From: jihye Date: Wed, 15 Feb 2017 09:45:22 +0000 (+0900) Subject: skin: add color bar and border to controller X-Git-Tag: TizenStudio_2.0_p2.3.2~9^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c39fa821b55bf11430944b10ca4f91635282d7a;p=sdk%2Femulator%2Fqemu.git skin: add color bar and border to controller - change default position from center to top Change-Id: Ia3f431f8be5416f4bc543251102a43c808d79c70 Signed-off-by: jihye --- diff --git a/tizen/src/ui/controller/dockingconview.cpp b/tizen/src/ui/controller/dockingconview.cpp index 217108c..d1e336c 100644 --- a/tizen/src/ui/controller/dockingconview.cpp +++ b/tizen/src/ui/controller/dockingconview.cpp @@ -67,6 +67,8 @@ void DockingConView::createItems(ControllerForm *conForm) } } else { GeneralPurposeCon *generalCon = new GeneralPurposeCon(); + + generalCon->createHeaderBarAndBorder(scene(), parent->getMainWindow()->getUiInfo(), false); QList buttons = generalCon->createButtons(parentWidget(), conForm); diff --git a/tizen/src/ui/controller/floatingcontroller.cpp b/tizen/src/ui/controller/floatingcontroller.cpp index 238517f..4e90ecd 100644 --- a/tizen/src/ui/controller/floatingcontroller.cpp +++ b/tizen/src/ui/controller/floatingcontroller.cpp @@ -45,6 +45,7 @@ FloatingController::FloatingController(ControllerForm *conForm, conScene->setBackgroundBrush(Qt::transparent); conView = new FloatingConView(this, conForm, conScene); + resize(conForm->skinImg[LayoutForm::normal].size()); conView->resize(conForm->skinImg[LayoutForm::normal].size()); } diff --git a/tizen/src/ui/controller/floatingconview.cpp b/tizen/src/ui/controller/floatingconview.cpp index e4b9f80..277e3f1 100644 --- a/tizen/src/ui/controller/floatingconview.cpp +++ b/tizen/src/ui/controller/floatingconview.cpp @@ -67,6 +67,8 @@ void FloatingConView::createItems(ControllerForm *conForm) } } else { GeneralPurposeCon *generalCon = new GeneralPurposeCon(); + + generalCon->createHeaderBarAndBorder(scene(), parent->getMainWindow()->getUiInfo(), true); QList buttons = generalCon->createButtons(parentWidget(), conForm); diff --git a/tizen/src/ui/controller/generalpurposecon.cpp b/tizen/src/ui/controller/generalpurposecon.cpp index e4925e2..9a5c31e 100644 --- a/tizen/src/ui/controller/generalpurposecon.cpp +++ b/tizen/src/ui/controller/generalpurposecon.cpp @@ -37,10 +37,31 @@ GeneralPurposeCon::GeneralPurposeCon() qDebug("create general purpose controller"); } +void GeneralPurposeCon::createHeaderBarAndBorder(QGraphicsScene *scene, UiInformation *uiInfo, bool isFloating) +{ + QSize size = uiInfo->getConSize(); + + // draw color bar + scene->addRect(0, 0, size.width(), GPC_HEAD_BAR_HEIGHT, QPen(Qt::NoPen), + QBrush(uiInfo->getVMColor())); + + if (GPC_BORDER_SIZE > 0) { + float bsize = GPC_BORDER_SIZE / 2; + QPen borderPen(QColor(153, 153, 153), GPC_BORDER_SIZE, Qt::SolidLine); + if (isFloating) { // draw left border + scene->addLine(bsize, GPC_HEAD_BAR_HEIGHT + bsize, bsize, size.height(), borderPen); + } + // draw bottom border + scene->addLine(bsize, size.height() - bsize, size.width(), size.height() - bsize, borderPen); + // draw right border + scene->addLine(size.width() - bsize, GPC_HEAD_BAR_HEIGHT + bsize, size.width() - bsize, size.height(), borderPen); + } +} + QList GeneralPurposeCon::createButtons(QWidget *parent, ControllerForm *form) { QPoint topLeft = form->getCenteralRect().topLeft(); - topLeft.setX(topLeft.x() + GPC_LEFT_SPACING); + topLeft.setX(topLeft.x() + GPC_LEFT_SPACING + GPC_BORDER_SIZE); topLeft.setY(topLeft.y() + GPC_HEAD_SPACING); QList buttonList; diff --git a/tizen/src/ui/controller/generalpurposecon.h b/tizen/src/ui/controller/generalpurposecon.h index 44b263d..8dfb18d 100644 --- a/tizen/src/ui/controller/generalpurposecon.h +++ b/tizen/src/ui/controller/generalpurposecon.h @@ -33,8 +33,11 @@ #include "layout/hardwarekey.h" #include "controller/hwkeybutton.h" #include "layout/controllerform.h" +#include "uiinformation.h" -#define GPC_HEAD_SPACING (8) +#define GPC_HEAD_BAR_HEIGHT (5) +#define GPC_BORDER_SIZE (1.0) +#define GPC_HEAD_SPACING (8) + GPC_HEAD_BAR_HEIGHT #define GPC_LEFT_SPACING (8) #define GPC_TAIL_SPACING (8) #define GPC_KEYBUTTON_WIDTH (35) @@ -48,6 +51,7 @@ class GeneralPurposeCon public: GeneralPurposeCon(); ~GeneralPurposeCon(); + void createHeaderBarAndBorder(QGraphicsScene *scene, UiInformation *uiInfo, bool isFloating); QList createButtons(QWidget *parent, ControllerForm *form); private: diff --git a/tizen/src/ui/generalskinview.cpp b/tizen/src/ui/generalskinview.cpp index 1a8afad..8817588 100644 --- a/tizen/src/ui/generalskinview.cpp +++ b/tizen/src/ui/generalskinview.cpp @@ -90,7 +90,7 @@ void GeneralSkinView::createItems() 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); + QPen boaderPen(win->getUiInfo()->getVMColor(), BORDER_SIZE * 2, Qt::SolidLine); scene()->addRect(0, 0, size.width(), size.height(), boaderPen); } diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index a467866..d546ea8 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -362,7 +362,7 @@ static void qt5_gui_init(void) } /* controller */ - const int defaultDockPos = Qt::AlignRight | Qt::AlignCenter; + const int defaultDockPos = Qt::AlignRight | Qt::AlignTop; mainwindow->getUiState()->getConState()->setRecentlyDockPos(defaultDockPos); int conIndex = mruInfo.value(SKIN_PROPERTY_CONTROLLER_INDEX).toInt(); diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index 894f86f..f892762 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -88,28 +88,29 @@ QColor UiInformation::getVMColor() switch((basePort / 10) % 10) { case 0: - break; + return QColor(0, 150, 221); //#0096DD case 1: - return QColor(246, 226, 0); + return QColor(32, 212, 204); //#20D4CC case 2: - return QColor(0, 246, 12); + return QColor(229, 100, 172); //#E564AC case 3: - return QColor(168, 43, 255); + return QColor(255,138, 23); //#FF8A17 case 4: - return QColor(246, 110, 0); + return QColor(169, 125, 252); //#A97DFC case 5: - return QColor(245, 48, 233); + return QColor(226, 71, 94); //#E2475E case 6: - return QColor(94, 73, 255); + return QColor(255, 198, 0); //#FFC600 case 7: - return QColor(179, 246, 0); + return QColor(0, 166, 81); //#B8A288 case 8: - return QColor(245, 48, 48); + return QColor(29, 223, 221); //#00A651 case 9: - return QColor(29, 223, 221); + return QColor(141, 198, 64); //#8DC63F } - return QColor(0, 174, 239); + qWarning() << "invalid base port:" << basePort; + return QColor(0, 255, 0); } /* form */ diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index 4d0ba95..e65876e 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -802,8 +802,8 @@ void XmlLayoutParser::makeGeneralCon(ControllerForm *form) { int keyCount = form->getKeyList().count(); - int width = GPC_KEYBUTTON_WIDTH + GPC_KEYBUTTON_HSPACING; - int height = GPC_HEAD_SPACING; + int width = GPC_KEYBUTTON_WIDTH + GPC_KEYBUTTON_HSPACING + GPC_BORDER_SIZE * 2; + int height = GPC_HEAD_SPACING + GPC_BORDER_SIZE; height += (GPC_KEYBUTTON_HEIGHT * keyCount) + (GPC_KEYBUTTON_VSPACING * (keyCount - 1));