Merge lp:~3v1n0/unity/shortcuts-hidpi into lp:unity
- shortcuts-hidpi
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3816 |
Proposed branch: | lp:~3v1n0/unity/shortcuts-hidpi |
Merge into: | lp:unity |
Prerequisite: | lp:~brandontschaefer/unity/shutdown-dialog-hi-dpi |
Diff against target: |
333 lines (+123/-52) 3 files modified
shortcuts/ShortcutController.cpp (+1/-1) shortcuts/ShortcutView.cpp (+113/-48) shortcuts/ShortcutView.h (+9/-3) |
To merge this branch: | bzr merge lp:~3v1n0/unity/shortcuts-hidpi |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
PS Jenkins bot | continuous-integration | Pending | |
Review via email: mp+219771@code.launchpad.net |
This proposal supersedes a proposal from 2014-05-08.
Commit message
ShortcutView: use RawPixel's for the size values and convert them to match current scaling
Plus dinamically allocate horizontal space, not to cut the text.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
Here the overlay appears different before and after the fix.
https:/
https:/
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal | # |
> Here the overlay appears different before and after the fix.
>
> https:/
> https:/
This is because both in English and many localized versions the keys
or descriptions are cut, while there's no reason to limit the
horizontal size, since most of netbooks will still be able to see it.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:3807
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'shortcuts/ShortcutController.cpp' | |||
2 | --- shortcuts/ShortcutController.cpp 2014-05-16 00:35:23 +0000 | |||
3 | +++ shortcuts/ShortcutController.cpp 2014-05-16 00:35:23 +0000 | |||
4 | @@ -70,11 +70,11 @@ | |||
5 | 70 | if (!view_) | 70 | if (!view_) |
6 | 71 | return; | 71 | return; |
7 | 72 | 72 | ||
8 | 73 | model->Fill(); | ||
9 | 73 | view_->SetModel(model); | 74 | view_->SetModel(model); |
10 | 74 | 75 | ||
11 | 75 | if (Visible()) | 76 | if (Visible()) |
12 | 76 | { | 77 | { |
13 | 77 | model->Fill(); | ||
14 | 78 | auto const& offset = GetOffsetPerMonitor(view_->monitor()); | 78 | auto const& offset = GetOffsetPerMonitor(view_->monitor()); |
15 | 79 | 79 | ||
16 | 80 | if (offset.x < 0 || offset.y < 0) | 80 | if (offset.x < 0 || offset.y < 0) |
17 | 81 | 81 | ||
18 | === modified file 'shortcuts/ShortcutView.cpp' | |||
19 | --- shortcuts/ShortcutView.cpp 2013-11-16 11:44:23 +0000 | |||
20 | +++ shortcuts/ShortcutView.cpp 2014-05-16 00:35:23 +0000 | |||
21 | @@ -38,10 +38,16 @@ | |||
22 | 38 | const unsigned MAIN_TITLE_FONT_SIZE = 15; | 38 | const unsigned MAIN_TITLE_FONT_SIZE = 15; |
23 | 39 | const unsigned SECTION_NAME_FONT_SIZE = 12; | 39 | const unsigned SECTION_NAME_FONT_SIZE = 12; |
24 | 40 | const unsigned SHORTKEY_ENTRY_FONT_SIZE = 9; | 40 | const unsigned SHORTKEY_ENTRY_FONT_SIZE = 9; |
29 | 41 | const unsigned INTER_SPACE_SHORTKEY_DESCRIPTION = 10; | 41 | const RawPixel INTER_SPACE_SHORTKEY_DESCRIPTION = 10_em; |
30 | 42 | const unsigned SHORTKEY_COLUMN_WIDTH = 150; | 42 | const RawPixel SHORTKEY_COLUMN_DEFAULT_WIDTH = 150_em; |
31 | 43 | const unsigned DESCRIPTION_COLUMN_WIDTH = 265; | 43 | const RawPixel SHORTKEY_COLUMN_MAX_WIDTH = 350_em; |
32 | 44 | const unsigned LINE_SPACING = 5; | 44 | const RawPixel DESCRIPTION_COLUMN_DEFAULT_WIDTH = 265_em; |
33 | 45 | const RawPixel DESCRIPTION_COLUMN_MAX_WIDTH = 500_em; | ||
34 | 46 | const RawPixel LINE_SPACING = 3_em; | ||
35 | 47 | const RawPixel MAIN_HORIZONTAL_PADDING = 30_em; | ||
36 | 48 | const RawPixel MAIN_VERTICAL_PADDING = 18_em; | ||
37 | 49 | const RawPixel MAIN_CHILDREN_SPACE = 20_em; | ||
38 | 50 | const RawPixel COLUMNS_CHILDREN_SPACE = 30_em; | ||
39 | 45 | 51 | ||
40 | 46 | // We need this class because SetVisible doesn't work for layouts. | 52 | // We need this class because SetVisible doesn't work for layouts. |
41 | 47 | class SectionView : public nux::View | 53 | class SectionView : public nux::View |
42 | @@ -72,8 +78,8 @@ | |||
43 | 72 | : ui::UnityWindowView() | 78 | : ui::UnityWindowView() |
44 | 73 | { | 79 | { |
45 | 74 | auto main_layout = new nux::VLayout(); | 80 | auto main_layout = new nux::VLayout(); |
48 | 75 | main_layout->SetPadding(30, 18); | 81 | main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); |
49 | 76 | main_layout->SetSpaceBetweenChildren(20); | 82 | main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); |
50 | 77 | SetLayout(main_layout); | 83 | SetLayout(main_layout); |
51 | 78 | 84 | ||
52 | 79 | std::string header = "<b>"+std::string(_("Keyboard Shortcuts"))+"</b>"; | 85 | std::string header = "<b>"+std::string(_("Keyboard Shortcuts"))+"</b>"; |
53 | @@ -81,13 +87,22 @@ | |||
54 | 81 | auto* header_view = new StaticCairoText(header, NUX_TRACKER_LOCATION); | 87 | auto* header_view = new StaticCairoText(header, NUX_TRACKER_LOCATION); |
55 | 82 | header_view->SetFont(FONT_NAME+" "+std::to_string(MAIN_TITLE_FONT_SIZE)); | 88 | header_view->SetFont(FONT_NAME+" "+std::to_string(MAIN_TITLE_FONT_SIZE)); |
56 | 83 | header_view->SetLines(-1); | 89 | header_view->SetLines(-1); |
57 | 90 | header_view->SetScale(scale); | ||
58 | 84 | main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 91 | main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
59 | 85 | 92 | ||
60 | 86 | main_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 93 | main_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
61 | 87 | 94 | ||
62 | 88 | columns_layout_ = new nux::HLayout(); | 95 | columns_layout_ = new nux::HLayout(); |
64 | 89 | columns_layout_->SetSpaceBetweenChildren(30); | 96 | columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); |
65 | 90 | main_layout->AddLayout(columns_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 97 | main_layout->AddLayout(columns_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
66 | 98 | |||
67 | 99 | scale.changed.connect([this, main_layout, header_view] (double scale) { | ||
68 | 100 | main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); | ||
69 | 101 | main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); | ||
70 | 102 | columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); | ||
71 | 103 | header_view->SetScale(scale); | ||
72 | 104 | RenderColumns(); | ||
73 | 105 | }); | ||
74 | 91 | } | 106 | } |
75 | 92 | 107 | ||
76 | 93 | void View::SetModel(Model::Ptr model) | 108 | void View::SetModel(Model::Ptr model) |
77 | @@ -114,14 +129,17 @@ | |||
78 | 114 | auto* section_name_view = new StaticCairoText(name, NUX_TRACKER_LOCATION); | 129 | auto* section_name_view = new StaticCairoText(name, NUX_TRACKER_LOCATION); |
79 | 115 | section_name_view->SetFont(FONT_NAME+" "+std::to_string(SECTION_NAME_FONT_SIZE)); | 130 | section_name_view->SetFont(FONT_NAME+" "+std::to_string(SECTION_NAME_FONT_SIZE)); |
80 | 116 | section_name_view->SetLines(-1); | 131 | section_name_view->SetLines(-1); |
82 | 117 | layout->AddView(new nux::SpaceLayout(10, 10, 10, 10), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 132 | section_name_view->SetScale(scale); |
83 | 133 | const int top_space = (10_em).CP(scale); | ||
84 | 134 | const int bottom_space = (15_em).CP(scale); | ||
85 | 135 | layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | ||
86 | 118 | layout->AddView(section_name_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 136 | layout->AddView(section_name_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
88 | 119 | layout->AddView(new nux::SpaceLayout(15, 15, 15, 15), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 137 | layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
89 | 120 | 138 | ||
90 | 121 | return layout; | 139 | return layout; |
91 | 122 | } | 140 | } |
92 | 123 | 141 | ||
94 | 124 | nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint) | 142 | nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint, StaticCairoText* shortkey_view, StaticCairoText* description_view) |
95 | 125 | { | 143 | { |
96 | 126 | auto* view = new SectionView(NUX_TRACKER_LOCATION); | 144 | auto* view = new SectionView(NUX_TRACKER_LOCATION); |
97 | 127 | 145 | ||
98 | @@ -131,56 +149,56 @@ | |||
99 | 131 | nux::HLayout* shortkey_layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 149 | nux::HLayout* shortkey_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
100 | 132 | nux::HLayout* description_layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 150 | nux::HLayout* description_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
101 | 133 | 151 | ||
102 | 134 | glib::String shortkey(g_markup_escape_text(hint->shortkey().c_str(), -1)); | ||
103 | 135 | |||
104 | 136 | std::string skey = "<b>"+shortkey.Str()+"</b>"; | ||
105 | 137 | auto* shortkey_view = new StaticCairoText(skey, NUX_TRACKER_LOCATION); | ||
106 | 138 | shortkey_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
107 | 139 | shortkey_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
108 | 140 | shortkey_view->SetLines(-1); | ||
109 | 141 | shortkey_view->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); | ||
110 | 142 | shortkey_view->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); | ||
111 | 143 | |||
112 | 144 | glib::String es_desc(g_markup_escape_text(hint->description().c_str(), -1)); | ||
113 | 145 | |||
114 | 146 | auto* description_view = new StaticCairoText(es_desc.Str(), NUX_TRACKER_LOCATION); | ||
115 | 147 | description_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
116 | 148 | description_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
117 | 149 | description_view->SetLines(-1); | ||
118 | 150 | description_view->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
119 | 151 | description_view->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
120 | 152 | |||
121 | 153 | shortkey_layout->AddView(shortkey_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 152 | shortkey_layout->AddView(shortkey_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
122 | 154 | shortkey_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 153 | shortkey_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
123 | 155 | shortkey_layout->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); | ||
124 | 156 | shortkey_layout->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); | ||
125 | 157 | 154 | ||
126 | 158 | description_layout->AddView(description_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 155 | description_layout->AddView(description_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
127 | 159 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 156 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
128 | 160 | description_layout->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
129 | 161 | description_layout->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
130 | 162 | 157 | ||
131 | 163 | layout->AddLayout(shortkey_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 158 | layout->AddLayout(shortkey_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
132 | 164 | layout->AddLayout(description_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 159 | layout->AddLayout(description_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
134 | 165 | layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION); | 160 | layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION.CP(scale)); |
135 | 166 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 161 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
136 | 167 | 162 | ||
141 | 168 | view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& new_key) { | 163 | view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& key) { |
142 | 169 | bool enabled = !new_key.empty(); | 164 | std::string escaped = glib::String(g_markup_escape_text(key.c_str(), -1)).Str(); |
143 | 170 | shortkey_view->SetText(enabled ? "<b>"+new_key+"</b>" : ""); | 165 | |
144 | 171 | view->SetVisible(enabled); | 166 | if (!escaped.empty()) |
145 | 167 | escaped = "<b>"+escaped+"</b>"; | ||
146 | 168 | |||
147 | 169 | shortkey_view->SetText(escaped); | ||
148 | 170 | shortkey_view->SetVisible(!escaped.empty()); | ||
149 | 171 | view->SetVisible(shortkey_view->IsVisible()); | ||
150 | 172 | QueueRelayout(); | 172 | QueueRelayout(); |
151 | 173 | QueueDraw(); | ||
152 | 173 | }); | 174 | }); |
153 | 174 | 175 | ||
155 | 175 | view->SetVisible(!shortkey.Str().empty()); | 176 | view->SetVisible(shortkey_view->IsVisible()); |
156 | 176 | 177 | ||
157 | 177 | return view; | 178 | return view; |
158 | 178 | } | 179 | } |
159 | 179 | 180 | ||
160 | 181 | StaticCairoText* View::CreateShortcutTextView(std::string const& text, bool bold) | ||
161 | 182 | { | ||
162 | 183 | std::string escaped = glib::String(g_markup_escape_text(text.c_str(), -1)).Str(); | ||
163 | 184 | |||
164 | 185 | if (bold && !text.empty()) | ||
165 | 186 | escaped = "<b>"+escaped+"</b>"; | ||
166 | 187 | |||
167 | 188 | auto* text_view = new StaticCairoText(escaped, NUX_TRACKER_LOCATION); | ||
168 | 189 | text_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
169 | 190 | text_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
170 | 191 | text_view->SetLines(-1); | ||
171 | 192 | text_view->SetScale(scale); | ||
172 | 193 | text_view->SetVisible(!escaped.empty()); | ||
173 | 194 | |||
174 | 195 | return text_view; | ||
175 | 196 | } | ||
176 | 197 | |||
177 | 180 | nux::LinearLayout* View::CreateIntermediateLayout() | 198 | nux::LinearLayout* View::CreateIntermediateLayout() |
178 | 181 | { | 199 | { |
179 | 182 | nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); | 200 | nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
181 | 183 | layout->SetSpaceBetweenChildren(LINE_SPACING); | 201 | layout->SetSpaceBetweenChildren(LINE_SPACING.CP(scale)); |
182 | 184 | 202 | ||
183 | 185 | return layout; | 203 | return layout; |
184 | 186 | } | 204 | } |
185 | @@ -195,9 +213,38 @@ | |||
186 | 195 | view_layout_->ProcessDraw(GfxContext, force_draw); | 213 | view_layout_->ProcessDraw(GfxContext, force_draw); |
187 | 196 | } | 214 | } |
188 | 197 | 215 | ||
189 | 216 | void View::PreLayoutManagement() | ||
190 | 217 | { | ||
191 | 218 | UnityWindowView::PreLayoutManagement(); | ||
192 | 219 | |||
193 | 220 | for (auto const& column : shortkeys_) | ||
194 | 221 | { | ||
195 | 222 | int min_width = SHORTKEY_COLUMN_DEFAULT_WIDTH.CP(scale); | ||
196 | 223 | |||
197 | 224 | for (auto* shortkey : column) | ||
198 | 225 | min_width = std::min(std::max(min_width, shortkey->GetTextExtents().width), shortkey->GetMaximumWidth()); | ||
199 | 226 | |||
200 | 227 | for (auto* shortkey : column) | ||
201 | 228 | shortkey->SetMinimumWidth(min_width); | ||
202 | 229 | } | ||
203 | 230 | |||
204 | 231 | for (auto const& column : descriptions_) | ||
205 | 232 | { | ||
206 | 233 | int min_width = DESCRIPTION_COLUMN_DEFAULT_WIDTH.CP(scale); | ||
207 | 234 | |||
208 | 235 | for (auto* description : column) | ||
209 | 236 | min_width = std::min(std::max(min_width, description->GetTextExtents().width), description->GetMaximumWidth()); | ||
210 | 237 | |||
211 | 238 | for (auto* description : column) | ||
212 | 239 | description->SetMinimumWidth(min_width); | ||
213 | 240 | } | ||
214 | 241 | } | ||
215 | 242 | |||
216 | 198 | void View::RenderColumns() | 243 | void View::RenderColumns() |
217 | 199 | { | 244 | { |
218 | 200 | columns_layout_->Clear(); | 245 | columns_layout_->Clear(); |
219 | 246 | shortkeys_.clear(); | ||
220 | 247 | descriptions_.clear(); | ||
221 | 201 | 248 | ||
222 | 202 | if (!model_) | 249 | if (!model_) |
223 | 203 | { | 250 | { |
224 | @@ -209,11 +256,21 @@ | |||
225 | 209 | int i = 0; | 256 | int i = 0; |
226 | 210 | int column_idx = 0; | 257 | int column_idx = 0; |
227 | 211 | auto const& columns = columns_layout_->GetChildren(); | 258 | auto const& columns = columns_layout_->GetChildren(); |
230 | 212 | 259 | auto const& categories = model_->categories(); | |
231 | 213 | for (auto const& category : model_->categories()) | 260 | const int categories_per_column = model_->categories_per_column(); |
232 | 261 | const int columns_number = categories.size() / categories_per_column + 1; | ||
233 | 262 | const int top_space = (23_em).CP(scale); | ||
234 | 263 | const int bottom_space = (20_em).CP(scale); | ||
235 | 264 | const int max_shortkeys_width = SHORTKEY_COLUMN_MAX_WIDTH.CP(scale); | ||
236 | 265 | const int max_descriptions_width = DESCRIPTION_COLUMN_MAX_WIDTH.CP(scale); | ||
237 | 266 | |||
238 | 267 | shortkeys_.resize(columns_number); | ||
239 | 268 | descriptions_.resize(columns_number); | ||
240 | 269 | |||
241 | 270 | for (auto const& category : categories) | ||
242 | 214 | { | 271 | { |
243 | 215 | // Computing column index based on current index | 272 | // Computing column index based on current index |
245 | 216 | column_idx = i/model_->categories_per_column(); | 273 | column_idx = i/categories_per_column; |
246 | 217 | 274 | ||
247 | 218 | nux::LinearLayout* section_layout = CreateSectionLayout(category); | 275 | nux::LinearLayout* section_layout = CreateSectionLayout(category); |
248 | 219 | nux::LinearLayout* intermediate_layout = CreateIntermediateLayout(); | 276 | nux::LinearLayout* intermediate_layout = CreateIntermediateLayout(); |
249 | @@ -221,19 +278,27 @@ | |||
250 | 221 | 278 | ||
251 | 222 | for (auto const& hint : model_->hints().at(category)) | 279 | for (auto const& hint : model_->hints().at(category)) |
252 | 223 | { | 280 | { |
254 | 224 | nux::View* view = CreateShortKeyEntryView(hint); | 281 | StaticCairoText* shortkey = CreateShortcutTextView(hint->shortkey(), true); |
255 | 282 | shortkey->SetMaximumWidth(max_shortkeys_width); | ||
256 | 283 | shortkeys_[column_idx].push_back(shortkey); | ||
257 | 284 | |||
258 | 285 | StaticCairoText* description = CreateShortcutTextView(hint->description(), false); | ||
259 | 286 | description->SetMaximumWidth(max_descriptions_width); | ||
260 | 287 | descriptions_[column_idx].push_back(description); | ||
261 | 288 | |||
262 | 289 | nux::View* view = CreateShortKeyEntryView(hint, shortkey, description); | ||
263 | 225 | intermediate_layout->AddView(view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); | 290 | intermediate_layout->AddView(view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
264 | 226 | } | 291 | } |
265 | 227 | 292 | ||
266 | 228 | section_layout->AddLayout(intermediate_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 293 | section_layout->AddLayout(intermediate_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
267 | 229 | 294 | ||
269 | 230 | if ((i + 1) % model_->categories_per_column() != 0 && category != model_->categories().back()) | 295 | if ((i + 1) % categories_per_column != 0 && category != categories.back()) |
270 | 231 | { | 296 | { |
271 | 232 | // Add a line with some padding after and before each category that is not | 297 | // Add a line with some padding after and before each category that is not |
272 | 233 | // the last of the column. | 298 | // the last of the column. |
274 | 234 | section_layout->AddView(new nux::SpaceLayout(23, 23, 23, 23), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 299 | section_layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
275 | 235 | section_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 300 | section_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
277 | 236 | section_layout->AddView(new nux::SpaceLayout(20, 20, 20, 20), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 301 | section_layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
278 | 237 | } | 302 | } |
279 | 238 | 303 | ||
280 | 239 | nux::VLayout* column = nullptr; | 304 | nux::VLayout* column = nullptr; |
281 | @@ -251,7 +316,7 @@ | |||
282 | 251 | 316 | ||
283 | 252 | column->AddView(section_layout, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); | 317 | column->AddView(section_layout, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
284 | 253 | 318 | ||
286 | 254 | i++; | 319 | ++i; |
287 | 255 | } | 320 | } |
288 | 256 | 321 | ||
289 | 257 | ComputeContentSize(); | 322 | ComputeContentSize(); |
290 | 258 | 323 | ||
291 | === modified file 'shortcuts/ShortcutView.h' | |||
292 | --- shortcuts/ShortcutView.h 2013-11-16 11:44:23 +0000 | |||
293 | +++ shortcuts/ShortcutView.h 2014-05-16 00:35:23 +0000 | |||
294 | @@ -29,6 +29,8 @@ | |||
295 | 29 | 29 | ||
296 | 30 | namespace unity | 30 | namespace unity |
297 | 31 | { | 31 | { |
298 | 32 | class StaticCairoText; | ||
299 | 33 | |||
300 | 32 | namespace shortcut | 34 | namespace shortcut |
301 | 33 | { | 35 | { |
302 | 34 | 36 | ||
303 | @@ -47,8 +49,9 @@ | |||
304 | 47 | 49 | ||
305 | 48 | protected: | 50 | protected: |
306 | 49 | // Protected methods | 51 | // Protected methods |
309 | 50 | void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip); | 52 | void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip) override; |
310 | 51 | nux::Geometry GetBackgroundGeometry(); | 53 | nux::Geometry GetBackgroundGeometry() override; |
311 | 54 | void PreLayoutManagement() override; | ||
312 | 52 | 55 | ||
313 | 53 | // Introspectable methods | 56 | // Introspectable methods |
314 | 54 | std::string GetName() const; | 57 | std::string GetName() const; |
315 | @@ -56,7 +59,8 @@ | |||
316 | 56 | private: | 59 | private: |
317 | 57 | // Private methods | 60 | // Private methods |
318 | 58 | nux::LinearLayout* CreateSectionLayout(std::string const& section_name); | 61 | nux::LinearLayout* CreateSectionLayout(std::string const& section_name); |
320 | 59 | nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const& hint); | 62 | nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const&, StaticCairoText* shortkey, StaticCairoText* description); |
321 | 63 | StaticCairoText* CreateShortcutTextView(std::string const& text, bool bold); | ||
322 | 60 | nux::LinearLayout* CreateIntermediateLayout(); | 64 | nux::LinearLayout* CreateIntermediateLayout(); |
323 | 61 | 65 | ||
324 | 62 | void RenderColumns(); | 66 | void RenderColumns(); |
325 | @@ -64,6 +68,8 @@ | |||
326 | 64 | // Private members | 68 | // Private members |
327 | 65 | Model::Ptr model_; | 69 | Model::Ptr model_; |
328 | 66 | nux::HLayout* columns_layout_; | 70 | nux::HLayout* columns_layout_; |
329 | 71 | std::vector<std::vector<StaticCairoText*>> shortkeys_; | ||
330 | 72 | std::vector<std::vector<StaticCairoText*>> descriptions_; | ||
331 | 67 | 73 | ||
332 | 68 | friend class TestShortcutView; | 74 | friend class TestShortcutView; |
333 | 69 | }; | 75 | }; |
FAILED: Continuous integration, rev:3805 jenkins. qa.ubuntu. com/job/ unity-ci/ 919/ jenkins. qa.ubuntu. com/job/ unity-utopic- amd64-ci/ 6/console jenkins. qa.ubuntu. com/job/ unity-utopic- armhf-ci/ 6/console jenkins. qa.ubuntu. com/job/ unity-utopic- i386-ci/ 6/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/919/ rebuild
http://