From: GiWoong Kim Date: Wed, 19 Aug 2015 11:58:42 +0000 (+0900) Subject: shortcut: refactoring for HW key shortcut X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~40^2~181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a44108cc89c7c95226ad31f8c40687bf32ea9346;p=sdk%2Femulator%2Fqemu.git shortcut: refactoring for HW key shortcut - remove unnecessary member variables and functions - duplicated methods were integrated between main form and controller - add some logs Change-Id: Iaae0ccad24da0de4c1908eb1545897b5cc20ae46 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/ui/controller/dockingcontroller.cpp b/tizen/src/ui/controller/dockingcontroller.cpp index 2cf341989d..7e6051ea7d 100644 --- a/tizen/src/ui/controller/dockingcontroller.cpp +++ b/tizen/src/ui/controller/dockingcontroller.cpp @@ -47,6 +47,11 @@ DockingController::DockingController(ControllerForm *conForm, conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); } +ControllerForm *DockingController::getConForm() +{ + return conForm; +} + DockingConView *DockingController::getConView() { return conView; diff --git a/tizen/src/ui/controller/dockingcontroller.h b/tizen/src/ui/controller/dockingcontroller.h index f0c0e04a87..cd1673034a 100644 --- a/tizen/src/ui/controller/dockingcontroller.h +++ b/tizen/src/ui/controller/dockingcontroller.h @@ -46,6 +46,7 @@ public: QAction *menu, int dockPos, QWidget *parent = 0); ~DockingController(); + ControllerForm *getConForm(); DockingConView *getConView(); int getDockPos(); void updateGeometry(); diff --git a/tizen/src/ui/controller/floatingcontroller.cpp b/tizen/src/ui/controller/floatingcontroller.cpp index a26ee120c5..ace2b183c1 100644 --- a/tizen/src/ui/controller/floatingcontroller.cpp +++ b/tizen/src/ui/controller/floatingcontroller.cpp @@ -54,6 +54,11 @@ FloatingController::FloatingController(ControllerForm *conForm, layout->addWidget(conView); } +ControllerForm *FloatingController::getConForm() +{ + return conForm; +} + FloatingConView *FloatingController::getConView() { return conView; diff --git a/tizen/src/ui/controller/floatingcontroller.h b/tizen/src/ui/controller/floatingcontroller.h index f8a663415f..25c9121640 100644 --- a/tizen/src/ui/controller/floatingcontroller.h +++ b/tizen/src/ui/controller/floatingcontroller.h @@ -43,6 +43,7 @@ public: explicit FloatingController(ControllerForm *conForm, QAction *menu, QWidget *parent = 0); ~FloatingController(); + ControllerForm *getConForm(); FloatingConView *getConView(); protected: diff --git a/tizen/src/ui/controller/generalpurposecon.cpp b/tizen/src/ui/controller/generalpurposecon.cpp index bd35c3df68..7eb99a6123 100644 --- a/tizen/src/ui/controller/generalpurposecon.cpp +++ b/tizen/src/ui/controller/generalpurposecon.cpp @@ -62,8 +62,8 @@ void GeneralPurposeCon::createItems(QList keyList, QSize size) keyButton = new HWKeyButton(buttonGroup, hwKey, QSize(GPC_KEYBUTTON_WIDTH, GPC_KEYBUTTON_HEIGHT)); - if (!hwKey->getKeySequence().isEmpty()) { - keyButton->setToolTip(hwKey->getKeySequence()); + if (hwKey->getKeySequence().isEmpty() == false) { + keyButton->setToolTip(hwKey->getKeySequence().toString()); } layout->addWidget(keyButton); diff --git a/tizen/src/ui/controller/hwkeybutton.cpp b/tizen/src/ui/controller/hwkeybutton.cpp index c3ca9bc97e..0bf298b1c7 100644 --- a/tizen/src/ui/controller/hwkeybutton.cpp +++ b/tizen/src/ui/controller/hwkeybutton.cpp @@ -60,7 +60,7 @@ HWKeyButton::HWKeyButton(QWidget *parent, HardwareKey *hwKey, QSize size) : void HWKeyButton::mousePressEvent(QMouseEvent *event) { - const int keycode = hwKey->getKeycodeType()->getShortPressKeycode(); + const int keycode = hwKey->getKeycode(); qDebug() << hwKey->getName() << "key button pressed:" << keycode; do_hw_key_event(KEY_PRESSED, keycode); @@ -70,7 +70,7 @@ void HWKeyButton::mousePressEvent(QMouseEvent *event) void HWKeyButton::mouseReleaseEvent(QMouseEvent *event) { - const int keycode = hwKey->getKeycodeType()->getShortPressKeycode(); + const int keycode = hwKey->getKeycode(); qDebug() << hwKey->getName() << "key button released:" << keycode; do_hw_key_event(KEY_RELEASED, keycode); diff --git a/tizen/src/ui/input/keyboardshortcut.cpp b/tizen/src/ui/input/keyboardshortcut.cpp index c3baebee0a..934cc49e09 100644 --- a/tizen/src/ui/input/keyboardshortcut.cpp +++ b/tizen/src/ui/input/keyboardshortcut.cpp @@ -38,125 +38,53 @@ extern "C" { KeyboardShortcut::KeyboardShortcut(QWidget *parent) : QWidget(parent) { - this->parent = (MainWindow *)parent; - this->hide(); -} + this->win = (MainWindow *)parent; -void KeyboardShortcut::removeControllerShortcut() -{ - for (int index = 0; index < controllerShortcutList.count(); index++) { - delete controllerShortcutList.at(index); - } + mapper = new QSignalMapper(this); + connect(mapper, SIGNAL(mapped(int)), this, SLOT(slotHwKeyShortcut(int))); - controllerShortcutList.clear(); - controllerShortcutMap.clear(); + hide(); - qDebug() << "Removed controller shortcuts"; + registerHwKeyShortcuts(win->uiInfo->getMainForm()->keyList); } -void KeyboardShortcut::removeHwKeyShortcut() +QMap KeyboardShortcut::getHwKeyShortcutMap() { - for (int index = 0; index < hwKeyShortcutList.count(); index++) { - delete hwKeyShortcutList.at(index); - } - - hwKeyShortcutList.clear(); - hwKeyShortcutMap.clear(); - - qDebug() << "Removed hwKey shortcuts"; + return hwKeyShortcutMap; } -void KeyboardShortcut::registShortcutKey(QShortcut *shortcut, QString item) +void KeyboardShortcut::registerHwKeyShortcuts(QList list) { - QSignalMapper *mapper = new QSignalMapper(this); - if (!mapper || !shortcut) { - qDebug() << "regist HwKey shortcut failed."; - return; - } + for (int index = 0; index < list.count(); index++) { + HardwareKey *hwKey = list.at(index); + if (hwKey && hwKey->getKeySequence().isEmpty() == false) { + QShortcut *shortcut = new QShortcut(hwKey->getKeySequence(), win); - connect(shortcut, SIGNAL(activated()), mapper, SLOT(map())); - mapper->setMapping(shortcut, item); - connect(mapper, SIGNAL(mapped(const QString &)), this, SLOT(slotShortcutHwKey(const QString &))); -} + connect(shortcut, SIGNAL(activated()), mapper, SLOT(map())); + mapper->setMapping(shortcut, hwKey->getKeycode()); -void KeyboardShortcut::setKeyboardShortcutController() -{ - DockingController *dct = parent->getDockingCon(); - FloatingController *fct = parent->getFloatingCon(); - - if (dct) { - controllerKeyList = dct->getConView()->getKeyList(); - } else if (fct) { - controllerKeyList = fct->getConView()->getKeyList(); - } else { - qDebug() << "controllerKeyList is not exist!"; - return; - } - - qDebug() << "Set keyboard shortcut ControllerKeys."; - for (int index = 0; index < controllerKeyList.count(); index++) { - HardwareKey *controllerKey = controllerKeyList.at(index); - if (controllerKey) { - if (!controllerKey->getKeySequence().isEmpty()) { - QShortcut *shortcut = new QShortcut( - QKeySequence::fromString(controllerKey->getKeySequence()), parent); - registShortcutKey(shortcut, controllerKey->getName()); - - controllerShortcutList.append(shortcut); - controllerShortcutMap.insert( - controllerKey->getName(), controllerKey->getKeySequence()); - } - } else { - qDebug() << "controllerKeyList.at(" << index << ") is NULL"; + hwKeyShortcutMap.insert(hwKey, shortcut); } } + + qDebug() << hwKeyShortcutMap.count() << "shortcuts have been registered"; } -void KeyboardShortcut::setKeyboardShortcutHwKey() +void KeyboardShortcut::cancelHwKeyShortcuts(QList list) { - UIInformation *uiInfo = parent->uiInfo; - - if (uiInfo) { - if (uiInfo->getMainForm() != NULL) { - if (uiInfo->getMainForm()->keyList.count() > 0) { - hwKeyList = uiInfo->getMainForm()->keyList; - } else if (uiInfo->getMainForm()->keyList.count() == 0) { - qWarning() << "hwKey is not exist"; - return; - } else { - qWarning() << "hwKeyList is not exist"; - return; - } - } else { - qWarning() << "uiInfo->getMainForm() is NULL"; - } - } else { - qWarning() << "uiInfo is NULL"; - return; + for (int index = 0; index < list.count(); index++) { + delete hwKeyShortcutMap.value(list.at(index)); + hwKeyShortcutMap.remove(list.at(index)); } - qDebug() << "Set keyboard shortcut HwKeys."; - for (int index = 0; index < hwKeyList.count(); index++) { - HardwareKey *hwKey = hwKeyList.at(index); - if (hwKey) { - if (!hwKey->getKeySequence().isEmpty()) { - QShortcut *shortcut = new QShortcut( - QKeySequence::fromString(hwKey->getKeySequence()), parent); - registShortcutKey(shortcut, hwKey->getName()); - - hwKeyShortcutList.append(shortcut); - hwKeyShortcutMap.insert(hwKey->getName(), hwKey->getKeySequence()); - } - } else { - qDebug() << "hwKeyList.at(" << index << ") is NULL"; - } - } + qDebug() << hwKeyShortcutMap.count() << "shortcuts have been registered"; } +// TODO: move to context menu class void KeyboardShortcut::slotShortcutHostKeyboard() { - QAction *action = parent->getPopupMenu()->keyboardGroup->checkedAction(); - QList keyboardStatusList = parent->getPopupMenu()->keyboardGroup->actions(); + QAction *action = win->getPopupMenu()->keyboardGroup->checkedAction(); + QList keyboardStatusList = win->getPopupMenu()->keyboardGroup->actions(); if (!action) { qWarning() << "HostKeyboard enable/disable failed"; @@ -181,71 +109,17 @@ void KeyboardShortcut::slotShortcutHostKeyboard() keyboardStatusList.at(index)->setChecked(true); } -int KeyboardShortcut::getHwKeyCode(QString item) -{ - int index = 0, keyCode = 0; - - for (index = 0; index < hwKeyList.count(); index++) { - if (hwKeyList.at(index)->getName().compare(item) == 0) { - keyCode = hwKeyList.at(index)-> - getKeycodeType()->getShortPressKeycode(); - break; - } - } - - if (index == hwKeyList.count()) { - for (index = 0; index < controllerKeyList.count(); index++) { - if (controllerKeyList.at(index)->getName().compare(item) == 0) { - keyCode = controllerKeyList.at(index)-> - getKeycodeType()->getShortPressKeycode(); - break; - } - } - - if (index == controllerKeyList.count()) { - qWarning() << item << "is not exist in KeyList"; - } - } - - return keyCode; -} - -void KeyboardShortcut::doHwKeyEvent(int keyCode) +void KeyboardShortcut::slotHwKeyShortcut(int keycode) { - do_hw_key_event(KEY_PRESSED, keyCode); - do_hw_key_event(KEY_RELEASED, keyCode); -} + qDebug() << "shortcut: \"HW key\"" << keycode; -void KeyboardShortcut::slotShortcutHwKey(const QString &name) -{ - int keyCode = getHwKeyCode(name); - doHwKeyEvent(keyCode); -} - -QList KeyboardShortcut::getControllerShortcutList() -{ - return controllerShortcutList; -} - -QList KeyboardShortcut::getHwKeyShortcutList() -{ - return hwKeyShortcutList; -} - -QMap KeyboardShortcut::getHwKeyShortcutMap() -{ - return hwKeyShortcutMap; -} - -QMap KeyboardShortcut::getControllerShortcutMap() -{ - return controllerShortcutMap; + do_hw_key_event(KEY_PRESSED, keycode); + do_hw_key_event(KEY_RELEASED, keycode); } KeyboardShortcut::~KeyboardShortcut() { - removeHwKeyShortcut(); - removeControllerShortcut(); - qDebug("destroy keyboard shortcut"); + + hwKeyShortcutMap.clear(); } diff --git a/tizen/src/ui/input/keyboardshortcut.h b/tizen/src/ui/input/keyboardshortcut.h index 39544874e1..bd7902b266 100644 --- a/tizen/src/ui/input/keyboardshortcut.h +++ b/tizen/src/ui/input/keyboardshortcut.h @@ -31,9 +31,7 @@ #ifndef KEYBOARDSHORTCUT_H #define KEYBOARDSHORTCUT_H -#include -#include -#include +#include #include "layout/hardwarekey.h" @@ -47,32 +45,19 @@ public: KeyboardShortcut(QWidget *parent = 0); ~KeyboardShortcut(); - void setKeyboardShortcutHwKey(); - void setKeyboardShortcutController(); - void removeControllerShortcut(); - void removeHwKeyShortcut(); - - QList getControllerShortcutList(); - QList getHwKeyShortcutList(); - QMap getHwKeyShortcutMap(); - QMap getControllerShortcutMap(); + void registerHwKeyShortcuts(QList list); + void cancelHwKeyShortcuts(QList list); + QMap getHwKeyShortcutMap(); public slots: - void slotShortcutHwKey(const QString &name); + void slotHwKeyShortcut(int keycode); void slotShortcutHostKeyboard(); private: - void registShortcutKey(QShortcut *shortcut, QString item); - int getHwKeyCode(QString item); - void doHwKeyEvent(int keyCode); + MainWindow *win; + QSignalMapper *mapper; - MainWindow *parent; - QList hwKeyList; - QList controllerKeyList; - QList controllerShortcutList; - QList hwKeyShortcutList; - QMap hwKeyShortcutMap; - QMap controllerShortcutMap; + QMap hwKeyShortcutMap; }; #endif // KEYBOARDSHORTCUT_H diff --git a/tizen/src/ui/layout/hardwarekey.cpp b/tizen/src/ui/layout/hardwarekey.cpp index 6020a8ddcd..b09e86f59e 100644 --- a/tizen/src/ui/layout/hardwarekey.cpp +++ b/tizen/src/ui/layout/hardwarekey.cpp @@ -30,7 +30,7 @@ #include "hardwarekey.h" HardwareKey::HardwareKey(QString name, KeycodeType *keycodeType, - QRect region, QString tooltip, QString keySequence) + QRect region, QString tooltip, QKeySequence keySequence) { this->name = name; this->keycodeType = keycodeType; @@ -53,6 +53,11 @@ KeycodeType *HardwareKey::getKeycodeType() return keycodeType; } +int HardwareKey::getKeycode() +{ + return getKeycodeType()->getShortPressKeycode(); +} + bool HardwareKey::hasLongPressKeycode() { return (keycodeType->getLongPressKeycode() > 0); @@ -68,7 +73,7 @@ QString HardwareKey::getTooltip() return tooltip; } -QString HardwareKey::getKeySequence() +QKeySequence HardwareKey::getKeySequence() { return keySequence; } diff --git a/tizen/src/ui/layout/hardwarekey.h b/tizen/src/ui/layout/hardwarekey.h index 451dc173df..9d0531b01e 100644 --- a/tizen/src/ui/layout/hardwarekey.h +++ b/tizen/src/ui/layout/hardwarekey.h @@ -38,22 +38,23 @@ class HardwareKey { public: HardwareKey(QString name, KeycodeType *keycodeType, - QRect region, QString tooltip, QString keySequence); + QRect region, QString tooltip, QKeySequence keySequence); ~HardwareKey(); QString getName(); KeycodeType *getKeycodeType(); + int getKeycode(); bool hasLongPressKeycode(); QRect getRegion(); QString getTooltip(); - QString getKeySequence(); + QKeySequence getKeySequence(); private: QString name; KeycodeType *keycodeType; QRect region; QString tooltip; - QString keySequence; + QKeySequence keySequence; }; #endif // HARDWAREKEY_H diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index a70c8957f5..24189fe323 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -99,7 +99,6 @@ MainWindow::MainWindow(UIInformation *uiInfo, QWidget *parent) : /* set HW Key shortcut */ keyboardShortcut = new KeyboardShortcut(this); - keyboardShortcut->setKeyboardShortcutHwKey(); /* popup menu */ popupMenu = new ContextMenu(this); @@ -267,13 +266,14 @@ void MainWindow::openController(int index, int dockPos) return; } + getUIState()->conState.conFormIndex = index; + QAction *action = NULL; if (popupMenu != NULL && popupMenu->getControllerMapper() != NULL) { action = (QAction *)popupMenu->getControllerMapper()->mapping(index); + qDebug() << "open controller:" << action->text(); } - getUIState()->conState.conFormIndex = index; - /* create */ if (dockPos == -1) { getUIState()->conState.floatingCon = @@ -293,6 +293,9 @@ void MainWindow::openController(int index, int dockPos) #endif } + /* register controller's HW key shortcuts */ + keyboardShortcut->registerHwKeyShortcuts(conForm->keyList); + /* update layout */ resize(uiInfo->getUiSize()); @@ -315,9 +318,6 @@ void MainWindow::openController(int index, int dockPos) * So, we need an additional updating for display. */ display->update(); - /* set controller shortcut */ - keyboardShortcut->setKeyboardShortcutController(); - #ifdef CONFIG_LINUX popupMenu->slotTopMost(getUIState()->isOnTop()); #endif @@ -328,6 +328,9 @@ void MainWindow::closeController() if (getDockingCon() != NULL) { qDebug("close docking controller"); + /* cancel controller's HW key shortcuts */ + keyboardShortcut->cancelHwKeyShortcuts( + getDockingCon()->getConForm()->keyList); getDockingCon()->close(); getUIState()->conState.dockingCon = NULL; @@ -339,6 +342,10 @@ void MainWindow::closeController() qDebug("close floating controller"); getUIState()->conState.recentlyFloatPos = getFloatingCon()->pos(); + + /* cancel controller's HW key shortcuts */ + keyboardShortcut->cancelHwKeyShortcuts( + getFloatingCon()->getConForm()->keyList); getFloatingCon()->close(); getUIState()->conState.floatingCon = NULL; @@ -347,9 +354,6 @@ void MainWindow::closeController() /* Some part of QGLWidget's surface might be lost on Windows when view changing. * So, we need an additional updating for display. */ display->update(); - - /* remove controller shortcut */ - keyboardShortcut->removeControllerShortcut(); } /* override */ @@ -399,11 +403,17 @@ void MainWindow::updateDisplayMatrix() void MainWindow::switchForm(int index) { - qDebug("window switch : %d", index); + qDebug("window switch: %d", index); + + /* cancel HW key shortcuts */ + keyboardShortcut->cancelHwKeyShortcuts(uiInfo->getMainForm()->keyList); /* layout switching */ getUIState()->mainFormIndex = index; + /* register new HW key shortcuts */ + keyboardShortcut->registerHwKeyShortcuts(uiInfo->getMainForm()->keyList); + updateDisplayMatrix(); if (getDockingCon() != NULL) { @@ -427,7 +437,7 @@ void MainWindow::switchForm(int index) void MainWindow::scaleForm(int scale) { - qDebug("window scale : %d", scale); + qDebug("window scale: %d", scale); /* scale changing */ getUIState()->mainFormScale = scale; diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 2ba7dca17f..2df49680aa 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -646,11 +646,6 @@ void ContextMenu::slotSwitch(int index) } else { qDebug() << "Display is not ready."; } - - /* reset HwKey shortcut */ - KeyboardShortcut *keyboardShortcut = parent->getKeyboardShortcut(); - keyboardShortcut->removeHwKeyShortcut(); - keyboardShortcut->setKeyboardShortcutHwKey(); } void ContextMenu::slotSwitchShortcutPrev() @@ -845,10 +840,11 @@ void ContextMenu::slotConShortcutNext() } QAction *nextAction = conActions.at(index); + qDebug() << "shortcut next:" << controllerMenu->title() << + '<' << nextAction->text(); + nextAction->setChecked(true); nextAction->trigger(); - - qDebug() << "shortcut: next" << controllerMenu->title() << nextAction->text(); } void ContextMenu::slotShell() diff --git a/tizen/src/ui/menu/detailedinfodialog.cpp b/tizen/src/ui/menu/detailedinfodialog.cpp index 8ca07ea6a4..0299444907 100644 --- a/tizen/src/ui/menu/detailedinfodialog.cpp +++ b/tizen/src/ui/menu/detailedinfodialog.cpp @@ -202,18 +202,26 @@ void DetailedInfoDialog::updateShortcutTableItems() /* insert menu shortcut info */ insertMenuShortcutInfo(win->uiInfo->menuList); - setShortcutInfoTable(keyboardShortcut->getHwKeyShortcutMap(), - keyboardShortcut->getHwKeyShortcutList()); - setShortcutInfoTable(keyboardShortcut->getControllerShortcutMap(), - keyboardShortcut->getControllerShortcutList()); + // TODO: consider getHwKeyShortcutMap() + /* insert HW key shortcut info */ + insertHwKeyShortcutInfo(win->uiInfo->getMainForm()->keyList); + + /* insert Controller's HW key shortcut info */ + ControllerForm *conForm = win->uiInfo->getConForm(); + if (conForm != NULL) { + insertHwKeyShortcutInfo(win->uiInfo->getConForm()->keyList, + QString(" (controller)")); + } qDebug() << shortcutInfoTable->rowCount() << "shortcut items have been inserted"; } void DetailedInfoDialog::insertMenuShortcutInfo(QList list) { + MenuItem *item = NULL; + for (int i = 0; i < list.count(); i++) { - MenuItem *item = list.at(i); + item = list.at(i); if (item != NULL) { if (item->getType() == MenuItemType::separator) { /* do nothing */ @@ -242,26 +250,18 @@ void DetailedInfoDialog::insertMenuShortcutInfo(QList list) } } -void DetailedInfoDialog::setShortcutInfoTable( - const QMap& map, const QList& list) +void DetailedInfoDialog::insertHwKeyShortcutInfo( + QList list, QString source) { - QMap::const_iterator mapIter = map.constBegin(); + HardwareKey *hwKey = NULL; - for (int index = 0; index < list.count(); index++) { - while (mapIter != map.constEnd()) { - if (mapIter.value() == list.at(index)->key().toString()) { -#ifdef CONFIG_DARWIN - QString value = mapIter.value(); - value.replace("Ctrl", "Cmd"); - insertTableRow(shortcutInfoTable, mapIter.key(), value); -#else - insertTableRow(shortcutInfoTable, mapIter.key(), mapIter.value()); -#endif - break; - } - ++mapIter; + for (int i = 0; i < list.count(); i++) { + hwKey = list.at(i); + if (hwKey && hwKey->getKeySequence().isEmpty() == false && + hwKey->getName().isEmpty() == false) { + insertTableRow(shortcutInfoTable, + hwKey->getName() + source, hwKey->getKeySequence().toString()); } - mapIter = map.constBegin(); } } @@ -305,8 +305,7 @@ void DetailedInfoDialog::resizeTableToContents(QTableWidget *table) resize(tWidth, tHeight); - shortcutInfoTable->resizeColumnsToContents(); - vmInfoTable->resizeColumnsToContents(); + table->resizeColumnsToContents(); } void DetailedInfoDialog::insertTableRow(QTableWidget *table, diff --git a/tizen/src/ui/menu/detailedinfodialog.h b/tizen/src/ui/menu/detailedinfodialog.h index fb0946ec22..7e718dc912 100644 --- a/tizen/src/ui/menu/detailedinfodialog.h +++ b/tizen/src/ui/menu/detailedinfodialog.h @@ -45,15 +45,6 @@ public: ~DetailedInfoDialog(); void updateShortcutTableItems(); - void insertMenuShortcutInfo(QList list); - - void setShortcutInfoTable(const QMap& map, - const QList& list); - void insertTableRow(QTableWidget *table, const QString& key, - const QString& value, const QString& tooltip); - void insertTableRow(QTableWidget *table, const QString& key, - const QString& value); - void removeTableRows(QTableWidget *table, int startIndex, int lastIndex); public slots: void slotCellOpen(int nRow, int nCol); @@ -67,6 +58,15 @@ private: QTableWidget *createShortcutInfoTable(); void resizeTableToContents(QTableWidget *table); + void insertTableRow(QTableWidget *table, const QString& key, + const QString& value, const QString& tooltip); + void insertTableRow(QTableWidget *table, const QString& key, + const QString& value); + void removeTableRows(QTableWidget *table, int startIndex, int lastIndex); + + void insertMenuShortcutInfo(QList list); + void insertHwKeyShortcutInfo(QList list, QString source = ""); + MainWindow *win; QVBoxLayout *baseLayout; QHBoxLayout *upsideLayout; diff --git a/tizen/src/ui/skinkeyitem.cpp b/tizen/src/ui/skinkeyitem.cpp index 3e7c6f8651..241c27ca91 100644 --- a/tizen/src/ui/skinkeyitem.cpp +++ b/tizen/src/ui/skinkeyitem.cpp @@ -75,7 +75,7 @@ void SkinKeyItem::mousePressEvent(QGraphicsSceneMouseEvent *event) return; } - const int keycode = hwKey->getKeycodeType()->getShortPressKeycode(); + const int keycode = hwKey->getKeycode(); qDebug() << hwKey->getName() << "key pressed:" << keycode; do_hw_key_event(KEY_PRESSED, keycode); @@ -89,7 +89,7 @@ void SkinKeyItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { bezelParent->setHWKeyHandling(isPressed = false); - int keycode = hwKey->getKeycodeType()->getShortPressKeycode(); + int keycode = hwKey->getKeycode(); if (hwKey->hasLongPressKeycode() == true) { if (longPressTimer->remainingTime() <= 0) { diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index 119e82c894..32547c5e84 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -73,7 +73,7 @@ MainForm *UIInformation::getMainForm() if (index > (mainFormList.count() - 1) || index < 0) { qWarning("invalid form found"); - uiState.mainFormIndex = 0; + index = uiState.mainFormIndex = 0; } return mainFormList.at(index); @@ -91,7 +91,7 @@ ControllerForm *UIInformation::getConForm() if (index > (conFormList.count() - 1) || index < 0) { qWarning("invalid form found"); - uiState.conState.conFormIndex = 0; + return NULL; } return conFormList.at(index); diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index c884cbcb66..b8b324b8a9 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -176,7 +176,7 @@ HardwareKey *XmlLayoutParser::parseKey(QXmlStreamReader &xml) QRect keyRegion; KeycodeType *keycodeType = NULL; QString keyTooptip; - QString keySequence; + QKeySequence keySequence; /* attribute */ QString keyName = xml.attributes().value(NAME_ATTR_KEYWORD).toString(); @@ -198,7 +198,7 @@ HardwareKey *XmlLayoutParser::parseKey(QXmlStreamReader &xml) keyTooptip = xml.readElementText(); } else if (xml.name() == SHORTCUT_KEYWORD) { /* shortcut */ - keySequence = xml.readElementText(); + keySequence = QKeySequence::fromString(xml.readElementText()); } } @@ -356,7 +356,7 @@ int XmlLayoutParser::parseFactorList( return map.count(); } -int XmlLayoutParser::parseShortcut( +int XmlLayoutParser::parseShortcuts( QXmlStreamReader &xml, QMap &map) { QString key = xml.attributes().value(PROP_ATTR_KEYWORD).toString(); @@ -378,7 +378,7 @@ AdvancedMenuItem *XmlLayoutParser::parseAdvancedMenuItem(QXmlStreamReader &xml) { if (token == QXmlStreamReader::StartElement) { if (xml.name() == SHORTCUT_KEYWORD) { - parseShortcut(xml, item->getShortcutMap()); + parseShortcuts(xml, item->getShortcutMap()); } else if (xml.name() == MENULIST_KEYWORD) { int cnt = parseMenuList(xml, item->getMenuList()); qDebug("- advanced menuList : %d", cnt); @@ -404,7 +404,7 @@ ScaleMenuItem *XmlLayoutParser::parseScaleMenuItem(QXmlStreamReader &xml) { if (token == QXmlStreamReader::StartElement) { if (xml.name() == SHORTCUT_KEYWORD) { - parseShortcut(xml, item->getShortcutMap()); + parseShortcuts(xml, item->getShortcutMap()); } else if (xml.name() == FACTORLIST_KEYWORD) { int defaultFactor = 0; int cnt = parseFactorList(xml, item->getFactorMap(), &defaultFactor); @@ -437,7 +437,7 @@ MenuItem *XmlLayoutParser::parseGeneralMenuItem( { if (token == QXmlStreamReader::StartElement) { if (xml.name() == SHORTCUT_KEYWORD) { - parseShortcut(xml, item->getShortcutMap()); + parseShortcuts(xml, item->getShortcutMap()); } } diff --git a/tizen/src/ui/xmllayoutparser.h b/tizen/src/ui/xmllayoutparser.h index bf7cd1cbef..7cb3ac0881 100644 --- a/tizen/src/ui/xmllayoutparser.h +++ b/tizen/src/ui/xmllayoutparser.h @@ -61,7 +61,7 @@ private: int parseMainFormList(QXmlStreamReader &xml, QList &list); int parseFactorList(QXmlStreamReader &xml, QMap &map, int *defaultFactor); - int parseShortcut(QXmlStreamReader &xml, QMap &map); + int parseShortcuts(QXmlStreamReader &xml, QMap &map); AdvancedMenuItem *parseAdvancedMenuItem(QXmlStreamReader &xml); ScaleMenuItem *parseScaleMenuItem(QXmlStreamReader &xml); MenuItem *parseGeneralMenuItem(QXmlStreamReader &xml, int menuType);