diff options
author | Jinhyung Choi <jinh0.choi@samsung.com> | 2015-11-04 11:33:51 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2015-11-26 13:46:08 +0900 |
commit | cf9b7905746a104b83261bc3a4c6955ab0e62bbf (patch) | |
tree | ec5d26b40b80ce7c41750704eced5677fb12be90 /tizen/src | |
parent | 22cd3f8fe579dbacfe0df79fbba3966d4c7e8894 (diff) | |
download | qemu-cf9b7905746a104b83261bc3a4c6955ab0e62bbf.tar.gz qemu-cf9b7905746a104b83261bc3a4c6955ab0e62bbf.tar.bz2 qemu-cf9b7905746a104b83261bc3a4c6955ab0e62bbf.zip |
UI: supports reboot from context menu
When a malfunction of emulator occurs, such as no response from the guest OS,
what a developer can do is selecting "force close"
and restarting from emulator manager.
In order to avoid the inconvenience of doing it, reboot menu is added.
It is working directly to hardware after requesting sync() to guest OS
----------------
| Context menu |
----------------
| reboot |
---------------- ----------
| | emuld |
------------------------ ----------
| 1. send sync message | -------------> | sync() |
| 2. start a timer | ----------
------------------------
| The timer expires after 1s
-------------------------------
| qemu_system_reset_request() |
-------------------------------
Conflicts:
tizen/src/extension/ui/resource/skins/tv-1080x1920/layout.xml
tizen/src/extension/ui/resource/skins/tv-1920x1080/layout.xml
tizen/src/extension/ui/resource/skins/tv-2560x1080/layout.xml
Change-Id: I3c3c31c2cc19065f53b620d83c79e68e0183db53
Signed-off-by: Jinhyung Choi <jinh0.choi@samsung.com>
(cherry picked from commit 14fc61baff1e8b48cbcb810a8392a1ac601f2511)
Diffstat (limited to 'tizen/src')
22 files changed, 108 insertions, 4 deletions
diff --git a/tizen/src/ecs/ecs.h b/tizen/src/ecs/ecs.h index b201a153b4..c1657f9fcb 100644 --- a/tizen/src/ecs/ecs.h +++ b/tizen/src/ecs/ecs.h @@ -62,6 +62,7 @@ #define MSG_TYPE_GUESTIP "guest_ip" #define MSG_TYPE_HDS "hds" #define MSG_TYPE_PACKAGE "package" +#define MSG_TYPE_SYSTEM "system" #define MSG_GROUP_STATUS 15 @@ -184,7 +185,12 @@ bool ntf_to_monitor(const char* data, const int len); bool send_msg_to_guest(const char* cmd, int group, int action, char* data, int data_len); -void send_shutdown_request(void); +enum ecs_system_action { + ECS_SYSTEM_ACTION_FORCE_CLOSE, + ECS_SYSTEM_ACTION_REBOOT +}; + +void send_shutdown_request(int action); void make_send_device_ntf (char* cmd, int group, int action, char* data); diff --git a/tizen/src/ecs/ecs_msg.c b/tizen/src/ecs/ecs_msg.c index f54b4500b2..b8fb4281c6 100644 --- a/tizen/src/ecs/ecs_msg.c +++ b/tizen/src/ecs/ecs_msg.c @@ -193,9 +193,9 @@ bool send_msg_to_guest(const char* cmd, int group, int action, char* data, int d return true; } -void send_shutdown_request(void) +void send_shutdown_request(int action) { - int ret = send_msg_to_guest("system", 0, 0, NULL, 0); + int ret = send_msg_to_guest(MSG_TYPE_SYSTEM, 0, action, NULL, 0); if (!ret) { LOG_SEVERE("fail to send evdi shutdown system call to emuld.\n"); } diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 8d85458892..e8398e8906 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -130,7 +130,7 @@ static Notifier emulator_exit = { .notify = emulator_notify_exit }; static void* run_timed_shutdown_thread(void* args) { - send_shutdown_request(); + send_shutdown_request(ECS_SYSTEM_ACTION_FORCE_CLOSE); const int sleep_interval_time = 1000; /* milli-seconds */ const int timeout_for_shutdown = (uintptr_t)args; diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 90f77dea6c..72ea6d55b4 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -40,6 +40,9 @@ extern "C" { // FIXME: To avoid very complex header inclusion chains void qemu_system_graceful_shutdown_request(unsigned int sec); +void qemu_system_reset_request(void); +#define MENU_ACTION_REBOOT 1 +void send_shutdown_request(int action); #include "util/osutil.h" #include "util/device_hotplug.h" @@ -80,6 +83,9 @@ ContextMenu::ContextMenu(QWidget *parent) : QMenu(parent) /* for close */ longPressTimer = new QTimer(this); + /* for system reset */ + rebootTimer = new QTimer(this); + createItems(this, this->parent->getUiInfo()->getMenuList()); installEventFilter(this); @@ -143,6 +149,10 @@ void ContextMenu::createItems(QMenu *menu, QList<MenuItem *> &list) /* About menu */ createAboutItem(menu, item); break; + case MenuItemType::systemResetItem: + /* System Reset menu */ + createSystemResetItem(menu, item); + break; case MenuItemType::forceCloseItem: /* Force Close menu */ createForceCloseItem(menu, item); @@ -525,6 +535,23 @@ void ContextMenu::createAboutItem(QMenu *menu, MenuItem *item) item->setAction(actionAbout); } +void ContextMenu::createSystemResetItem(QMenu *menu, MenuItem *item) +{ + if (menu == NULL || item == NULL) { + return; + } + + QString menuName = item->getName(); + actionSystemReset = addGeneralAction( + menu, QIcon(QPixmap(":/icons/system_reset.png")), + menuName.isEmpty() ? MENU_FORCECLOSE_ITEM_TEXT : menuName, + item->getShortcuts().isEmpty()? NULL : + new QShortcut(item->getShortcuts().begin().value(), parent), + SLOT(slotSystemReset())); + + item->setAction(actionSystemReset); +} + void ContextMenu::createForceCloseItem(QMenu *menu, MenuItem *item) { if (menu == NULL || item == NULL) { @@ -1017,6 +1044,27 @@ void ContextMenu::slotAbout() #endif } +void ContextMenu::slotDeviceReset() +{ + qDebug("System reset request."); + qemu_system_reset_request(); + qDebug("Done for system reset request."); +} + +void ContextMenu::slotSystemReset() +{ + qDebug("Reboot."); + + send_shutdown_request(MENU_ACTION_REBOOT); + + qDebug("Sent sync message to emuld."); + + rebootTimer->setInterval(HARDWARE_REBOOT_INTERVAL); + rebootTimer->setSingleShot(true); + connect(rebootTimer, SIGNAL(timeout()), this, SLOT(slotDeviceReset())); + rebootTimer->start(); +} + void ContextMenu::slotForceClose() { qDebug("force close"); @@ -1090,4 +1138,6 @@ ContextMenu::~ContextMenu() delete shellOpener; longPressTimer->stop(); + + rebootTimer->stop(); } diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index 63dc565140..942a077b67 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -49,6 +49,7 @@ extern "C" { } #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */ +#define HARDWARE_REBOOT_INTERVAL 1000 /* milli-seconds */ class ContextMenu : public QMenu { @@ -96,6 +97,9 @@ public slots: void slotHostKeyboard(bool on); void slotAbout(); + void slotSystemReset(); + void slotDeviceReset(); + void slotForceClose(); void slotClose(); void slotPwkeyRelease(); @@ -116,6 +120,7 @@ protected: void createControlPanelItem(QMenu *menu, MenuItem *item); void createScreenShotItem(QMenu *menu, MenuItem *item); void createAboutItem(QMenu *menu, MenuItem *item); + void createSystemResetItem(QMenu *menu, MenuItem *item); void createForceCloseItem(QMenu *menu, MenuItem *item); void createCloseItem(QMenu *menu, MenuItem *item); bool eventFilter(QObject *obj, QEvent *event); @@ -146,6 +151,7 @@ private: QAction *actionControlPanel; QAction *actionScreenShot; QAction *actionAbout; + QAction *actionSystemReset; QAction *actionForceClose; QAction *actionClose; @@ -155,5 +161,6 @@ private: ShellOpener *shellOpener; QTimer *longPressTimer; + QTimer *rebootTimer; }; #endif // CONTEXTMENU_H diff --git a/tizen/src/ui/menu/menuitem.h b/tizen/src/ui/menu/menuitem.h index d271700c3b..0658bea279 100644 --- a/tizen/src/ui/menu/menuitem.h +++ b/tizen/src/ui/menu/menuitem.h @@ -50,6 +50,7 @@ namespace MenuItemType controlPanelItem, screenShotItem, aboutItem, + systemResetItem, forceCloseItem, closeItem, }; diff --git a/tizen/src/ui/resource/icons/system_reset.png b/tizen/src/ui/resource/icons/system_reset.png Binary files differnew file mode 100644 index 0000000000..bb4e7c203d --- /dev/null +++ b/tizen/src/ui/resource/icons/system_reset.png diff --git a/tizen/src/ui/resource/resource.qrc b/tizen/src/ui/resource/resource.qrc index 5f009d3405..7dce589438 100644 --- a/tizen/src/ui/resource/resource.qrc +++ b/tizen/src/ui/resource/resource.qrc @@ -38,6 +38,7 @@ <file>icons/about.png</file> <file>icons/advanced.png</file> <file>icons/close.png</file> + <file>icons/system_reset.png</file> <file>icons/force_close.png</file> <file>icons/rotate.png</file> <file>icons/scale.png</file> diff --git a/tizen/src/ui/resource/skins/mobile-320x480-3btn/layout.xml b/tizen/src/ui/resource/skins/mobile-320x480-3btn/layout.xml index 4170bfc7da..dcc709690e 100644 --- a/tizen/src/ui/resource/skins/mobile-320x480-3btn/layout.xml +++ b/tizen/src/ui/resource/skins/mobile-320x480-3btn/layout.xml @@ -233,6 +233,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/mobile/mobile-480x800-3btn/layout.xml b/tizen/src/ui/resource/skins/mobile/mobile-480x800-3btn/layout.xml index 295b8f1788..483bdbd946 100644 --- a/tizen/src/ui/resource/skins/mobile/mobile-480x800-3btn/layout.xml +++ b/tizen/src/ui/resource/skins/mobile/mobile-480x800-3btn/layout.xml @@ -233,6 +233,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/mobile/mobile-540x960-3btn/layout.xml b/tizen/src/ui/resource/skins/mobile/mobile-540x960-3btn/layout.xml index 09292016ac..4c01197d78 100644 --- a/tizen/src/ui/resource/skins/mobile/mobile-540x960-3btn/layout.xml +++ b/tizen/src/ui/resource/skins/mobile/mobile-540x960-3btn/layout.xml @@ -233,6 +233,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/mobile/mobile-720x1280-3btn/layout.xml b/tizen/src/ui/resource/skins/mobile/mobile-720x1280-3btn/layout.xml index 39f1eb8d72..d52af189c8 100644 --- a/tizen/src/ui/resource/skins/mobile/mobile-720x1280-3btn/layout.xml +++ b/tizen/src/ui/resource/skins/mobile/mobile-720x1280-3btn/layout.xml @@ -233,6 +233,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/layout.xml b/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/layout.xml index 798cbebc80..e9eef246f0 100644 --- a/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/layout.xml +++ b/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/layout.xml @@ -72,6 +72,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/tv/tv-1920x1080/layout.xml b/tizen/src/ui/resource/skins/tv/tv-1920x1080/layout.xml index d6e748d7f2..f338dc3113 100644 --- a/tizen/src/ui/resource/skins/tv/tv-1920x1080/layout.xml +++ b/tizen/src/ui/resource/skins/tv/tv-1920x1080/layout.xml @@ -55,6 +55,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearable/wearable-320x320-1btn/layout.xml b/tizen/src/ui/resource/skins/wearable/wearable-320x320-1btn/layout.xml index fef73a6848..b3811f6426 100644 --- a/tizen/src/ui/resource/skins/wearable/wearable-320x320-1btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearable/wearable-320x320-1btn/layout.xml @@ -103,6 +103,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearable/wearable-360x360-1btn/layout.xml b/tizen/src/ui/resource/skins/wearable/wearable-360x360-1btn/layout.xml index c6723b9665..73e25c336c 100644 --- a/tizen/src/ui/resource/skins/wearable/wearable-360x360-1btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearable/wearable-360x360-1btn/layout.xml @@ -103,6 +103,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearable/wearable-360x480-1btn/layout.xml b/tizen/src/ui/resource/skins/wearable/wearable-360x480-1btn/layout.xml index 6f1d496a5d..51812753cd 100644 --- a/tizen/src/ui/resource/skins/wearable/wearable-360x480-1btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearable/wearable-360x480-1btn/layout.xml @@ -103,6 +103,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearable/wearable-general-1btn/layout.xml b/tizen/src/ui/resource/skins/wearable/wearable-general-1btn/layout.xml index e14fa3429e..15803d10db 100644 --- a/tizen/src/ui/resource/skins/wearable/wearable-general-1btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearable/wearable-general-1btn/layout.xml @@ -62,6 +62,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearable/wearableO-360x360-2btn/layout.xml b/tizen/src/ui/resource/skins/wearable/wearableO-360x360-2btn/layout.xml index cb9cbe2b51..2f60964fd1 100644 --- a/tizen/src/ui/resource/skins/wearable/wearableO-360x360-2btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearable/wearableO-360x360-2btn/layout.xml @@ -135,6 +135,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/resource/skins/wearableO-360x360-1btn/layout.xml b/tizen/src/ui/resource/skins/wearableO-360x360-1btn/layout.xml index 9021a696c1..67094fdcb3 100644 --- a/tizen/src/ui/resource/skins/wearableO-360x360-1btn/layout.xml +++ b/tizen/src/ui/resource/skins/wearableO-360x360-1btn/layout.xml @@ -111,6 +111,9 @@ <shortcut>Ctrl+F6</shortcut> </controlPanelItem> <separator/> + <rebootItem name="Reboot"> + <shortcut>Ctrl+Shift+F4</shortcut> + </rebootItem> <closeItem name="Close"> <shortcut>Ctrl+F4</shortcut> </closeItem> diff --git a/tizen/src/ui/xmllayoutkeyword.h b/tizen/src/ui/xmllayoutkeyword.h index 996ed5ed32..f8d2e10713 100644 --- a/tizen/src/ui/xmllayoutkeyword.h +++ b/tizen/src/ui/xmllayoutkeyword.h @@ -79,6 +79,7 @@ #define ECP_MENU_KEYWORD "controlPanelItem" #define SCREENSHOT_MENU_KEYWORD "screenShotItem" #define ABOUT_MENU_KEYWORD "aboutItem" +#define SYSTEM_RESET_MENU_KEYWORD "rebootItem" #define FORCECLOSE_MENU_KEYWORD "forceCloseItem" #define CLOSE_MENU_KEYWORD "closeItem" diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index 2b016ecacb..483afbbcd6 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -502,6 +502,8 @@ int XmlLayoutParser::parseMenuList( item = parseGeneralMenuItem(xml, MenuItemType::screenShotItem); } else if (xml.name() == ABOUT_MENU_KEYWORD) { item = parseGeneralMenuItem(xml, MenuItemType::aboutItem); + } else if (xml.name() == SYSTEM_RESET_MENU_KEYWORD) { + item = parseGeneralMenuItem(xml, MenuItemType::systemResetItem); } else if (xml.name() == FORCECLOSE_MENU_KEYWORD) { item = parseGeneralMenuItem(xml, MenuItemType::forceCloseItem); } else if (xml.name() == CLOSE_MENU_KEYWORD) { |