diff options
author | jihye <jihye424.kim@samsung.com> | 2017-02-16 20:54:11 +0900 |
---|---|---|
committer | JiHye Kim <jihye424.kim@samsung.com> | 2017-03-02 20:21:49 +0900 |
commit | 9ab518ce4462c5d1db5e91697262822926ca3927 (patch) | |
tree | 32bf68071bc969433aacfdf7de4e74969e04852e | |
parent | 9a3a68a43ef4a926adb9794d0f2734d86c87aefc (diff) | |
download | qemu-9ab518ce4462c5d1db5e91697262822926ca3927.tar.gz qemu-9ab518ce4462c5d1db5e91697262822926ca3927.tar.bz2 qemu-9ab518ce4462c5d1db5e91697262822926ca3927.zip |
skin: add outer, border, inner line and header color bar
Change-Id: I5d781d0a5b704d097147c4fb000ba297dcf79970
Signed-off-by: jihye <jihye424.kim@samsung.com>
-rw-r--r-- | tizen/src/ui/generalskinview.cpp | 63 | ||||
-rw-r--r-- | tizen/src/ui/generalskinview.h | 8 | ||||
-rw-r--r-- | tizen/src/ui/xmllayoutparser.cpp | 2 |
3 files changed, 60 insertions, 13 deletions
diff --git a/tizen/src/ui/generalskinview.cpp b/tizen/src/ui/generalskinview.cpp index 8817588563..9fb8a142d0 100644 --- a/tizen/src/ui/generalskinview.cpp +++ b/tizen/src/ui/generalskinview.cpp @@ -83,23 +83,66 @@ 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); + + // header bar + scene()->addRect(0, 0, size.width(), HEADER_BAR_HEIGHT, + QPen(Qt::NoPen), QBrush(win->getUiInfo()->getVMColor())); + // header + QBrush brush(QColor(244, 244, 244)); + scene()->addRect(0, HEADER_BAR_HEIGHT, size.width(), HEADER_HEIGHT, QPen(Qt::NoPen), brush); if (BORDER_SIZE > 0) { - QPen boaderPen(win->getUiInfo()->getVMColor(), BORDER_SIZE * 2, Qt::SolidLine); - scene()->addRect(0, 0, size.width(), size.height(), boaderPen); + float osize = OUT_LINE_SIZE / 2; + float isize = INNER_LINE_SIZE / 2; + float bsize = (BORDER_SIZE - INNER_LINE_SIZE - OUT_LINE_SIZE) / 2; + + // out line + if (osize > 0) { + QPen outPen(QColor(153, 153, 153), OUT_LINE_SIZE, Qt::SolidLine); + // left + scene()->addLine(osize, HEADER_BAR_HEIGHT + osize, osize, size.height(), outPen); + // bottom + scene()->addLine(osize, size.height() - osize, size.width() - osize, size.height() - osize, outPen); + // right + scene()->addLine(size.width() - osize, HEADER_BAR_HEIGHT + osize, size.width() - osize, size.height(), outPen); + } + + // border line + if (bsize > 0) { + QPen borderPen(QColor(244, 244, 244), BORDER_SIZE - INNER_LINE_SIZE - OUT_LINE_SIZE, Qt::SolidLine); + float offset = OUT_LINE_SIZE + bsize; + // left + scene()->addLine(offset, HEADER_HEIGHT + bsize, offset, size.height() - offset, borderPen); + // bottom + scene()->addLine(offset, size.height() - offset, size.width() - offset, size.height() - offset, borderPen); + // right + scene()->addLine(size.width() - offset, HEADER_HEIGHT + bsize, size.width() - offset, size.height() - offset, borderPen); + } + // inner line + if (isize > 0) { + QPen innerPen(QColor(153, 153, 153), INNER_LINE_SIZE, Qt::SolidLine); + // top + scene()->addLine(BORDER_SIZE - isize, HEADER_HEIGHT - isize, + size.width() - BORDER_SIZE + isize, HEADER_HEIGHT - isize, innerPen); + // left + scene()->addLine(BORDER_SIZE - isize, HEADER_HEIGHT - isize, + BORDER_SIZE - isize, size.height() - BORDER_SIZE + isize, innerPen); + // bottom + scene()->addLine(BORDER_SIZE - isize, size.height() - BORDER_SIZE + isize, + size.width() - BORDER_SIZE, size.height() - BORDER_SIZE + isize, innerPen); + // right + scene()->addLine(size.width() - BORDER_SIZE + isize, HEADER_HEIGHT - isize, + size.width() - BORDER_SIZE + isize, size.height() - BORDER_SIZE + isize, innerPen); + } } 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); + int y = (HEADER_HEIGHT - HEADER_BAR_HEIGHT - rect.height()) / 2; + title->setPos(BORDER_SIZE + 5, HEADER_BAR_HEIGHT + y); } QSize GeneralSkinView::getMainSize() @@ -108,7 +151,7 @@ QSize GeneralSkinView::getMainSize() skinImg[LayoutForm::normal].size() * win->getUiInfo()->getUiState()->getScaleFactor(); size.setWidth(size.width() + BORDER_SIZE * 2); - size.setHeight(size.height() + HEADER_HEIGHT + BORDER_SIZE * 2); + size.setHeight(size.height() + HEADER_HEIGHT + BORDER_SIZE); return size; } @@ -119,7 +162,7 @@ QRegion GeneralSkinView::getMainRegion() 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(); + + HEADER_HEIGHT + BORDER_SIZE).createAlphaMask(); return QRegion(QBitmap::fromImage(regionImage)); } diff --git a/tizen/src/ui/generalskinview.h b/tizen/src/ui/generalskinview.h index c30ad8427f..33fd9900f0 100644 --- a/tizen/src/ui/generalskinview.h +++ b/tizen/src/ui/generalskinview.h @@ -35,8 +35,12 @@ #include "mainview.h" -#define BORDER_SIZE (2) -#define HEADER_HEIGHT (30) +#define OUT_LINE_SIZE (1.0) +#define INNER_LINE_SIZE (1.0) +// BORDER_SIZE = OUT_LINE_SIZE + BORDER_LINE_SIZE + INNER_LINE_SIZE +#define BORDER_SIZE (6.0) +#define HEADER_BAR_HEIGHT (5) +#define HEADER_HEIGHT (30) + HEADER_BAR_HEIGHT class MainWindow; diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index e65876e43d..c2c4b20c78 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -387,7 +387,7 @@ int XmlLayoutParser::parseMainFormList(QXmlStreamReader &xml, 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)); + form->getDpyType()->setOffset(QPoint(BORDER_SIZE, HEADER_HEIGHT)); } list.append(form); |