From: GiWoong Kim Date: Wed, 6 Aug 2014 05:36:26 +0000 (+0900) Subject: ui: modify the class name to avoid confusing X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b9dbfd35202120c430e77f6dfa2474c4ae451f7;p=sdk%2Femulator%2Fqemu.git ui: modify the class name to avoid confusing layout -> form Change-Id: I1d1c57e716df7fedcadbd3baf1cbdd4490c2b273 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index c3be0733a2..7f4b2337fb 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -40,7 +40,7 @@ #include "controllerwidget.h" #include "ui/xml/hardwarekeytype.h" #include "ui/xml/keylisttype.h" -#include "ui/xml/layouttype.h" +#include "ui/xml/formtype.h" extern "C" { #include "emul_state.h" @@ -48,8 +48,8 @@ extern "C" { //using namespace std; void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &); -void loadSkinLayoutFromXML(QFile *, UIInformation *); -void loadControllerLayoutFromXML(QFile *, UIInformation *); +void loadSkinFormFromXML(QFile *, UIInformation *); +void loadControllerFormFromXML(QFile *, UIInformation *); static QApplication *app; @@ -60,7 +60,7 @@ static MainWindow *mainwindow; static UIInformation *uiInfo; #define FORM_FILE_NAME "layout.qml" -#define CON_FORM_SUBPATH "controller-layout" +#define CON_FORM_SUBPATH "controller" void qt5_skin_init(void) { @@ -88,7 +88,7 @@ void qt5_skin_init(void) } uiInfo->skinName = skinName; - uiInfo->uiState.layoutScale = 50; + uiInfo->uiState.formScale = 50; /* XML */ // TODO: convert QML to XML @@ -100,14 +100,14 @@ void qt5_skin_init(void) /* load skin form */ QFile skinXMLFile(uiInfo->skinPath + FORM_FILE_NAME); - loadSkinLayoutFromXML(&skinXMLFile, uiInfo); + loadSkinFormFromXML(&skinXMLFile, 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() + '/' + FORM_FILE_NAME); - loadControllerLayoutFromXML(&conXMLFile, uiInfo); + loadControllerFormFromXML(&conXMLFile, uiInfo); } /* GUI */ @@ -190,7 +190,7 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt } } -void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) +void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) { if (file->exists() == false) { qFatal("%s is not found", qPrintable(file->fileName())); @@ -198,7 +198,7 @@ void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) qDebug("skin form is loaded from %s", qPrintable(file->fileName())); - qmlRegisterType("EmulatorComponent", 1, 0, "Layout"); + qmlRegisterType("EmulatorComponent", 1, 0, "Form"); /* QML */ QQmlEngine *engine = new QQmlEngine(); @@ -214,35 +214,35 @@ void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) QFileInfo fileInfo(*file); qDebug() << "xml version :" << QQmlProperty::read(object, "version").toString(); - LayoutType *layoutType = NULL; + FormType *formType = NULL; KeyListType *keyListType = NULL; HardwareKeyType *hwKeyType = NULL; - QObjectList layoutTypeList = object->children(); - for (int index = 0; index < layoutTypeList.count(); index++) { - SkinLayout *layout = new SkinLayout(); /* dst */ + QObjectList formTypeList = object->children(); + for (int index = 0; index < formTypeList.count(); index++) { + SkinForm *form = new SkinForm(); /* dst */ - layoutType = (LayoutType *)layoutTypeList.at(index); /* src */ + formType = (FormType *)formTypeList.at(index); /* src */ - layout->displayRegion = layoutType->displayRegion(); - layout->skinImg[SkinLayout::normal].load( - fileInfo.absolutePath() + "/" + layoutType->mainImageName()); - layout->skinImg[SkinLayout::pressed].load( - fileInfo.absolutePath() + "/" + layoutType->pressedImageName()); + form->displayRegion = formType->displayRegion(); + form->skinImg[SkinForm::normal].load( + fileInfo.absolutePath() + "/" + formType->mainImageName()); + form->skinImg[SkinForm::pressed].load( + fileInfo.absolutePath() + "/" + formType->pressedImageName()); - keyListType = layoutType->keyListType(); + keyListType = formType->keyListType(); if (keyListType != NULL) { for (int i = 0; i < keyListType->list.count(); i++) { hwKeyType = keyListType->list.at(i); if (hwKeyType != NULL) { - layout->keyList.append( + form->keyList.append( new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } - uiInfo->layoutList.append(layout); + uiInfo->formList.append(form); } delete object; @@ -252,7 +252,7 @@ void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) delete engine; } -void loadControllerLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) +void loadControllerFormFromXML(QFile *file, UIInformation *uiInfo/* out */) { if (file->exists() == false) { qWarning("%s is not found", qPrintable(file->fileName())); @@ -275,29 +275,29 @@ void loadControllerLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) QFileInfo fileInfo(*file); qDebug() << "xml version :" << QQmlProperty::read(object, "version").toString(); - LayoutType *layoutType = (LayoutType *)object; + FormType *formType = (FormType *)object; KeyListType *keyListType = NULL; HardwareKeyType *hwKeyType = NULL; - ControllerLayout *layout = new ControllerLayout(fileInfo.dir().dirName()); - layout->conImg[ControllerLayout::normal].load( - fileInfo.absolutePath() + "/" + layoutType->mainImageName()); - layout->conImg[ControllerLayout::pressed].load( - fileInfo.absolutePath() + "/" + layoutType->pressedImageName()); + ControllerForm *form = new ControllerForm(fileInfo.dir().dirName()); + form->conImg[ControllerForm::normal].load( + fileInfo.absolutePath() + "/" + formType->mainImageName()); + form->conImg[ControllerForm::pressed].load( + fileInfo.absolutePath() + "/" + formType->pressedImageName()); - keyListType = layoutType->keyListType(); + keyListType = formType->keyListType(); if (keyListType != NULL) { for (int i = 0; i < keyListType->list.count(); i++) { hwKeyType = keyListType->list.at(i); if (hwKeyType != NULL) { - layout->keyList.append( + form->keyList.append( new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } - uiInfo->controllerList.append(layout); + uiInfo->controllerList.append(form); delete object; } diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index 8034a6516d..a33417671d 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -5,7 +5,7 @@ $(obj)/qrc_resource.o: $(obj)/qrc_resource.cpp $(obj)/qrc_resource.cpp: $(TIZEN_UI)/resource/resource.qrc rcc -name resource $< -o $@ -obj-$(CONFIG_QT) += controllerlayout.o +obj-$(CONFIG_QT) += controllerform.o obj-$(CONFIG_QT) += controllerwidget.o moc_controllerwidget.o obj-$(CONFIG_QT) += displaywidget.o moc_displaywidget.o obj-$(CONFIG_QT) += hardwarekey.o @@ -13,7 +13,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) += skinlayout.o +obj-$(CONFIG_QT) += skinform.o obj-$(CONFIG_QT) += skinview.o obj-$(CONFIG_QT) += uiinformation.o obj-$(CONFIG_QT) += uistate.o diff --git a/tizen/src/ui/controllerform.cpp b/tizen/src/ui/controllerform.cpp new file mode 100644 index 0000000000..63bcd6634f --- /dev/null +++ b/tizen/src/ui/controllerform.cpp @@ -0,0 +1,11 @@ +#include "controllerform.h" + +ControllerForm::ControllerForm(QString name) +{ + this->name = name; +} + +ControllerForm::~ControllerForm() +{ + qDebug("destroy con layout"); +} diff --git a/tizen/src/ui/controllerform.h b/tizen/src/ui/controllerform.h new file mode 100644 index 0000000000..79f9e037aa --- /dev/null +++ b/tizen/src/ui/controllerform.h @@ -0,0 +1,26 @@ +#ifndef CONTROLLERFORM_H +#define CONTROLLERFORM_H + +#include + +#include "hardwarekey.h" + +class ControllerForm +{ + Q_ENUMS(ConImgType) + +public: + ControllerForm(QString name); + ~ControllerForm(); + + QString name; + QImage conImg[2]; + QList keyList; + + enum ConImgType { + normal = 0, + pressed = 1 + }; +}; + +#endif // CONTROLLERFORM_H diff --git a/tizen/src/ui/controllerlayout.cpp b/tizen/src/ui/controllerlayout.cpp deleted file mode 100644 index 0b2269a6cb..0000000000 --- a/tizen/src/ui/controllerlayout.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "controllerlayout.h" - -ControllerLayout::ControllerLayout(QString name) -{ - this->name = name; -} - -ControllerLayout::~ControllerLayout() -{ - qDebug("destroy con layout"); -} diff --git a/tizen/src/ui/controllerlayout.h b/tizen/src/ui/controllerlayout.h deleted file mode 100644 index b993affb69..0000000000 --- a/tizen/src/ui/controllerlayout.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CONTROLLERLAYOUT_H -#define CONTROLLERLAYOUT_H - -#include - -#include "hardwarekey.h" - -class ControllerLayout -{ - Q_ENUMS(ConImgType) - -public: - ControllerLayout(QString name); - ~ControllerLayout(); - - QString name; - QImage conImg[2]; - QList keyList; - - enum ConImgType { - normal = 0, - pressed = 1 - }; -}; - -#endif // CONTROLLERLAYOUT_H diff --git a/tizen/src/ui/controllerwidget.cpp b/tizen/src/ui/controllerwidget.cpp index f379e37641..4f150ccd70 100644 --- a/tizen/src/ui/controllerwidget.cpp +++ b/tizen/src/ui/controllerwidget.cpp @@ -2,16 +2,16 @@ #include "controllerwidget.h" -ControllerWidget::ControllerWidget(ControllerLayout *conLayout, QWidget *parent) : +ControllerWidget::ControllerWidget(ControllerForm *conForm, QWidget *parent) : QLabel(parent) { - this->conLayout = conLayout; + this->conForm = conForm; setStyleSheet("border-style: none"); setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle(conLayout->name); + setWindowTitle(conForm->name); QHBoxLayout *layout = new QHBoxLayout(this); layout->setMargin(0); @@ -19,14 +19,14 @@ ControllerWidget::ControllerWidget(ControllerLayout *conLayout, QWidget *parent) QGraphicsScene *conScene = new QGraphicsScene(this); - conView = new SkinControllerView(conLayout, conScene, this); + conView = new SkinControllerView(conForm, conScene, this); conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); layout->addWidget(conView); } void ControllerWidget::showEvent(QShowEvent *event) { - setRegion(conLayout->conImg[ControllerLayout::normal]); + setRegion(conForm->conImg[ControllerForm::normal]); } void ControllerWidget::setRegion(QImage baseImage) diff --git a/tizen/src/ui/controllerwidget.h b/tizen/src/ui/controllerwidget.h index 60ef55f550..be18a3297a 100644 --- a/tizen/src/ui/controllerwidget.h +++ b/tizen/src/ui/controllerwidget.h @@ -3,7 +3,7 @@ #include -#include "controllerlayout.h" +#include "controllerform.h" #include "skincontrollerview.h" class ControllerWidget : public QLabel @@ -11,7 +11,7 @@ class ControllerWidget : public QLabel Q_OBJECT public: - explicit ControllerWidget(ControllerLayout *conLayout, QWidget *parent = 0); + explicit ControllerWidget(ControllerForm *conForm, QWidget *parent = 0); ~ControllerWidget(); protected: @@ -21,7 +21,7 @@ protected: private: SkinControllerView *conView; - ControllerLayout *conLayout; + ControllerForm *conForm; }; #endif // CONTROLLERWIDGET_H diff --git a/tizen/src/ui/displaywidget.cpp b/tizen/src/ui/displaywidget.cpp index e620c548aa..a0ef1fc4d6 100644 --- a/tizen/src/ui/displaywidget.cpp +++ b/tizen/src/ui/displaywidget.cpp @@ -15,7 +15,7 @@ DisplayWidget::DisplayWidget(QSize resolution, QGLContext *context, QWidget *par this->resolution = resolution; MainWindow *win = ((MainWindow *)this->parent()->parent()); - rotateAngle = win->getUIState()->layoutAngle; + rotateAngle = win->getUIState()->formAngle; scaleFactor = win->getUIState()->getScaleFactor(); //setAutoFillBackground(false); @@ -65,18 +65,18 @@ void DisplayWidget::resizeEvent(QResizeEvent *event) //QGLWidget::resizeEvent(event); /* initializeGL */ MainWindow *win = ((MainWindow *)this->parent()->parent()); - SkinLayout *layout = win->uiInfo->getLayout(); - if (layout == NULL) { - layout = win->uiInfo->layoutList.at(0); + SkinForm *form = win->uiInfo->getForm(); + if (form == NULL) { + form = win->uiInfo->formList.at(0); } const qreal sx = scaleFactor; const qreal sy = scaleFactor; - setGeometry(layout->displayRegion.x() * sx, - layout->displayRegion.y() * sy, - layout->displayRegion.width() * sx, - layout->displayRegion.height() * sy); + setGeometry(form->displayRegion.x() * sx, + form->displayRegion.y() * sy, + form->displayRegion.width() * sx, + form->displayRegion.height() * sy); qt5_window_width = width(); qt5_window_height = height(); diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 574d68b9c8..558fa6e176 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -1,7 +1,7 @@ #include #include "mainwindow.h" -#include "skinlayout.h" +#include "skinform.h" QOpenGLContext *qt5GLContext = NULL; QSurfaceFormat qt5GLFormat; @@ -178,8 +178,8 @@ void MainWindow::openController(int index) return; } - ControllerLayout *conLayout = uiInfo->controllerList.at(index); - con = new ControllerWidget(conLayout); + ControllerForm *conForm = uiInfo->controllerList.at(index); + con = new ControllerWidget(conForm); QPoint globalPos = mapToGlobal(QPoint(0, 0)); con->move(globalPos.x() + size().width(), globalPos.y()); @@ -200,12 +200,12 @@ void MainWindow::resizeEvent(QResizeEvent *event) { qDebug("resize main window"); - resize(uiInfo->getLayoutSize().width(), - uiInfo->getLayoutSize().height()); + resize(uiInfo->getFormSize().width(), + uiInfo->getFormSize().height()); - SkinLayout *layout = uiInfo->getLayout(); - if (layout != NULL) { - setRegion(layout->skinImg[SkinLayout::normal]); + SkinForm *form = uiInfo->getForm(); + if (form != NULL) { + setRegion(form->skinImg[SkinForm::normal]); } } @@ -213,10 +213,10 @@ void MainWindow::rotate(int angle) { qDebug("window rotate : %d", angle); - getUIState()->layoutAngle = angle; + getUIState()->formAngle = angle; skinView->rotate(); - display->rotate(getUIState()->layoutAngle); + display->rotate(getUIState()->formAngle); adjustSize(); } @@ -225,10 +225,10 @@ void MainWindow::scale(int scale) { qDebug("window scale : %d", scale); - getUIState()->layoutScale = scale; + getUIState()->formScale = scale; skinView->adjustSize(); - display->scale(getUIState()->layoutScale); + display->scale(getUIState()->formScale); adjustSize(); } diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 7f1071c170..312b32cd3f 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -52,7 +52,7 @@ ContextMenu::ContextMenu(QWidget *parent) : rotateMapper->setMapping(action, 90); connect(action, SIGNAL(triggered()), rotateMapper, SLOT(map())); - action = (QAction *)rotateMapper->mapping(win->getUIState()->layoutAngle); + action = (QAction *)rotateMapper->mapping(win->getUIState()->formAngle); action->setChecked(true); /* =============== */ @@ -89,7 +89,7 @@ ContextMenu::ContextMenu(QWidget *parent) : // TODO: interpolation - action = (QAction *)scaleMapper->mapping(win->getUIState()->layoutScale); + action = (QAction *)scaleMapper->mapping(win->getUIState()->formScale); action->setChecked(true); /* ============== */ diff --git a/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml b/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml index 7acd6b7ebc..ab67ef49a1 100644 --- a/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml +++ b/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml @@ -4,7 +4,7 @@ import EmulatorComponent 1.0 Item { property string version: "1.0" - Layout { + Form { objectName: "portrait" display: Region { left: 67; top: 116; width: 720; height: 1280 } @@ -39,7 +39,7 @@ Item { } } - Layout { + Form { objectName: "landscape" display: Region { left: 116; top: 78; width: 1280; height: 720 } @@ -74,7 +74,7 @@ Item { } } - Layout { + Form { objectName: "reverse portrait" display: Region { left: 78; top: 117; width: 720; height: 1280 } @@ -109,7 +109,7 @@ Item { } } - Layout { + Form { objectName: "reverse landscape" display: Region { left: 117; top: 67; width: 1280; height: 720 } diff --git a/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml b/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml index 4f6945b602..f7a0a1c853 100644 --- a/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml +++ b/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml @@ -4,7 +4,7 @@ import EmulatorComponent 1.0 Item { property string version: "1.0" - Layout { + Form { objectName: "portrait" display: Region { left: 26; top: 60; width: 320; height: 320 } @@ -19,7 +19,7 @@ Item { } } - Layout { + Form { objectName: "landscape" display: Region { left: 60; top: 38; width: 320; height: 320 } @@ -34,7 +34,7 @@ Item { } } - Layout { + Form { objectName: "reverse portrait" display: Region { left: 38; top: 60; width: 320; height: 320 } @@ -49,7 +49,7 @@ Item { } } - Layout { + Form { objectName: "reverse landscape" display: Region { left: 60; top: 26; width: 320; height: 320 } diff --git a/tizen/src/ui/skincontrollerview.cpp b/tizen/src/ui/skincontrollerview.cpp index 1e4cbf3c04..9c8bdcb9bf 100644 --- a/tizen/src/ui/skincontrollerview.cpp +++ b/tizen/src/ui/skincontrollerview.cpp @@ -2,7 +2,7 @@ #include "mainwindow.h" #include "skinkeyitem.h" -SkinControllerView::SkinControllerView(ControllerLayout *conLayout, QGraphicsScene *scene, QWidget *parent) : +SkinControllerView::SkinControllerView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent) : QGraphicsView(scene, parent) { setStyleSheet("background: transparent"); @@ -16,23 +16,23 @@ SkinControllerView::SkinControllerView(ControllerLayout *conLayout, QGraphicsSce grabWinPos = QPoint(-1, -1); grabPos = QPoint(-1, -1); - createItems(conLayout); + createItems(conForm); } -void SkinControllerView::createItems(ControllerLayout *conLayout) +void SkinControllerView::createItems(ControllerForm *conForm) { /* bezel */ - SkinBezelItem *bezelItem = new SkinBezelItem(conLayout->conImg[ControllerLayout::normal]); + SkinBezelItem *bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]); scene()->addItem(bezelItem); /* HW keys */ - QList keyList = conLayout->keyList; + QList keyList = conForm->keyList; HardwareKey *hwKey = NULL; for (int i = 0; i < keyList.count(); i++) { hwKey = keyList.at(i); if (hwKey != NULL) { - new SkinKeyItem(conLayout->conImg[ControllerLayout::pressed].copy(hwKey->region), + new SkinKeyItem(conForm->conImg[ControllerForm::pressed].copy(hwKey->region), hwKey, bezelItem); } } diff --git a/tizen/src/ui/skincontrollerview.h b/tizen/src/ui/skincontrollerview.h index c9e3c40291..f3e78829dc 100644 --- a/tizen/src/ui/skincontrollerview.h +++ b/tizen/src/ui/skincontrollerview.h @@ -2,12 +2,12 @@ #define SKINCONTROLLERVIEW_H #include "skinview.h" -#include "controllerlayout.h" +#include "controllerform.h" class SkinControllerView : public QGraphicsView { public: - SkinControllerView(ControllerLayout *conLayout, QGraphicsScene *scene, QWidget *parent = 0); + SkinControllerView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0); ~SkinControllerView(); protected: @@ -21,7 +21,7 @@ protected: QPoint grabPos; private: - void createItems(ControllerLayout *conLayout); + void createItems(ControllerForm *conForm); }; #endif // SKINCONTROLLERVIEW_H diff --git a/tizen/src/ui/skinform.cpp b/tizen/src/ui/skinform.cpp new file mode 100644 index 0000000000..fc407ca15c --- /dev/null +++ b/tizen/src/ui/skinform.cpp @@ -0,0 +1,16 @@ +#include "skinform.h" + +SkinForm::SkinForm() : + displayRegion(0, 0, 0, 0) +{ +} + +SkinForm::~SkinForm() +{ + qDebug("destroy skin form"); + + for (int i = 0; i < keyList.count(); i++) { + delete keyList.at(i); + } + keyList.clear(); +} diff --git a/tizen/src/ui/skinform.h b/tizen/src/ui/skinform.h new file mode 100644 index 0000000000..49c6072306 --- /dev/null +++ b/tizen/src/ui/skinform.h @@ -0,0 +1,26 @@ +#ifndef SKINFORM_H +#define SKINFORM_H + +#include + +#include "hardwarekey.h" + +class SkinForm +{ + Q_ENUMS(SkinImgType) + +public: + SkinForm(); + ~SkinForm(); + + QImage skinImg[2]; + QRect displayRegion; + QList keyList; + + enum SkinImgType { + normal = 0, + pressed = 1 + }; +}; + +#endif // SKINFORM_H diff --git a/tizen/src/ui/skinlayout.cpp b/tizen/src/ui/skinlayout.cpp deleted file mode 100644 index 0ee389bb3a..0000000000 --- a/tizen/src/ui/skinlayout.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "skinlayout.h" - -SkinLayout::SkinLayout() : - displayRegion(0, 0, 0, 0) -{ -} - -SkinLayout::~SkinLayout() -{ - qDebug("destroy skin layout"); - - for (int i = 0; i < keyList.count(); i++) { - delete keyList.at(i); - } - keyList.clear(); -} diff --git a/tizen/src/ui/skinlayout.h b/tizen/src/ui/skinlayout.h deleted file mode 100644 index 2aee722663..0000000000 --- a/tizen/src/ui/skinlayout.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SKINLAYOUT_H -#define SKINLAYOUT_H - -#include - -#include "hardwarekey.h" - -class SkinLayout -{ - Q_ENUMS(SkinImgType) - -public: - SkinLayout(); - ~SkinLayout(); - - QImage skinImg[2]; - QRect displayRegion; - QList keyList; - - enum SkinImgType { - normal = 0, - pressed = 1 - }; -}; - -#endif // SKINLAYOUT_H diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index 3943e25e00..5952791151 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -22,23 +22,23 @@ SkinView::SkinView(QGraphicsScene *scene, QWidget *parent) : void SkinView::createItems() { MainWindow *win = ((MainWindow *)this->parent()); - SkinLayout *layout = win->uiInfo->getLayout(); - if (layout == NULL) { - layout = win->uiInfo->layoutList.at(0); + SkinForm *form = win->uiInfo->getForm(); + if (form == NULL) { + form = win->uiInfo->formList.at(0); } /* bezel */ - SkinBezelItem *bezelItem = new SkinBezelItem(layout->skinImg[SkinLayout::normal]); + SkinBezelItem *bezelItem = new SkinBezelItem(form->skinImg[SkinForm::normal]); scene()->addItem(bezelItem); /* HW keys */ - QList keyList = layout->keyList; + QList keyList = form->keyList; HardwareKey *hwKey = NULL; for (int i = 0; i < keyList.count(); i++) { hwKey = keyList.at(i); if (hwKey != NULL) { - new SkinKeyItem(layout->skinImg[SkinLayout::pressed].copy(hwKey->region), + new SkinKeyItem(form->skinImg[SkinForm::pressed].copy(hwKey->region), hwKey, bezelItem); } } @@ -61,8 +61,8 @@ void SkinView::resizeEvent(QResizeEvent *event) MainWindow *win = ((MainWindow *)this->parent()); /* geometry */ - const int width = win->uiInfo->getLayoutSize().width(); - const int height = win->uiInfo->getLayoutSize().height(); + const int width = win->uiInfo->getFormSize().width(); + const int height = win->uiInfo->getFormSize().height(); setGeometry(0, 0, width, height); /* scaling */ diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index f5c07dbb45..40f0dbfc74 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -6,35 +6,35 @@ UIInformation::UIInformation() : skinPath = "./"; } -SkinLayout *UIInformation::getLayout() +SkinForm *UIInformation::getForm() { - if (uiState.getLayoutIndex() > (layoutList.count() - 1) - || uiState.getLayoutIndex() < 0) { - qWarning("layout is null"); + if (uiState.getFormIndex() > (formList.count() - 1) + || uiState.getFormIndex() < 0) { + qWarning("form is null"); return NULL; } - return layoutList.at(uiState.getLayoutIndex()); + return formList.at(uiState.getFormIndex()); } -QSize UIInformation::getLayoutSize() +QSize UIInformation::getFormSize() { - SkinLayout *layout = getLayout(); - if (layout == NULL) { + SkinForm *form = getForm(); + if (form == NULL) { return QSize(0, 0); } - return getLayout()->skinImg[SkinLayout::normal].size() * uiState.getScaleFactor(); + return getForm()->skinImg[SkinForm::normal].size() * uiState.getScaleFactor(); } UIInformation::~UIInformation() { qDebug("destroy UI info"); - for (int i = 0; i < layoutList.count(); i++) { - delete layoutList.at(i); + for (int i = 0; i < formList.count(); i++) { + delete formList.at(i); } - layoutList.clear(); + formList.clear(); for (int i = 0; i < controllerList.count(); i++) { delete controllerList.at(i); diff --git a/tizen/src/ui/uiinformation.h b/tizen/src/ui/uiinformation.h index ba26f77256..de10e1b3cc 100644 --- a/tizen/src/ui/uiinformation.h +++ b/tizen/src/ui/uiinformation.h @@ -3,9 +3,9 @@ #include -#include "skinlayout.h" +#include "skinform.h" #include "uistate.h" -#include "controllerlayout.h" +#include "controllerform.h" class UIInformation { @@ -19,14 +19,14 @@ public: QString skinPath; QString skinName; - QList layoutList; - QList controllerList; + QList formList; + QList controllerList; QColor hoverColor; UIState uiState; /* runtime information */ - SkinLayout *getLayout(); /* current */ - QSize getLayoutSize(); /* current */ + SkinForm *getForm(); /* current */ + QSize getFormSize(); /* current */ }; #endif // UIINFORMATION_H diff --git a/tizen/src/ui/uistate.cpp b/tizen/src/ui/uistate.cpp index c7f1acbb99..0928bae8ab 100644 --- a/tizen/src/ui/uistate.cpp +++ b/tizen/src/ui/uistate.cpp @@ -1,11 +1,11 @@ #include "uistate.h" UIState::UIState() : - layoutAngle(0), layoutScale(100) + formAngle(0), formScale(100) { } -int UIState::getLayoutIndex(int angle) +int UIState::getFormIndex(int angle) { // TODO: map @@ -30,9 +30,9 @@ int UIState::getLayoutIndex(int angle) return index; } -int UIState::getLayoutIndex() +int UIState::getFormIndex() { - return getLayoutIndex(layoutAngle); + return getFormIndex(formAngle); } qreal UIState::getScaleFactor(int scale) @@ -42,5 +42,5 @@ qreal UIState::getScaleFactor(int scale) qreal UIState::getScaleFactor() { - return getScaleFactor(this->layoutScale); + return getScaleFactor(this->formScale); } diff --git a/tizen/src/ui/uistate.h b/tizen/src/ui/uistate.h index 84bfd366e7..f556df5eb0 100644 --- a/tizen/src/ui/uistate.h +++ b/tizen/src/ui/uistate.h @@ -8,13 +8,13 @@ class UIState public: UIState(); - int getLayoutIndex(int angle); - int getLayoutIndex(); /* current */ + int getFormIndex(int angle); + int getFormIndex(); /* current */ qreal getScaleFactor(int scale); qreal getScaleFactor(); /* current */ - int layoutAngle; - int layoutScale; + int formAngle; + int formScale; }; #endif // UISTATE_H diff --git a/tizen/src/ui/xml/Makefile.objs b/tizen/src/ui/xml/Makefile.objs index 9a9378ad85..6cb887c6c7 100644 --- a/tizen/src/ui/xml/Makefile.objs +++ b/tizen/src/ui/xml/Makefile.objs @@ -1,10 +1,10 @@ -obj-$(CONFIG_QT) += layouttype.o moc_layouttype.o +obj-$(CONFIG_QT) += formtype.o moc_formtype.o obj-$(CONFIG_QT) += hardwarekeytype.o moc_hardwarekeytype.o obj-$(CONFIG_QT) += regiontype.o moc_regiontype.o obj-$(CONFIG_QT) += keylisttype.o moc_keylisttype.o -$(obj)/moc_layouttype.o: $(obj)/moc_layouttype.cpp -$(obj)/moc_layouttype.cpp: $(obj)/layouttype.h +$(obj)/moc_formtype.o: $(obj)/moc_formtype.cpp +$(obj)/moc_formtype.cpp: $(obj)/formtype.h moc $< -o $@ $(obj)/moc_hardwarekeytype.o: $(obj)/moc_hardwarekeytype.cpp $(obj)/moc_hardwarekeytype.cpp: $(obj)/hardwarekeytype.h diff --git a/tizen/src/ui/xml/formtype.cpp b/tizen/src/ui/xml/formtype.cpp new file mode 100644 index 0000000000..6f6e50c9cc --- /dev/null +++ b/tizen/src/ui/xml/formtype.cpp @@ -0,0 +1,50 @@ +#include "formtype.h" + +FormType::FormType(QObject *parent) : + QObject(parent), keyList(NULL) +{ +} + +void FormType::setRegionType(RegionType *regionType) +{ + this->regionType = regionType; +} + +QString FormType::mainImageName() const +{ + return mainImgName; +} + +void FormType::setMainImageName(QString imgFileName) +{ + mainImgName = imgFileName; +} + +QString FormType::pressedImageName() const +{ + return pressedImgName; +} + +void FormType::setPressedImageName(QString imgFileName) +{ + pressedImgName = imgFileName; +} + +KeyListType *FormType::keyListType() +{ + return keyList; +} + +void FormType::setKeyListType(KeyListType *keyList) +{ + this->keyList = keyList; +} + +QRect FormType::displayRegion() +{ + if (regionType == NULL) { + return QRect(0, 0, 0, 0); + } + + return regionType->region(); +} diff --git a/tizen/src/ui/xml/formtype.h b/tizen/src/ui/xml/formtype.h new file mode 100644 index 0000000000..662c0a7bce --- /dev/null +++ b/tizen/src/ui/xml/formtype.h @@ -0,0 +1,38 @@ +#ifndef FORMTYPE_H +#define FORMTYPE_H + +#include + +#include "keylisttype.h" +#include "regiontype.h" + +class FormType : public QObject +{ + Q_OBJECT + Q_PROPERTY(RegionType *display WRITE setRegionType) + Q_PROPERTY(QString mainImage READ mainImageName WRITE setMainImageName) + Q_PROPERTY(QString pressedImage READ pressedImageName WRITE setPressedImageName) + Q_PROPERTY(KeyListType *hwKeyList READ keyListType WRITE setKeyListType) + Q_CLASSINFO("DefaultProperty", "hwKeyList") + +public: + explicit FormType(QObject *parent = 0); + + void setRegionType(RegionType *regionType); + QString mainImageName() const; + void setMainImageName(QString imgFileName); + QString pressedImageName() const; + void setPressedImageName(QString imgFileName); + KeyListType *keyListType(); + void setKeyListType(KeyListType *keyList); + + QRect displayRegion(); + +private: + RegionType *regionType; + QString mainImgName; + QString pressedImgName; + KeyListType *keyList; +}; + +#endif // FORMTYPE_H diff --git a/tizen/src/ui/xml/layouttype.cpp b/tizen/src/ui/xml/layouttype.cpp deleted file mode 100644 index 235238525c..0000000000 --- a/tizen/src/ui/xml/layouttype.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "layouttype.h" - -LayoutType::LayoutType(QObject *parent) : - QObject(parent), keyList(NULL) -{ -} - -void LayoutType::setRegionType(RegionType *regionType) -{ - this->regionType = regionType; -} - -QString LayoutType::mainImageName() const -{ - return mainImgName; -} - -void LayoutType::setMainImageName(QString imgFileName) -{ - mainImgName = imgFileName; -} - -QString LayoutType::pressedImageName() const -{ - return pressedImgName; -} - -void LayoutType::setPressedImageName(QString imgFileName) -{ - pressedImgName = imgFileName; -} - -KeyListType *LayoutType::keyListType() -{ - return keyList; -} - -void LayoutType::setKeyListType(KeyListType *keyList) -{ - this->keyList = keyList; -} - -QRect LayoutType::displayRegion() -{ - if (regionType == NULL) { - return QRect(0, 0, 0, 0); - } - - return regionType->region(); -} diff --git a/tizen/src/ui/xml/layouttype.h b/tizen/src/ui/xml/layouttype.h deleted file mode 100644 index b0af6d8260..0000000000 --- a/tizen/src/ui/xml/layouttype.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef LAYOUTTYPE_H -#define LAYOUTTYPE_H - -#include - -#include "keylisttype.h" -#include "regiontype.h" - -class LayoutType : public QObject -{ - Q_OBJECT - Q_PROPERTY(RegionType *display WRITE setRegionType) - Q_PROPERTY(QString mainImage READ mainImageName WRITE setMainImageName) - Q_PROPERTY(QString pressedImage READ pressedImageName WRITE setPressedImageName) - Q_PROPERTY(KeyListType *hwKeyList READ keyListType WRITE setKeyListType) - Q_CLASSINFO("DefaultProperty", "hwKeyList") - -public: - explicit LayoutType(QObject *parent = 0); - - void setRegionType(RegionType *regionType); - QString mainImageName() const; - void setMainImageName(QString imgFileName); - QString pressedImageName() const; - void setPressedImageName(QString imgFileName); - KeyListType *keyListType(); - void setKeyListType(KeyListType *keyList); - - QRect displayRegion(); - -private: - RegionType *regionType; - QString mainImgName; - QString pressedImgName; - KeyListType *keyList; -}; - -#endif // LAYOUTTYPE_H