From 6cdf6d377bd847ff914f9a9511c0baf43e186220 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Wed, 22 Apr 2015 14:55:06 +0900 Subject: [PATCH] input: moved keyboard source code files 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 --- tizen/src/ui/Makefile.objs | 6 +- tizen/src/ui/input/Makefile.objs | 6 ++ tizen/src/ui/{ => input}/keyboardhelper.cpp | 101 ++++++++++-------- tizen/src/ui/{ => input}/keyboardhelper.h | 0 tizen/src/ui/{ => input}/keyboardshortcut.cpp | 24 ++--- tizen/src/ui/{ => input}/keyboardshortcut.h | 0 tizen/src/ui/mainwindow.h | 2 +- tizen/src/ui/menu/contextmenu.h | 2 +- tizen/src/ui/menu/detailedinfodialog.h | 2 +- tizen/src/ui/skinview.h | 2 +- 10 files changed, 79 insertions(+), 66 deletions(-) create mode 100644 tizen/src/ui/input/Makefile.objs rename tizen/src/ui/{ => input}/keyboardhelper.cpp (82%) rename tizen/src/ui/{ => input}/keyboardhelper.h (100%) rename tizen/src/ui/{ => input}/keyboardshortcut.cpp (95%) rename tizen/src/ui/{ => input}/keyboardshortcut.h (100%) diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index 499efb643a..d792f54c8f 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -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 index 0000000000..315eb0966b --- /dev/null +++ b/tizen/src/ui/input/Makefile.objs @@ -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/keyboardhelper.cpp b/tizen/src/ui/input/keyboardhelper.cpp similarity index 82% rename from tizen/src/ui/keyboardhelper.cpp rename to tizen/src/ui/input/keyboardhelper.cpp index 37ac16e6be..8f126d92d8 100644 --- a/tizen/src/ui/keyboardhelper.cpp +++ b/tizen/src/ui/input/keyboardhelper.cpp @@ -27,7 +27,6 @@ * */ -#include #include #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::iterator keypadIter = this->keypadMap.find(keyCode); - while (keypadIter != this->keypadMap.end()) { + if (!numLockState && (event->modifiers() == (Qt::KeypadModifier | Qt::ShiftModifier))) { + QMap::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::iterator keyMapIter = this->keyMap.find(keyCode); - while (keyMapIter != this->keyMap.end()) { + QMap::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); } } diff --git a/tizen/src/ui/keyboardhelper.h b/tizen/src/ui/input/keyboardhelper.h similarity index 100% rename from tizen/src/ui/keyboardhelper.h rename to tizen/src/ui/input/keyboardhelper.h diff --git a/tizen/src/ui/keyboardshortcut.cpp b/tizen/src/ui/input/keyboardshortcut.cpp similarity index 95% rename from tizen/src/ui/keyboardshortcut.cpp rename to tizen/src/ui/input/keyboardshortcut.cpp index 211f111a4d..d7555f6bdd 100644 --- a/tizen/src/ui/keyboardshortcut.cpp +++ b/tizen/src/ui/input/keyboardshortcut.cpp @@ -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 switchList = parent->getPopupMenu()->switchGroup->actions(); if (!action) { - qDebug() << "switch prev failed."; + qWarning() << "switch prev failed."; return; } @@ -276,7 +276,7 @@ void KeyboardShortcut::slotShortcutSwitchNext() QList switchList = parent->getPopupMenu()->switchGroup->actions(); if (!action) { - qDebug() << "switch next failed."; + qWarning() << "switch next failed."; return; } @@ -298,7 +298,7 @@ void KeyboardShortcut::slotShortcutScaleNext() QList scaleList = parent->getPopupMenu()->scaleGroup->actions(); if (!action) { - qDebug() << "scale next failed."; + qWarning() << "scale next failed."; return; } @@ -320,7 +320,7 @@ void KeyboardShortcut::slotShortcutScalePrev() QList scaleList = parent->getPopupMenu()->scaleGroup->actions(); if (!action) { - qDebug() << "scale prev failed."; + qWarning() << "scale prev failed."; return; } @@ -342,7 +342,7 @@ void KeyboardShortcut::slotShortcutController() QList 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 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; diff --git a/tizen/src/ui/keyboardshortcut.h b/tizen/src/ui/input/keyboardshortcut.h similarity index 100% rename from tizen/src/ui/keyboardshortcut.h rename to tizen/src/ui/input/keyboardshortcut.h diff --git a/tizen/src/ui/mainwindow.h b/tizen/src/ui/mainwindow.h index b0ecbd0367..8661f59841 100644 --- a/tizen/src/ui/mainwindow.h +++ b/tizen/src/ui/mainwindow.h @@ -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" diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index e4682bc060..8a55471d76 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -38,7 +38,7 @@ #include "aboutdialog.h" #include "screenshotdialog.h" #include "menu/menuitem.h" -#include "keyboardshortcut.h" +#include "input/keyboardshortcut.h" class MainWindow; diff --git a/tizen/src/ui/menu/detailedinfodialog.h b/tizen/src/ui/menu/detailedinfodialog.h index cd65f6f797..50617fb44b 100644 --- a/tizen/src/ui/menu/detailedinfodialog.h +++ b/tizen/src/ui/menu/detailedinfodialog.h @@ -33,7 +33,7 @@ #include #include -#include "keyboardshortcut.h" +#include "input/keyboardshortcut.h" #define DETAILED_INFO_TITLE "Detailed Info" #define TABLE_BORDER_SIZE 2 diff --git a/tizen/src/ui/skinview.h b/tizen/src/ui/skinview.h index b89e08631e..33663e28b1 100644 --- a/tizen/src/ui/skinview.h +++ b/tizen/src/ui/skinview.h @@ -33,7 +33,7 @@ #include #include "mainform.h" -#include "keyboardhelper.h" +#include "input/keyboardhelper.h" class MainWindow; -- 2.34.1