diff options
author | GiWoong Kim <giwoong.kim@samsung.com> | 2014-08-12 13:12:19 +0900 |
---|---|---|
committer | GiWoong Kim <giwoong.kim@samsung.com> | 2014-08-12 16:47:35 +0900 |
commit | a9013cf05859ce88431483f6d2b3282f43e2e48d (patch) | |
tree | 900ffff157ec269aa6e93cd1a90489cc424aebc2 /tizen | |
parent | ddacec66c398e8d99c84982a7083c8d485018ed6 (diff) | |
download | qemu-a9013cf05859ce88431483f6d2b3282f43e2e48d.tar.gz qemu-a9013cf05859ce88431483f6d2b3282f43e2e48d.tar.bz2 qemu-a9013cf05859ce88431483f6d2b3282f43e2e48d.zip |
ui: clean up QML
delete a QtQuickItem
remove warnings
modified varable & function names
Change-Id: Ic8044786c7f7e3163e16503c3408fc441ce992a8
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
Diffstat (limited to 'tizen')
-rw-r--r-- | tizen/src/display/qt5_supplement.cpp | 37 | ||||
-rw-r--r-- | tizen/src/ui/mainwindow.cpp | 3 | ||||
-rw-r--r-- | tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml | 243 | ||||
-rw-r--r-- | tizen/src/ui/resource/wearable-320x320-1btn/layout.qml | 83 | ||||
-rw-r--r-- | tizen/src/ui/xml/Makefile.objs | 8 | ||||
-rw-r--r-- | tizen/src/ui/xml/emulatoruitype.cpp | 17 | ||||
-rw-r--r-- | tizen/src/ui/xml/emulatoruitype.h | 25 | ||||
-rw-r--r-- | tizen/src/ui/xml/formlisttype.cpp | 17 | ||||
-rw-r--r-- | tizen/src/ui/xml/formlisttype.h | 26 | ||||
-rw-r--r-- | tizen/src/ui/xml/formtype.cpp | 16 | ||||
-rw-r--r-- | tizen/src/ui/xml/formtype.h | 20 | ||||
-rw-r--r-- | tizen/src/ui/xml/hardwarekeytype.cpp | 14 | ||||
-rw-r--r-- | tizen/src/ui/xml/hardwarekeytype.h | 14 | ||||
-rw-r--r-- | tizen/src/ui/xml/keylisttype.cpp | 9 | ||||
-rw-r--r-- | tizen/src/ui/xml/keylisttype.h | 11 | ||||
-rw-r--r-- | tizen/src/ui/xml/regiontype.cpp | 21 | ||||
-rw-r--r-- | tizen/src/ui/xml/regiontype.h | 19 |
17 files changed, 365 insertions, 218 deletions
diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 07dce80336..9195e30bd5 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -27,20 +27,16 @@ */ #include <QApplication> -#include "qt5_supplement.h" - #include <QQmlComponent> #include <QQmlEngine> #include <QQmlProperty> -#include <QtQuick/QQuickItem> +#include "qt5_supplement.h" #include "mainwindow.h" #include "uiinformation.h" #include "hardwarekey.h" #include "controllerwidget.h" -#include "ui/xml/hardwarekeytype.h" -#include "ui/xml/keylisttype.h" -#include "ui/xml/formtype.h" +#include "ui/xml/emulatoruitype.h" extern "C" { #include "emul_state.h" @@ -198,6 +194,8 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) qDebug("skin form is loaded from %s", qPrintable(file->fileName())); + qmlRegisterType<EmulatorUIType>("EmulatorComponent", 1, 0, "EmulatorUI"); + qmlRegisterType<FormListType>("EmulatorComponent", 1, 0, "FormList"); qmlRegisterType<FormType>("EmulatorComponent", 1, 0, "Form"); /* QML */ @@ -214,17 +212,18 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) QFileInfo fileInfo(*file); qDebug() << "xml version :" << QQmlProperty::read(object, "version").toString(); + EmulatorUIType *uiType = (EmulatorUIType *)object; FormType *formType = NULL; KeyListType *keyListType = NULL; HardwareKeyType *hwKeyType = NULL; - QObjectList formTypeList = object->children(); - for (int index = 0; index < formTypeList.count(); index++) { + FormListType *formListType = uiType->formListType(); + for (int index = 0; index < formListType->getFormList()->count(); index++) { SkinForm *form = new SkinForm(); /* dst */ - formType = (FormType *)formTypeList.at(index); /* src */ + formType = (FormType *)formListType->getFormList()->at(index); /* src */ - form->displayRegion = formType->displayRegion(); + form->displayRegion = formType->getDisplayRegion(); form->skinImg[SkinForm::normal].load( fileInfo.absolutePath() + "/" + formType->mainImageName()); form->skinImg[SkinForm::pressed].load( @@ -232,12 +231,11 @@ void loadSkinFormFromXML(QFile *file, UIInformation *uiInfo/* out */) keyListType = formType->keyListType(); if (keyListType != NULL) { - for (int i = 0; i < keyListType->list.count(); i++) { - hwKeyType = keyListType->list.at(i); + for (int i = 0; i < keyListType->getKeyList()->count(); i++) { + hwKeyType = keyListType->getKeyList()->at(i); if (hwKeyType != NULL) { - form->keyList.append( - new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), - hwKeyType->region(), hwKeyType->tooltip())); + form->keyList.append(new HardwareKey(hwKeyType->objectName(), + hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } @@ -287,12 +285,11 @@ void loadControllerFormFromXML(QFile *file, UIInformation *uiInfo/* out */) keyListType = formType->keyListType(); if (keyListType != NULL) { - for (int i = 0; i < keyListType->list.count(); i++) { - hwKeyType = keyListType->list.at(i); + for (int i = 0; i < keyListType->getKeyList()->count(); i++) { + hwKeyType = keyListType->getKeyList()->at(i); if (hwKeyType != NULL) { - form->keyList.append( - new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), - hwKeyType->region(), hwKeyType->tooltip())); + form->keyList.append(new HardwareKey(hwKeyType->objectName(), + hwKeyType->keycode(), hwKeyType->region(), hwKeyType->tooltip())); } } } diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 3a025ee5a3..63dee5f1c3 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -71,8 +71,11 @@ MainWindow::MainWindow(UIInformation *uiInfo, QWidget *parent) : QHBoxLayout *winLayout = new QHBoxLayout(this); winLayout->setMargin(0); winLayout->setSpacing(0); + /* scene */ QGraphicsScene* skinScene = new QGraphicsScene(this); + //skinScene->setBackgroundBrush(Qt::black); + /* view */ skinView = new SkinView(skinScene, this); winLayout->addWidget(skinView); diff --git a/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml b/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml index ab67ef49a1..012075db3d 100644 --- a/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml +++ b/tizen/src/ui/resource/mobile-720x1280-3btn/layout.qml @@ -1,145 +1,146 @@ -import QtQuick 2.0 import EmulatorComponent 1.0 -Item { +EmulatorUI { property string version: "1.0" - Form { - objectName: "portrait" - display: Region { left: 67; top: 116; width: 720; height: 1280 } + FormList { + Form { + objectName: "portrait" + display: Region { left: 67; top: 116; width: 720; height: 1280 } - mainImage: "default_0.png" - pressedImage: "default_0_p.png" + mainImage: "default_0.png" + pressedImage: "default_0_p.png" - KeyList { - Key { objectName: "Menu"; keycode: 169 - Region { left: 210; top: 1401; width: 84; height: 84 } - tooltip: "Menu" - } - Key { objectName: "Home"; keycode: 139 - Region { left: 390; top: 1401; width: 84; height: 84 } - tooltip: "Home" - } - Key { objectName: "Back"; keycode: 158 - Region { left: 570; top: 1401; width: 84; height: 84 } - tooltip: "Back" - } - Key { objectName: "Power"; keycode: 116 - Region { left: 841; top: 1309; width: 24; height: 96 } - tooltip: "Power" - } - Key { objectName: "Volume +"; keycode: 115 - Region { left: 841; top: 108; width: 24; height: 96 } - tooltip: "Volume +" - } - Key { objectName: "Volume -"; keycode: 114 - Region { left: 841; top: 219; width: 24; height: 96 } - tooltip: "Volume -" + KeyList { + Key { objectName: "Menu"; keycode: 169 + Region { left: 210; top: 1401; width: 84; height: 84 } + tooltip: "Menu" + } + Key { objectName: "Home"; keycode: 139 + Region { left: 390; top: 1401; width: 84; height: 84 } + tooltip: "Home" + } + Key { objectName: "Back"; keycode: 158 + Region { left: 570; top: 1401; width: 84; height: 84 } + tooltip: "Back" + } + Key { objectName: "Power"; keycode: 116 + Region { left: 841; top: 1309; width: 24; height: 96 } + tooltip: "Power" + } + Key { objectName: "Volume +"; keycode: 115 + Region { left: 841; top: 108; width: 24; height: 96 } + tooltip: "Volume +" + } + Key { objectName: "Volume -"; keycode: 114 + Region { left: 841; top: 219; width: 24; height: 96 } + tooltip: "Volume -" + } } } - } - Form { - objectName: "landscape" - display: Region { left: 116; top: 78; width: 1280; height: 720 } + Form { + objectName: "landscape" + display: Region { left: 116; top: 78; width: 1280; height: 720 } - mainImage: "default_L90.png" - pressedImage: "default_L90_p.png" + mainImage: "default_L90.png" + pressedImage: "default_L90_p.png" - KeyList { - Key { objectName: "Menu"; keycode: 169 - Region { left: 1400; top: 570; width: 84; height: 84 } - tooltip: "Menu" - } - Key { objectName: "Home"; keycode: 139 - Region { left: 1400; top: 392; width: 84; height: 84 } - tooltip: "Home" - } - Key { objectName: "Back"; keycode: 158 - Region { left: 1400; top: 210; width: 84; height: 84 } - tooltip: "Back" - } - Key { objectName: "Power"; keycode: 116 - Region { left: 1308; top: 2; width: 96; height: 24 } - tooltip: "Power" - } - Key { objectName: "Volume +"; keycode: 115 - Region { left: 108; top: 2; width: 96; height: 24 } - tooltip: "Volume +" - } - Key { objectName: "Volume -"; keycode: 114 - Region { left: 217; top: 2; width: 96; height: 24 } - tooltip: "Volume -" + KeyList { + Key { objectName: "Menu"; keycode: 169 + Region { left: 1400; top: 570; width: 84; height: 84 } + tooltip: "Menu" + } + Key { objectName: "Home"; keycode: 139 + Region { left: 1400; top: 392; width: 84; height: 84 } + tooltip: "Home" + } + Key { objectName: "Back"; keycode: 158 + Region { left: 1400; top: 210; width: 84; height: 84 } + tooltip: "Back" + } + Key { objectName: "Power"; keycode: 116 + Region { left: 1308; top: 2; width: 96; height: 24 } + tooltip: "Power" + } + Key { objectName: "Volume +"; keycode: 115 + Region { left: 108; top: 2; width: 96; height: 24 } + tooltip: "Volume +" + } + Key { objectName: "Volume -"; keycode: 114 + Region { left: 217; top: 2; width: 96; height: 24 } + tooltip: "Volume -" + } } } - } - Form { - objectName: "reverse portrait" - display: Region { left: 78; top: 117; width: 720; height: 1280 } + Form { + objectName: "reverse portrait" + display: Region { left: 78; top: 117; width: 720; height: 1280 } - mainImage: "default_180.png" - pressedImage: "default_180_p.png" + mainImage: "default_180.png" + pressedImage: "default_180_p.png" - KeyList { - Key { objectName: "Menu"; keycode: 169 - Region { left: 570; top: 30; width: 84; height: 84 } - tooltip: "Menu" - } - Key { objectName: "Home"; keycode: 139 - Region { left: 390; top: 30; width: 84; height: 84 } - tooltip: "Home" - } - Key { objectName: "Back"; keycode: 158 - Region { left: 210; top: 30; width: 84; height: 84 } - tooltip: "Back" - } - Key { objectName: "Power"; keycode: 116 - Region { left: 2; top: 110; width: 24; height: 96 } - tooltip: "Power" - } - Key { objectName: "Volume +"; keycode: 115 - Region { left: 2; top: 1310; width: 24; height: 96 } - tooltip: "Volume +" - } - Key { objectName: "Volume -"; keycode: 114 - Region { left: 2; top: 1200; width: 24; height: 96 } - tooltip: "Volume -" + KeyList { + Key { objectName: "Menu"; keycode: 169 + Region { left: 570; top: 30; width: 84; height: 84 } + tooltip: "Menu" + } + Key { objectName: "Home"; keycode: 139 + Region { left: 390; top: 30; width: 84; height: 84 } + tooltip: "Home" + } + Key { objectName: "Back"; keycode: 158 + Region { left: 210; top: 30; width: 84; height: 84 } + tooltip: "Back" + } + Key { objectName: "Power"; keycode: 116 + Region { left: 2; top: 110; width: 24; height: 96 } + tooltip: "Power" + } + Key { objectName: "Volume +"; keycode: 115 + Region { left: 2; top: 1310; width: 24; height: 96 } + tooltip: "Volume +" + } + Key { objectName: "Volume -"; keycode: 114 + Region { left: 2; top: 1200; width: 24; height: 96 } + tooltip: "Volume -" + } } } - } - Form { - objectName: "reverse landscape" - display: Region { left: 117; top: 67; width: 1280; height: 720 } + Form { + objectName: "reverse landscape" + display: Region { left: 117; top: 67; width: 1280; height: 720 } - mainImage: "default_R90.png" - pressedImage: "default_R90_p.png" + mainImage: "default_R90.png" + pressedImage: "default_R90_p.png" - KeyList { - Key { objectName: "Menu"; keycode: 169 - Region { left: 28; top: 209; width: 84; height: 84 } - tooltip: "Menu" - } - Key { objectName: "Home"; keycode: 139 - Region { left: 28; top: 391; width: 84; height: 84 } - tooltip: "Home" - } - Key { objectName: "Back"; keycode: 158 - Region { left: 28; top: 568; width: 84; height: 84 } - tooltip: "Back" - } - Key { objectName: "Power"; keycode: 116 - Region { left: 109; top: 841; width: 96; height: 24 } - tooltip: "Power" - } - Key { objectName: "Volume +"; keycode: 115 - Region { left: 1309; top: 841; width: 96; height: 24 } - tooltip: "Volume +" - } - Key { objectName: "Volume -"; keycode: 114 - Region { left: 1199; top: 841; width: 96; height: 24 } - tooltip: "Volume -" + KeyList { + Key { objectName: "Menu"; keycode: 169 + Region { left: 28; top: 209; width: 84; height: 84 } + tooltip: "Menu" + } + Key { objectName: "Home"; keycode: 139 + Region { left: 28; top: 391; width: 84; height: 84 } + tooltip: "Home" + } + Key { objectName: "Back"; keycode: 158 + Region { left: 28; top: 568; width: 84; height: 84 } + tooltip: "Back" + } + Key { objectName: "Power"; keycode: 116 + Region { left: 109; top: 841; width: 96; height: 24 } + tooltip: "Power" + } + Key { objectName: "Volume +"; keycode: 115 + Region { left: 1309; top: 841; width: 96; height: 24 } + tooltip: "Volume +" + } + Key { objectName: "Volume -"; keycode: 114 + Region { left: 1199; top: 841; width: 96; height: 24 } + tooltip: "Volume -" + } } } } diff --git a/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml b/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml index f7a0a1c853..9fee04421d 100644 --- a/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml +++ b/tizen/src/ui/resource/wearable-320x320-1btn/layout.qml @@ -1,65 +1,66 @@ -import QtQuick 2.0 import EmulatorComponent 1.0 -Item { +EmulatorUI { property string version: "1.0" - Form { - objectName: "portrait" - display: Region { left: 26; top: 60; width: 320; height: 320 } + FormList { + Form { + objectName: "portrait" + display: Region { left: 26; top: 60; width: 320; height: 320 } - mainImage: "default_0.png" - pressedImage: "default_0_p.png" + mainImage: "default_0.png" + pressedImage: "default_0_p.png" - KeyList { - Key { objectName: "Power"; keycode: 116 - Region { left: 372; top: 116; width: 12; height: 80 } - tooltip: "Power" + KeyList { + Key { objectName: "Power"; keycode: 116 + Region { left: 372; top: 116; width: 12; height: 80 } + tooltip: "Power" + } } } - } - Form { - objectName: "landscape" - display: Region { left: 60; top: 38; width: 320; height: 320 } + Form { + objectName: "landscape" + display: Region { left: 60; top: 38; width: 320; height: 320 } - mainImage: "default_L90.png" - pressedImage: "default_L90_p.png" + mainImage: "default_L90.png" + pressedImage: "default_L90_p.png" - KeyList { - Key { objectName: "Power"; keycode: 116 - Region { left: 116; top: 0; width: 80; height: 12 } - tooltip: "Power" + KeyList { + Key { objectName: "Power"; keycode: 116 + Region { left: 116; top: 0; width: 80; height: 12 } + tooltip: "Power" + } } } - } - Form { - objectName: "reverse portrait" - display: Region { left: 38; top: 60; width: 320; height: 320 } + Form { + objectName: "reverse portrait" + display: Region { left: 38; top: 60; width: 320; height: 320 } - mainImage: "default_180.png" - pressedImage: "default_180_p.png" + mainImage: "default_180.png" + pressedImage: "default_180_p.png" - KeyList { - Key { objectName: "Power"; keycode: 116 - Region { left: 0; top: 244; width: 12; height: 80 } - tooltip: "Power" + KeyList { + Key { objectName: "Power"; keycode: 116 + Region { left: 0; top: 244; width: 12; height: 80 } + tooltip: "Power" + } } } - } - Form { - objectName: "reverse landscape" - display: Region { left: 60; top: 26; width: 320; height: 320 } + Form { + objectName: "reverse landscape" + display: Region { left: 60; top: 26; width: 320; height: 320 } - mainImage: "default_R90.png" - pressedImage: "default_R90_p.png" + mainImage: "default_R90.png" + pressedImage: "default_R90_p.png" - KeyList { - Key { objectName: "Power"; keycode: 116 - Region { left: 244; top: 372; width: 80; height: 12 } - tooltip: "Power" + KeyList { + Key { objectName: "Power"; keycode: 116 + Region { left: 244; top: 372; width: 80; height: 12 } + tooltip: "Power" + } } } } diff --git a/tizen/src/ui/xml/Makefile.objs b/tizen/src/ui/xml/Makefile.objs index 6cb887c6c7..3b999b8448 100644 --- a/tizen/src/ui/xml/Makefile.objs +++ b/tizen/src/ui/xml/Makefile.objs @@ -1,8 +1,16 @@ +obj-$(CONFIG_QT) += emulatoruitype.o moc_emulatoruitype.o +obj-$(CONFIG_QT) += formlisttype.o moc_formlisttype.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_emulatoruitype.o: $(obj)/moc_emulatoruitype.cpp +$(obj)/moc_emulatoruitype.cpp: $(obj)/emulatoruitype.h + moc $< -o $@ +$(obj)/moc_formlisttype.o: $(obj)/moc_formlisttype.cpp +$(obj)/moc_formlisttype.cpp: $(obj)/formlisttype.h + moc $< -o $@ $(obj)/moc_formtype.o: $(obj)/moc_formtype.cpp $(obj)/moc_formtype.cpp: $(obj)/formtype.h moc $< -o $@ diff --git a/tizen/src/ui/xml/emulatoruitype.cpp b/tizen/src/ui/xml/emulatoruitype.cpp new file mode 100644 index 0000000000..fc615e3582 --- /dev/null +++ b/tizen/src/ui/xml/emulatoruitype.cpp @@ -0,0 +1,17 @@ +#include "emulatoruitype.h" + +EmulatorUIType::EmulatorUIType(QObject *parent) : + QObject(parent) +{ + /* do nothing */ +} + +FormListType *EmulatorUIType::formListType() +{ + return formList; +} + +void EmulatorUIType::setFormListType(FormListType *formList) +{ + this->formList = formList; +} diff --git a/tizen/src/ui/xml/emulatoruitype.h b/tizen/src/ui/xml/emulatoruitype.h new file mode 100644 index 0000000000..298c4a8d41 --- /dev/null +++ b/tizen/src/ui/xml/emulatoruitype.h @@ -0,0 +1,25 @@ +#ifndef EMULATORUITYPE_H +#define EMULATORUITYPE_H + +#include <QObject> + +#include "formlisttype.h" + +class EmulatorUIType : public QObject +{ + Q_OBJECT + Q_PROPERTY(FormListType *formListType READ formListType WRITE setFormListType) + Q_CLASSINFO("DefaultProperty", "formListType") + +public: + explicit EmulatorUIType(QObject *parent = 0); + + FormListType *formListType(); + +private: + void setFormListType(FormListType *formList); + + FormListType *formList; +}; + +#endif // EMULATORUITYPE_H diff --git a/tizen/src/ui/xml/formlisttype.cpp b/tizen/src/ui/xml/formlisttype.cpp new file mode 100644 index 0000000000..fc8dcc30a8 --- /dev/null +++ b/tizen/src/ui/xml/formlisttype.cpp @@ -0,0 +1,17 @@ +#include "formlisttype.h" + +FormListType::FormListType(QObject *parent) : + QObject(parent) +{ + /* do nothing */ +} + +QQmlListProperty<FormType> FormListType::formList() +{ + return QQmlListProperty<FormType>(this, list); +} + +QList<FormType *> *FormListType::getFormList() +{ + return &list; +} diff --git a/tizen/src/ui/xml/formlisttype.h b/tizen/src/ui/xml/formlisttype.h new file mode 100644 index 0000000000..52f5d9a2b1 --- /dev/null +++ b/tizen/src/ui/xml/formlisttype.h @@ -0,0 +1,26 @@ +#ifndef FORMLISTTYPE_H +#define FORMLISTTYPE_H + +#include <QObject> +#include <QQmlListProperty> + +#include "formtype.h" + +class FormListType : public QObject +{ + Q_OBJECT + Q_PROPERTY(QQmlListProperty<FormType> formList READ formList) + Q_CLASSINFO("DefaultProperty", "formList") + +public: + explicit FormListType(QObject *parent = 0); + + QList<FormType *> *getFormList(); + +private: + QQmlListProperty<FormType> formList(); + + QList<FormType *> list; +}; + +#endif // FORMLISTTYPE_H diff --git a/tizen/src/ui/xml/formtype.cpp b/tizen/src/ui/xml/formtype.cpp index 6f6e50c9cc..61419e4b52 100644 --- a/tizen/src/ui/xml/formtype.cpp +++ b/tizen/src/ui/xml/formtype.cpp @@ -3,11 +3,17 @@ FormType::FormType(QObject *parent) : QObject(parent), keyList(NULL) { + /* do nothing */ } -void FormType::setRegionType(RegionType *regionType) +RegionType *FormType::displayRegionType() { - this->regionType = regionType; + return displayRegion; +} + +void FormType::setDisplayRegionType(RegionType *displayRegion) +{ + this->displayRegion = displayRegion; } QString FormType::mainImageName() const @@ -40,11 +46,11 @@ void FormType::setKeyListType(KeyListType *keyList) this->keyList = keyList; } -QRect FormType::displayRegion() +QRect FormType::getDisplayRegion() { - if (regionType == NULL) { + if (displayRegion == NULL) { return QRect(0, 0, 0, 0); } - return regionType->region(); + return displayRegion->region(); } diff --git a/tizen/src/ui/xml/formtype.h b/tizen/src/ui/xml/formtype.h index 662c0a7bce..cf35de13f8 100644 --- a/tizen/src/ui/xml/formtype.h +++ b/tizen/src/ui/xml/formtype.h @@ -9,27 +9,29 @@ class FormType : public QObject { Q_OBJECT - Q_PROPERTY(RegionType *display WRITE setRegionType) + Q_PROPERTY(RegionType *display READ displayRegionType WRITE setDisplayRegionType) 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") + Q_PROPERTY(KeyListType *keyListType READ keyListType WRITE setKeyListType) + Q_CLASSINFO("DefaultProperty", "keyListType") 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(); + QRect getDisplayRegion(); private: - RegionType *regionType; + RegionType *displayRegionType(); + void setDisplayRegionType(RegionType *displayRegion); + void setMainImageName(QString imgFileName); + void setPressedImageName(QString imgFileName); + void setKeyListType(KeyListType *keyList); + + RegionType *displayRegion; QString mainImgName; QString pressedImgName; KeyListType *keyList; diff --git a/tizen/src/ui/xml/hardwarekeytype.cpp b/tizen/src/ui/xml/hardwarekeytype.cpp index 975091e1af..e2667fb0cc 100644 --- a/tizen/src/ui/xml/hardwarekeytype.cpp +++ b/tizen/src/ui/xml/hardwarekeytype.cpp @@ -3,6 +3,7 @@ HardwareKeyType::HardwareKeyType(QObject *parent) : QObject(parent) { + /* do nothing */ } int HardwareKeyType::keycode() const @@ -25,16 +26,21 @@ void HardwareKeyType::setTooltip(const QString &tooltip) tip = tooltip; } -void HardwareKeyType::setRegionType(RegionType *regionType) +RegionType *HardwareKeyType::keyRegionType() { - this->regionType = regionType; + return keyRegion; +} + +void HardwareKeyType::setKeyRegionType(RegionType *keyRegion) +{ + this->keyRegion = keyRegion; } QRect HardwareKeyType::region() { - if (regionType == NULL) { + if (keyRegion == NULL) { return QRect(0, 0, 0, 0); } - return regionType->region(); + return keyRegion->region(); } diff --git a/tizen/src/ui/xml/hardwarekeytype.h b/tizen/src/ui/xml/hardwarekeytype.h index a63acf154e..4e86af00ed 100644 --- a/tizen/src/ui/xml/hardwarekeytype.h +++ b/tizen/src/ui/xml/hardwarekeytype.h @@ -10,24 +10,26 @@ class HardwareKeyType : public QObject Q_OBJECT Q_PROPERTY(int keycode READ keycode WRITE setKeycode) Q_PROPERTY(QString tooltip READ tooltip WRITE setTooltip) - Q_PROPERTY(RegionType *keyRegion WRITE setRegionType) - Q_CLASSINFO("DefaultProperty", "keyRegion") + Q_PROPERTY(RegionType *keyRegionType READ keyRegionType WRITE setKeyRegionType) + Q_CLASSINFO("DefaultProperty", "keyRegionType") public: explicit HardwareKeyType(QObject *parent = 0); int keycode() const; - void setKeycode(int keycode); QString tooltip() const; - void setTooltip(const QString &tooltip); - void setRegionType(RegionType *regionType); QRect region(); private: + void setKeycode(int keycode); + void setTooltip(const QString &tooltip); + RegionType *keyRegionType(); + void setKeyRegionType(RegionType *regionType); + int code; QString tip; - RegionType *regionType; + RegionType *keyRegion; }; #endif // HARDWAREKEYTYPE_H diff --git a/tizen/src/ui/xml/keylisttype.cpp b/tizen/src/ui/xml/keylisttype.cpp index c3b0a7fb50..503ebeef32 100644 --- a/tizen/src/ui/xml/keylisttype.cpp +++ b/tizen/src/ui/xml/keylisttype.cpp @@ -3,9 +3,16 @@ KeyListType::KeyListType(QObject *parent) : QObject(parent) { + /* do nothing */ } -QQmlListProperty<HardwareKeyType> KeyListType::keylist() +QQmlListProperty<HardwareKeyType> KeyListType::keyListType() { return QQmlListProperty<HardwareKeyType>(this, list); } + +QList<HardwareKeyType *> *KeyListType::getKeyList() +{ + return &list; +} + diff --git a/tizen/src/ui/xml/keylisttype.h b/tizen/src/ui/xml/keylisttype.h index b7f4d3c567..9729fcf0b8 100644 --- a/tizen/src/ui/xml/keylisttype.h +++ b/tizen/src/ui/xml/keylisttype.h @@ -4,18 +4,21 @@ #include <QObject> #include <QQmlListProperty> -#include "xml/hardwarekeytype.h" +#include "hardwarekeytype.h" class KeyListType : public QObject { Q_OBJECT - Q_PROPERTY(QQmlListProperty<HardwareKeyType> keylist READ keylist) - Q_CLASSINFO("DefaultProperty", "keylist") + Q_PROPERTY(QQmlListProperty<HardwareKeyType> keyListType READ keyListType) + Q_CLASSINFO("DefaultProperty", "keyListType") public: explicit KeyListType(QObject *parent = 0); - QQmlListProperty<HardwareKeyType> keylist(); + QList<HardwareKeyType *> *getKeyList(); + +private: + QQmlListProperty<HardwareKeyType> keyListType(); QList<HardwareKeyType *> list; }; diff --git a/tizen/src/ui/xml/regiontype.cpp b/tizen/src/ui/xml/regiontype.cpp index ebdded8bd8..d2aaff3186 100644 --- a/tizen/src/ui/xml/regiontype.cpp +++ b/tizen/src/ui/xml/regiontype.cpp @@ -3,6 +3,12 @@ RegionType::RegionType(QObject *parent) : QObject(parent), x(0), y(0), w(0), h(0) { + /* do nothing */ +} + +int RegionType::left() +{ + return x; } void RegionType::setLeft(int left) @@ -10,16 +16,31 @@ void RegionType::setLeft(int left) x = left; } +int RegionType::top() +{ + return y; +} + void RegionType::setTop(int top) { y = top; } +int RegionType::width() +{ + return w; +} + void RegionType::setWidth(int width) { w = width; } +int RegionType::height() +{ + return h; +} + void RegionType::setHeight(int height) { h = height; diff --git a/tizen/src/ui/xml/regiontype.h b/tizen/src/ui/xml/regiontype.h index 6fb946f189..c6a53a28f4 100644 --- a/tizen/src/ui/xml/regiontype.h +++ b/tizen/src/ui/xml/regiontype.h @@ -7,22 +7,27 @@ class RegionType : public QObject { Q_OBJECT - Q_PROPERTY(int left WRITE setLeft) - Q_PROPERTY(int top WRITE setTop) - Q_PROPERTY(int width WRITE setWidth) - Q_PROPERTY(int height WRITE setHeight) + Q_PROPERTY(int left READ left WRITE setLeft) + Q_PROPERTY(int top READ top WRITE setTop) + Q_PROPERTY(int width READ width WRITE setWidth) + Q_PROPERTY(int height READ height WRITE setHeight) public: explicit RegionType(QObject *parent = 0); + int left(); + int top(); + int width(); + int height(); + + QRect region() const; + +private: void setLeft(int left); void setTop(int top); void setWidth(int width); void setHeight(int height); - QRect region() const; - -private: int x; int y; int w; |