From: GiWoong Kim Date: Tue, 14 Oct 2014 10:06:49 +0000 (+0900) Subject: controller: control the controller position X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c52c034f0336fdfa436dd094bef967fb87270db9;p=sdk%2Femulator%2Fqemu.git controller: control the controller position remember the last position and state of controller read MRU position values from .skin.properties Change-Id: Ie135f4158c903e272440c3f223178425e221fc20 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 422cd8a8b4..5a362bf93f 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -62,6 +62,7 @@ static UIInformation *uiInfo; #define SKIN_PROPERTY_WINDOW_Y "window.y" #define SKIN_PROPERTY_WINDOW_SCALE "window.scale" #define SKIN_PROPERTY_CONTROLLER_INDEX "controller.index" +#define SKIN_PROPERTY_CONTROLLER_DOCK "controller.dock" #define SKIN_INFO_FILE_NAME "info.ini" #define FORM_FILE_NAME "layout.qml" @@ -117,7 +118,7 @@ void qt5_gui_init(void) qDebug("previous scale value is %d", scale); if (scale <= 0) { - scale = 50; + scale = 50; /* default scale */ } uiInfo->uiState.mainFormScale = scale; @@ -185,7 +186,12 @@ void qt5_gui_init(void) int conIndex = mruInfo.value(SKIN_PROPERTY_CONTROLLER_INDEX).toInt(); if (conIndex >= 0 && conIndex < uiInfo->conFormList.count()) { - mainwindow->openController(conIndex, Qt::AlignRight | Qt::AlignCenter); + int conDockPos = mruInfo.value(SKIN_PROPERTY_CONTROLLER_DOCK).toInt(); + if (conDockPos <= 0) { + conDockPos = Qt::AlignRight | Qt::AlignCenter; + } + + mainwindow->openController(conIndex, conDockPos); } mainwindow->startSwapper(); @@ -203,6 +209,14 @@ void qt5_destroy() mruInfo.setValue(SKIN_PROPERTY_WINDOW_SCALE, uiInfo->uiState.mainFormScale); mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_INDEX, uiInfo->uiState.conState.conFormIndex); + DockingController *con = uiInfo->uiState.conState.dockingCon; + if (con != NULL) { + mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, con->getDockPos()); + } else { + mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, 0); + } + + /* clean up */ mainwindow->terminateSwapper(); mainwindow->closeController(); diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 54628de9b7..2ca0014349 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -238,6 +238,7 @@ void MainWindow::openController(int index, int dockPos) } else { getUIState()->conState.dockingCon = new DockingController(conForm, action, dockPos, this); + getUIState()->conState.recentlyDockPos = dockPos; } /* update layout */ @@ -265,9 +266,10 @@ void MainWindow::closeController() if (getDockingCon() != NULL) { qDebug("close docking controller"); + getUIState()->conState.recentlyDockPos = -1; winLayout->removeWidget(getDockingCon()); - getDockingCon()->close(); + getUIState()->conState.dockingCon = NULL; adjustSize(); @@ -276,7 +278,9 @@ void MainWindow::closeController() if (getFloatingCon() != NULL) { qDebug("close floating controller"); + getUIState()->conState.recentlyFloatPos = getFloatingCon()->pos(); getFloatingCon()->close(); + getUIState()->conState.floatingCon = NULL; } } diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index db70dfdbac..2411f5431e 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -273,7 +273,7 @@ void ContextMenu::slotController(int index) qDebug("controller : %d", index); MainWindow *win = ((MainWindow *)this->parent()); - win->openController(index, Qt::AlignRight | Qt::AlignCenter); + win->openController(index, win->getUIState()->conState.recentlyDockPos); } void ContextMenu::slotShell() diff --git a/tizen/src/ui/uistate.cpp b/tizen/src/ui/uistate.cpp index af8c79d5dd..dff66fdad9 100644 --- a/tizen/src/ui/uistate.cpp +++ b/tizen/src/ui/uistate.cpp @@ -35,6 +35,7 @@ UIState::UIState() : conState.conFormIndex = 0; conState.dockingCon = NULL; conState.floatingCon = NULL; + conState.recentlyDockPos = -1; conState.recentlyFloatPos = QPoint(-1, -1); } diff --git a/tizen/src/ui/uistate.h b/tizen/src/ui/uistate.h index 562af2f383..bbd99c56be 100644 --- a/tizen/src/ui/uistate.h +++ b/tizen/src/ui/uistate.h @@ -45,6 +45,7 @@ public: int conFormIndex; DockingController *dockingCon; FloatingController *floatingCon; + int recentlyDockPos; QPoint recentlyFloatPos; };