KeySequence: remove unnecessary function and etc
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 10 Nov 2015 11:36:02 +0000 (20:36 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 11 Nov 2015 07:39:38 +0000 (16:39 +0900)
- remove unnecessary function
- modify some variable names

Change-Id: Ia9988078c47a2d934d1aacb845b1100df168d7b3
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/input/keyboardshortcut.cpp
tizen/src/ui/input/keyboardshortcut.h
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/detailedinfodialog.cpp
tizen/src/ui/menu/menuitem.cpp
tizen/src/ui/menu/menuitem.h
tizen/src/ui/skinview.cpp
tizen/src/ui/xmllayoutparser.cpp

index c683677c891a53c3a04c57c00cb5853d7e6e371c..8e2b52b1e0d4ef08b6b867e62164148216c111cc 100644 (file)
@@ -80,35 +80,6 @@ void KeyboardShortcut::cancelHwKeyShortcuts(QList<HardwareKey *> &list)
     qDebug() << hwKeyShortcutMap.count() << "shortcuts have been registered";
 }
 
-// TODO: move to context menu class
-void KeyboardShortcut::slotShortcutHostKeyboard()
-{
-    QAction *action = win->getPopupMenu()->keyboardGroup->checkedAction();
-    QList<QAction *> keyboardStatusList = win->getPopupMenu()->keyboardGroup->actions();
-
-    if (!action) {
-        qWarning() << "HostKeyboard enable/disable failed";
-        return;
-    }
-
-    int index = 0;
-    if (action->text().contains(MENU_ON_ITEM_TEXT)) {
-        for (index = 0; index < keyboardStatusList.count(); index++) {
-            if (keyboardStatusList.at(index)->text().contains(MENU_OFF_ITEM_TEXT)) {
-                break;
-            }
-        }
-    } else {
-        for (index = 0; index < keyboardStatusList.count(); index++) {
-            if (keyboardStatusList.at(index)->text().contains(MENU_ON_ITEM_TEXT)) {
-                break;
-            }
-        }
-    }
-
-    keyboardStatusList.at(index)->setChecked(true);
-}
-
 void KeyboardShortcut::slotHwKeyShortcut(int keycode)
 {
     qDebug() << "shortcut: \"HW key\"" << keycode;
index e17d9f25fd5021afb29c79d0be945af9fe1373fc..35e98b5851c3ee1ab5a1d5f1931d5ceaa94e05aa 100644 (file)
@@ -51,7 +51,6 @@ public:
 
 public slots:
     void slotHwKeyShortcut(int keycode);
-    void slotShortcutHostKeyboard();
 
 private:
     MainWindow *win;
index 098e0a7e09d6df4398744d45f66726e5c6c42a6a..e8dcb37210df7cc401571d46c3c119adbd1ac7f6 100644 (file)
@@ -189,8 +189,8 @@ void ContextMenu::createInfoItem(QMenu *menu, MenuItem *item)
     actionDetailedInfo = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/detailed_info.png")),
         menuName.isEmpty() ? vmName : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotDetailedInfo()));
 
     actionDetailedInfo->setIconText(menuName.isEmpty() ? QString(DETAILED_INFO_TITLE) : menuName);
@@ -214,9 +214,9 @@ void ContextMenu::createOnTopItem(QMenu *menu, MenuItem *item)
     connect(actionTopMost, SIGNAL(triggered(bool)), this, SLOT(slotTopMost(bool)));
 
     /* shortcut */
