Merge lp:~hikiko/unity/unity.scale-payment-musicpayment into lp:unity

Proposed by Eleni Maria Stea
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3830
Merge reported by: Marco Trevisan (Treviño)
Merged at revision: not available
Proposed branch: lp:~hikiko/unity/unity.scale-payment-musicpayment
Merge into: lp:unity
Prerequisite: lp:~hikiko/unity/unity.layouts-fix
Diff against target: 608 lines (+174/-47)
8 files modified
dash/previews/ActionLink.cpp (+13/-0)
dash/previews/ActionLink.h (+3/-2)
dash/previews/MusicPaymentPreview.cpp (+103/-29)
dash/previews/MusicPaymentPreview.h (+1/-0)
dash/previews/PaymentPreview.cpp (+44/-15)
dash/previews/PaymentPreview.h (+3/-0)
dash/previews/Preview.cpp (+4/-0)
dash/previews/StandaloneMusicPaymentPreview.cpp (+3/-1)
To merge this branch: bzr merge lp:~hikiko/unity/unity.scale-payment-musicpayment
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+223889@code.launchpad.net

Commit message

scaled music payment preview and payment preview and their widgets
added scale factor to action link

Description of the change

scaled music payment preview and payment preview and their widgets
added scale factor to action link

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Please apply this diff not to make this to crash in jenkins:

http://bazaar.launchpad.net/~3v1n0/unity/previews-scaling-improved/revision/3832

review: Needs Fixing
3831. By Eleni Maria Stea

