ui: move some controller files
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 31 Mar 2015 09:35:27 +0000 (18:35 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 31 Mar 2015 09:35:27 +0000 (18:35 +0900)
tizen/src/ui/ -> tizen/src/ui/controller/

Change-Id: I3496f9dcd48e7fbe167aa8ca7e9068c1672a11be
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
21 files changed:
tizen/src/display/qt5_supplement.cpp
tizen/src/ui/Makefile.objs
tizen/src/ui/controller/Makefile.objs
tizen/src/ui/controller/dockingcontroller.cpp [new file with mode: 0644]
tizen/src/ui/controller/dockingcontroller.h [new file with mode: 0644]
tizen/src/ui/controller/dockingconview.cpp [new file with mode: 0644]
tizen/src/ui/controller/dockingconview.h [new file with mode: 0644]
tizen/src/ui/controller/floatingcontroller.cpp [new file with mode: 0644]
tizen/src/ui/controller/floatingcontroller.h [new file with mode: 0644]
tizen/src/ui/controller/floatingconview.cpp [new file with mode: 0644]
tizen/src/ui/controller/floatingconview.h [new file with mode: 0644]
tizen/src/ui/dockingcontroller.cpp [deleted file]
tizen/src/ui/dockingcontroller.h [deleted file]
tizen/src/ui/dockingconview.cpp [deleted file]
tizen/src/ui/dockingconview.h [deleted file]
tizen/src/ui/floatingcontroller.cpp [deleted file]
tizen/src/ui/floatingcontroller.h [deleted file]
tizen/src/ui/floatingconview.cpp [deleted file]
tizen/src/ui/floatingconview.h [deleted file]
tizen/src/ui/mainwindow.h
tizen/src/ui/uistate.h

index 2a3489e539e3280c42a6f3ad9a2824c3a73e875c..7a4368ee0537d369c56858384df766936ffa3f79 100644 (file)
@@ -32,9 +32,7 @@
 
 #include "qt5_supplement.h"
 #include "mainwindow.h"
-#include "uiinformation.h"
 #include "hardwarekey.h"
-#include "floatingcontroller.h"
 #include "xmllayoutparser.h"
 #include "uiutil.h"
 
index 518a9140d8fba1f15cb24138cb972383f3c70661..499efb643acac52aca4a3f6fc83ed90a69036baa 100644 (file)
@@ -6,10 +6,6 @@ $(obj)/qrc_resource.cpp: $(TIZEN_UI)/resource/resource.qrc
        rcc -name resource $< -o $@
 
 obj-$(CONFIG_QT) += controllerform.o
-obj-$(CONFIG_QT) += dockingcontroller.o moc_dockingcontroller.o
-obj-$(CONFIG_QT) += dockingconview.o
-obj-$(CONFIG_QT) += floatingcontroller.o moc_floatingcontroller.o
-obj-$(CONFIG_QT) += floatingconview.o
 obj-$(CONFIG_QT) += displaybase.o
 obj-$(CONFIG_QT) += displayglwidget.o moc_displayglwidget.o
 obj-$(CONFIG_QT) += displayswwidget.o moc_displayswwidget.o
@@ -33,12 +29,6 @@ obj-$(CONFIG_QT) += qrc_resource.o
 obj-$(CONFIG_QT) += controller/
 obj-$(CONFIG_QT) += menu/
 
-$(obj)/moc_dockingcontroller.o: $(obj)/moc_dockingcontroller.cpp
-$(obj)/moc_dockingcontroller.cpp: $(obj)/dockingcontroller.h
-       moc $< -o $@
-$(obj)/moc_floatingcontroller.o: $(obj)/moc_floatingcontroller.cpp
-$(obj)/moc_floatingcontroller.cpp: $(obj)/floatingcontroller.h
-       moc $< -o $@
 $(obj)/moc_displayglwidget.o: $(obj)/moc_displayglwidget.cpp
 $(obj)/moc_displayglwidget.cpp: $(obj)/displayglwidget.h
        moc $< -o $@
index 81496144389cb7c95232ee7957ce69f7c253135b..2dd3fbb4681c38b93d8c8d2630daa4adb5a1173a 100644 (file)
@@ -1 +1,12 @@
-obj-$(CONFIG_QT) += generalpurposecon.o
\ No newline at end of file
+obj-$(CONFIG_QT) += dockingcontroller.o moc_dockingcontroller.o
+obj-$(CONFIG_QT) += dockingconview.o
+obj-$(CONFIG_QT) += floatingcontroller.o moc_floatingcontroller.o
+obj-$(CONFIG_QT) += floatingconview.o
+obj-$(CONFIG_QT) += generalpurposecon.o
+
+$(obj)/moc_dockingcontroller.o: $(obj)/moc_dockingcontroller.cpp
+$(obj)/moc_dockingcontroller.cpp: $(obj)/dockingcontroller.h
+       moc $< -o $@
+$(obj)/moc_floatingcontroller.o: $(obj)/moc_floatingcontroller.cpp
+$(obj)/moc_floatingcontroller.cpp: $(obj)/floatingcontroller.h
+       moc $< -o $@
\ No newline at end of file
diff --git a/tizen/src/ui/controller/dockingcontroller.cpp b/tizen/src/ui/controller/dockingcontroller.cpp
new file mode 100644 (file)
index 0000000..de5a135
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "dockingcontroller.h"
+#include "mainwindow.h"
+
+DockingController::DockingController(ControllerForm *conForm,
+    QAction *menu, int dockPos, QWidget *parent) : QWidget(parent)
+{
+    this->conForm = conForm;
+    this->menu = menu;
+    this->dockPos = dockPos;
+
+    setStyleSheet("border-style: none");
+    setAttribute(Qt::WA_DeleteOnClose);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setMargin(0);
+    layout->setSpacing(0);
+
+    if (dockPos & Qt::AlignCenter) {
+        layout->setAlignment(Qt::AlignCenter);
+    } else if (dockPos & Qt::AlignTop) {
+        layout->setAlignment(Qt::AlignTop);
+    } else if (dockPos & Qt::AlignBottom) {
+        layout->setAlignment(Qt::AlignBottom);
+    }
+
+    QGraphicsScene *conScene = new QGraphicsScene(this);
+    conScene->setBackgroundBrush(Qt::black);
+
+    conView = new DockingConView(conForm, conScene, this);
+    conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+    layout->addWidget(conView);
+}
+
+DockingConView *DockingController::getConView()
+{
+    return conView;
+}
+
+int DockingController::getDockPos()
+{
+    return dockPos;
+}
+
+void DockingController::showEvent(QShowEvent *event)
+{
+    if (menu != NULL) {
+        menu->setChecked(true);
+    }
+}
+
+void DockingController::closeEvent(QCloseEvent *event) {
+    if (menu != NULL) {
+        menu->setChecked(false);
+    }
+
+    MainWindow *win = ((MainWindow *)this->parent());
+    win->getUIState()->conState.dockingCon = NULL;
+}
+
+DockingController::~DockingController()
+{
+    qDebug("destroy docking controller");
+}
diff --git a/tizen/src/ui/controller/dockingcontroller.h b/tizen/src/ui/controller/dockingcontroller.h
new file mode 100644 (file)
index 0000000..a388030
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef DOCKINGCONTROLLER_H
+#define DOCKINGCONTROLLER_H
+
+#include <QDialog>
+
+#include "controllerform.h"
+#include "dockingconview.h"
+
+class DockingController : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit DockingController(ControllerForm *conForm,
+        QAction *menu, int dockPos, QWidget *parent = 0);
+    ~DockingController();
+
+    DockingConView *getConView();
+    int getDockPos();
+
+protected:
+    void showEvent(QShowEvent *event);
+    void closeEvent(QCloseEvent *event);
+
+private:
+    DockingConView *conView;
+    ControllerForm *conForm;
+    QAction *menu;
+    int dockPos;
+};
+
+#endif // DOCKINGCONTROLLER_H
diff --git a/tizen/src/ui/controller/dockingconview.cpp b/tizen/src/ui/controller/dockingconview.cpp
new file mode 100644 (file)
index 0000000..5ab54a5
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "dockingconview.h"
+#include "mainwindow.h"
+#include "skinkeyitem.h"
+#include "controller/generalpurposecon.h"
+
+DockingConView::DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
+    : QGraphicsView(scene, parent)
+{
+    this->parent = (DockingController *)parent;
+
+    setStyleSheet("background: transparent");
+    setStyleSheet("border-style: none");
+
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setAlignment(Qt::AlignLeft | Qt::AlignTop);
+
+    rubberPos = QPoint(-1, -1);
+    grabPos = QPoint(-1, -1);
+    rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
+
+    createItems(conForm);
+}
+
+void DockingConView::createItems(ControllerForm *conForm)
+{
+    /* bezel */
+    bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+    scene()->addItem(bezelItem);
+
+    /* HW keys */
+    keyList = conForm->keyList;
+
+    if (conForm->isGeneralPurpose() == false) {
+        HardwareKey *hwKey = NULL;
+        for (int i = 0; i < keyList.count(); i++) {
+            hwKey = keyList.at(i);
+            if (hwKey != NULL) {
+                new SkinKeyItem(bezelItem, hwKey,
+                    conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
+                    conForm->getHoverType());
+            }
+        }
+    } else {
+        GeneralPurposeCon *generalCon = new GeneralPurposeCon(this, keyList,
+            QSize(conForm->centerRect.width(),
+                conForm->centerRect.height() - (GPC_HEAD_SPACING + GPC_TAIL_SPACING)));
+        scene()->addWidget(generalCon);
+
+        QPoint topLeft = conForm->centerRect.topLeft();
+        generalCon->move(topLeft.x(), topLeft.y() + GPC_HEAD_SPACING);
+    }
+}
+
+void DockingConView::resizeEvent(QResizeEvent *event)
+{
+    Q_UNUSED(event)
+
+    /* do nothing */
+}
+
+void DockingConView::mousePressEvent(QMouseEvent *event)
+{
+    QGraphicsView::mousePressEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (event->button() == Qt::LeftButton) {
+        QWidget *win = parent->parentWidget();
+
+        grabPos = event->globalPos();
+        eventPos = event->pos();
+        rubberPos.setX(win->pos().x() + parent->pos().x());
+        rubberPos.setY(win->pos().y() + pos().y());
+
+        if (rubberBand != NULL) {
+            rubberBand->setGeometry(QRect(rubberPos, size()));
+            rubberBand->show();
+        }
+    }
+}
+
+void DockingConView::mouseReleaseEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseReleaseEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (event->button() == Qt::LeftButton) {
+        if (grabPos != QPoint(-1, -1)) {
+            if (rubberBand != NULL) {
+                rubberBand->hide();
+            }
+
+            /* toggle */
+            MainWindow *win = ((MainWindow *)parent->parent());
+            win->getUIState()->conState.recentlyFloatPos = event->globalPos() - eventPos;
+
+            win->openController(win->getUIState()->conState.conFormIndex, -1);
+            return;
+        }
+    }
+}
+
+void DockingConView::mouseMoveEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseMoveEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (grabPos != QPoint(-1, -1) && rubberBand != NULL) {
+        rubberBand->setGeometry(
+            QRect(rubberPos + (event->globalPos() - grabPos), size()));
+    }
+}
+
+QList<HardwareKey *> DockingConView::getKeyList()
+{
+    return keyList;
+}
+
+DockingConView::~DockingConView()
+{
+    qDebug("destroy docking controller view");
+
+    if (rubberBand != NULL) {
+        rubberBand->close();
+        delete rubberBand;
+        rubberBand = NULL;
+    }
+}
diff --git a/tizen/src/ui/controller/dockingconview.h b/tizen/src/ui/controller/dockingconview.h
new file mode 100644 (file)
index 0000000..9579b46
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef DOCKINGCONVIEW_H
+#define DOCKINGCONVIEW_H
+
+#include <QRubberBand>
+
+#include "skinview.h"
+#include "skinbezelitem.h"
+#include "controllerform.h"
+
+class DockingController;
+
+class DockingConView : public QGraphicsView
+{
+public:
+    DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
+    ~DockingConView();
+    QList<HardwareKey *> getKeyList();
+
+protected:
+    void resizeEvent(QResizeEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+    void mouseReleaseEvent(QMouseEvent *event);
+    void mouseMoveEvent(QMouseEvent *event);
+
+    QPoint grabPos;
+    QPoint eventPos;
+    QPoint rubberPos;
+
+private:
+    void createItems(ControllerForm *conForm);
+
+    DockingController *parent;
+    SkinBezelItem *bezelItem;
+    QRubberBand *rubberBand;
+    QList<HardwareKey *> keyList;
+};
+
+#endif // DOCKINGCONVIEW_H
diff --git a/tizen/src/ui/controller/floatingcontroller.cpp b/tizen/src/ui/controller/floatingcontroller.cpp
new file mode 100644 (file)
index 0000000..23aff1e
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "floatingcontroller.h"
+#include "mainwindow.h"
+
+FloatingController::FloatingController(ControllerForm *conForm,
+    QAction *menu, QWidget *parent) : QDialog(parent)
+{
+    this->conForm = conForm;
+    this->menu = menu;
+
+    setStyleSheet("border-style: none");
+    setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
+    setAttribute(Qt::WA_DeleteOnClose);
+
+    setWindowTitle(conForm->getName());
+
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setMargin(0);
+    layout->setSpacing(0);
+
+    QGraphicsScene *conScene = new QGraphicsScene(this);
+    conScene->setBackgroundBrush(Qt::black);
+
+    conView = new FloatingConView(conForm, conScene, this);
+    conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+    layout->addWidget(conView);
+}
+
+FloatingConView *FloatingController::getConView()
+{
+    return conView;
+}
+
+void FloatingController::showEvent(QShowEvent *event)
+{
+    if (menu != NULL) {
+        menu->setChecked(true);
+    }
+
+    setRegion(&(conForm->conImg[ControllerForm::normal]));
+}
+
+void FloatingController::closeEvent(QCloseEvent *event) {
+    if (menu != NULL) {
+        menu->setChecked(false);
+    }
+
+    MainWindow *win = ((MainWindow *)this->parent());
+    win->getUIState()->conState.floatingCon = NULL;
+}
+
+void FloatingController::setRegion(QImage *baseImage)
+{
+    qDebug("set region");
+
+    if (baseImage->isNull() == true) {
+        qWarning("invalid image for region");
+        return;
+    }
+
+    setMask(QRegion(QBitmap::fromImage(baseImage->createAlphaMask())));
+}
+
+FloatingController::~FloatingController()
+{
+    qDebug("destroy floating controller");
+}
diff --git a/tizen/src/ui/controller/floatingcontroller.h b/tizen/src/ui/controller/floatingcontroller.h
new file mode 100644 (file)
index 0000000..d9e7bf5
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef FLOATINGCONTROLLER_H
+#define FLOATINGCONTROLLER_H
+
+#include <QDialog>
+
+#include "controllerform.h"
+#include "floatingconview.h"
+
+class FloatingController : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit FloatingController(ControllerForm *conForm, QAction *menu, QWidget *parent = 0);
+    ~FloatingController();
+
+    FloatingConView *getConView();
+
+protected:
+    void showEvent(QShowEvent *event);
+    void closeEvent(QCloseEvent *event);
+
+    void setRegion(QImage *baseImage);
+
+private:
+    FloatingConView *conView;
+    ControllerForm *conForm;
+    QAction *menu;
+};
+
+#endif // FLOATINGCONTROLLER_H
diff --git a/tizen/src/ui/controller/floatingconview.cpp b/tizen/src/ui/controller/floatingconview.cpp
new file mode 100644 (file)
index 0000000..28bb576
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "floatingconview.h"
+#include "mainwindow.h"
+#include "skinkeyitem.h"
+#include "controller/generalpurposecon.h"
+
+#define DOCKABLE_AREA_WIDTH 30
+
+FloatingConView::FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
+    : QGraphicsView(scene, parent)
+{
+    this->parent = (FloatingController *)parent;
+
+    setStyleSheet("background: transparent");
+    setStyleSheet("border-style: none");
+
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setAlignment(Qt::AlignLeft | Qt::AlignTop);
+
+    conPos = QPoint(-1, -1);
+    grabPos = QPoint(-1, -1);
+    rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
+
+    createItems(conForm);
+}
+
+void FloatingConView::createItems(ControllerForm *conForm)
+{
+    /* bezel */
+    bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+    scene()->addItem(bezelItem);
+
+    /* HW keys */
+    keyList = conForm->keyList;
+
+    if (conForm->isGeneralPurpose() == false) {
+        HardwareKey *hwKey = NULL;
+        for (int i = 0; i < keyList.count(); i++) {
+            hwKey = keyList.at(i);
+            if (hwKey != NULL) {
+                new SkinKeyItem(bezelItem, hwKey,
+                    conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
+                    conForm->getHoverType());
+            }
+        }
+    } else {
+        GeneralPurposeCon *generalCon = new GeneralPurposeCon(this, keyList,
+            QSize(conForm->centerRect.width(),
+                conForm->centerRect.height() - (GPC_HEAD_SPACING + GPC_TAIL_SPACING)));
+        scene()->addWidget(generalCon);
+
+        QPoint topLeft = conForm->centerRect.topLeft();
+            generalCon->move(topLeft.x(), topLeft.y() + GPC_HEAD_SPACING);
+    }
+}
+
+void FloatingConView::resizeEvent(QResizeEvent *event)
+{
+    //qDebug("resize con view");
+
+    Q_UNUSED(event)
+}
+
+int FloatingConView::isDockable(QWidget *object, QWidget *subject)
+{
+    const int heightOneThird = object->size().height() / 3;
+
+    /* MainWindow */
+    QRect rectDockableRC(object->pos().x() + object->size().width() - 1,
+        object->pos().y() + heightOneThird,
+        DOCKABLE_AREA_WIDTH,
+        heightOneThird);
+
+    QRect rectDockableRT(object->pos().x() + object->size().width() - 1,
+            object->pos().y(),
+            DOCKABLE_AREA_WIDTH,
+            heightOneThird);
+
+    QRect rectDockableRB(object->pos().x() + object->size().width() - 1,
+            object->pos().y() + (heightOneThird * 2),
+            DOCKABLE_AREA_WIDTH,
+            heightOneThird);
+
+    /* ControllerWidget */
+    QRect rectTarget(subject->pos().x() - 1,
+        subject->pos().y(),
+        DOCKABLE_AREA_WIDTH,
+        subject->size().height());
+
+    // TODO: define recursive function
+    QRect interRC = rectTarget.intersected(rectDockableRC);
+    QRect interRT = rectTarget.intersected(rectDockableRT);
+    QRect interRB = rectTarget.intersected(rectDockableRB);
+
+    QRect *interBiggest = NULL;
+
+    if ((interRC.width() * interRC.height()) < (interRT.width() * interRT.height())) {
+        interBiggest = &interRT;
+    } else {
+        interBiggest = &interRC;
+    }
+
+    if ((interBiggest->width() * interBiggest->height()) < (interRB.width() * interRB.height())) {
+        interBiggest = &interRB;
+    }
+
+    if (interBiggest != NULL &&
+        interBiggest->isNull() == false && interBiggest->isEmpty() == false) {
+        if (interBiggest == &interRC) {
+            return Qt::AlignRight | Qt::AlignCenter;
+        } else if (interBiggest == &interRT) {
+            return Qt::AlignRight | Qt::AlignTop;
+        } else if (interBiggest == &interRB) {
+            return Qt::AlignRight | Qt::AlignBottom;
+        }
+    }
+
+    return -1;
+}
+
+void FloatingConView::mousePressEvent(QMouseEvent *event)
+{
+    QGraphicsView::mousePressEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (event->button() == Qt::LeftButton) {
+        grabPos = event->globalPos();
+        conPos = parent->pos();
+    }
+}
+
+void FloatingConView::mouseReleaseEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseReleaseEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (event->button() == Qt::LeftButton) {
+        grabPos = QPoint(-1, -1);
+        if (rubberBand != NULL) {
+            rubberBand->hide();
+        }
+    }
+
+    const FloatingController *con = parent;
+    MainWindow *win = ((MainWindow *)con->parent());
+
+    int dockPos = isDockable((QWidget *)win, (QWidget *)parent);
+    if (dockPos != -1) {
+        /* toggle */
+        win->openController(win->getUIState()->conState.conFormIndex, dockPos);
+        return;
+    }
+}
+
+void FloatingConView::mouseMoveEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseMoveEvent(event);
+
+    if (bezelItem->isHWKeyHandling() == true) {
+        /* do nothing */
+        return;
+    }
+
+    if (grabPos != QPoint(-1, -1)) {
+        /* draw guide for dockable position */
+        const FloatingController *con = parent;
+        MainWindow *win = ((MainWindow *)con->parent());
+
+        if (rubberBand != NULL) {
+            int dockPos = isDockable((QWidget *)win, (QWidget *)con);
+            if (dockPos != -1) {
+                int vShift = 0;
+
+                if (win->size().height() > size().height()) {
+                    if (dockPos & Qt::AlignCenter) {
+                        vShift = (win->size().height() / 2) - (size().height() / 2);
+                    } else if (dockPos & Qt::AlignBottom) {
+                        vShift = win->size().height() - size().height();
+                    }
+                }
+
+                QPoint rubberPos(win->pos().x() + win->size().width(),
+                    win->pos().y() + vShift);
+                rubberBand->setGeometry(QRect(rubberPos, size()));
+                rubberBand->show();
+            } else {
+                rubberBand->hide();
+            }
+        }
+
+        parent->move(conPos + (event->globalPos() - grabPos));
+    }
+}
+
+QList<HardwareKey *> FloatingConView::getKeyList()
+{
+    return keyList;
+}
+
+FloatingConView::~FloatingConView()
+{
+    qDebug("destroy floating controller view");
+
+    if (rubberBand != NULL) {
+        rubberBand->close();
+        delete rubberBand;
+        rubberBand = NULL;
+    }
+}
diff --git a/tizen/src/ui/controller/floatingconview.h b/tizen/src/ui/controller/floatingconview.h
new file mode 100644 (file)
index 0000000..164e964
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef FLOATINGCONVIEW_H
+#define FLOATINGCONVIEW_H
+
+#include <QRubberBand>
+
+#include "skinview.h"
+#include "skinbezelitem.h"
+#include "controllerform.h"
+
+class FloatingController;
+
+class FloatingConView : public QGraphicsView
+{
+public:
+    FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
+    ~FloatingConView();
+    QList<HardwareKey *> getKeyList();
+
+protected:
+    void resizeEvent(QResizeEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+    void mouseReleaseEvent(QMouseEvent *event);
+    void mouseMoveEvent(QMouseEvent *event);
+
+    int isDockable(QWidget *object, QWidget *subject);
+
+    QPoint grabPos;
+    QPoint conPos;
+
+private:
+    void createItems(ControllerForm *conForm);
+
+    FloatingController *parent;
+    SkinBezelItem *bezelItem;
+    QRubberBand *rubberBand;
+    QList<HardwareKey *> keyList;
+};
+
+#endif // FLOATINGCONVIEW_H
diff --git a/tizen/src/ui/dockingcontroller.cpp b/tizen/src/ui/dockingcontroller.cpp
deleted file mode 100644 (file)
index de5a135..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "dockingcontroller.h"
-#include "mainwindow.h"
-
-DockingController::DockingController(ControllerForm *conForm,
-    QAction *menu, int dockPos, QWidget *parent) : QWidget(parent)
-{
-    this->conForm = conForm;
-    this->menu = menu;
-    this->dockPos = dockPos;
-
-    setStyleSheet("border-style: none");
-    setAttribute(Qt::WA_DeleteOnClose);
-
-    QVBoxLayout *layout = new QVBoxLayout(this);
-    layout->setMargin(0);
-    layout->setSpacing(0);
-
-    if (dockPos & Qt::AlignCenter) {
-        layout->setAlignment(Qt::AlignCenter);
-    } else if (dockPos & Qt::AlignTop) {
-        layout->setAlignment(Qt::AlignTop);
-    } else if (dockPos & Qt::AlignBottom) {
-        layout->setAlignment(Qt::AlignBottom);
-    }
-
-    QGraphicsScene *conScene = new QGraphicsScene(this);
-    conScene->setBackgroundBrush(Qt::black);
-
-    conView = new DockingConView(conForm, conScene, this);
-    conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-    layout->addWidget(conView);
-}
-
-DockingConView *DockingController::getConView()
-{
-    return conView;
-}
-
-int DockingController::getDockPos()
-{
-    return dockPos;
-}
-
-void DockingController::showEvent(QShowEvent *event)
-{
-    if (menu != NULL) {
-        menu->setChecked(true);
-    }
-}
-
-void DockingController::closeEvent(QCloseEvent *event) {
-    if (menu != NULL) {
-        menu->setChecked(false);
-    }
-
-    MainWindow *win = ((MainWindow *)this->parent());
-    win->getUIState()->conState.dockingCon = NULL;
-}
-
-DockingController::~DockingController()
-{
-    qDebug("destroy docking controller");
-}
diff --git a/tizen/src/ui/dockingcontroller.h b/tizen/src/ui/dockingcontroller.h
deleted file mode 100644 (file)
index a388030..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef DOCKINGCONTROLLER_H
-#define DOCKINGCONTROLLER_H
-
-#include <QDialog>
-
-#include "controllerform.h"
-#include "dockingconview.h"
-
-class DockingController : public QWidget
-{
-    Q_OBJECT
-
-public:
-    explicit DockingController(ControllerForm *conForm,
-        QAction *menu, int dockPos, QWidget *parent = 0);
-    ~DockingController();
-
-    DockingConView *getConView();
-    int getDockPos();
-
-protected:
-    void showEvent(QShowEvent *event);
-    void closeEvent(QCloseEvent *event);
-
-private:
-    DockingConView *conView;
-    ControllerForm *conForm;
-    QAction *menu;
-    int dockPos;
-};
-
-#endif // DOCKINGCONTROLLER_H
diff --git a/tizen/src/ui/dockingconview.cpp b/tizen/src/ui/dockingconview.cpp
deleted file mode 100644 (file)
index 5ab54a5..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "dockingconview.h"
-#include "mainwindow.h"
-#include "skinkeyitem.h"
-#include "controller/generalpurposecon.h"
-
-DockingConView::DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
-    : QGraphicsView(scene, parent)
-{
-    this->parent = (DockingController *)parent;
-
-    setStyleSheet("background: transparent");
-    setStyleSheet("border-style: none");
-
-    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setAlignment(Qt::AlignLeft | Qt::AlignTop);
-
-    rubberPos = QPoint(-1, -1);
-    grabPos = QPoint(-1, -1);
-    rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
-
-    createItems(conForm);
-}
-
-void DockingConView::createItems(ControllerForm *conForm)
-{
-    /* bezel */
-    bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
-    scene()->addItem(bezelItem);
-
-    /* HW keys */
-    keyList = conForm->keyList;
-
-    if (conForm->isGeneralPurpose() == false) {
-        HardwareKey *hwKey = NULL;
-        for (int i = 0; i < keyList.count(); i++) {
-            hwKey = keyList.at(i);
-            if (hwKey != NULL) {
-                new SkinKeyItem(bezelItem, hwKey,
-                    conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
-                    conForm->getHoverType());
-            }
-        }
-    } else {
-        GeneralPurposeCon *generalCon = new GeneralPurposeCon(this, keyList,
-            QSize(conForm->centerRect.width(),
-                conForm->centerRect.height() - (GPC_HEAD_SPACING + GPC_TAIL_SPACING)));
-        scene()->addWidget(generalCon);
-
-        QPoint topLeft = conForm->centerRect.topLeft();
-        generalCon->move(topLeft.x(), topLeft.y() + GPC_HEAD_SPACING);
-    }
-}
-
-void DockingConView::resizeEvent(QResizeEvent *event)
-{
-    Q_UNUSED(event)
-
-    /* do nothing */
-}
-
-void DockingConView::mousePressEvent(QMouseEvent *event)
-{
-    QGraphicsView::mousePressEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (event->button() == Qt::LeftButton) {
-        QWidget *win = parent->parentWidget();
-
-        grabPos = event->globalPos();
-        eventPos = event->pos();
-        rubberPos.setX(win->pos().x() + parent->pos().x());
-        rubberPos.setY(win->pos().y() + pos().y());
-
-        if (rubberBand != NULL) {
-            rubberBand->setGeometry(QRect(rubberPos, size()));
-            rubberBand->show();
-        }
-    }
-}
-
-void DockingConView::mouseReleaseEvent(QMouseEvent *event)
-{
-    QGraphicsView::mouseReleaseEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (event->button() == Qt::LeftButton) {
-        if (grabPos != QPoint(-1, -1)) {
-            if (rubberBand != NULL) {
-                rubberBand->hide();
-            }
-
-            /* toggle */
-            MainWindow *win = ((MainWindow *)parent->parent());
-            win->getUIState()->conState.recentlyFloatPos = event->globalPos() - eventPos;
-
-            win->openController(win->getUIState()->conState.conFormIndex, -1);
-            return;
-        }
-    }
-}
-
-void DockingConView::mouseMoveEvent(QMouseEvent *event)
-{
-    QGraphicsView::mouseMoveEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (grabPos != QPoint(-1, -1) && rubberBand != NULL) {
-        rubberBand->setGeometry(
-            QRect(rubberPos + (event->globalPos() - grabPos), size()));
-    }
-}
-
-QList<HardwareKey *> DockingConView::getKeyList()
-{
-    return keyList;
-}
-
-DockingConView::~DockingConView()
-{
-    qDebug("destroy docking controller view");
-
-    if (rubberBand != NULL) {
-        rubberBand->close();
-        delete rubberBand;
-        rubberBand = NULL;
-    }
-}
diff --git a/tizen/src/ui/dockingconview.h b/tizen/src/ui/dockingconview.h
deleted file mode 100644 (file)
index 9579b46..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef DOCKINGCONVIEW_H
-#define DOCKINGCONVIEW_H
-
-#include <QRubberBand>
-
-#include "skinview.h"
-#include "skinbezelitem.h"
-#include "controllerform.h"
-
-class DockingController;
-
-class DockingConView : public QGraphicsView
-{
-public:
-    DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
-    ~DockingConView();
-    QList<HardwareKey *> getKeyList();
-
-protected:
-    void resizeEvent(QResizeEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    void mouseReleaseEvent(QMouseEvent *event);
-    void mouseMoveEvent(QMouseEvent *event);
-
-    QPoint grabPos;
-    QPoint eventPos;
-    QPoint rubberPos;
-
-private:
-    void createItems(ControllerForm *conForm);
-
-    DockingController *parent;
-    SkinBezelItem *bezelItem;
-    QRubberBand *rubberBand;
-    QList<HardwareKey *> keyList;
-};
-
-#endif // DOCKINGCONVIEW_H
diff --git a/tizen/src/ui/floatingcontroller.cpp b/tizen/src/ui/floatingcontroller.cpp
deleted file mode 100644 (file)
index 23aff1e..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "floatingcontroller.h"
-#include "mainwindow.h"
-
-FloatingController::FloatingController(ControllerForm *conForm,
-    QAction *menu, QWidget *parent) : QDialog(parent)
-{
-    this->conForm = conForm;
-    this->menu = menu;
-
-    setStyleSheet("border-style: none");
-    setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
-    setAttribute(Qt::WA_DeleteOnClose);
-
-    setWindowTitle(conForm->getName());
-
-    QHBoxLayout *layout = new QHBoxLayout(this);
-    layout->setMargin(0);
-    layout->setSpacing(0);
-
-    QGraphicsScene *conScene = new QGraphicsScene(this);
-    conScene->setBackgroundBrush(Qt::black);
-
-    conView = new FloatingConView(conForm, conScene, this);
-    conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-    layout->addWidget(conView);
-}
-
-FloatingConView *FloatingController::getConView()
-{
-    return conView;
-}
-
-void FloatingController::showEvent(QShowEvent *event)
-{
-    if (menu != NULL) {
-        menu->setChecked(true);
-    }
-
-    setRegion(&(conForm->conImg[ControllerForm::normal]));
-}
-
-void FloatingController::closeEvent(QCloseEvent *event) {
-    if (menu != NULL) {
-        menu->setChecked(false);
-    }
-
-    MainWindow *win = ((MainWindow *)this->parent());
-    win->getUIState()->conState.floatingCon = NULL;
-}
-
-void FloatingController::setRegion(QImage *baseImage)
-{
-    qDebug("set region");
-
-    if (baseImage->isNull() == true) {
-        qWarning("invalid image for region");
-        return;
-    }
-
-    setMask(QRegion(QBitmap::fromImage(baseImage->createAlphaMask())));
-}
-
-FloatingController::~FloatingController()
-{
-    qDebug("destroy floating controller");
-}
diff --git a/tizen/src/ui/floatingcontroller.h b/tizen/src/ui/floatingcontroller.h
deleted file mode 100644 (file)
index d9e7bf5..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef FLOATINGCONTROLLER_H
-#define FLOATINGCONTROLLER_H
-
-#include <QDialog>
-
-#include "controllerform.h"
-#include "floatingconview.h"
-
-class FloatingController : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit FloatingController(ControllerForm *conForm, QAction *menu, QWidget *parent = 0);
-    ~FloatingController();
-
-    FloatingConView *getConView();
-
-protected:
-    void showEvent(QShowEvent *event);
-    void closeEvent(QCloseEvent *event);
-
-    void setRegion(QImage *baseImage);
-
-private:
-    FloatingConView *conView;
-    ControllerForm *conForm;
-    QAction *menu;
-};
-
-#endif // FLOATINGCONTROLLER_H
diff --git a/tizen/src/ui/floatingconview.cpp b/tizen/src/ui/floatingconview.cpp
deleted file mode 100644 (file)
index 28bb576..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "floatingconview.h"
-#include "mainwindow.h"
-#include "skinkeyitem.h"
-#include "controller/generalpurposecon.h"
-
-#define DOCKABLE_AREA_WIDTH 30
-
-FloatingConView::FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
-    : QGraphicsView(scene, parent)
-{
-    this->parent = (FloatingController *)parent;
-
-    setStyleSheet("background: transparent");
-    setStyleSheet("border-style: none");
-
-    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    setAlignment(Qt::AlignLeft | Qt::AlignTop);
-
-    conPos = QPoint(-1, -1);
-    grabPos = QPoint(-1, -1);
-    rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
-
-    createItems(conForm);
-}
-
-void FloatingConView::createItems(ControllerForm *conForm)
-{
-    /* bezel */
-    bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
-    scene()->addItem(bezelItem);
-
-    /* HW keys */
-    keyList = conForm->keyList;
-
-    if (conForm->isGeneralPurpose() == false) {
-        HardwareKey *hwKey = NULL;
-        for (int i = 0; i < keyList.count(); i++) {
-            hwKey = keyList.at(i);
-            if (hwKey != NULL) {
-                new SkinKeyItem(bezelItem, hwKey,
-                    conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
-                    conForm->getHoverType());
-            }
-        }
-    } else {
-        GeneralPurposeCon *generalCon = new GeneralPurposeCon(this, keyList,
-            QSize(conForm->centerRect.width(),
-                conForm->centerRect.height() - (GPC_HEAD_SPACING + GPC_TAIL_SPACING)));
-        scene()->addWidget(generalCon);
-
-        QPoint topLeft = conForm->centerRect.topLeft();
-            generalCon->move(topLeft.x(), topLeft.y() + GPC_HEAD_SPACING);
-    }
-}
-
-void FloatingConView::resizeEvent(QResizeEvent *event)
-{
-    //qDebug("resize con view");
-
-    Q_UNUSED(event)
-}
-
-int FloatingConView::isDockable(QWidget *object, QWidget *subject)
-{
-    const int heightOneThird = object->size().height() / 3;
-
-    /* MainWindow */
-    QRect rectDockableRC(object->pos().x() + object->size().width() - 1,
-        object->pos().y() + heightOneThird,
-        DOCKABLE_AREA_WIDTH,
-        heightOneThird);
-
-    QRect rectDockableRT(object->pos().x() + object->size().width() - 1,
-            object->pos().y(),
-            DOCKABLE_AREA_WIDTH,
-            heightOneThird);
-
-    QRect rectDockableRB(object->pos().x() + object->size().width() - 1,
-            object->pos().y() + (heightOneThird * 2),
-            DOCKABLE_AREA_WIDTH,
-            heightOneThird);
-
-    /* ControllerWidget */
-    QRect rectTarget(subject->pos().x() - 1,
-        subject->pos().y(),
-        DOCKABLE_AREA_WIDTH,
-        subject->size().height());
-
-    // TODO: define recursive function
-    QRect interRC = rectTarget.intersected(rectDockableRC);
-    QRect interRT = rectTarget.intersected(rectDockableRT);
-    QRect interRB = rectTarget.intersected(rectDockableRB);
-
-    QRect *interBiggest = NULL;
-
-    if ((interRC.width() * interRC.height()) < (interRT.width() * interRT.height())) {
-        interBiggest = &interRT;
-    } else {
-        interBiggest = &interRC;
-    }
-
-    if ((interBiggest->width() * interBiggest->height()) < (interRB.width() * interRB.height())) {
-        interBiggest = &interRB;
-    }
-
-    if (interBiggest != NULL &&
-        interBiggest->isNull() == false && interBiggest->isEmpty() == false) {
-        if (interBiggest == &interRC) {
-            return Qt::AlignRight | Qt::AlignCenter;
-        } else if (interBiggest == &interRT) {
-            return Qt::AlignRight | Qt::AlignTop;
-        } else if (interBiggest == &interRB) {
-            return Qt::AlignRight | Qt::AlignBottom;
-        }
-    }
-
-    return -1;
-}
-
-void FloatingConView::mousePressEvent(QMouseEvent *event)
-{
-    QGraphicsView::mousePressEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (event->button() == Qt::LeftButton) {
-        grabPos = event->globalPos();
-        conPos = parent->pos();
-    }
-}
-
-void FloatingConView::mouseReleaseEvent(QMouseEvent *event)
-{
-    QGraphicsView::mouseReleaseEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (event->button() == Qt::LeftButton) {
-        grabPos = QPoint(-1, -1);
-        if (rubberBand != NULL) {
-            rubberBand->hide();
-        }
-    }
-
-    const FloatingController *con = parent;
-    MainWindow *win = ((MainWindow *)con->parent());
-
-    int dockPos = isDockable((QWidget *)win, (QWidget *)parent);
-    if (dockPos != -1) {
-        /* toggle */
-        win->openController(win->getUIState()->conState.conFormIndex, dockPos);
-        return;
-    }
-}
-
-void FloatingConView::mouseMoveEvent(QMouseEvent *event)
-{
-    QGraphicsView::mouseMoveEvent(event);
-
-    if (bezelItem->isHWKeyHandling() == true) {
-        /* do nothing */
-        return;
-    }
-
-    if (grabPos != QPoint(-1, -1)) {
-        /* draw guide for dockable position */
-        const FloatingController *con = parent;
-        MainWindow *win = ((MainWindow *)con->parent());
-
-        if (rubberBand != NULL) {
-            int dockPos = isDockable((QWidget *)win, (QWidget *)con);
-            if (dockPos != -1) {
-                int vShift = 0;
-
-                if (win->size().height() > size().height()) {
-                    if (dockPos & Qt::AlignCenter) {
-                        vShift = (win->size().height() / 2) - (size().height() / 2);
-                    } else if (dockPos & Qt::AlignBottom) {
-                        vShift = win->size().height() - size().height();
-                    }
-                }
-
-                QPoint rubberPos(win->pos().x() + win->size().width(),
-                    win->pos().y() + vShift);
-                rubberBand->setGeometry(QRect(rubberPos, size()));
-                rubberBand->show();
-            } else {
-                rubberBand->hide();
-            }
-        }
-
-        parent->move(conPos + (event->globalPos() - grabPos));
-    }
-}
-
-QList<HardwareKey *> FloatingConView::getKeyList()
-{
-    return keyList;
-}
-
-FloatingConView::~FloatingConView()
-{
-    qDebug("destroy floating controller view");
-
-    if (rubberBand != NULL) {
-        rubberBand->close();
-        delete rubberBand;
-        rubberBand = NULL;
-    }
-}
diff --git a/tizen/src/ui/floatingconview.h b/tizen/src/ui/floatingconview.h
deleted file mode 100644 (file)
index 164e964..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef FLOATINGCONVIEW_H
-#define FLOATINGCONVIEW_H
-
-#include <QRubberBand>
-
-#include "skinview.h"
-#include "skinbezelitem.h"
-#include "controllerform.h"
-
-class FloatingController;
-
-class FloatingConView : public QGraphicsView
-{
-public:
-    FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
-    ~FloatingConView();
-    QList<HardwareKey *> getKeyList();
-
-protected:
-    void resizeEvent(QResizeEvent *event);
-    void mousePressEvent(QMouseEvent *event);
-    void mouseReleaseEvent(QMouseEvent *event);
-    void mouseMoveEvent(QMouseEvent *event);
-
-    int isDockable(QWidget *object, QWidget *subject);
-
-    QPoint grabPos;
-    QPoint conPos;
-
-private:
-    void createItems(ControllerForm *conForm);
-
-    FloatingController *parent;
-    SkinBezelItem *bezelItem;
-    QRubberBand *rubberBand;
-    QList<HardwareKey *> keyList;
-};
-
-#endif // FLOATINGCONVIEW_H
index cd31462264d5de88125a91ac3fb1ac0f4ba00173..93fdc31524b7052a672267b32bccde964adc6ff3 100644 (file)
@@ -41,8 +41,8 @@
 #include "displaybase.h"
 #include "skinbezelitem.h"
 #include "uiinformation.h"
-#include "dockingcontroller.h"
-#include "floatingcontroller.h"
+#include "controller/dockingcontroller.h"
+#include "controller/floatingcontroller.h"
 #include "keyboardshortcut.h"
 
 extern "C" {
index a77e9c507d17b29eb3054203daae5a8ea0d7cfeb..9d0bf0dbe98cc8ea07c517dc962eb2f37c0c0b27 100644 (file)
@@ -30,8 +30,8 @@
 #ifndef UISTATE_H
 #define UISTATE_H
 
-#include "dockingcontroller.h"
-#include "floatingcontroller.h"
+#include "controller/dockingcontroller.h"
+#include "controller/floatingcontroller.h"
 
 class ControllerState
 {