summaryrefslogtreecommitdiff
path: root/tizen/src/ui/displaybase.cpp
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2015-09-01 20:50:01 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2015-09-02 16:55:08 +0900
commit10e7e30f134e3411546eacde90645e921f9f7c70 (patch)
tree9ba77340916a54be009fe2b8e197660ba9bd0e12 /tizen/src/ui/displaybase.cpp
parent98ef667ccfd04fa2d3147c7ff7b66e4519afa195 (diff)
downloadqemu-10e7e30f134e3411546eacde90645e921f9f7c70.tar.gz
qemu-10e7e30f134e3411546eacde90645e921f9f7c70.tar.bz2
qemu-10e7e30f134e3411546eacde90645e921f9f7c70.zip
display: modified "display off guide image" processing
use an absolute path on image loading. remove unnecessary image format conversions. modify some variable and function names. Change-Id: I679ffb5e8661b51bbdd78d48dc34b23692e160ce Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
Diffstat (limited to 'tizen/src/ui/displaybase.cpp')
-rw-r--r--tizen/src/ui/displaybase.cpp89
1 files changed, 45 insertions, 44 deletions
diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp
index db9e30b6fd..993fc0c7bc 100644
--- a/tizen/src/ui/displaybase.cpp
+++ b/tizen/src/ui/displaybase.cpp
@@ -47,16 +47,17 @@ int qt5_window_angle = 0;
DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scaleFactor,
QWidget *w) : resolution(resolution), widget(w)
{
+ this->win = (MainWindow *)widget->parentWidget();
this->rect = displayForm->getRect();
this->maskImage = displayForm->getMask();
this->rotateAngle = displayForm->getAngle();
this->scaleFactor = scaleFactor;
this->isDragging = false;
- this->gImgState = false;
+
+ this->offGuide = NULL;
+ this->offGuideShown = false;
this->tsHelper = new TouchScreenHelper(this);
- this->gImg = new QImage();
- this->gPxmImg = new QPixmap();
isTouch = is_touchscreen_enabled();
if (!isTouch) {
@@ -66,11 +67,10 @@ DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scale
mouseStatus = MOUSE_LEAVE;
}
- loadGuideImg();
-
- MainWindow *win = (MainWindow *)widget->parentWidget();
win->getMainView()->getKbdHelper()->setMtTracker(tsHelper->getMtTracker());
+ loadGuideImg();
+
updateGeometry();
/* update sensor */
@@ -79,60 +79,56 @@ DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scale
void DisplayBase::loadGuideImg()
{
- QString guide_img_path(SDK_EMULATOR_IMAGES_PATH);
- guide_img_path.append(DISPLAY_OFF_GUIDE_IMAGE_FILE);
+ QString offImage = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_EMULATOR_IMAGES_PATH +
+ DISPLAY_OFF_GUIDE_IMAGE_FILE).absolutePath();
- bool ret = gImg->load(guide_img_path);
- if (ret == false) {
- qDebug() << guide_img_path << ": No such file";
- isGimgReady = false;
- } else {
- isGimgReady = true;
+ if (offGuideImg.load(offImage) == false) {
+ qWarning() << "failed to load image from" << offImage;
}
}
-void DisplayBase::startGuideImg()
+bool DisplayBase::isOffGuideReady()
{
- MainWindow *win = (MainWindow *)widget->parentWidget();
- int rWidth = rect.width() * scaleFactor;
- int rHeight = rect.height() * scaleFactor;
- int x = rect.x() * scaleFactor;
- int y = rect.y() * scaleFactor;
+ return !offGuideImg.isNull();
+}
- gLabel = new QLabel(win);
- gLabel->setAttribute(Qt::WA_DeleteOnClose);
- gLabel->setStyleSheet("background-color: black");
+void DisplayBase::showOffGuideImg()
+{
+ offGuideShown = true;
- *gPxmImg = QPixmap::fromImage(*gImg);
- *gPxmImg = gPxmImg->scaled(rWidth, rHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ offGuide = new QLabel(win);
+ offGuide->setAttribute(Qt::WA_DeleteOnClose);
+ offGuide->setStyleSheet(
+ "background-color: black; border-style: none;");
+ offGuide->setAlignment(Qt::AlignCenter);
- gLabel->setPixmap(*gPxmImg);
- gLabel->setGeometry(x, y, rWidth, rHeight);
- gLabel->setAlignment(Qt::AlignCenter);
- gLabel->show();
+ offGuide->setGeometry(getGeometry());
+ offGuide->setPixmap(offGuideImg.scaled(
+ getGeometry().width(), getGeometry().height(),
+ Qt::KeepAspectRatio, Qt::SmoothTransformation));
- gImgState = true;
+ offGuide->show();
}
-void DisplayBase::stopGuideImg()
+void DisplayBase::hideOffGuideImg()
{
- gLabel->close();
- gImgState = false;
-}
+ if (offGuide != NULL) {
+ offGuide->close();
+ offGuide = NULL;
+ }
-bool DisplayBase::getIsGimgReady()
-{
- return isGimgReady;
+ offGuideShown = false;
}
-bool DisplayBase::getGimgState()
+bool DisplayBase::isOffGuideShown()
{
- return gImgState;
+ return offGuideShown;
}
void DisplayBase::switchForm(DisplayType *displayForm)
{
- qDebug() << "display switch angle :" << displayForm->getAngle();
+ qDebug() << "display switch angle:" << displayForm->getAngle();
qt5_window_angle = rotateAngle = displayForm->getAngle();
@@ -150,7 +146,7 @@ void DisplayBase::switchForm(DisplayType *displayForm)
void DisplayBase::scaleForm(qreal scaleFactor)
{
- qDebug() << "display scale factor :" << scaleFactor;
+ qDebug() << "display scale factor:" << scaleFactor;
this->scaleFactor = scaleFactor;
@@ -167,10 +163,13 @@ void DisplayBase::update()
void DisplayBase::updateGeometry()
{
+ if (isOffGuideShown() == true) {
+ hideOffGuideImg();
+ }
+
qreal sx = rect.x() * scaleFactor;
qreal sy = rect.y() * scaleFactor;
- widget->setGeometry( qRound(sx),
- qRound(sy),
+ widget->setGeometry(qRound(sx), qRound(sy),
rect.width() * scaleFactor,
rect.height() * scaleFactor);
}
@@ -192,7 +191,7 @@ void DisplayBase::handlePaint(QPaintEvent *event)
void DisplayBase::handleResize(QResizeEvent *event)
{
- qDebug() << "resize display :" << event->size();
+ qDebug() << "resize display:" << event->size();
qt5_window_width = widget->width();
qt5_window_height = widget->height();
@@ -408,6 +407,8 @@ DisplayBase::~DisplayBase()
{
qDebug("destroy display");
+ hideOffGuideImg();
+
if (tsHelper != NULL) {
delete tsHelper;
}