Merge lp:~unity-team/unity8/new-scopes-cleanup into lp:unity8
- new-scopes-cleanup
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | Michał Sawicz |
Merged at revision: | not available |
Proposed branch: | lp:~unity-team/unity8/new-scopes-cleanup |
Merge into: | lp:unity8 |
Prerequisite: | lp:~unity-team/unity8/new-scopes-clean-to-trunk |
Diff against target: |
7715 lines (+1067/-5236) 91 files modified
data/unity8.conf (+4/-0) plugins/DashViews/listviewwithpageheader.cpp (+7/-7) qml/Components/OpenEffect.qml (+0/-138) qml/Components/PageHeader.qml (+1/-0) qml/Components/RatingStars.qml (+0/-41) qml/Components/Tile.qml (+0/-39) qml/Components/TileStyle.qml (+0/-81) qml/Dash/Apps/AppPreview.qml (+0/-167) qml/Dash/Apps/DashPluginFilterGrid.qml (+0/-47) qml/Dash/Apps/FrequentlyUsedAppsModel.qml (+0/-110) qml/Dash/Card.qml (+1/-0) qml/Dash/CardCarousel.qml (+1/-2) qml/Dash/CardFilterGrid.qml (+52/-25) qml/Dash/CardTool.qml (+1/-1) qml/Dash/DashCarousel.qml (+0/-47) qml/Dash/DashContent.qml (+26/-23) qml/Dash/DashFilterGrid.qml (+0/-65) qml/Dash/DashHome.qml (+0/-39) qml/Dash/DashPreview.qml (+0/-208) qml/Dash/DashPreviewPlaceholder.qml (+0/-25) qml/Dash/DashRenderer.qml (+1/-4) qml/Dash/Generic/FlatTileStyle.qml (+0/-79) qml/Dash/Generic/GenericCarousel.qml (+0/-53) qml/Dash/Generic/GenericFilterGrid.qml (+0/-46) qml/Dash/Generic/GenericFilterGridPotrait.qml (+0/-28) qml/Dash/Generic/GenericPreview.qml (+0/-197) qml/Dash/Generic/WeatherFilterGrid.qml (+0/-47) qml/Dash/GenericScopeView.qml (+3/-8) qml/Dash/Movie/MoviePreview.qml (+0/-71) qml/Dash/Music/CarouselDelegateMusic.qml (+0/-42) qml/Dash/Music/MusicCarousel.qml (+0/-34) qml/Dash/Music/MusicFilterGrid.qml (+0/-48) qml/Dash/Music/MusicPreview.qml (+0/-203) qml/Dash/Music/MusicTileStyle.qml (+0/-102) qml/Dash/PreviewDelegateMapper.qml (+0/-38) qml/Dash/PreviewListView.qml (+4/-2) qml/Dash/Previews/Header.qml (+0/-109) qml/Dash/Previews/Reviews.qml (+0/-194) qml/Dash/ScopeDelegateMapper.qml (+1/-3) qml/Dash/SearchableResultModel.qml (+0/-44) qml/Dash/Video/CarouselDelegateVideo.qml (+0/-42) qml/Dash/Video/VideoCarousel.qml (+0/-34) qml/Dash/Video/VideoFilterGrid.qml (+0/-47) qml/Dash/Video/VideoTileStyle.qml (+0/-87) tests/autopilot/unity8/shell/emulators/dash.py (+23/-52) tests/autopilot/unity8/shell/emulators/main_window.py (+0/-4) tests/autopilot/unity8/shell/tests/__init__.py (+1/-1) tests/autopilot/unity8/shell/tests/test_emulators.py (+26/-52) tests/autopilot/unity8/shell/tests/test_greeter.py (+0/-38) tests/mocks/Unity/CMakeLists.txt (+4/-4) tests/mocks/Unity/categoryresults.cpp (+0/-121) tests/mocks/Unity/categoryresults.h (+0/-68) tests/mocks/Unity/fake_applications_scope.cpp (+0/-76) tests/mocks/Unity/fake_applications_scope.h (+0/-33) tests/mocks/Unity/fake_categories.cpp (+127/-212) tests/mocks/Unity/fake_categories.h (+28/-32) tests/mocks/Unity/fake_preview.cpp (+0/-73) tests/mocks/Unity/fake_preview.h (+0/-65) tests/mocks/Unity/fake_previewmodel.cpp (+43/-53) tests/mocks/Unity/fake_previewmodel.h (+24/-25) tests/mocks/Unity/fake_previewstack.cpp (+76/-0) tests/mocks/Unity/fake_previewstack.h (+61/-0) tests/mocks/Unity/fake_previewwidgetmodel.cpp (+86/-0) tests/mocks/Unity/fake_previewwidgetmodel.h (+56/-0) tests/mocks/Unity/fake_resultsmodel.cpp (+117/-0) tests/mocks/Unity/fake_resultsmodel.h (+80/-0) tests/mocks/Unity/fake_scope.cpp (+20/-120) tests/mocks/Unity/fake_scope.h (+17/-18) tests/mocks/Unity/fake_scopes.cpp (+1/-5) tests/mocks/Unity/fake_unity_plugin.cpp (+8/-18) tests/qmltests/CMakeLists.txt (+0/-10) tests/qmltests/Components/tst_OpenEffect.qml (+0/-71) tests/qmltests/Components/tst_PageHeaderLabel.qml (+1/-1) tests/qmltests/Components/tst_RatingStars.qml (+0/-62) tests/qmltests/Components/tst_Tile.qml (+0/-71) tests/qmltests/Dash/Apps/tst_AppPreview.qml (+0/-276) tests/qmltests/Dash/Movie/tst_MoviePreview.qml (+0/-86) tests/qmltests/Dash/Music/tst_MusicPreview.qml (+0/-174) tests/qmltests/Dash/Previews/tst_Preview.qml (+3/-17) tests/qmltests/Dash/qml/FakeScopeView.qml (+1/-1) tests/qmltests/Dash/qml/fake_scopeView1.qml (+1/-1) tests/qmltests/Dash/qml/fake_scopeView2.qml (+1/-1) tests/qmltests/Dash/qml/fake_scopeView3.qml (+1/-1) tests/qmltests/Dash/tst_CardTool.qml (+1/-1) tests/qmltests/Dash/tst_Dash.qml (+12/-6) tests/qmltests/Dash/tst_DashContent.qml (+116/-34) tests/qmltests/Dash/tst_DashPreview.qml (+0/-202) tests/qmltests/Dash/tst_FilterGrids.qml (+0/-143) tests/qmltests/Dash/tst_GenericPreview.qml (+0/-125) tests/qmltests/Dash/tst_GenericScopeView.qml (+24/-231) tests/qmltests/tst_Shell.qml (+6/-25) |
To merge this branch: | bzr merge lp:~unity-team/unity8/new-scopes-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Unity Team | Pending | ||
Review via email:
|
Commit message
New scopes + removal of unused files + passing tests
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
lp:~unity-team/unity8/new-scopes-clean-to-trunk
lp:~unity-team/unity8/fix-5.2-tests
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
Yes, the changes are wanted by design
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:724
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 725. By Michał Sawicz
-
Temporarily force scope-registry to start.
- 726. By Albert Astals Cid
-
Merge
- 727. By Albert Astals Cid
-
This should help with the DashContent:
:test_showPrevi ewCarousel failure in CI - 728. By Albert Astals Cid
-
Merge
- 729. By Albert Astals Cid
-
Access the proper template variable
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:725
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 730. By Albert Astals Cid
-
And need cardTool. here too
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:729
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:730
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 731. By Albert Astals Cid
-
The button needs to be non totally transparent before we can click on it
- 732. By Albert Astals Cid
-
Childrens have moved again
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:732
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 733. By Michał Sawicz
-
Revert FIXME for starting scope registry.
- 734. By Albert Astals Cid
-
Click on the correct tile
There's more than one dashCategory1 so make sure we look for the correct one
otherwise we may be clicking on something that is not on screen
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:733
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:734
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 735. By Michał Sawicz
-
Merge 5.2 fixes
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:735
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
Looks good to me. Nice cleanup.
Waiting for all the prerequisites to get merged so the diff shrinks a bit before doing the final review/approval.
- 736. By Albert Astals Cid
-
Merge DashFilterGrid.qml to CardFilterGrid.qml
- 737. By Albert Astals Cid
-
DashFilterGrid -> CardFilterGrid in the tests
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:737
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 738. By Michał Sawicz
-
Merge new-scopes-
clean-to- trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:738
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 739. By Albert Astals Cid
-
Merge
- 740. By Albert Astals Cid
-
Turn this into a fuzzy compare too
I had another of those 80 != 80 cases that made the header animate when it should not
- 741. By Albert Astals Cid
-
And now make it compile ^_^
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:739
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:741
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : | # |
Merged into lp:~unity-team/unity8/new-scopes-clean-to-trunk
Preview Diff
1 | === modified file 'data/unity8.conf' |
2 | --- data/unity8.conf 2014-03-18 10:57:24 +0000 |
3 | +++ data/unity8.conf 2014-03-18 10:57:24 +0000 |
4 | @@ -1,6 +1,8 @@ |
5 | description "Unity Shell v8" |
6 | author "Ricardo Mendoza <ricmm@ubuntu.com>" |
7 | |
8 | +emits scope-ui-starting |
9 | + |
10 | start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus |
11 | stop on desktop-end |
12 | |
13 | @@ -38,6 +40,8 @@ |
14 | if [ -S "$MIR_SERVER_FILE" ]; then |
15 | rm "$MIR_SERVER_FILE" |
16 | fi |
17 | + |
18 | + initctl emit scope-ui-starting |
19 | end script |
20 | |
21 | exec ${BINARY:-unity8} $ARGS |
22 | |
23 | === modified file 'plugins/DashViews/listviewwithpageheader.cpp' |
24 | --- plugins/DashViews/listviewwithpageheader.cpp 2014-03-18 10:57:24 +0000 |
25 | +++ plugins/DashViews/listviewwithpageheader.cpp 2014-03-18 10:57:24 +0000 |
26 | @@ -376,13 +376,18 @@ |
27 | } |
28 | } |
29 | |
30 | +static inline bool uFuzzyCompare(qreal r1, qreal r2) |
31 | +{ |
32 | + return qFuzzyCompare(r1, r2) || (qFuzzyIsNull(r1) && qFuzzyIsNull(r2)); |
33 | +} |
34 | + |
35 | void ListViewWithPageHeader::showHeader() |
36 | { |
37 | if (!m_headerItem) |
38 | return; |
39 | |
40 | - auto to = qMax(-minYExtent(), contentY() - m_headerItem->height() + m_headerItemShownHeight); |
41 | - if (to != contentY()) { |
42 | + const auto to = qMax(-minYExtent(), contentY() - m_headerItem->height() + m_headerItemShownHeight); |
43 | + if (!uFuzzyCompare(to, contentY())) { |
44 | const bool headerShownByItsOwn = contentY() < m_headerItem->y() + m_headerItem->height(); |
45 | if (headerShownByItsOwn && m_headerItemShownHeight == 0) { |
46 | // We are not clipping since we are just at the top of the viewport |
47 | @@ -485,11 +490,6 @@ |
48 | polish(); |
49 | } |
50 | |
51 | -static inline bool uFuzzyCompare(qreal r1, qreal r2) |
52 | -{ |
53 | - return qFuzzyCompare(r1, r2) || (qFuzzyIsNull(r1) && qFuzzyIsNull(r2)); |
54 | -} |
55 | - |
56 | void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient) |
57 | { |
58 | // Check we are not being taken down and don't paint anything |
59 | |
60 | === removed file 'qml/Components/OpenEffect.qml' |
61 | --- qml/Components/OpenEffect.qml 2013-07-09 15:24:41 +0000 |
62 | +++ qml/Components/OpenEffect.qml 1970-01-01 00:00:00 +0000 |
63 | @@ -1,138 +0,0 @@ |
64 | -/* |
65 | - * Copyright (C) 2013 Canonical, Ltd. |
66 | - * |
67 | - * This program is free software; you can redistribute it and/or modify |
68 | - * it under the terms of the GNU General Public License as published by |
69 | - * the Free Software Foundation; version 3. |
70 | - * |
71 | - * This program is distributed in the hope that it will be useful, |
72 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
73 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
74 | - * GNU General Public License for more details. |
75 | - * |
76 | - * You should have received a copy of the GNU General Public License |
77 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
78 | - */ |
79 | - |
80 | -import QtQuick 2.0 |
81 | - |
82 | -Item { |
83 | - id: effect |
84 | - property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx |
85 | - property alias live: effectSource.live |
86 | - property Item sourceItem |
87 | - property ShaderEffectSource source: ShaderEffectSource { |
88 | - id: effectSource |
89 | - sourceItem: effect.enabled ? effect.sourceItem : null |
90 | - hideSource: effect.enabled |
91 | - live: false |
92 | - sourceRect: { |
93 | - if (effect.enabled) { |
94 | - Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow) |
95 | - } else { |
96 | - Qt.rect(0, 0, 0, 0) |
97 | - } |
98 | - } |
99 | - } |
100 | - |
101 | - onEnabledChanged: if (!live && enabled) scheduleUpdate() |
102 | - |
103 | - /*! |
104 | - \qmlproperty real positionPx |
105 | - The y coordinate of where to perform the split. |
106 | - |
107 | - \qmlproperty real topGapPx |
108 | - Gap's top edge. |
109 | - |
110 | - \qmlproperty real bottomGapPx |
111 | - Gap's bottom edge. |
112 | - |
113 | - \qmlproperty real topOverflow |
114 | - How much of the sourceItem should be sourced above its bounds. |
115 | - |
116 | - \qmlproperty real bottomOverflow |
117 | - How much of the sourceItem should be sourced below its bounds. |
118 | - */ |
119 | - |
120 | - property real positionPx: 0 |
121 | - property real topGapPx: 0 |
122 | - property real bottomGapPx: height |
123 | - property real topOverflow: 0.0 |
124 | - property real bottomOverflow: 0.0 |
125 | - property real topOpacity: 1.0 |
126 | - property real bottomOpacity: 1.0 |
127 | - |
128 | - property real __roundedPositionPx: Math.round(positionPx) |
129 | - |
130 | - function scheduleUpdate() { |
131 | - source.scheduleUpdate(); |
132 | - } |
133 | - |
134 | - ShaderEffect { |
135 | - id: top |
136 | - visible: effect.enabled |
137 | - opacity: topOpacity |
138 | - property ShaderEffectSource source: effect.source |
139 | - property real positionPx: __roundedPositionPx |
140 | - property real factor: effect.height / height |
141 | - |
142 | - clip: true |
143 | - |
144 | - anchors { |
145 | - top: parent.top |
146 | - left: parent.left |
147 | - right: parent.right |
148 | - topMargin: -topOverflow - positionPx + topGapPx |
149 | - } |
150 | - height: topOverflow + positionPx |
151 | - |
152 | - vertexShader: " |
153 | - uniform highp mat4 qt_Matrix; |
154 | - attribute highp vec4 qt_Vertex; |
155 | - attribute highp vec2 qt_MultiTexCoord0; |
156 | - varying highp vec2 qt_TexCoord0; |
157 | - uniform highp float factor; |
158 | - |
159 | - void main() { |
160 | - highp vec4 pos = qt_Vertex; |
161 | - pos.y *= factor; |
162 | - gl_Position = qt_Matrix * pos; |
163 | - qt_TexCoord0 = qt_MultiTexCoord0; |
164 | - } |
165 | - " |
166 | - } |
167 | - |
168 | - ShaderEffect { |
169 | - id: bottom |
170 | - visible: effect.enabled |
171 | - opacity: bottomOpacity |
172 | - property ShaderEffectSource source: effect.source |
173 | - property real offset: effect.topOverflow + __roundedPositionPx |
174 | - property real factor: effect.height / height |
175 | - |
176 | - clip: true |
177 | - |
178 | - anchors { |
179 | - left: parent.left |
180 | - right: parent.right |
181 | - } |
182 | - y: topOverflow + bottomGapPx |
183 | - height: sourceItem.height - positionPx + bottomOverflow |
184 | - |
185 | - vertexShader: " |
186 | - uniform highp mat4 qt_Matrix; |
187 | - attribute highp vec4 qt_Vertex; |
188 | - attribute highp vec2 qt_MultiTexCoord0; |
189 | - varying highp vec2 qt_TexCoord0; |
190 | - uniform highp float factor; |
191 | - uniform highp float offset; |
192 | - |
193 | - void main() { |
194 | - highp vec4 pos = qt_Vertex; |
195 | - pos.y = (pos.y * factor) - offset; |
196 | - gl_Position = qt_Matrix * pos; |
197 | - qt_TexCoord0 = qt_MultiTexCoord0; |
198 | - } |
199 | - " |
200 | - } |
201 | -} |
202 | |
203 | === modified file 'qml/Components/PageHeader.qml' |
204 | --- qml/Components/PageHeader.qml 2014-03-18 10:57:24 +0000 |
205 | +++ qml/Components/PageHeader.qml 2014-03-18 10:57:24 +0000 |
206 | @@ -74,6 +74,7 @@ |
207 | |
208 | AbstractButton { |
209 | id: backButton |
210 | + objectName: root.objectName + "_backButton" |
211 | visible: false |
212 | height: header.height |
213 | y: header.contentY |
214 | |
215 | === removed file 'qml/Components/RatingStars.qml' |
216 | --- qml/Components/RatingStars.qml 2014-02-14 10:14:55 +0000 |
217 | +++ qml/Components/RatingStars.qml 1970-01-01 00:00:00 +0000 |
218 | @@ -1,41 +0,0 @@ |
219 | -/* |
220 | - * Copyright (C) 2013 Canonical, Ltd. |
221 | - * |
222 | - * This program is free software; you can redistribute it and/or modify |
223 | - * it under the terms of the GNU General Public License as published by |
224 | - * the Free Software Foundation; version 3. |
225 | - * |
226 | - * This program is distributed in the hope that it will be useful, |
227 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
228 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
229 | - * GNU General Public License for more details. |
230 | - * |
231 | - * You should have received a copy of the GNU General Public License |
232 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
233 | - */ |
234 | - |
235 | -import QtQuick 2.0 |
236 | - |
237 | -Row { |
238 | - id: root |
239 | - property int rating |
240 | - property int maximumRating: 5 |
241 | - property int starCount: 5 |
242 | - height: childrenRect.height |
243 | - width: childrenRect.width |
244 | - |
245 | - readonly property int effectiveRating: Math.max(0, Math.min(root.starCount * root.rating / root.maximumRating, root.maximumRating)) |
246 | - |
247 | - Repeater { |
248 | - model: root.effectiveRating |
249 | - Image { |
250 | - source: "graphics/icon_star_on.png" |
251 | - } |
252 | - } |
253 | - Repeater { |
254 | - model: root.starCount - root.effectiveRating |
255 | - Image { |
256 | - source: "graphics/icon_star_off.png" |
257 | - } |
258 | - } |
259 | -} |
260 | |
261 | === removed file 'qml/Components/Tile.qml' |
262 | --- qml/Components/Tile.qml 2013-10-14 10:43:49 +0000 |
263 | +++ qml/Components/Tile.qml 1970-01-01 00:00:00 +0000 |
264 | @@ -1,39 +0,0 @@ |
265 | -/* |
266 | - * Copyright (C) 2013 Canonical, Ltd. |
267 | - * |
268 | - * This program is free software; you can redistribute it and/or modify |
269 | - * it under the terms of the GNU General Public License as published by |
270 | - * the Free Software Foundation; version 3. |
271 | - * |
272 | - * This program is distributed in the hope that it will be useful, |
273 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
274 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
275 | - * GNU General Public License for more details. |
276 | - * |
277 | - * You should have received a copy of the GNU General Public License |
278 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
279 | - */ |
280 | - |
281 | -import QtQuick 2.0 |
282 | -import Ubuntu.Components 0.1 |
283 | - |
284 | -AbstractButton { |
285 | - property url source |
286 | - property int fillMode: Image.PreserveAspectCrop |
287 | - property int horizontalAlignment: Text.AlignHCenter |
288 | - property string text |
289 | - property int imageWidth |
290 | - property int imageHeight |
291 | - property int maximumLineCount: 1 |
292 | - |
293 | - readonly property int center: (index % GridView.view.columns * width) + (width / 2) |
294 | - |
295 | - opacity: GridView.view.highlightIndex === -1 ? 1 : |
296 | - GridView.view.highlightIndex === index ? 0.6 : 0.2 |
297 | - |
298 | - Behavior on opacity { |
299 | - UbuntuNumberAnimation {} |
300 | - } |
301 | - |
302 | - style: TileStyle {} |
303 | -} |
304 | |
305 | === removed file 'qml/Components/TileStyle.qml' |
306 | --- qml/Components/TileStyle.qml 2013-10-10 10:20:36 +0000 |
307 | +++ qml/Components/TileStyle.qml 1970-01-01 00:00:00 +0000 |
308 | @@ -1,81 +0,0 @@ |
309 | -/* |
310 | - * Copyright (C) 2013 Canonical, Ltd. |
311 | - * |
312 | - * This program is free software; you can redistribute it and/or modify |
313 | - * it under the terms of the GNU General Public License as published by |
314 | - * the Free Software Foundation; version 3. |
315 | - * |
316 | - * This program is distributed in the hope that it will be useful, |
317 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
318 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
319 | - * GNU General Public License for more details. |
320 | - * |
321 | - * You should have received a copy of the GNU General Public License |
322 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
323 | - */ |
324 | - |
325 | -import QtQuick 2.0 |
326 | -import Ubuntu.Components 0.1 |
327 | - |
328 | -Item { |
329 | - id: tile |
330 | - |
331 | - anchors.fill: parent |
332 | - |
333 | - UbuntuShape { |
334 | - id: icon |
335 | - anchors { |
336 | - top: parent.top |
337 | - horizontalCenter: parent.horizontalCenter |
338 | - } |
339 | - radius: "medium" |
340 | - width: styledItem.imageWidth |
341 | - height: styledItem.imageHeight |
342 | - image: Image { |
343 | - id: image |
344 | - objectName: "image" |
345 | - sourceSize { width: icon.width; height: icon.height } |
346 | - asynchronous: true |
347 | - cache: false |
348 | - source: styledItem.source |
349 | - fillMode: styledItem.fillMode |
350 | - horizontalAlignment: Image.AlignHCenter |
351 | - verticalAlignment: Image.AlignVCenter |
352 | - } |
353 | - } |
354 | - |
355 | - UbuntuShape { |
356 | - id: borderPressed |
357 | - objectName: "borderPressed" |
358 | - |
359 | - anchors.fill: icon |
360 | - radius: "medium" |
361 | - borderSource: "radius_pressed.sci" |
362 | - opacity: styledItem.pressed ? 1.0 : 0.0 |
363 | - Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } } |
364 | - } |
365 | - |
366 | - Label { |
367 | - id: label |
368 | - objectName: "label" |
369 | - anchors { |
370 | - baseline: icon.bottom |
371 | - baselineOffset: units.gu(2) |
372 | - left: parent.left |
373 | - right: parent.right |
374 | - leftMargin: units.gu(1) |
375 | - rightMargin: units.gu(1) |
376 | - } |
377 | - |
378 | - color: Theme.palette.selected.backgroundText |
379 | - opacity: 0.9 |
380 | - style: Text.Raised |
381 | - styleColor: "black" |
382 | - fontSize: "small" |
383 | - elide: Text.ElideMiddle |
384 | - horizontalAlignment: styledItem.horizontalAlignment |
385 | - text: styledItem.text |
386 | - wrapMode: Text.Wrap |
387 | - maximumLineCount: styledItem.maximumLineCount |
388 | - } |
389 | -} |
390 | |
391 | === removed file 'qml/Dash/Apps/AppPreview.qml' |
392 | --- qml/Dash/Apps/AppPreview.qml 2014-01-15 06:32:25 +0000 |
393 | +++ qml/Dash/Apps/AppPreview.qml 1970-01-01 00:00:00 +0000 |
394 | @@ -1,167 +0,0 @@ |
395 | -/* |
396 | - * Copyright (C) 2013 Canonical, Ltd. |
397 | - * |
398 | - * This program is free software; you can redistribute it and/or modify |
399 | - * it under the terms of the GNU General Public License as published by |
400 | - * the Free Software Foundation; version 3. |
401 | - * |
402 | - * This program is distributed in the hope that it will be useful, |
403 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
404 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
405 | - * GNU General Public License for more details. |
406 | - * |
407 | - * You should have received a copy of the GNU General Public License |
408 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
409 | - */ |
410 | - |
411 | -import QtQuick 2.0 |
412 | -import Ubuntu.Components 0.1 |
413 | -import Ubuntu.Components.ListItems 0.1 as ListItems |
414 | -import ".." |
415 | -import "../Generic" |
416 | -import "../Previews" |
417 | -import "../../Components" |
418 | - |
419 | -GenericPreview { |
420 | - id: root |
421 | - |
422 | - signal sendUserReview(string review) |
423 | - |
424 | - previewImages: previewImagesComponent |
425 | - description: descriptionComponent |
426 | - header: headerComponent |
427 | - |
428 | - // TODO: Ratings are not yet complete... enable this once they work |
429 | - //ratings: ratingsComponent |
430 | - |
431 | - Component { |
432 | - id: previewImagesComponent |
433 | - ListView { |
434 | - id: previewImageListView |
435 | - spacing: units.gu(1) |
436 | - orientation: ListView.Horizontal |
437 | - height: units.gu(22) |
438 | - model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image] |
439 | - cacheBuffer: width * 3 |
440 | - |
441 | - // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more) |
442 | - // we finally reached the point where this ListView doesn't correctly get swipe input any more but |
443 | - // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking |
444 | - // layer to make sure this ListView can be swiped, regardless of what's behind it. |
445 | - MouseArea { |
446 | - anchors.fill: parent |
447 | - enabled: parent.contentWidth > parent.width |
448 | - } |
449 | - |
450 | - LazyImage { |
451 | - objectName: "placeholderScreenshot" |
452 | - anchors { |
453 | - top: parent.top |
454 | - bottom: parent.bottom |
455 | - } |
456 | - scaleTo: "height" |
457 | - source: "broken_image" |
458 | - initialWidth: units.gu(13) |
459 | - visible: previewImageListView.count == 0 |
460 | - } |
461 | - |
462 | - delegate: LazyImage { |
463 | - id: shape |
464 | - anchors { |
465 | - top: parent.top |
466 | - bottom: parent.bottom |
467 | - } |
468 | - source: modelData ? modelData : "" |
469 | - scaleTo: "height" |
470 | - initialWidth: units.gu(13) |
471 | - } |
472 | - } |
473 | - } |
474 | - |
475 | - Component { |
476 | - id: headerComponent |
477 | - Header { |
478 | - objectName: "previewHeader" |
479 | - title: previewData.title |
480 | - icon: previewData.appIcon |
481 | - subtitle: root.previewData.infoMap["publisher"] ? root.previewData.infoMap["publisher"].value : "" |
482 | - rating: Math.round(root.previewData.rating * 10) |
483 | - reviews: root.previewData.numRatings |
484 | - rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0 |
485 | - } |
486 | - } |
487 | - |
488 | - Component { |
489 | - id: descriptionComponent |
490 | - Column { |
491 | - spacing: units.gu(1) |
492 | - |
493 | - Label { |
494 | - objectName: "descriptionLabel" |
495 | - anchors { left: parent.left; right: parent.right } |
496 | - text: root.previewData.description |
497 | - fontSize: "medium" |
498 | - color: Theme.palette.selected.backgroundText |
499 | - opacity: .6 |
500 | - wrapMode: Text.WordWrap |
501 | - style: Text.Raised |
502 | - styleColor: "black" |
503 | - } |
504 | - } |
505 | - } |
506 | - |
507 | - Component { |
508 | - id: ratingsComponent |
509 | - Column { |
510 | - id: columnReviewRating |
511 | - objectName: "columnReviewRating" |
512 | - visible: root.previewData.rating >= 0 |
513 | - |
514 | - spacing: units.gu(1) |
515 | - height: childrenRect.height |
516 | - |
517 | - ListItems.ThinDivider { } |
518 | - |
519 | - Item { |
520 | - anchors { left: parent.left; right: parent.right } |
521 | - height: rateLabel.height |
522 | - |
523 | - Label { |
524 | - id: rateLabel |
525 | - fontSize: "medium" |
526 | - color: "white" |
527 | - style: Text.Raised |
528 | - styleColor: "black" |
529 | - opacity: .9 |
530 | - text: i18n.tr("Rate this") |
531 | - |
532 | - anchors.left: parent.left |
533 | - anchors.verticalCenter: parent.verticalCenter |
534 | - } |
535 | - |
536 | - // FIXME these need to be made interactive and connected to the scope |
537 | - RatingStars { |
538 | - anchors.right: parent.right |
539 | - anchors.verticalCenter: parent.verticalCenter |
540 | - } |
541 | - } |
542 | - |
543 | - ListItems.ThinDivider { } |
544 | - |
545 | - Reviews { |
546 | - id: appReviews |
547 | - objectName: "appReviews" |
548 | - |
549 | - anchors { left: parent.left; right: parent.right } |
550 | - |
551 | - model: root.previewData.infoMap["comments"] ? root.previewData.infoMap["comments"].value : undefined |
552 | - |
553 | - onSendReview: root.sendUserReview(review); |
554 | - |
555 | - onEditing: { |
556 | - root.ensureVisible(appReviews.textArea); |
557 | - } |
558 | - } |
559 | - } |
560 | - } |
561 | -} |
562 | |
563 | === removed file 'qml/Dash/Apps/DashPluginFilterGrid.qml' |
564 | --- qml/Dash/Apps/DashPluginFilterGrid.qml 2013-11-11 11:44:39 +0000 |
565 | +++ qml/Dash/Apps/DashPluginFilterGrid.qml 1970-01-01 00:00:00 +0000 |
566 | @@ -1,47 +0,0 @@ |
567 | -/* |
568 | - * Copyright (C) 2013 Canonical, Ltd. |
569 | - * |
570 | - * This program is free software; you can redistribute it and/or modify |
571 | - * it under the terms of the GNU General Public License as published by |
572 | - * the Free Software Foundation; version 3. |
573 | - * |
574 | - * This program is distributed in the hope that it will be useful, |
575 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
576 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
577 | - * GNU General Public License for more details. |
578 | - * |
579 | - * You should have received a copy of the GNU General Public License |
580 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
581 | - */ |
582 | - |
583 | -import QtQuick 2.0 |
584 | -import Ubuntu.Components 0.1 |
585 | -import "../../Components" |
586 | -import "../Generic" |
587 | - |
588 | -GenericFilterGrid { |
589 | - id: filtergrid |
590 | - |
591 | - delegate: Tile { |
592 | - id: tile |
593 | - objectName: "delegate" + index |
594 | - width: filtergrid.cellWidth |
595 | - height: filtergrid.cellHeight |
596 | - text: model.title |
597 | - imageWidth: filtergrid.iconWidth |
598 | - imageHeight: filtergrid.iconHeight |
599 | - source: model.icon |
600 | - |
601 | - style: FlatTileStyle { |
602 | - disabled: model.rendererHints['scope_disabled'] === 1; |
603 | - } |
604 | - |
605 | - onClicked: { |
606 | - filtergrid.clicked(index, tile.y) |
607 | - } |
608 | - |
609 | - onPressAndHold: { |
610 | - filtergrid.pressAndHold(index, tile.y) |
611 | - } |
612 | - } |
613 | -} |
614 | |
615 | === removed file 'qml/Dash/Apps/FrequentlyUsedAppsModel.qml' |
616 | --- qml/Dash/Apps/FrequentlyUsedAppsModel.qml 2014-02-24 20:56:03 +0000 |
617 | +++ qml/Dash/Apps/FrequentlyUsedAppsModel.qml 1970-01-01 00:00:00 +0000 |
618 | @@ -1,110 +0,0 @@ |
619 | -/* |
620 | - * Copyright (C) 2013 Canonical, Ltd. |
621 | - * |
622 | - * This program is free software; you can redistribute it and/or modify |
623 | - * it under the terms of the GNU General Public License as published by |
624 | - * the Free Software Foundation; version 3. |
625 | - * |
626 | - * This program is distributed in the hope that it will be useful, |
627 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
628 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
629 | - * GNU General Public License for more details. |
630 | - * |
631 | - * You should have received a copy of the GNU General Public License |
632 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
633 | - */ |
634 | - |
635 | -import QtQuick 2.0 |
636 | - |
637 | -ListModel { |
638 | - ListElement { |
639 | - uri: "application://dialer-app.desktop" |
640 | - icon: "../../graphics/applicationIcons/phone-app.png" |
641 | - category: 0 |
642 | - mimetype: "application/x-desktop" |
643 | - title: "Dialer" |
644 | - comment: "" |
645 | - dndUri: "file:///usr/share/applications/dialer-app.desktop" |
646 | - metadata: "subscope:applications.scope/applications-non-click.scope" |
647 | - } |
648 | - ListElement { |
649 | - uri: "application://messaging-app.desktop" |
650 | - icon: "../../graphics/applicationIcons/messages-app.png" |
651 | - category: 0 |
652 | - mimetype: "application/x-desktop" |
653 | - title: "Messaging" |
654 | - comment: "" |
655 | - dndUri: "file:///usr/share/applications/messaging-app.desktop" |
656 | - metadata: "subscope:applications.scope/applications-non-click.scope" |
657 | - } |
658 | - ListElement { |
659 | - uri: "application://address-book-app.desktop" |
660 | - icon: "../../graphics/applicationIcons/contacts-app.png" |
661 | - category: 0 |
662 | - mimetype: "application/x-desktop" |
663 | - title: "Contacts" |
664 | - comment: "" |
665 | - dndUri: "file:///usr/share/applications/address-book-app.desktop" |
666 | - metadata: "subscope:applications.scope/applications-non-click.scope" |
667 | - } |
668 | - ListElement { |
669 | - uri: "appid://com.ubuntu.camera/camera/current-user-version" |
670 | - icon: "../../graphics/applicationIcons/camera.png" |
671 | - category: 0 |
672 | - mimetype: "application/x-desktop" |
673 | - title: "Camera" |
674 | - comment: "" |
675 | - dndUri: "appid://com.ubuntu.camera/camera/current-user-version" |
676 | - metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.camera" |
677 | - } |
678 | - ListElement { |
679 | - uri: "appid://com.ubuntu.gallery/gallery/current-user-version" |
680 | - icon: "../../graphics/applicationIcons/gallery.png" |
681 | - category: 0 |
682 | - mimetype: "application/x-desktop" |
683 | - title: "Gallery" |
684 | - comment: "" |
685 | - dndUri: "appid://com.ubuntu.gallery/gallery/current-user-version" |
686 | - metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.gallery" |
687 | - } |
688 | - ListElement { |
689 | - uri: "appid://com.ubuntu.developer.webapps.webapp-facebook/webapp-facebook/current-user-version" |
690 | - icon: "../../graphics/applicationIcons/facebook.png" |
691 | - category: 0 |
692 | - mimetype: "application/x-desktop" |
693 | - title: "Facebook" |
694 | - comment: "" |
695 | - dndUri: "appid://com.ubuntu.developer.webapps.webapp-facebook/webapp-facebook/current-user-version" |
696 | - metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.developer.webapps.webapp-facebook" |
697 | - } |
698 | - ListElement { |
699 | - uri: "application://webbrowser-app.desktop" |
700 | - icon: "../../graphics/applicationIcons/browser.png" |
701 | - category: 0 |
702 | - mimetype: "application/x-desktop" |
703 | - title: "Browser" |
704 | - comment: "" |
705 | - dndUri: "file:///usr/share/applications/webbrowser-app.desktop" |
706 | - metadata: "subscope:applications.scope/applications-non-click.scope" |
707 | - } |
708 | - ListElement { |
709 | - uri: "appid://com.ubuntu.developer.webapps.webapp-gmail/webapp-gmail/current-user-version" |
710 | - icon: "../../graphics/applicationIcons/gmail.png" |
711 | - category: 0 |
712 | - mimetype: "application/x-desktop" |
713 | - title: "GMail" |
714 | - comment: "" |
715 | - dndUri: "appid://com.ubuntu.developer.webapps.webapp-gmail/webapp-gmail/current-user-version" |
716 | - metadata: "subscope:applications.scope/applications-click.scope?app_id=com.ubuntu.developer.webapps.webapp-gmail" |
717 | - } |
718 | - ListElement { |
719 | - uri: "application://ubuntu-system-settings.desktop" |
720 | - icon: "../../graphics/applicationIcons/system-settings.png" |
721 | - category: 0 |
722 | - mimetype: "application/x-desktop" |
723 | - title: "System Settings" |
724 | - comment: "" |
725 | - dndUri: "file:///usr/share/applications/ubuntu-system-settings.desktop" |
726 | - metadata: "subscope:applications.scope/applications-non-click.scope" |
727 | - } |
728 | -} |
729 | |
730 | === modified file 'qml/Dash/Card.qml' |
731 | --- qml/Dash/Card.qml 2014-03-18 10:57:24 +0000 |
732 | +++ qml/Dash/Card.qml 2014-03-18 10:57:24 +0000 |
733 | @@ -26,6 +26,7 @@ |
734 | property alias fontScale: header.fontScale |
735 | property alias headerAlignment: header.headerAlignment |
736 | property alias headerHeight: header.height |
737 | + readonly property alias title: header.title |
738 | |
739 | property bool showHeader: true |
740 | |
741 | |
742 | === modified file 'qml/Dash/CardCarousel.qml' |
743 | --- qml/Dash/CardCarousel.qml 2014-03-18 10:57:24 +0000 |
744 | +++ qml/Dash/CardCarousel.qml 2014-03-18 10:57:24 +0000 |
745 | @@ -42,7 +42,6 @@ |
746 | selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor |
747 | cacheBuffer: 1404 // 18px * 13gu * 6 |
748 | model: cardCarousel.model |
749 | - highlightIndex: cardCarousel.highlightIndex |
750 | |
751 | onClicked: cardCarousel.clicked(index, itemY) |
752 | onPressAndHold: cardCarousel.pressAndHold(index, itemY) |
753 | @@ -52,7 +51,7 @@ |
754 | |
755 | itemComponent: Card { |
756 | id: card |
757 | - objectName: "delegate" + index |
758 | + objectName: "carouselDelegate" + index |
759 | headerHeight: carousel.headerHeight |
760 | cardData: model |
761 | template: cardTool.template |
762 | |
763 | === modified file 'qml/Dash/CardFilterGrid.qml' |
764 | --- qml/Dash/CardFilterGrid.qml 2014-03-18 10:57:24 +0000 |
765 | +++ qml/Dash/CardFilterGrid.qml 2014-03-18 10:57:24 +0000 |
766 | @@ -15,35 +15,62 @@ |
767 | */ |
768 | |
769 | import QtQuick 2.0 |
770 | -import Ubuntu.Components 0.1 |
771 | +import "../Components" |
772 | |
773 | -DashFilterGrid { |
774 | +DashRenderer { |
775 | id: genericFilterGrid |
776 | |
777 | - minimumHorizontalSpacing: units.gu(1) |
778 | - delegateWidth: cardTool.cardWidth |
779 | - delegateHeight: cardTool.cardHeight |
780 | + expandable: filterGrid.expandable |
781 | + collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2) |
782 | + collapsedHeight: filterGrid.collapsedHeight |
783 | + columns: filterGrid.columns |
784 | + rows: filter ? collapsedRowCount : uncollapsedRowCount |
785 | + margins: filterGrid.margins |
786 | + uncollapsedHeight: filterGrid.uncollapsedHeight |
787 | verticalSpacing: units.gu(1) |
788 | - collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2) |
789 | - |
790 | - delegate: Item { |
791 | - width: genericFilterGrid.cellWidth |
792 | - height: genericFilterGrid.cellHeight |
793 | - Card { |
794 | - id: card |
795 | - width: cardTool.cardWidth |
796 | - height: cardTool.cardHeight |
797 | - headerHeight: cardTool.headerHeight |
798 | - anchors.horizontalCenter: parent.horizontalCenter |
799 | - objectName: "delegate" + index |
800 | - cardData: model |
801 | - template: cardTool.template |
802 | - components: cardTool.components |
803 | - |
804 | - headerAlignment: cardTool.headerAlignment |
805 | - |
806 | - onClicked: genericFilterGrid.clicked(index, card.y) |
807 | - onPressAndHold: genericFilterGrid.pressAndHold(index, card.y) |
808 | + currentItem: filterGrid.currentItem |
809 | + height: filterGrid.height |
810 | + |
811 | + function startFilterAnimation(filter) { |
812 | + filterGrid.startFilterAnimation(filter) |
813 | + } |
814 | + |
815 | + FilterGrid { |
816 | + id: filterGrid |
817 | + width: genericFilterGrid.width |
818 | + minimumHorizontalSpacing: units.gu(1) |
819 | + delegateWidth: cardTool.cardWidth |
820 | + delegateHeight: cardTool.cardHeight |
821 | + verticalSpacing: genericFilterGrid.verticalSpacing |
822 | + model: genericFilterGrid.model |
823 | + filter: genericFilterGrid.filter |
824 | + collapsedRowCount: genericFilterGrid.collapsedRowCount |
825 | + delegateCreationBegin: genericFilterGrid.delegateCreationBegin |
826 | + delegateCreationEnd: genericFilterGrid.delegateCreationEnd |
827 | + delegate: Item { |
828 | + width: filterGrid.cellWidth |
829 | + height: filterGrid.cellHeight |
830 | + Card { |
831 | + id: card |
832 | + width: cardTool.cardWidth |
833 | + height: cardTool.cardHeight |
834 | + headerHeight: cardTool.headerHeight |
835 | + anchors.horizontalCenter: parent.horizontalCenter |
836 | + objectName: "delegate" + index |
837 | + cardData: model |
838 | + template: cardTool.template |
839 | + components: cardTool.components |
840 | + |
841 | + headerAlignment: cardTool.headerAlignment |
842 | + |
843 | + onClicked: genericFilterGrid.clicked(index, card.y) |
844 | + onPressAndHold: genericFilterGrid.pressAndHold(index, card.y) |
845 | + } |
846 | + } |
847 | + |
848 | + onFilterChanged: { |
849 | + genericFilterGrid.filter = filter |
850 | + filter = Qt.binding(function() { return genericFilterGrid.filter }) |
851 | } |
852 | } |
853 | } |
854 | |
855 | === modified file 'qml/Dash/CardTool.qml' |
856 | --- qml/Dash/CardTool.qml 2014-03-06 15:46:54 +0000 |
857 | +++ qml/Dash/CardTool.qml 2014-03-18 10:57:24 +0000 |
858 | @@ -163,7 +163,7 @@ |
859 | |
860 | Card { |
861 | id: card |
862 | - objectName: "card" |
863 | + objectName: "cardToolCard" |
864 | template: cardTool.template |
865 | components: cardTool.components |
866 | |
867 | |
868 | === removed file 'qml/Dash/DashCarousel.qml' |
869 | --- qml/Dash/DashCarousel.qml 2013-11-22 13:53:00 +0000 |
870 | +++ qml/Dash/DashCarousel.qml 1970-01-01 00:00:00 +0000 |
871 | @@ -1,47 +0,0 @@ |
872 | -/* |
873 | - * Copyright (C) 2013 Canonical, Ltd. |
874 | - * |
875 | - * This program is free software; you can redistribute it and/or modify |
876 | - * it under the terms of the GNU General Public License as published by |
877 | - * the Free Software Foundation; version 3. |
878 | - * |
879 | - * This program is distributed in the hope that it will be useful, |
880 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
881 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
882 | - * GNU General Public License for more details. |
883 | - * |
884 | - * You should have received a copy of the GNU General Public License |
885 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
886 | - */ |
887 | - |
888 | -import QtQuick 2.0 |
889 | -import Ubuntu.Components 0.1 |
890 | -import "../Components" |
891 | - |
892 | -DashRenderer { |
893 | - id: dashCarousel |
894 | - |
895 | - property alias cacheBuffer: carousel.cacheBuffer |
896 | - property alias itemComponent: carousel.itemComponent |
897 | - property alias minimumTileWidth: carousel.minimumTileWidth |
898 | - property alias selectedItemScaleFactor: carousel.selectedItemScaleFactor |
899 | - property alias tileAspectRatio: carousel.tileAspectRatio |
900 | - |
901 | - currentItem: carousel.currentItem |
902 | - height: carousel.implicitHeight + units.gu(6) |
903 | - verticalSpacing: units.gu(3) |
904 | - |
905 | - Carousel { |
906 | - id: carousel |
907 | - anchors.fill: parent |
908 | - tileAspectRatio: 198 / 288 |
909 | - minimumTileWidth: units.gu(13) |
910 | - selectedItemScaleFactor: 1.14 |
911 | - cacheBuffer: 1404 // 18px * 13gu * 6 |
912 | - model: dashCarousel.model |
913 | - highlightIndex: dashCarousel.highlightIndex |
914 | - |
915 | - onClicked: dashCarousel.clicked(index, itemY) |
916 | - onPressAndHold: dashCarousel.pressAndHold(index, itemY) |
917 | - } |
918 | -} |
919 | |
920 | === modified file 'qml/Dash/DashContent.qml' |
921 | --- qml/Dash/DashContent.qml 2014-03-18 10:57:24 +0000 |
922 | +++ qml/Dash/DashContent.qml 2014-03-18 10:57:24 +0000 |
923 | @@ -24,7 +24,7 @@ |
924 | |
925 | property var model: null |
926 | property var scopes: null |
927 | - property alias currentIndex: dashContentList.currentIndex |
928 | + readonly property alias currentIndex: dashContentList.currentIndex |
929 | property alias previewOpen: previewListView.open |
930 | |
931 | property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {} |
932 | @@ -51,6 +51,12 @@ |
933 | } |
934 | |
935 | function setCurrentScopeAtIndex(index, animate, reset) { |
936 | + // if the scopes haven't loaded yet, then wait until they are. |
937 | + if (!scopes.loaded) { |
938 | + set_current_index = [ index, animate, reset ] |
939 | + return; |
940 | + } |
941 | + |
942 | var storedMoveDuration = dashContentList.highlightMoveDuration |
943 | var storedMoveSpeed = dashContentList.highlightMoveVelocity |
944 | if (!animate) { |
945 | @@ -58,11 +64,6 @@ |
946 | dashContentList.highlightMoveDuration = 0 |
947 | } |
948 | |
949 | - // if the scopes haven't loaded yet, then wait until they are. |
950 | - if (!scopes.loaded) { |
951 | - set_current_index = [ index, animate, reset ] |
952 | - return; |
953 | - } |
954 | set_current_index = undefined; |
955 | |
956 | if (dashContentList.count > index) |
957 | @@ -100,7 +101,7 @@ |
958 | id: dashContentList |
959 | objectName: "dashContentList" |
960 | |
961 | - interactive: dashContent.scopes.loaded && !previewListView.open && !currentItem.moving |
962 | + interactive: dashContent.scopes.loaded && !previewListView.open && currentItem && !currentItem.moving |
963 | |
964 | anchors.fill: parent |
965 | model: dashContent.model |
966 | @@ -124,7 +125,7 @@ |
967 | dashContent.setCurrentScopeAtIndex(count-1, true, true) |
968 | } else if (currentIndex < 0) { |
969 | // setting currentIndex directly, cause we don't want to loose set_current_index |
970 | - dashContent.currentIndex = 0 |
971 | + dashContentList.currentIndex = 0 |
972 | } |
973 | } |
974 | } |
975 | @@ -147,11 +148,12 @@ |
976 | readonly property bool isLoaded: status == Loader.Ready |
977 | |
978 | onLoaded: { |
979 | + item.objectName = scope.id |
980 | + item.pageHeader = dashPageHeader; |
981 | + item.previewListView = previewListView; |
982 | item.scope = Qt.binding(function() { return scope }) |
983 | item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem }) |
984 | item.tabBarHeight = dashPageHeader.implicitHeight; |
985 | - item.pageHeader = dashPageHeader; |
986 | - item.previewListView = previewListView; |
987 | dashContentList.movementStarted.connect(item.movementStarted) |
988 | dashContent.positionedAtBeginning.connect(item.positionedAtBeginning) |
989 | dashContent.scopeLoaded(item.scope.id) |
990 | @@ -177,23 +179,25 @@ |
991 | width: parent.width |
992 | searchEntryEnabled: true |
993 | searchHistory: dashContent.searchHistory |
994 | - scope: dashContentList.currentItem.theScope |
995 | + scope: dashContentList.currentItem && dashContentList.currentItem.theScope |
996 | |
997 | childItem: TabBar { |
998 | id: tabBar |
999 | objectName: "tabbar" |
1000 | height: units.gu(6.5) |
1001 | width: parent.width |
1002 | - selectionMode: false |
1003 | style: DashContentTabBarStyle {} |
1004 | |
1005 | - // TODO This together with the __styleInstance onModelChanged below |
1006 | - // are a workaround for the first tab sometimes not showing the text. |
1007 | - // But Tabs are going away in the future so not sure if makes |
1008 | - // sense invetigating what's the problem at this stage |
1009 | - model: dashContentList.model.count > 0 ? dashContentList.model : null |
1010 | + model: dashContentList.model |
1011 | |
1012 | onSelectedIndexChanged: { |
1013 | + if (dashContentList.currentIndex == -1 && tabBar.selectedIndex != -1) { |
1014 | + // TODO This together with the Timer below |
1015 | + // are a workaround for the first tab sometimes not showing the text. |
1016 | + // But Tabs are going away in the future so not sure if makes |
1017 | + // sense invetigating what's the problem at this stage |
1018 | + selectionModeTimer.restart(); |
1019 | + } |
1020 | dashContentList.currentIndex = selectedIndex; |
1021 | } |
1022 | |
1023 | @@ -204,12 +208,10 @@ |
1024 | } |
1025 | } |
1026 | |
1027 | - Connections { |
1028 | - target: __styleInstance |
1029 | - onModelChanged: { |
1030 | - tabBar.selectedIndex = -1; |
1031 | - tabBar.selectedIndex = 0; |
1032 | - } |
1033 | + Timer { |
1034 | + id: selectionModeTimer |
1035 | + interval: 1 |
1036 | + onTriggered: tabBar.selectionMode = false |
1037 | } |
1038 | } |
1039 | } |
1040 | @@ -217,6 +219,7 @@ |
1041 | |
1042 | PreviewListView { |
1043 | id: previewListView |
1044 | + objectName: "dashContentPreviewList" |
1045 | visible: x != width |
1046 | scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null |
1047 | pageHeader: dashPageHeader |
1048 | |
1049 | === removed file 'qml/Dash/DashFilterGrid.qml' |
1050 | --- qml/Dash/DashFilterGrid.qml 2014-03-18 10:57:24 +0000 |
1051 | +++ qml/Dash/DashFilterGrid.qml 1970-01-01 00:00:00 +0000 |
1052 | @@ -1,65 +0,0 @@ |
1053 | -/* |
1054 | - * Copyright (C) 2013 Canonical, Ltd. |
1055 | - * |
1056 | - * This program is free software; you can redistribute it and/or modify |
1057 | - * it under the terms of the GNU General Public License as published by |
1058 | - * the Free Software Foundation; version 3. |
1059 | - * |
1060 | - * This program is distributed in the hope that it will be useful, |
1061 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1062 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1063 | - * GNU General Public License for more details. |
1064 | - * |
1065 | - * You should have received a copy of the GNU General Public License |
1066 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1067 | - */ |
1068 | - |
1069 | -import QtQuick 2.0 |
1070 | -import "../Components" |
1071 | -import ".." |
1072 | - |
1073 | -DashRenderer { |
1074 | - id: dashFilterGrid |
1075 | - |
1076 | - property alias cellWidth: filterGrid.cellWidth |
1077 | - property alias cellHeight: filterGrid.cellHeight |
1078 | - property alias delegate: filterGrid.delegate |
1079 | - property alias delegateWidth: filterGrid.delegateWidth |
1080 | - property alias delegateHeight: filterGrid.delegateHeight |
1081 | - property alias verticalSpacing: filterGrid.verticalSpacing |
1082 | - property alias maximumNumberOfColumns: filterGrid.maximumNumberOfColumns |
1083 | - property alias minimumHorizontalSpacing: filterGrid.minimumHorizontalSpacing |
1084 | - property alias collapsedRowCount: filterGrid.collapsedRowCount |
1085 | - |
1086 | - collapsedHeight: filterGrid.collapsedHeight |
1087 | - columns: filterGrid.columns |
1088 | - rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount |
1089 | - currentItem: filterGrid.currentItem |
1090 | - expandable: filterGrid.expandable |
1091 | - height: filterGrid.height |
1092 | - margins: filterGrid.margins |
1093 | - uncollapsedHeight: filterGrid.uncollapsedHeight |
1094 | - |
1095 | - function startFilterAnimation(filter) { |
1096 | - filterGrid.startFilterAnimation(filter) |
1097 | - } |
1098 | - |
1099 | - FilterGrid { |
1100 | - id: filterGrid |
1101 | - width: dashFilterGrid.width |
1102 | - minimumHorizontalSpacing: units.gu(0.5) |
1103 | - delegateWidth: units.gu(11) |
1104 | - delegateHeight: units.gu(9.5) |
1105 | - verticalSpacing: units.gu(2) |
1106 | - model: dashFilterGrid.model |
1107 | - filter: dashFilterGrid.filter |
1108 | - highlightIndex: dashFilterGrid.highlightIndex |
1109 | - delegateCreationBegin: dashFilterGrid.delegateCreationBegin |
1110 | - delegateCreationEnd: dashFilterGrid.delegateCreationEnd |
1111 | - |
1112 | - onFilterChanged: { |
1113 | - dashFilterGrid.filter = filter |
1114 | - filter = Qt.binding(function() { return dashFilterGrid.filter }) |
1115 | - } |
1116 | - } |
1117 | -} |
1118 | |
1119 | === removed file 'qml/Dash/DashHome.qml' |
1120 | --- qml/Dash/DashHome.qml 2013-08-11 21:21:38 +0000 |
1121 | +++ qml/Dash/DashHome.qml 1970-01-01 00:00:00 +0000 |
1122 | @@ -1,39 +0,0 @@ |
1123 | -/* |
1124 | - * Copyright (C) 2013 Canonical, Ltd. |
1125 | - * |
1126 | - * This program is free software; you can redistribute it and/or modify |
1127 | - * it under the terms of the GNU General Public License as published by |
1128 | - * the Free Software Foundation; version 3. |
1129 | - * |
1130 | - * This program is distributed in the hope that it will be useful, |
1131 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1132 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1133 | - * GNU General Public License for more details. |
1134 | - * |
1135 | - * You should have received a copy of the GNU General Public License |
1136 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1137 | - */ |
1138 | - |
1139 | -import QtQuick 2.0 |
1140 | -import Ubuntu.Components 0.1 |
1141 | -import Utils 0.1 |
1142 | -import "../Components" |
1143 | -import "../Components/ListItems" |
1144 | -import "Apps" |
1145 | - |
1146 | -GenericScopeView { |
1147 | - id: root |
1148 | - objectName: "DashHome" |
1149 | - |
1150 | - SearchableResultModel { |
1151 | - id: appsModel |
1152 | - |
1153 | - model: FrequentlyUsedAppsModel {} |
1154 | - filterRole: 3 |
1155 | - searchQuery: root.scope.searchQuery |
1156 | - } |
1157 | - |
1158 | - onScopeChanged: { |
1159 | - root.scope.categories.overrideResults("applications.scope", appsModel); |
1160 | - } |
1161 | -} |
1162 | |
1163 | === removed file 'qml/Dash/DashPreview.qml' |
1164 | --- qml/Dash/DashPreview.qml 2014-02-03 19:18:05 +0000 |
1165 | +++ qml/Dash/DashPreview.qml 1970-01-01 00:00:00 +0000 |
1166 | @@ -1,208 +0,0 @@ |
1167 | -/* |
1168 | - * Copyright (C) 2013 Canonical, Ltd. |
1169 | - * |
1170 | - * This program is free software; you can redistribute it and/or modify |
1171 | - * it under the terms of the GNU General Public License as published by |
1172 | - * the Free Software Foundation; version 3. |
1173 | - * |
1174 | - * This program is distributed in the hope that it will be useful, |
1175 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1176 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1177 | - * GNU General Public License for more details. |
1178 | - * |
1179 | - * You should have received a copy of the GNU General Public License |
1180 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1181 | - */ |
1182 | - |
1183 | -import QtQuick 2.0 |
1184 | -import Ubuntu.Components 0.1 |
1185 | - |
1186 | -Item { |
1187 | - id: root |
1188 | - |
1189 | - property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0 |
1190 | - property var previewData |
1191 | - property alias showProcessingAction: waitingForActionMouseArea.enabled |
1192 | - |
1193 | - property real previewWidthRatio: 0.5 |
1194 | - property bool isCurrent: false |
1195 | - |
1196 | - property Component previewImages |
1197 | - property Component header |
1198 | - property Component actions |
1199 | - property Component description |
1200 | - property Component ratings |
1201 | - |
1202 | - readonly property bool narrowMode: width <= height * 1.5 |
1203 | - readonly property int columnWidth: narrowMode ? contentRow.width : (contentRow.width / 3) - contentRow.spacing |
1204 | - readonly property int contentSpacing: units.gu(3) |
1205 | - |
1206 | - clip: true |
1207 | - |
1208 | - function ensureVisible(item) { |
1209 | - var o = leftFlickable.mapFromItem(item, 0, 0, item.width, item.height); |
1210 | - var keyboardY = shell.height - root.keyboardSize; |
1211 | - if ((o.y + o.height) > keyboardY) { |
1212 | - leftFlickable.contentY += o.y + o.height - keyboardY; |
1213 | - } |
1214 | - } |
1215 | - |
1216 | - Connections { |
1217 | - target: shell.applicationManager |
1218 | - onMainStageFocusedApplicationChanged: { |
1219 | - root.close(); |
1220 | - } |
1221 | - onSideStageFocusedApplicationChanged: { |
1222 | - root.close(); |
1223 | - } |
1224 | - } |
1225 | - |
1226 | - onPreviewDataChanged: showProcessingAction = false |
1227 | - |
1228 | - MouseArea { |
1229 | - anchors.fill: parent |
1230 | - } |
1231 | - |
1232 | - Row { |
1233 | - id: contentRow |
1234 | - anchors { |
1235 | - left: parent.left |
1236 | - top: parent.top |
1237 | - right: parent.right |
1238 | - bottom: parent.bottom |
1239 | - topMargin: root.contentSpacing |
1240 | - leftMargin: root.contentSpacing |
1241 | - rightMargin: root.contentSpacing |
1242 | - } |
1243 | - height: childrenRect.height |
1244 | - |
1245 | - spacing: units.gu(2) |
1246 | - |
1247 | - |
1248 | - Flickable { |
1249 | - id: leftFlickable |
1250 | - objectName: "leftFlickable" |
1251 | - anchors { |
1252 | - top: parent.top |
1253 | - bottom: parent.bottom |
1254 | - } |
1255 | - width: root.columnWidth |
1256 | - contentHeight: leftColumn.height + root.contentSpacing |
1257 | - anchors.bottomMargin: root.keyboardSize |
1258 | - clip: true |
1259 | - |
1260 | - Behavior on contentY { NumberAnimation { duration: 300 } } |
1261 | - |
1262 | - Column { |
1263 | - id: leftColumn |
1264 | - objectName: "leftColumn" |
1265 | - height: childrenRect.height |
1266 | - spacing: root.contentSpacing |
1267 | - anchors { |
1268 | - left: parent.left |
1269 | - right: parent.right |
1270 | - } |
1271 | - } |
1272 | - } |
1273 | - |
1274 | - Flickable { |
1275 | - id: centerFlickable |
1276 | - anchors { |
1277 | - top: parent.top |
1278 | - bottom: parent.bottom |
1279 | - } |
1280 | - width: root.columnWidth |
1281 | - contentHeight: centerColumn.height |
1282 | - clip: true |
1283 | - |
1284 | - Column { |
1285 | - id: centerColumn |
1286 | - objectName: "centerColumn" |
1287 | - height: childrenRect.height |
1288 | - anchors { |
1289 | - left: parent.left |
1290 | - right: parent.right |
1291 | - } |
1292 | - spacing: root.contentSpacing |
1293 | - } |
1294 | - } |
1295 | - |
1296 | - Flickable { |
1297 | - id: rightFlickable |
1298 | - anchors { |
1299 | - top: parent.top |
1300 | - bottom: parent.bottom |
1301 | - } |
1302 | - width: root.columnWidth |
1303 | - contentHeight: rightColumn.height |
1304 | - clip: true |
1305 | - |
1306 | - Column { |
1307 | - id: rightColumn |
1308 | - objectName: "rightColumn" |
1309 | - height: childrenRect.height |
1310 | - anchors { |
1311 | - left: parent.left |
1312 | - right: parent.right |
1313 | - } |
1314 | - } |
1315 | - } |
1316 | - } |
1317 | - |
1318 | - Loader { |
1319 | - id: previewImageLoader |
1320 | - parent: leftColumn |
1321 | - sourceComponent: root.previewImages |
1322 | - anchors { |
1323 | - left: parent.left |
1324 | - right: parent.right |
1325 | - } |
1326 | - } |
1327 | - |
1328 | - Loader { |
1329 | - id: ratingsLoader |
1330 | - parent: root.narrowMode ? leftColumn : rightColumn |
1331 | - anchors { |
1332 | - left: parent.left |
1333 | - right: parent.right |
1334 | - } |
1335 | - sourceComponent: root.ratings |
1336 | - } |
1337 | - |
1338 | - Loader { |
1339 | - id: descriptionLoader |
1340 | - parent: root.narrowMode ? leftColumn : centerColumn |
1341 | - anchors { |
1342 | - left: parent.left |
1343 | - right: parent.right |
1344 | - } |
1345 | - sourceComponent: root.description |
1346 | - } |
1347 | - |
1348 | - Loader { |
1349 | - id: actionsLoader |
1350 | - parent: root.narrowMode ? leftColumn : centerColumn |
1351 | - anchors { |
1352 | - left: parent.left |
1353 | - right: parent.right |
1354 | - } |
1355 | - sourceComponent: root.actions |
1356 | - } |
1357 | - |
1358 | - Loader { |
1359 | - id: headerLoader |
1360 | - parent: root.narrowMode ? leftColumn : centerColumn |
1361 | - anchors { |
1362 | - left: parent.left |
1363 | - right: parent.right |
1364 | - } |
1365 | - sourceComponent: root.header |
1366 | - } |
1367 | - |
1368 | - MouseArea { |
1369 | - id: waitingForActionMouseArea |
1370 | - objectName: "waitingForActionMouseArea" |
1371 | - anchors.fill: parent |
1372 | - enabled: false |
1373 | - } |
1374 | -} |
1375 | |
1376 | === removed file 'qml/Dash/DashPreviewPlaceholder.qml' |
1377 | --- qml/Dash/DashPreviewPlaceholder.qml 2014-03-18 10:57:24 +0000 |
1378 | +++ qml/Dash/DashPreviewPlaceholder.qml 1970-01-01 00:00:00 +0000 |
1379 | @@ -1,25 +0,0 @@ |
1380 | -/* |
1381 | - * Copyright (C) 2013 Canonical, Ltd. |
1382 | - * |
1383 | - * This program is free software; you can redistribute it and/or modify |
1384 | - * it under the terms of the GNU General Public License as published by |
1385 | - * the Free Software Foundation; version 3. |
1386 | - * |
1387 | - * This program is distributed in the hope that it will be useful, |
1388 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1389 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1390 | - * GNU General Public License for more details. |
1391 | - * |
1392 | - * You should have received a copy of the GNU General Public License |
1393 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1394 | - */ |
1395 | - |
1396 | -import QtQuick 2.0 |
1397 | -import Ubuntu.Components 0.1 |
1398 | - |
1399 | -DashPreview { |
1400 | - ActivityIndicator { |
1401 | - anchors.centerIn: parent |
1402 | - running: visible |
1403 | - } |
1404 | -} |
1405 | |
1406 | === modified file 'qml/Dash/DashRenderer.qml' |
1407 | --- qml/Dash/DashRenderer.qml 2014-03-18 10:57:24 +0000 |
1408 | +++ qml/Dash/DashRenderer.qml 2014-03-18 10:57:24 +0000 |
1409 | @@ -31,9 +31,6 @@ |
1410 | |
1411 | property int rows: 1 |
1412 | |
1413 | - // Index of the highlighted item |
1414 | - property int highlightIndex: -1 |
1415 | - |
1416 | property int margins: 0 |
1417 | |
1418 | property int uncollapsedHeight: height |
1419 | @@ -53,7 +50,7 @@ |
1420 | /*! |
1421 | \brief CardTool component. |
1422 | */ |
1423 | - property var cardTool |
1424 | + property var cardTool: undefined |
1425 | |
1426 | /// Emitted when the user clicked on an item |
1427 | /// @param index is the index of the clicked item |
1428 | |
1429 | === removed directory 'qml/Dash/Generic' |
1430 | === removed file 'qml/Dash/Generic/FlatTileStyle.qml' |
1431 | --- qml/Dash/Generic/FlatTileStyle.qml 2013-10-10 10:20:36 +0000 |
1432 | +++ qml/Dash/Generic/FlatTileStyle.qml 1970-01-01 00:00:00 +0000 |
1433 | @@ -1,79 +0,0 @@ |
1434 | -/* |
1435 | - * Copyright (C) 2013 Canonical, Ltd. |
1436 | - * |
1437 | - * This program is free software; you can redistribute it and/or modify |
1438 | - * it under the terms of the GNU General Public License as published by |
1439 | - * the Free Software Foundation; version 3. |
1440 | - * |
1441 | - * This program is distributed in the hope that it will be useful, |
1442 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1443 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1444 | - * GNU General Public License for more details. |
1445 | - * |
1446 | - * You should have received a copy of the GNU General Public License |
1447 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1448 | - */ |
1449 | - |
1450 | -import QtQuick 2.0 |
1451 | -import Ubuntu.Components 0.1 |
1452 | - |
1453 | -Item { |
1454 | - id: tile |
1455 | - |
1456 | - property bool disabled: false |
1457 | - |
1458 | - anchors.fill: parent |
1459 | - |
1460 | - Image { |
1461 | - id: icon |
1462 | - objectName: "image" |
1463 | - width: styledItem.imageWidth |
1464 | - height: styledItem.imageHeight |
1465 | - |
1466 | - anchors.horizontalCenter: parent.horizontalCenter |
1467 | - |
1468 | - sourceSize { width: width; height: height } |
1469 | - asynchronous: true |
1470 | - cache: false |
1471 | - source: styledItem.source |
1472 | - fillMode: styledItem.fillMode |
1473 | - opacity: tile.disabled ? 0.3 : 1.0 |
1474 | - horizontalAlignment: Image.AlignHCenter |
1475 | - verticalAlignment: Image.AlignVCenter |
1476 | - } |
1477 | - |
1478 | - UbuntuShape { |
1479 | - id: borderPressed |
1480 | - objectName: "borderPressed" |
1481 | - |
1482 | - anchors.fill: icon |
1483 | - radius: "medium" |
1484 | - borderSource: "radius_pressed.sci" |
1485 | - opacity: styledItem.pressed ? 1.0 : 0.0 |
1486 | - Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } } |
1487 | - } |
1488 | - |
1489 | - Label { |
1490 | - id: label |
1491 | - objectName: "label" |
1492 | - anchors { |
1493 | - baseline: icon.bottom |
1494 | - baselineOffset: units.gu(2) |
1495 | - left: parent.left |
1496 | - right: parent.right |
1497 | - leftMargin: units.gu(1) |
1498 | - rightMargin: units.gu(1) |
1499 | - } |
1500 | - |
1501 | - color: Theme.palette.selected.backgroundText |
1502 | - opacity: 0.9 |
1503 | - style: Text.Raised |
1504 | - styleColor: "black" |
1505 | - fontSize: "small" |
1506 | - elide: Text.ElideMiddle |
1507 | - horizontalAlignment: styledItem.horizontalAlignment |
1508 | - text: styledItem.text |
1509 | - wrapMode: Text.Wrap |
1510 | - maximumLineCount: styledItem.maximumLineCount |
1511 | - } |
1512 | -} |
1513 | |
1514 | === removed file 'qml/Dash/Generic/GenericCarousel.qml' |
1515 | --- qml/Dash/Generic/GenericCarousel.qml 2013-12-05 18:01:29 +0000 |
1516 | +++ qml/Dash/Generic/GenericCarousel.qml 1970-01-01 00:00:00 +0000 |
1517 | @@ -1,53 +0,0 @@ |
1518 | -/* |
1519 | - * Copyright (C) 2013 Canonical, Ltd. |
1520 | - * |
1521 | - * This program is free software; you can redistribute it and/or modify |
1522 | - * it under the terms of the GNU General Public License as published by |
1523 | - * the Free Software Foundation; version 3. |
1524 | - * |
1525 | - * This program is distributed in the hope that it will be useful, |
1526 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1527 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1528 | - * GNU General Public License for more details. |
1529 | - * |
1530 | - * You should have received a copy of the GNU General Public License |
1531 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1532 | - */ |
1533 | - |
1534 | -import QtQuick 2.0 |
1535 | -import Ubuntu.Components 0.1 |
1536 | -import "../../Components" |
1537 | -import ".." |
1538 | - |
1539 | -DashCarousel { |
1540 | - id: genericCarousel |
1541 | - itemComponent: carouselDelegateGeneric |
1542 | - |
1543 | - Component { |
1544 | - id: carouselDelegateGeneric |
1545 | - |
1546 | - BaseCarouselDelegate { |
1547 | - id: item |
1548 | - objectName: "carouselDelegate" |
1549 | - |
1550 | - UbuntuShape { |
1551 | - anchors.fill: parent |
1552 | - radius: "medium" |
1553 | - borderSource: "" |
1554 | - image: Image { |
1555 | - asynchronous: true |
1556 | - sourceSize { width: item.width; height: item.height } |
1557 | - source: model ? model.icon : "" |
1558 | - } |
1559 | - } |
1560 | - |
1561 | - BorderImage { |
1562 | - anchors.centerIn: parent |
1563 | - opacity: 0.6 |
1564 | - source: "../../Components/graphics/non-selected.sci" |
1565 | - width: parent.width + units.gu(1.5) |
1566 | - height: parent.height + units.gu(1.5) |
1567 | - } |
1568 | - } |
1569 | - } |
1570 | -} |
1571 | |
1572 | === removed file 'qml/Dash/Generic/GenericFilterGrid.qml' |
1573 | --- qml/Dash/Generic/GenericFilterGrid.qml 2013-11-22 13:53:00 +0000 |
1574 | +++ qml/Dash/Generic/GenericFilterGrid.qml 1970-01-01 00:00:00 +0000 |
1575 | @@ -1,46 +0,0 @@ |
1576 | -/* |
1577 | - * Copyright (C) 2013 Canonical, Ltd. |
1578 | - * |
1579 | - * This program is free software; you can redistribute it and/or modify |
1580 | - * it under the terms of the GNU General Public License as published by |
1581 | - * the Free Software Foundation; version 3. |
1582 | - * |
1583 | - * This program is distributed in the hope that it will be useful, |
1584 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1585 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1586 | - * GNU General Public License for more details. |
1587 | - * |
1588 | - * You should have received a copy of the GNU General Public License |
1589 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1590 | - */ |
1591 | - |
1592 | -import QtQuick 2.0 |
1593 | -import Ubuntu.Components 0.1 |
1594 | -import "../../Components" |
1595 | -import ".." |
1596 | - |
1597 | -DashFilterGrid { |
1598 | - id: genericFilterGrid |
1599 | - |
1600 | - property int iconWidth: units.gu(8) |
1601 | - property int iconHeight: units.gu(7.5) |
1602 | - |
1603 | - minimumHorizontalSpacing: units.gu(0.5) |
1604 | - delegateWidth: units.gu(11) |
1605 | - delegateHeight: units.gu(9.5) |
1606 | - verticalSpacing: units.gu(2) |
1607 | - |
1608 | - delegate: Tile { |
1609 | - id: tile |
1610 | - objectName: "delegate" + index |
1611 | - width: genericFilterGrid.cellWidth |
1612 | - height: genericFilterGrid.cellHeight |
1613 | - text: model.title |
1614 | - imageWidth: genericFilterGrid.iconWidth |
1615 | - imageHeight: genericFilterGrid.iconHeight |
1616 | - source: model.icon |
1617 | - |
1618 | - onClicked: genericFilterGrid.clicked(index, tile.y) |
1619 | - onPressAndHold: genericFilterGrid.pressAndHold(index, tile.y) |
1620 | - } |
1621 | -} |
1622 | |
1623 | === removed file 'qml/Dash/Generic/GenericFilterGridPotrait.qml' |
1624 | --- qml/Dash/Generic/GenericFilterGridPotrait.qml 2013-11-20 00:10:01 +0000 |
1625 | +++ qml/Dash/Generic/GenericFilterGridPotrait.qml 1970-01-01 00:00:00 +0000 |
1626 | @@ -1,28 +0,0 @@ |
1627 | -/* |
1628 | - * Copyright (C) 2013 Canonical, Ltd. |
1629 | - * |
1630 | - * This program is free software; you can redistribute it and/or modify |
1631 | - * it under the terms of the GNU General Public License as published by |
1632 | - * the Free Software Foundation; version 3. |
1633 | - * |
1634 | - * This program is distributed in the hope that it will be useful, |
1635 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1636 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1637 | - * GNU General Public License for more details. |
1638 | - * |
1639 | - * You should have received a copy of the GNU General Public License |
1640 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1641 | - */ |
1642 | - |
1643 | -import QtQuick 2.0 |
1644 | -import Ubuntu.Components 0.1 |
1645 | -import "../../Components" |
1646 | - |
1647 | -GenericFilterGrid { |
1648 | - minimumHorizontalSpacing: units.gu(0.5) |
1649 | - delegateWidth: units.gu(11) |
1650 | - delegateHeight: units.gu(18) |
1651 | - verticalSpacing: units.gu(2) |
1652 | - iconWidth: (width / columns) * 0.8 |
1653 | - iconHeight: iconWidth * 16 / 11 |
1654 | -} |
1655 | |
1656 | === removed file 'qml/Dash/Generic/GenericPreview.qml' |
1657 | --- qml/Dash/Generic/GenericPreview.qml 2014-01-23 06:57:49 +0000 |
1658 | +++ qml/Dash/Generic/GenericPreview.qml 1970-01-01 00:00:00 +0000 |
1659 | @@ -1,197 +0,0 @@ |
1660 | -/* |
1661 | - * Copyright (C) 2013, 2014 Canonical, Ltd. |
1662 | - * |
1663 | - * This program is free software; you can redistribute it and/or modify |
1664 | - * it under the terms of the GNU General Public License as published by |
1665 | - * the Free Software Foundation; version 3. |
1666 | - * |
1667 | - * This program is distributed in the hope that it will be useful, |
1668 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1669 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1670 | - * GNU General Public License for more details. |
1671 | - * |
1672 | - * You should have received a copy of the GNU General Public License |
1673 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1674 | - */ |
1675 | - |
1676 | -import QtQuick 2.0 |
1677 | -import Ubuntu.Components 0.1 |
1678 | -import Ubuntu.Components.ListItems 0.1 as ListItems |
1679 | -import Ubuntu.DownloadDaemonListener 0.1 |
1680 | -import "../../Components" |
1681 | -import ".." |
1682 | -import "../Previews" |
1683 | - |
1684 | -DashPreview { |
1685 | - id: genericPreview |
1686 | - |
1687 | - previewImages: previewImagesComponent |
1688 | - header: headerComponent |
1689 | - actions: (previewData.infoMap !== undefined && previewData.infoMap["show_progressbar"]) ? progressComponent : actionsComponent |
1690 | - description: descriptionComponent |
1691 | - |
1692 | - Component { |
1693 | - id: previewImagesComponent |
1694 | - |
1695 | - LazyImage { |
1696 | - objectName: "genericPreviewImage" |
1697 | - anchors { |
1698 | - left: parent.left |
1699 | - right: parent.right |
1700 | - } |
1701 | - scaleTo: "width" |
1702 | - source: genericPreview.previewData.image |
1703 | - initialHeight: width |
1704 | - } |
1705 | - } |
1706 | - |
1707 | - Component { |
1708 | - id: headerComponent |
1709 | - Header { |
1710 | - title: previewData.title |
1711 | - subtitle: previewData.subtitle |
1712 | - } |
1713 | - } |
1714 | - |
1715 | - Component { |
1716 | - id: actionsComponent |
1717 | - |
1718 | - Column { |
1719 | - id: buttonList |
1720 | - spacing: units.gu(1) |
1721 | - Repeater { |
1722 | - objectName: "buttonList" |
1723 | - model: previewData.actions |
1724 | - |
1725 | - delegate: Button { |
1726 | - objectName: "button" + index |
1727 | - width: parent.width |
1728 | - height: buttonList.buttonHeight |
1729 | - color: Theme.palette.selected.foreground |
1730 | - text: modelData.displayName |
1731 | - iconSource: modelData.iconHint |
1732 | - iconPosition: "right" |
1733 | - onClicked: { |
1734 | - previewData.execute(modelData.id, { }) |
1735 | - genericPreview.showProcessingAction = true; |
1736 | - } |
1737 | - } |
1738 | - } |
1739 | - } |
1740 | - } |
1741 | - |
1742 | - Component { |
1743 | - id: progressComponent |
1744 | - |
1745 | - ProgressBar { |
1746 | - id: progressBar |
1747 | - objectName: "progressBar" |
1748 | - value: 0 |
1749 | - maximumValue: 100 |
1750 | - height: units.gu(5) |
1751 | - |
1752 | - property var model: previewData.actions |
1753 | - |
1754 | - DownloadTracker { |
1755 | - service: "com.canonical.applications.Downloader" |
1756 | - dbusPath: previewData.infoMap["progressbar_source"] ? previewData.infoMap["progressbar_source"].value : "" |
1757 | - |
1758 | - onProgress: { |
1759 | - var percentage = parseInt(received * 100 / total); |
1760 | - progressBar.value = percentage; |
1761 | - } |
1762 | - |
1763 | - onFinished: { |
1764 | - previewData.execute(progressBar.model[0].id, { }) |
1765 | - } |
1766 | - |
1767 | - onError: { |
1768 | - previewData.execute(progressBar.model[1].id, { "error": error }); |
1769 | - } |
1770 | - } |
1771 | - |
1772 | - } |
1773 | - } |
1774 | - |
1775 | - Component { |
1776 | - id: descriptionComponent |
1777 | - Column { |
1778 | - spacing: units.gu(2) |
1779 | - |
1780 | - Label { |
1781 | - id: descriptionLabel |
1782 | - objectName: "descriptionLabel" |
1783 | - anchors { left: parent.left; right: parent.right } |
1784 | - visible: text != "" |
1785 | - fontSize: "small" |
1786 | - opacity: 0.6 |
1787 | - color: "white" |
1788 | - text: previewData.description.replace(/[\r\n]/g, "<br />") |
1789 | - style: Text.Raised |
1790 | - styleColor: "black" |
1791 | - wrapMode: Text.WordWrap |
1792 | - textFormat: Text.RichText |
1793 | - // FIXME: workaround for https://bugreports.qt-project.org/browse/QTBUG-33020 |
1794 | - onWidthChanged: { wrapMode = Text.NoWrap; wrapMode = Text.WordWrap } |
1795 | - } |
1796 | - |
1797 | - Column { |
1798 | - objectName: "infoHintColumn" |
1799 | - anchors { |
1800 | - left: parent.left |
1801 | - right: parent.right |
1802 | - } |
1803 | - Repeater { |
1804 | - objectName: "infoHintRepeater" |
1805 | - model: previewData.infoHints |
1806 | - |
1807 | - delegate: Item { |
1808 | - objectName: "infoHintItem" + index |
1809 | - width: parent.width |
1810 | - height: units.gu(5) |
1811 | - Row { |
1812 | - width: parent.width |
1813 | - spacing: units.gu(1) |
1814 | - property int columnWidth: (width - spacing) / 2 |
1815 | - anchors.verticalCenter: parent.verticalCenter |
1816 | - |
1817 | - Label { |
1818 | - objectName: "displayNameLabel" |
1819 | - visible: valueLabel.visible |
1820 | - fontSize: "small" |
1821 | - opacity: 0.9 |
1822 | - color: "white" |
1823 | - horizontalAlignment: Text.AlignLeft |
1824 | - width: parent.columnWidth |
1825 | - text: modelData.displayName |
1826 | - style: Text.Raised |
1827 | - styleColor: "black" |
1828 | - } |
1829 | - Label { |
1830 | - id: valueLabel |
1831 | - objectName: "valueLabel" |
1832 | - visible: modelData.value != "" |
1833 | - fontSize: "small" |
1834 | - opacity: 0.6 |
1835 | - color: "white" |
1836 | - horizontalAlignment: Text.AlignRight |
1837 | - width: parent.columnWidth |
1838 | - text: modelData.value ? modelData.value : "" |
1839 | - style: Text.Raised |
1840 | - styleColor: "black" |
1841 | - wrapMode: Text.WordWrap |
1842 | - } |
1843 | - } |
1844 | - ListItems.ThinDivider { |
1845 | - anchors { |
1846 | - left: parent.left |
1847 | - bottom: parent.bottom |
1848 | - right: parent.right |
1849 | - } |
1850 | - } |
1851 | - } |
1852 | - } |
1853 | - } |
1854 | - } |
1855 | - } |
1856 | -} |
1857 | |
1858 | === removed file 'qml/Dash/Generic/WeatherFilterGrid.qml' |
1859 | --- qml/Dash/Generic/WeatherFilterGrid.qml 2013-11-11 11:44:39 +0000 |
1860 | +++ qml/Dash/Generic/WeatherFilterGrid.qml 1970-01-01 00:00:00 +0000 |
1861 | @@ -1,47 +0,0 @@ |
1862 | -/* |
1863 | - * Copyright (C) 2013 Canonical, Ltd. |
1864 | - * |
1865 | - * This program is free software; you can redistribute it and/or modify |
1866 | - * it under the terms of the GNU General Public License as published by |
1867 | - * the Free Software Foundation; version 3. |
1868 | - * |
1869 | - * This program is distributed in the hope that it will be useful, |
1870 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1871 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1872 | - * GNU General Public License for more details. |
1873 | - * |
1874 | - * You should have received a copy of the GNU General Public License |
1875 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1876 | - */ |
1877 | - |
1878 | -import QtQuick 2.0 |
1879 | -import Ubuntu.Components 0.1 |
1880 | -import "../../Components" |
1881 | - |
1882 | -GenericFilterGrid { |
1883 | - id: filtergrid |
1884 | - |
1885 | - delegateHeight: units.gu(11.5) |
1886 | - |
1887 | - delegate: Tile { |
1888 | - id: tile |
1889 | - objectName: "delegate" + index |
1890 | - width: filtergrid.cellWidth |
1891 | - height: filtergrid.cellHeight |
1892 | - text: model.title |
1893 | - imageWidth: filtergrid.iconWidth |
1894 | - imageHeight: filtergrid.iconHeight |
1895 | - source: model.icon |
1896 | - maximumLineCount: 2 |
1897 | - |
1898 | - style: FlatTileStyle {} |
1899 | - |
1900 | - onClicked: { |
1901 | - filtergrid.clicked(index, tile.y) |
1902 | - } |
1903 | - |
1904 | - onPressAndHold: { |
1905 | - filtergrid.pressAndHold(index, tile.y) |
1906 | - } |
1907 | - } |
1908 | -} |
1909 | |
1910 | === modified file 'qml/Dash/GenericScopeView.qml' |
1911 | --- qml/Dash/GenericScopeView.qml 2014-03-18 10:57:24 +0000 |
1912 | +++ qml/Dash/GenericScopeView.qml 2014-03-18 10:57:24 +0000 |
1913 | @@ -24,9 +24,9 @@ |
1914 | FocusScope { |
1915 | id: scopeView |
1916 | |
1917 | - property Scope scope |
1918 | + property Scope scope: null |
1919 | property SortFilterProxyModel categories: categoryFilter |
1920 | - property bool isCurrent |
1921 | + property bool isCurrent: false |
1922 | property alias moving: categoryView.moving |
1923 | property int tabBarHeight: 0 |
1924 | property PageHeader pageHeader: null |
1925 | @@ -91,7 +91,7 @@ |
1926 | Binding { |
1927 | target: pageHeader |
1928 | property: "searchQuery" |
1929 | - value: scopeView.scope.searchQuery |
1930 | + value: scopeView.scope ? scopeView.scope.searchQuery : "" |
1931 | when: isCurrent |
1932 | } |
1933 | |
1934 | @@ -122,11 +122,6 @@ |
1935 | onOriginYChanged: pageHeader.positionRealHeader(); |
1936 | onContentHeightChanged: pageHeader.positionRealHeader(); |
1937 | |
1938 | - Behavior on contentY { |
1939 | - enabled: previewListView.open |
1940 | - UbuntuNumberAnimation {} |
1941 | - } |
1942 | - |
1943 | delegate: ListItems.Base { |
1944 | id: baseItem |
1945 | objectName: "dashCategory" + category |
1946 | |
1947 | === removed directory 'qml/Dash/Movie' |
1948 | === removed file 'qml/Dash/Movie/MoviePreview.qml' |
1949 | --- qml/Dash/Movie/MoviePreview.qml 2013-10-02 19:21:33 +0000 |
1950 | +++ qml/Dash/Movie/MoviePreview.qml 1970-01-01 00:00:00 +0000 |
1951 | @@ -1,71 +0,0 @@ |
1952 | -/* |
1953 | - * Copyright (C) 2013 Canonical, Ltd. |
1954 | - * |
1955 | - * This program is free software; you can redistribute it and/or modify |
1956 | - * it under the terms of the GNU General Public License as published by |
1957 | - * the Free Software Foundation; version 3. |
1958 | - * |
1959 | - * This program is distributed in the hope that it will be useful, |
1960 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1961 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1962 | - * GNU General Public License for more details. |
1963 | - * |
1964 | - * You should have received a copy of the GNU General Public License |
1965 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1966 | - */ |
1967 | - |
1968 | -import QtQuick 2.0 |
1969 | -import Ubuntu.Components 0.1 |
1970 | -import ".." |
1971 | -import "../Generic" |
1972 | -import "../../Components" |
1973 | -import "../Previews" |
1974 | - |
1975 | -GenericPreview { |
1976 | - id: root |
1977 | - |
1978 | - property bool ready: previewData ? true : false |
1979 | - property url url: ready ? previewData.image : "" |
1980 | - |
1981 | - previewImages: previewImageComponent |
1982 | - header: headerComponent |
1983 | - |
1984 | - Component { |
1985 | - id: previewImageComponent |
1986 | - LazyImage { |
1987 | - anchors.left: parent.left |
1988 | - anchors.right: parent.right |
1989 | - scaleTo: "width" |
1990 | - visible: height > 0 |
1991 | - source: root.url |
1992 | - initialHeight: width * 10 / 16 |
1993 | - |
1994 | - Image { |
1995 | - objectName: "playButton" |
1996 | - anchors.centerIn: parent |
1997 | - readonly property bool bigButton: parent.width > units.gu(40) |
1998 | - width: bigButton ? units.gu(8) : units.gu(4.5) |
1999 | - height: width |
2000 | - source: "../graphics/play_button%1%2.png".arg(previewImageMouseArea.pressed ? "_active" : "").arg(bigButton ? "_big" : "") |
2001 | - } |
2002 | - |
2003 | - MouseArea { |
2004 | - id: previewImageMouseArea |
2005 | - anchors.fill: parent |
2006 | - onClicked: { |
2007 | - Qt.openUrlExternally(previewData.result.uri); |
2008 | - } |
2009 | - } |
2010 | - } |
2011 | - } |
2012 | - |
2013 | - Component { |
2014 | - id: headerComponent |
2015 | - Header { |
2016 | - title: previewData.title |
2017 | - rating: Math.round(previewData.rating * 10) |
2018 | - reviews: previewData.numRatings |
2019 | - rated: previewData.infoMap["rated"] ? previewData.infoMap["rated"].value : 0 |
2020 | - } |
2021 | - } |
2022 | -} |
2023 | |
2024 | === removed directory 'qml/Dash/Music' |
2025 | === removed file 'qml/Dash/Music/CarouselDelegateMusic.qml' |
2026 | --- qml/Dash/Music/CarouselDelegateMusic.qml 2013-07-09 11:04:25 +0000 |
2027 | +++ qml/Dash/Music/CarouselDelegateMusic.qml 1970-01-01 00:00:00 +0000 |
2028 | @@ -1,42 +0,0 @@ |
2029 | -/* |
2030 | - * Copyright (C) 2013 Canonical, Ltd. |
2031 | - * |
2032 | - * This program is free software; you can redistribute it and/or modify |
2033 | - * it under the terms of the GNU General Public License as published by |
2034 | - * the Free Software Foundation; version 3. |
2035 | - * |
2036 | - * This program is distributed in the hope that it will be useful, |
2037 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2038 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2039 | - * GNU General Public License for more details. |
2040 | - * |
2041 | - * You should have received a copy of the GNU General Public License |
2042 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2043 | - */ |
2044 | - |
2045 | -import QtQuick 2.0 |
2046 | -import Ubuntu.Components 0.1 |
2047 | -import "../../Components" |
2048 | - |
2049 | -BaseCarouselDelegate { |
2050 | - id: item |
2051 | - |
2052 | - UbuntuShape { |
2053 | - anchors.fill: parent |
2054 | - radius: "medium" |
2055 | - borderSource: "" |
2056 | - image: Image { |
2057 | - asynchronous: true |
2058 | - sourceSize { width: item.width; height: item.height } |
2059 | - source: model ? model.icon : "" |
2060 | - } |
2061 | - } |
2062 | - |
2063 | - BorderImage { |
2064 | - anchors.centerIn: parent |
2065 | - opacity: 0.6 |
2066 | - source: "../../Components/graphics/non-selected.sci" |
2067 | - width: parent.width + units.gu(1.5) |
2068 | - height: parent.height + units.gu(1.5) |
2069 | - } |
2070 | -} |
2071 | |
2072 | === removed file 'qml/Dash/Music/MusicCarousel.qml' |
2073 | --- qml/Dash/Music/MusicCarousel.qml 2013-11-20 00:10:01 +0000 |
2074 | +++ qml/Dash/Music/MusicCarousel.qml 1970-01-01 00:00:00 +0000 |
2075 | @@ -1,34 +0,0 @@ |
2076 | -/* |
2077 | - * Copyright (C) 2013 Canonical, Ltd. |
2078 | - * |
2079 | - * This program is free software; you can redistribute it and/or modify |
2080 | - * it under the terms of the GNU General Public License as published by |
2081 | - * the Free Software Foundation; version 3. |
2082 | - * |
2083 | - * This program is distributed in the hope that it will be useful, |
2084 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2085 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2086 | - * GNU General Public License for more details. |
2087 | - * |
2088 | - * You should have received a copy of the GNU General Public License |
2089 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2090 | - */ |
2091 | - |
2092 | -import QtQuick 2.0 |
2093 | -import "../../Components" |
2094 | -import ".." |
2095 | - |
2096 | -DashCarousel { |
2097 | - id: musicCarousel |
2098 | - tileAspectRatio: 1 |
2099 | - minimumTileWidth: units.gu(13) |
2100 | - itemComponent: carouselDelegateMusic |
2101 | - selectedItemScaleFactor: 1.2 |
2102 | - cacheBuffer: 1404 // 18px * 13gu * 6 |
2103 | - |
2104 | - Component { |
2105 | - id: carouselDelegateMusic |
2106 | - CarouselDelegateMusic { |
2107 | - } |
2108 | - } |
2109 | -} |
2110 | |
2111 | === removed file 'qml/Dash/Music/MusicFilterGrid.qml' |
2112 | --- qml/Dash/Music/MusicFilterGrid.qml 2013-11-22 13:53:00 +0000 |
2113 | +++ qml/Dash/Music/MusicFilterGrid.qml 1970-01-01 00:00:00 +0000 |
2114 | @@ -1,48 +0,0 @@ |
2115 | -/* |
2116 | - * Copyright (C) 2013 Canonical, Ltd. |
2117 | - * |
2118 | - * This program is free software; you can redistribute it and/or modify |
2119 | - * it under the terms of the GNU General Public License as published by |
2120 | - * the Free Software Foundation; version 3. |
2121 | - * |
2122 | - * This program is distributed in the hope that it will be useful, |
2123 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2124 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2125 | - * GNU General Public License for more details. |
2126 | - * |
2127 | - * You should have received a copy of the GNU General Public License |
2128 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2129 | - */ |
2130 | - |
2131 | -import QtQuick 2.0 |
2132 | -import "../../Components" |
2133 | -import "../Generic" |
2134 | - |
2135 | -GenericFilterGrid { |
2136 | - id: musicFilterGrid |
2137 | - |
2138 | - delegateWidth: units.gu(11) |
2139 | - delegateHeight: units.gu(16) |
2140 | - iconWidth: units.gu(11) |
2141 | - iconHeight: units.gu(11) |
2142 | - |
2143 | - delegate: Tile { |
2144 | - id: tile |
2145 | - objectName: "delegate" + index |
2146 | - width: musicFilterGrid.cellWidth |
2147 | - height: musicFilterGrid.cellHeight |
2148 | - text: model.comment |
2149 | - imageWidth: musicFilterGrid.iconWidth |
2150 | - imageHeight: musicFilterGrid.iconHeight |
2151 | - source: model.icon |
2152 | - maximumLineCount: 2 |
2153 | - horizontalAlignment: Text.AlignLeft |
2154 | - |
2155 | - style: MusicTileStyle { |
2156 | - artist: model.title |
2157 | - } |
2158 | - |
2159 | - onClicked: musicFilterGrid.clicked(index, tile.y) |
2160 | - onPressAndHold: musicFilterGrid.pressAndHold(index, tile.y) |
2161 | - } |
2162 | -} |
2163 | |
2164 | === removed file 'qml/Dash/Music/MusicPreview.qml' |
2165 | --- qml/Dash/Music/MusicPreview.qml 2014-01-29 16:12:16 +0000 |
2166 | +++ qml/Dash/Music/MusicPreview.qml 1970-01-01 00:00:00 +0000 |
2167 | @@ -1,203 +0,0 @@ |
2168 | -/* |
2169 | - * Copyright (C) 2013 Canonical, Ltd. |
2170 | - * |
2171 | - * This program is free software; you can redistribute it and/or modify |
2172 | - * it under the terms of the GNU General Public License as published by |
2173 | - * the Free Software Foundation; version 3. |
2174 | - * |
2175 | - * This program is distributed in the hope that it will be useful, |
2176 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2177 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2178 | - * GNU General Public License for more details. |
2179 | - * |
2180 | - * You should have received a copy of the GNU General Public License |
2181 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2182 | - */ |
2183 | - |
2184 | -import QtQuick 2.0 |
2185 | -import QtMultimedia 5.0 |
2186 | -import Ubuntu.Components 0.1 |
2187 | -import Ubuntu.Components.ListItems 0.1 |
2188 | -import ".." |
2189 | -import "../Generic" |
2190 | -import "../../Components" |
2191 | -import "../Previews" |
2192 | - |
2193 | -GenericPreview { |
2194 | - id: root |
2195 | - |
2196 | - previewImages: previewImageComponent |
2197 | - header: headerComponent |
2198 | - description: descriptionComponent |
2199 | - |
2200 | - Component { |
2201 | - id: previewImageComponent |
2202 | - LazyImage { |
2203 | - height: units.gu(22) |
2204 | - scaleTo: "height" |
2205 | - source: previewData ? previewData.image : "" |
2206 | - initialHeight: height |
2207 | - initialWidth: height |
2208 | - } |
2209 | - } |
2210 | - |
2211 | - Component { |
2212 | - id: headerComponent |
2213 | - Header { |
2214 | - title: previewData.title |
2215 | - subtitle: previewData.subtitle |
2216 | - } |
2217 | - } |
2218 | - |
2219 | - Component { |
2220 | - id: descriptionComponent |
2221 | - |
2222 | - Item { |
2223 | - height: childrenRect.height |
2224 | - Audio { |
2225 | - id: audioPlayer |
2226 | - objectName: "audioPlayer" |
2227 | - property real progress: audioPlayer.position / audioPlayer.duration |
2228 | - |
2229 | - property Item playingItem |
2230 | - |
2231 | - Component.onDestruction: { |
2232 | - audioPlayer.stop(); |
2233 | - } |
2234 | - |
2235 | - onErrorStringChanged: console.warn("Audio player error:", errorString) |
2236 | - |
2237 | - } |
2238 | - |
2239 | - Connections { |
2240 | - target: root |
2241 | - onIsCurrentChanged: { |
2242 | - if (!root.isCurrent) { |
2243 | - audioPlayer.stop(); |
2244 | - } |
2245 | - } |
2246 | - } |
2247 | - |
2248 | - Column { |
2249 | - anchors { left: parent.left; right: parent.right } |
2250 | - visible: trackRepeater.count > 0 |
2251 | - |
2252 | - ThinDivider { |
2253 | - objectName: "topDivider" |
2254 | - anchors { left: parent.left; right: parent.right } |
2255 | - } |
2256 | - |
2257 | - Repeater { |
2258 | - id: trackRepeater |
2259 | - objectName: "trackRepeater" |
2260 | - |
2261 | - model: previewData.tracks |
2262 | - |
2263 | - delegate: Item { |
2264 | - id: trackItem |
2265 | - objectName: "trackItem" + index |
2266 | - anchors { left: parent.left; right: parent.right } |
2267 | - height: units.gu(5) |
2268 | - property bool isPlayingItem: audioPlayer.playingItem == trackItem |
2269 | - |
2270 | - function play() { |
2271 | - audioPlayer.stop(); |
2272 | - // Make sure we change the source, even if two items point to the same uri location |
2273 | - audioPlayer.source = ""; |
2274 | - audioPlayer.source = model.uri; |
2275 | - audioPlayer.playingItem = trackItem; |
2276 | - audioPlayer.play(); |
2277 | - } |
2278 | - |
2279 | - Row { |
2280 | - id: trackRow |
2281 | - width: parent.width |
2282 | - spacing: units.gu(1) |
2283 | - property int column1Width: units.gu(3) |
2284 | - property int column2Width: width - (2 * spacing) - column1Width - column3Width |
2285 | - property int column3Width: units.gu(4) |
2286 | - anchors.verticalCenter: parent.verticalCenter |
2287 | - |
2288 | - Button { |
2289 | - objectName: "playButton" |
2290 | - width: trackRow.column1Width |
2291 | - height: width |
2292 | - iconSource: audioPlayer.playbackState == Audio.PlayingState && trackItem.isPlayingItem ? "image://theme/media-playback-pause" : "image://theme/media-playback-start" |
2293 | - |
2294 | - // Can't be "transparent" or "#00xxxxxx" as the button optimizes away the surrounding shape |
2295 | - // FIXME when this is resolved: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1251685 |
2296 | - color: "#01000000" |
2297 | - |
2298 | - onClicked: { |
2299 | - if (trackItem.isPlayingItem) { |
2300 | - if (audioPlayer.playbackState == Audio.PlayingState) { |
2301 | - audioPlayer.pause(); |
2302 | - } else if (audioPlayer.playbackState == Audio.PausedState){ |
2303 | - audioPlayer.play(); |
2304 | - } |
2305 | - } else { |
2306 | - trackItem.play(); |
2307 | - } |
2308 | - } |
2309 | - } |
2310 | - |
2311 | - Label { |
2312 | - objectName: "trackTitleLabel" |
2313 | - fontSize: "small" |
2314 | - opacity: 0.9 |
2315 | - color: "white" |
2316 | - horizontalAlignment: Text.AlignLeft |
2317 | - anchors.verticalCenter: parent.verticalCenter |
2318 | - width: parent.column2Width |
2319 | - text: title |
2320 | - style: Text.Raised |
2321 | - styleColor: "black" |
2322 | - elide: Text.ElideRight |
2323 | - |
2324 | - UbuntuShape { |
2325 | - id: progressBarFill |
2326 | - objectName: "progressBarFill" |
2327 | - color: UbuntuColors.orange |
2328 | - anchors.left: progressBarImage.left |
2329 | - anchors.right: progressBarImage.right |
2330 | - anchors.verticalCenter: progressBarImage.verticalCenter |
2331 | - height: units.dp(2) |
2332 | - anchors.margins: units.dp(2) |
2333 | - anchors.rightMargin: maxWidth - (maxWidth * audioPlayer.progress) + units.dp(2) |
2334 | - visible: progressBarImage.visible |
2335 | - property int maxWidth: progressBarImage.width - units.dp(4) |
2336 | - } |
2337 | - |
2338 | - Image { |
2339 | - id: progressBarImage |
2340 | - anchors { left: parent.left; top: parent.bottom; right: parent.right } |
2341 | - height: units.dp(6) |
2342 | - visible: audioPlayer.playbackState != Audio.StoppedState && trackItem.isPlayingItem && model.length.length > 0 |
2343 | - source: "graphics/music_progress_bg.png" |
2344 | - } |
2345 | - } |
2346 | - |
2347 | - Label { |
2348 | - id: valueLabel |
2349 | - objectName: "timeLabel" |
2350 | - fontSize: "small" |
2351 | - opacity: 0.9 |
2352 | - color: "white" |
2353 | - anchors.verticalCenter: parent.verticalCenter |
2354 | - horizontalAlignment: Text.AlignRight |
2355 | - width: parent.column3Width |
2356 | - text: length |
2357 | - style: Text.Raised |
2358 | - styleColor: "black" |
2359 | - } |
2360 | - } |
2361 | - |
2362 | - ThinDivider { |
2363 | - anchors { left: parent.left; bottom: parent.bottom; right: parent.right } |
2364 | - } |
2365 | - } |
2366 | - } |
2367 | - } |
2368 | - } |
2369 | - } |
2370 | -} |
2371 | |
2372 | === removed file 'qml/Dash/Music/MusicTileStyle.qml' |
2373 | --- qml/Dash/Music/MusicTileStyle.qml 2013-10-14 10:23:18 +0000 |
2374 | +++ qml/Dash/Music/MusicTileStyle.qml 1970-01-01 00:00:00 +0000 |
2375 | @@ -1,102 +0,0 @@ |
2376 | -/* |
2377 | - * Copyright (C) 2013 Canonical, Ltd. |
2378 | - * |
2379 | - * This program is free software; you can redistribute it and/or modify |
2380 | - * it under the terms of the GNU General Public License as published by |
2381 | - * the Free Software Foundation; version 3. |
2382 | - * |
2383 | - * This program is distributed in the hope that it will be useful, |
2384 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2385 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2386 | - * GNU General Public License for more details. |
2387 | - * |
2388 | - * You should have received a copy of the GNU General Public License |
2389 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2390 | - */ |
2391 | - |
2392 | -import QtQuick 2.0 |
2393 | -import Ubuntu.Components 0.1 |
2394 | - |
2395 | -Item { |
2396 | - id: tile |
2397 | - |
2398 | - property alias artist: artistLabel.text |
2399 | - |
2400 | - anchors.fill: parent |
2401 | - |
2402 | - UbuntuShape { |
2403 | - id: icon |
2404 | - anchors { |
2405 | - top: parent.top |
2406 | - horizontalCenter: parent.horizontalCenter |
2407 | - } |
2408 | - radius: "medium" |
2409 | - width: styledItem.imageWidth |
2410 | - height: styledItem.imageHeight |
2411 | - image: Image { |
2412 | - id: image |
2413 | - objectName: "image" |
2414 | - sourceSize { width: icon.width; height: icon.height } |
2415 | - asynchronous: true |
2416 | - cache: false |
2417 | - source: styledItem.source |
2418 | - fillMode: styledItem.fillMode |
2419 | - horizontalAlignment: Image.AlignHCenter |
2420 | - verticalAlignment: Image.AlignVCenter |
2421 | - } |
2422 | - } |
2423 | - |
2424 | - UbuntuShape { |
2425 | - id: borderPressed |
2426 | - objectName: "borderPressed" |
2427 | - |
2428 | - anchors.fill: icon |
2429 | - radius: "medium" |
2430 | - borderSource: "radius_pressed.sci" |
2431 | - opacity: styledItem.pressed ? 1.0 : 0.0 |
2432 | - Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } } |
2433 | - } |
2434 | - |
2435 | - Label { |
2436 | - id: label |
2437 | - objectName: "label" |
2438 | - anchors { |
2439 | - baseline: icon.bottom |
2440 | - baselineOffset: units.gu(2) |
2441 | - left: icon.left |
2442 | - right: parent.right |
2443 | - rightMargin: units.gu(1) |
2444 | - leftMargin: units.dp(2) |
2445 | - } |
2446 | - |
2447 | - color: Theme.palette.selected.backgroundText |
2448 | - opacity: 0.9 |
2449 | - style: Text.Raised |
2450 | - styleColor: "black" |
2451 | - fontSize: "small" |
2452 | - font.weight: Font.Bold |
2453 | - elide: Text.ElideRight |
2454 | - horizontalAlignment: styledItem.horizontalAlignment |
2455 | - text: styledItem.text |
2456 | - wrapMode: Text.Wrap |
2457 | - maximumLineCount: styledItem.maximumLineCount |
2458 | - } |
2459 | - |
2460 | - Label { |
2461 | - id: artistLabel |
2462 | - anchors { |
2463 | - top: label.bottom |
2464 | - left: label.left |
2465 | - right: label.right |
2466 | - rightMargin: units.gu(1) |
2467 | - } |
2468 | - |
2469 | - color: Theme.palette.selected.backgroundText |
2470 | - opacity: 0.9 |
2471 | - style: Text.Raised |
2472 | - styleColor: "black" |
2473 | - fontSize: "x-small" |
2474 | - elide: Text.ElideMiddle |
2475 | - horizontalAlignment: styledItem.horizontalAlignment |
2476 | - } |
2477 | -} |
2478 | |
2479 | === removed file 'qml/Dash/PreviewDelegateMapper.qml' |
2480 | --- qml/Dash/PreviewDelegateMapper.qml 2013-11-04 15:40:30 +0000 |
2481 | +++ qml/Dash/PreviewDelegateMapper.qml 1970-01-01 00:00:00 +0000 |
2482 | @@ -1,38 +0,0 @@ |
2483 | -/* |
2484 | - * Copyright (C) 2013 Canonical, Ltd. |
2485 | - * |
2486 | - * This program is free software; you can redistribute it and/or modify |
2487 | - * it under the terms of the GNU General Public License as published by |
2488 | - * the Free Software Foundation; version 3. |
2489 | - * |
2490 | - * This program is distributed in the hope that it will be useful, |
2491 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2492 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2493 | - * GNU General Public License for more details. |
2494 | - * |
2495 | - * You should have received a copy of the GNU General Public License |
2496 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2497 | - */ |
2498 | - |
2499 | -import QtQuick 2.0 |
2500 | - |
2501 | -QtObject { |
2502 | - property var d: QtObject { |
2503 | - readonly property string genericPreview: "Generic/GenericPreview.qml" |
2504 | - readonly property string appPreview: "Apps/AppPreview.qml" |
2505 | - property var previewDelegateMapping: {"preview-generic": genericPreview, |
2506 | - "preview-application": appPreview, |
2507 | - "preview-movie": "Movie/MoviePreview.qml", |
2508 | - "preview-music": "Music/MusicPreview.qml", |
2509 | - } |
2510 | - } |
2511 | - |
2512 | - function map(rendererName) { |
2513 | - var customPreview = d.previewDelegateMapping[rendererName] |
2514 | - if (customPreview != undefined) { |
2515 | - return customPreview |
2516 | - } |
2517 | - console.debug("Renderer "+rendererName+" not found, using preview-generic") |
2518 | - return d.genericPreview |
2519 | - } |
2520 | -} |
2521 | |
2522 | === modified file 'qml/Dash/PreviewListView.qml' |
2523 | --- qml/Dash/PreviewListView.qml 2014-03-18 10:57:24 +0000 |
2524 | +++ qml/Dash/PreviewListView.qml 2014-03-18 10:57:24 +0000 |
2525 | @@ -34,6 +34,7 @@ |
2526 | |
2527 | PageHeader { |
2528 | id: header |
2529 | + objectName: root.objectName + "_pageHeader" |
2530 | width: parent.width |
2531 | searchEntryEnabled: false |
2532 | scope: root.scope |
2533 | @@ -60,7 +61,7 @@ |
2534 | |
2535 | ListView { |
2536 | id: previewListView |
2537 | - objectName: "previewListView" |
2538 | + objectName: root.objectName + "_listView" |
2539 | anchors { |
2540 | top: header.bottom |
2541 | bottom: parent.bottom |
2542 | @@ -91,7 +92,7 @@ |
2543 | pageHeader.unfocus(); |
2544 | } else { |
2545 | // Cancel any pending preview requests or actions |
2546 | - if (previewListView.currentItem.previewData !== undefined) { |
2547 | + if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) { |
2548 | previewListView.currentItem.previewData.cancelAction(); |
2549 | } |
2550 | scope.cancelActivation(); |
2551 | @@ -100,6 +101,7 @@ |
2552 | } |
2553 | |
2554 | delegate: Item { |
2555 | + objectName: "previewItem" + index |
2556 | height: previewListView.height |
2557 | width: previewListView.width |
2558 | |
2559 | |
2560 | === removed file 'qml/Dash/Previews/Header.qml' |
2561 | --- qml/Dash/Previews/Header.qml 2013-10-01 17:49:48 +0000 |
2562 | +++ qml/Dash/Previews/Header.qml 1970-01-01 00:00:00 +0000 |
2563 | @@ -1,109 +0,0 @@ |
2564 | -/* |
2565 | - * Copyright (C) 2013 Canonical, Ltd. |
2566 | - * |
2567 | - * This program is free software; you can redistribute it and/or modify |
2568 | - * it under the terms of the GNU General Public License as published by |
2569 | - * the Free Software Foundation; version 3. |
2570 | - * |
2571 | - * This program is distributed in the hope that it will be useful, |
2572 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2573 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2574 | - * GNU General Public License for more details. |
2575 | - * |
2576 | - * You should have received a copy of the GNU General Public License |
2577 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2578 | - */ |
2579 | - |
2580 | -import QtQuick 2.0 |
2581 | -import Ubuntu.Components 0.1 |
2582 | -import "../../Components" |
2583 | - |
2584 | -Row { |
2585 | - id: root |
2586 | - property alias icon: image.source |
2587 | - property alias title: titleLabel.text |
2588 | - property alias subtitle: subtitleLabel.text |
2589 | - property alias rating: ratingStars.rating |
2590 | - property int rated: 0 |
2591 | - property int reviews: 0 |
2592 | - |
2593 | - spacing: units.gu(2) |
2594 | - height: imageShape.visible ? imageShape.height : contentColumn.height |
2595 | - |
2596 | - UbuntuShape { |
2597 | - id: imageShape |
2598 | - width: height |
2599 | - height: Math.max(units.gu(6), contentColumn.height) |
2600 | - visible: image.source.toString().length > 0 |
2601 | - image: Image { |
2602 | - id: image |
2603 | - sourceSize { width: imageShape.width; height: imageShape.height } |
2604 | - asynchronous: true |
2605 | - fillMode: Image.PreserveAspectFit |
2606 | - } |
2607 | - } |
2608 | - |
2609 | - Column { |
2610 | - id: contentColumn |
2611 | - spacing: units.gu(1) |
2612 | - width: parent.width - x |
2613 | - |
2614 | - Label { |
2615 | - id: titleLabel |
2616 | - objectName: "titleLabel" |
2617 | - fontSize: "large" |
2618 | - color: "white" |
2619 | - style: Text.Raised |
2620 | - styleColor: "black" |
2621 | - opacity: .9 |
2622 | - width: parent.width |
2623 | - elide: Text.ElideRight |
2624 | - } |
2625 | - |
2626 | - Label { |
2627 | - id: subtitleLabel |
2628 | - objectName: "subtitleLabel" |
2629 | - fontSize: "medium" |
2630 | - color: "white" |
2631 | - style: Text.Raised |
2632 | - styleColor: "black" |
2633 | - opacity: .6 |
2634 | - visible: text.length > 0 |
2635 | - } |
2636 | - |
2637 | - Row { |
2638 | - visible: root.rating >= 0 |
2639 | - spacing: units.gu(1) |
2640 | - |
2641 | - RatingStars { |
2642 | - id: ratingStars |
2643 | - maximumRating: 10 |
2644 | - rating: -1 |
2645 | - } |
2646 | - |
2647 | - Label { |
2648 | - id: ratedLabel |
2649 | - objectName: "ratedLabel" |
2650 | - fontSize: "medium" |
2651 | - color: "white" |
2652 | - style: Text.Raised |
2653 | - styleColor: "black" |
2654 | - opacity: .6 |
2655 | - //TRANSLATORS: Number of persons who rated this app/video/whatever |
2656 | - text: i18n.tr("(%1)").arg(root.rated) |
2657 | - } |
2658 | - |
2659 | - Label { |
2660 | - id: reviewsLabel |
2661 | - objectName: "reviewsLabel" |
2662 | - fontSize: "medium" |
2663 | - color: "white" |
2664 | - style: Text.Raised |
2665 | - styleColor: "black" |
2666 | - opacity: .6 |
2667 | - //TRANSLATORS: Number of persons who wrote reviews for this app/video/whatever |
2668 | - text: i18n.tr("%1 review", "%1 reviews", root.reviews).arg(root.reviews) |
2669 | - } |
2670 | - } |
2671 | - } |
2672 | -} |
2673 | |
2674 | === removed file 'qml/Dash/Previews/Reviews.qml' |
2675 | --- qml/Dash/Previews/Reviews.qml 2013-09-30 19:34:47 +0000 |
2676 | +++ qml/Dash/Previews/Reviews.qml 1970-01-01 00:00:00 +0000 |
2677 | @@ -1,194 +0,0 @@ |
2678 | -/* |
2679 | - * Copyright (C) 2013 Canonical, Ltd. |
2680 | - * |
2681 | - * This program is free software; you can redistribute it and/or modify |
2682 | - * it under the terms of the GNU General Public License as published by |
2683 | - * the Free Software Foundation; version 3. |
2684 | - * |
2685 | - * This program is distributed in the hope that it will be useful, |
2686 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2687 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2688 | - * GNU General Public License for more details. |
2689 | - * |
2690 | - * You should have received a copy of the GNU General Public License |
2691 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2692 | - */ |
2693 | - |
2694 | -import QtQuick 2.0 |
2695 | -import Ubuntu.Components 0.1 |
2696 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
2697 | -import "../../Components" |
2698 | - |
2699 | -Column { |
2700 | - id: root |
2701 | - |
2702 | - property var model |
2703 | - property alias textArea: reviewField |
2704 | - |
2705 | - signal sendReview(string review) |
2706 | - signal editing |
2707 | - |
2708 | - spacing: units.gu(2) |
2709 | - state: "" |
2710 | - |
2711 | - states: [ |
2712 | - State { |
2713 | - name: "" |
2714 | - PropertyChanges { target: reviewField; width: root.width } |
2715 | - PropertyChanges { target: sendButton; opacity: 0 } |
2716 | - PropertyChanges { target: inverseArea; enabled: false } |
2717 | - }, |
2718 | - State { |
2719 | - name: "editing" |
2720 | - PropertyChanges { target: reviewField; width: (root.width - row.spacing - sendButton.width) } |
2721 | - PropertyChanges { target: sendButton; opacity: 1 } |
2722 | - PropertyChanges { target: inverseArea; enabled: true } |
2723 | - } |
2724 | - ] |
2725 | - |
2726 | - transitions: [ |
2727 | - Transition { |
2728 | - from: "" |
2729 | - to: "editing" |
2730 | - SequentialAnimation { |
2731 | - UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration } |
2732 | - UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration } |
2733 | - } |
2734 | - }, |
2735 | - Transition { |
2736 | - from: "editing" |
2737 | - to: "" |
2738 | - SequentialAnimation { |
2739 | - UbuntuNumberAnimation { target: sendButton; properties: "opacity"; duration: UbuntuAnimation.SlowDuration } |
2740 | - UbuntuNumberAnimation { target: reviewField; properties: "width"; duration: UbuntuAnimation.SlowDuration } |
2741 | - } |
2742 | - } |
2743 | - ] |
2744 | - |
2745 | - Label { |
2746 | - fontSize: "medium" |
2747 | - color: "white" |
2748 | - style: Text.Raised |
2749 | - styleColor: "black" |
2750 | - opacity: .9 |
2751 | - text: i18n.tr("Add a review") |
2752 | - } |
2753 | - |
2754 | - Row { |
2755 | - id: row |
2756 | - spacing: units.gu(1) |
2757 | - width: root.width |
2758 | - |
2759 | - // FIXME: needs to react to Qt.inputMethod geometry |
2760 | - TextArea { |
2761 | - id: reviewField |
2762 | - objectName: "reviewField" |
2763 | - placeholderText: i18n.tr("Review") |
2764 | - width: parent.width |
2765 | - verticalAlignment: Text.AlignVCenter |
2766 | - autoSize: true |
2767 | - maximumLineCount: 5 |
2768 | - |
2769 | - Behavior on height { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } } |
2770 | - |
2771 | - onFocusChanged: { |
2772 | - if(reviewField.focus){ |
2773 | - root.state = "editing"; |
2774 | - reviewField.selectAll(); |
2775 | - root.editing(); |
2776 | - } |
2777 | - } |
2778 | - |
2779 | - // FIXME: not active when in wide mode |
2780 | - InverseMouseArea { |
2781 | - id: inverseArea |
2782 | - anchors.fill: parent |
2783 | - enabled: false |
2784 | - onPressed: { |
2785 | - reviewField.focus = false; |
2786 | - root.state = ""; |
2787 | - } |
2788 | - } |
2789 | - } |
2790 | - |
2791 | - Button { |
2792 | - id: sendButton |
2793 | - objectName: "sendButton" |
2794 | - width: units.gu(10) |
2795 | - height: units.gu(4) |
2796 | - anchors.bottom: reviewField.bottom |
2797 | - color: Theme.palette.selected.foreground |
2798 | - text: i18n.tr("Send") |
2799 | - opacity: 0 |
2800 | - |
2801 | - onClicked: { |
2802 | - root.sendReview(reviewField.text); |
2803 | - reviewField.text = "" |
2804 | - } |
2805 | - } |
2806 | - } |
2807 | - |
2808 | - ListItem.ThinDivider {} |
2809 | - |
2810 | - Label { |
2811 | - fontSize: "medium" |
2812 | - color: "white" |
2813 | - style: Text.Raised |
2814 | - styleColor: "black" |
2815 | - opacity: .9 |
2816 | - text: i18n.tr("Comments:") |
2817 | - } |
2818 | - |
2819 | - Repeater { |
2820 | - objectName: "commentsArea" |
2821 | - model: root.model |
2822 | - |
2823 | - Column { |
2824 | - anchors { left: parent.left; right: parent.right } |
2825 | - |
2826 | - Column { |
2827 | - anchors { left: parent.left; right: parent.right } |
2828 | - |
2829 | - Label { |
2830 | - anchors { left: parent.left; right: parent.right } |
2831 | - text: modelData[0] |
2832 | - fontSize: "medium" |
2833 | - color: "white" |
2834 | - opacity: .8 |
2835 | - wrapMode: Text.WordWrap |
2836 | - style: Text.Raised |
2837 | - styleColor: "black" |
2838 | - } |
2839 | - |
2840 | - Row { |
2841 | - spacing: units.gu(1) |
2842 | - |
2843 | - RatingStars { |
2844 | - maximumRating: 10 |
2845 | - rating: modelData[1] |
2846 | - } |
2847 | - |
2848 | - Label { |
2849 | - text: modelData[2] |
2850 | - fontSize: "medium" |
2851 | - color: Theme.palette.selected.backgroundText |
2852 | - opacity: .6 |
2853 | - style: Text.Raised |
2854 | - styleColor: "black" |
2855 | - } |
2856 | - } |
2857 | - } |
2858 | - |
2859 | - Label { |
2860 | - anchors { left: parent.left; right: parent.right } |
2861 | - text: modelData[3] |
2862 | - fontSize: "medium" |
2863 | - color: Theme.palette.selected.backgroundText |
2864 | - opacity: .6 |
2865 | - wrapMode: Text.WordWrap |
2866 | - style: Text.Raised |
2867 | - styleColor: "black" |
2868 | - } |
2869 | - } |
2870 | - } |
2871 | -} |
2872 | |
2873 | === modified file 'qml/Dash/ScopeDelegateMapper.qml' |
2874 | --- qml/Dash/ScopeDelegateMapper.qml 2014-03-18 10:57:24 +0000 |
2875 | +++ qml/Dash/ScopeDelegateMapper.qml 2014-03-18 10:57:24 +0000 |
2876 | @@ -17,9 +17,7 @@ |
2877 | import QtQuick 2.0 |
2878 | |
2879 | QtObject { |
2880 | - property var scopeDelegateMapping: {"clickscope": "DashApps.qml", |
2881 | - "home.scope": "DashHome.qml" |
2882 | - } |
2883 | + property var scopeDelegateMapping: {"clickscope": "DashApps.qml"} |
2884 | property string genericScope: "GenericScopeView.qml" |
2885 | |
2886 | function map(scopeId) { |
2887 | |
2888 | === removed file 'qml/Dash/SearchableResultModel.qml' |
2889 | --- qml/Dash/SearchableResultModel.qml 2014-03-18 10:57:24 +0000 |
2890 | +++ qml/Dash/SearchableResultModel.qml 1970-01-01 00:00:00 +0000 |
2891 | @@ -1,44 +0,0 @@ |
2892 | -/* |
2893 | - * Copyright (C) 2013 Canonical, Ltd. |
2894 | - * |
2895 | - * This program is free software; you can redistribute it and/or modify |
2896 | - * it under the terms of the GNU General Public License as published by |
2897 | - * the Free Software Foundation; version 3. |
2898 | - * |
2899 | - * This program is distributed in the hope that it will be useful, |
2900 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2901 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2902 | - * GNU General Public License for more details. |
2903 | - * |
2904 | - * You should have received a copy of the GNU General Public License |
2905 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2906 | - */ |
2907 | - |
2908 | -import Utils 0.1 |
2909 | -import Unity 0.2 |
2910 | - |
2911 | -SortFilterProxyModel { |
2912 | - id: root |
2913 | - |
2914 | - property string searchQuery: "" |
2915 | - property bool hideOnSearch: false |
2916 | - |
2917 | - filterRole: CategoryResults.RoleTitle |
2918 | - |
2919 | - function get(index) { |
2920 | - return model.get(mapToSource(index)) |
2921 | - } |
2922 | - |
2923 | - onSearchQueryChanged: { |
2924 | - if (searchQuery.length == 0) { |
2925 | - filterRegExp = RegExp(""); |
2926 | - filterCaseSensitivity = Qt.CaseInsensitive; |
2927 | - } else if (!hideOnSearch) { |
2928 | - setFilterWildcard(searchQuery); |
2929 | - filterCaseSensitivity = Qt.CaseInsensitive; |
2930 | - } else { |
2931 | - filterRegExp = /^$/; |
2932 | - filterCaseSensitivity = Qt.CaseInsensitive; |
2933 | - } |
2934 | - } |
2935 | -} |
2936 | |
2937 | === removed directory 'qml/Dash/Video' |
2938 | === removed file 'qml/Dash/Video/CarouselDelegateVideo.qml' |
2939 | --- qml/Dash/Video/CarouselDelegateVideo.qml 2013-07-09 09:06:29 +0000 |
2940 | +++ qml/Dash/Video/CarouselDelegateVideo.qml 1970-01-01 00:00:00 +0000 |
2941 | @@ -1,42 +0,0 @@ |
2942 | -/* |
2943 | - * Copyright (C) 2013 Canonical, Ltd. |
2944 | - * |
2945 | - * This program is free software; you can redistribute it and/or modify |
2946 | - * it under the terms of the GNU General Public License as published by |
2947 | - * the Free Software Foundation; version 3. |
2948 | - * |
2949 | - * This program is distributed in the hope that it will be useful, |
2950 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2951 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2952 | - * GNU General Public License for more details. |
2953 | - * |
2954 | - * You should have received a copy of the GNU General Public License |
2955 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2956 | - */ |
2957 | - |
2958 | -import QtQuick 2.0 |
2959 | -import Ubuntu.Components 0.1 |
2960 | -import "../../Components" |
2961 | - |
2962 | -BaseCarouselDelegate { |
2963 | - id: item |
2964 | - |
2965 | - UbuntuShape { |
2966 | - anchors.fill: parent |
2967 | - radius: "medium" |
2968 | - borderSource: "" |
2969 | - image: Image { |
2970 | - asynchronous: true |
2971 | - sourceSize { width: item.width; height: item.height } |
2972 | - source: model ? model.icon : "" |
2973 | - } |
2974 | - } |
2975 | - |
2976 | - BorderImage { |
2977 | - anchors.centerIn: parent |
2978 | - opacity: 0.6 |
2979 | - source: "../../Components/graphics/non-selected.sci" |
2980 | - width: parent.width + units.gu(1.5) |
2981 | - height: parent.height + units.gu(1.5) |
2982 | - } |
2983 | -} |
2984 | |
2985 | === removed file 'qml/Dash/Video/VideoCarousel.qml' |
2986 | --- qml/Dash/Video/VideoCarousel.qml 2013-11-20 00:10:01 +0000 |
2987 | +++ qml/Dash/Video/VideoCarousel.qml 1970-01-01 00:00:00 +0000 |
2988 | @@ -1,34 +0,0 @@ |
2989 | -/* |
2990 | - * Copyright (C) 2013 Canonical, Ltd. |
2991 | - * |
2992 | - * This program is free software; you can redistribute it and/or modify |
2993 | - * it under the terms of the GNU General Public License as published by |
2994 | - * the Free Software Foundation; version 3. |
2995 | - * |
2996 | - * This program is distributed in the hope that it will be useful, |
2997 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2998 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2999 | - * GNU General Public License for more details. |
3000 | - * |
3001 | - * You should have received a copy of the GNU General Public License |
3002 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3003 | - */ |
3004 | - |
3005 | -import QtQuick 2.0 |
3006 | -import "../../Components" |
3007 | -import ".." |
3008 | - |
3009 | -DashCarousel { |
3010 | - id: videosCarousel |
3011 | - tileAspectRatio: 198 / 288 |
3012 | - minimumTileWidth: units.gu(13) |
3013 | - itemComponent: carouselDelegateVideo |
3014 | - selectedItemScaleFactor: 1.14 |
3015 | - cacheBuffer: 1404 // 18px * 13gu * 6 |
3016 | - |
3017 | - Component { |
3018 | - id: carouselDelegateVideo |
3019 | - CarouselDelegateVideo { |
3020 | - } |
3021 | - } |
3022 | -} |
3023 | |
3024 | === removed file 'qml/Dash/Video/VideoFilterGrid.qml' |
3025 | --- qml/Dash/Video/VideoFilterGrid.qml 2013-11-22 13:53:00 +0000 |
3026 | +++ qml/Dash/Video/VideoFilterGrid.qml 1970-01-01 00:00:00 +0000 |
3027 | @@ -1,47 +0,0 @@ |
3028 | -/* |
3029 | - * Copyright (C) 2013 Canonical, Ltd. |
3030 | - * |
3031 | - * This program is free software; you can redistribute it and/or modify |
3032 | - * it under the terms of the GNU General Public License as published by |
3033 | - * the Free Software Foundation; version 3. |
3034 | - * |
3035 | - * This program is distributed in the hope that it will be useful, |
3036 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3037 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3038 | - * GNU General Public License for more details. |
3039 | - * |
3040 | - * You should have received a copy of the GNU General Public License |
3041 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3042 | - */ |
3043 | - |
3044 | -import QtQuick 2.0 |
3045 | -import Ubuntu.Components 0.1 |
3046 | -import "../../Components" |
3047 | -import "../Generic" |
3048 | - |
3049 | -GenericFilterGrid { |
3050 | - id: videoFilterGrid |
3051 | - |
3052 | - delegateWidth: units.gu(11) |
3053 | - delegateHeight: units.gu(15) |
3054 | - iconWidth: units.gu(11) |
3055 | - iconHeight: units.gu(11) |
3056 | - |
3057 | - delegate: Tile { |
3058 | - id: tile |
3059 | - objectName: "delegate" + index |
3060 | - width: videoFilterGrid.cellWidth |
3061 | - height: videoFilterGrid.cellHeight |
3062 | - text: model.title |
3063 | - imageWidth: videoFilterGrid.iconWidth |
3064 | - imageHeight: videoFilterGrid.iconHeight |
3065 | - source: model.icon |
3066 | - maximumLineCount: 2 |
3067 | - horizontalAlignment: Text.AlignLeft |
3068 | - |
3069 | - style: VideoTileStyle {} |
3070 | - |
3071 | - onClicked: videoFilterGrid.clicked(index, tile.y) |
3072 | - onPressAndHold: videoFilterGrid.pressAndHold(index, tile.y) |
3073 | - } |
3074 | -} |
3075 | |
3076 | === removed file 'qml/Dash/Video/VideoTileStyle.qml' |
3077 | --- qml/Dash/Video/VideoTileStyle.qml 2013-10-14 10:23:18 +0000 |
3078 | +++ qml/Dash/Video/VideoTileStyle.qml 1970-01-01 00:00:00 +0000 |
3079 | @@ -1,87 +0,0 @@ |
3080 | -/* |
3081 | - * Copyright (C) 2013 Canonical, Ltd. |
3082 | - * |
3083 | - * This program is free software; you can redistribute it and/or modify |
3084 | - * it under the terms of the GNU General Public License as published by |
3085 | - * the Free Software Foundation; version 3. |
3086 | - * |
3087 | - * This program is distributed in the hope that it will be useful, |
3088 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3089 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3090 | - * GNU General Public License for more details. |
3091 | - * |
3092 | - * You should have received a copy of the GNU General Public License |
3093 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3094 | - */ |
3095 | - |
3096 | -import QtQuick 2.0 |
3097 | -import Ubuntu.Components 0.1 |
3098 | - |
3099 | -Item { |
3100 | - id: tile |
3101 | - |
3102 | - anchors.fill: parent |
3103 | - |
3104 | - Image { |
3105 | - id: icon |
3106 | - anchors { |
3107 | - top: parent.top |
3108 | - horizontalCenter: parent.horizontalCenter |
3109 | - } |
3110 | - width: styledItem.imageWidth |
3111 | - height: styledItem.imageHeight |
3112 | - source: "graphics/movie_icon_holder.png" |
3113 | - |
3114 | - Image { |
3115 | - id: image |
3116 | - objectName: "image" |
3117 | - anchors { |
3118 | - fill: parent; |
3119 | - topMargin: units.gu(2); |
3120 | - bottomMargin: units.gu(2) |
3121 | - } |
3122 | - sourceSize { width: icon.width; height: icon.height } |
3123 | - asynchronous: true |
3124 | - cache: false |
3125 | - source: styledItem.source |
3126 | - fillMode: styledItem.fillMode |
3127 | - horizontalAlignment: Image.AlignHCenter |
3128 | - verticalAlignment: Image.AlignVCenter |
3129 | - } |
3130 | - } |
3131 | - |
3132 | - UbuntuShape { |
3133 | - id: borderPressed |
3134 | - objectName: "borderPressed" |
3135 | - |
3136 | - anchors.fill: icon |
3137 | - radius: "medium" |
3138 | - borderSource: "radius_pressed.sci" |
3139 | - opacity: styledItem.pressed ? 1.0 : 0.0 |
3140 | - Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } } |
3141 | - } |
3142 | - |
3143 | - Label { |
3144 | - id: label |
3145 | - objectName: "label" |
3146 | - anchors { |
3147 | - baseline: icon.bottom |
3148 | - baselineOffset: units.gu(2) |
3149 | - left: icon.left |
3150 | - right: parent.right |
3151 | - rightMargin: units.gu(1) |
3152 | - leftMargin: units.dp(2) |
3153 | - } |
3154 | - |
3155 | - color: Theme.palette.selected.backgroundText |
3156 | - opacity: 0.9 |
3157 | - style: Text.Raised |
3158 | - styleColor: "black" |
3159 | - fontSize: "small" |
3160 | - elide: Text.ElideRight |
3161 | - horizontalAlignment: styledItem.horizontalAlignment |
3162 | - text: styledItem.text |
3163 | - wrapMode: Text.Wrap |
3164 | - maximumLineCount: styledItem.maximumLineCount |
3165 | - } |
3166 | -} |
3167 | |
3168 | === removed directory 'qml/Dash/Video/graphics' |
3169 | === removed file 'qml/Dash/Video/graphics/icon_button_amazon@20.png' |
3170 | Binary files qml/Dash/Video/graphics/icon_button_amazon@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_amazon@20.png 1970-01-01 00:00:00 +0000 differ |
3171 | === removed file 'qml/Dash/Video/graphics/icon_button_u1@20.png' |
3172 | Binary files qml/Dash/Video/graphics/icon_button_u1@20.png 2013-06-05 22:03:08 +0000 and qml/Dash/Video/graphics/icon_button_u1@20.png 1970-01-01 00:00:00 +0000 differ |
3173 | === removed file 'qml/Dash/Video/graphics/movie_icon_holder@27.png' |
3174 | Binary files qml/Dash/Video/graphics/movie_icon_holder@27.png 2013-10-09 17:06:13 +0000 and qml/Dash/Video/graphics/movie_icon_holder@27.png 1970-01-01 00:00:00 +0000 differ |
3175 | === modified file 'tests/autopilot/unity8/shell/emulators/dash.py' |
3176 | --- tests/autopilot/unity8/shell/emulators/dash.py 2014-02-07 17:03:14 +0000 |
3177 | +++ tests/autopilot/unity8/shell/emulators/dash.py 2014-03-18 10:57:24 +0000 |
3178 | @@ -36,11 +36,9 @@ |
3179 | self.dash_content_list = self.wait_select_single( |
3180 | 'QQuickListView', objectName='dashContentList') |
3181 | |
3182 | - def get_home_applications_grid(self): |
3183 | - get_grid = self.get_scope('home').wait_select_single( |
3184 | - "GenericFilterGrid", |
3185 | - objectName="applications.scope" |
3186 | - ) |
3187 | + def get_applications_grid(self): |
3188 | + get_grid = self.get_scope('clickscope').wait_select_single( |
3189 | + 'CardFilterGrid', objectName='local') |
3190 | return get_grid |
3191 | |
3192 | def get_application_icon(self, text): |
3193 | @@ -50,24 +48,22 @@ |
3194 | :param text: String containing the text of the icon to search for. |
3195 | |
3196 | """ |
3197 | - app_grid = self.get_home_applications_grid() |
3198 | + app_grid = self.get_applications_grid() |
3199 | resp_grid = app_grid.wait_select_single('ResponsiveGridView') |
3200 | return resp_grid.select_single('Tile', text=text) |
3201 | |
3202 | - def get_scope(self, scope_name='home'): |
3203 | - scope_id = "%s.scope" % scope_name |
3204 | + def get_scope(self, scope_name='clickscope'): |
3205 | return self.dash_content_list.select_single( |
3206 | - 'QQuickLoader', scopeId=scope_id) |
3207 | + 'QQuickLoader', scopeId=scope_name) |
3208 | |
3209 | @autopilot_logging.log_action(logger.info) |
3210 | - def open_scope(self, scope_name): |
3211 | + def open_scope(self, scope_id): |
3212 | """Open a dash scope. |
3213 | |
3214 | - :parameter scope_name: The name of the scope. |
3215 | + :parameter scope_id: The id of the scope. |
3216 | :return: The scope. |
3217 | |
3218 | """ |
3219 | - scope_id = "%s.scope" % scope_name |
3220 | scope_loader = self._get_scope_loader(scope_id) |
3221 | if scope_loader.isCurrent: |
3222 | logger.info('The scope is already open.') |
3223 | @@ -84,7 +80,7 @@ |
3224 | 'No scope found with id {0}'.format(scope_id)) |
3225 | |
3226 | def _get_scope_from_loader(self, loader): |
3227 | - if loader.scopeId == 'applications.scope': |
3228 | + if loader.scopeId == 'clickscope': |
3229 | return loader.select_single(DashApps) |
3230 | else: |
3231 | return loader.select_single(GenericScopeView) |
3232 | @@ -115,7 +111,7 @@ |
3233 | original_index = self.dash_content_list.currentIndex |
3234 | # Scroll on the border of the page header, because some scopes have |
3235 | # contents that can be scrolled horizontally. |
3236 | - page_header = self.select_single('PageHeader') |
3237 | + page_header = self._get_page_header() |
3238 | border = page_header.select_single('QQuickBorderImage') |
3239 | start_x = border.width / 3 |
3240 | stop_x = border.width / 3 * 2 |
3241 | @@ -123,12 +119,15 @@ |
3242 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
3243 | self.dash_content_list.currentIndex.wait_for(original_index - 1) |
3244 | |
3245 | + def _get_page_header(self): |
3246 | + return self.select_single('PageHeader', objectName='pageHeader') |
3247 | + |
3248 | @autopilot_logging.log_action(logger.info) |
3249 | def _scroll_to_right_scope(self): |
3250 | original_index = self.dash_content_list.currentIndex |
3251 | # Scroll on the border of the page header, because some scopes have |
3252 | # contents that can be scrolled horizontally. |
3253 | - page_header = self.select_single('PageHeader') |
3254 | + page_header = self._get_page_header() |
3255 | border = page_header.select_single('QQuickBorderImage') |
3256 | start_x = border.width / 3 * 2 |
3257 | stop_x = border.width / 3 |
3258 | @@ -137,24 +136,9 @@ |
3259 | self.dash_content_list.currentIndex.wait_for(original_index + 1) |
3260 | |
3261 | |
3262 | -class DashPreview(emulators.UnityEmulatorBase): |
3263 | - """Autopilot emulator for the generic preview.""" |
3264 | - |
3265 | - def get_details(self): |
3266 | - """Return the details of the open preview.""" |
3267 | - title = self.select_single('Label', objectName='titleLabel').text |
3268 | - subtitle = self.select_single( |
3269 | - 'Label', objectName='subtitleLabel').text |
3270 | - description = self.select_single( |
3271 | - 'Label', objectName='descriptionLabel').text |
3272 | - return dict(title=title, subtitle=subtitle, description=description) |
3273 | - |
3274 | - |
3275 | class GenericScopeView(emulators.UnityEmulatorBase): |
3276 | """Autopilot emulator for generic scopes.""" |
3277 | |
3278 | - preview_class = DashPreview |
3279 | - |
3280 | @autopilot_logging.log_action(logger.info) |
3281 | def open_preview(self, category, app_name): |
3282 | """Open the preview of an application. |
3283 | @@ -164,15 +148,13 @@ |
3284 | |
3285 | """ |
3286 | category_element = self._get_category_element(category) |
3287 | - icon = category_element.select_single('Tile', text=app_name) |
3288 | + icon = category_element.select_single('Card', title=app_name) |
3289 | # FIXME some categories need a long press in order to see the preview. |
3290 | # Some categories do not show previews, like recent apps. |
3291 | # --elopio - 2014-1-14 |
3292 | self.pointing_device.click_object(icon) |
3293 | - preview = self.get_root_instance().wait_select_single( |
3294 | - self.preview_class, isCurrent=True) |
3295 | - preview.showProcessingAction.wait_for(False) |
3296 | - return preview |
3297 | + return self.get_root_instance().wait_select_single( |
3298 | + 'PreviewListView', objectName='dashContentPreviewList') |
3299 | |
3300 | def _get_category_element(self, category): |
3301 | try: |
3302 | @@ -183,24 +165,9 @@ |
3303 | 'No category found with name {}'.format(category)) |
3304 | |
3305 | |
3306 | -class AppPreview(DashPreview): |
3307 | - """Autopilot emulator for the application preview.""" |
3308 | - |
3309 | - def get_details(self): |
3310 | - """Return the details of the application showed in its preview.""" |
3311 | - details = super(AppPreview, self).get_details() |
3312 | - # TODO return screenshots, icon, rating and reviews. |
3313 | - # --elopio - 2014-1-15 |
3314 | - return dict( |
3315 | - title=details.get('title'), publisher=details.get('subtitle'), |
3316 | - description=details.get('description')) |
3317 | - |
3318 | - |
3319 | class DashApps(GenericScopeView): |
3320 | """Autopilot emulator for the applications scope.""" |
3321 | |
3322 | - preview_class = AppPreview |
3323 | - |
3324 | def get_applications(self, category): |
3325 | """Return the list of applications on a category. |
3326 | |
3327 | @@ -208,7 +175,11 @@ |
3328 | |
3329 | """ |
3330 | category_element = self._get_category_element(category) |
3331 | - application_tiles = category_element.select_many('Tile') |
3332 | + application_tiles = category_element.select_many('Card') |
3333 | # TODO return them on the same order they are displayed. |
3334 | # --elopio - 2014-1-15 |
3335 | - return [tile.text for tile in application_tiles] |
3336 | + result = [] |
3337 | + for card in application_tiles: |
3338 | + if card.objectName != 'cardToolCard': |
3339 | + result.append(card) |
3340 | + return result |
3341 | |
3342 | === modified file 'tests/autopilot/unity8/shell/emulators/main_window.py' |
3343 | --- tests/autopilot/unity8/shell/emulators/main_window.py 2014-02-12 06:11:16 +0000 |
3344 | +++ tests/autopilot/unity8/shell/emulators/main_window.py 2014-03-18 10:57:24 +0000 |
3345 | @@ -42,10 +42,6 @@ |
3346 | objectName="greeterContentLoader" |
3347 | ) |
3348 | |
3349 | - def get_greeter_background(self): |
3350 | - return self.select_single( |
3351 | - "CrossFadeImage", objectName="greeterBackground") |
3352 | - |
3353 | def get_login_loader(self): |
3354 | return self.select_single("QQuickLoader", objectName="loginLoader") |
3355 | |
3356 | |
3357 | === modified file 'tests/autopilot/unity8/shell/tests/__init__.py' |
3358 | --- tests/autopilot/unity8/shell/tests/__init__.py 2014-02-22 00:12:49 +0000 |
3359 | +++ tests/autopilot/unity8/shell/tests/__init__.py 2014-03-18 10:57:24 +0000 |
3360 | @@ -376,7 +376,7 @@ |
3361 | |
3362 | def assertUnityReady(self): |
3363 | dash = self.get_dash() |
3364 | - home_scope = dash.get_scope('home') |
3365 | + home_scope = dash.get_scope('clickscope') |
3366 | |
3367 | # FIXME! There is a huge timeout here for when we're doing CI on |
3368 | # VMs. See lp:1203715 |
3369 | |
3370 | === modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py' |
3371 | --- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-02-22 00:12:49 +0000 |
3372 | +++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-03-18 10:57:24 +0000 |
3373 | @@ -60,14 +60,13 @@ |
3374 | self.dash.open_scope, scope_name) |
3375 | |
3376 | self.assertEqual( |
3377 | - 'No scope found with id unexisting.scope', str(exception)) |
3378 | + 'No scope found with id unexisting', str(exception)) |
3379 | self.assertFalse(mock_pointer.called) |
3380 | |
3381 | def test_open_already_opened_scope(self): |
3382 | scope_id = self._get_current_scope_id() |
3383 | with mock.patch.object(self.dash, 'pointing_device') as mock_pointer: |
3384 | - scope = self.dash.open_scope(self._get_scope_name_from_id( |
3385 | - scope_id)) |
3386 | + scope = self.dash.open_scope(scope_id) |
3387 | |
3388 | self.assertFalse(mock_pointer.called) |
3389 | self._assert_scope_is_opened(scope, scope_id) |
3390 | @@ -83,12 +82,11 @@ |
3391 | return scope.scopeId |
3392 | |
3393 | def test_open_scope_to_the_right(self): |
3394 | - leftmost_scope = self._get_scope_name_from_id( |
3395 | - self._get_leftmost_scope_id()) |
3396 | + leftmost_scope = self._get_leftmost_scope_id() |
3397 | self.dash.open_scope(leftmost_scope) |
3398 | |
3399 | scope_id = self._get_rightmost_scope_id() |
3400 | - scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id)) |
3401 | + scope = self.dash.open_scope(scope_id) |
3402 | self._assert_scope_is_opened(scope, scope_id) |
3403 | |
3404 | def _get_leftmost_scope_id(self): |
3405 | @@ -104,10 +102,6 @@ |
3406 | 'QQuickItem')[0] |
3407 | return item.get_children_by_type('QQuickLoader') |
3408 | |
3409 | - def _get_scope_name_from_id(self, scope_id): |
3410 | - if scope_id.endswith('.scope'): |
3411 | - return scope_id[:-6] |
3412 | - |
3413 | def _get_rightmost_scope_id(self): |
3414 | scope_loaders = self._get_scope_loaders() |
3415 | rightmost_scope_loader = scope_loaders[0] |
3416 | @@ -117,23 +111,22 @@ |
3417 | return rightmost_scope_loader.scopeId |
3418 | |
3419 | def test_open_scope_to_the_left(self): |
3420 | - rightmost_scope = self._get_scope_name_from_id( |
3421 | - self._get_rightmost_scope_id()) |
3422 | + rightmost_scope = self._get_rightmost_scope_id() |
3423 | self.dash.open_scope(rightmost_scope) |
3424 | |
3425 | scope_id = self._get_leftmost_scope_id() |
3426 | - scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id)) |
3427 | + scope = self.dash.open_scope(scope_id) |
3428 | self._assert_scope_is_opened(scope, scope_id) |
3429 | |
3430 | def test_open_generic_scope(self): |
3431 | - scope_id = 'home.scope' |
3432 | - scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id)) |
3433 | + scope_id = 'scopes' |
3434 | + scope = self.dash.open_scope(scope_id) |
3435 | self._assert_scope_is_opened(scope, scope_id) |
3436 | self.assertIsInstance(scope, dash_emulators.GenericScopeView) |
3437 | |
3438 | def test_open_applications_scope(self): |
3439 | - scope_id = 'applications.scope' |
3440 | - scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id)) |
3441 | + scope_id = 'clickscope' |
3442 | + scope = self.dash.open_scope(scope_id) |
3443 | self._assert_scope_is_opened(scope, scope_id) |
3444 | self.assertIsInstance(scope, dash_emulators.DashApps) |
3445 | |
3446 | @@ -144,36 +137,24 @@ |
3447 | # Set up the fake scopes before launching unity. |
3448 | self.useFixture(fixture_setup.FakeScopes()) |
3449 | super(GenericScopeViewEmulatorTestCase, self).setUp() |
3450 | - self.home_scope = self.dash.open_scope('home') |
3451 | + self.generic_scope = self.dash.open_scope('MockScope1') |
3452 | |
3453 | def test_open_preview(self): |
3454 | - preview = self.home_scope.open_preview('0', 'Title.0') |
3455 | - self.assertIsInstance(preview, dash_emulators.DashPreview) |
3456 | - self.assertTrue(preview.isCurrent) |
3457 | - self.assertFalse(preview.showProcessingAction) |
3458 | - |
3459 | - def test_get_details(self): |
3460 | - expected_details = dict( |
3461 | - title='Title', subtitle='Subtitle', description='Description') |
3462 | - |
3463 | - preview = self.home_scope.open_preview('0', 'Title.0') |
3464 | - details = preview.get_details() |
3465 | - |
3466 | - self.assertEqual(expected_details, details) |
3467 | - |
3468 | + preview = self.generic_scope.open_preview('0', 'Title.0.0') |
3469 | + preview.x.wait_for(0) |
3470 | |
3471 | class DashAppsEmulatorTestCase(DashBaseTestCase): |
3472 | |
3473 | available_applications = [ |
3474 | - 'Title.1', 'Title.21', 'Title.41', 'Title.61', 'Title.81', |
3475 | - 'Title.101', 'Title.121', 'Title.141', 'Title.161', 'Title.181', |
3476 | - 'Title.201', 'Title.221', 'Title.241', 'Title.261', 'Title.281'] |
3477 | + 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4', |
3478 | + 'Title.2.5', 'Title.2.6', 'Title.2.7', 'Title.2.8', 'Title.2.9', |
3479 | + 'Title.2.9', 'Title.2.10', 'Title.2.11'] |
3480 | |
3481 | def setUp(self): |
3482 | # Set up the fake scopes before launching unity. |
3483 | self.useFixture(fixture_setup.FakeScopes()) |
3484 | super(DashAppsEmulatorTestCase, self).setUp() |
3485 | - self.applications_scope = self.dash.open_scope('applications') |
3486 | + self.applications_scope = self.dash.open_scope('clickscope') |
3487 | |
3488 | def test_get_applications_with_unexisting_category(self): |
3489 | exception = self.assertRaises( |
3490 | @@ -185,34 +166,27 @@ |
3491 | 'No category found with name unexisting category', str(exception)) |
3492 | |
3493 | def test_get_applications_should_return_list_with_names(self): |
3494 | - category = 'installed' |
3495 | + category = '2' |
3496 | expected_apps_count = self._get_number_of_application_slots(category) |
3497 | expected_applications = self.available_applications[ |
3498 | :expected_apps_count] |
3499 | |
3500 | applications = self.applications_scope.get_applications(category) |
3501 | + applications_titles = [] |
3502 | + for application in applications: |
3503 | + cardHeader = application.select_single('CardHeader') |
3504 | + applications_titles.append(cardHeader.title) |
3505 | |
3506 | self.assertThat(applications, HasLength(expected_apps_count)) |
3507 | for expected in expected_applications: |
3508 | - self.assertThat(applications, Contains(expected)) |
3509 | + self.assertThat(applications_titles, Contains(expected)) |
3510 | |
3511 | def _get_number_of_application_slots(self, category): |
3512 | category_element = self.applications_scope._get_category_element( |
3513 | category) |
3514 | - grid = category_element.select_single('GenericFilterGrid') |
3515 | + grid = category_element.select_single('CardFilterGrid') |
3516 | return grid.columns * grid.rows |
3517 | |
3518 | def test_open_preview(self): |
3519 | - preview = self.applications_scope.open_preview('installed', 'Title.1') |
3520 | - self.assertIsInstance(preview, dash_emulators.AppPreview) |
3521 | - self.assertTrue(preview.isCurrent) |
3522 | - self.assertFalse(preview.showProcessingAction) |
3523 | - |
3524 | - def test_get_details(self): |
3525 | - expected_details = dict( |
3526 | - title='Title', publisher='', description='Description') |
3527 | - |
3528 | - preview = self.applications_scope.open_preview('installed', 'Title.1') |
3529 | - details = preview.get_details() |
3530 | - |
3531 | - self.assertEqual(expected_details, details) |
3532 | + preview = self.applications_scope.open_preview('2', 'Title.2.1') |
3533 | + preview.x.wait_for(0) |
3534 | |
3535 | === removed file 'tests/autopilot/unity8/shell/tests/test_greeter.py' |
3536 | --- tests/autopilot/unity8/shell/tests/test_greeter.py 2013-10-22 15:59:23 +0000 |
3537 | +++ tests/autopilot/unity8/shell/tests/test_greeter.py 1970-01-01 00:00:00 +0000 |
3538 | @@ -1,38 +0,0 @@ |
3539 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
3540 | -# |
3541 | -# Unity Autopilot Test Suite |
3542 | -# Copyright (C) 2012-2013 Canonical |
3543 | -# |
3544 | -# This program is free software: you can redistribute it and/or modify |
3545 | -# it under the terms of the GNU General Public License as published by |
3546 | -# the Free Software Foundation, either version 3 of the License, or |
3547 | -# (at your option) any later version. |
3548 | -# |
3549 | -# This program is distributed in the hope that it will be useful, |
3550 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3551 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3552 | -# GNU General Public License for more details. |
3553 | -# |
3554 | -# You should have received a copy of the GNU General Public License |
3555 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3556 | -# |
3557 | - |
3558 | -from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios |
3559 | - |
3560 | -from testtools.matchers import Equals |
3561 | - |
3562 | -class TestGreeter(UnityTestCase): |
3563 | - |
3564 | - """Tests the Shell Greeter.""" |
3565 | - |
3566 | - scenarios = _get_device_emulation_scenarios() |
3567 | - |
3568 | - def test_greeter_background(self): |
3569 | - """Test that the background of the greeter and the background of the shell are placed correctly |
3570 | - |
3571 | - """ |
3572 | - self.launch_unity() |
3573 | - self.main_window.get_greeter() |
3574 | - greeter_background = self.main_window.get_greeter_background() |
3575 | - shell_background = self.main_window.get_shell_background() |
3576 | - self.assertThat(greeter_background.globalRect, Equals(shell_background.globalRect)) |
3577 | |
3578 | === modified file 'tests/mocks/Unity/CMakeLists.txt' |
3579 | --- tests/mocks/Unity/CMakeLists.txt 2014-02-07 09:55:56 +0000 |
3580 | +++ tests/mocks/Unity/CMakeLists.txt 2014-03-18 10:57:24 +0000 |
3581 | @@ -18,14 +18,14 @@ |
3582 | add_definitions(-DQT_NO_KEYWORDS) |
3583 | |
3584 | set(UnityQML_SOURCES |
3585 | - categoryresults.cpp |
3586 | iconutils.cpp |
3587 | - fake_applications_scope.cpp |
3588 | - fake_preview.cpp |
3589 | fake_scope.cpp |
3590 | fake_scopes.cpp |
3591 | fake_categories.cpp |
3592 | - scopes-ng/fake_preview_model.cpp |
3593 | + fake_resultsmodel.cpp |
3594 | + fake_previewmodel.cpp |
3595 | + fake_previewstack.cpp |
3596 | + fake_previewwidgetmodel.cpp |
3597 | fake_unity_plugin.cpp |
3598 | ) |
3599 | |
3600 | |
3601 | === removed file 'tests/mocks/Unity/categoryresults.cpp' |
3602 | --- tests/mocks/Unity/categoryresults.cpp 2013-11-12 18:21:40 +0000 |
3603 | +++ tests/mocks/Unity/categoryresults.cpp 1970-01-01 00:00:00 +0000 |
3604 | @@ -1,121 +0,0 @@ |
3605 | -/* |
3606 | - * Copyright (C) 2013 Canonical, Ltd. |
3607 | - * |
3608 | - * Authors: |
3609 | - * Michal Hruby <michal.hruby@canonical.com> |
3610 | - * |
3611 | - * This program is free software; you can redistribute it and/or modify |
3612 | - * it under the terms of the GNU General Public License as published by |
3613 | - * the Free Software Foundation; version 3. |
3614 | - * |
3615 | - * This program is distributed in the hope that it will be useful, |
3616 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3617 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3618 | - * GNU General Public License for more details. |
3619 | - * |
3620 | - * You should have received a copy of the GNU General Public License |
3621 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3622 | - */ |
3623 | - |
3624 | -// self |
3625 | -#include "categoryresults.h" |
3626 | -#include "iconutils.h" |
3627 | - |
3628 | -// TODO: use something from libunity once it's public |
3629 | -enum ResultsColumn { |
3630 | - URI, |
3631 | - ICON_HINT, |
3632 | - CATEGORY, |
3633 | - RESULT_TYPE, |
3634 | - MIMETYPE, |
3635 | - TITLE, |
3636 | - COMMENT, |
3637 | - DND_URI, |
3638 | - METADATA |
3639 | -}; |
3640 | - |
3641 | -CategoryResults::CategoryResults(QObject* parent) |
3642 | - : DeeListModel(parent) |
3643 | - , m_categoryIndex(-1) |
3644 | -{ |
3645 | - m_roles[CategoryResults::RoleUri] = "uri"; |
3646 | - m_roles[CategoryResults::RoleIconHint] = "icon"; |
3647 | - m_roles[CategoryResults::RoleCategory] = "category"; |
3648 | - m_roles[CategoryResults::RoleMimetype] = "mimetype"; |
3649 | - m_roles[CategoryResults::RoleTitle] = "title"; |
3650 | - m_roles[CategoryResults::RoleComment] = "comment"; |
3651 | - m_roles[CategoryResults::RoleDndUri] = "dndUri"; |
3652 | - m_roles[CategoryResults::RoleMetadata] = "metadata"; |
3653 | - m_roles[CategoryResults::RoleRendererHints] = "rendererHints"; |
3654 | -} |
3655 | - |
3656 | -int CategoryResults::categoryIndex() const |
3657 | -{ |
3658 | - return m_categoryIndex; |
3659 | -} |
3660 | - |
3661 | -void CategoryResults::setCategoryIndex(int index) |
3662 | -{ |
3663 | - if (m_categoryIndex != index) { |
3664 | - m_categoryIndex = index; |
3665 | - Q_EMIT categoryIndexChanged(m_categoryIndex); |
3666 | - } |
3667 | -} |
3668 | - |
3669 | -QHash<int, QByteArray> |
3670 | -CategoryResults::roleNames() const |
3671 | -{ |
3672 | - return m_roles; |
3673 | -} |
3674 | - |
3675 | -QVariant |
3676 | -CategoryResults::data(const QModelIndex& index, int role) const |
3677 | -{ |
3678 | - if (!index.isValid()) { |
3679 | - return QVariant(); |
3680 | - } |
3681 | - |
3682 | - switch (role) { |
3683 | - case RoleUri: |
3684 | - return DeeListModel::data(index, ResultsColumn::URI); |
3685 | - case RoleIconHint: { |
3686 | - QString giconString(DeeListModel::data(index, ResultsColumn::ICON_HINT).toString()); |
3687 | - if (giconString.isEmpty()) { |
3688 | - QString mimetype(DeeListModel::data(index, ResultsColumn::MIMETYPE).toString()); |
3689 | - QString uri(DeeListModel::data(index, ResultsColumn::URI).toString()); |
3690 | - QString thumbnailerUri(uriToThumbnailerProviderString(uri, mimetype, DeeListModel::data(index, ResultsColumn::METADATA).toHash())); |
3691 | - if (!thumbnailerUri.isNull()) { |
3692 | - return QVariant::fromValue(thumbnailerUri); |
3693 | - } |
3694 | - } |
3695 | - return QVariant::fromValue(gIconToDeclarativeImageProviderString(giconString)); |
3696 | - } |
3697 | - case RoleCategory: |
3698 | - return DeeListModel::data(index, ResultsColumn::CATEGORY); |
3699 | - case RoleMimetype: |
3700 | - return DeeListModel::data(index, ResultsColumn::MIMETYPE); |
3701 | - case RoleTitle: |
3702 | - return DeeListModel::data(index, ResultsColumn::TITLE); |
3703 | - case RoleComment: |
3704 | - return DeeListModel::data(index, ResultsColumn::COMMENT); |
3705 | - case RoleDndUri: |
3706 | - return DeeListModel::data(index, ResultsColumn::DND_URI); |
3707 | - case RoleMetadata: |
3708 | - return DeeListModel::data(index, ResultsColumn::METADATA); |
3709 | - case RoleRendererHints: |
3710 | - { |
3711 | - QVariantHash hash(DeeListModel::data(index, ResultsColumn::METADATA).toHash()); |
3712 | - if (hash.contains("content")) { |
3713 | - QVariantMap hints; |
3714 | - QVariantHash innerHash(hash["content"].toHash()); |
3715 | - if (innerHash.contains("scope_disabled")) { |
3716 | - hints["scope_disabled"] = innerHash["scope_disabled"]; |
3717 | - } |
3718 | - return hints.empty() ? QVariant() : QVariant::fromValue(hints); |
3719 | - } |
3720 | - return QVariant(); |
3721 | - } |
3722 | - default: |
3723 | - return QVariant(); |
3724 | - } |
3725 | -} |
3726 | |
3727 | === removed file 'tests/mocks/Unity/categoryresults.h' |
3728 | --- tests/mocks/Unity/categoryresults.h 2013-11-12 18:21:40 +0000 |
3729 | +++ tests/mocks/Unity/categoryresults.h 1970-01-01 00:00:00 +0000 |
3730 | @@ -1,68 +0,0 @@ |
3731 | -/* |
3732 | - * Copyright (C) 2013 Canonical, Ltd. |
3733 | - * |
3734 | - * Authors: |
3735 | - * Michal Hruby <michal.hruby@canonical.com> |
3736 | - * |
3737 | - * This program is free software; you can redistribute it and/or modify |
3738 | - * it under the terms of the GNU General Public License as published by |
3739 | - * the Free Software Foundation; version 3. |
3740 | - * |
3741 | - * This program is distributed in the hope that it will be useful, |
3742 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3743 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3744 | - * GNU General Public License for more details. |
3745 | - * |
3746 | - * You should have received a copy of the GNU General Public License |
3747 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3748 | - */ |
3749 | - |
3750 | - |
3751 | -#ifndef CATEGORY_RESULTS_H |
3752 | -#define CATEGORY_RESULTS_H |
3753 | - |
3754 | -// dee-qt |
3755 | -#include "deelistmodel.h" |
3756 | - |
3757 | -class Q_DECL_EXPORT CategoryResults : public DeeListModel |
3758 | -{ |
3759 | - Q_OBJECT |
3760 | - |
3761 | - Q_ENUMS(Roles) |
3762 | - |
3763 | - Q_PROPERTY(int categoryIndex READ categoryIndex WRITE setCategoryIndex NOTIFY categoryIndexChanged) |
3764 | - |
3765 | -public: |
3766 | - explicit CategoryResults(QObject* parent = 0); |
3767 | - |
3768 | - enum Roles { |
3769 | - RoleUri, |
3770 | - RoleIconHint, |
3771 | - RoleCategory, |
3772 | - RoleMimetype, |
3773 | - RoleTitle, |
3774 | - RoleComment, |
3775 | - RoleDndUri, |
3776 | - RoleMetadata, |
3777 | - RoleRendererHints |
3778 | - }; |
3779 | - |
3780 | - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; |
3781 | - |
3782 | - QHash<int, QByteArray> roleNames() const; |
3783 | - |
3784 | - /* getters */ |
3785 | - int categoryIndex() const; |
3786 | - |
3787 | - /* setters */ |
3788 | - void setCategoryIndex(int index); |
3789 | - |
3790 | -Q_SIGNALS: |
3791 | - void categoryIndexChanged(int index); |
3792 | - |
3793 | -private: |
3794 | - QHash<int, QByteArray> m_roles; |
3795 | - int m_categoryIndex; |
3796 | -}; |
3797 | - |
3798 | -#endif // CATEGORY_RESULTS_H |
3799 | |
3800 | === removed file 'tests/mocks/Unity/fake_applications_scope.cpp' |
3801 | --- tests/mocks/Unity/fake_applications_scope.cpp 2014-01-16 17:39:35 +0000 |
3802 | +++ tests/mocks/Unity/fake_applications_scope.cpp 1970-01-01 00:00:00 +0000 |
3803 | @@ -1,76 +0,0 @@ |
3804 | -/* |
3805 | - * Copyright (C) 2013, 2014 Canonical, Ltd. |
3806 | - * |
3807 | - * This program is free software; you can redistribute it and/or modify |
3808 | - * it under the terms of the GNU General Public License as published by |
3809 | - * the Free Software Foundation; version 3. |
3810 | - * |
3811 | - * This program is distributed in the hope that it will be useful, |
3812 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3813 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3814 | - * GNU General Public License for more details. |
3815 | - * |
3816 | - * You should have received a copy of the GNU General Public License |
3817 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3818 | - */ |
3819 | - |
3820 | -#include "fake_applications_scope.h" |
3821 | - |
3822 | -static const gchar * categories_model_schema[] = { |
3823 | - "s", //ID |
3824 | - "s", // DISPLAY_NAME |
3825 | - "s", // ICON_HINT |
3826 | - "s", // RENDERER_NAME |
3827 | - "a{sv}" // HINTS |
3828 | -}; |
3829 | - |
3830 | -ApplicationsScope::ApplicationsScope(bool visible, QObject* parent) |
3831 | - : Scope(parent) |
3832 | -{ |
3833 | - m_id = "applications.scope"; |
3834 | - m_name = "Applications"; |
3835 | - m_visible = visible; |
3836 | - m_previewRendererName = "preview-application"; |
3837 | - m_categories->setModel(createCategoriesModel()); |
3838 | -} |
3839 | - |
3840 | -DeeModel* ApplicationsScope::createCategoriesModel() |
3841 | -{ |
3842 | - DeeModel* category_model = dee_sequence_model_new(); |
3843 | - dee_model_set_schema_full(category_model, categories_model_schema, G_N_ELEMENTS(categories_model_schema)); |
3844 | - GVariant* hints = g_variant_new_array(g_variant_type_element(G_VARIANT_TYPE_VARDICT), NULL, 0); |
3845 | - |
3846 | - GVariant* children[1]; |
3847 | - children[0] = g_variant_new_dict_entry(g_variant_new_string("content-type"), |
3848 | - g_variant_new_variant(g_variant_new_string("apps"))); |
3849 | - GVariant* recentHints = g_variant_new_array(g_variant_type_element(G_VARIANT_TYPE_VARDICT), children, 1); |
3850 | - dee_model_append(category_model, |
3851 | - "recent", |
3852 | - "Recent", |
3853 | - "gtk-apply", |
3854 | - "special", |
3855 | - recentHints); |
3856 | - |
3857 | - dee_model_append(category_model, |
3858 | - "installed", |
3859 | - "Installed", |
3860 | - "gtk-apply", |
3861 | - "grid", |
3862 | - hints); |
3863 | - |
3864 | - dee_model_append(category_model, |
3865 | - "suggested", |
3866 | - "Suggested", |
3867 | - "gtk-apply", |
3868 | - "grid", |
3869 | - hints); |
3870 | - |
3871 | - dee_model_append(category_model, |
3872 | - "outdated", |
3873 | - "Outdaded", |
3874 | - "gtk-apply", |
3875 | - "grid", |
3876 | - hints); |
3877 | - |
3878 | - return category_model; |
3879 | -} |
3880 | |
3881 | === removed file 'tests/mocks/Unity/fake_applications_scope.h' |
3882 | --- tests/mocks/Unity/fake_applications_scope.h 2013-09-02 20:34:05 +0000 |
3883 | +++ tests/mocks/Unity/fake_applications_scope.h 1970-01-01 00:00:00 +0000 |
3884 | @@ -1,33 +0,0 @@ |
3885 | -/* |
3886 | - * Copyright (C) 2013 Canonical, Ltd. |
3887 | - * |
3888 | - * This program is free software; you can redistribute it and/or modify |
3889 | - * it under the terms of the GNU General Public License as published by |
3890 | - * the Free Software Foundation; version 3. |
3891 | - * |
3892 | - * This program is distributed in the hope that it will be useful, |
3893 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3894 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3895 | - * GNU General Public License for more details. |
3896 | - * |
3897 | - * You should have received a copy of the GNU General Public License |
3898 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3899 | - */ |
3900 | - |
3901 | -#ifndef FAKE_APPLICATIONS_SCOPE_H |
3902 | -#define FAKE_APPLICATIONS_SCOPE_H |
3903 | - |
3904 | -#include "fake_scope.h" |
3905 | - |
3906 | -class ApplicationsScope : public Scope |
3907 | -{ |
3908 | - Q_OBJECT |
3909 | - |
3910 | -public: |
3911 | - ApplicationsScope(bool visible, QObject* parent = 0); |
3912 | - |
3913 | -private: |
3914 | - DeeModel* createCategoriesModel(); |
3915 | -}; |
3916 | - |
3917 | -#endif // FAKE_APPLICATIONS_SCOPE_H |
3918 | |
3919 | === modified file 'tests/mocks/Unity/fake_categories.cpp' |
3920 | --- tests/mocks/Unity/fake_categories.cpp 2013-10-02 13:02:16 +0000 |
3921 | +++ tests/mocks/Unity/fake_categories.cpp 2014-03-18 10:57:24 +0000 |
3922 | @@ -19,100 +19,21 @@ |
3923 | // self |
3924 | #include "fake_categories.h" |
3925 | |
3926 | -// local |
3927 | -#include "categoryresults.h" |
3928 | - |
3929 | -#define CATEGORY_COLUMN 2 |
3930 | - |
3931 | -// TODO: use something from libunity once it's public |
3932 | -enum CategoryColumn { |
3933 | - ID, |
3934 | - DISPLAY_NAME, |
3935 | - ICON_HINT, |
3936 | - RENDERER_NAME, |
3937 | - HINTS |
3938 | -}; |
3939 | - |
3940 | -Categories::Categories(QObject* parent) |
3941 | - : DeeListModel(parent) |
3942 | +#include "fake_resultsmodel.h" |
3943 | + |
3944 | +Categories::Categories(int category_count, QObject* parent) |
3945 | + : QAbstractListModel(parent) |
3946 | + , m_category_count(category_count) |
3947 | { |
3948 | - // FIXME: need to clean up unused filters on countChanged |
3949 | m_roles[Categories::RoleCategoryId] = "categoryId"; |
3950 | m_roles[Categories::RoleName] = "name"; |
3951 | m_roles[Categories::RoleIcon] = "icon"; |
3952 | + m_roles[Categories::RoleRawRendererTemplate] = "rawRendererTemplate"; |
3953 | m_roles[Categories::RoleRenderer] = "renderer"; |
3954 | - m_roles[Categories::RoleContentType] = "contentType"; |
3955 | - m_roles[Categories::RoleRendererHint] = "rendererHint"; |
3956 | - m_roles[Categories::RoleHints] = "hints"; |
3957 | + m_roles[Categories::RoleComponents] = "components"; |
3958 | + m_roles[Categories::RoleProgressSource] = "progressSource"; |
3959 | m_roles[Categories::RoleResults] = "results"; |
3960 | m_roles[Categories::RoleCount] = "count"; |
3961 | - |
3962 | - // TODO This should not be needed but accumulatting the count changes |
3963 | - // makes the visualization more stable and also makes crashes on fast |
3964 | - // change of the search term harder to reproduce |
3965 | - m_timer.setSingleShot(true); |
3966 | - m_timer.setInterval(50); |
3967 | - connect(&m_timer, SIGNAL(timeout()), this, SLOT(onEmitCountChanged())); |
3968 | -} |
3969 | - |
3970 | -DeeListModel* |
3971 | -Categories::getFilter(int index) const |
3972 | -{ |
3973 | - if (!m_filters.contains(index)) { |
3974 | - auto results = new CategoryResults (); |
3975 | - results->setCategoryIndex(index); |
3976 | - connect(results, SIGNAL(countChanged()), this, SLOT(onCountChanged())); |
3977 | - |
3978 | - unsigned cat_index = static_cast<unsigned>(index); |
3979 | - auto model = getResultsForCategory(cat_index); |
3980 | - results->setModel(model); |
3981 | - |
3982 | - m_filters.insert(index, results); |
3983 | - } |
3984 | - |
3985 | - return m_filters[index]; |
3986 | -} |
3987 | - |
3988 | -void |
3989 | -Categories::onCountChanged() |
3990 | -{ |
3991 | - DeeListModel* filter = qobject_cast<DeeListModel*>(sender()); |
3992 | - if (filter) { |
3993 | - m_timerFilters << filter; |
3994 | - m_timer.start(); |
3995 | - } |
3996 | -} |
3997 | - |
3998 | -void Categories::onRowCountChanged() |
3999 | -{ |
4000 | - QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender()); |
4001 | - // find the corresponding category index |
4002 | - for (auto iter = m_overriddenCategories.begin(); iter != m_overriddenCategories.end(); ++iter) { |
4003 | - if (iter.value() == model) { |
4004 | - for (int i = 0; i < rowCount(); i++) { |
4005 | - auto id = data(index(i), RoleCategoryId).toString(); |
4006 | - if (id != iter.key()) continue; |
4007 | - QVector<int> roles; |
4008 | - roles.append(RoleCount); |
4009 | - QModelIndex changedIndex = index(i); |
4010 | - Q_EMIT dataChanged(changedIndex, changedIndex, roles); |
4011 | - break; |
4012 | - } |
4013 | - } |
4014 | - } |
4015 | -} |
4016 | - |
4017 | -void |
4018 | -Categories::onEmitCountChanged() |
4019 | -{ |
4020 | - QVector<int> roles; |
4021 | - roles.append(Categories::RoleCount); |
4022 | - Q_FOREACH(DeeListModel* results, m_timerFilters) { |
4023 | - auto cat_results = qobject_cast<CategoryResults*>(results); |
4024 | - QModelIndex changedIndex = index(cat_results->categoryIndex()); |
4025 | - Q_EMIT dataChanged(changedIndex, changedIndex, roles); |
4026 | - } |
4027 | - m_timerFilters.clear(); |
4028 | } |
4029 | |
4030 | QHash<int, QByteArray> |
4031 | @@ -121,92 +42,44 @@ |
4032 | return m_roles; |
4033 | } |
4034 | |
4035 | -void Categories::onOverrideModelDestroyed() |
4036 | -{ |
4037 | - QObject* model = sender(); |
4038 | - auto iter = m_overriddenCategories.begin(); |
4039 | - while (iter != m_overriddenCategories.end()) { |
4040 | - if (iter.value() == model) { |
4041 | - iter = m_overriddenCategories.erase(iter); |
4042 | - continue; |
4043 | - } |
4044 | - ++iter; |
4045 | - } |
4046 | -} |
4047 | - |
4048 | -void Categories::overrideResults(const QString& categoryId, QAbstractItemModel* model) |
4049 | -{ |
4050 | - m_overriddenCategories[categoryId] = model; |
4051 | - // watch the model |
4052 | - connect(model, &QObject::destroyed, this, &Categories::onOverrideModelDestroyed); |
4053 | - connect(model, &QAbstractItemModel::rowsInserted, this, &Categories::onRowCountChanged); |
4054 | - connect(model, &QAbstractItemModel::rowsRemoved, this, &Categories::onRowCountChanged); |
4055 | - connect(model, &QAbstractItemModel::modelReset, this, &Categories::onRowCountChanged); |
4056 | - |
4057 | - // emit the dataChanged signal if the category is already in the model |
4058 | - for (int i = 0; i < rowCount(); i++) { |
4059 | - auto id = data(index(i), RoleCategoryId).toString(); |
4060 | - if (id != categoryId) continue; |
4061 | - QVector<int> roles; |
4062 | - roles.append(RoleCount); |
4063 | - roles.append(RoleResults); |
4064 | - QModelIndex changedIndex = index(i); |
4065 | - Q_EMIT dataChanged(changedIndex, changedIndex, roles); |
4066 | - break; |
4067 | - } |
4068 | -} |
4069 | - |
4070 | -void Categories::setResultModel(DeeModel* model) |
4071 | -{ |
4072 | - // FIXME: should ref it |
4073 | - m_dee_results = model; |
4074 | -} |
4075 | - |
4076 | - |
4077 | -static void category_filter_map_func (DeeModel* orig_model, |
4078 | - DeeFilterModel* filter_model, |
4079 | - gpointer user_data) |
4080 | -{ |
4081 | - DeeModelIter* iter; |
4082 | - DeeModelIter* end; |
4083 | - unsigned index = GPOINTER_TO_UINT(user_data); |
4084 | - |
4085 | - iter = dee_model_get_first_iter(orig_model); |
4086 | - end = dee_model_get_last_iter(orig_model); |
4087 | - while (iter != end) { |
4088 | - unsigned category_index = dee_model_get_uint32(orig_model, iter, CATEGORY_COLUMN); |
4089 | - if (index == category_index) { |
4090 | - dee_filter_model_append_iter(filter_model, iter); |
4091 | - } |
4092 | - iter = dee_model_next(orig_model, iter); |
4093 | - } |
4094 | -} |
4095 | - |
4096 | -static gboolean category_filter_notify_func (DeeModel* orig_model, |
4097 | - DeeModelIter* orig_iter, |
4098 | - DeeFilterModel* filter_model, |
4099 | - gpointer user_data) |
4100 | -{ |
4101 | - unsigned index = GPOINTER_TO_UINT(user_data); |
4102 | - unsigned category_index = dee_model_get_uint32(orig_model, orig_iter, CATEGORY_COLUMN); |
4103 | - |
4104 | - if (index != category_index) |
4105 | - return FALSE; |
4106 | - |
4107 | - dee_filter_model_insert_iter_with_original_order(filter_model, orig_iter); |
4108 | - return TRUE; |
4109 | -} |
4110 | - |
4111 | -DeeModel* Categories::getResultsForCategory(unsigned cat_index) const |
4112 | -{ |
4113 | - DeeFilter filter; |
4114 | - filter.map_func = category_filter_map_func; |
4115 | - filter.map_notify = category_filter_notify_func; |
4116 | - filter.destroy = nullptr; |
4117 | - filter.userdata = GUINT_TO_POINTER(cat_index); |
4118 | - |
4119 | - DeeModel* filtered_model = dee_filter_model_new(m_dee_results, &filter); |
4120 | - return filtered_model; |
4121 | +int Categories::rowCount(const QModelIndex& /*parent*/) const |
4122 | +{ |
4123 | + return m_category_count + m_specialCategories.count(); |
4124 | +} |
4125 | + |
4126 | +void Categories::addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject) |
4127 | +{ |
4128 | + CategoryData catData; |
4129 | + catData.categoryId = categoryId; |
4130 | + catData.name = name; |
4131 | + catData.icon = icon; |
4132 | + catData.rawTemplate = rawTemplate; |
4133 | + catData.countObject = countObject; |
4134 | + |
4135 | + beginInsertRows(QModelIndex(), 0, 0); |
4136 | + m_specialCategories.prepend(catData); |
4137 | + endInsertRows(); |
4138 | + |
4139 | + if (countObject) { |
4140 | + connect(countObject, SIGNAL(countChanged()), this, SLOT(countChanged())); |
4141 | + } |
4142 | +} |
4143 | + |
4144 | +void Categories::countChanged() |
4145 | +{ |
4146 | + QObject* countObject = sender(); |
4147 | + |
4148 | + for (int i = 0; i < m_specialCategories.count(); ++i) { |
4149 | + const CategoryData &catData = m_specialCategories.at(i); |
4150 | + if (catData.countObject == countObject) { |
4151 | + QVector<int> roles; |
4152 | + roles.append(RoleCount); |
4153 | + |
4154 | + QModelIndex changedIndex(index(i)); |
4155 | + dataChanged(changedIndex, changedIndex, roles); |
4156 | + break; |
4157 | + } |
4158 | + } |
4159 | } |
4160 | |
4161 | QVariant |
4162 | @@ -216,44 +89,86 @@ |
4163 | return QVariant(); |
4164 | } |
4165 | |
4166 | - switch (role) { |
4167 | - case RoleCategoryId: |
4168 | - return DeeListModel::data(index, CategoryColumn::ID); |
4169 | - case RoleName: |
4170 | - return DeeListModel::data(index, CategoryColumn::DISPLAY_NAME); |
4171 | - case RoleIcon: |
4172 | - return DeeListModel::data(index, CategoryColumn::ICON_HINT); |
4173 | - case RoleRenderer: |
4174 | - return DeeListModel::data(index, CategoryColumn::RENDERER_NAME); |
4175 | - case RoleContentType: |
4176 | - { |
4177 | - auto hints = DeeListModel::data(index, CategoryColumn::HINTS).toHash(); |
4178 | - return hints.contains("content-type") ? hints["content-type"] : QVariant(QString("default")); |
4179 | - } |
4180 | - case RoleRendererHint: |
4181 | - { |
4182 | - auto hints = DeeListModel::data(index, CategoryColumn::HINTS).toHash(); |
4183 | - return hints.contains("renderer-hint") ? hints["renderer-hint"] : QVariant(QString()); |
4184 | - } |
4185 | - case RoleHints: |
4186 | - return DeeListModel::data(index, CategoryColumn::HINTS); |
4187 | - case RoleResults: |
4188 | - if (m_overriddenCategories.size() > 0) |
4189 | - { |
4190 | - auto id = DeeListModel::data(index, CategoryColumn::ID).toString(); |
4191 | - if (m_overriddenCategories.find(id) != m_overriddenCategories.end()) |
4192 | - return QVariant::fromValue(m_overriddenCategories[id]); |
4193 | - } |
4194 | - return QVariant::fromValue(getFilter(index.row())); |
4195 | - case RoleCount: |
4196 | - if (m_overriddenCategories.size() > 0) |
4197 | - { |
4198 | - auto id = DeeListModel::data(index, CategoryColumn::ID).toString(); |
4199 | - if (m_overriddenCategories.find(id) != m_overriddenCategories.end()) |
4200 | - return QVariant::fromValue(m_overriddenCategories[id]->rowCount()); |
4201 | - } |
4202 | - return QVariant::fromValue(getFilter(index.row())->rowCount()); |
4203 | - default: |
4204 | - return QVariant(); |
4205 | + ResultsModel *resultsModel = m_resultsModels[index.row()]; |
4206 | + if (!resultsModel) { |
4207 | + resultsModel = new ResultsModel(15, index.row()); |
4208 | + m_resultsModels[index.row()] = resultsModel; |
4209 | + } |
4210 | + if (index.row() < m_specialCategories.count()) { |
4211 | + const CategoryData &catData = m_specialCategories.at(index.row()); |
4212 | + switch (role) { |
4213 | + case RoleCategoryId: |
4214 | + return catData.categoryId; |
4215 | + case RoleName: |
4216 | + return catData.name; |
4217 | + case RoleIcon: |
4218 | + return catData.icon; |
4219 | + case RoleRawRendererTemplate: |
4220 | + return catData.rawTemplate; |
4221 | + case RoleRenderer: |
4222 | + { |
4223 | + QVariantMap map; |
4224 | + map["category-layout"] = index.row() % 2 == 0 ? "grid" : "carousel"; |
4225 | + map["card-size"] = "small"; |
4226 | + return map; |
4227 | + } |
4228 | + case RoleComponents: |
4229 | + { |
4230 | + QVariantMap map, artMap; |
4231 | + artMap["aspect-ratio"] = "1.0"; |
4232 | + artMap["field"] = "art"; |
4233 | + map["art"] = artMap; |
4234 | + map["title"] = "HOLA"; |
4235 | + return map; |
4236 | + } |
4237 | + case RoleProgressSource: |
4238 | + qFatal("Using un-implemented RoleProgressSource Categories role"); |
4239 | + return QVariant(); |
4240 | + case RoleResults: |
4241 | + return QVariant(); |
4242 | + case RoleCount: |
4243 | + return catData.countObject->property("count"); |
4244 | + default: |
4245 | + qFatal("Using un-implemented Categories role"); |
4246 | + return QVariant(); |
4247 | + } |
4248 | + } else { |
4249 | + switch (role) { |
4250 | + case RoleCategoryId: |
4251 | + return QString("%1").arg(index.row()); |
4252 | + case RoleName: |
4253 | + return QString("Category %1").arg(index.row()); |
4254 | + case RoleIcon: |
4255 | + return "gtk-apply"; |
4256 | + case RoleRawRendererTemplate: |
4257 | + qFatal("Using un-implemented RoleRawRendererTemplate Categories role"); |
4258 | + return QVariant(); |
4259 | + case RoleRenderer: |
4260 | + { |
4261 | + QVariantMap map; |
4262 | + map["category-layout"] = index.row() % 2 == 0 ? "grid" : "carousel"; |
4263 | + map["card-size"] = "small"; |
4264 | + return map; |
4265 | + } |
4266 | + case RoleComponents: |
4267 | + { |
4268 | + QVariantMap map, artMap; |
4269 | + artMap["aspect-ratio"] = "1.0"; |
4270 | + artMap["field"] = "art"; |
4271 | + map["art"] = artMap; |
4272 | + map["title"] = "HOLA"; |
4273 | + return map; |
4274 | + } |
4275 | + case RoleProgressSource: |
4276 | + qFatal("Using un-implemented RoleProgressSource Categories role"); |
4277 | + return QVariant(); |
4278 | + case RoleResults: |
4279 | + return QVariant::fromValue(resultsModel); |
4280 | + case RoleCount: |
4281 | + return resultsModel->rowCount(); |
4282 | + default: |
4283 | + qFatal("Using un-implemented Categories role"); |
4284 | + return QVariant(); |
4285 | + } |
4286 | } |
4287 | } |
4288 | |
4289 | === modified file 'tests/mocks/Unity/fake_categories.h' |
4290 | --- tests/mocks/Unity/fake_categories.h 2013-10-02 13:02:16 +0000 |
4291 | +++ tests/mocks/Unity/fake_categories.h 2014-03-18 10:57:24 +0000 |
4292 | @@ -18,58 +18,54 @@ |
4293 | #define FAKE_CATEGORIES_H |
4294 | |
4295 | // Qt |
4296 | -#include <QObject> |
4297 | -#include <QSet> |
4298 | -#include <QTimer> |
4299 | - |
4300 | -#include <dee.h> |
4301 | -#include <deelistmodel.h> |
4302 | - |
4303 | -class Categories : public DeeListModel |
4304 | +#include <QAbstractListModel> |
4305 | +#include <QList> |
4306 | + |
4307 | +class ResultsModel; |
4308 | + |
4309 | +class Categories : public QAbstractListModel |
4310 | { |
4311 | Q_OBJECT |
4312 | |
4313 | Q_ENUMS(Roles) |
4314 | |
4315 | public: |
4316 | - Categories(QObject* parent = 0); |
4317 | + Categories(int category_count, QObject* parent = 0); |
4318 | enum Roles { |
4319 | RoleCategoryId, |
4320 | RoleName, |
4321 | RoleIcon, |
4322 | + RoleRawRendererTemplate, |
4323 | RoleRenderer, |
4324 | - RoleContentType, |
4325 | - RoleRendererHint, |
4326 | - RoleHints, |
4327 | + RoleComponents, |
4328 | + RoleProgressSource, // maybe |
4329 | RoleResults, |
4330 | RoleCount |
4331 | }; |
4332 | |
4333 | - Q_INVOKABLE void overrideResults(const QString& categoryId, QAbstractItemModel* model); |
4334 | - |
4335 | - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; |
4336 | - |
4337 | - QHash<int, QByteArray> roleNames() const; |
4338 | - |
4339 | - /* setters */ |
4340 | - void setResultModel(DeeModel* model); |
4341 | + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
4342 | + QHash<int, QByteArray> roleNames() const override; |
4343 | + int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
4344 | + |
4345 | + Q_INVOKABLE void addSpecialCategory(QString const& categoryId, QString const& name, QString const& icon, QString const& rawTemplate, QObject* countObject); |
4346 | |
4347 | private Q_SLOTS: |
4348 | - void onCountChanged(); |
4349 | - void onRowCountChanged(); |
4350 | - void onEmitCountChanged(); |
4351 | - void onOverrideModelDestroyed(); |
4352 | + void countChanged(); |
4353 | |
4354 | private: |
4355 | - DeeModel* getResultsForCategory(unsigned index) const; |
4356 | - DeeListModel* getFilter(int index) const; |
4357 | - |
4358 | - DeeModel* m_dee_results; |
4359 | - QTimer m_timer; |
4360 | - QSet<DeeListModel*> m_timerFilters; |
4361 | + mutable QHash<int, ResultsModel*> m_resultsModels; |
4362 | QHash<int, QByteArray> m_roles; |
4363 | - QMap<QString, QAbstractItemModel*> m_overriddenCategories; |
4364 | - mutable QMap<int, DeeListModel*> m_filters; |
4365 | + int m_category_count; |
4366 | + |
4367 | + struct CategoryData { |
4368 | + QString categoryId; |
4369 | + QString name; |
4370 | + QString icon; |
4371 | + QString rawTemplate; |
4372 | + QObject* countObject; |
4373 | + }; |
4374 | + |
4375 | + QList<CategoryData> m_specialCategories; |
4376 | }; |
4377 | |
4378 | #endif // FAKE_CATEGORIES_H |
4379 | |
4380 | === removed file 'tests/mocks/Unity/fake_preview.cpp' |
4381 | --- tests/mocks/Unity/fake_preview.cpp 2014-01-16 17:39:35 +0000 |
4382 | +++ tests/mocks/Unity/fake_preview.cpp 1970-01-01 00:00:00 +0000 |
4383 | @@ -1,73 +0,0 @@ |
4384 | -/* |
4385 | - * Copyright (C) 2013, 2014 Canonical, Ltd. |
4386 | - * |
4387 | - * This program is free software; you can redistribute it and/or modify |
4388 | - * it under the terms of the GNU General Public License as published by |
4389 | - * the Free Software Foundation; version 3. |
4390 | - * |
4391 | - * This program is distributed in the hope that it will be useful, |
4392 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4393 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4394 | - * GNU General Public License for more details. |
4395 | - * |
4396 | - * You should have received a copy of the GNU General Public License |
4397 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4398 | - */ |
4399 | - |
4400 | -#include "fake_preview.h" |
4401 | - |
4402 | -Preview::Preview(const QString &rendererName, QObject *parent): |
4403 | - QObject(parent), |
4404 | - m_rendererName(rendererName) |
4405 | -{ |
4406 | -} |
4407 | - |
4408 | -QString Preview::rendererName() const |
4409 | -{ |
4410 | - return m_rendererName; |
4411 | -} |
4412 | - |
4413 | -QString Preview::title() const |
4414 | -{ |
4415 | - return "Title"; |
4416 | -} |
4417 | - |
4418 | -QString Preview::subtitle() const |
4419 | -{ |
4420 | - return "Subtitle"; |
4421 | -} |
4422 | - |
4423 | -QString Preview::description() const |
4424 | -{ |
4425 | - return "Description"; |
4426 | -} |
4427 | - |
4428 | -QVariant Preview::actions() |
4429 | -{ |
4430 | - return QVariant(); |
4431 | -} |
4432 | - |
4433 | -QVariant Preview::infoHints() |
4434 | -{ |
4435 | - return QVariant(); |
4436 | -} |
4437 | - |
4438 | -QVariantMap Preview::infoHintsHash() const |
4439 | -{ |
4440 | - return QVariantMap(); |
4441 | -} |
4442 | - |
4443 | -QString Preview::image() const |
4444 | -{ |
4445 | - return ""; |
4446 | -} |
4447 | - |
4448 | -void Preview::execute(const QString& actionId, const QHash<QString, QVariant>& hints) |
4449 | -{ |
4450 | - Q_UNUSED(actionId); |
4451 | - Q_UNUSED(hints); |
4452 | -} |
4453 | - |
4454 | -void Preview::cancelAction() |
4455 | -{ |
4456 | -} |
4457 | |
4458 | === removed file 'tests/mocks/Unity/fake_preview.h' |
4459 | --- tests/mocks/Unity/fake_preview.h 2014-01-16 17:39:35 +0000 |
4460 | +++ tests/mocks/Unity/fake_preview.h 1970-01-01 00:00:00 +0000 |
4461 | @@ -1,65 +0,0 @@ |
4462 | -/* |
4463 | - * Copyright (C) 2013, 2014 Canonical, Ltd. |
4464 | - * |
4465 | - * This program is free software; you can redistribute it and/or modify |
4466 | - * it under the terms of the GNU General Public License as published by |
4467 | - * the Free Software Foundation; version 3. |
4468 | - * |
4469 | - * This program is distributed in the hope that it will be useful, |
4470 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4471 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4472 | - * GNU General Public License for more details. |
4473 | - * |
4474 | - * You should have received a copy of the GNU General Public License |
4475 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4476 | - */ |
4477 | - |
4478 | -#ifndef FAKE_PREVIEW_H |
4479 | -#define FAKE_PREVIEW_H |
4480 | - |
4481 | -// Qt |
4482 | -#include <QObject> |
4483 | -#include <QString> |
4484 | -#include <QMetaType> |
4485 | -#include <QList> |
4486 | -#include <QVariantMap> |
4487 | - |
4488 | -class Q_DECL_EXPORT Preview : public QObject |
4489 | -{ |
4490 | - Q_OBJECT |
4491 | - |
4492 | - Q_PROPERTY(QString rendererName READ rendererName NOTIFY previewChanged) |
4493 | - Q_PROPERTY(QString title READ title NOTIFY previewChanged) |
4494 | - Q_PROPERTY(QString subtitle READ subtitle NOTIFY previewChanged) |
4495 | - Q_PROPERTY(QString description READ description NOTIFY previewChanged) |
4496 | - Q_PROPERTY(QVariant actions READ actions NOTIFY previewChanged) |
4497 | - Q_PROPERTY(QVariant infoHints READ infoHints NOTIFY previewChanged) |
4498 | - Q_PROPERTY(QVariantMap infoMap READ infoHintsHash NOTIFY previewChanged) |
4499 | - Q_PROPERTY(QString image READ image NOTIFY previewChanged) |
4500 | - |
4501 | -public: |
4502 | - explicit Preview(const QString &rendererName, QObject *parent = 0); |
4503 | - |
4504 | - QString rendererName() const; |
4505 | - QString title() const; |
4506 | - QString subtitle() const; |
4507 | - QString description() const; |
4508 | - QVariant actions(); |
4509 | - QVariant infoHints(); |
4510 | - QVariantMap infoHintsHash() const; |
4511 | - QString image() const; |
4512 | - |
4513 | - Q_INVOKABLE void execute(const QString& actionId, const QHash<QString, QVariant>& hints); |
4514 | - |
4515 | - Q_INVOKABLE void cancelAction(); |
4516 | - |
4517 | -Q_SIGNALS: |
4518 | - void previewChanged(); |
4519 | - |
4520 | -private: |
4521 | - QString m_rendererName; |
4522 | -}; |
4523 | - |
4524 | -Q_DECLARE_METATYPE(Preview *) |
4525 | - |
4526 | -#endif // FAKE_PREVIEW_H |
4527 | |
4528 | === renamed file 'tests/mocks/Unity/scopes-ng/fake_preview_model.cpp' => 'tests/mocks/Unity/fake_previewmodel.cpp' |
4529 | --- tests/mocks/Unity/scopes-ng/fake_preview_model.cpp 2014-02-07 09:57:30 +0000 |
4530 | +++ tests/mocks/Unity/fake_previewmodel.cpp 2014-03-18 10:57:24 +0000 |
4531 | @@ -19,78 +19,68 @@ |
4532 | */ |
4533 | |
4534 | // self |
4535 | -#include "fake_preview_model.h" |
4536 | +#include "fake_previewmodel.h" |
4537 | + |
4538 | +// local |
4539 | +#include "fake_previewwidgetmodel.h" |
4540 | |
4541 | // Qt |
4542 | -#include <QVariantMap> |
4543 | - |
4544 | -namespace scopes_ng |
4545 | -{ |
4546 | - |
4547 | -struct PreviewData |
4548 | -{ |
4549 | - QString id; |
4550 | - QString type; |
4551 | - QVariantMap data; |
4552 | - |
4553 | - PreviewData(QString const& id_, QString const& type_, QVariantMap const& data_): id(id_), type(type_), data(data_) |
4554 | - { |
4555 | - } |
4556 | -}; |
4557 | +#include <QDebug> |
4558 | |
4559 | PreviewModel::PreviewModel(QObject* parent) : QAbstractListModel(parent) |
4560 | { |
4561 | - m_roles[Roles::RoleWidgetId] = "widgetId"; |
4562 | - m_roles[Roles::RoleType] = "type"; |
4563 | - m_roles[Roles::RoleProperties] = "properties"; |
4564 | - |
4565 | - populateWidgets(); |
4566 | -} |
4567 | - |
4568 | -void PreviewModel::populateWidgets() |
4569 | -{ |
4570 | - beginResetModel(); |
4571 | - m_previewWidgets.clear(); |
4572 | - for (int i = 0; i <= 20; i++) { |
4573 | - // FIXME: the API will expose nicer getters soon, use those! |
4574 | - QVariantMap attributes; |
4575 | - attributes["text"] = QVariant::fromValue(QString("Widget %1").arg(i)); |
4576 | - attributes["title"] = QVariant::fromValue(QString("Title %1").arg(i)); |
4577 | - PreviewData* preview_data = new PreviewData(QString("widget-%1").arg(i), QString("text"), attributes); |
4578 | - m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
4579 | - } |
4580 | - endResetModel(); |
4581 | - |
4582 | -} |
4583 | - |
4584 | -void PreviewModel::triggered(QString widgetId, QString actionId, QVariantMap data) |
4585 | -{ |
4586 | - Q_EMIT actionTriggered(widgetId, actionId, data); |
4587 | + // we have one column by default |
4588 | + PreviewWidgetModel* columnModel = new PreviewWidgetModel(this); |
4589 | + m_previewWidgetModels.append(columnModel); |
4590 | } |
4591 | |
4592 | QHash<int, QByteArray> PreviewModel::roleNames() const |
4593 | { |
4594 | - return m_roles; |
4595 | + QHash<int, QByteArray> roles; |
4596 | + |
4597 | + roles[Roles::RoleColumnModel] = "columnModel"; |
4598 | + |
4599 | + return roles; |
4600 | +} |
4601 | + |
4602 | +void PreviewModel::setWidgetColumnCount(int count) |
4603 | +{ |
4604 | + if (count != 1) { |
4605 | + qWarning("PreviewModel::setWidgetColumnCount != 1 not implemented"); |
4606 | + } |
4607 | +} |
4608 | + |
4609 | +int PreviewModel::widgetColumnCount() const |
4610 | +{ |
4611 | + return 1; |
4612 | +} |
4613 | + |
4614 | +bool PreviewModel::loaded() const |
4615 | +{ |
4616 | + return true; |
4617 | +} |
4618 | + |
4619 | +bool PreviewModel::processingAction() const |
4620 | +{ |
4621 | + return false; |
4622 | +} |
4623 | + |
4624 | +void PreviewModel::setProcessingAction(bool /*processing*/) |
4625 | +{ |
4626 | + qFatal("PreviewModel::setProcessingAction not implemented"); |
4627 | } |
4628 | |
4629 | int PreviewModel::rowCount(const QModelIndex&) const |
4630 | { |
4631 | - return m_previewWidgets.size(); |
4632 | + return m_previewWidgetModels.size(); |
4633 | } |
4634 | |
4635 | QVariant PreviewModel::data(const QModelIndex& index, int role) const |
4636 | { |
4637 | - auto widget_data = m_previewWidgets.at(index.row()); |
4638 | switch (role) { |
4639 | - case RoleWidgetId: |
4640 | - return widget_data->id; |
4641 | - case RoleType: |
4642 | - return widget_data->type; |
4643 | - case RoleProperties: |
4644 | - return widget_data->data; |
4645 | + case RoleColumnModel: |
4646 | + return QVariant::fromValue(m_previewWidgetModels.at(index.row())); |
4647 | default: |
4648 | return QVariant(); |
4649 | } |
4650 | } |
4651 | - |
4652 | -} // namespace scopes_ng |
4653 | |
4654 | === renamed file 'tests/mocks/Unity/scopes-ng/fake_preview_model.h' => 'tests/mocks/Unity/fake_previewmodel.h' |
4655 | --- tests/mocks/Unity/scopes-ng/fake_preview_model.h 2014-02-07 09:55:56 +0000 |
4656 | +++ tests/mocks/Unity/fake_previewmodel.h 2014-03-18 10:57:24 +0000 |
4657 | @@ -15,54 +15,53 @@ |
4658 | */ |
4659 | |
4660 | |
4661 | -#ifndef NG_FAKE_PREVIEW_H |
4662 | -#define NG_FAKE_PREVIEW_H |
4663 | +#ifndef FAKE_PREVIEWMODEL_H |
4664 | +#define FAKE_PREVIEWMODEL_H |
4665 | |
4666 | #include <QAbstractListModel> |
4667 | #include <QSharedPointer> |
4668 | #include <QVariantMap> |
4669 | |
4670 | -namespace scopes_ng |
4671 | -{ |
4672 | - |
4673 | -class PreviewData; |
4674 | - |
4675 | -class Q_DECL_EXPORT PreviewModel : public QAbstractListModel |
4676 | +class PreviewWidgetModel; |
4677 | + |
4678 | +class PreviewModel : public QAbstractListModel |
4679 | { |
4680 | Q_OBJECT |
4681 | |
4682 | Q_ENUMS(Roles) |
4683 | |
4684 | + Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged) |
4685 | + Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) |
4686 | + Q_PROPERTY(bool processingAction READ processingAction NOTIFY processingActionChanged) |
4687 | + |
4688 | public: |
4689 | explicit PreviewModel(QObject* parent = 0); |
4690 | |
4691 | enum Roles { |
4692 | - RoleWidgetId, |
4693 | - RoleType, |
4694 | - RoleProperties |
4695 | + RoleColumnModel |
4696 | }; |
4697 | |
4698 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
4699 | QHash<int, QByteArray> roleNames() const override; |
4700 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
4701 | |
4702 | + void setWidgetColumnCount(int count); |
4703 | + int widgetColumnCount() const; |
4704 | + bool loaded() const; |
4705 | + bool processingAction() const; |
4706 | + void setProcessingAction(bool processing); |
4707 | + |
4708 | Q_SIGNALS: |
4709 | - void actionTriggered(QString widgetId, QString actionId, QVariantMap data); |
4710 | - |
4711 | -public Q_SLOTS: |
4712 | - void triggered(QString widgetId, QString actionId, QVariantMap data); |
4713 | + void widgetColumnCountChanged(); |
4714 | + void loadedChanged(); |
4715 | + void processingActionChanged(); |
4716 | + void triggered(QString const&, QString const&, QVariantMap const&); |
4717 | |
4718 | private: |
4719 | QHash<int, QByteArray> m_roles; |
4720 | - QList<QSharedPointer<PreviewData>> m_previewWidgets; |
4721 | - |
4722 | - void populateWidgets(); |
4723 | - |
4724 | + QList<PreviewWidgetModel*> m_previewWidgetModels; |
4725 | }; |
4726 | |
4727 | -} // namespace scopes_ng |
4728 | - |
4729 | - |
4730 | -Q_DECLARE_METATYPE(scopes_ng::PreviewModel*) |
4731 | - |
4732 | -#endif // NG_FAKE_PREVIW_H |
4733 | +Q_DECLARE_METATYPE(PreviewModel*) |
4734 | + |
4735 | +#endif // FAKE_PREVIEWMODEL_H |
4736 | |
4737 | === added file 'tests/mocks/Unity/fake_previewstack.cpp' |
4738 | --- tests/mocks/Unity/fake_previewstack.cpp 1970-01-01 00:00:00 +0000 |
4739 | +++ tests/mocks/Unity/fake_previewstack.cpp 2014-03-18 10:57:24 +0000 |
4740 | @@ -0,0 +1,76 @@ |
4741 | +/* |
4742 | + * Copyright (C) 2014 Canonical, Ltd. |
4743 | + * |
4744 | + * This program is free software; you can redistribute it and/or modify |
4745 | + * it under the terms of the GNU General Public License as published by |
4746 | + * the Free Software Foundation; version 3. |
4747 | + * |
4748 | + * This program is distributed in the hope that it will be useful, |
4749 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4750 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4751 | + * GNU General Public License for more details. |
4752 | + * |
4753 | + * You should have received a copy of the GNU General Public License |
4754 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4755 | + */ |
4756 | + |
4757 | +// self |
4758 | +#include "fake_previewstack.h" |
4759 | + |
4760 | +// local |
4761 | +#include "fake_previewmodel.h" |
4762 | +#include "fake_scope.h" |
4763 | + |
4764 | +PreviewStack::PreviewStack(QObject* parent) : QAbstractListModel(parent) |
4765 | +{ |
4766 | + m_previews << new PreviewModel(this); |
4767 | +} |
4768 | + |
4769 | +PreviewStack::~PreviewStack() |
4770 | +{ |
4771 | +} |
4772 | + |
4773 | +QHash<int, QByteArray> PreviewStack::roleNames() const |
4774 | +{ |
4775 | + QHash<int, QByteArray> roles; |
4776 | + |
4777 | + roles[Roles::RolePreviewModel] = "previewModel"; |
4778 | + |
4779 | + return roles; |
4780 | +} |
4781 | + |
4782 | +void PreviewStack::setWidgetColumnCount(int columnCount) |
4783 | +{ |
4784 | + if (columnCount != 1) { |
4785 | + qFatal("PreviewStack::setWidgetColumnCount != 1 not implemented"); |
4786 | + } |
4787 | +} |
4788 | + |
4789 | +int PreviewStack::widgetColumnCount() const |
4790 | +{ |
4791 | + return 1; |
4792 | +} |
4793 | + |
4794 | +int PreviewStack::rowCount(const QModelIndex&) const |
4795 | +{ |
4796 | + return m_previews.size(); |
4797 | +} |
4798 | + |
4799 | +PreviewModel* PreviewStack::get(int index) const |
4800 | +{ |
4801 | + if (index >= m_previews.size()) { |
4802 | + return nullptr; |
4803 | + } |
4804 | + |
4805 | + return m_previews.at(index); |
4806 | +} |
4807 | + |
4808 | +QVariant PreviewStack::data(const QModelIndex& index, int role) const |
4809 | +{ |
4810 | + switch (role) { |
4811 | + case RolePreviewModel: |
4812 | + return QVariant::fromValue(m_previews.at(index.row())); |
4813 | + default: |
4814 | + return QVariant(); |
4815 | + } |
4816 | +} |
4817 | |
4818 | === added file 'tests/mocks/Unity/fake_previewstack.h' |
4819 | --- tests/mocks/Unity/fake_previewstack.h 1970-01-01 00:00:00 +0000 |
4820 | +++ tests/mocks/Unity/fake_previewstack.h 2014-03-18 10:57:24 +0000 |
4821 | @@ -0,0 +1,61 @@ |
4822 | +/* |
4823 | + * Copyright (C) 2014 Canonical, Ltd. |
4824 | + * |
4825 | + * This program is free software; you can redistribute it and/or modify |
4826 | + * it under the terms of the GNU General Public License as published by |
4827 | + * the Free Software Foundation; version 3. |
4828 | + * |
4829 | + * This program is distributed in the hope that it will be useful, |
4830 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4831 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4832 | + * GNU General Public License for more details. |
4833 | + * |
4834 | + * You should have received a copy of the GNU General Public License |
4835 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4836 | + */ |
4837 | + |
4838 | + |
4839 | +#ifndef FAKE_PREVIEWSTACK_H |
4840 | +#define FAKE_PREVIEWSTACK_H |
4841 | + |
4842 | +#include <QAbstractListModel> |
4843 | +#include <QSharedPointer> |
4844 | +#include <QVariantMap> |
4845 | + |
4846 | +class PreviewModel; |
4847 | + |
4848 | +class PreviewStack : public QAbstractListModel |
4849 | +{ |
4850 | + Q_OBJECT |
4851 | + |
4852 | + Q_ENUMS(Roles) |
4853 | + |
4854 | + Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged) |
4855 | + |
4856 | +public: |
4857 | + explicit PreviewStack(QObject* parent = 0); |
4858 | + virtual ~PreviewStack(); |
4859 | + |
4860 | + enum Roles { |
4861 | + RolePreviewModel |
4862 | + }; |
4863 | + |
4864 | + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
4865 | + QHash<int, QByteArray> roleNames() const override; |
4866 | + int rowCount(const QModelIndex& parent = QModelIndex()) const override; |
4867 | + |
4868 | + Q_INVOKABLE PreviewModel* get(int index) const; |
4869 | + |
4870 | + void setWidgetColumnCount(int columnCount); |
4871 | + int widgetColumnCount() const; |
4872 | + |
4873 | +Q_SIGNALS: |
4874 | + void widgetColumnCountChanged(); |
4875 | + |
4876 | +private: |
4877 | + QList<PreviewModel*> m_previews; |
4878 | +}; |
4879 | + |
4880 | +Q_DECLARE_METATYPE(PreviewStack*) |
4881 | + |
4882 | +#endif // FAKE_PREVIEWSTACK_H |
4883 | |
4884 | === added file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp' |
4885 | --- tests/mocks/Unity/fake_previewwidgetmodel.cpp 1970-01-01 00:00:00 +0000 |
4886 | +++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2014-03-18 10:57:24 +0000 |
4887 | @@ -0,0 +1,86 @@ |
4888 | +/* |
4889 | + * Copyright (C) 2014 Canonical, Ltd. |
4890 | + * |
4891 | + * Authors: |
4892 | + * Michał Sawicz <michal.sawicz@canonical.com> |
4893 | + * Michal Hruby <michal.hruby@canonical.com> |
4894 | + * |
4895 | + * This program is free software; you can redistribute it and/or modify |
4896 | + * it under the terms of the GNU General Public License as published by |
4897 | + * the Free Software Foundation; version 3. |
4898 | + * |
4899 | + * This program is distributed in the hope that it will be useful, |
4900 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4901 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4902 | + * GNU General Public License for more details. |
4903 | + * |
4904 | + * You should have received a copy of the GNU General Public License |
4905 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4906 | + */ |
4907 | + |
4908 | +// self |
4909 | +#include "fake_previewwidgetmodel.h" |
4910 | + |
4911 | +// Qt |
4912 | +#include <QVariantMap> |
4913 | + |
4914 | +struct PreviewData |
4915 | +{ |
4916 | + QString id; |
4917 | + QString type; |
4918 | + QVariantMap data; |
4919 | + |
4920 | + PreviewData(QString const& id_, QString const& type_, QVariantMap const& data_): id(id_), type(type_), data(data_) |
4921 | + { |
4922 | + } |
4923 | +}; |
4924 | + |
4925 | +PreviewWidgetModel::PreviewWidgetModel(QObject* parent) : QAbstractListModel(parent) |
4926 | +{ |
4927 | + m_roles[Roles::RoleWidgetId] = "widgetId"; |
4928 | + m_roles[Roles::RoleType] = "type"; |
4929 | + m_roles[Roles::RoleProperties] = "properties"; |
4930 | + |
4931 | + populateWidgets(); |
4932 | +} |
4933 | + |
4934 | +void PreviewWidgetModel::populateWidgets() |
4935 | +{ |
4936 | + beginResetModel(); |
4937 | + m_previewWidgets.clear(); |
4938 | + for (int i = 0; i <= 20; i++) { |
4939 | + // FIXME: the API will expose nicer getters soon, use those! |
4940 | + QVariantMap attributes; |
4941 | + attributes["text"] = QVariant::fromValue(QString("Widget %1").arg(i)); |
4942 | + attributes["title"] = QVariant::fromValue(QString("Title %1").arg(i)); |
4943 | + PreviewData* preview_data = new PreviewData(QString("widget-%1").arg(i), QString("text"), attributes); |
4944 | + m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
4945 | + } |
4946 | + endResetModel(); |
4947 | + |
4948 | +} |
4949 | + |
4950 | +QHash<int, QByteArray> PreviewWidgetModel::roleNames() const |
4951 | +{ |
4952 | + return m_roles; |
4953 | +} |
4954 | + |
4955 | +int PreviewWidgetModel::rowCount(const QModelIndex&) const |
4956 | +{ |
4957 | + return m_previewWidgets.size(); |
4958 | +} |
4959 | + |
4960 | +QVariant PreviewWidgetModel::data(const QModelIndex& index, int role) const |
4961 | +{ |
4962 | + auto widget_data = m_previewWidgets.at(index.row()); |
4963 | + switch (role) { |
4964 | + case RoleWidgetId: |
4965 | + return widget_data->id; |
4966 | + case RoleType: |
4967 | + return widget_data->type; |
4968 | + case RoleProperties: |
4969 | + return widget_data->data; |
4970 | + default: |
4971 | + return QVariant(); |
4972 | + } |
4973 | +} |
4974 | |
4975 | === added file 'tests/mocks/Unity/fake_previewwidgetmodel.h' |
4976 | --- tests/mocks/Unity/fake_previewwidgetmodel.h 1970-01-01 00:00:00 +0000 |
4977 | +++ tests/mocks/Unity/fake_previewwidgetmodel.h 2014-03-18 10:57:24 +0000 |
4978 | @@ -0,0 +1,56 @@ |
4979 | +/* |
4980 | + * Copyright (C) 2014 Canonical, Ltd. |
4981 | + * |
4982 | + * This program is free software; you can redistribute it and/or modify |
4983 | + * it under the terms of the GNU General Public License as published by |
4984 | + * the Free Software Foundation; version 3. |
4985 | + * |
4986 | + * This program is distributed in the hope that it will be useful, |
4987 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4988 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4989 | + * GNU General Public License for more details. |
4990 | + * |
4991 | + * You should have received a copy of the GNU General Public License |
4992 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4993 | + */ |
4994 | + |
4995 | + |
4996 | +#ifndef FAKE_PREVIEWWIDGETMODEL_H |
4997 | +#define FAKE_PREVIEWWIDGETMODEL_H |
4998 | + |
4999 | +#include <QAbstractListModel> |
5000 | +#include <QSharedPointer> |
FAILED: Continuous integration, rev:712 /code.launchpad .net/~unity- team/unity8/ new-scopes- cleanup/ +merge/ 209642/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity8- ci/2441/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 3711 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/3302/ console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- trusty/ 1311/console jenkins. qa.ubuntu. com/job/ unity8- trusty- amd64-ci/ 962 jenkins. qa.ubuntu. com/job/ unity8- trusty- armhf-ci/ 966 jenkins. qa.ubuntu. com/job/ unity8- trusty- armhf-ci/ 966/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- trusty- i386-ci/ 962 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty/ 3261 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/3716 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/3716/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/3304 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/3304/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/5673/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 4524
Executed test runs:
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/2441/ rebuild
http://