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>
tizen/src/ui/Makefile.objs
tizen/src/ui/input/Makefile.objs [new file with mode: 0644]
tizen/src/ui/input/keyboardhelper.cpp [moved from tizen/src/ui/keyboardhelper.cpp with 82% similarity]
tizen/src/ui/input/keyboardhelper.h [moved from tizen/src/ui/keyboardhelper.h with 100% similarity]
tizen/src/ui/input/keyboardshortcut.cpp [moved from tizen/src/ui/keyboardshortcut.cpp with 95% similarity]
tizen/src/ui/input/keyboardshortcut.h [moved from tizen/src/ui/keyboardshortcut.h with 100% similarity]
tizen/src/ui/mainwindow.h
tizen/src/ui/menu/contextmenu.h
tizen/src/ui/menu/detailedinfodialog.h
tizen/src/ui/skinview.h

index 499efb6..d792f54 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
similarity index 82%
rename from tizen/src/ui/keyboardhelper.cpp
rename to tizen/src/ui/input/keyboardhelper.cpp
index 37ac16e..8f126d9 100644 (file)
@@ -27,7 +27,6 @@
  *
  */
 
-#include <Qt>
 #include <QtWidgets>
 
 #include "keyboardhelper.h"
@@ -208,10 +207,11 @@ void KeyboardHelper::createKeyMap()
 
 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();
+    while (!keyCodeList.isEmpty()) {
+        qDebug() << "auto release scancode : " << keyCodeList.last();
+
+        do_qt_keyboard_key_event(KEY_RELEASED, keyCodeList.last());
+        keyCodeList.removeLast();
     }
 
 #if 0
@@ -223,9 +223,9 @@ void KeyboardHelper::autoKeyRelease(void)
 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 (!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;
@@ -233,19 +233,19 @@ int KeyboardHelper::keyCodeOperation(QKeyEvent *event, int keyCode)
         }
     }
 
