From 30ee27fdee2577b91a7b81b7b309665be07ee86e Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Fri, 8 May 2015 16:09:17 +0900 Subject: [PATCH] rotary: consider the scaling Change-Id: Ic6aed5fd74723fc30bb859409f40c4fdb657c3c5 Signed-off-by: GiWoong Kim --- tizen/src/ui/displaybase.cpp | 5 ++++- tizen/src/ui/mainwindow.cpp | 10 ++++++---- tizen/src/ui/rotaryview.cpp | 20 +++++++++++++------- tizen/src/ui/rotaryview.h | 2 +- tizen/src/ui/skinview.cpp | 4 ++-- tizen/src/ui/skinview.h | 2 +- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp index c38b7a1..1d9b827 100644 --- a/tizen/src/ui/displaybase.cpp +++ b/tizen/src/ui/displaybase.cpp @@ -104,7 +104,10 @@ void DisplayBase::handleResize(QResizeEvent *event) /* masking */ if (maskImage.size() != QSize(0, 0)) { qDebug("set a mask to display"); - widget->setMask(maskImage.mask()); + + widget->setMask(maskImage.scaled( + maskImage.width() * scaleFactor, + maskImage.height() * scaleFactor).mask()); } } diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 16084f7..7070b48 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -397,9 +397,10 @@ void MainWindow::switchForm(int index) resize(uiInfo->getUiSize()); - skinView->update(); + skinView->updateLayout(); + if (rotary != NULL) { - rotary->update(); + rotary->updateLayout(); } if (display != NULL) { @@ -421,9 +422,10 @@ void MainWindow::scaleForm(int scale) resize(uiInfo->getUiSize()); - skinView->update(); + skinView->updateLayout(); + if (rotary != NULL) { - rotary->update(); + rotary->updateLayout(); } if (display != NULL) { diff --git a/tizen/src/ui/rotaryview.cpp b/tizen/src/ui/rotaryview.cpp index 96dcf91..4265b88 100644 --- a/tizen/src/ui/rotaryview.cpp +++ b/tizen/src/ui/rotaryview.cpp @@ -38,7 +38,8 @@ RotaryView::RotaryView(QWidget *parent) : QGraphicsView(new QGraphicsScene(parent), parent) { this->win = (MainWindow *)parent; - this->rotaryImg = win->uiInfo->getMainForm()->getRotaryImage(); + this->rotaryImg = NULL; + this->rotaryItem = NULL; this->grabPos = QPoint(-1, -1); this->grabAngle = 0; this->rotaryDegree = 0; @@ -53,7 +54,7 @@ RotaryView::RotaryView(QWidget *parent) : setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setAlignment(Qt::AlignLeft | Qt::AlignTop); - update(); + updateLayout(); } void RotaryView::createItems() @@ -65,7 +66,7 @@ void RotaryView::createItems() scene()->addItem(rotaryItem); } -void RotaryView::update() +void RotaryView::updateLayout() { scene()->clear(); @@ -75,11 +76,13 @@ void RotaryView::update() /* repositioning & resizing */ const int alignOffsetX = (rotaryImg->width() - displayRect.width()) / 2; const int alignOffsetY = (rotaryImg->height() - displayRect.height()) / 2; + const qreal scaleFactor = win->getUIState()->getScaleFactor(); setGeometry( - displayRect.x() - alignOffsetX, - displayRect.y() - alignOffsetY, - rotaryImg->width(), rotaryImg->height()); + (displayRect.x() - alignOffsetX) * scaleFactor, + (displayRect.y() - alignOffsetY) * scaleFactor, + rotaryImg->width() * scaleFactor, + rotaryImg->height() * scaleFactor); scene()->setSceneRect(0, 0, width(), height()); createItems(); @@ -101,7 +104,10 @@ void RotaryView::resizeEvent(QResizeEvent *event) setTransform(QTransform(sx, 0, 0, 0, sy, 0, 0, 0, 1)); /* masking */ - setMask(win->uiInfo->getMainForm()->getRotaryImage()->mask()); + QPixmap scaledRotaryImg = rotaryImg->scaled( + rotaryImg->width() * win->getUIState()->getScaleFactor(), + rotaryImg->height() * win->getUIState()->getScaleFactor()); + setMask(scaledRotaryImg.mask()); QGraphicsView::resizeEvent(event); } diff --git a/tizen/src/ui/rotaryview.h b/tizen/src/ui/rotaryview.h index e5f0030..68f9790 100644 --- a/tizen/src/ui/rotaryview.h +++ b/tizen/src/ui/rotaryview.h @@ -42,7 +42,7 @@ public: RotaryView(QWidget *parent); ~RotaryView(); - void update(); + void updateLayout(); protected: void resizeEvent(QResizeEvent *event); diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index 872ac66..30ba666 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -46,7 +46,7 @@ SkinView::SkinView(QGraphicsScene *scene, QWidget *parent) : this->grabWinPos = QPoint(-1, -1); this->grabPos = QPoint(-1, -1); - update(); + updateLayout(); kbd = new KeyboardHelper(this); } @@ -71,7 +71,7 @@ void SkinView::createItems(MainForm *form) } } -void SkinView::update() +void SkinView::updateLayout() { scene()->clear(); diff --git a/tizen/src/ui/skinview.h b/tizen/src/ui/skinview.h index bec3a68..7ef875b 100644 --- a/tizen/src/ui/skinview.h +++ b/tizen/src/ui/skinview.h @@ -43,7 +43,7 @@ public: SkinView(QGraphicsScene *scene, QWidget *parent = 0); ~SkinView(); - void update(); + void updateLayout(); protected: void resizeEvent(QResizeEvent *event); -- 2.7.4