ui: read MRU values(scale, position) from .skin.properties 94/29294/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 6 Oct 2014 05:40:51 +0000 (14:40 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Fri, 24 Oct 2014 05:47:41 +0000 (14:47 +0900)
Change-Id: Id1b47cda3a54343051ef6b89f0b78d3498b336bb
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/emulator_configure.sh
tizen/src/display/qt5_supplement.cpp
tizen/src/ui/uiinformation.cpp
tizen/src/ui/uiinformation.h

index 5ffa376f432c825c40c54155ae95be523e4b0441..f566626d0b4095945688da52b73c053a192c0b3d 100755 (executable)
@@ -225,6 +225,7 @@ exec ./configure \
  --audio-drv-list=winwave \
  --enable-hax \
  --disable-vnc \
+ --enable-qt \
  $CONFIGURE_APPEND \
 ;;
 Darwin*)
index 22fb31641e882d7f099a29a3b822d1bc65204b43..ebe584ecd7f3b4f5ebeb3238e1fa5d5203391265 100644 (file)
@@ -60,11 +60,15 @@ static MainWindow *mainwindow;
 static UIInformation *uiInfo;
 
 #define CONTROL_PRIORITY_MAX 10
+#define SKIN_PROPERTIES_FILE_NAME ".skin.properties"
+#define SKIN_INFO_FILE_NAME "info.ini"
 #define FORM_FILE_NAME "layout.qml"
 #define CON_FORM_SUBPATH "controller"
 
-void qt5_skin_init(void)
+void qt5_gui_init(void)
 {
+    QCoreApplication::setApplicationName("Tizen Emulator");
+
     qDebug() << "* Qt version :" << QT_VERSION_STR;
     qDebug() << "* working path :" << QDir::currentPath();
     qDebug() << "* binary path :" << QCoreApplication::applicationDirPath();
@@ -79,19 +83,35 @@ void qt5_skin_init(void)
     uiInfo->resolution.setHeight(get_emul_resolution_height());
     uiInfo->basePort = get_emul_vm_base_port();
 
+    uiInfo->vmDataPath = get_emul_vm_data_path();
+    if (uiInfo->vmDataPath.endsWith(QDir::separator()) == false) {
+        uiInfo->vmDataPath += QDir::separator();
+    }
+
     uiInfo->skinPath = QDir(get_emul_skin_path()).canonicalPath();
     if (uiInfo->skinPath.endsWith(QDir::separator()) == false) {
         uiInfo->skinPath += QDir::separator();
     }
 
-    QSettings skinInfo(uiInfo->skinPath + "info.ini", QSettings::IniFormat);
+    /* read skin information */
+    QSettings skinInfo(uiInfo->skinPath + SKIN_INFO_FILE_NAME,
+        QSettings::IniFormat);
     QString skinName = skinInfo.value("skin.name").toString();
     if (skinName.isEmpty() == true) {
         skinName = "Undefined";
     }
     uiInfo->skinName = skinName;
 
-    uiInfo->uiState.mainFormScale = 50;
+    /* read MRU information */
+    QSettings mruInfo(uiInfo->vmDataPath + SKIN_PROPERTIES_FILE_NAME,
+        QSettings::IniFormat);
+    int scale = mruInfo.value("window.scale").toInt();
+    qDebug("previous scale value is %d", scale);
+
+    if (scale <= 0) {
+        scale = 50;
+    }
+    uiInfo->uiState.mainFormScale = scale;
 
     /* XML */
     // TODO: convert QML to XML
@@ -115,8 +135,19 @@ void qt5_skin_init(void)
 
     /* GUI */
     qDebug("start!");
+
     mainwindow = new MainWindow(uiInfo);
-//    mainwindow->move(100, 100); // TODO: MRU
+
+    /* position */
+    int xx = mruInfo.value("window.x").toInt();
+    int yy = mruInfo.value("window.y").toInt();
+    qDebug("previous position value is (%d, %d)", xx, yy);
+
+    if (xx == 0 && yy == 0) {
+        xx = yy = uiInfo->basePort % 100;
+    }
+    mainwindow->move(xx, yy);
+
     mainwindow->show();
 
     mainwindow->openController(getControlIndex(), true);
@@ -143,7 +174,7 @@ void qt5_early_prepare(void)
 
 void qt5_prepare(void)
 {
-    qt5_skin_init();
+    qt5_gui_init();
 }
 
 void qt5_update_internal(void *data, int width, int height)
index 10fdb856686220aa92a2abbc6734f296cba3f36e..b7c59710b6cd786df58f4203f38ca47b4c9e982f 100644 (file)
@@ -32,6 +32,7 @@
 UIInformation::UIInformation() :
     resolution(0, 0), basePort(0)
 {
+    vmDataPath = "./";
     skinPath = "./";
 }
 
index 5eb7d1db55ea75650b9c48c2c18afd94de958b70..221338e80c2dfc30baacaf1efb38ee842fb68fcf 100644 (file)
@@ -45,6 +45,7 @@ public:
     QString vmName;
     QSize resolution;
     int basePort;
+    QString vmDataPath;
 
     QString skinPath;
     QString skinName;