summaryrefslogtreecommitdiff
path: root/tizen/src/ui
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2016-01-08 14:31:00 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2016-01-13 10:21:10 +0900
commit895f93a7ed13d934c11099d76aaee3f69f5b1076 (patch)
treef03db0c417a1638d700f8e9fb4a44a6d55ecbd8c /tizen/src/ui
parent6c198b417a7bbb49b760a069660bbf6d5847110c (diff)
downloadqemu-895f93a7ed13d934c11099d76aaee3f69f5b1076.tar.gz
qemu-895f93a7ed13d934c11099d76aaee3f69f5b1076.tar.bz2
qemu-895f93a7ed13d934c11099d76aaee3f69f5b1076.zip
display: minor cleanup for input
move each duplicated code to its parent class Change-Id: I7eeb29892bd23264eb688a72d6583fc9d4460755 Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com> (cherry picked from commit 9ca2ddeccd7c8e00beffe1e4fc044314e5ae8701)
Diffstat (limited to 'tizen/src/ui')
-rw-r--r--tizen/src/ui/displaybase.cpp51
-rw-r--r--tizen/src/ui/displaybase.h5
-rw-r--r--tizen/src/ui/displayglwidget.cpp9
-rw-r--r--tizen/src/ui/displayglwidget.h5
-rw-r--r--tizen/src/ui/displayswwidget.cpp10
-rw-r--r--tizen/src/ui/displayswwidget.h5
6 files changed, 47 insertions, 38 deletions
diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp
index 4dfa9329e4..6eb3c3367a 100644
--- a/tizen/src/ui/displaybase.cpp
+++ b/tizen/src/ui/displaybase.cpp
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -53,17 +54,27 @@ DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scale
this->scaleFactor = scaleFactor;
this->isDragging = false;
+ this->tsHelper = NULL;
+ this->mouseHelper = NULL;
+
this->offGuide = NULL;
this->offGuideShown = false;
this->isTsEnabled = is_touchscreen_enabled();
-
- /* touch screen */
- this->tsHelper = new TouchScreenHelper(this);
- win->getMainView()->getKbdHelper()->setMtTracker(tsHelper->getMtTracker());
-
- /* mouse */
- this->mouseHelper = new MouseHelper(this, resolution);
+ if (isTsEnabled == true) {
+ qDebug("touch screen device was enabled");
+
+ /* touch screen */
+ tsHelper = new TouchScreenHelper(this);
+ win->getMainView()->getKbdHelper()->setMtTracker(tsHelper->getMtTracker());
+ } else {
+ qDebug("touch screen device was not enabled");
+
+ /* mouse */
+ mouseHelper = new MouseHelper(this, resolution);
+ widget->setCursor(Qt::BlankCursor);
+ widget->setMouseTracking(true);
+ }
loadOffGuideImg();
@@ -228,7 +239,9 @@ QPoint DisplayBase::getGuestPos(QPoint hostPos)
guestPos.setY(guestPosX);
break;
case 0:
+ break;
default:
+ qWarning() << "unsupported coordinate system:" << rotateAngle;
break;
}
@@ -250,9 +263,10 @@ void DisplayBase::handleMousePress(QMouseEvent *event)
if (event->button() == Qt::LeftButton) {
isDragging = true;
- if (isTsEnabled == true) {
+ if (tsHelper != NULL) {
tsHelper->mousePressed(event, getGuestPos(event->pos()));
- } else {
+ }
+ if (mouseHelper != NULL) {
mouseHelper->mousePressed(event);
}
}
@@ -265,9 +279,10 @@ void DisplayBase::handleMouseRelease(QMouseEvent *event)
isDragging = false;
}
- if (isTsEnabled == true) {
+ if (tsHelper != NULL) {
tsHelper->mouseReleased(event, getGuestPos(event->pos()));
- } else {
+ }
+ if (mouseHelper != NULL) {
mouseHelper->mouseReleased(event);
}
}
@@ -275,7 +290,8 @@ void DisplayBase::handleMouseRelease(QMouseEvent *event)
void DisplayBase::handleMouseMove(QMouseEvent *event)
{
- if (isTsEnabled == true) { /* touch device */
+ /* touch screen device */
+ if (tsHelper != NULL) {
if (isDragging == true) {
int hostPosX = event->x();
int hostPosY = event->y();
@@ -307,7 +323,10 @@ void DisplayBase::handleMouseMove(QMouseEvent *event)
tsHelper->mouseMoved(event, getGuestPos(event->pos()));
}
}
- } else { /* mouse device */
+ }
+
+ /* mouse device */
+ if (mouseHelper != NULL) {
const int hostPosX = event->x();
const int hostPosY = event->y();
@@ -329,14 +348,14 @@ void DisplayBase::handleMouseMove(QMouseEvent *event)
void DisplayBase::handleMouseEnter(QEvent *event)
{
- if (isTsEnabled == false) {
+ if (mouseHelper != NULL) {
mouseHelper->mouseEnter(event);
}
}
void DisplayBase::handleMouseLeave(QEvent *event)
{
- if (isTsEnabled == false) {
+ if (mouseHelper != NULL) {
mouseHelper->mouseLeave(event);
}
}
diff --git a/tizen/src/ui/displaybase.h b/tizen/src/ui/displaybase.h
index fdaa8d3e5b..de83c7613a 100644
--- a/tizen/src/ui/displaybase.h
+++ b/tizen/src/ui/displaybase.h
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -78,12 +79,12 @@ protected:
int rotateAngle;
qreal scaleFactor;
bool isDragging;
+ bool isTsEnabled;
private:
void loadOffGuideImg();
QSize resolution;
- bool isTsEnabled;
MainWindow *win;
QWidget *widget; /* child */
diff --git a/tizen/src/ui/displayglwidget.cpp b/tizen/src/ui/displayglwidget.cpp
index 65841bee0e..84f173dc02 100644
--- a/tizen/src/ui/displayglwidget.cpp
+++ b/tizen/src/ui/displayglwidget.cpp
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -39,12 +40,6 @@ DisplayGLWidget::DisplayGLWidget(QWidget *parent, QGLContext *context,
QGLWidget(context, parent), DisplayBase(displayForm, resolution, scaleFactor, this)
{
setAutoBufferSwap(false);
- isTouch = is_touchscreen_enabled();
- /* mouse mode */
- if (!isTouch) {
- setCursor(Qt::BlankCursor);
- setMouseTracking(true);
- }
}
/* override */
diff --git a/tizen/src/ui/displayglwidget.h b/tizen/src/ui/displayglwidget.h
index 170c801159..378fd6377d 100644
--- a/tizen/src/ui/displayglwidget.h
+++ b/tizen/src/ui/displayglwidget.h
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -57,8 +58,6 @@ protected:
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
-private:
- bool isTouch;
};
#endif // DISPLAYGLWIDGET_H
diff --git a/tizen/src/ui/displayswwidget.cpp b/tizen/src/ui/displayswwidget.cpp
index a973a8c0a0..831c8ec430 100644
--- a/tizen/src/ui/displayswwidget.cpp
+++ b/tizen/src/ui/displayswwidget.cpp
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -47,13 +48,6 @@ DisplaySWWidget::DisplaySWWidget(QWidget *parent,
displayForm->getRect().height() * scaleFactor);
initImage.fill(Qt::black);
setPixmap(initImage);
-
- isTouch = is_touchscreen_enabled();
- /* mouse mode */
- if (!isTouch) {
- setCursor(Qt::BlankCursor);
- setMouseTracking(true);
- }
}
/* override */
diff --git a/tizen/src/ui/displayswwidget.h b/tizen/src/ui/displayswwidget.h
index 5c3d27ec32..26de5d9b00 100644
--- a/tizen/src/ui/displayswwidget.h
+++ b/tizen/src/ui/displayswwidget.h
@@ -5,7 +5,8 @@
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
* Stanislav Vorobiov
*
* This program is free software; you can redistribute it and/or
@@ -55,9 +56,9 @@ protected:
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
+
private:
MultiTouchTracker *mtTracker;
- bool isTouch;
};
#endif // DISPLAYSWWIDGET_H