Merge lp:~saviq/unity8/revert-r376 into lp:unity8
- revert-r376
- Merge into trunk
Proposed by
Michał Sawicz
Status: | Merged |
---|---|
Approved by: | Loïc Minier |
Approved revision: | 395 |
Merged at revision: | 395 |
Proposed branch: | lp:~saviq/unity8/revert-r376 |
Merge into: | lp:unity8 |
Diff against target: |
409 lines (+9/-128) 7 files modified
Components/PageHeader.qml (+1/-44) Dash/GenericScopeView.qml (+0/-1) plugins/Unity/scope.cpp (+5/-30) plugins/Unity/scope.h (+2/-7) tests/mocks/Unity/fake_scope.cpp (+0/-13) tests/mocks/Unity/fake_scope.h (+1/-5) tests/qmltests/Components/tst_PageHeader.qml (+0/-28) |
To merge this branch: | bzr merge lp:~saviq/unity8/revert-r376 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Loïc Minier | Approve | ||
Review via email: mp+189455@code.launchpad.net |
Commit message
Revert r376 that caused constant CPU usage due to the ActivityIndicator.
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Components/PageHeader.qml' | |||
2 | --- Components/PageHeader.qml 2013-10-02 16:11:27 +0000 | |||
3 | +++ Components/PageHeader.qml 2013-10-05 08:36:17 +0000 | |||
4 | @@ -18,7 +18,6 @@ | |||
5 | 18 | import Ubuntu.Components 0.1 | 18 | import Ubuntu.Components 0.1 |
6 | 19 | import Ubuntu.Components.Popups 0.1 | 19 | import Ubuntu.Components.Popups 0.1 |
7 | 20 | import Ubuntu.Components.ListItems 0.1 as ListItem | 20 | import Ubuntu.Components.ListItems 0.1 as ListItem |
8 | 21 | import Unity 0.1 | ||
9 | 22 | 21 | ||
10 | 23 | Item { | 22 | Item { |
11 | 24 | /*! | 23 | /*! |
12 | @@ -31,7 +30,6 @@ | |||
13 | 31 | property bool searchEntryEnabled: false | 30 | property bool searchEntryEnabled: false |
14 | 32 | property alias searchQuery: searchField.text | 31 | property alias searchQuery: searchField.text |
15 | 33 | property ListModel searchHistory: SearchHistoryModel {} | 32 | property ListModel searchHistory: SearchHistoryModel {} |
16 | 34 | property Scope scope | ||
17 | 35 | 33 | ||
18 | 36 | height: units.gu(8.5) | 34 | height: units.gu(8.5) |
19 | 37 | implicitHeight: units.gu(8.5) | 35 | implicitHeight: units.gu(8.5) |
20 | @@ -150,7 +148,7 @@ | |||
21 | 150 | hasClearButton: false | 148 | hasClearButton: false |
22 | 151 | 149 | ||
23 | 152 | primaryItem: AbstractButton { | 150 | primaryItem: AbstractButton { |
25 | 153 | enabled: searchField.text != "" && !searchIndicator.running | 151 | enabled: searchField.text != "" |
26 | 154 | onClicked: { | 152 | onClicked: { |
27 | 155 | if (searchField.text != "") { | 153 | if (searchField.text != "") { |
28 | 156 | searchHistory.addQuery(searchField.text) | 154 | searchHistory.addQuery(searchField.text) |
29 | @@ -160,22 +158,8 @@ | |||
30 | 160 | height: parent.height | 158 | height: parent.height |
31 | 161 | width: height | 159 | width: height |
32 | 162 | 160 | ||
33 | 163 | ActivityIndicator { | ||
34 | 164 | id: searchIndicator | ||
35 | 165 | objectName: "searchIndicator" | ||
36 | 166 | |||
37 | 167 | anchors { | ||
38 | 168 | verticalCenter: parent.verticalCenter | ||
39 | 169 | left: parent.left | ||
40 | 170 | leftMargin: units.gu(0.5) | ||
41 | 171 | } | ||
42 | 172 | |||
43 | 173 | running: opacity > 0 | ||
44 | 174 | } | ||
45 | 175 | |||
46 | 176 | Image { | 161 | Image { |
47 | 177 | id: primaryImage | 162 | id: primaryImage |
48 | 178 | objectName: "primaryImage" | ||
49 | 179 | anchors { | 163 | anchors { |
50 | 180 | verticalCenter: parent.verticalCenter | 164 | verticalCenter: parent.verticalCenter |
51 | 181 | left: parent.left | 165 | left: parent.left |
52 | @@ -183,7 +167,6 @@ | |||
53 | 183 | } | 167 | } |
54 | 184 | width: units.gu(3) | 168 | width: units.gu(3) |
55 | 185 | height: units.gu(3) | 169 | height: units.gu(3) |
56 | 186 | visible: opacity > 0 | ||
57 | 187 | } | 170 | } |
58 | 188 | 171 | ||
59 | 189 | Item { | 172 | Item { |
60 | @@ -202,32 +185,6 @@ | |||
61 | 202 | onActiveFocusChanged: { | 185 | onActiveFocusChanged: { |
62 | 203 | if (!activeFocus) searchContainer.closePopover() | 186 | if (!activeFocus) searchContainer.closePopover() |
63 | 204 | } | 187 | } |
64 | 205 | |||
65 | 206 | states: [ | ||
66 | 207 | State { | ||
67 | 208 | name: "searching" | ||
68 | 209 | when: scope.searchInProgress && searchField.text !== "" | ||
69 | 210 | PropertyChanges { target: searchIndicator; running: true; opacity: 1 } | ||
70 | 211 | PropertyChanges { target: primaryImage; opacity: 0 } | ||
71 | 212 | }, | ||
72 | 213 | State { | ||
73 | 214 | name: "idle" | ||
74 | 215 | when: !scope.searchInProgress || searchField.text === "" | ||
75 | 216 | PropertyChanges { target: searchIndicator; opacity: 0 } | ||
76 | 217 | PropertyChanges { target: primaryImage; opacity: 1 } | ||
77 | 218 | } | ||
78 | 219 | ] | ||
79 | 220 | |||
80 | 221 | transitions: [ | ||
81 | 222 | Transition { | ||
82 | 223 | to: "searching" | ||
83 | 224 | reversible: true | ||
84 | 225 | SequentialAnimation { | ||
85 | 226 | NumberAnimation { target: primaryImage; property: "opacity"; duration: UbuntuAnimation.FastDuration; easing.type: Easing.Linear } | ||
86 | 227 | NumberAnimation { target: searchIndicator; property: "opacity"; duration: UbuntuAnimation.FastDuration; easing.type: Easing.Linear } | ||
87 | 228 | } | ||
88 | 229 | } | ||
89 | 230 | ] | ||
90 | 231 | } | 188 | } |
91 | 232 | 189 | ||
92 | 233 | states: [ | 190 | states: [ |
93 | 234 | 191 | ||
94 | === modified file 'Dash/GenericScopeView.qml' | |||
95 | --- Dash/GenericScopeView.qml 2013-10-04 15:44:55 +0000 | |||
96 | +++ Dash/GenericScopeView.qml 2013-10-05 08:36:17 +0000 | |||
97 | @@ -190,7 +190,6 @@ | |||
98 | 190 | width: categoryView.width | 190 | width: categoryView.width |
99 | 191 | text: scopeView.scope.name | 191 | text: scopeView.scope.name |
100 | 192 | searchEntryEnabled: true | 192 | searchEntryEnabled: true |
101 | 193 | scope: scopeView.scope | ||
102 | 194 | } | 193 | } |
103 | 195 | } | 194 | } |
104 | 196 | 195 | ||
105 | 197 | 196 | ||
106 | === modified file 'plugins/Unity/scope.cpp' | |||
107 | --- plugins/Unity/scope.cpp 2013-09-30 11:33:51 +0000 | |||
108 | +++ plugins/Unity/scope.cpp 2013-10-05 08:36:17 +0000 | |||
109 | @@ -33,14 +33,12 @@ | |||
110 | 33 | #include <QQmlEngine> | 33 | #include <QQmlEngine> |
111 | 34 | 34 | ||
112 | 35 | #include <UnityCore/Variant.h> | 35 | #include <UnityCore/Variant.h> |
113 | 36 | #include <UnityCore/GLibWrapper.h> | ||
114 | 37 | 36 | ||
115 | 38 | #include <libintl.h> | 37 | #include <libintl.h> |
116 | 39 | #include <glib.h> | 38 | #include <glib.h> |
117 | 40 | 39 | ||
118 | 41 | Scope::Scope(QObject *parent) : QObject(parent) | 40 | Scope::Scope(QObject *parent) : QObject(parent) |
119 | 42 | , m_formFactor("phone") | 41 | , m_formFactor("phone") |
120 | 43 | , m_searchInProgress(false) | ||
121 | 44 | { | 42 | { |
122 | 45 | m_categories.reset(new Categories(this)); | 43 | m_categories.reset(new Categories(this)); |
123 | 46 | } | 44 | } |
124 | @@ -70,11 +68,6 @@ | |||
125 | 70 | return QString::fromStdString(m_unityScope->search_hint()); | 68 | return QString::fromStdString(m_unityScope->search_hint()); |
126 | 71 | } | 69 | } |
127 | 72 | 70 | ||
128 | 73 | bool Scope::searchInProgress() const | ||
129 | 74 | { | ||
130 | 75 | return m_searchInProgress; | ||
131 | 76 | } | ||
132 | 77 | |||
133 | 78 | bool Scope::visible() const | 71 | bool Scope::visible() const |
134 | 79 | { | 72 | { |
135 | 80 | return m_unityScope->visible(); | 73 | return m_unityScope->visible(); |
136 | @@ -122,15 +115,10 @@ | |||
137 | 122 | string ("") and m_searchQuery is the null string, | 115 | string ("") and m_searchQuery is the null string, |
138 | 123 | search_query != m_searchQuery is still true. | 116 | search_query != m_searchQuery is still true. |
139 | 124 | */ | 117 | */ |
140 | 125 | using namespace std::placeholders; | ||
141 | 126 | |||
142 | 127 | if (m_searchQuery.isNull() || search_query != m_searchQuery) { | 118 | if (m_searchQuery.isNull() || search_query != m_searchQuery) { |
143 | 128 | m_searchQuery = search_query; | 119 | m_searchQuery = search_query; |
147 | 129 | m_cancellable.Renew(); | 120 | m_unityScope->Search(search_query.toStdString(), sigc::mem_fun(this, &Scope::searchFinished)); |
145 | 130 | m_searchInProgress = true; | ||
146 | 131 | m_unityScope->Search(search_query.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable); | ||
148 | 132 | Q_EMIT searchQueryChanged(); | 121 | Q_EMIT searchQueryChanged(); |
149 | 133 | Q_EMIT searchInProgressChanged(); | ||
150 | 134 | } | 122 | } |
151 | 135 | } | 123 | } |
152 | 136 | 124 | ||
153 | @@ -306,6 +294,8 @@ | |||
154 | 306 | m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged)); | 294 | m_unityScope->visible.changed.connect(sigc::mem_fun(this, &Scope::visibleChanged)); |
155 | 307 | m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged)); | 295 | m_unityScope->shortcut.changed.connect(sigc::mem_fun(this, &Scope::shortcutChanged)); |
156 | 308 | m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged)); | 296 | m_unityScope->connected.changed.connect(sigc::mem_fun(this, &Scope::connectedChanged)); |
157 | 297 | /* Signals forwarding */ | ||
158 | 298 | connect(this, SIGNAL(searchFinished(const std::string &, unity::glib::HintsMap const &, unity::glib::Error const &)), SLOT(onSearchFinished(const std::string &, unity::glib::HintsMap const &))); | ||
159 | 309 | 299 | ||
160 | 310 | /* FIXME: signal should be forwarded instead of calling the handler directly */ | 300 | /* FIXME: signal should be forwarded instead of calling the handler directly */ |
161 | 311 | m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated)); | 301 | m_unityScope->activated.connect(sigc::mem_fun(this, &Scope::onActivated)); |
162 | @@ -326,33 +316,18 @@ | |||
163 | 326 | 316 | ||
164 | 327 | void Scope::synchronizeStates() | 317 | void Scope::synchronizeStates() |
165 | 328 | { | 318 | { |
166 | 329 | using namespace std::placeholders; | ||
167 | 330 | |||
168 | 331 | if (connected()) { | 319 | if (connected()) { |
169 | 332 | /* Forward local states to m_unityScope */ | 320 | /* Forward local states to m_unityScope */ |
170 | 333 | if (!m_searchQuery.isNull()) { | 321 | if (!m_searchQuery.isNull()) { |
175 | 334 | m_cancellable.Renew(); | 322 | m_unityScope->Search(m_searchQuery.toStdString()); |
172 | 335 | m_searchInProgress = true; | ||
173 | 336 | m_unityScope->Search(m_searchQuery.toStdString(), std::bind(&Scope::onSearchFinished, this, _1, _2, _3), m_cancellable); | ||
174 | 337 | Q_EMIT searchInProgressChanged(); | ||
176 | 338 | } | 323 | } |
177 | 339 | } | 324 | } |
178 | 340 | } | 325 | } |
179 | 341 | 326 | ||
181 | 342 | void Scope::onSearchFinished(std::string const& /* query */, unity::glib::HintsMap const& hints, unity::glib::Error const& err) | 327 | void Scope::onSearchFinished(const std::string& /* query */, unity::glib::HintsMap const &hints) |
182 | 343 | { | 328 | { |
183 | 344 | QString hint; | 329 | QString hint; |
184 | 345 | 330 | ||
185 | 346 | GError* error = const_cast<unity::glib::Error&>(err); | ||
186 | 347 | |||
187 | 348 | if (!err || !g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { | ||
188 | 349 | m_searchInProgress = false; | ||
189 | 350 | Q_EMIT searchInProgressChanged(); | ||
190 | 351 | } else { | ||
191 | 352 | // no need to check the results hint, we're still searching | ||
192 | 353 | return; | ||
193 | 354 | } | ||
194 | 355 | |||
195 | 356 | if (!m_unityScope->results()->count()) { | 331 | if (!m_unityScope->results()->count()) { |
196 | 357 | unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint"); | 332 | unity::glib::HintsMap::const_iterator it = hints.find("no-results-hint"); |
197 | 358 | if (it != hints.end()) { | 333 | if (it != hints.end()) { |
198 | 359 | 334 | ||
199 | === modified file 'plugins/Unity/scope.h' | |||
200 | --- plugins/Unity/scope.h 2013-09-30 11:33:51 +0000 | |||
201 | +++ plugins/Unity/scope.h 2013-10-05 08:36:17 +0000 | |||
202 | @@ -28,7 +28,6 @@ | |||
203 | 28 | // libunity-core | 28 | // libunity-core |
204 | 29 | #include <UnityCore/Scope.h> | 29 | #include <UnityCore/Scope.h> |
205 | 30 | #include <UnityCore/Results.h> | 30 | #include <UnityCore/Results.h> |
206 | 31 | #include <UnityCore/GLibWrapper.h> | ||
207 | 32 | 31 | ||
208 | 33 | #include "categories.h" | 32 | #include "categories.h" |
209 | 34 | #include "filters.h" | 33 | #include "filters.h" |
210 | @@ -44,7 +43,6 @@ | |||
211 | 44 | Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged) | 43 | Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged) |
212 | 45 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) | 44 | Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) |
213 | 46 | Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged) | 45 | Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged) |
214 | 47 | Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) | ||
215 | 48 | Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) | 46 | Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) |
216 | 49 | Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged) | 47 | Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged) |
217 | 50 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) | 48 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) |
218 | @@ -67,7 +65,6 @@ | |||
219 | 67 | bool visible() const; | 65 | bool visible() const; |
220 | 68 | QString shortcut() const; | 66 | QString shortcut() const; |
221 | 69 | bool connected() const; | 67 | bool connected() const; |
222 | 70 | bool searchInProgress() const; | ||
223 | 71 | Categories* categories() const; | 68 | Categories* categories() const; |
224 | 72 | Filters* filters() const; | 69 | Filters* filters() const; |
225 | 73 | QString searchQuery() const; | 70 | QString searchQuery() const; |
226 | @@ -98,11 +95,11 @@ | |||
227 | 98 | void iconHintChanged(const std::string&); | 95 | void iconHintChanged(const std::string&); |
228 | 99 | void descriptionChanged(const std::string&); | 96 | void descriptionChanged(const std::string&); |
229 | 100 | void searchHintChanged(const std::string&); | 97 | void searchHintChanged(const std::string&); |
230 | 101 | void searchInProgressChanged(); | ||
231 | 102 | void visibleChanged(bool); | 98 | void visibleChanged(bool); |
232 | 103 | void shortcutChanged(const std::string&); | 99 | void shortcutChanged(const std::string&); |
233 | 104 | void connectedChanged(bool); | 100 | void connectedChanged(bool); |
234 | 105 | void categoriesChanged(); | 101 | void categoriesChanged(); |
235 | 102 | void searchFinished(const std::string&, unity::glib::HintsMap const&, unity::glib::Error const&); | ||
236 | 106 | void searchQueryChanged(); | 103 | void searchQueryChanged(); |
237 | 107 | void noResultsHintChanged(); | 104 | void noResultsHintChanged(); |
238 | 108 | void formFactorChanged(); | 105 | void formFactorChanged(); |
239 | @@ -118,7 +115,7 @@ | |||
240 | 118 | 115 | ||
241 | 119 | private Q_SLOTS: | 116 | private Q_SLOTS: |
242 | 120 | void synchronizeStates(); | 117 | void synchronizeStates(); |
244 | 121 | void onSearchFinished(std::string const &, unity::glib::HintsMap const &, unity::glib::Error const&); | 118 | void onSearchFinished(const std::string &, unity::glib::HintsMap const &); |
245 | 122 | 119 | ||
246 | 123 | private: | 120 | private: |
247 | 124 | unity::dash::LocalResult createLocalResult(const QVariant &uri, const QVariant &icon_hint, | 121 | unity::dash::LocalResult createLocalResult(const QVariant &uri, const QVariant &icon_hint, |
248 | @@ -136,8 +133,6 @@ | |||
249 | 136 | QString m_searchQuery; | 133 | QString m_searchQuery; |
250 | 137 | QString m_noResultsHint; | 134 | QString m_noResultsHint; |
251 | 138 | QString m_formFactor; | 135 | QString m_formFactor; |
252 | 139 | bool m_searchInProgress; | ||
253 | 140 | unity::glib::Cancellable m_cancellable; | ||
254 | 141 | unity::glib::Cancellable m_previewCancellable; | 136 | unity::glib::Cancellable m_previewCancellable; |
255 | 142 | }; | 137 | }; |
256 | 143 | 138 | ||
257 | 144 | 139 | ||
258 | === modified file 'tests/mocks/Unity/fake_scope.cpp' | |||
259 | --- tests/mocks/Unity/fake_scope.cpp 2013-09-30 15:10:55 +0000 | |||
260 | +++ tests/mocks/Unity/fake_scope.cpp 2013-10-05 08:36:17 +0000 | |||
261 | @@ -30,7 +30,6 @@ | |||
262 | 30 | Scope::Scope(QObject* parent) | 30 | Scope::Scope(QObject* parent) |
263 | 31 | : QObject(parent) | 31 | : QObject(parent) |
264 | 32 | , m_visible(false) | 32 | , m_visible(false) |
265 | 33 | , m_searching(false) | ||
266 | 34 | , m_categories(new Categories(this)) | 33 | , m_categories(new Categories(this)) |
267 | 35 | , m_results(new DeeListModel(this)) | 34 | , m_results(new DeeListModel(this)) |
268 | 36 | { | 35 | { |
269 | @@ -45,7 +44,6 @@ | |||
270 | 45 | , m_id(id) | 44 | , m_id(id) |
271 | 46 | , m_name(name) | 45 | , m_name(name) |
272 | 47 | , m_visible(visible) | 46 | , m_visible(visible) |
273 | 48 | , m_searching(false) | ||
274 | 49 | , m_categories(new Categories(this)) | 47 | , m_categories(new Categories(this)) |
275 | 50 | , m_results(new DeeListModel(this)) | 48 | , m_results(new DeeListModel(this)) |
276 | 51 | { | 49 | { |
277 | @@ -87,10 +85,6 @@ | |||
278 | 87 | return true; | 85 | return true; |
279 | 88 | } | 86 | } |
280 | 89 | 87 | ||
281 | 90 | bool Scope::searchInProgress() const { | ||
282 | 91 | return m_searching; | ||
283 | 92 | } | ||
284 | 93 | |||
285 | 94 | Categories* Scope::categories() const { | 88 | Categories* Scope::categories() const { |
286 | 95 | return m_categories; | 89 | return m_categories; |
287 | 96 | } | 90 | } |
288 | @@ -128,13 +122,6 @@ | |||
289 | 128 | } | 122 | } |
290 | 129 | } | 123 | } |
291 | 130 | 124 | ||
292 | 131 | void Scope::setSearchInProgress(const bool inProg) { | ||
293 | 132 | if (inProg != m_searching) { | ||
294 | 133 | m_searching = inProg; | ||
295 | 134 | Q_EMIT searchInProgressChanged(); | ||
296 | 135 | } | ||
297 | 136 | } | ||
298 | 137 | |||
299 | 138 | void Scope::setNoResultsHint(const QString& str) { | 125 | void Scope::setNoResultsHint(const QString& str) { |
300 | 139 | if (str != m_noResultsHint) { | 126 | if (str != m_noResultsHint) { |
301 | 140 | m_noResultsHint = str; | 127 | m_noResultsHint = str; |
302 | 141 | 128 | ||
303 | === modified file 'tests/mocks/Unity/fake_scope.h' | |||
304 | --- tests/mocks/Unity/fake_scope.h 2013-09-30 15:10:55 +0000 | |||
305 | +++ tests/mocks/Unity/fake_scope.h 2013-10-05 08:36:17 +0000 | |||
306 | @@ -37,7 +37,6 @@ | |||
307 | 37 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) | 37 | Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) |
308 | 38 | Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged) | 38 | Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged) |
309 | 39 | 39 | ||
310 | 40 | Q_PROPERTY(bool searchInProgress READ searchInProgress WRITE setSearchInProgress NOTIFY searchInProgressChanged) | ||
311 | 41 | Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged) | 40 | Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged) |
312 | 42 | Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged) | 41 | Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged) |
313 | 43 | Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) | 42 | Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) |
314 | @@ -55,7 +54,6 @@ | |||
315 | 55 | bool visible() const; | 54 | bool visible() const; |
316 | 56 | QString shortcut() const; | 55 | QString shortcut() const; |
317 | 57 | bool connected() const; | 56 | bool connected() const; |
318 | 58 | bool searchInProgress() const; | ||
319 | 59 | Categories* categories() const; | 57 | Categories* categories() const; |
320 | 60 | QString searchQuery() const; | 58 | QString searchQuery() const; |
321 | 61 | QString noResultsHint() const; | 59 | QString noResultsHint() const; |
322 | @@ -66,7 +64,6 @@ | |||
323 | 66 | void setSearchQuery(const QString& search_query); | 64 | void setSearchQuery(const QString& search_query); |
324 | 67 | void setNoResultsHint(const QString& hint); | 65 | void setNoResultsHint(const QString& hint); |
325 | 68 | void setFormFactor(const QString& form_factor); | 66 | void setFormFactor(const QString& form_factor); |
326 | 69 | void setSearchInProgress(const bool inProg); | ||
327 | 70 | 67 | ||
328 | 71 | Q_INVOKABLE void activate(const QVariant &uri, const QVariant &icon_hint, const QVariant &category, | 68 | Q_INVOKABLE void activate(const QVariant &uri, const QVariant &icon_hint, const QVariant &category, |
329 | 72 | const QVariant &result_type, const QVariant &mimetype, const QVariant &title, | 69 | const QVariant &result_type, const QVariant &mimetype, const QVariant &title, |
330 | @@ -81,11 +78,11 @@ | |||
331 | 81 | void iconHintChanged(const QString&); | 78 | void iconHintChanged(const QString&); |
332 | 82 | void descriptionChanged(const QString&); | 79 | void descriptionChanged(const QString&); |
333 | 83 | void searchHintChanged(const QString&); | 80 | void searchHintChanged(const QString&); |
334 | 84 | void searchInProgressChanged(); | ||
335 | 85 | void visibleChanged(bool); | 81 | void visibleChanged(bool); |
336 | 86 | void shortcutChanged(const QString&); | 82 | void shortcutChanged(const QString&); |
337 | 87 | void connectedChanged(bool); | 83 | void connectedChanged(bool); |
338 | 88 | void categoriesChanged(); | 84 | void categoriesChanged(); |
339 | 85 | void searchFinished(const QString&); | ||
340 | 89 | void searchQueryChanged(); | 86 | void searchQueryChanged(); |
341 | 90 | void noResultsHintChanged(); | 87 | void noResultsHintChanged(); |
342 | 91 | void formFactorChanged(); | 88 | void formFactorChanged(); |
343 | @@ -106,7 +103,6 @@ | |||
344 | 106 | QString m_noResultsHint; | 103 | QString m_noResultsHint; |
345 | 107 | QString m_formFactor; | 104 | QString m_formFactor; |
346 | 108 | bool m_visible; | 105 | bool m_visible; |
347 | 109 | bool m_searching; | ||
348 | 110 | 106 | ||
349 | 111 | Categories* m_categories; | 107 | Categories* m_categories; |
350 | 112 | DeeListModel* m_results; | 108 | DeeListModel* m_results; |
351 | 113 | 109 | ||
352 | === modified file 'tests/qmltests/Components/tst_PageHeader.qml' | |||
353 | --- tests/qmltests/Components/tst_PageHeader.qml 2013-10-01 13:42:52 +0000 | |||
354 | +++ tests/qmltests/Components/tst_PageHeader.qml 2013-10-05 08:36:17 +0000 | |||
355 | @@ -19,17 +19,12 @@ | |||
356 | 19 | import ".." | 19 | import ".." |
357 | 20 | import "../../../Components" | 20 | import "../../../Components" |
358 | 21 | import Ubuntu.Components 0.1 | 21 | import Ubuntu.Components 0.1 |
359 | 22 | import Unity 0.1 | ||
360 | 23 | import Unity.Test 0.1 as UT | 22 | import Unity.Test 0.1 as UT |
361 | 24 | 23 | ||
362 | 25 | Item { | 24 | Item { |
363 | 26 | width: units.gu(110) | 25 | width: units.gu(110) |
364 | 27 | height: units.gu(30) | 26 | height: units.gu(30) |
365 | 28 | 27 | ||
366 | 29 | Scope { | ||
367 | 30 | id: scopeMock | ||
368 | 31 | } | ||
369 | 32 | |||
370 | 33 | UT.UnityTestCase { | 28 | UT.UnityTestCase { |
371 | 34 | name: "PageHeaderTest" | 29 | name: "PageHeaderTest" |
372 | 35 | when: windowShown | 30 | when: windowShown |
373 | @@ -137,27 +132,6 @@ | |||
374 | 137 | compare(pageHeader.searchHistory.count, 3) | 132 | compare(pageHeader.searchHistory.count, 3) |
375 | 138 | compare(pageHeader.searchHistory.get(0).query, "humppa4") | 133 | compare(pageHeader.searchHistory.get(0).query, "humppa4") |
376 | 139 | } | 134 | } |
377 | 140 | |||
378 | 141 | function test_search_indicator() { | ||
379 | 142 | var searchIndicator = findChild(pageHeader, "searchIndicator") | ||
380 | 143 | var primaryImage = findChild(pageHeader, "primaryImage") | ||
381 | 144 | |||
382 | 145 | pageHeader.triggerSearch() | ||
383 | 146 | |||
384 | 147 | scopeMock.searchInProgress = false | ||
385 | 148 | compare(searchIndicator.running, false, "Search indicator is running.") | ||
386 | 149 | tryCompare(primaryImage, "visible", true) | ||
387 | 150 | |||
388 | 151 | scopeMock.searchInProgress = true | ||
389 | 152 | compare(searchIndicator.running, true, "Search indicator isn't running.") | ||
390 | 153 | tryCompare(primaryImage, "visible", false) | ||
391 | 154 | |||
392 | 155 | pageHeader.resetSearch() | ||
393 | 156 | } | ||
394 | 157 | |||
395 | 158 | function cleanup() { | ||
396 | 159 | scopeMock.searchInProgress = false | ||
397 | 160 | } | ||
398 | 161 | } | 135 | } |
399 | 162 | 136 | ||
400 | 163 | Column { | 137 | Column { |
401 | @@ -171,8 +145,6 @@ | |||
402 | 171 | right: parent.right | 145 | right: parent.right |
403 | 172 | } | 146 | } |
404 | 173 | 147 | ||
405 | 174 | scope: scopeMock | ||
406 | 175 | |||
407 | 176 | searchEntryEnabled: true | 148 | searchEntryEnabled: true |
408 | 177 | text: "%^$%^%^&%^&%^$%GHR%" | 149 | text: "%^$%^%^&%^&%^$%GHR%" |
409 | 178 | } | 150 | } |
Tested binaries that Saviq provided for indicator-network and for unity8 with the unity-notifications before revert, and I didn't get the high CPU usage anymore.