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
obj-$(CONFIG_QT) += hardwarekey.o
obj-$(CONFIG_QT) += mainwindow.o moc_mainwindow.o
obj-$(CONFIG_QT) += skinbezelitem.o
-obj-$(CONFIG_QT) += skincontrollerview.o
obj-$(CONFIG_QT) += skinkeyitem.o moc_skinkeyitem.o
obj-$(CONFIG_QT) += mainform.o
obj-$(CONFIG_QT) += keyboardhelper.o
#include "mainwindow.h"
DockingController::DockingController(ControllerForm *conForm, QGraphicsScene *conScene,
- QAction *menu, QWidget *parent) : SkinControllerView(conForm, conScene, parent)
+ QAction *menu, QWidget *parent) : DockingConView(conForm, conScene, parent)
{
this->conForm = conForm;
this->menu = menu;
void DockingController::showEvent(QShowEvent *event)
{
menu->setChecked(true);
- //setRegion(conForm->conImg[ControllerForm::normal]);
}
void DockingController::closeEvent(QCloseEvent *event) {
#include <QDialog>
#include "controllerform.h"
-#include "skincontrollerview.h"
+#include "dockingconview.h"
-class DockingController : public SkinControllerView
+class DockingController : public DockingConView
{
Q_OBJECT
--- /dev/null
+/*
+ * 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"
+
+DockingConView::DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent) :
+ QGraphicsView(scene, parent)
+{
+ setStyleSheet("background: transparent");
+ //setAttribute(Qt::WA_TranslucentBackground);
+ 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 */
+ SkinBezelItem *bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+ scene()->addItem(bezelItem);
+
+ /* HW keys */
+ QList<HardwareKey *> keyList = conForm->keyList;
+
+ HardwareKey *hwKey = NULL;
+ for (int i = 0; i < keyList.count(); i++) {
+ hwKey = keyList.at(i);
+ if (hwKey != NULL) {
+ new SkinKeyItem(conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
+ hwKey, bezelItem);
+ }
+ }
+}
+
+void DockingConView::resizeEvent(QResizeEvent *event)
+{
+ //qDebug("resize con view");
+
+ Q_UNUSED(event)
+}
+
+void DockingConView::mousePressEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ QWidget *win = ((QWidget *) this->parent());
+
+ grabPos = event->globalPos();
+ eventPos = event->pos();
+ rubberPos = win->pos() + this->pos();
+
+ if (rubberBand != NULL) {
+ rubberBand->setGeometry(QRect(rubberPos, size()));
+ rubberBand->show();
+ }
+ }
+
+ QGraphicsView::mousePressEvent(event);
+}
+
+void DockingConView::mouseReleaseEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ if (grabPos != QPoint(-1, -1)) {
+ if (rubberBand != NULL) {
+ rubberBand->hide();
+ }
+
+ MainWindow *win = ((MainWindow *)this->parent());
+ win->getUIState()->conState.recentlyFloatPos = event->globalPos() - eventPos;
+ win->openController(win->getUIState()->conState.conFormIndex, false);
+
+ grabPos = QPoint(-1, -1);
+ }
+ }
+
+ QGraphicsView::mouseReleaseEvent(event);
+}
+
+void DockingConView::mouseMoveEvent(QMouseEvent *event)
+{
+ if (grabPos != QPoint(-1, -1)) {
+ rubberBand->setGeometry(
+ QRect(rubberPos + (event->globalPos() - grabPos), size()));
+ }
+
+ QGraphicsView::mouseMoveEvent(event);
+}
+
+DockingConView::~DockingConView()
+{
+ qDebug("destroy docking controller view");
+
+ if (rubberBand != NULL) {
+ rubberBand->close();
+ delete rubberBand;
+ rubberBand = NULL;
+ }
+}
--- /dev/null
+/*
+ * 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 "controllerform.h"
+
+class DockingConView : public QGraphicsView
+{
+public:
+ DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
+ ~DockingConView();
+
+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);
+
+ QRubberBand *rubberBand;
+};
+
+#endif // DOCKINGCONVIEW_H
QGraphicsScene *conScene = new QGraphicsScene(this);
- conView = new SkinControllerView(conForm, conScene, this);
+ conView = new FloatingConView(conForm, conScene, this);
conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
layout->addWidget(conView);
}
#include <QDialog>
#include "controllerform.h"
-#include "skincontrollerview.h"
+#include "floatingconview.h"
class FloatingController : public QDialog
{
void setRegion(QImage baseImage);
private:
- SkinControllerView *conView;
+ FloatingConView *conView;
ControllerForm *conForm;
QAction *menu;
};
--- /dev/null
+/*
+ * 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"
+
+FloatingConView::FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent) :
+ QGraphicsView(scene, parent)
+{
+ setStyleSheet("background: transparent");
+ //setAttribute(Qt::WA_TranslucentBackground);
+ setStyleSheet("border-style: none");
+
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setAlignment(Qt::AlignLeft | Qt::AlignTop);
+
+ winPos = QPoint(-1, -1);
+ grabPos = QPoint(-1, -1);
+
+ createItems(conForm);
+}
+
+void FloatingConView::createItems(ControllerForm *conForm)
+{
+ /* bezel */
+ SkinBezelItem *bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+ scene()->addItem(bezelItem);
+
+ /* HW keys */
+ QList<HardwareKey *> keyList = conForm->keyList;
+
+ HardwareKey *hwKey = NULL;
+ for (int i = 0; i < keyList.count(); i++) {
+ hwKey = keyList.at(i);
+ if (hwKey != NULL) {
+ new SkinKeyItem(conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
+ hwKey, bezelItem);
+ }
+ }
+}
+
+void FloatingConView::resizeEvent(QResizeEvent *event)
+{
+ //qDebug("resize con view");
+
+ Q_UNUSED(event)
+}
+
+void FloatingConView::mousePressEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ QWidget *win = ((QWidget *) this->parent());
+
+ grabPos = event->globalPos();
+ winPos = win->pos();
+ }
+
+ QGraphicsView::mousePressEvent(event);
+}
+
+void FloatingConView::mouseReleaseEvent(QMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ grabPos = QPoint(-1, -1);
+ }
+
+ QGraphicsView::mouseReleaseEvent(event);
+}
+
+void FloatingConView::mouseMoveEvent(QMouseEvent *event)
+{
+ QWidget *win = ((QWidget *)this->parent());
+
+ if (grabPos != QPoint(-1, -1)) {
+ win->move(winPos + (event->globalPos() - grabPos));
+ }
+
+ QGraphicsView::mouseMoveEvent(event);
+}
+
+FloatingConView::~FloatingConView()
+{
+ qDebug("destroy floating controller view");
+}
--- /dev/null
+/*
+ * 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 "skinview.h"
+#include "controllerform.h"
+
+class FloatingConView : public QGraphicsView
+{
+public:
+ FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
+ ~FloatingConView();
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+
+ QPoint grabPos;
+ QPoint winPos;
+
+private:
+ void createItems(ControllerForm *conForm);
+};
+
+#endif // FLOATINGCONVIEW_H
if (docking == true) {
winLayout->addWidget(getDockingCon());
} else {
- QPoint globalPos = mapToGlobal(QPoint(0, 0));
- getFloatingCon()->move(globalPos.x() + size().width(), globalPos.y());
+ if (getUIState()->conState.recentlyFloatPos == QPoint(-1, -1)) {
+ QPoint globalPos = mapToGlobal(QPoint(0, 0));
+ getFloatingCon()->move(globalPos.x() + size().width(), globalPos.y());
+ } else {
+ getFloatingCon()->move(getUIState()->conState.recentlyFloatPos);
+ getUIState()->conState.recentlyFloatPos = QPoint(-1, -1);
+ }
+
getFloatingCon()->show();
}
}
#include "displaybase.h"
#include "skinbezelitem.h"
#include "uiinformation.h"
-#include "skincontrollerview.h"
#include "dockingcontroller.h"
#include "floatingcontroller.h"
qDebug("controller : %d", index);
MainWindow *win = ((MainWindow *)this->parent());
- win->openController(index, false);
+ win->openController(index, true);
}
void ContextMenu::slotShell()
+++ /dev/null
-/*
- * 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 "skincontrollerview.h"
-#include "mainwindow.h"
-#include "skinkeyitem.h"
-
-SkinControllerView::SkinControllerView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent) :
- QGraphicsView(scene, parent)
-{
- setStyleSheet("background: transparent");
- //setAttribute(Qt::WA_TranslucentBackground);
- setStyleSheet("border-style: none");
-
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setAlignment(Qt::AlignLeft | Qt::AlignTop);
-
- grabWinPos = QPoint(-1, -1);
- grabPos = QPoint(-1, -1);
-
- createItems(conForm);
-}
-
-void SkinControllerView::createItems(ControllerForm *conForm)
-{
- /* bezel */
- SkinBezelItem *bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
- scene()->addItem(bezelItem);
-
- /* HW keys */
- QList<HardwareKey *> keyList = conForm->keyList;
-
- HardwareKey *hwKey = NULL;
- for (int i = 0; i < keyList.count(); i++) {
- hwKey = keyList.at(i);
- if (hwKey != NULL) {
- new SkinKeyItem(conForm->conImg[ControllerForm::pressed].copy(hwKey->region),
- hwKey, bezelItem);
- }
- }
-}
-
-void SkinControllerView::resizeEvent(QResizeEvent *event)
-{
- //qDebug("resize con view");
-
- Q_UNUSED(event)
-}
-
-void SkinControllerView::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton) {
- QWidget *win = ((QWidget *) this->parent());
- grabWinPos = win->pos();
- grabPos = event->globalPos();
- }
-
- QGraphicsView::mousePressEvent(event);
-}
-
-void SkinControllerView::mouseReleaseEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton) {
- grabPos = QPoint(-1, -1);
- }
-
- QGraphicsView::mouseReleaseEvent(event);
-}
-
-void SkinControllerView::mouseMoveEvent(QMouseEvent *event)
-{
- QWidget *win = ((QWidget *)this->parent());
-
- if (grabPos != QPoint(-1, -1)) {
- win->move(grabWinPos + (event->globalPos() - grabPos));
- }
-
- QGraphicsView::mouseMoveEvent(event);
-}
-
-SkinControllerView::~SkinControllerView()
-{
- qDebug("destroy controller view");
-}
+++ /dev/null
-/*
- * 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 SKINCONTROLLERVIEW_H
-#define SKINCONTROLLERVIEW_H
-
-#include "skinview.h"
-#include "controllerform.h"
-
-class SkinControllerView : public QGraphicsView
-{
-public:
- SkinControllerView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
- ~SkinControllerView();
-
-protected:
- void resizeEvent(QResizeEvent *event);
-
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
-
- QPoint grabWinPos;
- QPoint grabPos;
-
-private:
- void createItems(ControllerForm *conForm);
-};
-
-#endif // SKINCONTROLLERVIEW_H
conState.conFormIndex = 0;
conState.dockingCon = NULL;
conState.floatingCon = NULL;
+ conState.recentlyFloatPos = QPoint(-1, -1);
}
int UIState::getMainFormIndex(int angle)
int conFormIndex;
DockingController *dockingCon;
FloatingController *floatingCon;
+ QPoint recentlyFloatPos;
};
class UIState