fix for jenkins

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/previews/ActionLink.cpp'
2--- dash/previews/ActionLink.cpp 2013-11-19 18:48:35 +0000
3+++ dash/previews/ActionLink.cpp 2014-07-07 15:58:17 +0000
4@@ -40,12 +40,15 @@
5
6 ActionLink::ActionLink(std::string const& action_hint, std::string const& label, NUX_FILE_LINE_DECL)
7 : nux::AbstractButton(NUX_FILE_LINE_PARAM)
8+ , scale(1.0)
9 , action_hint_(action_hint)
10 , aligment_(StaticCairoText::NUX_ALIGN_CENTRE)
11 , underline_(StaticCairoText::NUX_UNDERLINE_SINGLE)
12 {
13 Init();
14 BuildLayout(label);
15+ UpdateScale(scale);
16+ scale.changed.connect(sigc::mem_fun(this, &ActionLink::UpdateScale));
17 }
18
19 std::string ActionLink::GetName() const
20@@ -109,6 +112,7 @@
21 static_text_ = new StaticCairoText(label_, true, NUX_TRACKER_LOCATION);
22 if (!font_hint_.empty())
23 static_text_->SetFont(font_hint_);
24+ static_text_->SetScale(scale);
25 static_text_->SetInputEventSensitivity(false);
26 static_text_->SetTextAlignment(aligment_);
27 static_text_->SetUnderline(underline_);
28@@ -243,5 +247,14 @@
29 return label_;
30 }
31
32+void ActionLink::UpdateScale(double scale)
33+{
34+ if (static_text_)
35+ static_text_->SetScale(scale);
36+
37+ QueueRelayout();
38+ QueueDraw();
39+}
40+
41 } // namespace dash
42 } // namespace unity
43
44=== modified file 'dash/previews/ActionLink.h'
45--- dash/previews/ActionLink.h 2013-09-19 16:44:03 +0000
46+++ dash/previews/ActionLink.h 2014-07-07 15:58:17 +0000
47@@ -48,6 +48,8 @@
48 nux::RWProperty<StaticCairoText::UnderlineState> underline_state;
49 nux::RWProperty<std::string> font_hint;
50
51+ nux::Property<double> scale;
52+
53 void Activate() {}
54 void Deactivate() {}
55
56@@ -90,8 +92,7 @@
57 StaticCairoText::UnderlineState underline_;
58 private:
59 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
60-
61-
62+ void UpdateScale(double scale);
63 };
64
65 } // namespace dash
66
67=== modified file 'dash/previews/MusicPaymentPreview.cpp'
68--- dash/previews/MusicPaymentPreview.cpp 2013-09-19 16:44:03 +0000
69+++ dash/previews/MusicPaymentPreview.cpp 2014-07-07 15:58:17 +0000
70@@ -49,6 +49,22 @@
71 {
72 nux::logging::Logger logger("unity.dash.previews.payment.preview.music");
73
74+const RawPixel DATA_MAX_HEIGHT = 76_em;
75+const RawPixel TITLE_CHILDREN_SPACE = 10_em;
76+const RawPixel PRIZE_CHILDREN_SPACE = 5_em;
77+const RawPixel TITLE_MAX_WIDTH = 480_em;
78+const RawPixel INTRO_MIN_HEIGHT = 50_em;
79+const RawPixel FORM_MIN_HEIGHT = 107_em;
80+const RawPixel FORM_PADDING = 20_em;
81+const RawPixel LABELS_CHILDREN_SPACE = 18_em;
82+const RawPixel PASSWORD_MIN_HEIGHT = 40_em;
83+const RawPixel PASSWORD_MIN_WIDTH = 240_em;
84+const RawPixel ACTIONS_CHILDREN_SPACE_MAX = 16_em;
85+const RawPixel ACTIONS_CHILDREN_SPACE_MIN = 8_em;
86+const RawPixel BUTTONS_SPACE = 20_em;
87+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
88+const RawPixel HEADER_MAX_SIZE = 76_em;
89+const RawPixel BODY_CHILDREN_SPACE = 20_em;
90 }
91
92 // static string definitions
93@@ -77,6 +93,7 @@
94 {
95 SetupViews();
96 PaymentPreview::SetupBackground();
97+ UpdateScale(scale);
98 }
99
100 std::string MusicPaymentPreview::GetName() const
101@@ -127,6 +144,7 @@
102 || MusicPaymentPreview::FORGOT_PASSWORD_ACTION == action_id)
103 {
104 nux::ObjectPtr<ActionLink> link = this->CreateLink(action);
105+ link->scale = scale();
106 link->activate.connect(sigc::mem_fun(this,
107 &MusicPaymentPreview::OnActionLinkActivated));
108
109@@ -137,6 +155,7 @@
110 nux::ObjectPtr<ActionButton> button = this->CreateButton(action);
111 button->activate.connect(sigc::mem_fun(this,
112 &MusicPaymentPreview::OnActionActivated));
113+ button->scale = scale();
114
115 buttons_map_.insert(std::make_pair(action->id, button));
116 }
117@@ -148,8 +167,8 @@
118 {
119 previews::Style& style = dash::previews::Style::Instance();
120 nux::VLayout* title_data_layout = new nux::VLayout();
121- title_data_layout->SetMaximumHeight(76);
122- title_data_layout->SetSpaceBetweenChildren(10);
123+ title_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
124+ title_data_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
125
126 title_ = new StaticCairoText(
127 preview_model_->title.Get(), true,
128@@ -157,8 +176,9 @@
129
130 title_->SetFont(style.payment_title_font());
131 title_->SetLines(-1);
132+ title_->SetScale(scale);
133 title_->SetFont(style.title_font());
134- title_->SetMaximumWidth(480);
135+ title_->SetMaximumWidth(TITLE_MAX_WIDTH.CP(scale));
136 title_->SetTextEllipsize(StaticCairoText::EllipsizeState::NUX_ELLIPSIZE_END);
137 title_data_layout->AddView(title_.GetPointer(), 1);
138
139@@ -166,6 +186,7 @@
140 preview_model_->subtitle.Get(), true,
141 NUX_TRACKER_LOCATION);
142 subtitle_->SetLines(-1);
143+ subtitle_->SetScale(scale);
144 subtitle_->SetFont(style.payment_subtitle_font());
145 title_data_layout->AddView(subtitle_.GetPointer(), 1);
146 title_data_layout->AddSpace(1, 1);
147@@ -176,14 +197,15 @@
148 {
149 previews::Style& style = dash::previews::Style::Instance();
150 nux::VLayout *prize_data_layout = new nux::VLayout();
151- prize_data_layout->SetMaximumHeight(76);
152- prize_data_layout->SetSpaceBetweenChildren(5);
153- prize_data_layout->SetPadding(0, 10, 0, 0);
154+ prize_data_layout->SetMaximumHeight(DATA_MAX_HEIGHT.CP(scale));
155+ prize_data_layout->SetSpaceBetweenChildren(PRIZE_CHILDREN_SPACE.CP(scale));
156+ prize_data_layout->SetPadding(0, TITLE_CHILDREN_SPACE.CP(scale), 0, 0);
157
158 purchase_prize_ = new StaticCairoText(
159 payment_preview_model_->purchase_prize.Get(), true,
160 NUX_TRACKER_LOCATION);
161 purchase_prize_->SetLines(-1);
162+ purchase_prize_->SetScale(scale);
163 purchase_prize_->SetFont(style.payment_prize_title_font());
164 prize_data_layout->AddView(purchase_prize_.GetPointer(), 1,
165 nux::MINOR_POSITION_END);
166@@ -192,6 +214,7 @@
167 _("Ubuntu One best offer"),
168 true, NUX_TRACKER_LOCATION);
169 purchase_hint_->SetLines(-1);
170+ purchase_hint_->SetScale(scale);
171 purchase_hint_->SetFont(style.payment_prize_subtitle_font());
172 prize_data_layout->AddView(purchase_hint_.GetPointer(), 1,
173 nux::MINOR_POSITION_END);
174@@ -200,6 +223,7 @@
175 payment_preview_model_->purchase_type.Get(), true,
176 NUX_TRACKER_LOCATION);
177 purchase_type_->SetLines(-1);
178+ purchase_type_->SetScale(scale);
179 purchase_type_->SetFont(style.payment_prize_subtitle_font());
180 prize_data_layout->AddView(purchase_type_.GetPointer(), 1,
181 nux::MINOR_POSITION_END);
182@@ -210,31 +234,30 @@
183 {
184 previews::Style& style = dash::previews::Style::Instance();
185 nux::VLayout *body_layout = new nux::VLayout();
186- body_layout->SetSpaceBetweenChildren(20);
187+ body_layout->SetSpaceBetweenChildren(BODY_CHILDREN_SPACE.CP(scale));
188
189 intro_ = new StaticCairoText(
190 payment_preview_model_->header.Get(), true,
191 NUX_TRACKER_LOCATION);
192 intro_->SetFont(style.payment_intro_font());
193- intro_->SetLineSpacing(10);
194+ intro_->SetScale(scale);
195+ intro_->SetLineSpacing(TITLE_CHILDREN_SPACE.CP(scale));
196 intro_->SetLines(-style.GetDescriptionLineCount());
197- intro_->SetMinimumHeight(50);
198+ intro_->SetMinimumHeight(INTRO_MIN_HEIGHT.CP(scale));
199
200 form_layout_ = new nux::HLayout();
201- form_layout_->SetSpaceBetweenChildren(10);
202- form_layout_->SetMinimumHeight(107);
203- form_layout_->SetLeftAndRightPadding(20);
204- form_layout_->SetTopAndBottomPadding(10);
205+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
206+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
207+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
208+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
209
210 form_layout_->AddLayout(GetFormLabels(), 1, nux::MINOR_POSITION_END);
211 form_layout_->AddLayout(GetFormFields(), 1, nux::MINOR_POSITION_END);
212 form_layout_->AddLayout(GetFormActions(), 1, nux::MINOR_POSITION_END);
213
214-
215 body_layout->AddView(intro_.GetPointer(), 1);
216 body_layout->AddLayout(form_layout_.GetPointer(), 1);
217
218-
219 return body_layout;
220 }
221
222@@ -244,17 +267,18 @@
223 nux::VLayout *labels_layout = new nux::VLayout();
224 if (error_message_.empty())
225 {
226- labels_layout->SetSpaceBetweenChildren(18);
227+ labels_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
228 }
229 else
230 {
231- labels_layout->SetSpaceBetweenChildren(10);
232+ labels_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
233 }
234
235 email_label_ = new StaticCairoText(
236 _("Ubuntu One email:"), true,
237 NUX_TRACKER_LOCATION);
238 email_label_->SetLines(-1);
239+ email_label_->SetScale(scale);
240 email_label_->SetFont(style.payment_form_labels_font());
241 labels_layout->AddView(email_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
242
243@@ -262,6 +286,7 @@
244 _("Payment method:"), true,
245 NUX_TRACKER_LOCATION);
246 payment_label_->SetLines(-1);
247+ payment_label_->SetScale(scale);
248 payment_label_->SetFont(style.payment_form_labels_font());
249 labels_layout->AddView(payment_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
250
251@@ -269,8 +294,9 @@
252 _("Ubuntu One password:"), true,
253 NUX_TRACKER_LOCATION);
254 password_label_->SetLines(-1);
255+ password_label_->SetScale(scale);
256 password_label_->SetFont(style.payment_form_labels_font());
257- password_label_->SetMinimumHeight(40);
258+ password_label_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
259 labels_layout->AddView(password_label_.GetPointer(), 0, nux::MINOR_POSITION_END);
260
261 return labels_layout;
262@@ -282,17 +308,18 @@
263 nux::VLayout *fields_layout = new nux::VLayout();
264 if (error_message_.empty())
265 {
266- fields_layout->SetSpaceBetweenChildren(18);
267+ fields_layout->SetSpaceBetweenChildren(LABELS_CHILDREN_SPACE.CP(scale));
268 }
269 else
270 {
271- fields_layout->SetSpaceBetweenChildren(10);
272+ fields_layout->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
273 }
274
275 email_ = new StaticCairoText(
276 payment_preview_model_->email.Get(), true,
277 NUX_TRACKER_LOCATION);
278 email_->SetLines(-1);
279+ email_->SetScale(scale);
280 email_->SetFont(style.payment_form_data_font());
281 fields_layout->AddView(email_.GetPointer(), 1,
282 nux::MINOR_POSITION_START);
283@@ -301,13 +328,14 @@
284 payment_preview_model_->payment_method.Get(), true,
285 NUX_TRACKER_LOCATION);
286 payment_->SetLines(-1);
287+ payment_->SetScale(scale);
288 payment_->SetFont(style.payment_form_data_font());
289 fields_layout->AddView(payment_.GetPointer(), 1,
290 nux::MINOR_POSITION_START);
291
292 password_entry_ = new TextInput();
293- password_entry_->SetMinimumHeight(40);
294- password_entry_->SetMinimumWidth(240);
295+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
296+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
297 password_entry_->input_hint = _("Password");
298
299 fields_layout->AddView(password_entry_.GetPointer(),
300@@ -322,6 +350,7 @@
301 StaticCairoText* error = new StaticCairoText(
302 _("Wrong password"), true, NUX_TRACKER_LOCATION);
303 error->SetLines(-1);
304+ error->SetScale(scale);
305 error->SetFont(style.payment_form_data_font());
306 // ensure it is an error using red
307 error->SetTextColor(style.payment_error_color());
308@@ -337,11 +366,11 @@
309 nux::VLayout *actions_layout = new nux::VLayout();
310 if (error_message_.empty())
311 {
312- actions_layout->SetSpaceBetweenChildren(16);
313+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MAX.CP(scale));
314 }
315 else
316 {
317- actions_layout->SetSpaceBetweenChildren(8);
318+ actions_layout->SetSpaceBetweenChildren(ACTIONS_CHILDREN_SPACE_MIN.CP(scale));
319 }
320
321 nux::ObjectPtr<StaticCairoText> empty_;
322@@ -349,6 +378,7 @@
323 "", true,
324 NUX_TRACKER_LOCATION);
325 empty_->SetLines(-1);
326+ empty_->SetScale(scale);
327 empty_->SetFont(style.payment_form_labels_font());
328 actions_layout->AddView(empty_.GetPointer(), 1,
329 nux::MINOR_POSITION_START);
330@@ -374,14 +404,14 @@
331 actions_buffer_h->AddSpace(0, 1);
332
333 nux::HLayout* buttons_data_layout = new nux::HLayout();
334- buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions());
335+ buttons_data_layout->SetSpaceBetweenChildren(style.GetSpaceBetweenActions().CP(scale));
336
337- lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth(),
338- style.GetPaymentLockHeight());
339+ lock_texture_ = new IconTexture(style.GetLockIcon(), style.GetPaymentLockWidth().CP(scale),
340+ style.GetPaymentLockHeight().CP(scale));
341 buttons_data_layout->AddView(lock_texture_.GetPointer(), 0, nux::MINOR_POSITION_CENTER,
342 nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN);
343
344- buttons_data_layout->AddSpace(20, 1);
345+ buttons_data_layout->AddSpace(BUTTONS_SPACE.CP(scale), 1);
346 if(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer())
347 buttons_data_layout->AddView(buttons_map_[MusicPaymentPreview::CANCEL_PURCHASE_ACTION].GetPointer(),
348 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f,
349@@ -413,7 +443,8 @@
350
351 previews::Style& style = dash::previews::Style::Instance();
352
353- int width = std::max<int>(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin());
354+ int content_width = geo.width - style.GetPanelSplitWidth().CP(scale) - style.GetDetailsLeftMargin().CP(scale) - style.GetDetailsRightMargin().CP(scale);
355+ int width = std::max<int>(0, content_width);
356
357 if(full_data_layout_) { full_data_layout_->SetMaximumWidth(width); }
358 if(header_layout_) { header_layout_->SetMaximumWidth(width); }
359@@ -460,6 +491,49 @@
360 PaymentPreview::SetupViews();
361 }
362
363+void MusicPaymentPreview::UpdateScale(double scale)
364+{
365+ PaymentPreview::UpdateScale(scale);
366+
367+ if (intro_)
368+ intro_->SetScale(scale);
369+ if (email_label_)
370+ email_label_->SetScale(scale);
371+ if (payment_label_)
372+ payment_label_->SetScale(scale);
373+ if (payment_)
374+ payment_->SetScale(scale);
375+ if (password_label_)
376+ password_label_->SetScale(scale);
377+ if (purchase_hint_)
378+ purchase_hint_->SetScale(scale);
379+ if (purchase_prize_)
380+ purchase_prize_->SetScale(scale);
381+ if (purchase_type_)
382+ purchase_type_->SetScale(scale);
383+ if (change_payment_)
384+ change_payment_->SetScale(scale);
385+ if (error_label_)
386+ error_label_->SetScale(scale);
387+
388+ previews::Style& style = dash::previews::Style::Instance();
389+ if (lock_texture_)
390+ lock_texture_->SetSize(std::max(style.GetPaymentLockWidth().CP(scale), style.GetPaymentLockHeight().CP(scale)));
391+
392+ if (password_entry_)
393+ {
394+ password_entry_->SetMinimumHeight(PASSWORD_MIN_HEIGHT.CP(scale));
395+ password_entry_->SetMinimumWidth(PASSWORD_MIN_WIDTH.CP(scale));
396+ }
397+
398+ if (form_layout_)
399+ {
400+ form_layout_->SetSpaceBetweenChildren(TITLE_CHILDREN_SPACE.CP(scale));
401+ form_layout_->SetMinimumHeight(FORM_MIN_HEIGHT.CP(scale));
402+ form_layout_->SetLeftAndRightPadding(FORM_PADDING.CP(scale));
403+ form_layout_->SetTopAndBottomPadding(TITLE_CHILDREN_SPACE.CP(scale));
404+ }
405+}
406
407 }
408 }
409
410=== modified file 'dash/previews/MusicPaymentPreview.h'
411--- dash/previews/MusicPaymentPreview.h 2013-09-19 16:44:03 +0000
412+++ dash/previews/MusicPaymentPreview.h 2014-07-07 15:58:17 +0000
413@@ -90,6 +90,7 @@
414 void OnActionLinkActivated(ActionLink* link, std::string const& id);
415
416 virtual void SetupViews();
417+ virtual void UpdateScale(double scale) override;
418
419 void PreLayoutManagement();
420
421
422=== modified file 'dash/previews/PaymentPreview.cpp'
423--- dash/previews/PaymentPreview.cpp 2013-09-19 16:44:03 +0000
424+++ dash/previews/PaymentPreview.cpp 2014-07-07 15:58:17 +0000
425@@ -39,6 +39,15 @@
426
427 nux::logging::Logger logger("unity.dash.previews.payment.preview");
428
429+const RawPixel CONTENT_DATA_CHILDREN_SPACE = 5_em;
430+const RawPixel CONTENT_DATA_PADDING = 10_em;
431+const RawPixel OVERLAY_LAYOUT_SPACE = 20_em;
432+const RawPixel HEADER_CHILDREN_SPACE = 10_em;
433+const RawPixel HEADER_MAX_SIZE = 76_em;
434+const RawPixel IMAGE_MIN_MAX_SIZE = 64_em;
435+const RawPixel HEADER_SPACE = 10_em;
436+const RawPixel LINK_MIN_WIDTH = 178_em;
437+const RawPixel LINK_MAX_HEIGHT = 34_em;
438 }
439
440 class OverlaySpinner : public unity::debug::Introspectable, public nux::View
441@@ -183,6 +192,11 @@
442 : Preview(preview_model)
443 , data_(nullptr)
444 , full_data_layout_(nullptr)
445+, content_data_layout_(nullptr)
446+, overlay_layout_(nullptr)
447+, header_layout_(nullptr)
448+, body_layout_(nullptr)
449+, footer_layout_(nullptr)
450 {
451 }
452
453@@ -199,18 +213,18 @@
454 nux::Layout* PaymentPreview::GetHeader()
455 {
456 nux::HLayout* header_data_layout = new nux::HLayout();
457- header_data_layout->SetSpaceBetweenChildren(10);
458- header_data_layout->SetMaximumHeight(76);
459- header_data_layout->SetMinimumHeight(76);
460+ header_data_layout->SetSpaceBetweenChildren(HEADER_CHILDREN_SPACE.CP(scale));
461+ header_data_layout->SetMaximumHeight(HEADER_MAX_SIZE.CP(scale));
462+ header_data_layout->SetMinimumHeight(HEADER_MAX_SIZE.CP(scale));
463
464 image_ = new CoverArt();
465- image_->SetMinMaxSize(64, 64);
466+ image_->SetMinMaxSize(IMAGE_MIN_MAX_SIZE.CP(scale), IMAGE_MIN_MAX_SIZE.CP(scale));
467 AddChild(image_.GetPointer());
468 UpdateCoverArtImage(image_.GetPointer());
469
470 header_data_layout->AddView(image_.GetPointer(), 0);
471 header_data_layout->AddLayout(GetTitle(), 0);
472- header_data_layout->AddSpace(10, 1);
473+ header_data_layout->AddSpace(HEADER_SPACE.CP(scale), 1);
474 header_data_layout->AddLayout(GetPrice(), 0);
475 return header_data_layout;
476 }
477@@ -223,8 +237,8 @@
478 link = new ActionLink(action->id,
479 action->display_name, NUX_TRACKER_LOCATION);
480 link->font_hint.Set(style.payment_form_labels_font().c_str());
481- link->SetMinimumWidth(178);
482- link->SetMaximumHeight(34);
483+ link->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
484+ link->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
485 return link;
486 }
487
488@@ -239,8 +253,8 @@
489 NUX_TRACKER_LOCATION);
490 button->SetFont(style.action_font());
491 button->SetExtraHint(action->extra_text, style.action_extra_font());
492- button->SetMinimumWidth(178);
493- button->SetMaximumHeight(34);
494+ button->SetMinimumWidth(LINK_MIN_WIDTH.CP(scale));
495+ button->SetMaximumHeight(LINK_MAX_HEIGHT.CP(scale));
496 return button;
497 }
498
499@@ -327,8 +341,8 @@
500
501 // layout to be used to show the info
502 content_data_layout_ = new nux::VLayout();
503- content_data_layout_->SetSpaceBetweenChildren(5);
504- content_data_layout_->SetPadding(10, 10, 0, 10);
505+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
506+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
507
508 header_layout_ = GetHeader();
509
510@@ -344,21 +358,36 @@
511
512 // layout to draw an overlay
513 overlay_layout_ = new nux::VLayout();
514- StaticCairoText* calculating = new StaticCairoText(
515+ calculating_ = new StaticCairoText(
516 "Performing purchase", true,
517 NUX_TRACKER_LOCATION);
518
519 OverlaySpinner* spinner_ = new OverlaySpinner();
520- overlay_layout_->AddSpace(20, 1);
521- overlay_layout_->AddView(calculating, 0, nux::MINOR_POSITION_CENTER);
522+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
523+ overlay_layout_->AddView(calculating_, 0, nux::MINOR_POSITION_CENTER);
524 overlay_layout_->AddView(spinner_, 1, nux::MINOR_POSITION_CENTER);
525- overlay_layout_->AddSpace(20, 1);
526+ overlay_layout_->AddSpace(OVERLAY_LAYOUT_SPACE.CP(scale), 1);
527
528 full_data_layout_->AddLayout(overlay_layout_.GetPointer());
529
530+ UpdateScale(scale);
531 SetLayout(full_data_layout_.GetPointer());
532 }
533
534+void PaymentPreview::UpdateScale(double scale)
535+{
536+ Preview::UpdateScale(scale);
537+
538+ if (calculating_)
539+ calculating_->SetScale(scale);
540+
541+ if (content_data_layout_)
542+ {
543+ content_data_layout_->SetSpaceBetweenChildren(CONTENT_DATA_CHILDREN_SPACE.CP(scale));
544+ content_data_layout_->SetPadding(CONTENT_DATA_PADDING.CP(scale), CONTENT_DATA_PADDING.CP(scale), 0, CONTENT_DATA_PADDING.CP(scale));
545+ }
546+}
547+
548 }
549
550 }
551
552=== modified file 'dash/previews/PaymentPreview.h'
553--- dash/previews/PaymentPreview.h 2013-09-19 16:44:03 +0000
554+++ dash/previews/PaymentPreview.h 2014-07-07 15:58:17 +0000
555@@ -106,6 +106,7 @@
556
557 virtual void LoadActions() = 0;
558 virtual void SetupViews();
559+ virtual void UpdateScale(double scale) override;
560 virtual void SetupBackground();
561
562 nux::ObjectPtr<nux::LayeredLayout> full_data_layout_;
563@@ -115,6 +116,8 @@
564 nux::ObjectPtr<nux::Layout> body_layout_;
565 nux::ObjectPtr<nux::Layout> footer_layout_;
566
567+ StaticCairoText* calculating_;
568+
569 // content elements
570 nux::ObjectPtr<CoverArt> image_;
571
572
573=== modified file 'dash/previews/Preview.cpp'
574--- dash/previews/Preview.cpp 2014-07-07 15:58:17 +0000
575+++ dash/previews/Preview.cpp 2014-07-07 15:58:17 +0000
576@@ -306,6 +306,10 @@
577 ActionButton* bn = dynamic_cast<ActionButton*>(button);
578 if (bn)
579 bn->scale = scale;
580+
581+ ActionLink* link = dynamic_cast<ActionLink*>(button);
582+ if (link)
583+ link->scale = scale;
584 }
585
586 QueueRelayout();
587
588=== modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp'
589--- dash/previews/StandaloneMusicPaymentPreview.cpp 2013-11-18 18:13:59 +0000
590+++ dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-07 15:58:17 +0000
591@@ -147,6 +147,7 @@
592 void TestRunner::Init ()
593 {
594 container_ = new previews::PreviewContainer(NUX_TRACKER_LOCATION);
595+// container_->scale = 1.62;
596 container_->request_close.connect([this]() { exit(0); });
597 container_->DisableNavButton(previews::Navigation::BOTH);
598
599@@ -189,7 +190,8 @@
600 glib::StealRef());
601
602 dash::Preview::Ptr preview_model(dash::Preview::PreviewForVariant(v));
603- container_->Preview(preview_model, previews::Navigation::LEFT);
604+ if (container_)
605+ container_->Preview(preview_model, previews::Navigation::LEFT);
606 }
607
608 void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)