Merge lp:~alecu/unity-scope-click/super-stilish-scopes into lp:unity-scope-click/devel

Proposed by Alejandro J. Cura
Status: Merged
Approved by: dobey
Approved revision: 418
Merged at revision: 420
Proposed branch: lp:~alecu/unity-scope-click/super-stilish-scopes
Merge into: lp:unity-scope-click/devel
Diff against target: 142 lines (+41/-4)
4 files modified
libclickscope/click/highlights.cpp (+9/-3)
libclickscope/click/highlights.h (+3/-1)
libclickscope/tests/test_bootstrap.cpp (+5/-0)
scope/clickstore/store-query.cpp (+24/-0)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/super-stilish-scopes
Reviewer Review Type Date Requested Status
dobey (community) Approve
Diego Sarmentero (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+231810@code.launchpad.net

Commit message

Change the renderer for categories with just scopes

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
dobey (dobey) wrote :

Some of the scope icons don't look so great, but that seems to be a result of scaling/cropping in unity8 rather than an issue in this branch.

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Here's how it looks when looking at the "Developer Tools" department in staging: http://pasteboard.co/2tNPTLdY.png

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libclickscope/click/highlights.cpp'
2--- libclickscope/click/highlights.cpp 2014-08-05 19:00:03 +0000
3+++ libclickscope/click/highlights.cpp 2014-08-21 21:18:09 +0000
4@@ -39,10 +39,11 @@
5 {
6 }
7
8-Highlight::Highlight(const std::string& slug, const std::string& name, const Packages& pkgs)
9+Highlight::Highlight(const std::string& slug, const std::string& name, const Packages& pkgs, bool contains_scopes)
10 : slug_(slug),
11 name_(name),
12- packages_(pkgs)
13+ packages_(pkgs),
14+ contains_scopes_(contains_scopes)
15 {
16 }
17
18@@ -51,6 +52,11 @@
19 packages_.push_back(pkg);
20 }
21
22+bool Highlight::contains_scopes() const
23+{
24+ return contains_scopes_;
25+}
26+
27 std::string Highlight::slug() const
28 {
29 return slug_;
30@@ -116,7 +122,7 @@
31 highlights.push_back(Highlight("__all-apps__", _("Apps"), apps));
32 }
33 if (scopes.size() > 0) {
34- highlights.push_back(Highlight("__all-scopes__", _("Scopes"), scopes));
35+ highlights.push_back(Highlight("__all-scopes__", _("Scopes"), scopes, true));
36 }
37 }
38 }
39
40=== modified file 'libclickscope/click/highlights.h'
41--- libclickscope/click/highlights.h 2014-07-10 10:11:04 +0000
42+++ libclickscope/click/highlights.h 2014-08-21 21:18:09 +0000
43@@ -51,12 +51,13 @@
44 };
45
46 Highlight(const std::string& name);
47- Highlight(const std::string& slug, const std::string& name, const Packages& pkgs);
48+ Highlight(const std::string& slug, const std::string& name, const Packages& pkgs, bool contains_scopes=false);
49 void add_package(const Package& pkg);
50
51 std::string name() const;
52 std::string slug() const;
53 Packages packages() const;
54+ bool contains_scopes() const;
55
56 static std::list<Highlight> from_json_root_node(const Json::Value& val);
57
58@@ -66,6 +67,7 @@
59 std::string slug_;
60 std::string name_;
61 Packages packages_;
62+ bool contains_scopes_;
63 };
64
65 typedef std::list<Highlight> HighlightList;
66
67=== modified file 'libclickscope/tests/test_bootstrap.cpp'
68--- libclickscope/tests/test_bootstrap.cpp 2014-08-05 19:00:03 +0000
69+++ libclickscope/tests/test_bootstrap.cpp 2014-08-21 21:18:09 +0000
70@@ -184,18 +184,23 @@
71 auto it = highlights.begin();
72 EXPECT_EQ("Top Apps", it->name());
73 EXPECT_EQ(2u, it->packages().size());
74+ EXPECT_EQ(false, it->contains_scopes());
75 ++it;
76 EXPECT_EQ("Most Purchased", it->name());
77 EXPECT_EQ(2u, it->packages().size());
78+ EXPECT_EQ(false, it->contains_scopes());
79 ++it;
80 EXPECT_EQ("New Releases", it->name());
81 EXPECT_EQ(2u, it->packages().size());
82+ EXPECT_EQ(false, it->contains_scopes());
83 ++it;
84 EXPECT_EQ("Apps", it->name());
85 EXPECT_EQ(2u, it->packages().size());
86+ EXPECT_EQ(false, it->contains_scopes());
87 ++it;
88 EXPECT_EQ("Scopes", it->name());
89 EXPECT_EQ(2u, it->packages().size());
90+ EXPECT_EQ(true, it->contains_scopes());
91 }
92
93 }
94
95=== modified file 'scope/clickstore/store-query.cpp'
96--- scope/clickstore/store-query.cpp 2014-08-20 16:56:36 +0000
97+++ scope/clickstore/store-query.cpp 2014-08-21 21:18:09 +0000
98@@ -77,6 +77,25 @@
99 }
100 )";
101
102+static const std::string CATEGORY_SCOPES_DISPLAY = R"(
103+ {
104+ "schema-version" : 1,
105+ "template" : {
106+ "overlay": true,
107+ "category-layout" : "grid",
108+ "card-size": "small"
109+ },
110+ "components" : {
111+ "title" : "title",
112+ "subtitle": "subtitle",
113+ "art" : {
114+ "field": "art",
115+ "aspect-ratio": 0.55
116+ }
117+ }
118+ }
119+)";
120+
121 static const std::string CATEGORY_APP_OF_THE_WEEK = R"(
122 {
123 "schema-version" : 1,
124@@ -322,6 +341,7 @@
125 void click::Query::push_highlights(const scopes::SearchReplyProxy& searchReply, const HighlightList& highlights, const PackageSet &locallyInstalledApps)
126 {
127 const scopes::CategoryRenderer renderer(CATEGORY_APPS_DISPLAY);
128+ const scopes::CategoryRenderer scopes_renderer(CATEGORY_SCOPES_DISPLAY);
129 const scopes::CategoryRenderer aotw_renderer(CATEGORY_APP_OF_THE_WEEK);
130
131 for (auto const& hl: highlights)
132@@ -331,6 +351,10 @@
133 {
134 rdr = &aotw_renderer;
135 }
136+ if (hl.contains_scopes())
137+ {
138+ rdr = &scopes_renderer;
139+ }
140 auto category = register_category(searchReply, hl.slug(), hl.name(), "", *rdr);
141 for (auto const& pkg: hl.packages())
142 {

Subscribers

People subscribed via source and target branches

to all changes: