display: notify angle to sensor device on Qt GUI
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 22 Jun 2015 08:39:29 +0000 (17:39 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 22 Jun 2015 08:45:50 +0000 (17:45 +0900)
Change-Id: Ieeeb2f894937f8a25a7f6d37b4d5df98e55d595b
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/displaybase.cpp

index 3772ae76755cec12ad5c4d1ce745943d4f018289..3bd885a772de8b2e6e088d713d2beabb2662d8f9 100644 (file)
 #include "displaybase.h"
 #include "mainwindow.h"
 
+extern "C" {
+#include "emul_state.h"
+#include "skin/maruskin_operation.h"
+}
+
 #define BLANK_GUIDE_IMAGE_PATH "../images/"
 #define BLANK_GUIDE_IMAGE_NAME "blank-guide.png"
 
@@ -117,9 +122,30 @@ void DisplayBase::switchForm(DisplayType *displayForm)
 {
     qDebug() << "display switch angle :" << displayForm->getAngle();
 
+    qt5_window_angle = rotateAngle = displayForm->getAngle();
+
     rect = displayForm->getRect();
     maskImage = displayForm->getMask();
-    qt5_window_angle = rotateAngle = displayForm->getAngle();
+
+    /* update sensor */
+    // TODO: use degree
+    switch(rotateAngle) {
+    case 0:
+        do_rotation_event(ROTATION_PORTRAIT);
+        break;
+    case 90:
+        do_rotation_event(ROTATION_REVERSE_LANDSCAPE);
+        break;
+    case 180:
+        do_rotation_event(ROTATION_REVERSE_PORTRAIT);
+        break;
+    case 270:
+        do_rotation_event(ROTATION_LANDSCAPE);
+        break;
+    default:
+        qWarning() << "invalid angle :" << rotateAngle;
+        break;
+    }
 
     updateGeometry();
     update();