controller: modified controller property 97/29297/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 24 Oct 2014 05:53:44 +0000 (14:53 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 27 Oct 2014 09:54:51 +0000 (02:54 -0700)
write MRU value for controller index of menu
add name property to QML

Change-Id: I1f4e3737a0b36c607031b163e7d55a351a92ae8d
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/display/qt5_supplement.cpp

index fa61e3b19a5a2cbbbf90a3471c2b4d5b0de554c6..28c860735fd8815819210724661f22c3acb9a221 100644 (file)
@@ -58,6 +58,11 @@ static MainWindow *mainwindow;
 static UIInformation *uiInfo;
 
 #define SKIN_PROPERTIES_FILE_NAME ".skin.properties"
+#define SKIN_PROPERTY_WINDOW_X "window.x"
+#define SKIN_PROPERTY_WINDOW_Y "window.y"
+#define SKIN_PROPERTY_WINDOW_SCALE "window.scale"
+#define SKIN_PROPERTY_CONTROLLER_INDEX "controller.index"
+
 #define SKIN_INFO_FILE_NAME "info.ini"
 #define FORM_FILE_NAME "layout.qml"
 #define CON_FORM_SUBPATH "controller"
@@ -108,7 +113,7 @@ void qt5_gui_init(void)
     /* read MRU information */
     QSettings mruInfo(uiInfo->vmDataPath + SKIN_PROPERTIES_FILE_NAME,
         QSettings::IniFormat);
-    int scale = mruInfo.value("window.scale").toInt();
+    int scale = mruInfo.value(SKIN_PROPERTY_WINDOW_SCALE).toInt();
     qDebug("previous scale value is %d", scale);
 
     if (scale <= 0) {
@@ -167,8 +172,8 @@ void qt5_gui_init(void)
     mainwindow = new MainWindow(uiInfo);
 
     /* position */
-    int xx = mruInfo.value("window.x").toInt();
-    int yy = mruInfo.value("window.y").toInt();
+    int xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X).toInt();
+    int yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y).toInt();
     qDebug("previous position value is (%d, %d)", xx, yy);
 
     if (xx == 0 && yy == 0) {
@@ -178,7 +183,10 @@ void qt5_gui_init(void)
 
     mainwindow->show();
 
-    mainwindow->openController(0, true);
+    int conIndex = mruInfo.value(SKIN_PROPERTY_CONTROLLER_INDEX).toInt();
+    if (conIndex >= 0 && conIndex < uiInfo->conFormList.count()) {
+        mainwindow->openController(conIndex, true);
+    }
 
     mainwindow->startSwapper();
 }
@@ -190,9 +198,10 @@ void qt5_destroy()
     /* write MRU information */
     QSettings mruInfo(uiInfo->vmDataPath + SKIN_PROPERTIES_FILE_NAME,
         QSettings::IniFormat);
-    mruInfo.setValue("window.x", mainwindow->pos().x());
-    mruInfo.setValue("window.y", mainwindow->pos().y());
-    mruInfo.setValue("window.scale", uiInfo->uiState.mainFormScale);
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_X, mainwindow->pos().x());
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_Y, mainwindow->pos().y());
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_SCALE, uiInfo->uiState.mainFormScale);
+    mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_INDEX, uiInfo->uiState.conState.conFormIndex);
 
     mainwindow->terminateSwapper();
 
@@ -362,7 +371,10 @@ void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
         KeyListType *keyListType = NULL;
         HardwareKeyType *hwKeyType = NULL;
 
-        ControllerForm *conForm = new ControllerForm(fileInfo.dir().dirName());
+        QString conName = QQmlProperty::read(object, "name").toString();
+        ControllerForm *conForm = new ControllerForm(
+            conName.isEmpty() ? fileInfo.dir().dirName() : conName);
+
         conForm->conImg[ControllerForm::normal].load(fileInfo.absolutePath()
             + QDir::separator() + formType->mainImageName());
         conForm->conImg[ControllerForm::pressed].load(fileInfo.absolutePath()