Merge lp:~stolowski/unity-api/single-preview into lp:unity-api
- single-preview
- Merge into trunk
Proposed by
Paweł Stołowski
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~stolowski/unity-api/single-preview | ||||
Merge into: | lp:unity-api | ||||
Diff against target: |
487 lines (+29/-284) 11 files modified
debian/changelog (+7/-0) include/unity/shell/scopes/CMakeLists.txt (+1/-1) include/unity/shell/scopes/PreviewStackInterface.h (+0/-99) include/unity/shell/scopes/ScopeInterface.h (+10/-3) test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt (+0/-2) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.cpp (+0/-63) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.h (+0/-47) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp (+7/-3) test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h (+2/-1) test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp (+1/-3) test/qmltest/unity/shell/scopes/tst_Scopes.qml (+1/-62) |
||||
To merge this branch: | bzr merge lp:~stolowski/unity-api/single-preview | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+286359@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-02-18.
Commit message
Removed PreviewStackInt
Description of the change
Removed PreviewStackInt
To post a comment you must log in.
- 209. By Paweł Stołowski
-
Merged trunk
- 210. By Paweł Stołowski
-
Bump version
- 211. By Paweł Stołowski
-
Merged activation-progress
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2016-02-11 23:53:29 +0000 | |||
3 | +++ debian/changelog 2016-02-18 15:46:52 +0000 | |||
4 | @@ -1,3 +1,10 @@ | |||
5 | 1 | unity-api (7.107) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Removed PreviewStackInterface, modified ScopeInterface to return | ||
8 | 4 | PreviewModelInterface on preview(). | ||
9 | 5 | |||
10 | 6 | -- Pawel Stolowski <pawel.stolowski@canonical.com> Wed, 17 Feb 2016 17:46:13 +0100 | ||
11 | 7 | |||
12 | 1 | unity-api (7.106+16.04.20160211.1-0ubuntu1) xenial; urgency=medium | 8 | unity-api (7.106+16.04.20160211.1-0ubuntu1) xenial; urgency=medium |
13 | 2 | 9 | ||
14 | 3 | [ Daniel d'Andrada ] | 10 | [ Daniel d'Andrada ] |
15 | 4 | 11 | ||
16 | === modified file 'include/unity/shell/scopes/CMakeLists.txt' | |||
17 | --- include/unity/shell/scopes/CMakeLists.txt 2015-11-30 09:18:57 +0000 | |||
18 | +++ include/unity/shell/scopes/CMakeLists.txt 2016-02-18 15:46:52 +0000 | |||
19 | @@ -7,7 +7,7 @@ | |||
20 | 7 | 7 | ||
21 | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
22 | 9 | 9 | ||
24 | 10 | set(VERSION 9) | 10 | set(VERSION 10) |
25 | 11 | set(PKGCONFIG_NAME "unity-shell-scopes") | 11 | set(PKGCONFIG_NAME "unity-shell-scopes") |
26 | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs") | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Scopes APIs") |
27 | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") |
28 | 14 | 14 | ||
29 | === removed file 'include/unity/shell/scopes/PreviewStackInterface.h' | |||
30 | --- include/unity/shell/scopes/PreviewStackInterface.h 2014-05-19 09:24:42 +0000 | |||
31 | +++ include/unity/shell/scopes/PreviewStackInterface.h 1970-01-01 00:00:00 +0000 | |||
32 | @@ -1,99 +0,0 @@ | |||
33 | 1 | /* | ||
34 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
35 | 3 | * | ||
36 | 4 | * This program is free software; you can redistribute it and/or modify | ||
37 | 5 | * it under the terms of the GNU General Public License as published by | ||
38 | 6 | * the Free Software Foundation; version 3. | ||
39 | 7 | * | ||
40 | 8 | * This program is distributed in the hope that it will be useful, | ||
41 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
42 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
43 | 11 | * GNU General Public License for more details. | ||
44 | 12 | * | ||
45 | 13 | * You should have received a copy of the GNU General Public License | ||
46 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
47 | 15 | */ | ||
48 | 16 | |||
49 | 17 | #ifndef UNITY_SHELL_SCOPES_PREVIEWSTACKINTERFACE_H | ||
50 | 18 | #define UNITY_SHELL_SCOPES_PREVIEWSTACKINTERFACE_H | ||
51 | 19 | |||
52 | 20 | #include <unity/SymbolExport.h> | ||
53 | 21 | |||
54 | 22 | #include <QAbstractListModel> | ||
55 | 23 | |||
56 | 24 | namespace unity | ||
57 | 25 | { | ||
58 | 26 | namespace shell | ||
59 | 27 | { | ||
60 | 28 | namespace scopes | ||
61 | 29 | { | ||
62 | 30 | |||
63 | 31 | class PreviewModelInterface; | ||
64 | 32 | |||
65 | 33 | /** | ||
66 | 34 | * @brief A master model for previews. | ||
67 | 35 | * | ||
68 | 36 | * Each item in this model represents an individual preview, where each is stacked | ||
69 | 37 | * on top of the previous one. Item on index 0 is always the one on the very bottom | ||
70 | 38 | * of the stack. | ||
71 | 39 | */ | ||
72 | 40 | class UNITY_API PreviewStackInterface : public QAbstractListModel | ||
73 | 41 | { | ||
74 | 42 | Q_OBJECT | ||
75 | 43 | |||
76 | 44 | Q_ENUMS(Roles) | ||
77 | 45 | |||
78 | 46 | /** | ||
79 | 47 | * @brief Number of columns the individual previews should expose. | ||
80 | 48 | * | ||
81 | 49 | * Previews can be laid out in a different number of columns - for example the number | ||
82 | 50 | * of desired columns can change when changing orientation of the display and | ||
83 | 51 | * therefore there's more horizontal space available. | ||
84 | 52 | */ | ||
85 | 53 | Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged) | ||
86 | 54 | |||
87 | 55 | protected: | ||
88 | 56 | /// @cond | ||
89 | 57 | explicit PreviewStackInterface(QObject* parent = 0) : QAbstractListModel(parent) { } | ||
90 | 58 | /// @endcond | ||
91 | 59 | |||
92 | 60 | public: | ||
93 | 61 | /** | ||
94 | 62 | * @brief The roles supported by this model. | ||
95 | 63 | */ | ||
96 | 64 | enum Roles { | ||
97 | 65 | RolePreviewModel | ||
98 | 66 | }; | ||
99 | 67 | |||
100 | 68 | /** | ||
101 | 69 | * @brief Get preview model at a particular index. | ||
102 | 70 | * | ||
103 | 71 | * Return PreviewModelInterface instance at a particular index or nullptr | ||
104 | 72 | * if the index is out of bounds. | ||
105 | 73 | */ | ||
106 | 74 | Q_INVOKABLE virtual unity::shell::scopes::PreviewModelInterface* getPreviewModel(int index) const = 0; | ||
107 | 75 | |||
108 | 76 | // @cond | ||
109 | 77 | virtual void setWidgetColumnCount(int columnCount) = 0; | ||
110 | 78 | virtual int widgetColumnCount() const = 0; | ||
111 | 79 | QHash<int, QByteArray> roleNames() const override | ||
112 | 80 | { | ||
113 | 81 | QHash<int, QByteArray> roles; | ||
114 | 82 | roles[RolePreviewModel] = "previewModel"; | ||
115 | 83 | return roles; | ||
116 | 84 | } | ||
117 | 85 | // @endcond | ||
118 | 86 | |||
119 | 87 | Q_SIGNALS: | ||
120 | 88 | // @cond | ||
121 | 89 | void widgetColumnCountChanged(); | ||
122 | 90 | // @endcond | ||
123 | 91 | }; | ||
124 | 92 | |||
125 | 93 | } | ||
126 | 94 | } | ||
127 | 95 | } | ||
128 | 96 | |||
129 | 97 | Q_DECLARE_METATYPE(unity::shell::scopes::PreviewStackInterface*) | ||
130 | 98 | |||
131 | 99 | #endif | ||
132 | 100 | 0 | ||
133 | === modified file 'include/unity/shell/scopes/ScopeInterface.h' | |||
134 | --- include/unity/shell/scopes/ScopeInterface.h 2015-10-05 12:54:22 +0000 | |||
135 | +++ include/unity/shell/scopes/ScopeInterface.h 2016-02-18 15:46:52 +0000 | |||
136 | @@ -30,7 +30,7 @@ | |||
137 | 30 | { | 30 | { |
138 | 31 | 31 | ||
139 | 32 | class CategoriesInterface; | 32 | class CategoriesInterface; |
141 | 33 | class PreviewStackInterface; | 33 | class PreviewModelInterface; |
142 | 34 | class NavigationInterface; | 34 | class NavigationInterface; |
143 | 35 | class SettingsModelInterface; | 35 | class SettingsModelInterface; |
144 | 36 | 36 | ||
145 | @@ -74,6 +74,11 @@ | |||
146 | 74 | Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) | 74 | Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged) |
147 | 75 | 75 | ||
148 | 76 | /** | 76 | /** |
149 | 77 | * @brief Boolean specifying whether an activation request is currently running. | ||
150 | 78 | */ | ||
151 | 79 | Q_PROPERTY(bool activationInProgress READ activationInProgress NOTIFY activationInProgressChanged) | ||
152 | 80 | |||
153 | 81 | /** | ||
154 | 77 | * @brief Boolean specifying whether the scope is favourited. | 82 | * @brief Boolean specifying whether the scope is favourited. |
155 | 78 | */ | 83 | */ |
156 | 79 | Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged) | 84 | Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged) |
157 | @@ -173,6 +178,7 @@ | |||
158 | 173 | virtual QString searchHint() const = 0; | 178 | virtual QString searchHint() const = 0; |
159 | 174 | virtual QString shortcut() const = 0; | 179 | virtual QString shortcut() const = 0; |
160 | 175 | virtual bool searchInProgress() const = 0; | 180 | virtual bool searchInProgress() const = 0; |
161 | 181 | virtual bool activationInProgress() const = 0; | ||
162 | 176 | virtual bool favorite() const = 0; | 182 | virtual bool favorite() const = 0; |
163 | 177 | virtual CategoriesInterface* categories() const = 0; | 183 | virtual CategoriesInterface* categories() const = 0; |
164 | 178 | virtual SettingsModelInterface* settings() const = 0; | 184 | virtual SettingsModelInterface* settings() const = 0; |
165 | @@ -203,10 +209,10 @@ | |||
166 | 203 | /** | 209 | /** |
167 | 204 | * @brief Method used to preview a result. | 210 | * @brief Method used to preview a result. |
168 | 205 | * | 211 | * |
170 | 206 | * Returns a new PreviewStackInterface instance. It's caller's responsibility | 212 | * Returns a new PreviewModelInterface instance. It's caller's responsibility |
171 | 207 | * to free it. | 213 | * to free it. |
172 | 208 | */ | 214 | */ |
174 | 209 | Q_INVOKABLE virtual unity::shell::scopes::PreviewStackInterface* preview(QVariant const& result, QString const& categoryId) = 0; | 215 | Q_INVOKABLE virtual unity::shell::scopes::PreviewModelInterface* preview(QVariant const& result, QString const& categoryId) = 0; |
175 | 210 | 216 | ||
176 | 211 | /** | 217 | /** |
177 | 212 | * @brief Cancels the current activation. | 218 | * @brief Cancels the current activation. |
178 | @@ -256,6 +262,7 @@ | |||
179 | 256 | void descriptionChanged(); | 262 | void descriptionChanged(); |
180 | 257 | void searchHintChanged(); | 263 | void searchHintChanged(); |
181 | 258 | void searchInProgressChanged(); | 264 | void searchInProgressChanged(); |
182 | 265 | void activationInProgressChanged(); | ||
183 | 259 | void favoriteChanged(); | 266 | void favoriteChanged(); |
184 | 260 | void shortcutChanged(); | 267 | void shortcutChanged(); |
185 | 261 | void categoriesChanged(); | 268 | void categoriesChanged(); |
186 | 262 | 269 | ||
187 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt' | |||
188 | --- test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2014-07-25 15:17:40 +0000 | |||
189 | +++ test/qmltest/mocks/plugins/Unity/Scopes/CMakeLists.txt 2016-02-18 15:46:52 +0000 | |||
190 | @@ -15,7 +15,6 @@ | |||
191 | 15 | Mocks/MockDepartment.cpp | 15 | Mocks/MockDepartment.cpp |
192 | 16 | Mocks/MockResultsModel.cpp | 16 | Mocks/MockResultsModel.cpp |
193 | 17 | Mocks/MockPreviewModel.cpp | 17 | Mocks/MockPreviewModel.cpp |
194 | 18 | Mocks/MockPreviewStack.cpp | ||
195 | 19 | Mocks/MockPreviewWidgetModel.cpp | 18 | Mocks/MockPreviewWidgetModel.cpp |
196 | 20 | Mocks/MockScope.cpp | 19 | Mocks/MockScope.cpp |
197 | 21 | Mocks/MockScopes.cpp | 20 | Mocks/MockScopes.cpp |
198 | @@ -25,7 +24,6 @@ | |||
199 | 25 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h | 24 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ResultsModelInterface.h |
200 | 26 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h | 25 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewModelInterface.h |
201 | 27 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewWidgetModelInterface.h | 26 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewWidgetModelInterface.h |
202 | 28 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/PreviewStackInterface.h | ||
203 | 29 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopeInterface.h | 27 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopeInterface.h |
204 | 30 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopesInterface.h | 28 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/ScopesInterface.h |
205 | 31 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/SettingsModelInterface.h | 29 | ${CMAKE_SOURCE_DIR}/include/unity/shell/scopes/SettingsModelInterface.h |
206 | 32 | 30 | ||
207 | === removed file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.cpp' | |||
208 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.cpp 2014-05-19 11:45:10 +0000 | |||
209 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.cpp 1970-01-01 00:00:00 +0000 | |||
210 | @@ -1,63 +0,0 @@ | |||
211 | 1 | /* | ||
212 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
213 | 3 | * | ||
214 | 4 | * This program is free software; you can redistribute it and/or modify | ||
215 | 5 | * it under the terms of the GNU General Public License as published by | ||
216 | 6 | * the Free Software Foundation; version 3. | ||
217 | 7 | * | ||
218 | 8 | * This program is distributed in the hope that it will be useful, | ||
219 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
220 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
221 | 11 | * GNU General Public License for more details. | ||
222 | 12 | * | ||
223 | 13 | * You should have received a copy of the GNU General Public License | ||
224 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
225 | 15 | */ | ||
226 | 16 | |||
227 | 17 | // self | ||
228 | 18 | #include "MockPreviewStack.h" | ||
229 | 19 | |||
230 | 20 | // local | ||
231 | 21 | #include "MockPreviewModel.h" | ||
232 | 22 | |||
233 | 23 | MockPreviewStack::MockPreviewStack(QObject* parent) | ||
234 | 24 | : unity::shell::scopes::PreviewStackInterface(parent) | ||
235 | 25 | { | ||
236 | 26 | m_previews << new MockPreviewModel(this); | ||
237 | 27 | } | ||
238 | 28 | |||
239 | 29 | void MockPreviewStack::setWidgetColumnCount(int columnCount) | ||
240 | 30 | { | ||
241 | 31 | if (columnCount != 1) { | ||
242 | 32 | qFatal("MockPreviewStack::setWidgetColumnCount != 1 not implemented"); | ||
243 | 33 | } | ||
244 | 34 | } | ||
245 | 35 | |||
246 | 36 | int MockPreviewStack::widgetColumnCount() const | ||
247 | 37 | { | ||
248 | 38 | return 1; | ||
249 | 39 | } | ||
250 | 40 | |||
251 | 41 | int MockPreviewStack::rowCount(const QModelIndex&) const | ||
252 | 42 | { | ||
253 | 43 | return m_previews.size(); | ||
254 | 44 | } | ||
255 | 45 | |||
256 | 46 | unity::shell::scopes::PreviewModelInterface* MockPreviewStack::getPreviewModel(int index) const | ||
257 | 47 | { | ||
258 | 48 | if (index >= m_previews.size()) { | ||
259 | 49 | return nullptr; | ||
260 | 50 | } | ||
261 | 51 | |||
262 | 52 | return m_previews.at(index); | ||
263 | 53 | } | ||
264 | 54 | |||
265 | 55 | QVariant MockPreviewStack::data(const QModelIndex& index, int role) const | ||
266 | 56 | { | ||
267 | 57 | switch (role) { | ||
268 | 58 | case RolePreviewModel: | ||
269 | 59 | return QVariant::fromValue(m_previews.at(index.row())); | ||
270 | 60 | default: | ||
271 | 61 | return QVariant(); | ||
272 | 62 | } | ||
273 | 63 | } | ||
274 | 64 | 0 | ||
275 | === removed file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.h' | |||
276 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.h 2014-05-19 11:45:10 +0000 | |||
277 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockPreviewStack.h 1970-01-01 00:00:00 +0000 | |||
278 | @@ -1,47 +0,0 @@ | |||
279 | 1 | /* | ||
280 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
281 | 3 | * | ||
282 | 4 | * This program is free software; you can redistribute it and/or modify | ||
283 | 5 | * it under the terms of the GNU General Public License as published by | ||
284 | 6 | * the Free Software Foundation; version 3. | ||
285 | 7 | * | ||
286 | 8 | * This program is distributed in the hope that it will be useful, | ||
287 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
288 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
289 | 11 | * GNU General Public License for more details. | ||
290 | 12 | * | ||
291 | 13 | * You should have received a copy of the GNU General Public License | ||
292 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
293 | 15 | */ | ||
294 | 16 | |||
295 | 17 | |||
296 | 18 | #ifndef MOCKPREVIEWSTACK_H | ||
297 | 19 | #define MOCKPREVIEWSTACK_H | ||
298 | 20 | |||
299 | 21 | #include <unity/shell/scopes/PreviewStackInterface.h> | ||
300 | 22 | |||
301 | 23 | #include <QSharedPointer> | ||
302 | 24 | #include <QVariantMap> | ||
303 | 25 | |||
304 | 26 | class MockPreviewModel; | ||
305 | 27 | |||
306 | 28 | class MockPreviewStack : public unity::shell::scopes::PreviewStackInterface | ||
307 | 29 | { | ||
308 | 30 | Q_OBJECT | ||
309 | 31 | |||
310 | 32 | public: | ||
311 | 33 | explicit MockPreviewStack (QObject* parent = 0); | ||
312 | 34 | |||
313 | 35 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
314 | 36 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
315 | 37 | |||
316 | 38 | Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* getPreviewModel(int index) const override; | ||
317 | 39 | |||
318 | 40 | void setWidgetColumnCount(int columnCount) override; | ||
319 | 41 | int widgetColumnCount() const override; | ||
320 | 42 | |||
321 | 43 | private: | ||
322 | 44 | QList<MockPreviewModel*> m_previews; | ||
323 | 45 | }; | ||
324 | 46 | |||
325 | 47 | #endif | ||
326 | 48 | 0 | ||
327 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp' | |||
328 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2015-10-05 12:54:22 +0000 | |||
329 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.cpp 2016-02-18 15:46:52 +0000 | |||
330 | @@ -16,7 +16,7 @@ | |||
331 | 16 | 16 | ||
332 | 17 | #include "MockScope.h" | 17 | #include "MockScope.h" |
333 | 18 | #include "MockCategories.h" | 18 | #include "MockCategories.h" |
335 | 19 | #include "MockPreviewStack.h" | 19 | #include "MockPreviewModel.h" |
336 | 20 | #include "MockDepartment.h" | 20 | #include "MockDepartment.h" |
337 | 21 | #include "MockSettingsModel.h" | 21 | #include "MockSettingsModel.h" |
338 | 22 | 22 | ||
339 | @@ -77,6 +77,10 @@ | |||
340 | 77 | return m_searching; | 77 | return m_searching; |
341 | 78 | } | 78 | } |
342 | 79 | 79 | ||
343 | 80 | bool MockScope::activationInProgress() const { | ||
344 | 81 | return false; | ||
345 | 82 | } | ||
346 | 83 | |||
347 | 80 | unity::shell::scopes::CategoriesInterface* MockScope::categories() const { | 84 | unity::shell::scopes::CategoriesInterface* MockScope::categories() const { |
348 | 81 | return m_categories; | 85 | return m_categories; |
349 | 82 | } | 86 | } |
350 | @@ -172,14 +176,14 @@ | |||
351 | 172 | Q_UNUSED(actionId); | 176 | Q_UNUSED(actionId); |
352 | 173 | } | 177 | } |
353 | 174 | 178 | ||
355 | 175 | unity::shell::scopes::PreviewStackInterface* MockScope::preview(QVariant const& result, QString const& categoryId) | 179 | unity::shell::scopes::PreviewModelInterface* MockScope::preview(QVariant const& result, QString const& categoryId) |
356 | 176 | { | 180 | { |
357 | 177 | Q_UNUSED(result); | 181 | Q_UNUSED(result); |
358 | 178 | Q_UNUSED(categoryId); | 182 | Q_UNUSED(categoryId); |
359 | 179 | 183 | ||
360 | 180 | // This probably leaks, do we don't care | 184 | // This probably leaks, do we don't care |
361 | 181 | // it's a test after all | 185 | // it's a test after all |
363 | 182 | return new MockPreviewStack; | 186 | return new MockPreviewModel; |
364 | 183 | } | 187 | } |
365 | 184 | 188 | ||
366 | 185 | unity::shell::scopes::NavigationInterface* MockScope::getNavigation(QString const& navigationId) | 189 | unity::shell::scopes::NavigationInterface* MockScope::getNavigation(QString const& navigationId) |
367 | 186 | 190 | ||
368 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h' | |||
369 | --- test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2015-10-05 12:54:22 +0000 | |||
370 | +++ test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockScope.h 2016-02-18 15:46:52 +0000 | |||
371 | @@ -36,6 +36,7 @@ | |||
372 | 36 | bool favorite() const override; | 36 | bool favorite() const override; |
373 | 37 | QString shortcut() const override; | 37 | QString shortcut() const override; |
374 | 38 | bool searchInProgress() const override; | 38 | bool searchInProgress() const override; |
375 | 39 | bool activationInProgress() const override; | ||
376 | 39 | unity::shell::scopes::CategoriesInterface* categories() const override; | 40 | unity::shell::scopes::CategoriesInterface* categories() const override; |
377 | 40 | unity::shell::scopes::SettingsModelInterface* settings() const override; | 41 | unity::shell::scopes::SettingsModelInterface* settings() const override; |
378 | 41 | QString searchQuery() const override; | 42 | QString searchQuery() const override; |
379 | @@ -59,7 +60,7 @@ | |||
380 | 59 | 60 | ||
381 | 60 | Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override; | 61 | Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override; |
382 | 61 | Q_INVOKABLE void activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) override; | 62 | Q_INVOKABLE void activateAction(QVariant const& result, QString const& categoryId, QString const& actionId) override; |
384 | 62 | Q_INVOKABLE unity::shell::scopes::PreviewStackInterface* preview(QVariant const& result, QString const& categoryId) override; | 63 | Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* preview(QVariant const& result, QString const& categoryId) override; |
385 | 63 | Q_INVOKABLE void cancelActivation() override; | 64 | Q_INVOKABLE void cancelActivation() override; |
386 | 64 | Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; | 65 | Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override; |
387 | 65 | Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override; | 66 | Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& departmentId) override; |
388 | 66 | 67 | ||
389 | === modified file 'test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp' | |||
390 | --- test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2014-07-25 15:17:40 +0000 | |||
391 | +++ test/qmltest/mocks/plugins/Unity/Scopes/TestScopesPlugin.cpp 2016-02-18 15:46:52 +0000 | |||
392 | @@ -24,7 +24,6 @@ | |||
393 | 24 | #include "ResultsModelInterface.h" | 24 | #include "ResultsModelInterface.h" |
394 | 25 | #include "PreviewModelInterface.h" | 25 | #include "PreviewModelInterface.h" |
395 | 26 | #include "PreviewWidgetModelInterface.h" | 26 | #include "PreviewWidgetModelInterface.h" |
396 | 27 | #include "PreviewStackInterface.h" | ||
397 | 28 | #include "SettingsModelInterface.h" | 27 | #include "SettingsModelInterface.h" |
398 | 29 | #include "Mocks/MockScopes.h" | 28 | #include "Mocks/MockScopes.h" |
399 | 30 | #include "Mocks/MockScope.h" | 29 | #include "Mocks/MockScope.h" |
400 | @@ -36,8 +35,7 @@ | |||
401 | 36 | qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML. Get them from Scope instance."); | 35 | qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML. Get them from Scope instance."); |
402 | 37 | qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML. Get them from Scope instance."); | 36 | qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML. Get them from Scope instance."); |
403 | 38 | qmlRegisterUncreatableType<unity::shell::scopes::ResultsModelInterface>(uri, 0, 2, "ResultsModel", "Can't create new ResultsModel in QML. Get them from Categories instance."); | 37 | qmlRegisterUncreatableType<unity::shell::scopes::ResultsModelInterface>(uri, 0, 2, "ResultsModel", "Can't create new ResultsModel in QML. Get them from Categories instance."); |
405 | 39 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance."); | 38 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from Scope instance."); |
406 | 40 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewWidgetModelInterface>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance."); | 39 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewWidgetModelInterface>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance."); |
407 | 41 | qmlRegisterUncreatableType<unity::shell::scopes::PreviewStackInterface>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance."); | ||
408 | 42 | qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "Settings", "Can't create new Settings in QML. Get them from Scope instance."); | 40 | qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "Settings", "Can't create new Settings in QML. Get them from Scope instance."); |
409 | 43 | } | 41 | } |
410 | 44 | 42 | ||
411 | === modified file 'test/qmltest/unity/shell/scopes/tst_Scopes.qml' | |||
412 | --- test/qmltest/unity/shell/scopes/tst_Scopes.qml 2015-10-09 08:30:31 +0000 | |||
413 | +++ test/qmltest/unity/shell/scopes/tst_Scopes.qml 2016-02-18 15:46:52 +0000 | |||
414 | @@ -343,72 +343,11 @@ | |||
415 | 343 | } | 343 | } |
416 | 344 | 344 | ||
417 | 345 | Verifier { | 345 | Verifier { |
418 | 346 | id: previewStackVerifier | ||
419 | 347 | |||
420 | 348 | Repeater { | ||
421 | 349 | id: previewStackRepeater | ||
422 | 350 | model: preview | ||
423 | 351 | delegate: Item { | ||
424 | 352 | property var roles: model | ||
425 | 353 | } | ||
426 | 354 | } | ||
427 | 355 | |||
428 | 356 | function test_previewStack_data() { | ||
429 | 357 | return [ | ||
430 | 358 | { tag: "PreviewStack[object]", type: "object" }, | ||
431 | 359 | { tag: "PreviewStack[PreviewStackInterface]", type: "unity::shell::scopes::PreviewStackInterface" }, | ||
432 | 360 | ]; | ||
433 | 361 | } | ||
434 | 362 | |||
435 | 363 | function test_previewStack(data) { | ||
436 | 364 | object = previewStackRepeater.model; | ||
437 | 365 | name = "PreviewStack"; | ||
438 | 366 | verifyData(data); | ||
439 | 367 | } | ||
440 | 368 | |||
441 | 369 | function test_previewStack_roles_data() { | ||
442 | 370 | return [ | ||
443 | 371 | { tag: "Model.roles[previewModel]", role: "previewModel", type: "object" } | ||
444 | 372 | ]; | ||
445 | 373 | } | ||
446 | 374 | |||
447 | 375 | function test_previewStack_roles(data) { | ||
448 | 376 | object = previewStackRepeater.itemAt(0).roles; | ||
449 | 377 | name = "PreviewStack"; | ||
450 | 378 | verifyData(data); | ||
451 | 379 | } | ||
452 | 380 | |||
453 | 381 | function test_previewStack_properties_data() { | ||
454 | 382 | return [ | ||
455 | 383 | { tag: "Item.properties[widgetColumnCount]", constant: "widgetColumnCount", type: "number" } | ||
456 | 384 | ]; | ||
457 | 385 | } | ||
458 | 386 | |||
459 | 387 | function test_previewStack_properties(data) { | ||
460 | 388 | object = previewStackRepeater.model; | ||
461 | 389 | name = "PreviewStack"; | ||
462 | 390 | verifyData(data); | ||
463 | 391 | } | ||
464 | 392 | |||
465 | 393 | function test_previewStack_methods_data() { | ||
466 | 394 | return [ | ||
467 | 395 | { tag: "Model.methods[get]", method: "getPreviewModel" } | ||
468 | 396 | ]; | ||
469 | 397 | } | ||
470 | 398 | |||
471 | 399 | function test_previewStack_methods(data) { | ||
472 | 400 | object = previewStackRepeater.model; | ||
473 | 401 | name = "PreviewStack" | ||
474 | 402 | verifyData(data); | ||
475 | 403 | } | ||
476 | 404 | } | ||
477 | 405 | |||
478 | 406 | Verifier { | ||
479 | 407 | id: previewModelVerifier | 346 | id: previewModelVerifier |
480 | 408 | 347 | ||
481 | 409 | Repeater { | 348 | Repeater { |
482 | 410 | id: previewModelRepeater | 349 | id: previewModelRepeater |
484 | 411 | model: preview.getPreviewModel(0) | 350 | model: preview |
485 | 412 | delegate: Item { | 351 | delegate: Item { |
486 | 413 | property var roles: model | 352 | property var roles: model |
487 | 414 | property var columnModel: model.columnModel | 353 | property var columnModel: model.columnModel |