rcc -name resource $< -o $@
obj-$(CONFIG_QT) += controllerform.o
+obj-$(CONFIG_QT) += dockingcontroller.o moc_dockingcontroller.o
obj-$(CONFIG_QT) += floatingcontroller.o moc_floatingcontroller.o
obj-$(CONFIG_QT) += displaybase.o
obj-$(CONFIG_QT) += displayglwidget.o moc_displayglwidget.o
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 $@
--- /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 <QtWidgets>
+
+#include "dockingcontroller.h"
+#include "mainwindow.h"
+
+DockingController::DockingController(ControllerForm *conForm, QGraphicsScene *conScene,
+ QAction *menu, QWidget *parent) : SkinControllerView(conForm, conScene, parent)
+{
+ this->conForm = conForm;
+ this->menu = menu;
+
+ setAttribute(Qt::WA_DeleteOnClose);
+ setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+}
+
+void DockingController::showEvent(QShowEvent *event)
+{
+ menu->setChecked(true);
+ //setRegion(conForm->conImg[ControllerForm::normal]);
+}
+
+void DockingController::closeEvent(QCloseEvent *event) {
+ menu->setChecked(false);
+
+ MainWindow *win = ((MainWindow *)this->parent());
+ win->getUIState()->conState.dockingCon = NULL;
+}
+
+void DockingController::setRegion(QImage baseImage)
+{
+ qDebug("set region");
+
+ /*
+ if (baseImage.isNull() == true) {
+ qWarning("invalid image for region");
+ return;
+ }
+
+ QImage region = baseImage.createAlphaMask();
+ setMask(QRegion(QBitmap::fromImage(region)));
+ */
+}
+
+DockingController::~DockingController()
+{
+ qDebug("destroy docking contoller");
+}
--- /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 DOCKINGCONTROLLER_H
+#define DOCKINGCONTROLLER_H
+
+#include <QDialog>
+
+#include "controllerform.h"
+#include "skincontrollerview.h"
+
+class DockingController : public SkinControllerView
+{
+ Q_OBJECT
+
+public:
+ explicit DockingController(ControllerForm *conForm, QGraphicsScene *conScene,
+ QAction *menu, QWidget *parent = 0);
+ ~DockingController();
+
+protected:
+ void showEvent(QShowEvent *event);
+ void closeEvent(QCloseEvent *event);
+
+ void setRegion(QImage baseImage);
+
+private:
+ ControllerForm *conForm;
+ QAction *menu;
+};
+
+#endif // DOCKINGCONTROLLER_H
FloatingController::~FloatingController()
{
- qDebug("destroy contoller");
+ qDebug("destroy floating contoller");
}
popupMenu = NULL;
skinView = NULL;
display = NULL;
- conView = NULL;
/* windowing */
setWindowTitle("Emulator");
return &(uiInfo->uiState);
}
+DockingController *MainWindow::getDockingCon()
+{
+ return getUIState()->conState.dockingCon;
+}
+
FloatingController *MainWindow::getFloatingCon()
{
return getUIState()->conState.floatingCon;
}
if (docking == true) {
+ QAction *action = (QAction *)popupMenu->getControllerMapper()->mapping(index);
conScene = new QGraphicsScene(this);
- conView = new SkinControllerView(conForm, conScene, this);
- conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ getUIState()->conState.dockingCon =
+ new DockingController(conForm, conScene, action, this);
- winLayout->addWidget(conView);
+ winLayout->addWidget(getDockingCon());
} else {
QAction *action = (QAction *)popupMenu->getControllerMapper()->mapping(index);
- getUIState()->conState.floatingCon = new FloatingController(conForm, action, this);
+ getUIState()->conState.floatingCon =
+ new FloatingController(conForm, action, this);
QPoint globalPos = mapToGlobal(QPoint(0, 0));
getFloatingCon()->move(globalPos.x() + size().width(), globalPos.y());
void MainWindow::closeController()
{
- if (conView != NULL) {
+ if (getDockingCon() != NULL) {
qDebug("close docking controller");
- conView->close();
- conScene->clear();
+ winLayout->removeWidget(getDockingCon());
+
+ getDockingCon()->close();
+ getUIState()->conState.dockingCon = NULL;
- delete conView;
- conView = NULL;
+ conScene->clear();
delete conScene;
conScene = NULL;
}
qDebug("close floating controller");
getFloatingCon()->close();
+ getUIState()->conState.floatingCon = NULL;
}
}
#include "skinbezelitem.h"
#include "uiinformation.h"
#include "skincontrollerview.h"
+#include "dockingcontroller.h"
#include "floatingcontroller.h"
extern "C" {
UIState *getUIState(void);
void rotate(int angle);
void scale(int scale);
+ DockingController *getDockingCon();
FloatingController *getFloatingCon();
void openController(int index, bool docking);
void closeController();
QHBoxLayout *winLayout;
QGraphicsScene *skinScene;
QGraphicsScene *conScene;
- ContextMenu *popupMenu;
SkinView* skinView;
DisplayBase *display;
- SkinControllerView *conView;
+ ContextMenu *popupMenu;
+
QThread *swapperThread;
DisplaySwapper *swapper;
};
#include <QtWidgets>
+#include "dockingcontroller.h"
#include "floatingcontroller.h"
class ControllerState
{
public:
+ DockingController *dockingCon;
FloatingController *floatingCon;
};