skin: apply new general skin
authorjihye <jihye424.kim@samsung.com>
Thu, 8 Dec 2016 06:49:54 +0000 (15:49 +0900)
committerjihye <jihye424.kim@samsung.com>
Wed, 1 Feb 2017 10:54:17 +0000 (19:54 +0900)
- separate sources of general skin and phone shape skin

Change-Id: I4447536e17a3ed7fb6f62d5d8e165a785f20e598
Signed-off-by: jihye <jihye424.kim@samsung.com>
16 files changed:
tizen/src/ui/Makefile.objs
tizen/src/ui/displaybase.cpp
tizen/src/ui/displaybase.h
tizen/src/ui/generalskinview.cpp [new file with mode: 0644]
tizen/src/ui/generalskinview.h [new file with mode: 0644]
tizen/src/ui/layout/displaytype.cpp
tizen/src/ui/layout/displaytype.h
tizen/src/ui/mainview.cpp
tizen/src/ui/mainview.h
tizen/src/ui/mainwindow.cpp
tizen/src/ui/phoneshapeskinview.cpp [new file with mode: 0644]
tizen/src/ui/phoneshapeskinview.h [new file with mode: 0644]
tizen/src/ui/skinpainter.cpp
tizen/src/ui/uiinformation.cpp
tizen/src/ui/uiinformation.h
tizen/src/ui/xmllayoutparser.cpp

index 76ddc84..8c8feec 100644 (file)
@@ -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
index b255575..c9fe65a 100644 (file)
@@ -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);
 }
index 77512cd..e3e2a43 100644 (file)
@@ -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 (file)
index 0000000..1a8afad
--- /dev/null
@@ -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 (file)
index 0000000..c30ad84
--- /dev/null
@@ -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
index 15087d9..197c65f 100644 (file)
@@ -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;
index 73f80d0..64b6332 100644 (file)
@@ -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;
 };
index 8996663..22ca25b 100644 (file)
@@ -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");
index f231a56..b47904c 100644 (file)
@@ -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
index 06a8749..0bb8446 100644 (file)
@@ -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 (file)
index 0000000..0d119bc
--- /dev/null
@@ -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 (file)
index 0000000..94af16f
--- /dev/null
@@ -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
index c78d496..3ee51ed 100644 (file)
@@ -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)));
index 51ad169..894f86f 100644 (file)
@@ -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);
     }
 
index c97c7aa..7ae66f4 100644 (file)
@@ -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
index 59e81b1..25838d7 100644 (file)
@@ -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);