-    if (this->isSpecialKey(keyCode)) {
+    if (isSpecialKey(keyCode)) {
         virtio_keyboard_event(224);
     }
 
-    QMap<int, int>::iterator keyMapIter = this->keyMap.find(keyCode);
-    while (keyMapIter != this->keyMap.end()) {
+    QMap<int, int>::iterator keyMapIter = keyMap.find(keyCode);
+    while (keyMapIter != keyMap.end()) {
         if (keyMapIter.key() == keyCode) {
             break;
         }
     }
 
-    if (keyMapIter == this->keyMap.end()) {
-        qDebug() << "unsupported keycode pressed: " << keyCode;
+    if (keyMapIter == keyMap.end()) {
+        qWarning() << "unsupported keycode pressed : " << keyCode;
         return -1;
     }
 
@@ -276,20 +276,23 @@ bool KeyboardHelper::isSpecialKey(int keyCode)
 void KeyboardHelper::keyPressed(QKeyEvent *event)
 {
     int keyCode = event->key();
-    qDebug() << "key pressed :" << event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
+    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)) {
+        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";
         }
     }
@@ -299,84 +302,89 @@ void KeyboardHelper::keyPressed(QKeyEvent *event)
     if (keyCode == Qt::Key_NumLock) {
 #ifdef CONFIG_WIN32
         if (event->nativeModifiers() == 0x1000200) {
-            this->numLockState = ON;
+            numLockState = ON;
         } else if (event->nativeModifiers() == 0x1000000) {
-            this->numLockState = OFF;
+            numLockState = OFF;
         }
 #else
         if (event->nativeModifiers() == 0) {
-            this->numLockState = ON;
+            numLockState = ON;
         } else if (event->nativeModifiers() == 16) {
-            this->numLockState = OFF;
+            numLockState = OFF;
         }
 #endif
-        qDebug() << "num_lock state: " << this->numLockState << "pressed";
+        qDebug() << "num_lock state : " << numLockState << "pressed";
         return;
     } else if (keyCode == Qt::Key_CapsLock) {
 #ifdef CONFIG_WIN32
         if (event->nativeModifiers() == 256) {
-            this->capsLockState = ON;
+            capsLockState = ON;
         } else if (event->nativeModifiers() == 0) {
-            this->capsLockState = OFF;
+            capsLockState = OFF;
         }
 #else
         if (event->nativeModifiers() == 18) {
-            this->capsLockState = ON;
+            capsLockState = ON;
         } else if (event->nativeModifiers() == 16) {
-            this->capsLockState = OFF;
+            capsLockState = OFF;
         }
 #endif
-        qDebug() << "caps_lock state: " << this->capsLockState << "pressed";
+        qDebug() << "caps_lock state : " << capsLockState << "pressed";
         return;
     }
 
-    /* host numlock check for sync */
+    /* host NumLock check for sync */
     if ((event->modifiers() & Qt::KeypadModifier)) {
-        if (this->isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
+        if (isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
             if (!(event->modifiers() & Qt::ShiftModifier)) {
-                this->numLockState = OFF;
+                numLockState = OFF;
             } else {
-                this->numLockState = ON;
+                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;
+            if (!((event->modifiers() & Qt::ShiftModifier) ||
+                keyCode == 42 || keyCode == 43 || keyCode == 45 || keyCode == 47))
+            { /* (42 = *, 43 = +, 45 = -, 47 = /) on keypad */
+                numLockState = ON;
             } else {
-                this->numLockState = OFF;
+                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;
+            capsLockState = ON;
         } else {
-            this->capsLockState = OFF;
+            capsLockState = OFF;
         }
     }
 
-    if (get_emul_caps_lock_state() != this->capsLockState) {
+    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() != this->numLockState) {
+    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 = this->keyCodeOperation(event, keyCode);
+    int ret = keyCodeOperation(event, keyCode);
     if (ret != -1) {
         /* for auto release */
-        this->keyCodeList.append(ret);
+        keyCodeList.append(ret);
         do_qt_keyboard_key_event(KEY_PRESSED, ret);
     }
 }
@@ -384,31 +392,34 @@ void KeyboardHelper::keyPressed(QKeyEvent *event)
 void KeyboardHelper::keyReleased(QKeyEvent *event)
 {
     int keyCode = event->key();
-    qDebug() << "key released :" <<  event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers();
+    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";
+        qDebug() << "num_lock state : " << numLockState << "released";
         return;
     } else if (keyCode == Qt::Key_CapsLock) {
-        qDebug() << "caps_lock state: " << this->capsLockState << "released";
+        qDebug() << "caps_lock state : " << 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) {
+    if (numLockState && event->modifiers() == Qt::KeypadModifier) {
+        if (isSpecialKey(keyCode) || keyCode == Qt::Key_Clear) {
             switch(keyCode) {
                 case Qt::Key_Delete:
                     keyCode = 46; /* . */
@@ -450,11 +461,11 @@ void KeyboardHelper::keyReleased(QKeyEvent *event)
     }
 #endif
 
-    int ret = this->keyCodeOperation(event, keyCode);
+    int ret = keyCodeOperation(event, keyCode);
     if (ret != -1) {
         do_qt_keyboard_key_event(KEY_RELEASED, ret);
         /* remove keycode from list */
-        this->keyCodeList.removeOne(ret);
+        keyCodeList.removeOne(ret);
     }
 }
 
similarity index 95%
rename from tizen/src/ui/keyboardshortcut.cpp
rename to tizen/src/ui/input/keyboardshortcut.cpp
index 211f111..d7555f6 100644 (file)
@@ -114,17 +114,17 @@ void KeyboardShortcut::setKeyboardShortcutHwKey()
             if (uiInfo->getMainForm()->keyList.count() > 0) {
                 hwKeyList = uiInfo->getMainForm()->keyList;
             } else if (uiInfo->getMainForm()->keyList.count() == 0) {
-                qDebug() << "hwKey is not exist";
+                qWarning() << "hwKey is not exist";
                 return;
             } else {
-                qDebug() << "hwKeyList is not exist";
+                qWarning() << "hwKeyList is not exist";
                 return;
             }
         } else {
-            qDebug() << "uiInfo->getMainForm() is NULL";
+            qWarning() << "uiInfo->getMainForm() is NULL";
         }
     } else {
-        qDebug() << "uiInfo is NULL";
+        qWarning() << "uiInfo is NULL";
         return;
     }
 
@@ -254,7 +254,7 @@ void KeyboardShortcut::slotShortcutSwitchPrev()
     QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
 
     if (!action) {
-        qDebug() << "switch prev failed.";
+        qWarning() << "switch prev failed.";
         return;
     }
 
@@ -276,7 +276,7 @@ void KeyboardShortcut::slotShortcutSwitchNext()
     QList<QAction *> switchList = parent->getPopupMenu()->switchGroup->actions();
 
     if (!action) {
-        qDebug() << "switch next failed.";
+        qWarning() << "switch next failed.";
         return;
     }
 
@@ -298,7 +298,7 @@ void KeyboardShortcut::slotShortcutScaleNext()
     QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
 
     if (!action) {
-        qDebug() << "scale next failed.";
+        qWarning() << "scale next failed.";
         return;
     }
 
@@ -320,7 +320,7 @@ void KeyboardShortcut::slotShortcutScalePrev()
     QList<QAction *> scaleList = parent->getPopupMenu()->scaleGroup->actions();
 
     if (!action) {
-        qDebug() << "scale prev failed.";
+        qWarning() << "scale prev failed.";
         return;
     }
 
@@ -342,7 +342,7 @@ void KeyboardShortcut::slotShortcutController()
     QList<QAction *> controllerList = parent->getPopupMenu()->controllerGroup->actions();
 
     if (!action) {
-        qDebug() << "change controller failed.";
+        qWarning() << "change controller failed.";
         return;
     }
 
@@ -355,7 +355,7 @@ void KeyboardShortcut::slotShortcutController()
 
     QAction *nextControllerAction = controllerList.at(index);
     if (!nextControllerAction) {
-        qDebug() << "controllerList.at(" << index << ") is NULL";
+        qWarning() << "controllerList.at(" << index << ") is NULL";
         return;
     }
 
@@ -369,7 +369,7 @@ void KeyboardShortcut::slotShortcutHostKeyboard()
     QList<QAction *> keyboardStatusList = parent->getPopupMenu()->keyboardGroup->actions();
 
     if (!action) {
-        qDebug() << "HostKeyboard enable/disable failed";
+        qWarning() << "HostKeyboard enable/disable failed";
         return;
     }
 
@@ -403,7 +403,7 @@ int KeyboardShortcut::getHwKeyCode(QString item)
     }
 
     if (index == hwKeyList.count()) {
-        qDebug() << item << "is not exist in KeyList";
+        qWarning() << item << "is not exist in KeyList";
     }
 
     return keyCode;
index b0ecbd0..8661f59 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 e4682bc..8a55471 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 cd65f6f..50617fb 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 b89e086..33663e2 100644 (file)
@@ -33,7 +33,7 @@
 #include <QGraphicsView>
 
 #include "mainform.h"
-#include "keyboardhelper.h"
+#include "input/keyboardhelper.h"
 
 class MainWindow;