Merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-extra-info into lp:phablet-extras/maliit-plugins

Proposed by Thomas Moenicke
Status: Needs review
Proposed branch: lp:~thomas-moenicke/phablet-extras/maliit-plugins-extra-info
Merge into: lp:phablet-extras/maliit-plugins
Diff against target: 157 lines (+51/-0)
6 files modified
maliit-keyboard/lib/logic/layouthelper.h (+2/-0)
maliit-keyboard/lib/logic/layoutupdater.cpp (+11/-0)
maliit-keyboard/lib/models/layout.cpp (+15/-0)
maliit-keyboard/lib/models/layout.h (+17/-0)
maliit-keyboard/plugin/inputmethod.cpp (+3/-0)
maliit-keyboard/qml/Keyboard.qml (+3/-0)
To merge this branch: bzr merge lp:~thomas-moenicke/phablet-extras/maliit-plugins-extra-info
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+178342@code.launchpad.net

Commit message

exposing current keyboard state to QML

Description of the change

exposing current keyboard state to QML

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2139. By Thomas Moenicke

expose enum to QML

2140. By Thomas Moenicke

fixed signal/slot connection

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
2141. By Thomas Moenicke

fixed namespace issues in signal/slot
firing changed-signal when state is updated

2142. By Thomas Moenicke

support for all states (shifted, deadkey, default, primary, secondary)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

2142. By Thomas Moenicke

support for all states (shifted, deadkey, default, primary, secondary)

2141. By Thomas Moenicke

fixed namespace issues in signal/slot
firing changed-signal when state is updated

2140. By Thomas Moenicke

fixed signal/slot connection

2139. By Thomas Moenicke

expose enum to QML

2138. By Thomas Moenicke

