Merge lp:~stolowski/unity-api/single-preview into lp:unity-api

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
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 PreviewStackInterface. Changed ScopeInterface to return single preview.

Description of the change

Removed PreviewStackInterface. Changed ScopeInterface to return single preview.

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

Subscribers

People subscribed via source and target branches

to all changes: