input: moved keyboard source code files
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 22 Apr 2015 05:55:06 +0000 (14:55 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Thu, 30 Apr 2015 09:48:36 +0000 (18:48 +0900)
tizen/src/ui/keyboardhelper.cpp -> tizensrc/ui/input/keyboardhelper.cpp
tizen/src/ui/keyboardshortcut.cpp -> tizen/src/ui/input/keyboardshortcut.cpp

Change-Id: I6bbde2b114b72b0df8ff086c4927e737be13f376
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
14 files changed:
tizen/src/ui/Makefile.objs
tizen/src/ui/input/Makefile.objs [new file with mode: 0644]
tizen/src/ui/input/keyboardhelper.cpp [new file with mode: 0644]
tizen/src/ui/input/keyboardhelper.h [new file with mode: 0644]
tizen/src/ui/input/keyboardshortcut.cpp [new file with mode: 0644]
tizen/src/ui/input/keyboardshortcut.h [new file with mode: 0644]
tizen/src/ui/keyboardhelper.cpp [deleted file]
tizen/src/ui/keyboardhelper.h [deleted file]
tizen/src/ui/keyboardshortcut.cpp [deleted file]
tizen/src/ui/keyboardshortcut.h [deleted file]
tizen/src/ui/mainwindow.h
tizen/src/ui/menu/contextmenu.h
tizen/src/ui/menu/detailedinfodialog.h
tizen/src/ui/skinview.h

index 499efb643acac52aca4a3f6fc83ed90a69036baa..d792f54c8fe3d1500f72c45038be4b5d8a9007d3 100644 (file)
@@ -17,8 +17,6 @@ obj-$(CONFIG_QT) += displaytype.o
 obj-$(CONFIG_QT) += hovertype.o
 obj-$(CONFIG_QT) += layoutform.o
 obj-$(CONFIG_QT) += mainform.o
-obj-$(CONFIG_QT) += keyboardhelper.o
-obj-$(CONFIG_QT) += keyboardshortcut.o moc_keyboardshortcut.o
 obj-$(CONFIG_QT) += skinview.o
 obj-$(CONFIG_QT) += skinpainter.o
 obj-$(CONFIG_QT) += uiinformation.o
@@ -27,6 +25,7 @@ obj-$(CONFIG_QT) += uiutil.o
 obj-$(CONFIG_QT) += qrc_resource.o
 
 obj-$(CONFIG_QT) += controller/
+obj-$(CONFIG_QT) += input/
 obj-$(CONFIG_QT) += menu/
 
 $(obj)/moc_displayglwidget.o: $(obj)/moc_displayglwidget.cpp
@@ -41,6 +40,3 @@ $(obj)/moc_mainwindow.cpp: $(obj)/mainwindow.h
 $(obj)/moc_skinkeyitem.o: $(obj)/moc_skinkeyitem.cpp
 $(obj)/moc_skinkeyitem.cpp: $(obj)/skinkeyitem.h
        moc $< -o $@
-$(obj)/moc_keyboardshortcut.o: $(obj)/moc_keyboardshortcut.cpp
-$(obj)/moc_keyboardshortcut.cpp: $(obj)/keyboardshortcut.h
-       moc $< -o $@
diff --git a/tizen/src/ui/input/Makefile.objs b/tizen/src/ui/input/Makefile.objs
new file mode 100644 (file)
index 0000000..315eb09
--- /dev/null
@@ -0,0 +1,6 @@
+obj-$(CONFIG_QT) += keyboardhelper.o
+obj-$(CONFIG_QT) += keyboardshortcut.o moc_keyboardshortcut.o
+
+$(obj)/moc_keyboardshortcut.o: $(obj)/moc_keyboardshortcut.cpp
+$(obj)/moc_keyboardshortcut.cpp: $(obj)/keyboardshortcut.h
+       moc $< -o $@
\ No newline at end of file
diff --git a/tizen/src/ui/input/keyboardhelper.cpp b/tizen/src/ui/input/keyboardhelper.cpp
new file mode 100644 (file)
index 0000000..8f126d9
--- /dev/null
@@ -0,0 +1,475 @@
+/*
+ * Qt keyboard helper
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sungmin Ha <sungmin82.ha@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <QtWidgets>
+
+#include "keyboardhelper.h"
+
+extern "C" {
+#include "emul_state.h"
+#include "skin/maruskin_operation.h"
+
+void virtio_keyboard_event(int keycode);
+}
+
+KeyboardHelper::KeyboardHelper()
+{
+    createKeyMap();
+    createKeypadMap();
+
+    this->numLockState = false;
+    this->capsLockState = false;
+}
+
+void KeyboardHelper::createKeypadMap()
+{
+    keypadMap.insert(48, Qt::Key_Insert);
+    keypadMap.insert(49, Qt::Key_End);
+    keypadMap.insert(50, Qt::Key_Down);
+    keypadMap.insert(51, Qt::Key_PageDown);
+    keypadMap.insert(52, Qt::Key_Left);
+    keypadMap.insert(53, Qt::Key_Clear);
+    keypadMap.insert(54, Qt::Key_Right);
+    keypadMap.insert(55, Qt::Key_Home);
+    keypadMap.insert(56, Qt::Key_Up);
+    keypadMap.insert(57, Qt::Key_PageUp);
+    keypadMap.insert(46, Qt::Key_Delete);
+    keypadMap.insert(42, 106);  /* * */
+    keypadMap.insert(45, 109);  /* - */
+
+    keypadMap.insert(Qt::Key_Insert, 48);
+    keypadMap.insert(Qt::Key_End, 49);
+    keypadMap.insert(Qt::Key_Down, 50);
+    keypadMap.insert(Qt::Key_PageDown, 51);
+    keypadMap.insert(Qt::Key_Left, 52);
+    keypadMap.insert(Qt::Key_Clear, 53);
+    keypadMap.insert(Qt::Key_Right, 54);
+    keypadMap.insert(Qt::Key_Home, 55);
+    keypadMap.insert(Qt::Key_Up, 56);
+    keypadMap.insert(Qt::Key_PageUp, 57);
+    keypadMap.insert(Qt::Key_Delete, 46);
+}
+
+void KeyboardHelper::createKeyMap()
+{
+    /* characters */
+    /* q ~ p */
+    keyMap.insert(81, 16);
+    keyMap.insert(87, 17);
+    keyMap.insert(69, 18);
+    keyMap.insert(82, 19);
+    keyMap.insert(84, 20);
+    keyMap.insert(89, 21);
+    keyMap.insert(85, 22);
+    keyMap.insert(73, 23);
+    keyMap.insert(79, 24);
+    keyMap.insert(80, 25);
+
+    /* a ~ l */
+    keyMap.insert(65, 30);
+    keyMap.insert(83, 31);
+    keyMap.insert(68, 32);
+    keyMap.insert(70, 33);
+    keyMap.insert(71, 34);
+    keyMap.insert(72, 35);
+    keyMap.insert(74, 36);
+    keyMap.insert(75, 37);
+    keyMap.insert(76, 38);
+
+    /* z ~ m */
+    keyMap.insert(90, 44);
+    keyMap.insert(88, 45);
+    keyMap.insert(67, 46);
+    keyMap.insert(86, 47);
+    keyMap.insert(66, 48);
+    keyMap.insert(78, 49);
+    keyMap.insert(77, 50);
+
+    /* signs */
+    keyMap.insert(32, 57); /* space */
+    keyMap.insert(44, 51); /* , */
+    keyMap.insert(46, 52); /* . */
+    keyMap.insert(59, 39); /* ; */
+    keyMap.insert(47, 53); /* / */
+    keyMap.insert(42, 55); /* * */
+    keyMap.insert(106, 55); /* * */
+    keyMap.insert(45, 12); /* - */
+    keyMap.insert(109, 74); /* - */
+    keyMap.insert(61, 13); /* = */
+    keyMap.insert(91, 26); /* [ */
+    keyMap.insert(93, 27); /* ] */
+    keyMap.insert(92, 43); /* \ */
+    keyMap.insert(43, 78); /* + */
+    keyMap.insert(39, 40); /* Single quote */
+    keyMap.insert(96, 41); /* ` */
+
+    /* special keys */
+    keyMap.insert(Qt::Key_Return, 28); /* return */
+    keyMap.insert(Qt::Key_Enter, 28); /* enter */
+    keyMap.insert(Qt::Key_Escape, 1); /* escape */
+    keyMap.insert(Qt::Key_Tab, 15); /* tab */
+    keyMap.insert(Qt::Key_Backtab, 15); /* shift tab */
+    keyMap.insert(Qt::Key_Backspace, 14); /* backspace */
+    keyMap.insert(Qt::Key_Pause, 198); /* pause/break */
+    keyMap.insert(Qt::Key_PageUp, 73); /* PgUp */
+    keyMap.insert(Qt::Key_PageDown, 81); /* PgDn */
+    keyMap.insert(Qt::Key_Home, 71); /* Home */
+    keyMap.insert(Qt::Key_End, 79); /* End */
+    keyMap.insert(Qt::Key_Insert, 82); /* Insert */
+    keyMap.insert(Qt::Key_Delete, 83); /* delete */
+
+    /* arrow keys */
+    keyMap.insert(Qt::Key_Up, 72); /* up arrow */
+    keyMap.insert(Qt::Key_Down, 80); /* down arrow */
+    keyMap.insert(Qt::Key_Left, 75); /* left arrow */
+    keyMap.insert(Qt::Key_Right, 77); /* right arrow */
+
+    /* modifiers */
+    keyMap.insert(Qt::Key_Shift, 42); /* shift */
+    keyMap.insert(Qt::Key_Control, 29); /* ctrl */
+    keyMap.insert(Qt::Key_Alt, 56); /* alt */
+
+    /* numbers */
+    keyMap.insert(48, 11); /* 0 */
+    keyMap.insert(49, 2);  /* 1 */
+    keyMap.insert(50, 3);  /* 2 */
+    keyMap.insert(51, 4);  /* 3 */
+    keyMap.insert(52, 5);  /* 4 */
+    keyMap.insert(53, 6);  /* 5 */
+    keyMap.insert(54, 7);  /* 6 */
+    keyMap.insert(55, 8);  /* 7 */
+    keyMap.insert(56, 9);  /* 8 */
+    keyMap.insert(57, 10); /* 9 */
+
+    /* shift + numbers */
+    keyMap.insert(126, 41); /* ~ */
+    keyMap.insert(33, 2); /* ! */
+    keyMap.insert(64, 3); /* @ */
+    keyMap.insert(35, 4); /* # */
+    keyMap.insert(36, 5); /* $ */
+    keyMap.insert(37, 6); /* % */
+    keyMap.insert(94, 7); /* ^ */
+    keyMap.insert(38, 8); /* & */
+    keyMap.insert(40, 10); /* ( */
+    keyMap.insert(41, 11); /* ) */
+
+    /* shift + signs */
+    keyMap.insert(95, 12); /* _ */
+    keyMap.insert(124, 43); /* | */
+    keyMap.insert(123, 26); /* { */
+    keyMap.insert(125, 27); /* } */
+    keyMap.insert(58, 39); /* : */
+    keyMap.insert(34, 40); /* " */
+    keyMap.insert(60, 51); /* < */
+    keyMap.insert(62, 52); /* > */
+    keyMap.insert(63, 53); /* ? */
+
+    /* function keys */
+    keyMap.insert(Qt::Key_F1, 59); /* f1 */
+    keyMap.insert(Qt::Key_F2, 60); /* f2 */
+    keyMap.insert(Qt::Key_F3, 61); /* f3 */
+    keyMap.insert(Qt::Key_F4, 62); /* f4 */
+    keyMap.insert(Qt::Key_F5, 63); /* f5 */
+    keyMap.insert(Qt::Key_F6, 64); /* f6 */
+    keyMap.insert(Qt::Key_F7, 65); /* f7 */
+    keyMap.insert(Qt::Key_F8, 66); /* f8 */
+    keyMap.insert(Qt::Key_F9, 67); /* f9 */
+    keyMap.insert(Qt::Key_F10, 68); /* f10 */
+    keyMap.insert(Qt::Key_F11, 87); /* f11 */
+    keyMap.insert(Qt::Key_F12, 88); /* f12 */
+}
+
+void KeyboardHelper::autoKeyRelease(void)
+{
+    while (!keyCodeList.isEmpty()) {
+        qDebug() << "auto release scancode : " << keyCodeList.last();
+
+        do_qt_keyboard_key_event(KEY_RELEASED, keyCodeList.last());
+        keyCodeList.removeLast();
+    }
+
+#if 0
+    clear_finger_slot(false);
+    qDebug() << "disable multi-touch";
+#endif
+}
+
+int KeyboardHelper::keyCodeOperation(QKeyEvent *event, int keyCode)
+{
+    /* keypad and specialKey translation */
+    if (!numLockState && (event->modifiers() == (Qt::KeypadModifier | Qt::ShiftModifier))) {
+        QMap<int, int>::iterator keypadIter = keypadMap.find(keyCode);
+        while (keypadIter != keypadMap.end()) {
+            if (keypadIter.key() == keyCode) {
+                keyCode = keypadIter.value();
+                break;
+            }
+        }
+    }
+
+    if (isSpecialKey(keyCode)) {
+        virtio_keyboard_event(224);
+    }
+
+    QMap<int, int>::iterator keyMapIter = keyMap.find(keyCode);
+    while (keyMapIter != keyMap.end()) {
+        if (keyMapIter.key() == keyCode) {
+            break;
+        }
+    }
+
+    if (keyMapIter == keyMap.end()) {
+        qWarning() << "unsupported keycode pressed : " << keyCode;
+        return -1;
+    }
+
+    return keyMapIter.value();
+}
+
+bool KeyboardHelper::isSpecialKey(int keyCode)
+{
+    switch(keyCode) {
+        case Qt::Key_PageDown:
+        case Qt::Key_PageUp:
+        case Qt::Key_Home:
+        case Qt::Key_End:
+        case Qt::Key_Insert:
+        case Qt::Key_Delete:
+        case Qt::Key_Up:
+        case Qt::Key_Down:
+        case Qt::Key_Left:
+        case Qt::Key_Right:
+            return true;
+        default:
+            break;
+    }
+
+    return false;
+}
+
+void KeyboardHelper::keyPressed(QKeyEvent *event)
+{
+    int keyCode = event->key();
+    qDebug() << "key pressed :" << event->key() << event->text() <<
+        event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
+
+#if 0
+    /* TODO: multi-touch */
+    if (get_emul_max_touch_point() > 1) {
+        /* multi-touch checking */
+        if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
+            get_emul_multi_touch_state()->multitouch_enable = 2;
+            /* add a finger before start the multi-touch processing
+            if already exist the pressed touch in display */
+
+            qDebug() << "enable multi-touch = mode 2";
+        } else if (event->modifiers() == Qt::ShiftModifier ||
+            event->modifiers() == Qt::ControlModifier) {
+            get_emul_multi_touch_state()->multitouch_enable = 1;
+
+            qDebug() << "enable multi-touch = mode 1";
+        }
+    }
+#endif
+
+    /* NumLock or CapsLock key */
+    if (keyCode == Qt::Key_NumLock) {
+#ifdef CONFIG_WIN32
+        if (event->nativeModifiers() == 0x1000200) {
+            numLockState = ON;
+        } else if (event->nativeModifiers() == 0x1000000) {
+            numLockState = OFF;
+        }
+#else
+        if (event->nativeModifiers() == 0) {
+            numLockState = ON;
+        } else if (event->nativeModifiers() == 16) {
+            numLockState = OFF;
+        }
+#endif
+        qDebug() << "num_lock state : " << numLockState << "pressed";
+        return;
+    } else if (keyCode == Qt::Key_CapsLock) {
+#ifdef CONFIG_WIN32
+        if (event->nativeModifiers() == 256) {
+            capsLockState = ON;
+        } else if (event->nativeModifiers() == 0) {
+            capsLockState = OFF;
+        }
+#else
+        if (event->nativeModifiers() == 18) {
+            capsLockState = ON;
+        } else if (event->nativeModifiers() == 16) {
+            capsLockState = OFF;
+        }
+#endif
+        qDebug() << "caps_lock state : " << capsLockState << "pressed";
+        return;
+    }
+
+    /* host NumLock check for sync */
+    if ((event->modifiers() & Qt::KeypadModifier)) {
+        if (isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
+            if (!(event->modifiers() & Qt::ShiftModifier)) {
+                numLockState = OFF;
+            } else {
+                numLockState = ON;
+            }
+        } else {
+            if (!((event->modifiers() & Qt::ShiftModifier) ||
+                keyCode == 42 || keyCode == 43 || keyCode == 45 || keyCode == 47))
+            { /* (42 = *, 43 = +, 45 = -, 47 = /) on keypad */
+                numLockState = ON;
+            } else {
+                numLockState = OFF;
+            }
+        }
+    }
+
+    if (event->key() >= 65 && event->key() <= 90) {
+#ifdef CONFIG_WIN32
+        if (event->nativeModifiers() & 256) {
+#else
+        if (event->nativeModifiers() & 0x02) {
+#endif
+            capsLockState = ON;
+        } else {
+            capsLockState = OFF;
+        }
+    }
+
+    if (get_emul_caps_lock_state() != capsLockState) {
+        virtio_keyboard_event(58);
+        virtio_keyboard_event(58 | 0x80);
+        set_emul_caps_lock_state(get_emul_caps_lock_state() ^ 1);
+
+        qDebug() << "qemu CapsLock state was synchronized with host key value (" <<
+            get_emul_caps_lock_state() << ")";
+    }
+    if (get_emul_num_lock_state() != numLockState) {
+        virtio_keyboard_event(69);
+        virtio_keyboard_event(69 | 0x80);
+        set_emul_num_lock_state(get_emul_num_lock_state() ^ 1);
+
+        qDebug() << "qemu NumLock state was synchronized with host key value (" <<
+            get_emul_num_lock_state() << ")";
+    }
+
+    int ret = keyCodeOperation(event, keyCode);
+    if (ret != -1) {
+        /* for auto release */
+        keyCodeList.append(ret);
+        do_qt_keyboard_key_event(KEY_PRESSED, ret);
+    }
+}
+
+void KeyboardHelper::keyReleased(QKeyEvent *event)
+{
+    int keyCode = event->key();
+    qDebug() << "key released :" <<  event->key() << event->text() <<
+        event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
+
+#if 0
+    /* TODO: multi-touch */
+    if (event->key() == Qt::Key_Shift && event->modifiers() == Qt::ControlModifier) {
+        get_emul_multi_touch_state()->multitouch_enable = 1;
+
+        qDebug() << "enabled multi-touch = mode 1";
+    } else if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control) {
+        clear_finger_slot(false);
+
+        qDebug() << "disable multi-touch";
+    }
+#endif
+
+    if (keyCode == Qt::Key_NumLock) {
+        qDebug() << "num_lock state : " << numLockState << "released";
+        return;
+    } else if (keyCode == Qt::Key_CapsLock) {
+        qDebug() << "caps_lock state : " << capsLockState << "released";
+        return;
+    }
+
+#ifdef CONFIG_LINUX
+    /* for keypad keycode translation */
+    if (numLockState && event->modifiers() == Qt::KeypadModifier) {
+        if (isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
+            switch(keyCode) {
+                case Qt::Key_Delete:
+                    keyCode = 46; /* . */
+                    break;
+                case Qt::Key_Insert:
+                    keyCode = 48; /* 0 */
+                    break;
+                case Qt::Key_End:
+                    keyCode = 49; /* 1 */
+                    break;
+                case Qt::Key_Down:
+                    keyCode = 50; /* 2 */
+                    break;
+                case Qt::Key_PageDown:
+                    keyCode = 51; /* 3 */
+                    break;
+                case Qt::Key_Left:
+                    keyCode = 52; /* 4 */
+                    break;
+                case Qt::Key_Clear:
+                    keyCode = 53; /* 5 */
+                    break;
+                case Qt::Key_Right:
+                    keyCode = 54; /* 6 */
+                    break;
+                case Qt::Key_Home:
+                    keyCode = 55; /* 7 */
+                    break;
+                case Qt::Key_Up:
+                    keyCode = 56; /* 8 */
+                    break;
+                case Qt::Key_PageUp:
+                    keyCode = 57; /* 9 */
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+#endif
+
+    int ret = keyCodeOperation(event, keyCode);
+    if (ret != -1) {
+        do_qt_keyboard_key_event(KEY_RELEASED, ret);
+        /* remove keycode from list */
+        keyCodeList.removeOne(ret);
+    }
+}
+
+KeyboardHelper::~KeyboardHelper()
+{
+    qDebug("destroy keyboard helper");
+}
diff --git a/tizen/src/ui/input/keyboardhelper.h b/tizen/src/ui/input/keyboardhelper.h
new file mode 100644 (file)
index 0000000..7eef329
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Qt keyboard helper
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sungmin Ha <sungmin82.ha@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef KEYBOARDHELPER_H
+#define KEYBOARDHELPER_H
+
+#include <QMap>
+
+enum KbdLedState {
+    OFF,
+    ON
+};
+
+class KeyboardHelper
+{
+public:
+    KeyboardHelper();
+    ~KeyboardHelper();
+
+    void keyPressed(QKeyEvent *event);
+    void keyReleased(QKeyEvent *event);
+    void autoKeyRelease(void);
+    bool isSpecialKey(int keyCode);
+    int keyCodeOperation(QKeyEvent *event, int keyCode);
+
+protected:
+    QList<int> keyCodeList;
+    QMap<int, int> keyMap;
+    QMap<int, int> keypadMap;
+    bool numLockState;
+    bool capsLockState;
+
+private:
+    void createKeyMap();
+    void createKeypadMap();
+};
+
+#endif // KEYBOARDHELPER_H
diff --git a/tizen/src/ui/input/keyboardshortcut.cpp b/tizen/src/ui/input/keyboardshortcut.cpp
new file mode 100644 (file)
index 0000000..d7555f6
--- /dev/null
@@ -0,0 +1,447 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sungmin Ha <sungmin82.ha@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "keyboardshortcut.h"
+#include "mainwindow.h"
+
+KeyboardShortcut::KeyboardShortcut(QWidget *parent) : QWidget(parent)
+{
+    this->parent = (MainWindow *)parent;
+    this->hide();
+}
+
+void KeyboardShortcut::removeControllerShortcut()
+{
+    for (int index = 0; index < controllerShortcutList.count(); index++) {
+        delete controllerShortcutList.at(index);
+    }
+
+    controllerShortcutList.clear();
+    controllerShortcutMap.clear();
+
+    qDebug() << "Removed controller shortcuts";
+}
+
+void KeyboardShortcut::removeHwKeyShortcut()
+{
+    for (int index = 0; index < hwKeyShortcutList.count(); index++) {
+        delete hwKeyShortcutList.at(index);
+    }
+
+    hwKeyShortcutList.clear();
+    hwKeyShortcutMap.clear();
+
+    qDebug() << "Removed hwKey shortcuts";
+}
+
+void KeyboardShortcut::registShortcutKey(QShortcut *shortcut, QString item)
+{
+    QSignalMapper *mapper = new QSignalMapper(this);
+    if (!mapper || !shortcut) {
+        qDebug() << "regist HwKey shortcut failed.";
+        return;
+    }
+
+    connect(shortcut, SIGNAL(activated()), mapper, SLOT(map()));
+    mapper->setMapping(shortcut, item);
+    connect(mapper, SIGNAL(mapped(const QString &)), this, SLOT(slotShortcutHwKey(const QString &)));
+}
+
+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->keySequence.isEmpty()) {
+                QShortcut *shortcut = new QShortcut(QKeySequence::fromString(controllerKey->keySequence), parent);
+                registShortcutKey(shortcut, controllerKey->name);
+
+                controllerShortcutList.append(shortcut);
+                controllerShortcutMap.insert(controllerKey->name, controllerKey->keySequence);
+            }
+        } else {
+            qDebug() << "controllerKeyList.at(" << index << ") is NULL";
+        }
+    }
+}
+
+void KeyboardShortcut::setKeyboardShortcutHwKey()
+{
+    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;
+    }
+
+    qDebug() << "Set keyboard shortcut HwKeys.";
+    for (int index = 0; index < hwKeyList.count(); index++) {
+        HardwareKey *hwKey = hwKeyList.at(index);
+        if (hwKey) {
+            if (!hwKey->keySequence.isEmpty()) {
+                QShortcut *shortcut = new QShortcut(QKeySequence::fromString(hwKey->keySequence), parent);
+                registShortcutKey(shortcut, hwKey->name);
+
+                hwKeyShortcutList.append(shortcut);
+                hwKeyShortcutMap.insert(hwKey->name, hwKey->keySequence);
+            }
+        } else {
+            qDebug() << "hwKeyList.at(" << index << ") is NULL";
+        }
+    }
+}
+
+void KeyboardShortcut::setKeyboardShortcutContextMenu(MenuItem *item, QString property, QString keySequence)
+{
+    QShortcut *shortcut = new QShortcut(QKeySequence::fromString(keySequence), parent);
+    int itemType = item->getType();
+    QString itemName = item->getName();
+
+    switch (itemType) {
+        case MenuItemType::closeItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutClose()));
+            break;
+        case MenuItemType::infoItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutDetailedInfo()));
+            if (itemName.isEmpty()) {
+                itemName = DETAILED_INFO_TITLE;
+            }
+            break;
+        case MenuItemType::onTopItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutTopMost()));
+            break;
+        case MenuItemType::hostKeyboardItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutHostKeyboard()));
+            break;
+        case MenuItemType::forceCloseItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutForceClose()));
+            break;
+        case MenuItemType::shellItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutShell()));
+            break;
+        case MenuItemType::controlPanelItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutControlPanel()));
+            break;
+        case MenuItemType::screenShotItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutRequestScreenshot()));
+            break;
+        case MenuItemType::controllerItem:
+            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutController()));
+            break;
+        case MenuItemType::scaleItem:
+            if (property == "prev") {
+                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutScalePrev()));
+            } else if (property == "next") {
+                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutScaleNext()));
+            } else {
+                qDebug() << "undefined property: " << property;
+            }
+            break;
+        case MenuItemType::switchItem:
+            if (property == "prev") {
+                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutSwitchPrev()));
+            } else if (property == "next") {
+                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutSwitchNext()));
+            } else {
+                qDebug() << "undefined property: " << property;
+            }
+            break;
+        default:
+            qDebug() << "undefined item type: " << itemType;
+            return;
+    }
+
+    if (!property.isEmpty()) {
+        itemName.append(" " + property);
+    }
+
+    popupMenuShortcutMap.insert(itemName, keySequence);
+}
+
+void KeyboardShortcut::slotShortcutClose()
+{
+    parent->getPopupMenu()->slotClose();
+}
+
+void KeyboardShortcut::slotShortcutDetailedInfo()
+{
+    parent->getPopupMenu()->slotDetailedInfo();
+}
+
+void KeyboardShortcut::slotShortcutShell()
+{
+    parent->getPopupMenu()->slotShell();
+}
+
+void KeyboardShortcut::slotShortcutRequestScreenshot()
+{
+    parent->getPopupMenu()->slotRequestScreenshot();
+}
+
+void KeyboardShortcut::slotShortcutForceClose()
+{
+    parent->getPopupMenu()->slotForceClose();
+}
+
+void KeyboardShortcut::slotShortcutControlPanel()
+{
+    parent->getPopupMenu()->slotControlPanel();
+}
+
+void KeyboardShortcut::slotShortcutTopMost()
+{
+    QAction *action = parent->getPopupMenu()->getActionTopMost();
+    parent->getPopupMenu()->slotTopMost(!action->isChecked());
+}
+
+void KeyboardShortcut::slotShortcutSwitchPrev()
+{
+    QAction *action = parent->getPopupMenu()->switchGroup->checkedAction();
+    QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
+
+    if (!action) {
+        qWarning() << "switch prev failed.";
+        return;
+    }
+
+    int index = switchList.indexOf(action);
+    if (index == switchList.count() - 1) {
+        index = 0;
+    } else {
+        index++;
+    }
+
+    QAction *nextSwitchAction = switchList.at(index);
+    nextSwitchAction->setChecked(true);
+    nextSwitchAction->trigger();
+}
+
+void KeyboardShortcut::slotShortcutSwitchNext()
+{
+    QAction *action = parent->getPopupMenu()->switchGroup->checkedAction();
+    QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
+
+    if (!action) {
+        qWarning() << "switch next failed.";
+        return;
+    }
+
+    int index = switchList.indexOf(action);
+    if (index == 0) {
+        index = switchList.count() - 1;
+    } else {
+        index--;
+    }
+
+    QAction *nextSwitchAction = switchList.at(index);
+    nextSwitchAction->setChecked(true);
+    nextSwitchAction->trigger();
+}
+
+void KeyboardShortcut::slotShortcutScaleNext()
+{
+    QAction *action = parent->getPopupMenu()->scaleGroup->checkedAction();
+    QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
+
+    if (!action) {
+        qWarning() << "scale next failed.";
+        return;
+    }
+
+    int index = scaleList.indexOf(action);
+    if (index == 0) {
+        index = scaleList.count() - 1;
+    } else {
+        index--;
+    }
+
+    QAction *nextScaleAction = scaleList.at(index);
+    nextScaleAction->setChecked(true);
+    nextScaleAction->trigger();
+}
+
+void KeyboardShortcut::slotShortcutScalePrev()
+{
+    QAction *action = parent->getPopupMenu()->scaleGroup->checkedAction();
+    QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
+
+    if (!action) {
+        qWarning() << "scale prev failed.";
+        return;
+    }
+
+    int index = scaleList.indexOf(action);
+    if (index == scaleList.count() - 1) {
+        index = 0;
+    } else {
+        index++;
+    }
+
+    QAction *nextScaleAction = scaleList.at(index);
+    nextScaleAction->setChecked(true);
+    nextScaleAction->trigger();
+}
+
+void KeyboardShortcut::slotShortcutController()
+{
+    QAction *action = parent->getPopupMenu()->controllerGroup->checkedAction();
+    QList<QAction *> controllerList = parent->getPopupMenu()->controllerGroup->actions();
+
+    if (!action) {
+        qWarning() << "change controller failed.";
+        return;
+    }
+
+    int last_index = controllerList.count() - 1;
+    int index = controllerList.indexOf(action) + 1;
+
+    if (index > last_index) {
+        index = 0;
+    }
+
+    QAction *nextControllerAction = controllerList.at(index);
+    if (!nextControllerAction) {
+        qWarning() << "controllerList.at(" << index << ") is NULL";
+        return;
+    }
+
+    nextControllerAction->setChecked(true);
+    nextControllerAction->trigger();
+}
+
+void KeyboardShortcut::slotShortcutHostKeyboard()
+{
+    QAction *action = parent->getPopupMenu()->keyboardGroup->checkedAction();
+    QList<QAction *> keyboardStatusList = parent->getPopupMenu()->keyboardGroup->actions();
+
+    if (!action) {
+        qWarning() << "HostKeyboard enable/disable failed";
+        return;
+    }
+
+    int index = 0;
+    if (action->text().contains(KEYBOARD_ON)) {
+        for (index = 0; index < keyboardStatusList.count(); index++) {
+            if (keyboardStatusList.at(index)->text().contains(KEYBOARD_OFF)) {
+                break;
+            }
+        }
+    } else {
+        for (index = 0; index < keyboardStatusList.count(); index++) {
+            if (keyboardStatusList.at(index)->text().contains(KEYBOARD_ON)) {
+                break;
+            }
+        }
+    }
+
+    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)->name.compare(item) == 0) {
+            keyCode = hwKeyList.at(index)->keycode;
+            break;
+        }
+    }
+
+    if (index == hwKeyList.count()) {
+        qWarning() << item << "is not exist in KeyList";
+    }
+
+    return keyCode;
+}
+
+void KeyboardShortcut::doHwKeyEvent(int keyCode)
+{
+    do_hw_key_event(KEY_PRESSED, keyCode);
+    do_hw_key_event(KEY_RELEASED, keyCode);
+}
+
+void KeyboardShortcut::slotShortcutHwKey(const QString &name)
+{
+    int keyCode = getHwKeyCode(name);
+    doHwKeyEvent(keyCode);
+}
+
+QList<QShortcut *> KeyboardShortcut::getControllerShortcutList()
+{
+    return controllerShortcutList;
+}
+
+QMap<QString, QString> KeyboardShortcut::getPopupMenuShortcutMap()
+{
+    return popupMenuShortcutMap;
+}
+
+QMap<QString, QString> KeyboardShortcut::getHwKeyShortcutMap()
+{
+    return hwKeyShortcutMap;
+}
+
+QMap<QString, QString> KeyboardShortcut::getControllerShortcutMap()
+{
+    return controllerShortcutMap;
+}
+
+KeyboardShortcut::~KeyboardShortcut()
+{
+    qDebug("destroy keyboard shortcut");
+}
diff --git a/tizen/src/ui/input/keyboardshortcut.h b/tizen/src/ui/input/keyboardshortcut.h
new file mode 100644 (file)
index 0000000..353472f
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sungmin Ha <sungmin82.ha@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef KEYBOARDSHORTCUT_H
+#define KEYBOARDSHORTCUT_H
+
+#include <QObject>
+#include <QShortcut>
+#include <QMap>
+
+#include "hardwarekey.h"
+#include "menu/menuitem.h"
+
+class MainWindow;
+
+class KeyboardShortcut : public QWidget
+{
+    Q_OBJECT
+
+public:
+    KeyboardShortcut(QWidget *parent = 0);
+    ~KeyboardShortcut();
+
+    void setKeyboardShortcutHwKey();
+    void setKeyboardShortcutController();
+    void setKeyboardShortcutContextMenu(MenuItem *item, QString property, QString keySequence);
+    void removeControllerShortcut();
+    void removeHwKeyShortcut();
+
+    QList<QShortcut *> getControllerShortcutList();
+    QMap<QString, QString> getPopupMenuShortcutMap();
+    QMap<QString, QString> getHwKeyShortcutMap();
+    QMap<QString, QString> getControllerShortcutMap();
+
+public slots:
+    void slotShortcutHwKey(const QString &name);
+    void slotShortcutClose();
+    void slotShortcutDetailedInfo();
+    void slotShortcutControlPanel();
+    void slotShortcutShell();
+    void slotShortcutRequestScreenshot();
+    void slotShortcutForceClose();
+    void slotShortcutHostKeyboard();
+    void slotShortcutController();
+    void slotShortcutScalePrev();
+    void slotShortcutScaleNext();
+    void slotShortcutSwitchPrev();
+    void slotShortcutSwitchNext();
+    void slotShortcutTopMost();
+
+private:
+    void registShortcutKey(QShortcut *shortcut, QString item);
+    int getHwKeyCode(QString item);
+    void doHwKeyEvent(int keyCode);
+
+    MainWindow *parent;
+    QList<HardwareKey *> hwKeyList;
+    QList<HardwareKey *> controllerKeyList;
+    QList<QShortcut *> controllerShortcutList;
+    QList<QShortcut *> hwKeyShortcutList;
+    QMap<QString, QString> popupMenuShortcutMap;
+    QMap<QString, QString> hwKeyShortcutMap;
+    QMap<QString, QString> controllerShortcutMap;
+};
+
+#endif // KEYBOARDSHORTCUT_H
diff --git a/tizen/src/ui/keyboardhelper.cpp b/tizen/src/ui/keyboardhelper.cpp
deleted file mode 100644 (file)
index 37ac16e..0000000
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Qt keyboard helper
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sungmin Ha <sungmin82.ha@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include <Qt>
-#include <QtWidgets>
-
-#include "keyboardhelper.h"
-
-extern "C" {
-#include "emul_state.h"
-#include "skin/maruskin_operation.h"
-
-void virtio_keyboard_event(int keycode);
-}
-
-KeyboardHelper::KeyboardHelper()
-{
-    createKeyMap();
-    createKeypadMap();
-
-    this->numLockState = false;
-    this->capsLockState = false;
-}
-
-void KeyboardHelper::createKeypadMap()
-{
-    keypadMap.insert(48, Qt::Key_Insert);
-    keypadMap.insert(49, Qt::Key_End);
-    keypadMap.insert(50, Qt::Key_Down);
-    keypadMap.insert(51, Qt::Key_PageDown);
-    keypadMap.insert(52, Qt::Key_Left);
-    keypadMap.insert(53, Qt::Key_Clear);
-    keypadMap.insert(54, Qt::Key_Right);
-    keypadMap.insert(55, Qt::Key_Home);
-    keypadMap.insert(56, Qt::Key_Up);
-    keypadMap.insert(57, Qt::Key_PageUp);
-    keypadMap.insert(46, Qt::Key_Delete);
-    keypadMap.insert(42, 106);  /* * */
-    keypadMap.insert(45, 109);  /* - */
-
-    keypadMap.insert(Qt::Key_Insert, 48);
-    keypadMap.insert(Qt::Key_End, 49);
-    keypadMap.insert(Qt::Key_Down, 50);
-    keypadMap.insert(Qt::Key_PageDown, 51);
-    keypadMap.insert(Qt::Key_Left, 52);
-    keypadMap.insert(Qt::Key_Clear, 53);
-    keypadMap.insert(Qt::Key_Right, 54);
-    keypadMap.insert(Qt::Key_Home, 55);
-    keypadMap.insert(Qt::Key_Up, 56);
-    keypadMap.insert(Qt::Key_PageUp, 57);
-    keypadMap.insert(Qt::Key_Delete, 46);
-}
-
-void KeyboardHelper::createKeyMap()
-{
-    /* characters */
-    /* q ~ p */
-    keyMap.insert(81, 16);
-    keyMap.insert(87, 17);
-    keyMap.insert(69, 18);
-    keyMap.insert(82, 19);
-    keyMap.insert(84, 20);
-    keyMap.insert(89, 21);
-    keyMap.insert(85, 22);
-    keyMap.insert(73, 23);
-    keyMap.insert(79, 24);
-    keyMap.insert(80, 25);
-
-    /* a ~ l */
-    keyMap.insert(65, 30);
-    keyMap.insert(83, 31);
-    keyMap.insert(68, 32);
-    keyMap.insert(70, 33);
-    keyMap.insert(71, 34);
-    keyMap.insert(72, 35);
-    keyMap.insert(74, 36);
-    keyMap.insert(75, 37);
-    keyMap.insert(76, 38);
-
-    /* z ~ m */
-    keyMap.insert(90, 44);
-    keyMap.insert(88, 45);
-    keyMap.insert(67, 46);
-    keyMap.insert(86, 47);
-    keyMap.insert(66, 48);
-    keyMap.insert(78, 49);
-    keyMap.insert(77, 50);
-
-    /* signs */
-    keyMap.insert(32, 57); /* space */
-    keyMap.insert(44, 51); /* , */
-    keyMap.insert(46, 52); /* . */
-    keyMap.insert(59, 39); /* ; */
-    keyMap.insert(47, 53); /* / */
-    keyMap.insert(42, 55); /* * */
-    keyMap.insert(106, 55); /* * */
-    keyMap.insert(45, 12); /* - */
-    keyMap.insert(109, 74); /* - */
-    keyMap.insert(61, 13); /* = */
-    keyMap.insert(91, 26); /* [ */
-    keyMap.insert(93, 27); /* ] */
-    keyMap.insert(92, 43); /* \ */
-    keyMap.insert(43, 78); /* + */
-    keyMap.insert(39, 40); /* Single quote */
-    keyMap.insert(96, 41); /* ` */
-
-    /* special keys */
-    keyMap.insert(Qt::Key_Return, 28); /* return */
-    keyMap.insert(Qt::Key_Enter, 28); /* enter */
-    keyMap.insert(Qt::Key_Escape, 1); /* escape */
-    keyMap.insert(Qt::Key_Tab, 15); /* tab */
-    keyMap.insert(Qt::Key_Backtab, 15); /* shift tab */
-    keyMap.insert(Qt::Key_Backspace, 14); /* backspace */
-    keyMap.insert(Qt::Key_Pause, 198); /* pause/break */
-    keyMap.insert(Qt::Key_PageUp, 73); /* PgUp */
-    keyMap.insert(Qt::Key_PageDown, 81); /* PgDn */
-    keyMap.insert(Qt::Key_Home, 71); /* Home */
-    keyMap.insert(Qt::Key_End, 79); /* End */
-    keyMap.insert(Qt::Key_Insert, 82); /* Insert */
-    keyMap.insert(Qt::Key_Delete, 83); /* delete */
-
-    /* arrow keys */
-    keyMap.insert(Qt::Key_Up, 72); /* up arrow */
-    keyMap.insert(Qt::Key_Down, 80); /* down arrow */
-    keyMap.insert(Qt::Key_Left, 75); /* left arrow */
-    keyMap.insert(Qt::Key_Right, 77); /* right arrow */
-
-    /* modifiers */
-    keyMap.insert(Qt::Key_Shift, 42); /* shift */
-    keyMap.insert(Qt::Key_Control, 29); /* ctrl */
-    keyMap.insert(Qt::Key_Alt, 56); /* alt */
-
-    /* numbers */
-    keyMap.insert(48, 11); /* 0 */
-    keyMap.insert(49, 2);  /* 1 */
-    keyMap.insert(50, 3);  /* 2 */
-    keyMap.insert(51, 4);  /* 3 */
-    keyMap.insert(52, 5);  /* 4 */
-    keyMap.insert(53, 6);  /* 5 */
-    keyMap.insert(54, 7);  /* 6 */
-    keyMap.insert(55, 8);  /* 7 */
-    keyMap.insert(56, 9);  /* 8 */
-    keyMap.insert(57, 10); /* 9 */
-
-    /* shift + numbers */
-    keyMap.insert(126, 41); /* ~ */
-    keyMap.insert(33, 2); /* ! */
-    keyMap.insert(64, 3); /* @ */
-    keyMap.insert(35, 4); /* # */
-    keyMap.insert(36, 5); /* $ */
-    keyMap.insert(37, 6); /* % */
-    keyMap.insert(94, 7); /* ^ */
-    keyMap.insert(38, 8); /* & */
-    keyMap.insert(40, 10); /* ( */
-    keyMap.insert(41, 11); /* ) */
-
-    /* shift + signs */
-    keyMap.insert(95, 12); /* _ */
-    keyMap.insert(124, 43); /* | */
-    keyMap.insert(123, 26); /* { */
-    keyMap.insert(125, 27); /* } */
-    keyMap.insert(58, 39); /* : */
-    keyMap.insert(34, 40); /* " */
-    keyMap.insert(60, 51); /* < */
-    keyMap.insert(62, 52); /* > */
-    keyMap.insert(63, 53); /* ? */
-
-    /* function keys */
-    keyMap.insert(Qt::Key_F1, 59); /* f1 */
-    keyMap.insert(Qt::Key_F2, 60); /* f2 */
-    keyMap.insert(Qt::Key_F3, 61); /* f3 */
-    keyMap.insert(Qt::Key_F4, 62); /* f4 */
-    keyMap.insert(Qt::Key_F5, 63); /* f5 */
-    keyMap.insert(Qt::Key_F6, 64); /* f6 */
-    keyMap.insert(Qt::Key_F7, 65); /* f7 */
-    keyMap.insert(Qt::Key_F8, 66); /* f8 */
-    keyMap.insert(Qt::Key_F9, 67); /* f9 */
-    keyMap.insert(Qt::Key_F10, 68); /* f10 */
-    keyMap.insert(Qt::Key_F11, 87); /* f11 */
-    keyMap.insert(Qt::Key_F12, 88); /* f12 */
-}
-
-void KeyboardHelper::autoKeyRelease(void)
-{
-    while (!this->keyCodeList.isEmpty()) {
-        qDebug() << "auto release scancode: " << this->keyCodeList.last();
-        do_qt_keyboard_key_event(KEY_RELEASED, this->keyCodeList.last());
-        this->keyCodeList.removeLast();
-    }
-
-#if 0
-    clear_finger_slot(false);
-    qDebug() << "disable multi-touch";
-#endif
-}
-
-int KeyboardHelper::keyCodeOperation(QKeyEvent *event, int keyCode)
-{
-    /* keypad and specialKey translation */
-    if (!this->numLockState && (event->modifiers() == (Qt::KeypadModifier | Qt::ShiftModifier))) {
-        QMap<int, int>::iterator keypadIter = this->keypadMap.find(keyCode);
-        while (keypadIter != this->keypadMap.end()) {
-            if (keypadIter.key() == keyCode) {
-                keyCode = keypadIter.value();
-                break;
-            }
-        }
-    }
-
-    if (this->isSpecialKey(keyCode)) {
-        virtio_keyboard_event(224);
-    }
-
-    QMap<int, int>::iterator keyMapIter = this->keyMap.find(keyCode);
-    while (keyMapIter != this->keyMap.end()) {
-        if (keyMapIter.key() == keyCode) {
-            break;
-        }
-    }
-
-    if (keyMapIter == this->keyMap.end()) {
-        qDebug() << "unsupported keycode pressed: " << keyCode;
-        return -1;
-    }
-
-    return keyMapIter.value();
-}
-
-bool KeyboardHelper::isSpecialKey(int keyCode)
-{
-    switch(keyCode) {
-        case Qt::Key_PageDown:
-        case Qt::Key_PageUp:
-        case Qt::Key_Home:
-        case Qt::Key_End:
-        case Qt::Key_Insert:
-        case Qt::Key_Delete:
-        case Qt::Key_Up:
-        case Qt::Key_Down:
-        case Qt::Key_Left:
-        case Qt::Key_Right:
-            return true;
-        default:
-            break;
-    }
-
-    return false;
-}
-
-void KeyboardHelper::keyPressed(QKeyEvent *event)
-{
-    int keyCode = event->key();
-    qDebug() << "key pressed :" << event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
-
-#if 0
-    /* TODO: multi-touch */
-    if (get_emul_max_touch_point() > 1) {
-        /* multi-touch checking */
-        if (event->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) {
-            get_emul_multi_touch_state()->multitouch_enable = 2;
-            /* add a finger before start the multi-touch processing
-            if already exist the pressed touch in display */
-            qDebug() << "enable multi-touch = mode 2";
-        } else if (event->modifiers() == Qt::ShiftModifier ||
-            event->modifiers() == Qt::ControlModifier) {
-            get_emul_multi_touch_state()->multitouch_enable = 1;
-            qDebug() << "enable multi-touch = mode 1";
-        }
-    }
-#endif
-
-    /* NumLock or CapsLock key */
-    if (keyCode == Qt::Key_NumLock) {
-#ifdef CONFIG_WIN32
-        if (event->nativeModifiers() == 0x1000200) {
-            this->numLockState = ON;
-        } else if (event->nativeModifiers() == 0x1000000) {
-            this->numLockState = OFF;
-        }
-#else
-        if (event->nativeModifiers() == 0) {
-            this->numLockState = ON;
-        } else if (event->nativeModifiers() == 16) {
-            this->numLockState = OFF;
-        }
-#endif
-        qDebug() << "num_lock state: " << this->numLockState << "pressed";
-        return;
-    } else if (keyCode == Qt::Key_CapsLock) {
-#ifdef CONFIG_WIN32
-        if (event->nativeModifiers() == 256) {
-            this->capsLockState = ON;
-        } else if (event->nativeModifiers() == 0) {
-            this->capsLockState = OFF;
-        }
-#else
-        if (event->nativeModifiers() == 18) {
-            this->capsLockState = ON;
-        } else if (event->nativeModifiers() == 16) {
-            this->capsLockState = OFF;
-        }
-#endif
-        qDebug() << "caps_lock state: " << this->capsLockState << "pressed";
-        return;
-    }
-
-    /* host numlock check for sync */
-    if ((event->modifiers() & Qt::KeypadModifier)) {
-        if (this->isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
-            if (!(event->modifiers() & Qt::ShiftModifier)) {
-                this->numLockState = OFF;
-            } else {
-                this->numLockState = ON;
-            }
-        } else {
-            if (!(event->modifiers() & Qt::ShiftModifier || keyCode == 42 || keyCode == 43 || keyCode == 45 || keyCode == 47)) { /* (42 = *, 43 = +, 45 = -, 47 = /) on keypad */
-                this->numLockState = ON;
-            } else {
-                this->numLockState = OFF;
-            }
-        }
-    }
-    if (event->key() >= 65 && event->key() <= 90) {
-#ifdef CONFIG_WIN32
-        if (event->nativeModifiers() & 256) {
-#else
-        if (event->nativeModifiers() & 0x02) {
-#endif
-            this->capsLockState = ON;
-        } else {
-            this->capsLockState = OFF;
-        }
-    }
-
-    if (get_emul_caps_lock_state() != this->capsLockState) {
-        virtio_keyboard_event(58);
-        virtio_keyboard_event(58 | 0x80);
-        set_emul_caps_lock_state(get_emul_caps_lock_state() ^ 1);
-        qDebug() << "qemu CapsLock state was synchronized with host key value (" <<
-            get_emul_caps_lock_state() << ")";
-    }
-    if (get_emul_num_lock_state() != this->numLockState) {
-        virtio_keyboard_event(69);
-        virtio_keyboard_event(69 | 0x80);
-        set_emul_num_lock_state(get_emul_num_lock_state() ^ 1);
-        qDebug() << "qemu NumLock state was synchronized with host key value (" <<
-            get_emul_num_lock_state() << ")";
-    }
-
-    int ret = this->keyCodeOperation(event, keyCode);
-    if (ret != -1) {
-        /* for auto release */
-        this->keyCodeList.append(ret);
-        do_qt_keyboard_key_event(KEY_PRESSED, ret);
-    }
-}
-
-void KeyboardHelper::keyReleased(QKeyEvent *event)
-{
-    int keyCode = event->key();
-    qDebug() << "key released :" <<  event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
-
-#if 0
-    /* TODO: multi-touch */
-    if (event->key() == Qt::Key_Shift && event->modifiers() == Qt::ControlModifier) {
-        get_emul_multi_touch_state()->multitouch_enable = 1;
-        qDebug() << "enabled multi-touch = mode 1";
-    } else if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control) {
-        clear_finger_slot(false);
-        qDebug() << "disable multi-touch";
-    }
-#endif
-
-    if (keyCode == Qt::Key_NumLock) {
-        qDebug() << "num_lock state: " << this->numLockState << "released";
-        return;
-    } else if (keyCode == Qt::Key_CapsLock) {
-        qDebug() << "caps_lock state: " << this->capsLockState << "released";
-        return;
-    }
-
-#ifdef CONFIG_LINUX
-    /* for keypad keycode translation */
-    if (this->numLockState && event->modifiers() == Qt::KeypadModifier) {
-        if (this->isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
-            switch(keyCode) {
-                case Qt::Key_Delete:
-                    keyCode = 46; /* . */
-                    break;
-                case Qt::Key_Insert:
-                    keyCode = 48; /* 0 */
-                    break;
-                case Qt::Key_End:
-                    keyCode = 49; /* 1 */
-                    break;
-                case Qt::Key_Down:
-                    keyCode = 50; /* 2 */
-                    break;
-                case Qt::Key_PageDown:
-                    keyCode = 51; /* 3 */
-                    break;
-                case Qt::Key_Left:
-                    keyCode = 52; /* 4 */
-                    break;
-                case Qt::Key_Clear:
-                    keyCode = 53; /* 5 */
-                    break;
-                case Qt::Key_Right:
-                    keyCode = 54; /* 6 */
-                    break;
-                case Qt::Key_Home:
-                    keyCode = 55; /* 7 */
-                    break;
-                case Qt::Key_Up:
-                    keyCode = 56; /* 8 */
-                    break;
-                case Qt::Key_PageUp:
-                    keyCode = 57; /* 9 */
-                    break;
-                default:
-                    break;
-            }
-        }
-    }
-#endif
-
-    int ret = this->keyCodeOperation(event, keyCode);
-    if (ret != -1) {
-        do_qt_keyboard_key_event(KEY_RELEASED, ret);
-        /* remove keycode from list */
-        this->keyCodeList.removeOne(ret);
-    }
-}
-
-KeyboardHelper::~KeyboardHelper()
-{
-    qDebug("destroy keyboard helper");
-}
diff --git a/tizen/src/ui/keyboardhelper.h b/tizen/src/ui/keyboardhelper.h
deleted file mode 100644 (file)
index 7eef329..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Qt keyboard helper
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sungmin Ha <sungmin82.ha@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef KEYBOARDHELPER_H
-#define KEYBOARDHELPER_H
-
-#include <QMap>
-
-enum KbdLedState {
-    OFF,
-    ON
-};
-
-class KeyboardHelper
-{
-public:
-    KeyboardHelper();
-    ~KeyboardHelper();
-
-    void keyPressed(QKeyEvent *event);
-    void keyReleased(QKeyEvent *event);
-    void autoKeyRelease(void);
-    bool isSpecialKey(int keyCode);
-    int keyCodeOperation(QKeyEvent *event, int keyCode);
-
-protected:
-    QList<int> keyCodeList;
-    QMap<int, int> keyMap;
-    QMap<int, int> keypadMap;
-    bool numLockState;
-    bool capsLockState;
-
-private:
-    void createKeyMap();
-    void createKeypadMap();
-};
-
-#endif // KEYBOARDHELPER_H
diff --git a/tizen/src/ui/keyboardshortcut.cpp b/tizen/src/ui/keyboardshortcut.cpp
deleted file mode 100644 (file)
index 211f111..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sungmin Ha <sungmin82.ha@samsung.com>
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "keyboardshortcut.h"
-#include "mainwindow.h"
-
-KeyboardShortcut::KeyboardShortcut(QWidget *parent) : QWidget(parent)
-{
-    this->parent = (MainWindow *)parent;
-    this->hide();
-}
-
-void KeyboardShortcut::removeControllerShortcut()
-{
-    for (int index = 0; index < controllerShortcutList.count(); index++) {
-        delete controllerShortcutList.at(index);
-    }
-
-    controllerShortcutList.clear();
-    controllerShortcutMap.clear();
-
-    qDebug() << "Removed controller shortcuts";
-}
-
-void KeyboardShortcut::removeHwKeyShortcut()
-{
-    for (int index = 0; index < hwKeyShortcutList.count(); index++) {
-        delete hwKeyShortcutList.at(index);
-    }
-
-    hwKeyShortcutList.clear();
-    hwKeyShortcutMap.clear();
-
-    qDebug() << "Removed hwKey shortcuts";
-}
-
-void KeyboardShortcut::registShortcutKey(QShortcut *shortcut, QString item)
-{
-    QSignalMapper *mapper = new QSignalMapper(this);
-    if (!mapper || !shortcut) {
-        qDebug() << "regist HwKey shortcut failed.";
-        return;
-    }
-
-    connect(shortcut, SIGNAL(activated()), mapper, SLOT(map()));
-    mapper->setMapping(shortcut, item);
-    connect(mapper, SIGNAL(mapped(const QString &)), this, SLOT(slotShortcutHwKey(const QString &)));
-}
-
-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->keySequence.isEmpty()) {
-                QShortcut *shortcut = new QShortcut(QKeySequence::fromString(controllerKey->keySequence), parent);
-                registShortcutKey(shortcut, controllerKey->name);
-
-                controllerShortcutList.append(shortcut);
-                controllerShortcutMap.insert(controllerKey->name, controllerKey->keySequence);
-            }
-        } else {
-            qDebug() << "controllerKeyList.at(" << index << ") is NULL";
-        }
-    }
-}
-
-void KeyboardShortcut::setKeyboardShortcutHwKey()
-{
-    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) {
-                qDebug() << "hwKey is not exist";
-                return;
-            } else {
-                qDebug() << "hwKeyList is not exist";
-                return;
-            }
-        } else {
-            qDebug() << "uiInfo->getMainForm() is NULL";
-        }
-    } else {
-        qDebug() << "uiInfo is NULL";
-        return;
-    }
-
-    qDebug() << "Set keyboard shortcut HwKeys.";
-    for (int index = 0; index < hwKeyList.count(); index++) {
-        HardwareKey *hwKey = hwKeyList.at(index);
-        if (hwKey) {
-            if (!hwKey->keySequence.isEmpty()) {
-                QShortcut *shortcut = new QShortcut(QKeySequence::fromString(hwKey->keySequence), parent);
-                registShortcutKey(shortcut, hwKey->name);
-
-                hwKeyShortcutList.append(shortcut);
-                hwKeyShortcutMap.insert(hwKey->name, hwKey->keySequence);
-            }
-        } else {
-            qDebug() << "hwKeyList.at(" << index << ") is NULL";
-        }
-    }
-}
-
-void KeyboardShortcut::setKeyboardShortcutContextMenu(MenuItem *item, QString property, QString keySequence)
-{
-    QShortcut *shortcut = new QShortcut(QKeySequence::fromString(keySequence), parent);
-    int itemType = item->getType();
-    QString itemName = item->getName();
-
-    switch (itemType) {
-        case MenuItemType::closeItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutClose()));
-            break;
-        case MenuItemType::infoItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutDetailedInfo()));
-            if (itemName.isEmpty()) {
-                itemName = DETAILED_INFO_TITLE;
-            }
-            break;
-        case MenuItemType::onTopItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutTopMost()));
-            break;
-        case MenuItemType::hostKeyboardItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutHostKeyboard()));
-            break;
-        case MenuItemType::forceCloseItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutForceClose()));
-            break;
-        case MenuItemType::shellItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutShell()));
-            break;
-        case MenuItemType::controlPanelItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutControlPanel()));
-            break;
-        case MenuItemType::screenShotItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutRequestScreenshot()));
-            break;
-        case MenuItemType::controllerItem:
-            connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutController()));
-            break;
-        case MenuItemType::scaleItem:
-            if (property == "prev") {
-                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutScalePrev()));
-            } else if (property == "next") {
-                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutScaleNext()));
-            } else {
-                qDebug() << "undefined property: " << property;
-            }
-            break;
-        case MenuItemType::switchItem:
-            if (property == "prev") {
-                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutSwitchPrev()));
-            } else if (property == "next") {
-                connect(shortcut, SIGNAL(activated()), this, SLOT(slotShortcutSwitchNext()));
-            } else {
-                qDebug() << "undefined property: " << property;
-            }
-            break;
-        default:
-            qDebug() << "undefined item type: " << itemType;
-            return;
-    }
-
-    if (!property.isEmpty()) {
-        itemName.append(" " + property);
-    }
-
-    popupMenuShortcutMap.insert(itemName, keySequence);
-}
-
-void KeyboardShortcut::slotShortcutClose()
-{
-    parent->getPopupMenu()->slotClose();
-}
-
-void KeyboardShortcut::slotShortcutDetailedInfo()
-{
-    parent->getPopupMenu()->slotDetailedInfo();
-}
-
-void KeyboardShortcut::slotShortcutShell()
-{
-    parent->getPopupMenu()->slotShell();
-}
-
-void KeyboardShortcut::slotShortcutRequestScreenshot()
-{
-    parent->getPopupMenu()->slotRequestScreenshot();
-}
-
-void KeyboardShortcut::slotShortcutForceClose()
-{
-    parent->getPopupMenu()->slotForceClose();
-}
-
-void KeyboardShortcut::slotShortcutControlPanel()
-{
-    parent->getPopupMenu()->slotControlPanel();
-}
-
-void KeyboardShortcut::slotShortcutTopMost()
-{
-    QAction *action = parent->getPopupMenu()->getActionTopMost();
-    parent->getPopupMenu()->slotTopMost(!action->isChecked());
-}
-
-void KeyboardShortcut::slotShortcutSwitchPrev()
-{
-    QAction *action = parent->getPopupMenu()->switchGroup->checkedAction();
-    QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
-
-    if (!action) {
-        qDebug() << "switch prev failed.";
-        return;
-    }
-
-    int index = switchList.indexOf(action);
-    if (index == switchList.count() - 1) {
-        index = 0;
-    } else {
-        index++;
-    }
-
-    QAction *nextSwitchAction = switchList.at(index);
-    nextSwitchAction->setChecked(true);
-    nextSwitchAction->trigger();
-}
-
-void KeyboardShortcut::slotShortcutSwitchNext()
-{
-    QAction *action = parent->getPopupMenu()->switchGroup->checkedAction();
-    QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
-
-    if (!action) {
-        qDebug() << "switch next failed.";
-        return;
-    }
-
-    int index = switchList.indexOf(action);
-    if (index == 0) {
-        index = switchList.count() - 1;
-    } else {
-        index--;
-    }
-
-    QAction *nextSwitchAction = switchList.at(index);
-    nextSwitchAction->setChecked(true);
-    nextSwitchAction->trigger();
-}
-
-void KeyboardShortcut::slotShortcutScaleNext()
-{
-    QAction *action = parent->getPopupMenu()->scaleGroup->checkedAction();
-    QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
-
-    if (!action) {
-        qDebug() << "scale next failed.";
-        return;
-    }
-
-    int index = scaleList.indexOf(action);
-    if (index == 0) {
-        index = scaleList.count() - 1;
-    } else {
-        index--;
-    }
-
-    QAction *nextScaleAction = scaleList.at(index);
-    nextScaleAction->setChecked(true);
-    nextScaleAction->trigger();
-}
-
-void KeyboardShortcut::slotShortcutScalePrev()
-{
-    QAction *action = parent->getPopupMenu()->scaleGroup->checkedAction();
-    QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
-
-    if (!action) {
-        qDebug() << "scale prev failed.";
-        return;
-    }
-
-    int index = scaleList.indexOf(action);
-    if (index == scaleList.count() - 1) {
-        index = 0;
-    } else {
-        index++;
-    }
-
-    QAction *nextScaleAction = scaleList.at(index);
-    nextScaleAction->setChecked(true);
-    nextScaleAction->trigger();
-}
-
-void KeyboardShortcut::slotShortcutController()
-{
-    QAction *action = parent->getPopupMenu()->controllerGroup->checkedAction();
-    QList<QAction *> controllerList = parent->getPopupMenu()->controllerGroup->actions();
-
-    if (!action) {
-        qDebug() << "change controller failed.";
-        return;
-    }
-
-    int last_index = controllerList.count() - 1;
-    int index = controllerList.indexOf(action) + 1;
-
-    if (index > last_index) {
-        index = 0;
-    }
-
-    QAction *nextControllerAction = controllerList.at(index);
-    if (!nextControllerAction) {
-        qDebug() << "controllerList.at(" << index << ") is NULL";
-        return;
-    }
-
-    nextControllerAction->setChecked(true);
-    nextControllerAction->trigger();
-}
-
-void KeyboardShortcut::slotShortcutHostKeyboard()
-{
-    QAction *action = parent->getPopupMenu()->keyboardGroup->checkedAction();
-    QList<QAction *> keyboardStatusList = parent->getPopupMenu()->keyboardGroup->actions();
-
-    if (!action) {
-        qDebug() << "HostKeyboard enable/disable failed";
-        return;
-    }
-
-    int index = 0;
-    if (action->text().contains(KEYBOARD_ON)) {
-        for (index = 0; index < keyboardStatusList.count(); index++) {
-            if (keyboardStatusList.at(index)->text().contains(KEYBOARD_OFF)) {
-                break;
-            }
-        }
-    } else {
-        for (index = 0; index < keyboardStatusList.count(); index++) {
-            if (keyboardStatusList.at(index)->text().contains(KEYBOARD_ON)) {
-                break;
-            }
-        }
-    }
-
-    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)->name.compare(item) == 0) {
-            keyCode = hwKeyList.at(index)->keycode;
-            break;
-        }
-    }
-
-    if (index == hwKeyList.count()) {
-        qDebug() << item << "is not exist in KeyList";
-    }
-
-    return keyCode;
-}
-
-void KeyboardShortcut::doHwKeyEvent(int keyCode)
-{
-    do_hw_key_event(KEY_PRESSED, keyCode);
-    do_hw_key_event(KEY_RELEASED, keyCode);
-}
-
-void KeyboardShortcut::slotShortcutHwKey(const QString &name)
-{
-    int keyCode = getHwKeyCode(name);
-    doHwKeyEvent(keyCode);
-}
-
-QList<QShortcut *> KeyboardShortcut::getControllerShortcutList()
-{
-    return controllerShortcutList;
-}
-
-QMap<QString, QString> KeyboardShortcut::getPopupMenuShortcutMap()
-{
-    return popupMenuShortcutMap;
-}
-
-QMap<QString, QString> KeyboardShortcut::getHwKeyShortcutMap()
-{
-    return hwKeyShortcutMap;
-}
-
-QMap<QString, QString> KeyboardShortcut::getControllerShortcutMap()
-{
-    return controllerShortcutMap;
-}
-
-KeyboardShortcut::~KeyboardShortcut()
-{
-    qDebug("destroy keyboard shortcut");
-}
diff --git a/tizen/src/ui/keyboardshortcut.h b/tizen/src/ui/keyboardshortcut.h
deleted file mode 100644 (file)
index 353472f..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sungmin Ha <sungmin82.ha@samsung.com>
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef KEYBOARDSHORTCUT_H
-#define KEYBOARDSHORTCUT_H
-
-#include <QObject>
-#include <QShortcut>
-#include <QMap>
-
-#include "hardwarekey.h"
-#include "menu/menuitem.h"
-
-class MainWindow;
-
-class KeyboardShortcut : public QWidget
-{
-    Q_OBJECT
-
-public:
-    KeyboardShortcut(QWidget *parent = 0);
-    ~KeyboardShortcut();
-
-    void setKeyboardShortcutHwKey();
-    void setKeyboardShortcutController();
-    void setKeyboardShortcutContextMenu(MenuItem *item, QString property, QString keySequence);
-    void removeControllerShortcut();
-    void removeHwKeyShortcut();
-
-    QList<QShortcut *> getControllerShortcutList();
-    QMap<QString, QString> getPopupMenuShortcutMap();
-    QMap<QString, QString> getHwKeyShortcutMap();
-    QMap<QString, QString> getControllerShortcutMap();
-
-public slots:
-    void slotShortcutHwKey(const QString &name);
-    void slotShortcutClose();
-    void slotShortcutDetailedInfo();
-    void slotShortcutControlPanel();
-    void slotShortcutShell();
-    void slotShortcutRequestScreenshot();
-    void slotShortcutForceClose();
-    void slotShortcutHostKeyboard();
-    void slotShortcutController();
-    void slotShortcutScalePrev();
-    void slotShortcutScaleNext();
-    void slotShortcutSwitchPrev();
-    void slotShortcutSwitchNext();
-    void slotShortcutTopMost();
-
-private:
-    void registShortcutKey(QShortcut *shortcut, QString item);
-    int getHwKeyCode(QString item);
-    void doHwKeyEvent(int keyCode);
-
-    MainWindow *parent;
-    QList<HardwareKey *> hwKeyList;
-    QList<HardwareKey *> controllerKeyList;
-    QList<QShortcut *> controllerShortcutList;
-    QList<QShortcut *> hwKeyShortcutList;
-    QMap<QString, QString> popupMenuShortcutMap;
-    QMap<QString, QString> hwKeyShortcutMap;
-    QMap<QString, QString> controllerShortcutMap;
-};
-
-#endif // KEYBOARDSHORTCUT_H
index b0ecbd0367fd7149de462333ae2cdde23d7ffed9..8661f598411bc4d4d454a721c0111e77722fcfa4 100644 (file)
@@ -43,7 +43,7 @@
 #include "uiinformation.h"
 #include "controller/dockingcontroller.h"
 #include "controller/floatingcontroller.h"
