*/
#include "xmllayoutparser.h"
+#include "skinpainter.h"
#define NAME_ATTR_KEYWORD "name"
#define PROP_ATTR_KEYWORD "property"
QString normalImageFileName = xml.readElementText();
qDebug() << "- normalImage :" << normalImageFileName;
- if (normalImageFileName.isEmpty() == true) {
- // TODO: general purpose skin
- } else if (form->skinImg[MainForm::normal].load(
+ if (form->skinImg[MainForm::normal].load(
xmlPath + QDir::separator() + normalImageFileName) == false) {
qWarning() << "failed to load normal image";
}
if (xml.name() == FORM_KEYWORD) {
form = parseMainForm(xml);
if (form != NULL) {
+ if (form->skinImg[MainForm::normal].size() == QSize(0, 0)) {
+ qDebug("general purpose skin form");
+
+ SkinPainter skinPainter("main-skin",
+ form->displayType->region.width(), form->displayType->region.height());
+ form->skinImg[MainForm::normal] = skinPainter.getSkinImage();
+ form->displayType->region.translate(skinPainter.getDisplayRect().topLeft());
+ }
+
list.append(form);
}
}
obj-$(CONFIG_QT) += keyboardhelper.o
obj-$(CONFIG_QT) += keyboardshortcut.o moc_keyboardshortcut.o
obj-$(CONFIG_QT) += skinview.o
+obj-$(CONFIG_QT) += skinpainter.o
obj-$(CONFIG_QT) += uiinformation.o
obj-$(CONFIG_QT) += uistate.o
obj-$(CONFIG_QT) += uiutil.o
--- /dev/null
+skin.name=General purpose mobile
+resolution.width=all
+resolution.height=all
+manager.priority=2
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/emulator/ui/layout">
+ <layoutVersion>2.4</layoutVersion>
+ <formList>
+ <form name="Portrait">
+ <display>
+ <region left="0" top="0" width="720" height="1280"/>
+ <angle>0</angle>
+ </display>
+ </form>
+ <form name="Landscape">
+ <display>
+ <region left="0" top="0" width="1280" height="720"/>
+ <angle>270</angle>
+ </display>
+ </form>
+ <form name="Reverse Portrait">
+ <display>
+ <region left="0" top="0" width="720" height="1280"/>
+ <angle>180</angle>
+ </display>
+ </form>
+ <form name="Reverse Landscape">
+ <display>
+ <region left="0" top="0" width="1280" height="720"/>
+ <angle>90</angle>
+ </display>
+ </form>
+ </formList>
+
+ <menuList>
+ <infoItem>
+ <shortcut>Ctrl+F1</shortcut>
+ </infoItem>
+ <separator/>
+ <onTopItem name="Always on Top">
+ <shortcut>Ctrl+F2</shortcut>
+ </onTopItem>
+ <switchItem name="Rotate">
+ <shortcut property="prev">Ctrl+Num+7</shortcut>
+ <shortcut property="next">Ctrl+Num+9</shortcut>
+ </switchItem>
+ <scaleItem name="Scale">
+ <shortcut property="prev">Ctrl+F9</shortcut>
+ <shortcut property="next">Ctrl+F10</shortcut>
+ <factorList>
+ <factor name="1x">100</factor>
+ <factor name="3/4x">75</factor>
+ <factor name="1/2x">50</factor>
+ <factor name="1/4x">25</factor>
+ </factorList>
+ </scaleItem>
+ <separator/>
+ <advancedItem>
+ <menuList>
+ <screenShotItem name="Screen Shot">
+ <shortcut>Ctrl+F7</shortcut>
+ </screenShotItem>
+ <hostKeyboardItem name="Host Keyboard">
+ </hostKeyboardItem>
+ <separator/>
+ <aboutItem name="About"/>
+ <forceCloseItem name="Force Close">
+ <shortcut>Ctrl+F4</shortcut>
+ </forceCloseItem>
+ </menuList>
+ </advancedItem>
+ <controllerItem/>
+ <shellItem name="Shell">
+ <shortcut>Ctrl+F5</shortcut>
+ </shellItem>
+ <controlPanelItem name="Control Panel">
+ <shortcut>Ctrl+F6</shortcut>
+ </controlPanelItem>
+ <separator/>
+ <closeItem name="Close">
+ <shortcut>F4</shortcut>
+ </closeItem>
+ </menuList>
+
+</EmulatorUI>
<file>images/tizen_sdk.png</file>
<file>images/display_off_guide.png</file>
+ <file>images/main-skin/arrow_normal.png</file>
+ <file>images/main-skin/arrow_hover.png</file>
+ <file>images/main-skin/arrow_pushed.png</file>
+ <file>images/main-skin/LT.png</file>
+ <file>images/main-skin/LC.png</file>
+ <file>images/main-skin/LB.png</file>
+ <file>images/main-skin/TC.png</file>
+ <file>images/main-skin/BC.png</file>
+ <file>images/main-skin/RT.png</file>
+ <file>images/main-skin/RC.png</file>
+ <file>images/main-skin/RB.png</file>
+
<file>icons/emulator_icon.ico</file>
<file>icons/shell.png</file>
<file>icons/about.png</file>
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2015 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 <QPainter>
+#include <QDebug>
+
+#include "skinpainter.h"
+
+SkinPainter::SkinPainter(QString patchPath,
+ unsigned int displayWidth, unsigned int displayHeight)
+{
+ QString path = ":/images/" + patchPath + "/";
+
+ drawSkinPatch(path, displayWidth, displayHeight);
+}
+
+void SkinPainter::drawSkinPatch(QString patchPath,
+ unsigned int displayWidth, unsigned int displayHeight)
+{
+ qDebug() << "load skin patch from :" << patchPath;
+
+ QImage LT(patchPath + "LT.png");
+ QImage LC(patchPath + "LC.png");
+ QImage LB(patchPath + "LB.png");
+ QImage TC(patchPath + "TC.png");
+ QImage BC(patchPath + "BC.png");
+ QImage RT(patchPath + "RT.png");
+ QImage RC(patchPath + "RC.png");
+ QImage RB(patchPath + "RB.png");
+
+ displayRect.setRect(LT.width(), LT.height(), displayWidth, displayHeight);
+
+ skin = new QPixmap(displayWidth + (LT.width() * 2), displayHeight + (LT.height() * 2));
+ skin->fill(Qt::transparent);
+
+ QPainter painter(skin);
+
+ /* top side */
+ painter.drawImage(0, 0, LT);
+ painter.drawImage(QRect(LT.width(), 0, displayWidth, LT.height()), TC);
+ painter.drawImage(displayWidth + LT.width(), 0, RT);
+
+ /* middle side */
+ painter.drawImage(QRect(0, LT.height(), LT.width(), displayHeight), LC);
+ painter.fillRect(displayRect, Qt::SolidPattern);
+ painter.drawImage(QRect(displayWidth + LT.width(), LT.height(), RT.width(), displayHeight), RC);
+
+ /* bottom side */
+ painter.drawImage(0, displayHeight + LT.height(), LB);
+ painter.drawImage(QRect(LT.width(), displayHeight + LT.height(), displayWidth, LB.height()), BC);
+ painter.drawImage(displayWidth + LT.width(), displayHeight + LT.height(), RB);
+}
+
+QImage SkinPainter::getSkinImage()
+{
+ return skin->toImage();
+}
+
+QRect SkinPainter::getDisplayRect()
+{
+ return displayRect;
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2015 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 SKINPAINTER_H
+#define SKINPAINTER_H
+
+#include <QWidget>
+
+#include "displaytype.h"
+
+class SkinPainter
+{
+public:
+ SkinPainter(QString patchPath,
+ unsigned int displayWidth, unsigned int displayHeight);
+
+ QImage getSkinImage();
+ QRect getDisplayRect();
+
+private:
+ void drawSkinPatch(QString patchPath,
+ unsigned int displayWidth, unsigned int displayHeight);
+
+ QPixmap *skin;
+ QRect displayRect;
+};
+
+#endif // SKINPAINTER_H