4 * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
7 * SungMin Ha <sungmin82.ha@samsung.com>
8 * GiWoong Kim <giwoong.kim@samsung.com>
9 * SeokYeon Hwang <syeon.hwang@samsung.com>
10 * Sangho Park <sangho.p@samsung.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
37 #include "emulator_common.h"
38 #include "detailedinfodialog.h"
39 #include "aboutdialog.h"
40 #include "screenshotdialog.h"
41 #include "menu/menuitem.h"
42 #include "menu/sdbhelper.h"
43 #include "input/keyboardshortcut.h"
48 #include "emul_state.h"
51 #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */
52 #define HARDWARE_REBOOT_INTERVAL 1000 /* milli-seconds */
54 class ContextMenu : public QMenu
59 explicit ContextMenu(QWidget *parent = 0);
62 QAction *getOnTopAction();
64 QSignalMapper *getSwitchMapper();
65 QSignalMapper *getScaleMapper();
66 QSignalMapper *getControllerMapper();
68 ScreenShotDialog *screenshotDialog;
71 void slotAmbiguousShortcut();
73 void slotDetailedInfo();
74 void slotOnTop(bool on);
75 void slotOnTopShortcut();
77 void slotSwitch(int index);
78 void slotSwitchShortcutPrev();
79 void slotSwitchShortcutNext();
81 void slotScale(int scale);
82 void slotScaleShortcutPrev();
83 void slotScaleShortcutNext();
85 void slotController(int index);
87 void slotConShortcutPrev();
88 void slotConShortcutNext();
91 void slotControlPanel();
92 void slotRequestScreenshot();
93 void slotShowScreenshot(const QPixmap &);
94 void slotHostKeyboard(bool on);
97 void slotSystemReset();
98 void slotDeviceReset();
100 void slotForceClose();
102 void slotPwkeyRelease();
104 void slotUndefinedMenu();
107 void createItems(QMenu *menu, QList<MenuItem *> &list);
108 void createSeparator(QMenu *menu);
109 void createAdvancedItem(QMenu *menu, MenuItem *item);
111 void createInfoItem(QMenu *menu, MenuItem *item);
112 void createOnTopItem(QMenu *menu, MenuItem *item);
113 void createMoveItem(QMenu *menu, MenuItem *item);
114 void createSwitchItem(QMenu *menu, MenuItem *item);
115 void createScaleItem(QMenu *menu, MenuItem *item);
116 void createControllerItem(QMenu *menu, MenuItem *item);
117 void createHostKeyboardItem(QMenu *menu, MenuItem *item);
118 void createShellItem(QMenu *menu, MenuItem *item);
119 void createControlPanelItem(QMenu *menu, MenuItem *item);
120 void createScreenShotItem(QMenu *menu, MenuItem *item);
121 void createAboutItem(QMenu *menu, MenuItem *item);
122 void createSystemResetItem(QMenu *menu, MenuItem *item);
123 void createForceCloseItem(QMenu *menu, MenuItem *item);
124 void createCloseItem(QMenu *menu, MenuItem *item);
125 bool eventFilter(QObject *obj, QEvent *event);
128 void launchControlPanel(QString &, QStringList &);
129 QAction *addGeneralAction(QMenu *menu, const QIcon &icon,
130 const QString &text, QShortcut *shortcut, const char *slot);
131 void attachShortcut(QAction *action, QShortcut *shortcut, const char *slot);
135 DetailedInfoDialog *infoDialog;
136 AboutDialog *aboutDialog;
141 QMenu *controllerMenu;
143 QActionGroup *switchGroup;
144 QActionGroup *scaleGroup;
145 QActionGroup *keyboardGroup;
146 QActionGroup *controllerGroup;
148 QAction *actionDetailedInfo;
149 QAction *actionOnTop;
151 QAction *actionShell;
152 QAction *actionControlPanel;
153 QAction *actionScreenShot;
154 QAction *actionAbout;
155 QAction *actionSystemReset;
156 QAction *actionForceClose;
157 QAction *actionClose;
159 QSignalMapper *switchMapper;
160 QSignalMapper *scaleMapper;
161 QSignalMapper *controllerMapper;
163 SdbHelper *sdbHelper;
164 QTimer *longPressTimer;
167 #endif // CONTEXTMENU_H