shortcut: refactoring for HW key shortcut
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 19 Aug 2015 11:58:42 +0000 (20:58 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 20 Aug 2015 14:10:20 +0000 (23:10 +0900)
- 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 <giwoong.kim@samsung.com>
18 files changed:
tizen/src/ui/controller/dockingcontroller.cpp
tizen/src/ui/controller/dockingcontroller.h
tizen/src/ui/controller/floatingcontroller.cpp
tizen/src/ui/controller/floatingcontroller.h
tizen/src/ui/controller/generalpurposecon.cpp
tizen/src/ui/controller/hwkeybutton.cpp
tizen/src/ui/input/keyboardshortcut.cpp
tizen/src/ui/input/keyboardshortcut.h
tizen/src/ui/layout/hardwarekey.cpp
tizen/src/ui/layout/hardwarekey.h
tizen/src/ui/mainwindow.cpp
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/detailedinfodialog.cpp
tizen/src/ui/menu/detailedinfodialog.h
tizen/src/ui/skinkeyitem.cpp
tizen/src/ui/uiinformation.cpp
tizen/src/ui/xmllayoutparser.cpp
tizen/src/ui/xmllayoutparser.h

index 2cf3419..7e6051e 100644 (file)
@@ -47,6 +47,11 @@ DockingController::DockingController(ControllerForm *conForm,
     conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
 }
 
+ControllerForm *DockingController::getConForm()
+{
+    return conForm;
+}
+
 DockingConView *DockingController::getConView()
 {
     return conView;
index f0c0e04..cd16730 100644 (file)
@@ -46,6 +46,7 @@ public:
         QAction *menu, int dockPos, QWidget *parent = 0);
     ~DockingController();
 
+    ControllerForm *getConForm();
     DockingConView *getConView();
     int getDockPos();
     void updateGeometry();
index a26ee12..ace2b18 100644 (file)
@@ -54,6 +54,11 @@ FloatingController::FloatingController(ControllerForm *conForm,
     layout->addWidget(conView);
 }
 
+ControllerForm *FloatingController::getConForm()
+{
+    return conForm;
+}
+
 FloatingConView *FloatingController::getConView()
 {
     return conView;
index f8a6634..25c9121 100644 (file)
@@ -43,6 +43,7 @@ public:
     explicit FloatingController(ControllerForm *conForm, QAction *menu, QWidget *parent = 0);
     ~FloatingController();
 
+    ControllerForm *getConForm();
     FloatingConView *getConView();
 
 protected:
index bd35c3d..7eb99a6 100644 (file)
@@ -62,8 +62,8 @@ void GeneralPurposeCon::createItems(QList<HardwareKey *> 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);
index c3ca9bc..0bf298b 100644 (file)
@@ -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);
index c3baebe..934cc49 100644 (file)
@@ -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<HardwareKey *, QShortcut *> 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<HardwareKey *> 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<HardwareKey *> 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<QAction *> keyboardStatusList = parent->getPopupMenu()->keyboardGroup->actions();
+    QAction *action = win->getPopupMenu()->keyboardGroup->checkedAction();
+    QList<QAction *> 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<QShortcut *> KeyboardShortcut::getControllerShortcutList()
-{
-    return controllerShortcutList;
-}
-
-QList<QShortcut *> KeyboardShortcut::getHwKeyShortcutList()
-{
-    return hwKeyShortcutList;
-}
-
-QMap<QString, QString> KeyboardShortcut::getHwKeyShortcutMap()
-{
-    return hwKeyShortcutMap;
-}
-
-QMap<QString, QString> 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();
 }
index 3954487..bd7902b 100644 (file)
@@ -31,9 +31,7 @@
 #ifndef KEYBOARDSHORTCUT_H
 #define KEYBOARDSHORTCUT_H
 
-#include <QObject>
-#include <QShortcut>
-#include <QMap>
+#include <QtWidgets>
 
 #include "layout/hardwarekey.h"
 
@@ -47,32 +45,19 @@ public:
     KeyboardShortcut(QWidget *parent = 0);
     ~KeyboardShortcut();
 
-    void setKeyboardShortcutHwKey();
-    void setKeyboardShortcutController();
-    void removeControllerShortcut();
-    void removeHwKeyShortcut();
-
-    QList<QShortcut *> getControllerShortcutList();
-    QList<QShortcut *> getHwKeyShortcutList();
-    QMap<QString, QString> getHwKeyShortcutMap();
-    QMap<QString, QString> getControllerShortcutMap();
+    void registerHwKeyShortcuts(QList<HardwareKey *> list);
+    void cancelHwKeyShortcuts(QList<HardwareKey *> list);
+    QMap<HardwareKey *, QShortcut *> 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<HardwareKey *> hwKeyList;
-    QList<HardwareKey *> controllerKeyList;
-    QList<QShortcut *> controllerShortcutList;
-    QList<QShortcut *> hwKeyShortcutList;
-    QMap<QString, QString> hwKeyShortcutMap;
-    QMap<QString, QString> controllerShortcutMap;
+    QMap<HardwareKey *, QShortcut *> hwKeyShortcutMap;
 };
 
 #endif // KEYBOARDSHORTCUT_H
index 6020a8d..b09e86f 100644 (file)
@@ -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;
 }
index 451dc17..9d0531b 100644 (file)
@@ -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
index a70c895..24189fe 100644 (file)
@@ -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;
index 2ba7dca..2df4968 100644 (file)
@@ -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()
index 8ca07ea..0299444 100644 (file)
@@ -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<MenuItem *> 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<MenuItem *> list)
     }
 }
 
-void DetailedInfoDialog::setShortcutInfoTable(
-    const QMap<QString, QString>& map, const QList<QShortcut *>& list)
+void DetailedInfoDialog::insertHwKeyShortcutInfo(
+    QList<HardwareKey *> list, QString source)
 {
-    QMap<QString, QString>::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,
index fb0946e..7e718dc 100644 (file)
@@ -45,15 +45,6 @@ public:
     ~DetailedInfoDialog();
 
     void updateShortcutTableItems();
-    void insertMenuShortcutInfo(QList<MenuItem *> list);
-
-    void setShortcutInfoTable(const QMap<QString, QString>& map,
-            const QList<QShortcut *>& 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<MenuItem *> list);
+    void insertHwKeyShortcutInfo(QList<HardwareKey *> list, QString source = "");
+
     MainWindow *win;
     QVBoxLayout *baseLayout;
     QHBoxLayout *upsideLayout;
index 3e7c6f8..241c27c 100644 (file)
@@ -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) {
index 119e82c..32547c5 100644 (file)
@@ -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);
index c884cbc..b8b324b 100644 (file)
@@ -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<QString, QKeySequence> &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());
             }
         }
 
index bf7cd1c..7cb3ac0 100644 (file)
@@ -61,7 +61,7 @@ private:
     int parseMainFormList(QXmlStreamReader &xml, QList<MainForm *> &list);
 
     int parseFactorList(QXmlStreamReader &xml, QMap<int, QString> &map, int *defaultFactor);
-    int parseShortcut(QXmlStreamReader &xml, QMap<QString, QKeySequence> &map);
+    int parseShortcuts(QXmlStreamReader &xml, QMap<QString, QKeySequence> &map);
     AdvancedMenuItem *parseAdvancedMenuItem(QXmlStreamReader &xml);
     ScaleMenuItem *parseScaleMenuItem(QXmlStreamReader &xml);
     MenuItem *parseGeneralMenuItem(QXmlStreamReader &xml, int menuType);