on xenial help sign in
Starting to get shape
commit053eaecae064a89e24389e7263b0eba32c485a83 authorAlbert Astals <albert.astals@canonical.com> dateFri 11 Jul 2014, 12:03 (12 years ago) parent6509027
6 files changed+72−4
qml/Dash/CardFilterGrid.qml+1 qml/Dash/DashContent.qml+2 qml/Dash/ScopesOverview.qml+59−1 tests/mocks/Unity/fake_scopes.cpp+7−1 tests/mocks/Unity/fake_scopes.h+1 tests/mocks/Unity/fake_scopesoverview.cpp+2−2
qml/Dash/CardFilterGrid.qml+1
@@ -53,6 +53,7 @@ DashRenderer {
5353 item.objectName = "delegate" + index;
5454 item.width = Qt.binding(function() { return cardTool.cardWidth; });
5555 item.height = Qt.binding(function() { return cardTool.cardHeight; });
56+ item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
5657 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
5758 item.cardData = Qt.binding(function() { return model; });
5859 item.template = Qt.binding(function() { return cardTool.template; });
qml/Dash/DashContent.qml+2
@@ -103,6 +103,7 @@ Item {
103103 overviewController.progress = 0;
104104 overviewController.accepted = false;
105105 }
106+ scopeScale: dashContentListHolder.scale
106107 }
107108
108109 Item {
@@ -196,6 +197,7 @@ Item {
196197 }
197198 }
198199
200+ opacity: 1 - overviewController.progress
199201 scale: 1 - overviewController.progress * 0.6
200202 Behavior on scale {
201203 id: dashContentScaleAnimation
qml/Dash/ScopesOverview.qml+59−1
@@ -23,6 +23,7 @@ Item {
2323
2424 property real progress: 0
2525 property var scope: null
26+ property real scopeScale: 1
2627
2728 signal done
2829
@@ -135,6 +136,48 @@ Item {
135136 id: middleItems
136137 model: scope ? scope.categories : null
137138 delegate: Loader {
139+ height: {
140+ if (index == 0) {
141+ return parent.height;
142+ } else {
143+ return parent.height - topBar.height - units.gu(2)
144+ }
145+ }
146+ width: {
147+ if (index == 0) {
148+ return parent.width / scopeScale
149+ } else {
150+ return parent.width
151+ }
152+ }
153+ x: {
154+ if (index == 0) {
155+ return (root.width - width) / 2;
156+ } else {
157+ return 0;
158+ }
159+ }
160+ anchors {
161+ bottom: parent.bottom
162+ }
163+
164+ scale: index == 0 ? scopeScale : 1
165+
166+ opacity: tabBarHolder.currentTab == index ? 1 : 0
167+ Behavior on opacity { UbuntuNumberAnimation { } }
168+ enabled: opacity == 1
169+
170+ clip: index == 1
171+
172+ CardTool {
173+ id: cardTool
174+ objectName: "cardTool"
175+ count: results.count
176+ template: model.renderer
177+ components: model.components
178+ viewWidth: parent.width
179+ }
180+
138181 source: {
139182 if (index == 0) return "ScopesOverviewFavourites.qml";
140183 else if (index == 1) return "ScopesOverviewAll.qml";
@@ -143,6 +186,17 @@ Item {
143186 return "";
144187 }
145188 }
189+
190+ onLoaded: {
191+ item.model = Qt.binding(function() { return results })
192+ item.cardTool = cardTool;
193+ if (index == 0) {
194+ item.scopeWidth = root.width;
195+ item.scopeHeight = root.height;
196+ } else if (index == 1) {
197+ item.extraHeight = bottomBar.height;
198+ }
199+ }
146200 }
147201 }
148202
@@ -151,6 +205,7 @@ Item {
151205 color: "black"
152206 height: units.gu(6)
153207 width: parent.width
208+ opacity: 0.4
154209 y: {
155210 if (root.progress < 0.5) {
156211 return parent.height;
@@ -180,7 +235,10 @@ Item {
180235 text: i18n.tr("Done")
181236 color: parent.pressed ? "black" : "white"
182237 }
183− onClicked: root.done()
238+ onClicked: {
239+ root.done();
240+ tabBarHolder.currentTab = 0;
241+ }
184242 }
185243 }
186244}
tests/mocks/Unity/fake_scopes.cpp+7−1
@@ -27,6 +27,7 @@
2727
2828Scopes::Scopes(QObject *parent)
2929 : unity::shell::scopes::ScopesInterface(parent)
30+ , m_scopesOverview(nullptr)
3031 , m_loaded(false)
3132 , timer(this)
3233{
@@ -47,7 +48,10 @@ void Scopes::updateScopes()
4748 addScope(new Scope("MockScope2", "Music", false, this));
4849 addScope(new Scope("clickscope", "Apps", true, this));
4950 addScope(new Scope("MockScope5", "Videos", true, this));
50− addScope(new ScopesOverview(this));
51+ addScope(new Scope("MockScope3", "MS3", false, this));
52+ addScope(new Scope("MockScope4", "MS4", false, this));
53+ addScope(new Scope("MockScope6", "MS6", false, this));
54+ m_scopesOverview = new ScopesOverview(this);
5155
5256 if (!m_loaded) {
5357 m_loaded = true;
@@ -64,6 +68,7 @@ void Scopes::clear()
6468 m_scopes.clear();
6569 endRemoveRows();
6670 }
71+ delete m_scopesOverview;
6772
6873 if (m_loaded) {
6974 m_loaded = false;
@@ -113,6 +118,7 @@ unity::shell::scopes::ScopeInterface* Scopes::getScope(int row) const
113118
114119unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const
115120{
121+ if (scope_id == "scopesOverview") return m_scopesOverview;
116122 for (Scope *scope : m_scopes) {
117123 if (scope->id() == scope_id)
118124 return scope;
tests/mocks/Unity/fake_scopes.h+1
@@ -59,6 +59,7 @@ private Q_SLOTS:
5959
6060private:
6161 QList<Scope*> m_scopes;
62+ Scope *m_scopesOverview;
6263 bool m_loaded;
6364 QTimer timer;
6465};
tests/mocks/Unity/fake_scopesoverview.cpp+2−2
@@ -75,14 +75,14 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
7575 {
7676 QVariantMap map;
7777 map["category-layout"] = "grid";
78− map["card-size"] = "medium";
78+ map["card-size"] = "small";
7979 map["overlay"] = true;
8080 return map;
8181 }
8282 case RoleComponents:
8383 {
8484 QVariantMap map, artMap;
85− artMap["aspect-ratio"] = "1.0";
85+ artMap["aspect-ratio"] = "0.5";
8686 artMap["field"] = "art";
8787 map["art"] = artMap;
8888 map["title"] = "HOLA";