From: GiWoong Kim Date: Tue, 17 Mar 2015 12:42:40 +0000 (+0900) Subject: skin: consider general purpose controller X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~522 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=334039cb76c6d86b40d452ad23d736004b8fe2b5;p=sdk%2Femulator%2Fqemu.git skin: consider general purpose controller add resource images for general purpose controller declare LayoutForm class Change-Id: I9af43c6ac690e97c55c51874aae64c52e548a4c8 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/display/xmllayoutparser.cpp b/tizen/src/display/xmllayoutparser.cpp index 6352fd970a..c63db63477 100644 --- a/tizen/src/display/xmllayoutparser.cpp +++ b/tizen/src/display/xmllayoutparser.cpp @@ -233,10 +233,11 @@ int XmlLayoutParser::parseMainFormList( if (form->skinImg[MainForm::normal].size() == QSize(0, 0)) { qDebug("general purpose skin form"); - SkinPainter skinPainter("main-skin", + SkinPainter painter("main-skin", form->displayType->region.width(), form->displayType->region.height()); - form->skinImg[MainForm::normal] = skinPainter.getSkinImage(); - form->displayType->region.translate(skinPainter.getDisplayRect().topLeft()); + form->skinImg[MainForm::normal] = painter.getSkinImage(); + form->displayType->region.translate(painter.getCenterRect().topLeft()); + form->setGeneralPurpose(true); } list.append(form); @@ -565,6 +566,12 @@ QString XmlLayoutParser::parseControllerUI(QXmlStreamReader &xml) } else if (xml.name() == FORM_KEYWORD) { form = parseControllerForm(xml); if (form != NULL) { + if (form->conImg[ControllerForm::normal].size() == QSize(0, 0)) { + qDebug("general purpose con form"); + + // TODO: + } + uiInfo->conFormList.append(form); } } diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index e9f8bf7955..bd8f10397b 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -18,6 +18,7 @@ obj-$(CONFIG_QT) += mainwindow.o moc_mainwindow.o obj-$(CONFIG_QT) += skinbezelitem.o obj-$(CONFIG_QT) += skinkeyitem.o moc_skinkeyitem.o obj-$(CONFIG_QT) += displaytype.o +obj-$(CONFIG_QT) += layoutform.o obj-$(CONFIG_QT) += mainform.o obj-$(CONFIG_QT) += keyboardhelper.o obj-$(CONFIG_QT) += keyboardshortcut.o moc_keyboardshortcut.o diff --git a/tizen/src/ui/controllerform.cpp b/tizen/src/ui/controllerform.cpp index d9a3e4976b..4b1b924dd9 100644 --- a/tizen/src/ui/controllerform.cpp +++ b/tizen/src/ui/controllerform.cpp @@ -29,14 +29,9 @@ #include "controllerform.h" -ControllerForm::ControllerForm(const QString &name) +ControllerForm::ControllerForm(const QString &name) : LayoutForm(name) { - this->name = name; -} - -QString ControllerForm::getName() -{ - return name; + /* do nothing */ } ControllerForm::~ControllerForm() diff --git a/tizen/src/ui/controllerform.h b/tizen/src/ui/controllerform.h index a78e58fe09..316fc8b7cc 100644 --- a/tizen/src/ui/controllerform.h +++ b/tizen/src/ui/controllerform.h @@ -32,9 +32,10 @@ #include +#include "layoutform.h" #include "hardwarekey.h" -class ControllerForm +class ControllerForm : public LayoutForm { Q_ENUMS(ConImgType) @@ -42,8 +43,6 @@ public: ControllerForm(const QString &name); ~ControllerForm(); - QString getName(); - QImage conImg[2]; QList keyList; @@ -51,9 +50,6 @@ public: normal = 0, pressed = 1 }; - -private: - QString name; }; #endif // CONTROLLERFORM_H diff --git a/tizen/src/ui/layoutform.cpp b/tizen/src/ui/layoutform.cpp new file mode 100644 index 0000000000..e60743d54d --- /dev/null +++ b/tizen/src/ui/layoutform.cpp @@ -0,0 +1,51 @@ +/* + * Qt UI + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * Sangho Park + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "layoutform.h" + +LayoutForm::LayoutForm(const QString &name) +{ + this->name = name; + this->generalPurpose = false; +} + +QString LayoutForm::getName() +{ + return name; +} + +void LayoutForm::setGeneralPurpose(bool general) +{ + generalPurpose = general; +} + +bool LayoutForm::isGeneralPurpose() +{ + return generalPurpose; +} diff --git a/tizen/src/ui/layoutform.h b/tizen/src/ui/layoutform.h new file mode 100644 index 0000000000..6da9b27496 --- /dev/null +++ b/tizen/src/ui/layoutform.h @@ -0,0 +1,49 @@ +/* + * Qt UI + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * Sangho Park + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#ifndef LAYOUTFORM_H +#define LAYOUTFORM_H + +#include + +class LayoutForm +{ +public: + LayoutForm(const QString &name); + + QString getName(); + void setGeneralPurpose(bool general); + bool isGeneralPurpose(); + +private: + QString name; + bool generalPurpose; +}; + +#endif // LAYOUTFORM_H diff --git a/tizen/src/ui/mainform.cpp b/tizen/src/ui/mainform.cpp index 94e30e77aa..3076e7b98a 100644 --- a/tizen/src/ui/mainform.cpp +++ b/tizen/src/ui/mainform.cpp @@ -29,17 +29,11 @@ #include "mainform.h" -MainForm::MainForm(const QString &name) +MainForm::MainForm(const QString &name) : LayoutForm(name) { - this->name = name; this->displayType = NULL; } -QString MainForm::getName() -{ - return name; -} - MainForm::~MainForm() { qDebug("destroy main form"); diff --git a/tizen/src/ui/mainform.h b/tizen/src/ui/mainform.h index c06eb5c70c..9de052b751 100644 --- a/tizen/src/ui/mainform.h +++ b/tizen/src/ui/mainform.h @@ -30,12 +30,13 @@ #ifndef MAINFORM_H #define MAINFORM_H -#include +#include +#include "layoutform.h" #include "displaytype.h" #include "hardwarekey.h" -class MainForm +class MainForm : public LayoutForm { Q_ENUMS(SkinImgType) @@ -43,8 +44,6 @@ public: MainForm(const QString &name); ~MainForm(); - QString getName(); - DisplayType *displayType; QImage skinImg[2]; QList keyList; @@ -53,9 +52,6 @@ public: normal = 0, pressed = 1 }; - -private: - QString name; }; #endif // MAINFORM_H diff --git a/tizen/src/ui/resource/images/controller-skin/BC.png b/tizen/src/ui/resource/images/controller-skin/BC.png new file mode 100644 index 0000000000..7f79e11233 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/BC.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/LB.png b/tizen/src/ui/resource/images/controller-skin/LB.png new file mode 100644 index 0000000000..89d0126de0 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/LB.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/LC.png b/tizen/src/ui/resource/images/controller-skin/LC.png new file mode 100644 index 0000000000..8dfa47acd8 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/LC.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/LT.png b/tizen/src/ui/resource/images/controller-skin/LT.png new file mode 100644 index 0000000000..3e0e9dc38f Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/LT.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/RB.png b/tizen/src/ui/resource/images/controller-skin/RB.png new file mode 100644 index 0000000000..526ecc2283 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/RB.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/RC.png b/tizen/src/ui/resource/images/controller-skin/RC.png new file mode 100644 index 0000000000..df904e0a04 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/RC.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/RT.png b/tizen/src/ui/resource/images/controller-skin/RT.png new file mode 100644 index 0000000000..45b30498b4 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/RT.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/TC.png b/tizen/src/ui/resource/images/controller-skin/TC.png new file mode 100644 index 0000000000..9efb7c6914 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/TC.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/keybutton_hover.png b/tizen/src/ui/resource/images/controller-skin/keybutton_hover.png new file mode 100644 index 0000000000..fc341a1bb8 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/keybutton_hover.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/keybutton_normal.png b/tizen/src/ui/resource/images/controller-skin/keybutton_normal.png new file mode 100644 index 0000000000..06a0b40081 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/keybutton_normal.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/keybutton_pushed.png b/tizen/src/ui/resource/images/controller-skin/keybutton_pushed.png new file mode 100644 index 0000000000..e161dc719b Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/keybutton_pushed.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_back.png b/tizen/src/ui/resource/images/controller-skin/scroll_back.png new file mode 100644 index 0000000000..5f8c377805 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_back.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_down_hover.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_hover.png new file mode 100644 index 0000000000..62f58d14b5 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_hover.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_down_normal.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_normal.png new file mode 100644 index 0000000000..7ced278fc8 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_normal.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_down_pushed.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_pushed.png new file mode 100644 index 0000000000..68cc7f2afc Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_down_pushed.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_up_hover.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_hover.png new file mode 100644 index 0000000000..a362b4e7f1 Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_hover.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_up_normal.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_normal.png new file mode 100644 index 0000000000..29882e087b Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_normal.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_button_up_pushed.png b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_pushed.png new file mode 100644 index 0000000000..6c510c132e Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_button_up_pushed.png differ diff --git a/tizen/src/ui/resource/images/controller-skin/scroll_thumb.png b/tizen/src/ui/resource/images/controller-skin/scroll_thumb.png new file mode 100644 index 0000000000..b33ca1fbdf Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_thumb.png differ diff --git a/tizen/src/ui/resource/resource.qrc b/tizen/src/ui/resource/resource.qrc index 6fba2c194f..568e4622ab 100644 --- a/tizen/src/ui/resource/resource.qrc +++ b/tizen/src/ui/resource/resource.qrc @@ -15,6 +15,15 @@ images/main-skin/RC.png images/main-skin/RB.png + images/controller-skin/LT.png + images/controller-skin/LC.png + images/controller-skin/LB.png + images/controller-skin/TC.png + images/controller-skin/BC.png + images/controller-skin/RT.png + images/controller-skin/RC.png + images/controller-skin/RB.png + icons/emulator_icon.ico icons/shell.png icons/about.png diff --git a/tizen/src/ui/skinpainter.cpp b/tizen/src/ui/skinpainter.cpp index 20516984d4..8a2ed0b1f5 100644 --- a/tizen/src/ui/skinpainter.cpp +++ b/tizen/src/ui/skinpainter.cpp @@ -54,7 +54,7 @@ void SkinPainter::drawSkinPatch(QString patchPath, QImage RC(patchPath + "RC.png"); QImage RB(patchPath + "RB.png"); - displayRect.setRect(LT.width(), LT.height(), displayWidth, displayHeight); + centerRect.setRect(LT.width(), LT.height(), displayWidth, displayHeight); skin = new QPixmap(displayWidth + (LT.width() * 2), displayHeight + (LT.height() * 2)); skin->fill(Qt::transparent); @@ -68,7 +68,7 @@ void SkinPainter::drawSkinPatch(QString patchPath, /* middle side */ painter.drawImage(QRect(0, LT.height(), LT.width(), displayHeight), LC); - painter.fillRect(displayRect, Qt::SolidPattern); + painter.fillRect(centerRect, Qt::SolidPattern); painter.drawImage(QRect(displayWidth + LT.width(), LT.height(), RT.width(), displayHeight), RC); /* bottom side */ @@ -82,7 +82,7 @@ QImage SkinPainter::getSkinImage() return skin->toImage(); } -QRect SkinPainter::getDisplayRect() +QRect SkinPainter::getCenterRect() { - return displayRect; + return centerRect; } diff --git a/tizen/src/ui/skinpainter.h b/tizen/src/ui/skinpainter.h index 437089e55c..916ff2cc0c 100644 --- a/tizen/src/ui/skinpainter.h +++ b/tizen/src/ui/skinpainter.h @@ -41,14 +41,14 @@ public: unsigned int displayWidth, unsigned int displayHeight); QImage getSkinImage(); - QRect getDisplayRect(); + QRect getCenterRect(); private: void drawSkinPatch(QString patchPath, unsigned int displayWidth, unsigned int displayHeight); QPixmap *skin; - QRect displayRect; + QRect centerRect; }; #endif // SKINPAINTER_H