diff options
author | jihye <jihye424.kim@samsung.com> | 2016-12-08 15:49:54 +0900 |
---|---|---|
committer | jihye <jihye424.kim@samsung.com> | 2017-02-01 19:54:17 +0900 |
commit | 2d0eeb30936260c22ce559ac390eb42ab479570f (patch) | |
tree | 8110140044a4659c612c8b00ec40e078f36ecb69 | |
parent | a764eb8b193c5b6ac2261cb87dab4bd26d422c8b (diff) | |
download | qemu-2d0eeb30936260c22ce559ac390eb42ab479570f.tar.gz qemu-2d0eeb30936260c22ce559ac390eb42ab479570f.tar.bz2 qemu-2d0eeb30936260c22ce559ac390eb42ab479570f.zip |
skin: apply new general skin
- separate sources of general skin and phone shape skin
Change-Id: I4447536e17a3ed7fb6f62d5d8e165a785f20e598
Signed-off-by: jihye <jihye424.kim@samsung.com>
-rw-r--r-- | tizen/src/ui/Makefile.objs | 2 | ||||
-rw-r--r-- | tizen/src/ui/displaybase.cpp | 3 | ||||
-rw-r--r-- | tizen/src/ui/displaybase.h | 1 | ||||
-rw-r--r-- | tizen/src/ui/generalskinview.cpp | 125 | ||||
-rw-r--r-- | tizen/src/ui/generalskinview.h | 59 | ||||
-rw-r--r-- | tizen/src/ui/layout/displaytype.cpp | 10 | ||||
-rw-r--r-- | tizen/src/ui/layout/displaytype.h | 3 | ||||
-rw-r--r-- | tizen/src/ui/mainview.cpp | 92 | ||||
-rw-r--r-- | tizen/src/ui/mainview.h | 12 | ||||
-rw-r--r-- | tizen/src/ui/mainwindow.cpp | 11 | ||||
-rw-r--r-- | tizen/src/ui/phoneshapeskinview.cpp | 140 | ||||
-rw-r--r-- | tizen/src/ui/phoneshapeskinview.h | 57 | ||||
-rw-r--r-- | tizen/src/ui/skinpainter.cpp | 2 | ||||
-rw-r--r-- | tizen/src/ui/uiinformation.cpp | 15 | ||||
-rw-r--r-- | tizen/src/ui/uiinformation.h | 5 | ||||
-rw-r--r-- | tizen/src/ui/xmllayoutparser.cpp | 10 |
16 files changed, 446 insertions, 101 deletions
diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index 76ddc8469c..8c8feecc8c 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -17,6 +17,8 @@ obj-$(CONFIG_QT) += skinbezelitem.o obj-$(CONFIG_QT) += skinkeyitem.o moc_skinkeyitem.o obj-$(CONFIG_QT) += skinview.o obj-$(CONFIG_QT) += mainview.o +obj-$(CONFIG_QT) += generalskinview.o +obj-$(CONFIG_QT) += phoneshapeskinview.o obj-$(CONFIG_QT) += rotaryview.o moc_rotaryview.o obj-$(CONFIG_QT) += skinpainter.o obj-$(CONFIG_QT) += uiinformation.o diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp index b255575fe4..c9fe65aa18 100644 --- a/tizen/src/ui/displaybase.cpp +++ b/tizen/src/ui/displaybase.cpp @@ -46,6 +46,7 @@ DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scale { this->win = (MainWindow *)widget->parentWidget(); this->rect = displayForm->getRect(); + this->offset = displayForm->getOffset(); this->maskImage = displayForm->getMask(); this->rotateAngle = displayForm->getAngle(); this->scaleFactor = scaleFactor; @@ -175,7 +176,7 @@ void DisplayBase::updateGeometry() qreal sx = rect.x() * scaleFactor; qreal sy = rect.y() * scaleFactor; - widget->setGeometry(qRound(sx), qRound(sy), + widget->setGeometry(qRound(sx) + offset.x(), qRound(sy) + offset.y(), rect.width() * scaleFactor, rect.height() * scaleFactor); } diff --git a/tizen/src/ui/displaybase.h b/tizen/src/ui/displaybase.h index 77512cd508..e3e2a438b6 100644 --- a/tizen/src/ui/displaybase.h +++ b/tizen/src/ui/displaybase.h @@ -106,6 +106,7 @@ private: QWidget *widget; /* inherited by widget */ QRect rect; QPixmap maskImage; + QPoint offset; TouchScreenHelper *tsHelper; MouseHelper *mouseHelper; diff --git a/tizen/src/ui/generalskinview.cpp b/tizen/src/ui/generalskinview.cpp new file mode 100644 index 0000000000..1a8afad351 --- /dev/null +++ b/tizen/src/ui/generalskinview.cpp @@ -0,0 +1,125 @@ +/* + * Qt UI + * + * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye Kim <jihye424.kim@samsung.com> + * SeokYeon Hwang <syeon.hwang@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 <QWidget> + +#include "generalskinview.h" +#include "mainwindow.h" + +GeneralSkinView::GeneralSkinView(QGraphicsScene *scene, QWidget *parent) + : MainView(scene, parent) +{ +} + +GeneralSkinView::~GeneralSkinView() +{ + qDebug("destroy general skin view"); +} + +/* override */ +void GeneralSkinView::resizeEvent(QResizeEvent *event) +{ + qDebug() << "resize general skin view:" << size(); + SkinView::resizeEvent(event); +} + +/* override */ +void GeneralSkinView::mousePressEvent(QMouseEvent *event) +{ + SkinView::mousePressEvent(event); + + if (event->button() == Qt::LeftButton) { + grabWindow(event->globalPos()); + } +} + +/* override */ +void GeneralSkinView::mouseReleaseEvent(QMouseEvent *event) +{ + SkinView::mouseReleaseEvent(event); + + if (event->button() == Qt::LeftButton) { + releaseWindow(); + } +} + +/* override */ +void GeneralSkinView::mouseMoveEvent(QMouseEvent *event) +{ + SkinView::mouseMoveEvent(event); + + if (isGrabWindow() == true) { + win->move(grabWinPos + (event->globalPos() - grabPos)); + } +} + +void GeneralSkinView::createItems() +{ + qDebug() << "create items for general skin view"; + + QBrush backBrush(QColor(244, 244, 244)); + QPen linePen(QColor(205, 205, 205), 1, Qt::SolidLine); + QSize size = win->getUiInfo()->getMainSize(); + scene()->addRect(BORDER_SIZE, BORDER_SIZE, size.width() - BORDER_SIZE * 2, HEADER_HEIGHT, QPen(Qt::NoPen), backBrush); + scene()->addLine(BORDER_SIZE, HEADER_HEIGHT + BORDER_SIZE, size.width() - BORDER_SIZE, HEADER_HEIGHT + BORDER_SIZE, linePen); + + if (BORDER_SIZE > 0) { + QPen boaderPen(QColor(0, 138, 248), BORDER_SIZE * 2, Qt::SolidLine); + scene()->addRect(0, 0, size.width(), size.height(), boaderPen); + } + + QGraphicsTextItem *title = new QGraphicsTextItem(win->getUiInfo()->getVmName()); + title->setDefaultTextColor(QColor(88, 88, 88)); + scene()->addItem(title); + QRectF rect = title->boundingRect(); + int y = (HEADER_HEIGHT - rect.height()) / 2; + title->setPos(BORDER_SIZE + 5, BORDER_SIZE + y); +} + +QSize GeneralSkinView::getMainSize() +{ + QSize size = win->getUiInfo()->getMainForm()-> + skinImg[LayoutForm::normal].size() * win->getUiInfo()->getUiState()->getScaleFactor(); + + size.setWidth(size.width() + BORDER_SIZE * 2); + size.setHeight(size.height() + HEADER_HEIGHT + BORDER_SIZE * 2); + + return size; +} + +QRegion GeneralSkinView::getMainRegion() +{ + QImage *mainImage = &(win->getUiInfo()->getMainForm()->skinImg[LayoutForm::normal]); + QImage regionImage = mainImage->scaled( + mainImage->width() * win->getUiInfo()->getUiState()->getScaleFactor() + BORDER_SIZE * 2, + mainImage->height() * win->getUiInfo()->getUiState()->getScaleFactor() + + HEADER_HEIGHT + BORDER_SIZE * 2).createAlphaMask(); + + return QRegion(QBitmap::fromImage(regionImage)); +} diff --git a/tizen/src/ui/generalskinview.h b/tizen/src/ui/generalskinview.h new file mode 100644 index 0000000000..c30ad8427f --- /dev/null +++ b/tizen/src/ui/generalskinview.h @@ -0,0 +1,59 @@ +/* + * Qt UI + * + * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye Kim <jihye424.kim@samsung.com> + * SeokYeon Hwang <syeon.hwang@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 GENERALSKINVIEW_H +#define GENERALSKINVIEW_H + +#include <QGraphicsView> +#include <QGraphicsTextItem> + +#include "mainview.h" + +#define BORDER_SIZE (2) +#define HEADER_HEIGHT (30) + +class MainWindow; + +class GeneralSkinView : public MainView +{ +public: + GeneralSkinView(QGraphicsScene *scene, QWidget *parent = 0); + ~GeneralSkinView(); + QSize getMainSize(); + QRegion getMainRegion(); + +protected: + void resizeEvent(QResizeEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void createItems(); +}; + +#endif // GENERALSKINVIEW_H diff --git a/tizen/src/ui/layout/displaytype.cpp b/tizen/src/ui/layout/displaytype.cpp index 15087d9b97..197c65f808 100644 --- a/tizen/src/ui/layout/displaytype.cpp +++ b/tizen/src/ui/layout/displaytype.cpp @@ -46,6 +46,16 @@ QRect DisplayType::getRect() return rect; } +void DisplayType::setOffset(QPoint offset) +{ + this->offset = offset; +} + +QPoint DisplayType::getOffset() +{ + return offset; +} + int DisplayType::getAngle() { return angle % 360; diff --git a/tizen/src/ui/layout/displaytype.h b/tizen/src/ui/layout/displaytype.h index 73f80d0c36..64b6332573 100644 --- a/tizen/src/ui/layout/displaytype.h +++ b/tizen/src/ui/layout/displaytype.h @@ -40,11 +40,14 @@ public: void setRect(QRect rect); QRect getRect(); + void setOffset(QPoint offset); + QPoint getOffset(); int getAngle(); QPixmap getMask(); private: QRect rect; + QPoint offset; int angle; QPixmap mask; }; diff --git a/tizen/src/ui/mainview.cpp b/tizen/src/ui/mainview.cpp index 899666310c..22ca25bc54 100644 --- a/tizen/src/ui/mainview.cpp +++ b/tizen/src/ui/mainview.cpp @@ -40,26 +40,6 @@ MainView::MainView(QGraphicsScene *scene, QWidget *parent) : this->win = ((MainWindow *)parent); this->grabWinPos = SKINVIEW_NULLITY_POSITION; this->kbdHelper = new KeyboardHelper(this); - - updateLayout(); -} - -void MainView::createItems(MainForm *form) -{ - /* bezel */ - bezelItem = createBezelItem(NULL, form); - scene()->addItem(bezelItem); - - /* HW keys */ - QList<HardwareKey *> &keyList = form->getKeyList(); - - HardwareKey *hwKey = NULL; - for (int i = 0; i < keyList.count(); i++) { - hwKey = keyList.at(i); - if (hwKey != NULL) { - createKeyItem(bezelItem, form, hwKey); - } - } } /* override */ @@ -97,68 +77,16 @@ void MainView::updateLayout() scene()->clear(); /* resizing */ - resize(win->getUiInfo()->getUiSize()); + resize(win->getUiInfo()->getMainSize()); scene()->setSceneRect(0, 0, size().width(), size().height()); - createItems(win->getUiInfo()->getMainForm()); -} - -/* override */ -void MainView::resizeEvent(QResizeEvent *event) -{ - qDebug() << "resize skin view:" << size(); - - /* scaling */ - const qreal sx = win->getUiState()->getScaleFactor(); - const qreal sy = win->getUiState()->getScaleFactor(); - setTransform(QTransform(sx, 0, 0, 0, sy, 0, 0, 0, 1)); - - SkinView::resizeEvent(event); -} - -/* override */ -void MainView::mousePressEvent(QMouseEvent *event) -{ - SkinView::mousePressEvent(event); - - if (bezelItem->isHWKeyHandling() == true) { - /* do nothing */ - return; - } - - if (event->button() == Qt::LeftButton) { - grabWindow(event->globalPos()); - } -} - -/* override */ -void MainView::mouseReleaseEvent(QMouseEvent *event) -{ - SkinView::mouseReleaseEvent(event); - - if (bezelItem->isHWKeyHandling() == true) { - /* do nothing */ - return; - } - - if (event->button() == Qt::LeftButton) { - releaseWindow(); - } + // create child view's items + createItems(); } -/* override */ -void MainView::mouseMoveEvent(QMouseEvent *event) +void MainView::createItems() { - SkinView::mouseMoveEvent(event); - - if (bezelItem->isHWKeyHandling() == true) { - /* do nothing */ - return; - } - - if (isGrabWindow() == true) { - win->move(grabWinPos + (event->globalPos() - grabPos)); - } + // empty function } /* override */ @@ -179,6 +107,16 @@ void MainView::keyReleaseEvent(QKeyEvent *event) kbdHelper->keyReleased(event); } +QSize MainView::getMainSize() +{ + return QSize(); +} + +QRegion MainView::getMainRegion() +{ + return QRegion(); +} + MainView::~MainView() { qDebug("destroy main view"); diff --git a/tizen/src/ui/mainview.h b/tizen/src/ui/mainview.h index f231a56aaf..b47904cfe6 100644 --- a/tizen/src/ui/mainview.h +++ b/tizen/src/ui/mainview.h @@ -50,14 +50,13 @@ public: void releaseWindow(); void updateLayout(); + virtual QSize getMainSize(); + virtual QRegion getMainRegion(); + protected: + virtual void createItems(); void grabWindow(QPoint pos); QRegion getKeyWinRegion(QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type); - - void resizeEvent(QResizeEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); void focusOutEvent(QFocusEvent *event); @@ -66,9 +65,6 @@ protected: SkinBezelItem *bezelItem; QPoint grabWinPos; KeyboardHelper *kbdHelper; - -private: - void createItems(MainForm *form); }; #endif // MAINVIEW_H diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 06a8749cbd..0bb8446b82 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -32,6 +32,8 @@ */ #include "mainwindow.h" +#include "generalskinview.h" +#include "phoneshapeskinview.h" #include "layout/mainform.h" #include "displayglwidget.h" #include "displayswwidget.h" @@ -76,7 +78,14 @@ MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : mainScene->setBackgroundBrush(Qt::transparent); /* view */ - mainView = new MainView(mainScene, this); + if (uiInfo->getMainForm()->isGeneralPurpose()) { + mainView = new GeneralSkinView(mainScene, this); + } else { + mainView = new PhoneShapeSkinView(mainScene, this); + } + + uiInfo->setMainView(mainView); + mainView->updateLayout(); /* rotary */ diff --git a/tizen/src/ui/phoneshapeskinview.cpp b/tizen/src/ui/phoneshapeskinview.cpp new file mode 100644 index 0000000000..0d119bc916 --- /dev/null +++ b/tizen/src/ui/phoneshapeskinview.cpp @@ -0,0 +1,140 @@ +/* + * Qt UI + * + * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye Kim <jihye424.kim@samsung.com> + * SeokYeon Hwang <syeon.hwang@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 <QWidget> + +#include "phoneshapeskinview.h" +#include "mainwindow.h" + +PhoneShapeSkinView::PhoneShapeSkinView(QGraphicsScene *scene, QWidget *parent) + : MainView(scene, parent) +{ +} + +PhoneShapeSkinView::~PhoneShapeSkinView() +{ + qDebug("destroy phone shape skin view"); +} + +/* override */ +void PhoneShapeSkinView::resizeEvent(QResizeEvent *event) +{ + qDebug() << "resize phone shape skin view:" << size(); + + /* scaling */ + const qreal sx = win->getUiState()->getScaleFactor(); + const qreal sy = win->getUiState()->getScaleFactor(); + setTransform(QTransform(sx, 0, 0, 0, sy, 0, 0, 0, 1)); + + SkinView::resizeEvent(event); +} + +/* override */ +void PhoneShapeSkinView::mousePressEvent(QMouseEvent *event) +{ + SkinView::mousePressEvent(event); + + if (bezelItem != NULL + && bezelItem->isHWKeyHandling() == true) { + /* do nothing */ + return; + } + + if (event->button() == Qt::LeftButton) { + grabWindow(event->globalPos()); + } +} + +/* override */ +void PhoneShapeSkinView::mouseReleaseEvent(QMouseEvent *event) +{ + SkinView::mouseReleaseEvent(event); + + if (bezelItem != NULL + && bezelItem->isHWKeyHandling() == true) { + /* do nothing */ + return; + } + + if (event->button() == Qt::LeftButton) { + releaseWindow(); + } +} + +/* override */ +void PhoneShapeSkinView::mouseMoveEvent(QMouseEvent *event) +{ + SkinView::mouseMoveEvent(event); + + if (bezelItem != NULL + && bezelItem->isHWKeyHandling() == true) { + /* do nothing */ + return; + } + + if (isGrabWindow() == true) { + win->move(grabWinPos + (event->globalPos() - grabPos)); + } +} + +void PhoneShapeSkinView::createItems() +{ + MainForm *form = win->getUiInfo()->getMainForm(); + + /* bezel */ + bezelItem = createBezelItem(NULL, form); + scene()->addItem(bezelItem); + + /* HW keys */ + QList<HardwareKey *> &keyList = form->getKeyList(); + + HardwareKey *hwKey = NULL; + for (int i = 0; i < keyList.count(); i++) { + hwKey = keyList.at(i); + if (hwKey != NULL) { + createKeyItem(bezelItem, form, hwKey); + } + } +} + +QSize PhoneShapeSkinView::getMainSize() +{ + return win->getUiInfo()->getMainForm()-> + skinImg[LayoutForm::normal].size() * win->getUiInfo()->getUiState()->getScaleFactor(); +} + +QRegion PhoneShapeSkinView::getMainRegion() +{ + QImage *mainImage = &(win->getUiInfo()->getMainForm()->skinImg[LayoutForm::normal]); + QImage regionImage = mainImage->scaled( + mainImage->width() * win->getUiInfo()->getUiState()->getScaleFactor(), + mainImage->height() * win->getUiInfo()->getUiState()->getScaleFactor()).createAlphaMask(); + + return QRegion(QBitmap::fromImage(regionImage)); +} diff --git a/tizen/src/ui/phoneshapeskinview.h b/tizen/src/ui/phoneshapeskinview.h new file mode 100644 index 0000000000..94af16f912 --- /dev/null +++ b/tizen/src/ui/phoneshapeskinview.h @@ -0,0 +1,57 @@ +/* + * Qt UI + * + * Copyright (C) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jihye Kim <jihye424.kim@samsung.com> + * SeokYeon Hwang <syeon.hwang@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 PHONESHAPESKINVIEW_H +#define PHONESHAPESKINVIEW_H +// +//#include <QGraphicsView> +//#include <QGraphicsTextItem> + +#include "mainview.h" + +class MainWindow; + +class PhoneShapeSkinView : public MainView +{ +public: + PhoneShapeSkinView(QGraphicsScene *scene, QWidget *parent = 0); + ~PhoneShapeSkinView(); + + QSize getMainSize(); + QRegion getMainRegion(); + +protected: + void resizeEvent(QResizeEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void createItems(); +}; + +#endif // PHONESHAPESKINVIEW_H diff --git a/tizen/src/ui/skinpainter.cpp b/tizen/src/ui/skinpainter.cpp index c78d4962c1..3ee51ed84d 100644 --- a/tizen/src/ui/skinpainter.cpp +++ b/tizen/src/ui/skinpainter.cpp @@ -53,7 +53,7 @@ void SkinPainter::drawSkin(QSize center, int degree, QList<Separator *> separato QRect centeralRect(0, 0, center.width(), center.height()); QPixmap image(center.width(), center.height()); - image.fill(Qt::transparent); + image.fill(Qt::black); QPainter painter(&image); painter.fillRect(centeralRect, QBrush(QColor(244, 244, 244))); diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index 51ad1690a9..894f86fac0 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -29,6 +29,7 @@ #include "uiinformation.h" #include "resource/ui_strings.h" +#include "mainview.h" UiInformation::UiInformation() : basePort(0) @@ -56,6 +57,8 @@ QString UiInformation::getSkinPath() { return skinPath; } void UiInformation::setSkinName(QString name) { skinName = name; } QString UiInformation::getSkinName() { return skinName; } +void UiInformation::setMainView(MainView *view) { mainView = view; } + QList<MainForm *> &UiInformation::getMainFormList() { return mainFormList; @@ -150,8 +153,7 @@ ControllerForm *UiInformation::getConForm() /* size */ QSize UiInformation::getMainSize() { - return getMainForm()-> - skinImg[LayoutForm::normal].size() * uiState.getScaleFactor(); + return mainView->getMainSize(); } QSize UiInformation::getConSize() @@ -182,12 +184,7 @@ QSize UiInformation::getUiSize() /* region */ QRegion UiInformation::getMainRegion() { - QImage *mainImage = &(getMainForm()->skinImg[LayoutForm::normal]); - QImage regionImage = mainImage->scaled( - mainImage->width() * uiState.getScaleFactor(), - mainImage->height() * uiState.getScaleFactor()).createAlphaMask(); - - return QRegion(QBitmap::fromImage(regionImage)); + return mainView->getMainRegion(); } QRegion UiInformation::getConRegion() @@ -221,7 +218,7 @@ QRegion UiInformation::getUiRegion() } } - conRegion.translate(getMainSize().width() + 1, vShift); + conRegion.translate(getMainSize().width(), vShift); uiRegion = uiRegion.united(conRegion); } diff --git a/tizen/src/ui/uiinformation.h b/tizen/src/ui/uiinformation.h index c97c7aa90c..7ae66f434e 100644 --- a/tizen/src/ui/uiinformation.h +++ b/tizen/src/ui/uiinformation.h @@ -37,6 +37,8 @@ #include "layout/controllerform.h" #include "menu/menuitem.h" +class MainView; + class UiInformation { public: @@ -61,6 +63,7 @@ public: QList<MenuItem *> &getMenuList(); UIState *getUiState(); + void setMainView(MainView *view); QColor getVMColor(); MainForm *getMainForm(); /* current */ @@ -89,6 +92,8 @@ private: QList<MenuItem *> menuList; UIState uiState; /* runtime information */ + + MainView *mainView; }; #endif // UIINFORMATION_H diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index 59e81b1c99..25838d7f26 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -36,6 +36,7 @@ #include "layout/keycodetype.h" #include "controller/generalpurposecon.h" #include "resource/ui_strings.h" +#include "generalskinview.h" #define LOG_LINE_HEAD_CHAR "> " #define LOG_INDENTATION_SIZE 2 @@ -375,14 +376,15 @@ int XmlLayoutParser::parseMainFormList(QXmlStreamReader &xml, /* image validation */ if (form->skinImg[LayoutForm::normal].size() == QSize(0, 0)) { QDEBUG_INDENT(depth + 1) << "(general purpose skin type)"; - - SkinPainter painter("main-skin", - uiInfo->getResolution(), form->getDpyType()->getAngle(), - QPoint(30, 16), uiInfo->getVMColor()); + QList<Separator *> list; + SkinPainter painter(uiInfo->getResolution(), + form->getDpyType()->getAngle(), list); form->setGeneralPurpose(true); form->skinImg[LayoutForm::normal] = painter.getSkinImage(); form->getDpyType()->setRect(painter.getCenteralRect()); + // set offset for title bar + form->getDpyType()->setOffset(QPoint(BORDER_SIZE, HEADER_HEIGHT + BORDER_SIZE)); } list.append(form); |