diff options
author | Kevin Krammer <kevin.krammer.qnx@kdab.com> | 2012-03-22 13:54:00 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-22 16:47:06 +0100 |
commit | 29518b04a619fdd7784e88eebe687fb87ae8a8b5 (patch) | |
tree | fdca58a2cd29a33e7c4100d2111025118aeb1692 /src/plugins/platforms/qnx/qqnxvirtualkeyboard.h | |
parent | 1a414cbc2664621431028593ea7b6de3e730d556 (diff) |
Make QNX virtual keyboard handling main event loop driven
Refactor from polling in an endless loop running in a separate thread
to using a QSocketNotifier working on the main thread.
Similar to "de-threading" of the navigator event handling in
9dc86ac0f2d019f93665c1ae0e3c2cd33fd88bce
Change-Id: I994dceed07312a3846737c8bea34cffa4ab408f1
Reviewed-by: Sean Harmer <sh@theharmers.co.uk>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxvirtualkeyboard.h')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxvirtualkeyboard.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h index 21b2e8736c..73a296fb9f 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h @@ -42,7 +42,7 @@ #ifndef VIRTUALKEYBOARD_H_ #define VIRTUALKEYBOARD_H_ -#include <QtCore/QThread> +#include <QtCore/QObject> #include <QtCore/QLocale> #include <QtGui/QPlatformScreen> #include <QtGui/QWindowSystemInterface> @@ -52,10 +52,12 @@ #include <string> #include <sys/pps.h> +class QSocketNotifier; + QT_BEGIN_NAMESPACE /* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */ -class QQnxVirtualKeyboard : public QThread +class QQnxVirtualKeyboard : public QObject { Q_OBJECT public: @@ -83,10 +85,16 @@ public: bool isVisible() const { return m_visible; } QLocale locale() const { return m_locale; } +public Q_SLOTS: + void start(); + Q_SIGNALS: void localeChanged(const QLocale &locale); void visibilityChanged(bool visible); +private Q_SLOTS: + void ppsDataReady(); + private: QQnxVirtualKeyboard(); virtual ~QQnxVirtualKeyboard(); @@ -94,7 +102,6 @@ private: // Will be called internally if needed. bool connect(); void close(); - void ppsDataReady(); bool queryPPSInfo(); void handleKeyboardInfoMessage(); void handleKeyboardStateChangeMessage(bool visible); @@ -110,9 +117,6 @@ private: void addPhoneModeOptions(); void addPinModeOptions(); - // QThread overrides - virtual void run(); - pps_encoder_t *m_encoder; pps_decoder_t *m_decoder; char *m_buffer; @@ -121,6 +125,7 @@ private: KeyboardMode m_keyboardMode; bool m_visible; QLocale m_locale; + QSocketNotifier *m_readNotifier; // Path to keyboardManager in PPS. static const char *ms_PPSPath; |