From: GiWoong Kim Date: Wed, 20 Aug 2014 08:42:37 +0000 (+0900) Subject: menu: added event filter for mouse right button X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F26339%2F1;p=sdk%2Femulator%2Fqemu.git menu: added event filter for mouse right button Change-Id: I80d5631007af1b813f2ca06c5a258ced39bfcf4f Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 12e9ad4188..d63d631203 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -79,6 +79,7 @@ void qt5_skin_init(void) if (uiInfo->skinPath.endsWith(QDir::separator()) == false) { uiInfo->skinPath += QDir::separator(); } + QSettings skinInfo(uiInfo->skinPath + "info.ini", QSettings::IniFormat); QString skinName = skinInfo.value("skin.name").toString(); if (skinName.isEmpty() == true) { diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index ecba0a3d9d..3541254b07 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -36,12 +36,20 @@ ContextMenu::ContextMenu(QWidget *parent) : QMenu(parent) { + infoDialog = NULL; + aboutDialog = NULL; + + createItems(); + + installEventFilter(this); +} + +void ContextMenu::createItems() { MainWindow *win = (MainWindow *)this->parent(); /* Detailed Info menu */ - infoDialog = new DetailedInfoDialog(win); QAction *action = addAction(win->uiInfo->vmName + " : " - + QString::number(win->uiInfo->basePort)); + + QString::number(win->uiInfo->basePort)); action->setIcon(QIcon(QPixmap(":/icons/detailed_info.png"))); connect(action, SIGNAL(triggered()), this, SLOT(slotDetailedInfo())); @@ -188,14 +196,33 @@ ContextMenu::ContextMenu(QWidget *parent) : connect(action, SIGNAL(triggered()), this, SLOT(slotClose())); } +bool ContextMenu::eventFilter(QObject *obj, QEvent *event) +{ + ContextMenu *menu = dynamic_cast(obj); + + if (menu != NULL && + (event->type() == QEvent::MouseButtonPress || + event->type() == QEvent::MouseButtonRelease)) { + QMouseEvent *mouseEvent = dynamic_cast(event); + + if (mouseEvent != NULL && mouseEvent->button() == Qt::RightButton) { + mouseEvent->ignore(); /* filtering */ + return true; + } + } + + return QObject::eventFilter(obj, event); +} + void ContextMenu::slotDetailedInfo() { qDebug("VM info"); - /* for modaless dialog */ - if (infoDialog != NULL) { - infoDialog->show(); + if (infoDialog == NULL) { + infoDialog = new DetailedInfoDialog((QWidget *)this->parent()); } + + infoDialog->show(); } void ContextMenu::slotTopMost(bool check) @@ -364,9 +391,11 @@ void ContextMenu::slotAbout() { qDebug("about"); - if (aboutDialog != NULL) { - aboutDialog->show(); + if (aboutDialog == NULL) { + aboutDialog = new AboutDialog((QWidget *)this->parent()); } + + aboutDialog->show(); } void ContextMenu::slotForceClose() diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index c416762e0d..d801ac5b91 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -72,6 +72,10 @@ public slots: void slotClose(); void slotPwkeyRelease(); +protected: + void createItems(); + bool eventFilter(QObject *obj, QEvent *event); + private: QTimer *longPressTimer; DetailedInfoDialog *infoDialog; diff --git a/tizen/src/ui/menu/detailedinfodialog.cpp b/tizen/src/ui/menu/detailedinfodialog.cpp index 0c13bfe1fc..9321a97602 100644 --- a/tizen/src/ui/menu/detailedinfodialog.cpp +++ b/tizen/src/ui/menu/detailedinfodialog.cpp @@ -37,7 +37,7 @@ extern char tizen_target_img_path[]; //TODO: not legacy DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : QDialog(parent) { - MainWindow *win = ((MainWindow *)this->parent()); + MainWindow *win = ((MainWindow *)parent); setWindowTitle("Detailed Info"); diff --git a/tizen/src/ui/resource/resource.qrc b/tizen/src/ui/resource/resource.qrc index 4ec3b7d3be..4ca194b80b 100644 --- a/tizen/src/ui/resource/resource.qrc +++ b/tizen/src/ui/resource/resource.qrc @@ -1,24 +1,4 @@ - - wearable-320x320-1btn/default_0.png - wearable-320x320-1btn/default_0_p.png - wearable-320x320-1btn/default_180.png - wearable-320x320-1btn/default_180_p.png - wearable-320x320-1btn/default_L90.png - wearable-320x320-1btn/default_L90_p.png - wearable-320x320-1btn/default_R90.png - wearable-320x320-1btn/default_R90_p.png - wearable-320x320-1btn/layout.qml - mobile-720x1280-3btn/default_0.png - mobile-720x1280-3btn/default_0_p.png - mobile-720x1280-3btn/default_180.png - mobile-720x1280-3btn/default_180_p.png - mobile-720x1280-3btn/default_L90.png - mobile-720x1280-3btn/default_L90_p.png - mobile-720x1280-3btn/default_R90.png - mobile-720x1280-3btn/default_R90_p.png - mobile-720x1280-3btn/layout.qml - about.png icons/emulator_icon.ico diff --git a/vl.c b/vl.c index c855b2be1f..724bd77aca 100644 --- a/vl.c +++ b/vl.c @@ -4076,7 +4076,9 @@ int main(int argc, char **argv, char **envp) exit(1); } +#ifdef CONFIG_MARU maru_display_early_init(display_type); +#endif current_machine = MACHINE(object_new(object_class_get_name( OBJECT_CLASS(machine_class))));