menu: modified shortcut info table on Detailed Info dialog
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 25 Sep 2015 07:20:51 +0000 (16:20 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 30 Sep 2015 05:42:47 +0000 (14:42 +0900)
Short-cut key information table has been separated into two parts.
One is a Menu short-cut table, the other is HW key short-cut table.

Change-Id: I8232cec0e77e6374dd43cc597ad4b5de3ed7a36a
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/menu/detailedinfodialog.cpp
tizen/src/ui/menu/detailedinfodialog.h

index 29a13fac18d45772e335f7e3ae53ee4537d5dce8..b0f0504db664c48b98041b257d4b73e8d67a0f02 100644 (file)
@@ -66,14 +66,21 @@ DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) :
 
     /* tab */
     tabWidget = new QTabWidget(this);
+    {
+        /* VM information table */
+        vmInfoTable = createVmInfoTable();
+        tabWidget->addTab(vmInfoTable, tr(DETAILED_INFO_VMTAB_TITLE));
 
-    /* VM information table */
-    vmInfoTable = createVmInfoTable();
-    tabWidget->addTab(vmInfoTable, tr(DETAILED_INFO_VMTAB_TITLE));
+        /* shortcut information table */
+        QTabWidget *shortcutTab = new QTabWidget(tabWidget);
 
-    /* shortcut info table */
-    shortcutInfoTable = createShortcutInfoTable();
-    tabWidget->addTab(shortcutInfoTable, tr(DETAILED_INFO_SHORTCUTTAB_TITLE));
+        menuShortcutTable = createShortcutInfoTable();
+        shortcutTab->addTab(menuShortcutTable, "Menu");
+        keyShortcutTable = createShortcutInfoTable();
+        shortcutTab->addTab(keyShortcutTable, "HW Key");
+
+        tabWidget->addTab(shortcutTab, DETAILED_INFO_SHORTCUTTAB_TITLE);
+    }
     upsideLayout->addWidget(tabWidget);
 
     baseLayout->addLayout(upsideLayout);
@@ -205,24 +212,40 @@ QTableWidget *DetailedInfoDialog::createShortcutInfoTable()
 
 void DetailedInfoDialog::updateShortcutTableItems()
 {
-    qDebug() << "clear" << shortcutInfoTable->rowCount() << "shortcut items";
-    removeTableRows(shortcutInfoTable, 0, shortcutInfoTable->rowCount());
-
     /* insert menu shortcut info */
-    insertMenuShortcutInfo(win->getUiInfo()->getMenuList());
+    {
+        qDebug() << "clear" <<
+            menuShortcutTable->rowCount() << "menu shortcut items";
+        removeTableRows(menuShortcutTable, 0, menuShortcutTable->rowCount());
 
-    // TODO: consider getHwKeyShortcutMap()
-    /* insert HW key shortcut info */
-    insertHwKeyShortcutInfo(win->getUiInfo()->getMainForm()->getKeyList());
+        insertMenuShortcutInfo(win->getUiInfo()->getMenuList());
 
-    /* insert Controller's HW key shortcut info */
-    ControllerForm *conForm = win->getUiInfo()->getConForm();
-    if (conForm != NULL) {
-        insertHwKeyShortcutInfo(win->getUiInfo()->getConForm()->getKeyList(),
-            QString(" (controller)"));
+        menuShortcutTable->resizeColumnsToContents();
+        qDebug() << menuShortcutTable->rowCount() <<
+            "menu shortcut items have been inserted";
     }
 
-    qDebug() << shortcutInfoTable->rowCount() << "shortcut items have been inserted";
+    /* insert HW key shortcut info */
+    {
+        qDebug() << "clear" <<
+            keyShortcutTable->rowCount() << "key shortcut items";
+        removeTableRows(keyShortcutTable, 0, keyShortcutTable->rowCount());
+
+        // TODO: consider getHwKeyShortcutMap()
+        insertHwKeyShortcutInfo(
+            win->getUiInfo()->getMainForm()->getKeyList());
+
+        ControllerForm *conForm = win->getUiInfo()->getConForm();
+        if (conForm != NULL) {
+            insertHwKeyShortcutInfo(
+                win->getUiInfo()->getConForm()->getKeyList(),
+                QString(" (controller)"));
+        }
+
+        keyShortcutTable->resizeColumnsToContents();
+        qDebug() << keyShortcutTable->rowCount() <<
+            "key shortcut items have been inserted";
+    }
 }
 
 void DetailedInfoDialog::insertMenuShortcutInfo(QList<MenuItem *> &list)
@@ -252,7 +275,7 @@ void DetailedInfoDialog::insertMenuShortcutInfo(QList<MenuItem *> &list)
                     keySequence.replace("Ctrl", "Cmd");
 #endif
 
-                    insertTableRow(shortcutInfoTable, function, keySequence);
+                    insertTableRow(menuShortcutTable, function, keySequence);
                 }
             }
         }
@@ -268,7 +291,7 @@ void DetailedInfoDialog::insertHwKeyShortcutInfo(
         hwKey = list.at(i);
         if (hwKey && hwKey->getKeySequence().isEmpty() == false &&
             hwKey->getName().isEmpty() == false) {
-            insertTableRow(shortcutInfoTable,
+            insertTableRow(keyShortcutTable,
                 hwKey->getName() + source, hwKey->getKeySequence().toString());
         }
     }
index e06dbf0e105ee07a94c417cd0dc93199fa4560a7..031609fa8c7c62aa561dc63e5128e200b9648a37 100644 (file)
@@ -65,7 +65,8 @@ private:
     void removeTableRows(QTableWidget *table, int startIndex, int lastIndex);
 
     void insertMenuShortcutInfo(QList<MenuItem *> &list);
-    void insertHwKeyShortcutInfo(QList<HardwareKey *> &list, QString source = "");
+    void insertHwKeyShortcutInfo(
+        QList<HardwareKey *> &list, QString source = "");
 
     MainWindow *win;
     QVBoxLayout *baseLayout;
@@ -74,7 +75,8 @@ private:
 
     QTabWidget *tabWidget;
     QTableWidget *vmInfoTable;
-    QTableWidget *shortcutInfoTable;
+    QTableWidget *menuShortcutTable;
+    QTableWidget *keyShortcutTable;
     KeyboardShortcut *keyboardShortcut;
 };