contextmenu: added close menu operation 25/25125/4
authorsungmin ha <sungmin82.ha@samsung.com>
Wed, 30 Jul 2014 05:22:49 +0000 (14:22 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Wed, 30 Jul 2014 08:20:05 +0000 (17:20 +0900)
organized extern codes
disable mainwindow's label

Change-Id: I3a568798549ddb8cd972dd18109504c9e2d148c5
Signed-off-by: sungmin ha <sungmin82.ha@samsung.com>
tizen/src/display/qt5.c
tizen/src/ui/displaywidget.cpp
tizen/src/ui/mainwindow.cpp
tizen/src/ui/mainwindow.h
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/contextmenu.h
tizen/src/ui/skinkeyitem.cpp
tizen/src/ui/skinkeyitem.h

index 43d3c30aab6ce36b7c50f2029230cfdd87d53646..ea4b9d526510a0c54c34bdd6a1ec096d029ce4c6 100644 (file)
@@ -49,7 +49,7 @@ static void qt5_update(DisplayChangeListener *dcl,
         return;
     }
 
-    qt5_update_internal(surface_data(surf), surface_width(surf), surface_height(surf));
+//    qt5_update_internal(surface_data(surf), surface_width(surf), surface_height(surf));
 }
 
 static void qt5_switch(DisplayChangeListener *dcl,
index 953dd52897bc574cb594fe2e926172b3f49b5530..c569e0730aed2ca6477944b6471e7d6f1aa620d6 100644 (file)
@@ -3,11 +3,6 @@
 #include "displaywidget.h"
 #include "mainwindow.h"
 
-extern "C" {
-void do_mouse_event(int button_type, int event_type,
-    int origin_x, int origin_y, int x, int y, int z);
-}
-
 uint32_t qt5_window_width = 0;
 uint32_t qt5_window_height = 0;
 int qt5_window_angle = 0;
index b447e3549e56215011ef66791d3ea975261cd556..f0f1c1001bf863b431fe555d2f875f0ea4ceefc7 100644 (file)
@@ -5,10 +5,6 @@
 #include "skinlayout.h"
 #include "skincontrollerview.h"
 
-#ifdef CONFIG_MARU
-extern "C" void shutdown_qemu_gracefully(void);
-#endif
-
 QOpenGLContext *qt5GLContext = NULL;
 QSurfaceFormat qt5GLFormat;
 
@@ -232,10 +228,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
                                  QMessageBox::Yes | QMessageBox::Default,
                                  QMessageBox::No);
     if (r == QMessageBox::Yes) {
-#ifdef CONFIG_MARU
         /* force close */
         shutdown_qemu_gracefully();
-#endif
     } else {
         event->ignore();
     }
index 83f04963a9913a1c3f061b95767ee9b2886f7a8a..ffc10916b9c289ab1e11a1a0ae5d169691ccfe35 100644 (file)
 #include "uiinformation.h"
 #include "skincontrollerview.h"
 
+extern "C" {
+#include "skin/maruskin_operation.h"
+}
+
 QT_BEGIN_NAMESPACE
 class QLabel;
 QT_END_NAMESPACE
index 690dfe21dc8e9db694cc712bc90f34dab2b8b32b..502826eb23aad948ed48fa8174287ed7e7644473 100644 (file)
@@ -5,9 +5,6 @@
 #include "detailedinfodialog.h"
 #include "aboutdialog.h"
 
-extern "C" void shutdown_qemu_gracefully(void);
-extern "C" void request_close(void);
-
 ContextMenu::ContextMenu(QWidget *parent) :
     QMenu(parent)
 {
@@ -131,6 +128,7 @@ ContextMenu::ContextMenu(QWidget *parent) :
     addSeparator();
 
     /* Close menu */
+    longPressTimer = new QTimer(this);
     action = addAction("&Close");
     action->setIcon(QIcon(QPixmap(":/icons/close.png")));
     connect(action, SIGNAL(triggered()), this, SLOT(slotClose()));
@@ -233,10 +231,20 @@ void ContextMenu::slotForceClose()
 */
 }
 
+void ContextMenu::slotPwkeyRelease()
+{
+    do_hw_key_event(KEY_RELEASED, HARD_KEY_POWER);
+}
+
 void ContextMenu::slotClose()
 {
     qDebug("close");
-    request_close();
+    do_hw_key_event(KEY_PRESSED, HARD_KEY_POWER);
+
+    this->longPressTimer->setInterval(CLOSE_POWER_KEY_INTERVAL);
+    this->longPressTimer->setSingleShot(true);
+    connect(longPressTimer, SIGNAL(timeout()), this, SLOT(slotPwkeyRelease()));
+    this->longPressTimer->start();
 }
 
 ContextMenu::~ContextMenu()
index ebcd85d8d31660c4f0ed407db39a4f5e781de8b1..5c3fe96ebe62a342124957cca18c077adbf2baf0 100644 (file)
@@ -2,6 +2,14 @@
 #define CONTEXTMENU_H
 
 #include <QMenu>
+#include <QTimer>
+
+extern "C" {
+#include "skin/maruskin_operation.h"
+#include "emul_state.h"
+}
+
+#define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */
 
 class ContextMenu : public QMenu
 {
@@ -22,8 +30,9 @@ public slots:
     void slotAbout();
     void slotForceClose();
     void slotClose();
+    void slotPwkeyRelease();
 
 private:
+    QTimer *longPressTimer;
 };
-
 #endif // CONTEXTMENU_H
index 49d51cc5078c18fb9d6ef18124d73531735dce22..bd45c61892d745e8ebe195abc988a46fd558b40a 100644 (file)
@@ -1,7 +1,5 @@
 #include "skinkeyitem.h"
 
-extern "C" void do_hw_key_event(int event_type, int keycode);
-
 SkinKeyItem::SkinKeyItem(QImage pressedImg, HardwareKey *key, QGraphicsItem *parent) :
     QGraphicsRectItem(key->region, parent)
 {
index 49d19535f063ff3b12ecf6cbaef3b5256849ba72..25c734ab94d32023e05b74f46aef0904fc5b5f73 100644 (file)
@@ -6,11 +6,10 @@
 
 #include "hardwarekey.h"
 
-/* keep it consistent with emulator-skin definition */
-enum {
-    KEY_PRESSED = 1,
-    KEY_RELEASED = 2,
-};
+extern "C" {
+#include "skin/maruskin_operation.h"
+#include "emul_state.h"
+}
 
 class SkinKeyItem : public QGraphicsRectItem
 {