skin: consider general purpose controller
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 17 Mar 2015 12:42:40 +0000 (21:42 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 30 Mar 2015 01:53:38 +0000 (10:53 +0900)
add resource images for general purpose controller
declare LayoutForm class

Change-Id: I9af43c6ac690e97c55c51874aae64c52e548a4c8
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
30 files changed:
tizen/src/display/xmllayoutparser.cpp
tizen/src/ui/Makefile.objs
tizen/src/ui/controllerform.cpp
tizen/src/ui/controllerform.h
tizen/src/ui/layoutform.cpp [new file with mode: 0644]
tizen/src/ui/layoutform.h [new file with mode: 0644]
tizen/src/ui/mainform.cpp
tizen/src/ui/mainform.h
tizen/src/ui/resource/images/controller-skin/BC.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/LB.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/LC.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/LT.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/RB.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/RC.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/RT.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/TC.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/keybutton_hover.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/keybutton_normal.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/keybutton_pushed.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_back.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_down_hover.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_down_normal.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_down_pushed.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_up_hover.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_up_normal.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_button_up_pushed.png [new file with mode: 0644]
tizen/src/ui/resource/images/controller-skin/scroll_thumb.png [new file with mode: 0644]
tizen/src/ui/resource/resource.qrc
tizen/src/ui/skinpainter.cpp
tizen/src/ui/skinpainter.h

index 6352fd970ad9bcadd96b7a2ac8a786d7448a98ee..c63db6347724cc47f2f80ec8e1c71edad7e81f1b 100644 (file)
@@ -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);
                 }
             }
index e9f8bf7955bff33c7ba99c8194f7962d37f09a41..bd8f10397b5287d2a0b696be9ba1234946ca2d18 100644 (file)
@@ -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
index d9a3e4976b29dbcffb499a1721d707c9f01d4ad3..4b1b924dd930e2bb31aafb69384dfbf9d272f299 100644 (file)
 
 #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()
index a78e58fe09d62fc23a86ccb3abf9b4b95b524988..316fc8b7cc1a359ca44ef9d38ffc06624df59524 100644 (file)
 
 #include <QWidget>
 
+#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<HardwareKey *> 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 (file)
index 0000000..e60743d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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 (file)
index 0000000..6da9b27
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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 <QWidget>
+
+class LayoutForm
+{
+public:
+    LayoutForm(const QString &name);
+
+    QString getName();
+    void setGeneralPurpose(bool general);
+    bool isGeneralPurpose();
+
+private:
+    QString name;
+    bool generalPurpose;
+};
+
+#endif // LAYOUTFORM_H
index 94e30e77aa77e82fde573d8b80b625880041a1a3..3076e7b98ad45ce0a6ffd55a3b2ab94faefc106f 100644 (file)
 
 #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");
index c06eb5c70cbac27ed8e14ad64ca91e5adcca05f7..9de052b75103254ac1fc95dd489cb870341f0ef8 100644 (file)
 #ifndef MAINFORM_H
 #define MAINFORM_H
 
-#include <QtWidgets>
+#include <QWidget>
 
+#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<HardwareKey *> 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 (file)
index 0000000..7f79e11
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 (file)
index 0000000..89d0126
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 (file)
index 0000000..8dfa47a
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 (file)
index 0000000..3e0e9dc
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 (file)
index 0000000..526ecc2
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 (file)
index 0000000..df904e0
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 (file)
index 0000000..45b3049
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 (file)
index 0000000..9efb7c6
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 (file)
index 0000000..fc341a1
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 (file)
index 0000000..06a0b40
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 (file)
index 0000000..e161dc7
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 (file)
index 0000000..5f8c377
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 (file)
index 0000000..62f58d1
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 (file)
index 0000000..7ced278
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 (file)
index 0000000..68cc7f2
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 (file)
index 0000000..a362b4e
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 (file)
index 0000000..29882e0
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 (file)
index 0000000..6c510c1
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 (file)
index 0000000..b33ca1f
Binary files /dev/null and b/tizen/src/ui/resource/images/controller-skin/scroll_thumb.png differ
index 6fba2c194f2a0916b9815f0eda029ae988870d51..568e4622ab1cea01eb86c46b8617affbbdeeccb7 100644 (file)
         <file>images/main-skin/RC.png</file>
         <file>images/main-skin/RB.png</file>
 
+        <file>images/controller-skin/LT.png</file>
+        <file>images/controller-skin/LC.png</file>
+        <file>images/controller-skin/LB.png</file>
+        <file>images/controller-skin/TC.png</file>
+        <file>images/controller-skin/BC.png</file>
+        <file>images/controller-skin/RT.png</file>
+        <file>images/controller-skin/RC.png</file>
+        <file>images/controller-skin/RB.png</file>
+
         <file>icons/emulator_icon.ico</file>
         <file>icons/shell.png</file>
         <file>icons/about.png</file>
index 20516984d45d9fa3febeb9d6ac516bb8b7a5639b..8a2ed0b1f516793e9edca19e5213a69d6d0f7011 100644 (file)
@@ -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;
 }
index 437089e55cc79e799963d1f28b9cd2253691c8cf..916ff2cc0c2ece6f05f87365c113b0000c9ab76b 100644 (file)
@@ -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