-    if (item->getShortcutMap().isEmpty() == false) {
+    if (item->getShortcuts().isEmpty() == false) {
         QShortcut *shortcut = new QShortcut(
-            item->getShortcutMap().begin().value(), parent);
+            item->getShortcuts().begin().value(), parent);
         connect(shortcut, SIGNAL(activated()), this, SLOT(slotTopMostShortcut()));
 
         actionTopMost->setShortcut(shortcut->key());
@@ -238,12 +238,9 @@ void ContextMenu::createMoveItem(QMenu *menu, MenuItem *item)
     connect(actionMove, SIGNAL(triggered()), this, SLOT(slotMove()));
 
     /* shortcut */
-    QMap<QString, QKeySequence> shortcutMap = item->getShortcutMap();
-    QShortcut *shortcut = NULL;
-
-    if (shortcutMap.isEmpty() == false) {
-        shortcut = new QShortcut(
-            item->getShortcutMap().begin().value(), parent);
+    if (item->getShortcuts().isEmpty() == false) {
+        QShortcut *shortcut = new QShortcut(
+            item->getShortcuts().begin().value(), parent);
         connect(shortcut, SIGNAL(activated()), this, SLOT(slotMove()));
 
         actionMove->setShortcut(shortcut->key());
@@ -271,17 +268,17 @@ void ContextMenu::createSwitchItem(QMenu *menu, MenuItem *item)
 
         /* shortcuts */
         QAction *switchAction = switchMenu->menuAction();
-        QMap<QString, QKeySequence> shortcutMap = item->getShortcutMap();
+        QMap<QString, QKeySequence> shortcuts = item->getShortcuts();
 
-        if (shortcutMap.isEmpty() == false) {
+        if (shortcuts.isEmpty() == false) {
             QMap<QString, QKeySequence>::const_iterator iter;
-            if ((iter = shortcutMap.find("prev")) != shortcutMap.end()) {
+            if ((iter = shortcuts.find("prev")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(iter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotSwitchShortcutPrev()));
 
                 switchAction->setShortcut(shortcut->key());
             }
-            if ((iter = shortcutMap.find("next")) != shortcutMap.end()) {
+            if ((iter = shortcuts.find("next")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(iter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotSwitchShortcutNext()));
 
@@ -290,7 +287,7 @@ void ContextMenu::createSwitchItem(QMenu *menu, MenuItem *item)
 
             if (switchAction->shortcut().isEmpty() == true) {
                 QShortcut *shortcut = new QShortcut(
-                    item->getShortcutMap().begin().value(), parent);
+                    item->getShortcuts().begin().value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotSwitchShortcutNext()));
 
                 switchAction->setShortcut(shortcut->key());
@@ -335,17 +332,17 @@ void ContextMenu::createScaleItem(QMenu *menu, MenuItem *item)
 
         /* shortcuts */
         QAction *scaleAction = scaleMenu->menuAction();
-        QMap<QString, QKeySequence> shortcutMap = item->getShortcutMap();
+        QMap<QString, QKeySequence> shortcuts = item->getShortcuts();
 
-        if (shortcutMap.isEmpty() == false) {
+        if (shortcuts.isEmpty() == false) {
             QMap<QString, QKeySequence>::const_iterator shortcutIter;
-            if ((shortcutIter = shortcutMap.find("prev")) != shortcutMap.end()) {
+            if ((shortcutIter = shortcuts.find("prev")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(shortcutIter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotScaleShortcutPrev()));
 
                 scaleAction->setShortcut(shortcut->key());
             }
-            if ((shortcutIter = shortcutMap.find("next")) != shortcutMap.end()) {
+            if ((shortcutIter = shortcuts.find("next")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(shortcutIter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotScaleShortcutNext()));
 
@@ -354,7 +351,7 @@ void ContextMenu::createScaleItem(QMenu *menu, MenuItem *item)
 
             if (scaleAction->shortcut().isEmpty() == true) {
                 QShortcut *shortcut = new QShortcut(
-                    item->getShortcutMap().begin().value(), parent);
+                    item->getShortcuts().begin().value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotScaleShortcutNext()));
 
                 scaleAction->setShortcut(shortcut->key());
@@ -408,17 +405,17 @@ void ContextMenu::createControllerItem(QMenu *menu, MenuItem *item)
 
         /* shortcuts */
         QAction *conAction = controllerMenu->menuAction();
-        QMap<QString, QKeySequence> shortcutMap = item->getShortcutMap();
+        QMap<QString, QKeySequence> shortcuts = item->getShortcuts();
 
-        if (shortcutMap.isEmpty() == false) {
+        if (shortcuts.isEmpty() == false) {
             QMap<QString, QKeySequence>::const_iterator iter;
-            if ((iter = shortcutMap.find("prev")) != shortcutMap.end()) {
+            if ((iter = shortcuts.find("prev")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(iter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotConShortcutPrev()));
 
                 conAction->setShortcut(shortcut->key());
             }
-            if ((iter = shortcutMap.find("next")) != shortcutMap.end()) {
+            if ((iter = shortcuts.find("next")) != shortcuts.end()) {
                 QShortcut *shortcut = new QShortcut(iter.value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotConShortcutNext()));
 
@@ -427,7 +424,7 @@ void ContextMenu::createControllerItem(QMenu *menu, MenuItem *item)
 
             if (conAction->shortcut().isEmpty() == true) {
                 QShortcut *shortcut = new QShortcut(
-                    item->getShortcutMap().begin().value(), parent);
+                    item->getShortcuts().begin().value(), parent);
                 connect(shortcut, SIGNAL(activated()), this, SLOT(slotConShortcutNext()));
 
                 conAction->setShortcut(shortcut->key());
@@ -492,8 +489,8 @@ void ContextMenu::createShellItem(QMenu *menu, MenuItem *item)
     actionShell = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/shell.png")),
         menuName.isEmpty() ? MENU_SHELL_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotShell()));
 
     item->setAction(actionShell);
@@ -509,8 +506,8 @@ void ContextMenu::createControlPanelItem(QMenu *menu, MenuItem *item)
     actionControlPanel = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/control_panel.png")),
         menuName.isEmpty() ? MENU_ECP_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotControlPanel()));
 
     item->setAction(actionControlPanel);
@@ -526,8 +523,8 @@ void ContextMenu::createScreenShotItem(QMenu *menu, MenuItem *item)
     actionScreenShot = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/screen_shot.png")),
         menuName.isEmpty() ? MENU_SCREENSHOT_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotRequestScreenshot()));
 
     item->setAction(actionScreenShot);
@@ -543,8 +540,8 @@ void ContextMenu::createAboutItem(QMenu *menu, MenuItem *item)
     actionAbout = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/about.png")),
         menuName.isEmpty() ? MENU_ABOUT_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotAbout()));
 
     item->setAction(actionAbout);
@@ -560,8 +557,8 @@ void ContextMenu::createForceCloseItem(QMenu *menu, MenuItem *item)
     actionForceClose = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/force_close.png")),
         menuName.isEmpty() ? MENU_FORCECLOSE_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotForceClose()));
 
     item->setAction(actionForceClose);
@@ -577,8 +574,8 @@ void ContextMenu::createCloseItem(QMenu *menu, MenuItem *item)
     actionClose = addGeneralAction(
         menu, QIcon(QPixmap(":/icons/close.png")),
         menuName.isEmpty() ? MENU_CLOSE_ITEM_TEXT : menuName,
-        item->getShortcutMap().isEmpty()? NULL :
-            new QShortcut(item->getShortcutMap().begin().value(), parent),
+        item->getShortcuts().isEmpty()? NULL :
+            new QShortcut(item->getShortcuts().begin().value(), parent),
         SLOT(slotClose()));
 
     item->setAction(actionClose);
index 07641e9baedcaa2f4afaadd80d51c38fe1e66468..909bc56f13783e0533fe795eeb18dc15bf58b0b1 100644 (file)
@@ -269,10 +269,10 @@ void DetailedInfoDialog::insertMenuShortcutInfo(QList<MenuItem *> &list)
                 AdvancedMenuItem *advItem = (AdvancedMenuItem *)item;
                 insertMenuShortcutInfo(advItem->getMenuList());
             } else if (item->getAction() != NULL &&
-                item->getShortcutMap().isEmpty() == false) {
+                item->getShortcuts().isEmpty() == false) {
 
-                QMap<QString, QKeySequence>::iterator iter = item->getShortcutMap().begin();
-                for ( ; iter != item->getShortcutMap().end(); iter++) {
+                QMap<QString, QKeySequence>::iterator iter = item->getShortcuts().begin();
+                for ( ; iter != item->getShortcuts().end(); iter++) {
                     QString function = item->getAction()->iconText().isEmpty() ?
                         item->getAction()->text() : item->getAction()->iconText();
                     function += " " + iter.key();
index 097d9de327bcac6f5945ecb030f3079dacef7a06..d8b2326e604c45c865d7f22d252b4e7d71be8933 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "menuitem.h"
 
-MenuItem::MenuItem(int type, QString name)
+MenuItem::MenuItem(int type, const QString &name)
 {
     this->type = type;
     this->name = name;
@@ -46,9 +46,9 @@ QString MenuItem::getName()
     return name;
 }
 
-QMap<QString, QKeySequence> &MenuItem::getShortcutMap()
+QMap<QString, QKeySequence> &MenuItem::getShortcuts()
 {
-    return shortcutMap;
+    return shortcuts;
 }
 
 void MenuItem::setAction(QAction *action)
index 30f7fec3e2d17b3e3db19bab5ee306b40d456f2e..d271700c3b73a36291926a3a4dc3f984df1e0ea2 100644 (file)
@@ -58,19 +58,19 @@ namespace MenuItemType
 class MenuItem
 {
 public:
-    MenuItem(int type, QString name);
+    MenuItem(int type, const QString &name);
     virtual ~MenuItem();
 
     int getType();
     QString getName();
-    QMap<QString, QKeySequence> &getShortcutMap();
+    QMap<QString, QKeySequence> &getShortcuts();
     void setAction(QAction *action);
     QAction *getAction();
 
 private:
     int type;
     QString name;
-    QMap<QString, QKeySequence> shortcutMap;
+    QMap<QString, QKeySequence> shortcuts;
     QAction *action;
 };
 
index 079c5fbc4ca7d7605a7757993bcdef8080b6077a..4208156653bd33520ddde48dd165c1e54c24edb6 100644 (file)
@@ -38,7 +38,8 @@ SkinView::SkinView(QWidget *parent, QGraphicsScene *scene) :
     this->grabPos = QPoint(-1, -1);
 
     /* note: do not call setStyleSheet() separately for each style */
-    setStyleSheet("border-style: none; " + QString(STYLE_TOOLTIP));
+    setStyleSheet("QGraphicsView { border-style: none; }" +
+        QString(STYLE_TOOLTIP));
 
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
index 88789681c4698e8c91a3dcb460599db2fc988429..a7c841909e03866cf2c4d504379a98a947b40487 100644 (file)
@@ -391,7 +391,7 @@ AdvancedMenuItem *XmlLayoutParser::parseAdvancedMenuItem(QXmlStreamReader &xml)
     {
         if (token == QXmlStreamReader::StartElement) {
             if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcuts(xml, item->getShortcutMap());
+                parseShortcuts(xml, item->getShortcuts());
             } else if (xml.name() == MENULIST_KEYWORD) {
                 int cnt = parseMenuList(xml, item->getMenuList());
                 qDebug("- advanced menuList: %d", cnt);
@@ -419,7 +419,7 @@ ScaleMenuItem *XmlLayoutParser::parseScaleMenuItem(QXmlStreamReader &xml)
     {
         if (token == QXmlStreamReader::StartElement) {
             if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcuts(xml, item->getShortcutMap());
+                parseShortcuts(xml, item->getShortcuts());
             } else if (xml.name() == FACTORLIST_KEYWORD) {
                 int defaultFactor = 0;
                 int cnt = parseFactorList(xml, item->getFactorMap(), &defaultFactor);
@@ -454,7 +454,7 @@ MenuItem *XmlLayoutParser::parseGeneralMenuItem(
     {
         if (token == QXmlStreamReader::StartElement) {
             if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcuts(xml, item->getShortcutMap());
+                parseShortcuts(xml, item->getShortcuts());
             } else {
                 qWarning() << "undefined element:" << xml.name();
             }