exposing current keyboard state to QML
This way a QML or test component can be aware of the current state of the keyboard

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maliit-keyboard/lib/logic/layouthelper.h'
2--- maliit-keyboard/lib/logic/layouthelper.h 2013-05-24 11:16:27 +0000
3+++ maliit-keyboard/lib/logic/layouthelper.h 2013-08-05 16:43:25 +0000
4@@ -35,6 +35,7 @@
5 #include "models/key.h"
6 #include "models/keyarea.h"
7 #include "models/wordribbon.h"
8+#include "models/layout.h"
9
10 #include <QtCore>
11
12@@ -143,6 +144,7 @@
13 Q_SLOT void onKeysOverriden(const Logic::KeyOverrides &overriden_keys,
14 bool update);
15
16+ Q_SIGNAL void stateChanged(Model::Layout::State state);
17 private:
18 const QScopedPointer<LayoutHelperPrivate> d_ptr;
19 };
20
21=== modified file 'maliit-keyboard/lib/logic/layoutupdater.cpp'
22--- maliit-keyboard/lib/logic/layoutupdater.cpp 2013-07-29 11:52:26 +0000
23+++ maliit-keyboard/lib/logic/layoutupdater.cpp 2013-08-05 16:43:25 +0000
24@@ -735,6 +735,13 @@
25 converter.setLayoutOrientation(orientation);
26 d->layout->setCenterPanel(d->inShiftedState() ? converter.shiftedKeyArea()
27 : converter.keyArea());
28+
29+ if (d->inShiftedState())
30+ Q_EMIT d->layout->stateChanged(Model::Layout::ShiftedState);
31+ else if (d->inDeadkeyState())
32+ Q_EMIT d->layout->stateChanged(Model::Layout::DeadkeyState);
33+ else
34+ Q_EMIT d->layout->stateChanged(Model::Layout::DefaultState);
35 }
36
37 void LayoutUpdater::switchToPrimarySymView()
38@@ -752,6 +759,8 @@
39
40 // Reset shift state machine, also see switchToMainView.
41 d->shift_machine.restart();
42+
43+ Q_EMIT d->layout->stateChanged(Model::Layout::PrimarySymbolState);
44 }
45
46 void LayoutUpdater::switchToSecondarySymView()
47@@ -766,6 +775,8 @@
48 KeyAreaConverter converter(d->style->attributes(), &d->loader);
49 converter.setLayoutOrientation(orientation);
50 d->layout->setCenterPanel(converter.symbolsKeyArea(1));
51+
52+ Q_EMIT d->layout->stateChanged(Model::Layout::SecondarySymbolState);
53 }
54
55 void LayoutUpdater::switchToAccentedView()
56
57=== modified file 'maliit-keyboard/lib/models/layout.cpp'
58--- maliit-keyboard/lib/models/layout.cpp 2013-06-05 14:58:50 +0000
59+++ maliit-keyboard/lib/models/layout.cpp 2013-08-05 16:43:25 +0000
60@@ -63,6 +63,7 @@
61 KeyArea key_area;
62 QString image_directory;
63 QHash<int, QByteArray> roles;
64+ Layout::State state;
65
66 explicit LayoutPrivate();
67 };
68@@ -73,6 +74,7 @@
69 , key_area()
70 , image_directory()
71 , roles()
72+ , state(Layout::DefaultState)
73 {
74 // Model roles are used as variables in QML, hence the under_score naming
75 // convention:
76@@ -229,6 +231,19 @@
77 qGuiApp->primaryScreen()->orientation()) );
78 }
79
80+Layout::State Layout::state() const
81+{
82+ Q_D(const Layout);
83+ return d->state;
84+}
85+
86+void Layout::setState(Model::Layout::State state)
87+{
88+ Q_D(Layout);
89+ d->state = state;
90+ Q_EMIT stateChanged(state);
91+}
92+
93 void Layout::setImageDirectory(const QString &directory)
94 {
95 Q_D(Layout);
96
97=== modified file 'maliit-keyboard/lib/models/layout.h'
98--- maliit-keyboard/lib/models/layout.h 2013-06-05 14:58:50 +0000
99+++ maliit-keyboard/lib/models/layout.h 2013-08-05 16:43:25 +0000
100@@ -78,7 +78,20 @@
101 Q_PROPERTY(int invisible_toucharea_height READ invisibleTouchAreaHeight
102 NOTIFY invisibleTouchAreaHeightChanged)
103
104+ Q_PROPERTY(State state READ state WRITE setState
105+ NOTIFY stateChanged)
106+
107+ Q_ENUMS(State)
108+
109 public:
110+ enum State {
111+ DefaultState,
112+ ShiftedState,
113+ PrimarySymbolState,
114+ SecondarySymbolState,
115+ DeadkeyState
116+ };
117+
118 enum Roles {
119 RoleKeyRectangle = Qt::UserRole + 1,
120 RoleKeyReactiveArea,
121@@ -133,6 +146,10 @@
122 Q_SLOT int invisibleTouchAreaHeight() const;
123 Q_SIGNAL void invisibleTouchAreaHeightChanged(int &changed);
124
125+ Q_SLOT State state() const;
126+ Q_SLOT void setState(Model::Layout::State state);
127+ Q_SIGNAL void stateChanged(Model::Layout::State state);
128+
129 virtual QHash<int, QByteArray> roleNames() const;
130 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
131 virtual QVariant data(const QModelIndex &index,
132
133=== modified file 'maliit-keyboard/plugin/inputmethod.cpp'
134--- maliit-keyboard/plugin/inputmethod.cpp 2013-07-30 16:16:14 +0000
135+++ maliit-keyboard/plugin/inputmethod.cpp 2013-08-05 16:43:25 +0000
136@@ -240,6 +240,9 @@
137 QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)),
138 &editor, SLOT(onLanguageChanged(const QString&)));
139
140+ QObject::connect(&layout.helper, SIGNAL(stateChanged(Model::Layout::State)),
141+ &layout.model, SLOT(setState(Model::Layout::State)));
142+
143 #ifdef EXTENDED_SURFACE_TEMP_DISABLED
144 QObject::connect(&layout.event_handler, SIGNAL(extendedKeysShown(Key)),
145 &extended_layout.event_handler, SLOT(onExtendedKeysShown(Key)));
146
147=== modified file 'maliit-keyboard/qml/Keyboard.qml'
148--- maliit-keyboard/qml/Keyboard.qml 2013-07-30 11:04:20 +0000
149+++ maliit-keyboard/qml/Keyboard.qml 2013-08-05 16:43:25 +0000
150@@ -335,5 +335,8 @@
151 transitions: Transition {
152 PropertyAnimation { target: canvas; properties: "y"; easing.type: Easing.InOutQuad }
153 }
154+
155+ property int test_state: maliit_layout.state
156+ onTest_stateChanged: console.error(maliit_layout.state)
157 }
158

Subscribers

People subscribed via source and target branches