controller: control the controller position 86/29386/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 14 Oct 2014 10:06:49 +0000 (19:06 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 28 Oct 2014 08:11:06 +0000 (01:11 -0700)
remember the last position and state of controller
read MRU position values from .skin.properties

Change-Id: Ie135f4158c903e272440c3f223178425e221fc20
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/display/qt5_supplement.cpp
tizen/src/ui/mainwindow.cpp
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/uistate.cpp
tizen/src/ui/uistate.h

index 422cd8a8b459274d8327fb034ae6583a7e88df10..5a362bf93f17da2cf132cf392e86442fa9b8ae5a 100644 (file)
@@ -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();
index 54628de9b76227b4ac2d2bdb0f9065d763ee32e6..2ca0014349d929aaa7b246620f8f9405d1d90720 100644 (file)
@@ -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;
     }
 }
index db70dfdbac2515f96ae06ab618abe348911276cb..2411f5431e496eeacef6f97fe03611f940d5b1b1 100644 (file)
@@ -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()
index af8c79d5dd76e66283040f79ed1e8dff92ddf993..dff66fdad97a0cf02b13c2108aba4b28e0a65619 100644 (file)
@@ -35,6 +35,7 @@ UIState::UIState() :
     conState.conFormIndex = 0;
     conState.dockingCon = NULL;
     conState.floatingCon = NULL;
+    conState.recentlyDockPos = -1;
     conState.recentlyFloatPos = QPoint(-1, -1);
 }
 
index 562af2f383e0c1b67d12141ff4769facc6429ace..bbd99c56bea541773dcb7ad28b94cdd3569d19e5 100644 (file)
@@ -45,6 +45,7 @@ public:
     int conFormIndex;
     DockingController *dockingCon;
     FloatingController *floatingCon;
+    int recentlyDockPos;
     QPoint recentlyFloatPos;
 };