-#include "keyboardshortcut.h"
+#include "input/keyboardshortcut.h"
 
 extern "C" {
 #include "skin/maruskin_operation.h"
index e4682bc0605c82cdcf7bfc70e514e0a9e00be9bd..8a55471d76454548ad7781dad439577588543ced 100644 (file)
@@ -38,7 +38,7 @@
 #include "aboutdialog.h"
 #include "screenshotdialog.h"
 #include "menu/menuitem.h"
-#include "keyboardshortcut.h"
+#include "input/keyboardshortcut.h"
 
 class MainWindow;
 
index cd65f6f79758f758d2cd767d7071d719155b8456..50617fb44bcf7a36e4cdaf0c453c0f077b8d4a94 100644 (file)
@@ -33,7 +33,7 @@
 #include <QtWidgets>
 #include <QDialog>
 
-#include "keyboardshortcut.h"
+#include "input/keyboardshortcut.h"
 
 #define DETAILED_INFO_TITLE "Detailed Info"
 #define TABLE_BORDER_SIZE 2
index b89e08631ef996b3650f06b96f2e370554361248..33663e28b1a5eaf73c6650d2f998387150a52e97 100644 (file)
@@ -33,7 +33,7 @@
 #include <QGraphicsView>
 
 #include "mainform.h"
-#include "keyboardhelper.h"
+#include "input/keyboardhelper.h"
 
 class MainWindow;