From a262d9731b7b16ca02357f8a728b147e23f610f9 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Thu, 25 Sep 2014 16:00:34 +0900 Subject: [PATCH] skin: modified variable names To distinguish between main window concept and controller window concept, we need to redefine variable or function names from source code. - device-shaped window -> main window - key window -> controller window Change-Id: I8b3adcdf2d72c9d897510838fe1d6d2db61dd8ab Signed-off-by: GiWoong Kim --- tizen/src/display/qt5_supplement.cpp | 45 +++++++++++---------- tizen/src/ui/Makefile.objs | 2 +- tizen/src/ui/displaybase.cpp | 4 +- tizen/src/ui/{skinform.cpp => mainform.cpp} | 8 ++-- tizen/src/ui/{skinform.h => mainform.h} | 12 +++--- tizen/src/ui/mainwindow.cpp | 24 +++++------ tizen/src/ui/menu/contextmenu.cpp | 12 +++--- tizen/src/ui/skinview.cpp | 10 ++--- tizen/src/ui/uiinformation.cpp | 28 ++++++------- tizen/src/ui/uiinformation.h | 10 ++--- tizen/src/ui/uistate.cpp | 10 ++--- tizen/src/ui/uistate.h | 8 ++-- 12 files changed, 87 insertions(+), 86 deletions(-) rename tizen/src/ui/{skinform.cpp => mainform.cpp} (91%) rename tizen/src/ui/{skinform.h => mainform.h} (91%) diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 1e45b5dfa3..8594d0812f 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -46,8 +46,8 @@ extern "C" { //using namespace std; void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &); -void loadSkinFormFromXML(QFile *, UIInformation *); -void loadControllerFormFromXML(QFile *, UIInformation *); +void loadMainFormFromXML(QFile *, UIInformation *); +void loadConFormFromXML(QFile *, UIInformation *); int getControlIndex(); int getPriority(QFile *file); @@ -91,7 +91,7 @@ void qt5_skin_init(void) } uiInfo->skinName = skinName; - uiInfo->uiState.formScale = 50; + uiInfo->uiState.mainFormScale = 50; /* XML */ // TODO: convert QML to XML @@ -101,16 +101,16 @@ void qt5_skin_init(void) qmlRegisterType("EmulatorComponent", 1, 0, "Key"); qmlRegisterType("EmulatorComponent", 1, 0, "KeyList"); - /* load skin form */ - QFile skinXMLFile(uiInfo->skinPath + FORM_FILE_NAME); - loadSkinFormFromXML(&skinXMLFile, uiInfo); + /* load main form */ + QFile mainXMLFile(uiInfo->skinPath + FORM_FILE_NAME); + loadMainFormFromXML(&mainXMLFile, uiInfo); /* load controller forms */ QDir skinDir(uiInfo->skinPath + CON_FORM_SUBPATH); QFileInfoList entries = skinDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); for (int i = 0; i < entries.size(); i++) { QFile conXMLFile(entries.at(i).filePath() + QDir::separator() + FORM_FILE_NAME); - loadControllerFormFromXML(&conXMLFile, uiInfo); + loadConFormFromXML(&conXMLFile, uiInfo); } /* GUI */ @@ -201,13 +201,13 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt } } -void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) +void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */) { if (file->exists() == false) { qFatal("%s is not found", qPrintable(file->fileName())); } - qDebug("skin form is loaded from %s", qPrintable(file->fileName())); + qDebug("main form is loaded from %s", qPrintable(file->fileName())); qmlRegisterType("EmulatorComponent", 1, 0, "EmulatorUI"); qmlRegisterType("EmulatorComponent", 1, 0, "FormList"); @@ -234,14 +234,14 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) FormListType *formListType = uiType->formListType(); for (int index = 0; index < formListType->getFormList()->count(); index++) { - SkinForm *form = new SkinForm(); /* dst */ + MainForm *mainForm = new MainForm(); /* dst */ formType = (FormType *)formListType->getFormList()->at(index); /* src */ - form->displayRegion = formType->getDisplayRegion(); - form->skinImg[SkinForm::normal].load(fileInfo.absolutePath() + mainForm->displayRegion = formType->getDisplayRegion(); + mainForm->skinImg[MainForm::normal].load(fileInfo.absolutePath() + QDir::separator() + formType->mainImageName()); - form->skinImg[SkinForm::pressed].load(fileInfo.absolutePath() + mainForm->skinImg[MainForm::pressed].load(fileInfo.absolutePath() + QDir::separator() + formType->pressedImageName()); keyListType = formType->keyListType(); @@ -249,13 +249,13 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) for (int i = 0; i < keyListType->getKeyList()->count(); i++) { hwKeyType = keyListType->getKeyList()->at(i); if (hwKeyType != NULL) { - form->keyList.append(new HardwareKey(hwKeyType->objectName(), + mainForm->keyList.append(new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } - uiInfo->formList.append(form); + uiInfo->mainFormList.append(mainForm); } delete object; @@ -265,7 +265,7 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) delete engine; } -void loadControllerFormFromXML(QFile *file, UIInformation *uiInfo/* out */) +void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */) { if (file->exists() == false) { qWarning("%s is not found", qPrintable(file->fileName())); @@ -292,10 +292,10 @@ void loadControllerFormFromXML(QFile *file, UIInformation *uiInfo/* out */) KeyListType *keyListType = NULL; HardwareKeyType *hwKeyType = NULL; - ControllerForm *form = new ControllerForm(fileInfo.dir().dirName()); - form->conImg[ControllerForm::normal].load(fileInfo.absolutePath() + ControllerForm *conForm = new ControllerForm(fileInfo.dir().dirName()); + conForm->conImg[ControllerForm::normal].load(fileInfo.absolutePath() + QDir::separator() + formType->mainImageName()); - form->conImg[ControllerForm::pressed].load(fileInfo.absolutePath() + conForm->conImg[ControllerForm::pressed].load(fileInfo.absolutePath() + QDir::separator() + formType->pressedImageName()); keyListType = formType->keyListType(); @@ -303,13 +303,13 @@ void loadControllerFormFromXML(QFile *file, UIInformation *uiInfo/* out */) for (int i = 0; i < keyListType->getKeyList()->count(); i++) { hwKeyType = keyListType->getKeyList()->at(i); if (hwKeyType != NULL) { - form->keyList.append(new HardwareKey(hwKeyType->objectName(), + conForm->keyList.append(new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } - uiInfo->controllerList.append(form); + uiInfo->conFormList.append(conForm); delete object; } @@ -324,8 +324,9 @@ int getControlIndex() int controlPriority = 0; int priority = CONTROL_PRIORITY_MAX; - if (!uiInfo) + if (!uiInfo) { return controlIndex; + } /* find high priority*/ QString line; diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index 882329bf29..498adede84 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -16,7 +16,7 @@ obj-$(CONFIG_QT) += mainwindow.o moc_mainwindow.o obj-$(CONFIG_QT) += skinbezelitem.o obj-$(CONFIG_QT) += skincontrollerview.o obj-$(CONFIG_QT) += skinkeyitem.o -obj-$(CONFIG_QT) += skinform.o +obj-$(CONFIG_QT) += mainform.o obj-$(CONFIG_QT) += keyboardhelper.o obj-$(CONFIG_QT) += skinview.o obj-$(CONFIG_QT) += uiinformation.o diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp index 6e3fed03e8..1af6e2c87b 100644 --- a/tizen/src/ui/displaybase.cpp +++ b/tizen/src/ui/displaybase.cpp @@ -44,7 +44,7 @@ DisplayBase::DisplayBase(QSize resolution, QWidget *w) // TODO: compare display region with resolution MainWindow *win = ((MainWindow *)w->parent()->parent()); - rotateAngle = win->getUIState()->formAngle; + rotateAngle = win->getUIState()->mainFormAngle; scaleFactor = win->getUIState()->getScaleFactor(); } @@ -88,7 +88,7 @@ void DisplayBase::handleResize(QResizeEvent *event) qDebug("resize display"); MainWindow *win = ((MainWindow *)w->parent()->parent()); - SkinForm *form = win->uiInfo->getForm(); + MainForm *form = win->uiInfo->getMainForm(); const qreal sx = scaleFactor; const qreal sy = scaleFactor; diff --git a/tizen/src/ui/skinform.cpp b/tizen/src/ui/mainform.cpp similarity index 91% rename from tizen/src/ui/skinform.cpp rename to tizen/src/ui/mainform.cpp index 54d9cbf30d..c707786292 100644 --- a/tizen/src/ui/skinform.cpp +++ b/tizen/src/ui/mainform.cpp @@ -27,16 +27,16 @@ * */ -#include "skinform.h" +#include "mainform.h" -SkinForm::SkinForm() : +MainForm::MainForm() : displayRegion(0, 0, 0, 0) { } -SkinForm::~SkinForm() +MainForm::~MainForm() { - qDebug("destroy skin form"); + qDebug("destroy main form"); for (int i = 0; i < keyList.count(); i++) { delete keyList.at(i); diff --git a/tizen/src/ui/skinform.h b/tizen/src/ui/mainform.h similarity index 91% rename from tizen/src/ui/skinform.h rename to tizen/src/ui/mainform.h index 775aedab21..28bcede54b 100644 --- a/tizen/src/ui/skinform.h +++ b/tizen/src/ui/mainform.h @@ -27,20 +27,20 @@ * */ -#ifndef SKINFORM_H -#define SKINFORM_H +#ifndef MAINFORM_H +#define MAINFORM_H #include #include "hardwarekey.h" -class SkinForm +class MainForm { Q_ENUMS(SkinImgType) public: - SkinForm(); - ~SkinForm(); + MainForm(); + ~MainForm(); QImage skinImg[2]; QRect displayRegion; @@ -52,4 +52,4 @@ public: }; }; -#endif // SKINFORM_H +#endif // MAINFORM_H diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index b597adb625..4ee0f7472c 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -31,7 +31,7 @@ */ #include "mainwindow.h" -#include "skinform.h" +#include "mainform.h" #include "displayglwidget.h" #include "displayswwidget.h" @@ -198,12 +198,12 @@ void MainWindow::openController(int index, bool docking) closeController(); - if (uiInfo->controllerList.count() <= index) { + if (uiInfo->conFormList.count() <= index) { qWarning("controller index out of range"); return; } - ControllerForm *conForm = uiInfo->controllerList.at(index); + ControllerForm *conForm = uiInfo->conFormList.at(index); if (conForm == NULL) { qWarning("controller is null"); return; @@ -254,12 +254,12 @@ void MainWindow::resizeEvent(QResizeEvent *event) { qDebug("resize main window"); - resize(uiInfo->getFormSize().width(), - uiInfo->getFormSize().height()); + resize(uiInfo->getMainFormSize().width(), + uiInfo->getMainFormSize().height()); - SkinForm *form = uiInfo->getForm(); - if (form != NULL) { - setRegion(form->skinImg[SkinForm::normal]); + MainForm *mainForm = uiInfo->getMainForm(); + if (mainForm != NULL) { + setRegion(mainForm->skinImg[MainForm::normal]); } } @@ -267,10 +267,10 @@ void MainWindow::rotate(int angle) { qDebug("window rotate : %d", angle); - getUIState()->formAngle = angle; + getUIState()->mainFormAngle = angle; skinView->rotate(); - display->rotate(getUIState()->formAngle); + display->rotate(getUIState()->mainFormAngle); adjustSize(); } @@ -279,10 +279,10 @@ void MainWindow::scale(int scale) { qDebug("window scale : %d", scale); - getUIState()->formScale = scale; + getUIState()->mainFormScale = scale; skinView->adjustSize(); - display->scale(getUIState()->formScale); + display->scale(getUIState()->mainFormScale); adjustSize(); } diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index fdd3ac61b0..637001c43c 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -64,7 +64,7 @@ void ContextMenu::createItems() { #endif /* = Rotate menu = */ - if (win->uiInfo->formList.count() > 1) { + if (win->uiInfo->mainFormList.count() > 1) { QMenu *rotateMenu = addMenu(QIcon(QPixmap(":/icons/rotate.png")), "&Rotate"); QActionGroup *rotateGroup = new QActionGroup(this); rotateMapper = new QSignalMapper(this); @@ -94,7 +94,7 @@ void ContextMenu::createItems() { rotateMapper->setMapping(action, 90); connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - action = (QAction *)rotateMapper->mapping(win->getUIState()->formAngle); + action = (QAction *)rotateMapper->mapping(win->getUIState()->mainFormAngle); action->setChecked(true); } /* =============== */ @@ -131,20 +131,20 @@ void ContextMenu::createItems() { // TODO: interpolation - action = (QAction *)scaleMapper->mapping(win->getUIState()->formScale); + action = (QAction *)scaleMapper->mapping(win->getUIState()->mainFormScale); action->setChecked(true); /* ============== */ /* = Controller menu = */ QMenu *controllerMenu = NULL; - if (win->uiInfo->controllerList.isEmpty() == false) { + if (win->uiInfo->conFormList.isEmpty() == false) { controllerMenu = addMenu("Controller"); QActionGroup *controllerGroup = new QActionGroup(this); controllerMapper = new QSignalMapper(this); connect(controllerMapper, SIGNAL(mapped(int)), this, SLOT(slotController(int))); - for (int i = 0; i < win->uiInfo->controllerList.count(); i++) { - action = controllerMenu->addAction(win->uiInfo->controllerList.at(i)->name); + for (int i = 0; i < win->uiInfo->conFormList.count(); i++) { + action = controllerMenu->addAction(win->uiInfo->conFormList.at(i)->name); action->setActionGroup(controllerGroup); action->setCheckable(true); controllerMapper->setMapping(action, i); diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index 6637d58ed5..531cd35104 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -53,10 +53,10 @@ SkinView::SkinView(QGraphicsScene *scene, QWidget *parent) : void SkinView::createItems() { MainWindow *win = ((MainWindow *)this->parent()); - SkinForm *form = win->uiInfo->getForm(); + MainForm *form = win->uiInfo->getMainForm(); /* bezel */ - SkinBezelItem *bezelItem = new SkinBezelItem(form->skinImg[SkinForm::normal]); + SkinBezelItem *bezelItem = new SkinBezelItem(form->skinImg[MainForm::normal]); scene()->addItem(bezelItem); /* HW keys */ @@ -66,7 +66,7 @@ void SkinView::createItems() for (int i = 0; i < keyList.count(); i++) { hwKey = keyList.at(i); if (hwKey != NULL) { - new SkinKeyItem(form->skinImg[SkinForm::pressed].copy(hwKey->region), + new SkinKeyItem(form->skinImg[MainForm::pressed].copy(hwKey->region), hwKey, bezelItem); } } @@ -89,8 +89,8 @@ void SkinView::resizeEvent(QResizeEvent *event) MainWindow *win = ((MainWindow *)this->parent()); /* geometry */ - const int width = win->uiInfo->getFormSize().width(); - const int height = win->uiInfo->getFormSize().height(); + const int width = win->uiInfo->getMainFormSize().width(); + const int height = win->uiInfo->getMainFormSize().height(); setGeometry(0, 0, width, height); /* scaling */ diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index d3c50ea711..431a7e5b28 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -35,39 +35,39 @@ UIInformation::UIInformation() : skinPath = "./"; } -SkinForm *UIInformation::getForm() +MainForm *UIInformation::getMainForm() { - if (uiState.getFormIndex() > (formList.count() - 1) - || uiState.getFormIndex() < 0) { + if (uiState.getMainFormIndex() > (mainFormList.count() - 1) + || uiState.getMainFormIndex() < 0) { qWarning("invalid form found"); - uiState.formAngle = 0; + uiState.mainFormAngle = 0; } - return formList.at(uiState.getFormIndex()); + return mainFormList.at(uiState.getMainFormIndex()); } -QSize UIInformation::getFormSize() +QSize UIInformation::getMainFormSize() { - SkinForm *form = getForm(); + MainForm *form = getMainForm(); if (form == NULL) { return QSize(0, 0); } - return form->skinImg[SkinForm::normal].size() * uiState.getScaleFactor(); + return form->skinImg[MainForm::normal].size() * uiState.getScaleFactor(); } UIInformation::~UIInformation() { qDebug("destroy UI info"); - for (int i = 0; i < formList.count(); i++) { - delete formList.at(i); + for (int i = 0; i < mainFormList.count(); i++) { + delete mainFormList.at(i); } - formList.clear(); + mainFormList.clear(); - for (int i = 0; i < controllerList.count(); i++) { - delete controllerList.at(i); + for (int i = 0; i < conFormList.count(); i++) { + delete conFormList.at(i); } - controllerList.clear(); + conFormList.clear(); } diff --git a/tizen/src/ui/uiinformation.h b/tizen/src/ui/uiinformation.h index eba9de2263..9c88a2e5c7 100644 --- a/tizen/src/ui/uiinformation.h +++ b/tizen/src/ui/uiinformation.h @@ -32,7 +32,7 @@ #include -#include "skinform.h" +#include "mainform.h" #include "uistate.h" #include "controllerform.h" @@ -48,14 +48,14 @@ public: QString skinPath; QString skinName; - QList formList; - QList controllerList; + QList mainFormList; + QList conFormList; QColor hoverColor; UIState uiState; /* runtime information */ - SkinForm *getForm(); /* current */ - QSize getFormSize(); /* current */ + MainForm *getMainForm(); /* current */ + QSize getMainFormSize(); /* current */ }; #endif // UIINFORMATION_H diff --git a/tizen/src/ui/uistate.cpp b/tizen/src/ui/uistate.cpp index d0b7442fbf..7f6c07cb88 100644 --- a/tizen/src/ui/uistate.cpp +++ b/tizen/src/ui/uistate.cpp @@ -30,12 +30,12 @@ #include "uistate.h" UIState::UIState() : - formAngle(0), formScale(100) + mainFormAngle(0), mainFormScale(100) { conState.floatingCon = NULL; } -int UIState::getFormIndex(int angle) +int UIState::getMainFormIndex(int angle) { // TODO: map @@ -60,9 +60,9 @@ int UIState::getFormIndex(int angle) return index; } -int UIState::getFormIndex() +int UIState::getMainFormIndex() { - return getFormIndex(formAngle); + return getMainFormIndex(mainFormAngle); } qreal UIState::getScaleFactor(int scale) @@ -72,5 +72,5 @@ qreal UIState::getScaleFactor(int scale) qreal UIState::getScaleFactor() { - return getScaleFactor(this->formScale); + return getScaleFactor(this->mainFormScale); } diff --git a/tizen/src/ui/uistate.h b/tizen/src/ui/uistate.h index 280ee37b33..30579ee23e 100644 --- a/tizen/src/ui/uistate.h +++ b/tizen/src/ui/uistate.h @@ -47,13 +47,13 @@ class UIState public: UIState(); - int getFormIndex(int angle); - int getFormIndex(); /* current */ + int getMainFormIndex(int angle); + int getMainFormIndex(); /* current */ qreal getScaleFactor(int scale); qreal getScaleFactor(); /* current */ - int formAngle; - int formScale; /* percentage */ + int mainFormAngle; + int mainFormScale; /* percentage */ ControllerState conState; }; -- 2.34.1