4 * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
7 * GiWoong Kim <giwoong.kim@samsung.com>
8 * Sangho Park <sangho1206.park@samsung.com>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 #include "dockingcontroller.h"
31 #include "mainwindow.h"
33 DockingController::DockingController(ControllerForm *conForm,
34 QAction *menu, int dockPos, QWidget *parent) : QWidget(parent)
36 this->win = (MainWindow *)parent;
37 this->conForm = conForm;
39 this->dockPos = dockPos;
41 setStyleSheet("background: transparent; border-style: none");
43 QGraphicsScene *conScene = new QGraphicsScene(this);
44 conScene->setBackgroundBrush(Qt::transparent);
46 conView = new DockingConView(this, conForm, conScene);
47 conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
48 conView->resize(conForm->skinImg[LayoutForm::normal].size());
51 ControllerForm *DockingController::getConForm()
56 DockingConView *DockingController::getConView()
61 MainWindow *DockingController::getMainWindow()
66 int DockingController::getDockPos()
71 void DockingController::updateGeometry()
73 const QSize mainSize = win->getUiInfo()->getMainSize();
74 const QSize conSize = win->getUiInfo()->getConSize();
78 if (mainSize.height() > conSize.height()) {
79 if (dockPos & Qt::AlignCenter) {
80 vShift = (mainSize.height() - conSize.height()) / 2;
81 } else if (dockPos & Qt::AlignBottom) {
82 vShift = mainSize.height() - conSize.height();
86 setGeometry(mainSize.width(), vShift, conSize.width(), conSize.height());
90 void DockingController::showEvent(QShowEvent *event)
92 qDebug("show docking controller");
97 menu->setChecked(true);
102 void DockingController::closeEvent(QCloseEvent *event) {
104 menu->setChecked(false);
107 win->getUiState()->getConState()->setDockingCon(NULL);
113 DockingController::~DockingController()
115 qDebug("destroy docking controller");