Merge lp:~hikiko/unity/unity.scale-application-components into lp:unity
- unity.scale-application-components
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3834 |
Proposed branch: | lp:~hikiko/unity/unity.scale-application-components |
Merge into: | lp:unity |
Prerequisite: | lp:~hikiko/unity/unity.preview-container-components |
Diff against target: |
455 lines (+162/-51) 6 files modified
dash/previews/ApplicationPreview.cpp (+106/-41) dash/previews/ApplicationPreview.h (+8/-0) dash/previews/PreviewRatingsWidget.cpp (+37/-6) dash/previews/PreviewRatingsWidget.h (+6/-0) unity-shared/RatingsButton.cpp (+2/-2) unity-shared/RatingsButton.h (+3/-2) |
To merge this branch: | bzr merge lp:~hikiko/unity/unity.scale-application-components |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Unity Team | Pending | ||
Review via email:
|
Commit message
Scaled the ApplicationPreview and the containing widgets and components.
Description of the change
Scaled the ApplicationPreview and the containing widgets and components.
![](/+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:3827
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: 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:3828
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3829
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Marco Trevisan (Treviño) (3v1n0) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Marco Trevisan (Treviño) (3v1n0) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Eleni Maria Stea (hikiko) wrote : | # |
fixed the PreLayoutManagement
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3830
http://
Executed test runs:
SUCCESS: http://
SUCCESS: 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 : | # |
PASSED: Continuous integration, rev:3832
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ok, problematic code has been fixed here.
Preview Diff
1 | === modified file 'dash/previews/ApplicationPreview.cpp' | |||
2 | --- dash/previews/ApplicationPreview.cpp 2014-06-17 18:22:57 +0000 | |||
3 | +++ dash/previews/ApplicationPreview.cpp 2014-06-17 18:22:57 +0000 | |||
4 | @@ -46,6 +46,16 @@ | |||
5 | 46 | { | 46 | { |
6 | 47 | namespace previews | 47 | namespace previews |
7 | 48 | { | 48 | { |
8 | 49 | |||
9 | 50 | namespace | ||
10 | 51 | { | ||
11 | 52 | const RawPixel ICON_SPACE_CHILDREN = 3_em; | ||
12 | 53 | const RawPixel DATA_SPACE_CHILDREN = 16_em; | ||
13 | 54 | const RawPixel INFO_SPACE_CHILDREN = 12_em; | ||
14 | 55 | const RawPixel COPYRIGHT_SPACE_CHILDREN = 8_em; | ||
15 | 56 | const RawPixel ICON_SIZE = 72_em; | ||
16 | 57 | } | ||
17 | 58 | |||
18 | 49 | DECLARE_LOGGER(logger, "unity.dash.preview.application"); | 59 | DECLARE_LOGGER(logger, "unity.dash.preview.application"); |
19 | 50 | 60 | ||
20 | 51 | class DetailsScrollView : public nux::ScrollView | 61 | class DetailsScrollView : public nux::ScrollView |
21 | @@ -121,8 +131,8 @@ | |||
22 | 121 | 131 | ||
23 | 122 | auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_->OnMouseDown(x, y, button_flags, key_flags); }; | 132 | auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_->OnMouseDown(x, y, button_flags, key_flags); }; |
24 | 123 | 133 | ||
27 | 124 | nux::HLayout* image_data_layout = new nux::HLayout(); | 134 | image_data_layout_ = new nux::HLayout(); |
28 | 125 | image_data_layout->SetSpaceBetweenChildren(style.GetPanelSplitWidth()); | 135 | image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale)); |
29 | 126 | 136 | ||
30 | 127 | ///////////////////// | 137 | ///////////////////// |
31 | 128 | // Image | 138 | // Image |
32 | @@ -134,34 +144,34 @@ | |||
33 | 134 | ///////////////////// | 144 | ///////////////////// |
34 | 135 | // App Data Panel | 145 | // App Data Panel |
35 | 136 | full_data_layout_ = new nux::VLayout(); | 146 | full_data_layout_ = new nux::VLayout(); |
38 | 137 | full_data_layout_->SetPadding(style.GetDetailsTopMargin(), 0, style.GetDetailsBottomMargin(), style.GetDetailsLeftMargin()); | 147 | full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale)); |
39 | 138 | full_data_layout_->SetSpaceBetweenChildren(16); | 148 | full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN); |
40 | 139 | 149 | ||
41 | 140 | ///////////////////// | 150 | ///////////////////// |
42 | 141 | // Main App Info | 151 | // Main App Info |
45 | 142 | nux::HLayout* main_app_info = new nux::HLayout(); | 152 | main_app_info_ = new nux::HLayout(); |
46 | 143 | main_app_info->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails()); | 153 | main_app_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale)); |
47 | 144 | 154 | ||
48 | 145 | ///////////////////// | 155 | ///////////////////// |
49 | 146 | // Icon Layout | 156 | // Icon Layout |
53 | 147 | nux::VLayout* icon_layout = new nux::VLayout(); | 157 | icon_layout_ = new nux::VLayout(); |
54 | 148 | icon_layout->SetSpaceBetweenChildren(3); | 158 | icon_layout_->SetSpaceBetweenChildren(ICON_SPACE_CHILDREN.CP(scale)); |
55 | 149 | app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", 72); | 159 | app_icon_ = new IconTexture(app_preview_model->app_icon.Get().RawPtr() ? g_icon_to_string(app_preview_model->app_icon.Get().RawPtr()) : "", ICON_SIZE.CP(scale)); |
56 | 150 | AddChild(app_icon_.GetPointer()); | 160 | AddChild(app_icon_.GetPointer()); |
59 | 151 | app_icon_->SetMinimumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth()); | 161 | app_icon_->SetMinimumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale)); |
60 | 152 | app_icon_->SetMaximumSize(style.GetAppIconAreaWidth(), style.GetAppIconAreaWidth()); | 162 | app_icon_->SetMaximumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale)); |
61 | 153 | app_icon_->mouse_click.connect(on_mouse_down); | 163 | app_icon_->mouse_click.connect(on_mouse_down); |
63 | 154 | icon_layout->AddView(app_icon_.GetPointer(), 0); | 164 | icon_layout_->AddView(app_icon_.GetPointer(), 0); |
64 | 155 | 165 | ||
65 | 156 | if (app_preview_model->rating >= 0) { | 166 | if (app_preview_model->rating >= 0) { |
66 | 157 | app_rating_ = new PreviewRatingsWidget(); | 167 | app_rating_ = new PreviewRatingsWidget(); |
67 | 158 | AddChild(app_rating_.GetPointer()); | 168 | AddChild(app_rating_.GetPointer()); |
70 | 159 | app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight()); | 169 | app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale)); |
71 | 160 | app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight()); | 170 | app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale)); |
72 | 161 | app_rating_->SetRating(app_preview_model->rating); | 171 | app_rating_->SetRating(app_preview_model->rating); |
73 | 162 | app_rating_->SetReviews(app_preview_model->num_ratings); | 172 | app_rating_->SetReviews(app_preview_model->num_ratings); |
74 | 163 | app_rating_->request_close().connect([this]() { preview_container_->request_close.emit(); }); | 173 | app_rating_->request_close().connect([this]() { preview_container_->request_close.emit(); }); |
76 | 164 | icon_layout->AddView(app_rating_.GetPointer(), 0); | 174 | icon_layout_->AddView(app_rating_.GetPointer(), 0); |
77 | 165 | } | 175 | } |
78 | 166 | 176 | ||
79 | 167 | ///////////////////// | 177 | ///////////////////// |
80 | @@ -169,11 +179,11 @@ | |||
81 | 169 | ///////////////////// | 179 | ///////////////////// |
82 | 170 | // Data | 180 | // Data |
83 | 171 | 181 | ||
86 | 172 | nux::VLayout* app_data_layout = new nux::VLayout(); | 182 | app_data_layout_ = new nux::VLayout(); |
87 | 173 | app_data_layout->SetSpaceBetweenChildren(16); | 183 | app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale)); |
88 | 174 | 184 | ||
89 | 175 | title_subtitle_layout_ = new nux::VLayout(); | 185 | title_subtitle_layout_ = new nux::VLayout(); |
91 | 176 | title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle()); | 186 | title_subtitle_layout_->SetSpaceBetweenChildren(style.GetSpaceBetweenTitleAndSubtitle().CP(scale)); |
92 | 177 | 187 | ||
93 | 178 | title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION); | 188 | title_ = new StaticCairoText(preview_model_->title, true, NUX_TRACKER_LOCATION); |
94 | 179 | AddChild(title_.GetPointer()); | 189 | AddChild(title_.GetPointer()); |
95 | @@ -192,8 +202,8 @@ | |||
96 | 192 | title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1); | 202 | title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1); |
97 | 193 | } | 203 | } |
98 | 194 | 204 | ||
101 | 195 | nux::VLayout* app_updated_copywrite_layout = new nux::VLayout(); | 205 | app_updated_copywrite_layout_ = new nux::VLayout(); |
102 | 196 | app_updated_copywrite_layout->SetSpaceBetweenChildren(8); | 206 | app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale)); |
103 | 197 | 207 | ||
104 | 198 | if (!app_preview_model->license.Get().empty()) | 208 | if (!app_preview_model->license.Get().empty()) |
105 | 199 | { | 209 | { |
106 | @@ -202,7 +212,7 @@ | |||
107 | 202 | license_->SetFont(style.app_license_font().c_str()); | 212 | license_->SetFont(style.app_license_font().c_str()); |
108 | 203 | license_->SetLines(-1); | 213 | license_->SetLines(-1); |
109 | 204 | license_->mouse_click.connect(on_mouse_down); | 214 | license_->mouse_click.connect(on_mouse_down); |
111 | 205 | app_updated_copywrite_layout->AddView(license_.GetPointer(), 1); | 215 | app_updated_copywrite_layout_->AddView(license_.GetPointer(), 1); |
112 | 206 | } | 216 | } |
113 | 207 | 217 | ||
114 | 208 | if (!app_preview_model->last_update.Get().empty()) | 218 | if (!app_preview_model->last_update.Get().empty()) |
115 | @@ -214,7 +224,7 @@ | |||
116 | 214 | AddChild(last_update_.GetPointer()); | 224 | AddChild(last_update_.GetPointer()); |
117 | 215 | last_update_->SetFont(style.app_last_update_font().c_str()); | 225 | last_update_->SetFont(style.app_last_update_font().c_str()); |
118 | 216 | last_update_->mouse_click.connect(on_mouse_down); | 226 | last_update_->mouse_click.connect(on_mouse_down); |
120 | 217 | app_updated_copywrite_layout->AddView(last_update_.GetPointer(), 1); | 227 | app_updated_copywrite_layout_->AddView(last_update_.GetPointer(), 1); |
121 | 218 | } | 228 | } |
122 | 219 | 229 | ||
123 | 220 | if (!app_preview_model->copyright.Get().empty()) | 230 | if (!app_preview_model->copyright.Get().empty()) |
124 | @@ -224,17 +234,17 @@ | |||
125 | 224 | copywrite_->SetFont(style.app_copywrite_font().c_str()); | 234 | copywrite_->SetFont(style.app_copywrite_font().c_str()); |
126 | 225 | copywrite_->SetLines(-1); | 235 | copywrite_->SetLines(-1); |
127 | 226 | copywrite_->mouse_click.connect(on_mouse_down); | 236 | copywrite_->mouse_click.connect(on_mouse_down); |
129 | 227 | app_updated_copywrite_layout->AddView(copywrite_.GetPointer(), 1); | 237 | app_updated_copywrite_layout_->AddView(copywrite_.GetPointer(), 1); |
130 | 228 | } | 238 | } |
131 | 229 | 239 | ||
134 | 230 | app_data_layout->AddLayout(title_subtitle_layout_); | 240 | app_data_layout_->AddLayout(title_subtitle_layout_); |
135 | 231 | app_data_layout->AddLayout(app_updated_copywrite_layout); | 241 | app_data_layout_->AddLayout(app_updated_copywrite_layout_); |
136 | 232 | 242 | ||
137 | 233 | // buffer space | 243 | // buffer space |
138 | 234 | ///////////////////// | 244 | ///////////////////// |
139 | 235 | 245 | ||
142 | 236 | main_app_info->AddLayout(icon_layout, 0); | 246 | main_app_info_->AddLayout(icon_layout_, 0); |
143 | 237 | main_app_info->AddLayout(app_data_layout, 1); | 247 | main_app_info_->AddLayout(app_data_layout_, 1); |
144 | 238 | ///////////////////// | 248 | ///////////////////// |
145 | 239 | 249 | ||
146 | 240 | ///////////////////// | 250 | ///////////////////// |
147 | @@ -243,9 +253,9 @@ | |||
148 | 243 | app_info->EnableHorizontalScrollBar(false); | 253 | app_info->EnableHorizontalScrollBar(false); |
149 | 244 | app_info->mouse_click.connect(on_mouse_down); | 254 | app_info->mouse_click.connect(on_mouse_down); |
150 | 245 | 255 | ||
154 | 246 | nux::VLayout* app_info_layout = new nux::VLayout(); | 256 | app_info_layout_ = new nux::VLayout(); |
155 | 247 | app_info_layout->SetSpaceBetweenChildren(12); | 257 | app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN); |
156 | 248 | app_info->SetLayout(app_info_layout); | 258 | app_info->SetLayout(app_info_layout_); |
157 | 249 | 259 | ||
158 | 250 | if (!preview_model_->description.Get().empty()) | 260 | if (!preview_model_->description.Get().empty()) |
159 | 251 | { | 261 | { |
160 | @@ -256,7 +266,7 @@ | |||
161 | 256 | description_->SetLines(-style.GetDescriptionLineCount()); | 266 | description_->SetLines(-style.GetDescriptionLineCount()); |
162 | 257 | description_->SetLineSpacing(style.GetDescriptionLineSpacing()); | 267 | description_->SetLineSpacing(style.GetDescriptionLineSpacing()); |
163 | 258 | description_->mouse_click.connect(on_mouse_down); | 268 | description_->mouse_click.connect(on_mouse_down); |
165 | 259 | app_info_layout->AddView(description_.GetPointer()); | 269 | app_info_layout_->AddView(description_.GetPointer()); |
166 | 260 | } | 270 | } |
167 | 261 | 271 | ||
168 | 262 | if (!preview_model_->GetInfoHints().empty()) | 272 | if (!preview_model_->GetInfoHints().empty()) |
169 | @@ -264,7 +274,7 @@ | |||
170 | 264 | preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth()); | 274 | preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth()); |
171 | 265 | AddChild(preview_info_hints_.GetPointer()); | 275 | AddChild(preview_info_hints_.GetPointer()); |
172 | 266 | preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); }); | 276 | preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); }); |
174 | 267 | app_info_layout->AddView(preview_info_hints_.GetPointer()); | 277 | app_info_layout_->AddView(preview_info_hints_.GetPointer()); |
175 | 268 | } | 278 | } |
176 | 269 | ///////////////////// | 279 | ///////////////////// |
177 | 270 | 280 | ||
178 | @@ -275,17 +285,17 @@ | |||
179 | 275 | actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin()); | 285 | actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin()); |
180 | 276 | /////////////////// | 286 | /////////////////// |
181 | 277 | 287 | ||
183 | 278 | full_data_layout_->AddLayout(main_app_info, 0); | 288 | full_data_layout_->AddLayout(main_app_info_, 0); |
184 | 279 | full_data_layout_->AddView(app_info, 1); | 289 | full_data_layout_->AddView(app_info, 1); |
185 | 280 | full_data_layout_->AddLayout(actions_layout, 0); | 290 | full_data_layout_->AddLayout(actions_layout, 0); |
186 | 281 | ///////////////////// | 291 | ///////////////////// |
187 | 282 | 292 | ||
190 | 283 | image_data_layout->AddView(image_.GetPointer(), 0); | 293 | image_data_layout_->AddView(image_.GetPointer(), 0); |
191 | 284 | image_data_layout->AddLayout(full_data_layout_, 1); | 294 | image_data_layout_->AddLayout(full_data_layout_, 1); |
192 | 285 | 295 | ||
193 | 286 | mouse_click.connect(on_mouse_down); | 296 | mouse_click.connect(on_mouse_down); |
194 | 287 | 297 | ||
196 | 288 | SetLayout(image_data_layout); | 298 | SetLayout(image_data_layout_); |
197 | 289 | } | 299 | } |
198 | 290 | 300 | ||
199 | 291 | void ApplicationPreview::PreLayoutManagement() | 301 | void ApplicationPreview::PreLayoutManagement() |
200 | @@ -296,12 +306,14 @@ | |||
201 | 296 | 306 | ||
202 | 297 | nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height); | 307 | nux::Geometry geo_art(geo.x, geo.y, style.GetAppImageAspectRatio() * geo.height, geo.height); |
203 | 298 | 308 | ||
206 | 299 | if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth()) | 309 | int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale); |
207 | 300 | geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth()); | 310 | if (content_width - geo_art.width < style.GetDetailsPanelMinimumWidth().CP(scale)) |
208 | 311 | geo_art.width = std::max(0, content_width - style.GetDetailsPanelMinimumWidth().CP(scale)); | ||
209 | 312 | |||
210 | 301 | image_->SetMinMaxSize(geo_art.width, geo_art.height); | 313 | image_->SetMinMaxSize(geo_art.width, geo_art.height); |
211 | 302 | 314 | ||
214 | 303 | int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); | 315 | int details_width = std::max(0, content_width - geo_art.width); |
215 | 304 | int top_app_info_max_width = MAX(0, details_width - style.GetAppIconAreaWidth() - style.GetSpaceBetweenIconAndDetails()); | 316 | int top_app_info_max_width = std::max(0, details_width - style.GetAppIconAreaWidth().CP(scale) - style.GetSpaceBetweenIconAndDetails().CP(scale)); |
216 | 305 | 317 | ||
217 | 306 | if (title_) { title_->SetMaximumWidth(top_app_info_max_width); } | 318 | if (title_) { title_->SetMaximumWidth(top_app_info_max_width); } |
218 | 307 | if (subtitle_) { subtitle_->SetMaximumWidth(top_app_info_max_width); } | 319 | if (subtitle_) { subtitle_->SetMaximumWidth(top_app_info_max_width); } |
219 | @@ -312,12 +324,65 @@ | |||
220 | 312 | 324 | ||
221 | 313 | for (nux::AbstractButton* button : action_buttons_) | 325 | for (nux::AbstractButton* button : action_buttons_) |
222 | 314 | { | 326 | { |
224 | 315 | button->SetMinMaxSize(CLAMP(RawPixel((details_width - style.GetSpaceBetweenActions()) / 2), 0_em, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); | 327 | button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions().CP(scale)) / 2, 0, style.GetActionButtonMaximumWidth().CP(scale)), style.GetActionButtonHeight().CP(scale)); |
225 | 316 | } | 328 | } |
226 | 317 | 329 | ||
227 | 318 | Preview::PreLayoutManagement(); | 330 | Preview::PreLayoutManagement(); |
228 | 319 | } | 331 | } |
229 | 320 | 332 | ||
230 | 333 | void ApplicationPreview::UpdateScale(double scale) | ||
231 | 334 | { | ||
232 | 335 | previews::Style& style = dash::previews::Style::Instance(); | ||
233 | 336 | |||
234 | 337 | if (app_icon_) | ||
235 | 338 | { | ||
236 | 339 | app_icon_->SetSize(ICON_SIZE.CP(scale)); | ||
237 | 340 | app_icon_->SetMinimumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale)); | ||
238 | 341 | app_icon_->SetMaximumSize(style.GetAppIconAreaWidth().CP(scale), style.GetAppIconAreaWidth().CP(scale)); | ||
239 | 342 | app_icon_->ReLoadIcon(); | ||
240 | 343 | } | ||
241 | 344 | |||
242 | 345 | if (license_) | ||
243 | 346 | license_->SetScale(scale); | ||
244 | 347 | if (last_update_) | ||
245 | 348 | last_update_->SetScale(scale); | ||
246 | 349 | if (copywrite_) | ||
247 | 350 | copywrite_->SetScale(scale); | ||
248 | 351 | |||
249 | 352 | if (app_rating_) | ||
250 | 353 | { | ||
251 | 354 | app_rating_->scale = scale; | ||
252 | 355 | app_rating_->SetMaximumHeight(style.GetRatingWidgetHeight().CP(scale)); | ||
253 | 356 | app_rating_->SetMinimumHeight(style.GetRatingWidgetHeight().CP(scale)); | ||
254 | 357 | } | ||
255 | 358 | |||
256 | 359 | if (image_data_layout_) | ||
257 | 360 | image_data_layout_->SetSpaceBetweenChildren(style.GetPanelSplitWidth().CP(scale)); | ||
258 | 361 | |||
259 | 362 | if (full_data_layout_) | ||
260 | 363 | { | ||
261 | 364 | full_data_layout_->SetPadding(style.GetDetailsTopMargin().CP(scale), 0, style.GetDetailsBottomMargin().CP(scale), style.GetDetailsLeftMargin().CP(scale)); | ||
262 | 365 | full_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale)); | ||
263 | 366 | } | ||
264 | 367 | |||
265 | 368 | if (main_app_info_) | ||
266 | 369 | main_app_info_->SetSpaceBetweenChildren(style.GetSpaceBetweenIconAndDetails().CP(scale)); | ||
267 | 370 | |||
268 | 371 | if (icon_layout_) | ||
269 | 372 | icon_layout_->SetSpaceBetweenChildren(ICON_SPACE_CHILDREN.CP(scale)); | ||
270 | 373 | |||
271 | 374 | if (app_data_layout_) | ||
272 | 375 | app_data_layout_->SetSpaceBetweenChildren(DATA_SPACE_CHILDREN.CP(scale)); | ||
273 | 376 | |||
274 | 377 | if (app_info_layout_) | ||
275 | 378 | app_info_layout_->SetSpaceBetweenChildren(INFO_SPACE_CHILDREN.CP(scale)); | ||
276 | 379 | |||
277 | 380 | if (app_updated_copywrite_layout_) | ||
278 | 381 | app_updated_copywrite_layout_->SetSpaceBetweenChildren(COPYRIGHT_SPACE_CHILDREN.CP(scale)); | ||
279 | 382 | |||
280 | 383 | Preview::UpdateScale(scale); | ||
281 | 384 | } | ||
282 | 385 | |||
283 | 321 | } // namespace previews | 386 | } // namespace previews |
284 | 322 | } // namespace dash | 387 | } // namespace dash |
285 | 323 | } // namepsace unity | 388 | } // namepsace unity |
286 | 324 | 389 | ||
287 | === modified file 'dash/previews/ApplicationPreview.h' | |||
288 | --- dash/previews/ApplicationPreview.h 2013-09-19 16:44:03 +0000 | |||
289 | +++ dash/previews/ApplicationPreview.h 2014-06-17 18:22:57 +0000 | |||
290 | @@ -54,9 +54,17 @@ | |||
291 | 54 | virtual void PreLayoutManagement(); | 54 | virtual void PreLayoutManagement(); |
292 | 55 | 55 | ||
293 | 56 | virtual void SetupViews(); | 56 | virtual void SetupViews(); |
294 | 57 | void UpdateScale(double scale) override; | ||
295 | 57 | 58 | ||
296 | 58 | protected: | 59 | protected: |
297 | 59 | nux::VLayout* title_subtitle_layout_; | 60 | nux::VLayout* title_subtitle_layout_; |
298 | 61 | nux::HLayout* image_data_layout_; | ||
299 | 62 | nux::HLayout* main_app_info_; | ||
300 | 63 | nux::VLayout* icon_layout_; | ||
301 | 64 | nux::VLayout* app_data_layout_; | ||
302 | 65 | nux::VLayout* app_updated_copywrite_layout_; | ||
303 | 66 | nux::VLayout* app_info_layout_; | ||
304 | 67 | nux::Layout* actions_layout_; | ||
305 | 60 | 68 | ||
306 | 61 | nux::ObjectPtr<IconTexture> app_icon_; | 69 | nux::ObjectPtr<IconTexture> app_icon_; |
307 | 62 | nux::ObjectPtr<PreviewRatingsWidget> app_rating_; | 70 | nux::ObjectPtr<PreviewRatingsWidget> app_rating_; |
308 | 63 | 71 | ||
309 | === modified file 'dash/previews/PreviewRatingsWidget.cpp' | |||
310 | --- dash/previews/PreviewRatingsWidget.cpp 2013-11-19 18:48:35 +0000 | |||
311 | +++ dash/previews/PreviewRatingsWidget.cpp 2014-06-17 18:22:57 +0000 | |||
312 | @@ -38,31 +38,42 @@ | |||
313 | 38 | namespace previews | 38 | namespace previews |
314 | 39 | { | 39 | { |
315 | 40 | 40 | ||
316 | 41 | namespace | ||
317 | 42 | { | ||
318 | 43 | const RawPixel CHILDREN_SPACE = 3_em; | ||
319 | 44 | const RawPixel RATINGS_SIZE = 18_em; | ||
320 | 45 | const RawPixel RATINGS_GAP = 2_em; | ||
321 | 46 | } | ||
322 | 47 | |||
323 | 41 | NUX_IMPLEMENT_OBJECT_TYPE(PreviewRatingsWidget); | 48 | NUX_IMPLEMENT_OBJECT_TYPE(PreviewRatingsWidget); |
324 | 42 | 49 | ||
325 | 43 | PreviewRatingsWidget::PreviewRatingsWidget(NUX_FILE_LINE_DECL) | 50 | PreviewRatingsWidget::PreviewRatingsWidget(NUX_FILE_LINE_DECL) |
326 | 44 | : View(NUX_FILE_LINE_PARAM) | 51 | : View(NUX_FILE_LINE_PARAM) |
327 | 52 | , scale(1.0) | ||
328 | 45 | { | 53 | { |
331 | 46 | nux::VLayout* layout = new nux::VLayout(); | 54 | layout_ = new nux::VLayout(); |
332 | 47 | layout->SetSpaceBetweenChildren(3); | 55 | layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale)); |
333 | 48 | 56 | ||
334 | 49 | previews::Style& style = previews::Style::Instance(); | 57 | previews::Style& style = previews::Style::Instance(); |
335 | 50 | 58 | ||
336 | 51 | auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_.OnMouseDown(x, y, button_flags, key_flags); }; | 59 | auto on_mouse_down = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { this->preview_container_.OnMouseDown(x, y, button_flags, key_flags); }; |
337 | 52 | 60 | ||
339 | 53 | ratings_ = new RatingsButton(18,2); | 61 | ratings_ = new RatingsButton(RATINGS_SIZE.CP(scale), RATINGS_GAP.CP(scale)); |
340 | 54 | ratings_->SetEditable(false); | 62 | ratings_->SetEditable(false); |
341 | 55 | ratings_->mouse_click.connect(on_mouse_down); | 63 | ratings_->mouse_click.connect(on_mouse_down); |
343 | 56 | layout->AddView(ratings_); | 64 | layout_->AddView(ratings_); |
344 | 57 | 65 | ||
345 | 58 | reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION); | 66 | reviews_ = new StaticCairoText("", NUX_TRACKER_LOCATION); |
346 | 59 | reviews_->SetFont(style.user_rating_font()); | 67 | reviews_->SetFont(style.user_rating_font()); |
347 | 68 | reviews_->SetScale(scale); | ||
348 | 60 | reviews_->mouse_click.connect(on_mouse_down); | 69 | reviews_->mouse_click.connect(on_mouse_down); |
350 | 61 | layout->AddView(reviews_); | 70 | layout_->AddView(reviews_); |
351 | 62 | 71 | ||
352 | 63 | mouse_click.connect(on_mouse_down); | 72 | mouse_click.connect(on_mouse_down); |
353 | 64 | 73 | ||
355 | 65 | SetLayout(layout); | 74 | SetLayout(layout_); |
356 | 75 | |||
357 | 76 | scale.changed.connect(sigc::mem_fun(this, &PreviewRatingsWidget::UpdateScale)); | ||
358 | 66 | } | 77 | } |
359 | 67 | 78 | ||
360 | 68 | PreviewRatingsWidget::~PreviewRatingsWidget() | 79 | PreviewRatingsWidget::~PreviewRatingsWidget() |
361 | @@ -114,6 +125,26 @@ | |||
362 | 114 | .add(GetAbsoluteGeometry()); | 125 | .add(GetAbsoluteGeometry()); |
363 | 115 | } | 126 | } |
364 | 116 | 127 | ||
365 | 128 | void PreviewRatingsWidget::UpdateScale(double scale) | ||
366 | 129 | { | ||
367 | 130 | if (reviews_) | ||
368 | 131 | reviews_->SetScale(scale); | ||
369 | 132 | |||
370 | 133 | if (ratings_) | ||
371 | 134 | { | ||
372 | 135 | ratings_->star_gap_ = RATINGS_SIZE.CP(scale); | ||
373 | 136 | ratings_->star_gap_ = RATINGS_GAP.CP(scale); | ||
374 | 137 | } | ||
375 | 138 | |||
376 | 139 | preview_container_.scale = scale; | ||
377 | 140 | |||
378 | 141 | if (layout_) | ||
379 | 142 | layout_->SetSpaceBetweenChildren(CHILDREN_SPACE.CP(scale)); | ||
380 | 143 | |||
381 | 144 | QueueRelayout(); | ||
382 | 145 | QueueDraw(); | ||
383 | 146 | } | ||
384 | 147 | |||
385 | 117 | } // namespace previews | 148 | } // namespace previews |
386 | 118 | } // namespace dash | 149 | } // namespace dash |
387 | 119 | } // namespace unity | 150 | } // namespace unity |
388 | 120 | 151 | ||
389 | === modified file 'dash/previews/PreviewRatingsWidget.h' | |||
390 | --- dash/previews/PreviewRatingsWidget.h 2013-09-19 16:44:03 +0000 | |||
391 | +++ dash/previews/PreviewRatingsWidget.h 2014-06-17 18:22:57 +0000 | |||
392 | @@ -52,6 +52,8 @@ | |||
393 | 52 | 52 | ||
394 | 53 | void SetReviews(int count); | 53 | void SetReviews(int count); |
395 | 54 | 54 | ||
396 | 55 | nux::Property<double> scale; | ||
397 | 56 | |||
398 | 55 | sigc::signal<void> request_close() const { return preview_container_.request_close; } | 57 | sigc::signal<void> request_close() const { return preview_container_.request_close; } |
399 | 56 | 58 | ||
400 | 57 | protected: | 59 | protected: |
401 | @@ -65,9 +67,13 @@ | |||
402 | 65 | void AddProperties(debug::IntrospectionData&); | 67 | void AddProperties(debug::IntrospectionData&); |
403 | 66 | 68 | ||
404 | 67 | private: | 69 | private: |
405 | 70 | void UpdateScale(double scale); | ||
406 | 71 | |||
407 | 68 | RatingsButton* ratings_; | 72 | RatingsButton* ratings_; |
408 | 69 | StaticCairoText* reviews_; | 73 | StaticCairoText* reviews_; |
409 | 70 | 74 | ||
410 | 75 | nux::VLayout* layout_; | ||
411 | 76 | |||
412 | 71 | PreviewContainer preview_container_; | 77 | PreviewContainer preview_container_; |
413 | 72 | }; | 78 | }; |
414 | 73 | 79 | ||
415 | 74 | 80 | ||
416 | === modified file 'unity-shared/RatingsButton.cpp' | |||
417 | --- unity-shared/RatingsButton.cpp 2013-11-19 18:48:35 +0000 | |||
418 | +++ unity-shared/RatingsButton.cpp 2014-06-17 18:22:57 +0000 | |||
419 | @@ -36,11 +36,11 @@ | |||
420 | 36 | { | 36 | { |
421 | 37 | RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL) | 37 | RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL) |
422 | 38 | : nux::ToggleButton(NUX_FILE_LINE_PARAM) | 38 | : nux::ToggleButton(NUX_FILE_LINE_PARAM) |
423 | 39 | , star_size_(star_size) | ||
424 | 40 | , star_gap_(star_gap) | ||
425 | 39 | , editable_(true) | 41 | , editable_(true) |
426 | 40 | , rating_(0.0) | 42 | , rating_(0.0) |
427 | 41 | , focused_star_(-1) | 43 | , focused_star_(-1) |
428 | 42 | , star_size_(star_size) | ||
429 | 43 | , star_gap_(star_gap) | ||
430 | 44 | { | 44 | { |
431 | 45 | SetAcceptKeyNavFocusOnMouseDown(false); | 45 | SetAcceptKeyNavFocusOnMouseDown(false); |
432 | 46 | SetAcceptKeyNavFocusOnMouseEnter(true); | 46 | SetAcceptKeyNavFocusOnMouseEnter(true); |
433 | 47 | 47 | ||
434 | === modified file 'unity-shared/RatingsButton.h' | |||
435 | --- unity-shared/RatingsButton.h 2013-09-19 16:44:03 +0000 | |||
436 | +++ unity-shared/RatingsButton.h 2014-06-17 18:22:57 +0000 | |||
437 | @@ -41,6 +41,9 @@ | |||
438 | 41 | virtual void SetRating(float rating); | 41 | virtual void SetRating(float rating); |
439 | 42 | virtual float GetRating() const; | 42 | virtual float GetRating() const; |
440 | 43 | 43 | ||
441 | 44 | int star_size_; | ||
442 | 45 | int star_gap_; | ||
443 | 46 | |||
444 | 44 | protected: | 47 | protected: |
445 | 45 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); | 48 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); |
446 | 46 | 49 | ||
447 | @@ -67,8 +70,6 @@ | |||
448 | 67 | bool editable_; | 70 | bool editable_; |
449 | 68 | float rating_; | 71 | float rating_; |
450 | 69 | int focused_star_; | 72 | int focused_star_; |
451 | 70 | int star_size_; | ||
452 | 71 | int star_gap_; | ||
453 | 72 | }; | 73 | }; |
454 | 73 | 74 | ||
455 | 74 | } // namespace unity | 75 | } // namespace unity |
FAILED: Continuous integration, rev:3826 jenkins. qa.ubuntu. com/job/ unity-ci/ 951/ jenkins. qa.ubuntu. com/job/ unity-utopic- amd64-ci/ 38/console jenkins. qa.ubuntu. com/job/ unity-utopic- armhf-ci/ 38/console jenkins. qa.ubuntu. com/job/ unity-utopic- i386-ci/ 38/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/951/ rebuild
http://