From 1dd489e7198afe77f34872d6e7947e6274f19f8e Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Fri, 24 Oct 2014 14:53:44 +0900 Subject: [PATCH] controller: modified controller property write MRU value for controller index of menu add name property to QML Change-Id: I1f4e3737a0b36c607031b163e7d55a351a92ae8d Signed-off-by: GiWoong Kim --- tizen/src/display/qt5_supplement.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index fa61e3b19a..28c860735f 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -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() -- 2.34.1