Merge lp:~zsombi/ubuntu-ui-toolkit/palette into lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/jenkins-test

Proposed by Zsombor Egri on 2016-01-15
Status: Merged
Approved by: Timo Jyrinki on 2016-01-15
Approved revision: 1775
Merged at revision: 1802
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/palette
Merge into: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/jenkins-test
Diff against target: 4787 lines (+1958/-742)
94 files modified
components.api (+49/-1)
debian/changelog (+40/-0)
documentation/ubuntu-theming.qdoc (+0/-6)
examples/ubuntu-ui-toolkit-gallery/About.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Colors.qml (+39/-9)
examples/ubuntu-ui-toolkit-gallery/NewListItems.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Popover.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Template.qml (+2/-0)
examples/ubuntu-ui-toolkit-gallery/gallery-logging.config (+3/-0)
src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+2/-2)
src/Ubuntu/Components/1.3/Icon.qdoc (+0/-87)
src/Ubuntu/Components/1.3/Icon.qml (+150/-0)
src/Ubuntu/Components/1.3/MainView.qml (+2/-1)
src/Ubuntu/Components/1.3/MainViewBase.qml (+13/-0)
src/Ubuntu/Components/1.3/Page.qml (+19/-4)
src/Ubuntu/Components/1.3/PageHeader.qml (+1/-1)
src/Ubuntu/Components/1.3/TextArea.qml (+1/-2)
src/Ubuntu/Components/1.3/TextField.qml (+1/-2)
src/Ubuntu/Components/1.3/Toolbar.qml (+1/-1)
src/Ubuntu/Components/1.3/UbuntuColors.qml (+65/-16)
src/Ubuntu/Components/ComponentModule.pro (+2/-1)
src/Ubuntu/Components/ListItems/1.3/LabelVisual.qml (+9/-2)
src/Ubuntu/Components/Popups/1.3/Dialog.qml (+9/-2)
src/Ubuntu/Components/Popups/1.3/Popover.qml (+8/-0)
src/Ubuntu/Components/Themes/1.3/Palette.qml (+13/-1)
src/Ubuntu/Components/Themes/1.3/PaletteValues.qml (+77/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml (+47/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml (+2/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml (+10/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml (+10/-12)
src/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml (+3/-3)
src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml (+5/-4)
src/Ubuntu/Components/Themes/Ambiance/1.3/OverflowPanel.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+3/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml (+28/-20)
src/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml (+3/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml (+2/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml (+8/-8)
src/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml (+26/-156)
src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml (+13/-5)
src/Ubuntu/Components/Themes/Ambiance/1.3/ToolbarButtonStyle.qml (+5/-0)
src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro (+1/-0)
src/Ubuntu/Components/Themes/Ambiance/qmldir (+1/-0)
src/Ubuntu/Components/Themes/SuruDark/1.2/ListItemStyle.qml (+0/-25)
src/Ubuntu/Components/Themes/SuruDark/1.3/ListItemStyle.qml (+0/-26)
src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml (+28/-20)
src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml (+47/-0)
src/Ubuntu/Components/Themes/SuruDark/SuruDark.pro (+1/-2)
src/Ubuntu/Components/Themes/SuruDark/qmldir (+1/-0)
src/Ubuntu/Components/plugin/adapters/actionsproxy_p.cpp (+73/-63)
src/Ubuntu/Components/plugin/adapters/actionsproxy_p.h (+8/-7)
src/Ubuntu/Components/plugin/plugin.cpp (+5/-7)
src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp (+10/-7)
src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h (+3/-1)
src/Ubuntu/Components/plugin/ucaction.cpp (+65/-9)
src/Ubuntu/Components/plugin/ucaction.h (+18/-0)
src/Ubuntu/Components/plugin/ucactioncontext.cpp (+138/-9)
src/Ubuntu/Components/plugin/ucactioncontext.h (+45/-3)
src/Ubuntu/Components/plugin/ucactionitem.cpp (+3/-1)
src/Ubuntu/Components/plugin/ucbottomedge.cpp (+3/-3)
src/Ubuntu/Components/plugin/ucbottomedge_p.h (+0/-1)
src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp (+29/-16)
src/Ubuntu/Components/plugin/ucdeprecatedtheme.h (+5/-7)
src/Ubuntu/Components/plugin/uclabel.cpp (+6/-3)
src/Ubuntu/Components/plugin/uclistitem.cpp (+35/-22)
src/Ubuntu/Components/plugin/uclistitem_p.h (+1/-1)
src/Ubuntu/Components/plugin/uclistitemlayout.cpp (+80/-4)
src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+3/-2)
src/Ubuntu/Components/plugin/uctheme.cpp (+75/-62)
src/Ubuntu/Components/plugin/uctheme.h (+6/-12)
src/Ubuntu/Components/plugin/ucthemingextension.cpp (+32/-8)
src/Ubuntu/Components/plugin/ucthemingextension.h (+3/-3)
src/Ubuntu/Components/qmldir (+2/-0)
src/Ubuntu/UbuntuGestures/ucswipearea.cpp (+7/-4)
src/src.pro (+1/-0)
tests/unit/tst_components/tst_action.qml (+14/-6)
tests/unit_x11/tst_bottomedge/LeanActiveRegionChange.qml (+1/-1)
tests/unit_x11/tst_components/AppTheme/Palette.qml (+1/-1)
tests/unit_x11/tst_components/MockKeyboard.qml (+1/-1)
tests/unit_x11/tst_components/tst_contextual_actions.qml (+326/-0)
tests/unit_x11/tst_components/tst_listitem.qml (+3/-5)
tests/unit_x11/tst_components/tst_listitem13.qml (+3/-5)
tests/unit_x11/tst_components/tst_pagestack.qml (+6/-0)
tests/unit_x11/tst_components/tst_shortcuts.qml (+32/-8)
tests/unit_x11/tst_components/tst_slotslayout.qml (+47/-2)
tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp (+24/-16)
tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro (+1/-1)
tests/unit_x11/tst_subtheming/DefaultTheme.qml (+28/-0)
tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+53/-4)
tests/unit_x11/tst_subtheming/tst_subtheming.pro (+3/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/palette
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-01-15
Timo Jyrinki (community) 2016-01-15 Approve on 2016-01-15
Review via email: mp+282696@code.launchpad.net

Commit message

Test for Palette fixes MR.

To post a comment you must log in.
Timo Jyrinki (timo-jyrinki) wrote :

wowzee, really cool!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2015-12-19 10:06:24 +0000
3+++ components.api 2016-01-15 07:23:58 +0000
4@@ -498,6 +498,11 @@
5 property string name
6 Ubuntu.Components.Icon 1.1: Icon
7 property url source
8+Ubuntu.Components.Icon 1.3: Item
9+ property color color
10+ property color keyColor
11+ property string name
12+ property url source
13 Ubuntu.Components.InverseMouse 1.0 0.1 UCInverseMouse: Mouse
14 Ubuntu.Components.InverseMouseArea 1.0 0.1 InverseMouseAreaType: MouseArea
15 function bool contains(QPointF point)
16@@ -715,6 +720,7 @@
17 Ubuntu.Components.Page 1.1 Page11: Page10
18 readonly property PageHeadConfiguration head
19 Ubuntu.Components.Page 1.3: PageTreeNode
20+ readonly property ActionContext actionContext
21 property Flickable flickable
22 readonly property PageHeadConfiguration head
23 property Item header
24@@ -830,8 +836,10 @@
25 property PaletteValues normal
26 property PaletteValues selected
27 Ubuntu.Components.Themes.Palette 1.3: QtObject
28+ property PaletteValues inactive
29 property PaletteValues normal
30 property PaletteValues selected
31+ property PaletteValues selectedInactive
32 Ubuntu.Components.Themes.PaletteValues 0.1: QtObject
33 property color background
34 property color backgroundText
35@@ -845,7 +853,11 @@
36 property color overlayText
37 property color selection
38 Ubuntu.Components.Themes.PaletteValues 1.3: QtObject
39+ property color activity
40+ property color activityText
41 property color background
42+ property color backgroundSecondaryText
43+ property color backgroundTertiaryText
44 property color backgroundText
45 property color base
46 property color baseText
47@@ -853,9 +865,18 @@
48 property color fieldText
49 property color foreground
50 property color foregroundText
51+ property color negative
52+ property color negativeText
53 property color overlay
54+ property color overlaySecondaryText
55 property color overlayText
56+ property color positive
57+ property color positiveText
58+ property color raised
59+ property color raisedSecondaryText
60+ property color raisedText
61 property color selection
62+ property color selectionText
63 Ubuntu.Components.Panel 1.0 0.1: Item
64 property int align
65 property bool animate
66@@ -947,6 +968,7 @@
67 property bool grabDismissAreaEvents
68 function var show()
69 function var hide()
70+Ubuntu.Components.PopupContext 1.3 UCPopupContext: ActionContext
71 Ubuntu.Components.Popups.PopupUtils 0.1 1.0 1.3
72 Ubuntu.Components.ProgressBar 1.0 0.1: AnimatedItem
73 property bool indeterminate
74@@ -963,7 +985,10 @@
75 property bool onScreen
76 property bool showProgressPercentage
77 property double value
78-Ubuntu.Components.ProgressionSlot 1.3: Icon
79+Ubuntu.Components.ProgressionSlot 1.3: Item
80+ property color color
81+ property color keyColor
82+ property string name
83 property url source
84 Ubuntu.Components.ProportionalShape 1.3 UCProportionalShape: UbuntuShape
85 Ubuntu.Components.PullToRefresh 1.1: StyledItem
86@@ -1491,6 +1516,7 @@
87 property Item pageStack
88 Ubuntu.Components.Styles.ToolbarStyle 1.3: Item
89 property Component defaultDelegate
90+UCActionContextAttached: QtObject
91 Ubuntu.Components.UCApplication 1.0 0.1: QtObject
92 property string applicationName
93 property QtObject inputMethod
94@@ -1558,6 +1584,28 @@
95 readonly property color purple
96 readonly property color red
97 readonly property color warmGrey
98+Ubuntu.Components.UbuntuColors 1.3: QtObject singleton
99+ readonly property color ash
100+ readonly property color blue
101+ readonly property color coolGrey
102+ readonly property color darkAubergine
103+ readonly property color darkGrey
104+ readonly property color graphite
105+ readonly property color green
106+ property Gradient greyGradient
107+ readonly property color inkstone
108+ readonly property color jet
109+ readonly property color lightAubergine
110+ readonly property color lightGrey
111+ readonly property color midAubergine
112+ readonly property color orange
113+ property Gradient orangeGradient
114+ readonly property color porcelain
115+ readonly property color purple
116+ readonly property color red
117+ readonly property color silk
118+ readonly property color slate
119+ readonly property color warmGrey
120 Ubuntu.Components.UbuntuListView 1.0 0.1: ListView
121 property int expandedIndex
122 Ubuntu.Components.UbuntuListView 1.1 UbuntuListView11: UbuntuListView
123
124=== modified file 'debian/changelog'
125--- debian/changelog 2015-12-21 21:09:04 +0000
126+++ debian/changelog 2016-01-15 07:23:58 +0000
127@@ -1,3 +1,43 @@
128+ubuntu-ui-toolkit (1.3.1795+16.04.20160106-0ubuntu1) xenial; urgency=medium
129+
130+ [ Christian Dywan ]
131+ * Fix typo in runtest.sh: $? is the error code, not $*.
132+ * Document use of RegExpValidator for password/ PIN input.
133+ * Include filename derived QML class name in .api. Fixes LP: #1527138
134+ * Use edit-clear for clear button instead of the invalid clear search.
135+ * No transparency in focus outline.
136+ * Give the original Toolbar its name back.
137+ * Fix typo in runtest.sh: $? is the error code, not $*.
138+ * Use resolved filename but add fragment. Fixes LP: #1401920
139+
140+ [ Zoltán Balogh ]
141+ * Use build root for the Gestures library instead of relative path.
142+ * Fix the tests for the gallery change
143+
144+ [ Zsombor Egri ]
145+ * Add mnemonics support to Action. Fixes LP: #1527527
146+ * Use original Image.source in image extension when no scaling is needed in
147+ order to keep the formatting which would be otherwise removed from a
148+ resolved file URL. Fixes LP: #1401920
149+ * Move UbuntuListView 1.3 code into one single file. Fixes LP: #1523815
150+
151+ [ Albert Astals Cid ]
152+ * Add UCTestExtras::removeTimeConstraintsFromSwipeArea
153+ For that needed to move ucswipearea.cpp from UbuntuComponents to
154+ UbuntuGestures but made it in a private header so we don't have to care much
155+ for the API/ABI stability for now.
156+
157+ [ Andrea Bernabei ]
158+ * make scrollbars tests more robust.
159+
160+ [ Tim Peeters ]
161+ * Update font sizes. Fixes LP: #1528263
162+
163+ [ CI Train Bot ]
164+ * No-change rebuild.
165+
166+ -- Zoltan Balogh <zoltan.balogh@canonical.com> Wed, 06 Jan 2016 04:27:02 +0000
167+
168 ubuntu-ui-toolkit (1.3.1778+16.04.20151221-0ubuntu1) xenial; urgency=medium
169
170 [ Tim Peeters ]
171
172=== modified file 'documentation/ubuntu-theming.qdoc'
173--- documentation/ubuntu-theming.qdoc 2015-08-11 10:01:34 +0000
174+++ documentation/ubuntu-theming.qdoc 2016-01-15 07:23:58 +0000
175@@ -270,17 +270,11 @@
176 * The extended (or even overridden) style component documents must follow the naming
177 * convention, and must have the names implied by the components styled.
178 *
179- * SuruDark theme overrides the Ambiance theme's ListItemStyle, therefore declares the
180- * ListItemStyle.qml document, with the following content:
181- * \snippet Themes/SuruDark/1.3/ListItemStyle.qml 0
182- *
183 * The style imports the Ambiance theme module, and extends the Ambiance ListItemStyle
184 * component. The same is done in the other style components. However, Palette defines
185 * own values, and does not re-use Ambiance palette values.
186 * \snippet Themes/SuruDark/1.3/Palette.qml 0
187 *
188- * The same is done with TabBarStyle and OptionSelectorStyle components.
189- *
190 * \note If a theme derived from SuruDark wants to override style components not present
191 * in SuruDark, they must import the SuruDark's parent theme in the style component.
192 * As example, if FancyTheme would want to override the SwitchStyle, it would need to
193
194=== modified file 'examples/ubuntu-ui-toolkit-gallery/About.qml'
195--- examples/ubuntu-ui-toolkit-gallery/About.qml 2015-10-23 14:46:16 +0000
196+++ examples/ubuntu-ui-toolkit-gallery/About.qml 2016-01-15 07:23:58 +0000
197@@ -23,7 +23,7 @@
198 theme: ThemeSettings {
199 name: "Ubuntu.Components.Themes.SuruDark"
200 palette: Palette {
201- normal.background: UbuntuColors.darkGrey
202+ normal.background: UbuntuColors.slate
203 }
204 }
205 style: Rectangle {
206
207=== modified file 'examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml'
208--- examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml 2015-12-02 08:23:14 +0000
209+++ examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml 2016-01-15 07:23:58 +0000
210@@ -132,7 +132,7 @@
211 objectName: "CustomRegion1"
212 enabled: regionConfig.model >= 1
213 to: 0.3
214- property color baseColor: UbuntuColors.lightGrey
215+ property color baseColor: UbuntuColors.silk
216 },
217 BottomEdgeRegion {
218 objectName: "CustomRegion2"
219
220=== modified file 'examples/ubuntu-ui-toolkit-gallery/Colors.qml'
221--- examples/ubuntu-ui-toolkit-gallery/Colors.qml 2015-07-22 13:14:43 +0000
222+++ examples/ubuntu-ui-toolkit-gallery/Colors.qml 2016-01-15 07:23:58 +0000
223@@ -33,15 +33,45 @@
224 }
225 }
226 TemplateRow {
227- title: i18n.tr("Light grey")
228- UbuntuShape {
229- backgroundColor: UbuntuColors.lightGrey
230- }
231- }
232- TemplateRow {
233- title: i18n.tr("Dark grey")
234- UbuntuShape {
235- backgroundColor: UbuntuColors.darkGrey
236+ title: i18n.tr("Porcelain")
237+ UbuntuShape {
238+ backgroundColor: UbuntuColors.porcelain
239+ }
240+ }
241+ TemplateRow {
242+ title: i18n.tr("Silk")
243+ UbuntuShape {
244+ backgroundColor: UbuntuColors.silk
245+ }
246+ }
247+ TemplateRow {
248+ title: i18n.tr("Ash")
249+ UbuntuShape {
250+ backgroundColor: UbuntuColors.ash
251+ }
252+ }
253+ TemplateRow {
254+ title: i18n.tr("Graphite")
255+ UbuntuShape {
256+ backgroundColor: UbuntuColors.graphite
257+ }
258+ }
259+ TemplateRow {
260+ title: i18n.tr("Slate")
261+ UbuntuShape {
262+ backgroundColor: UbuntuColors.slate
263+ }
264+ }
265+ TemplateRow {
266+ title: i18n.tr("Inkstone")
267+ UbuntuShape {
268+ backgroundColor: UbuntuColors.inkstone
269+ }
270+ }
271+ TemplateRow {
272+ title: i18n.tr("Jet")
273+ UbuntuShape {
274+ backgroundColor: UbuntuColors.jet
275 }
276 }
277 TemplateRow {
278
279=== modified file 'examples/ubuntu-ui-toolkit-gallery/NewListItems.qml'
280--- examples/ubuntu-ui-toolkit-gallery/NewListItems.qml 2015-09-28 12:26:13 +0000
281+++ examples/ubuntu-ui-toolkit-gallery/NewListItems.qml 2016-01-15 07:23:58 +0000
282@@ -163,7 +163,7 @@
283 model: [ i18n.tr("Basic"), i18n.tr("Colored divider"), i18n.tr("Immutable"), i18n.tr("No divider") ]
284 delegate: ListItemWithLabel {
285 title.text: modelData
286- color: dragging ? "lightblue" : "transparent"
287+ color: dragging ? theme.palette.selected.base : "transparent"
288 divider {
289 colorFrom: modelData == i18n.tr("Colored divider") ? UbuntuColors.red : Qt.rgba(0.0, 0.0, 0.0, 0.0)
290 colorTo: modelData == i18n.tr("Colored divider") ? UbuntuColors.green : Qt.rgba(0.0, 0.0, 0.0, 0.0)
291
292=== modified file 'examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml'
293--- examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml 2015-12-15 15:08:49 +0000
294+++ examples/ubuntu-ui-toolkit-gallery/PageHeaders.qml 2016-01-15 07:23:58 +0000
295@@ -81,7 +81,7 @@
296 width: label.width + units.gu(4)
297 height: parent.height
298 Rectangle {
299- color: UbuntuColors.darkGrey
300+ color: UbuntuColors.slate
301 opacity: 0.1
302 anchors.fill: parent
303 visible: button.pressed
304
305=== modified file 'examples/ubuntu-ui-toolkit-gallery/Popover.qml'
306--- examples/ubuntu-ui-toolkit-gallery/Popover.qml 2015-06-24 16:16:51 +0000
307+++ examples/ubuntu-ui-toolkit-gallery/Popover.qml 2016-01-15 07:23:58 +0000
308@@ -21,7 +21,7 @@
309 Template {
310 objectName: "popoversTemplate"
311
312- head.actions: [
313+ trailingActions: [
314 Action {
315 text: "Actions"
316 iconSource: "call_icon.png"
317
318=== modified file 'examples/ubuntu-ui-toolkit-gallery/Template.qml'
319--- examples/ubuntu-ui-toolkit-gallery/Template.qml 2015-12-16 15:02:33 +0000
320+++ examples/ubuntu-ui-toolkit-gallery/Template.qml 2016-01-15 07:23:58 +0000
321@@ -23,12 +23,14 @@
322 default property alias content: column.children
323 property alias spacing: column.spacing
324 property alias scrollable: templateFlickable.interactive
325+ property list<Action> trailingActions
326 flickable: templateFlickable
327
328 header: PageHeader {
329 title: template.title
330 flickable: layout.columns === 1 ? templateFlickable : null
331 onFlickableChanged: exposed = true;
332+ trailingActionBar.actions: trailingActions
333 }
334
335 ScrollView {
336
337=== modified file 'examples/ubuntu-ui-toolkit-gallery/gallery-logging.config'
338--- examples/ubuntu-ui-toolkit-gallery/gallery-logging.config 2015-12-11 10:24:51 +0000
339+++ examples/ubuntu-ui-toolkit-gallery/gallery-logging.config 2016-01-15 07:23:58 +0000
340@@ -4,3 +4,6 @@
341 ubuntu.components.SwipeArea.ActiveTouchInfo.debug=false
342 ubuntu.components.BottomEdge.debug=false
343 ubuntu.components.PageTreeNode.debug=false
344+ubuntu.components.Action.debug=false
345+ubuntu.components.ActionContext.debug=false
346+ubuntu.components.ActionProxy.debug=false
347
348=== modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml'
349--- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-01-06 11:24:54 +0000
350+++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-01-15 07:23:58 +0000
351@@ -810,7 +810,7 @@
352 rightMargin: dividerThickness
353 }
354 width: (column == (d.columns - 1)) || !pageWrapper ? 0 : units.dp(1)
355- color: theme.palette.selected.background
356+ color: theme.palette.normal.base
357 MouseArea {
358 id: resizerSensing
359 objectName: "Divider"
360@@ -835,7 +835,7 @@
361 when: resizerSensing.pressed
362 PropertyChanges {
363 target: verticalDivider
364- color: Qt.darker(theme.palette.normal.background, 1.5)
365+ color: Qt.darker(theme.palette.normal.background, 1.7)
366 }
367 }
368 transitions: Transition {
369
370=== removed file 'src/Ubuntu/Components/1.3/Icon.qdoc'
371--- src/Ubuntu/Components/1.3/Icon.qdoc 2015-04-25 08:54:58 +0000
372+++ src/Ubuntu/Components/1.3/Icon.qdoc 1970-01-01 00:00:00 +0000
373@@ -1,87 +0,0 @@
374-/*
375- * Copyright (C) 2014 Canonical, Ltd.
376- *
377- * This program is free software; you can redistribute it and/or modify
378- * it under the terms of the GNU General Public License as published by
379- * the Free Software Foundation; version 3.
380- *
381- * This program is distributed in the hope that it will be useful,
382- * but WITHOUT ANY WARRANTY; without even the implied warranty of
383- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
384- * GNU General Public License for more details.
385- *
386- * You should have received a copy of the GNU General Public License
387- * along with this program. If not, see <http://www.gnu.org/licenses/>.
388- */
389-
390-/*!
391- \qmltype Icon
392- \inqmlmodule Ubuntu.Components 1.1
393- \ingroup ubuntu
394- \brief The Icon component displays an icon from the icon theme.
395-
396- The icon theme contains a set of standard icons referred to by their name.
397- Using icons whenever possible enhances consistency accross applications.
398- Each icon has a name and can have different visual representations depending
399- on the size requested.
400-
401- Icons can also be colorized. Setting the \l color property will make all pixels
402- with the \l keyColor (by default #808080) colored.
403-
404- Example:
405- \qml
406- Icon {
407- width: 64
408- height: 64
409- name: "search"
410- }
411- \endqml
412-
413- Example of colorization:
414- \qml
415- Icon {
416- width: 64
417- height: 64
418- name: "search"
419- color: UbuntuColors.warmGrey
420- }
421- \endqml
422-
423- Icon themes are created following the
424- \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html}{Freedesktop Icon Theme Specification}.
425-*/
426-
427-/*!
428- The name of the icon to display.
429- \qmlproperty string Icon::name
430-
431- If both name and source are set, name will be ignored.
432-
433- \note The complete list of icons available in Ubuntu is not published yet.
434- For now please refer to the folders where the icon themes are installed:
435- \list
436- \li Ubuntu Touch: \l file:/usr/share/icons/suru
437- \li Ubuntu Desktop: \l file:/usr/share/icons/ubuntu-mono-dark
438- \endlist
439- These 2 separate icon themes will be merged soon.
440-*/
441-
442-/*!
443- The source url of the icon to display. It has precedence over name.
444-
445- If both name and source are set, name will be ignored.
446-
447- \since Ubuntu.Components 1.1
448- \qmlproperty url Icon::source
449-*/
450-
451-/*!
452- The color that all pixels that originally are of color \l keyColor should take.
453- \qmlproperty color Icon::color
454-*/
455-
456-/*!
457- The color of the pixels that should be colorized.
458- By default it is set to #808080.
459- \qmlproperty color Icon::keyColor
460-*/
461
462=== added file 'src/Ubuntu/Components/1.3/Icon.qml'
463--- src/Ubuntu/Components/1.3/Icon.qml 1970-01-01 00:00:00 +0000
464+++ src/Ubuntu/Components/1.3/Icon.qml 2016-01-15 07:23:58 +0000
465@@ -0,0 +1,150 @@
466+/*
467+ * Copyright (C) 2015 Canonical, Ltd.
468+ *
469+ * This program is free software; you can redistribute it and/or modify
470+ * it under the terms of the GNU General Public License as published by
471+ * the Free Software Foundation; version 3.
472+ *
473+ * This program is distributed in the hope that it will be useful,
474+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
475+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
476+ * GNU General Public License for more details.
477+ *
478+ * You should have received a copy of the GNU General Public License
479+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
480+ *
481+ * Authors: Zsombor Egri <zsombor.egri@canonical.com>
482+ * Loic Molinari <loic.molinari@canonical.com>
483+ */
484+
485+import QtQuick 2.4
486+
487+/*!
488+ \qmltype Icon
489+ \inqmlmodule Ubuntu.Components 1.3
490+ \inherits Item
491+ \ingroup ubuntu
492+ \brief The Icon component displays an icon from the icon theme.
493+
494+ The icon theme contains a set of standard icons referred to by their name.
495+ Using icons whenever possible enhances consistency accross applications.
496+ Each icon has a name and can have different visual representations depending
497+ on the size requested.
498+
499+ Icons can also be colorized. Setting the \l color property will make all pixels
500+ with the \l keyColor (by default #808080) colored.
501+
502+ Example:
503+ \qml
504+ Icon {
505+ width: 64
506+ height: 64
507+ name: "search"
508+ }
509+ \endqml
510+
511+ Example of colorization:
512+ \qml
513+ Icon {
514+ width: 64
515+ height: 64
516+ name: "search"
517+ color: UbuntuColors.warmGrey
518+ }
519+ \endqml
520+
521+ Icon themes are created following the
522+ \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html}{Freedesktop Icon Theme Specification}.
523+*/
524+
525+Item {
526+ id: icon
527+
528+ /*!
529+ The name of the icon to display.
530+ \qmlproperty string Icon::name
531+
532+ If both name and source are set, name will be ignored.
533+
534+ \note The complete list of icons available in Ubuntu is not published yet.
535+ For now please refer to the folders where the icon themes are installed:
536+ \list
537+ \li Ubuntu Touch: \l file:/usr/share/icons/suru
538+ \li Ubuntu Desktop: \l file:/usr/share/icons/ubuntu-mono-dark
539+ \endlist
540+ These 2 separate icon themes will be merged soon.
541+ */
542+ property string name
543+
544+ /*!
545+ The color that all pixels that originally are of color \l keyColor should take.
546+ \qmlproperty color Icon::color
547+ */
548+
549+ property alias color: colorizedImage.keyColorOut
550+
551+ /*!
552+ The color of the pixels that should be colorized.
553+ By default it is set to #808080.
554+ \qmlproperty color Icon::keyColor
555+ */
556+ property alias keyColor: colorizedImage.keyColorIn
557+
558+ /*!
559+ The source url of the icon to display. It has precedence over name.
560+
561+ If both name and source are set, name will be ignored.
562+
563+ \since Ubuntu.Components 1.1
564+ \qmlproperty url Icon::source
565+ */
566+
567+ property alias source: image.source
568+
569+ implicitWidth: image.implicitWidth
570+ implicitHeight: image.implicitHeight
571+
572+ Image {
573+ id: image
574+ objectName: "image"
575+ anchors.fill: parent
576+ fillMode: Image.PreserveAspectFit
577+
578+ sourceSize {
579+ width: icon.width
580+ height: icon.height
581+ }
582+
583+ source: icon.name ? "image://theme/%1".arg(icon.name) : ""
584+
585+ cache: true
586+ visible: !colorizedImage.visible
587+ }
588+
589+ ShaderEffect {
590+ id: colorizedImage
591+ objectName: "shader"
592+
593+ anchors.fill: parent
594+
595+ // Whether or not a color has been set.
596+ visible: image.status == Image.Ready && keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)
597+
598+ property Image source: image
599+ property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
600+ property color keyColorIn: "#808080"
601+ property real threshold: 0.1
602+
603+ fragmentShader: "
604+ varying highp vec2 qt_TexCoord0;
605+ uniform sampler2D source;
606+ uniform highp vec4 keyColorOut;
607+ uniform highp vec4 keyColorIn;
608+ uniform lowp float threshold;
609+ uniform lowp float qt_Opacity;
610+ void main() {
611+ lowp vec4 sourceColor = texture2D(source, qt_TexCoord0);
612+ gl_FragColor = mix(keyColorOut * vec4(sourceColor.a), sourceColor, step(threshold, distance(sourceColor.rgb / sourceColor.a, keyColorIn.rgb))) * qt_Opacity;
613+ }"
614+ }
615+}
616
617=== modified file 'src/Ubuntu/Components/1.3/MainView.qml'
618--- src/Ubuntu/Components/1.3/MainView.qml 2016-01-06 11:24:54 +0000
619+++ src/Ubuntu/Components/1.3/MainView.qml 2016-01-15 07:23:58 +0000
620@@ -162,7 +162,8 @@
621 // don't show the application header if the page has its own header.
622 visible: !(internal.activePage &&
623 internal.activePage.hasOwnProperty("header") &&
624- internal.activePage.header)
625+ internal.activePage.header) &&
626+ internal.activePage
627
628 height: visible ? implicitHeight : 0
629
630
631=== modified file 'src/Ubuntu/Components/1.3/MainViewBase.qml'
632--- src/Ubuntu/Components/1.3/MainViewBase.qml 2015-12-08 18:34:40 +0000
633+++ src/Ubuntu/Components/1.3/MainViewBase.qml 2016-01-15 07:23:58 +0000
634@@ -159,6 +159,19 @@
635 }
636 }
637
638+ /*!
639+ \qmlproperty ActrionContext MainView::actionContext
640+ \readonly
641+ \since Ubuntu.Components 1.3
642+ The action context of the MainView.
643+ */
644+ readonly property alias actionContext: localContext
645+ Toolkit.PopupContext {
646+ id: localContext
647+ objectName: "RootContext"
648+ active: true
649+ }
650+
651 onApplicationNameChanged: {
652 if (applicationName !== "") {
653 i18n.domain = applicationName;
654
655=== modified file 'src/Ubuntu/Components/1.3/Page.qml'
656--- src/Ubuntu/Components/1.3/Page.qml 2015-12-08 18:34:40 +0000
657+++ src/Ubuntu/Components/1.3/Page.qml 2016-01-15 07:23:58 +0000
658@@ -15,12 +15,13 @@
659 */
660
661 import QtQuick 2.4
662-import Ubuntu.Components 1.3 as Toolkit13
663+import Ubuntu.Components 1.3
664 import "pageUtils.js" as Utils
665
666 /*!
667 \qmltype Page
668 \inqmlmodule Ubuntu.Components 1.1
669+ \inherits StyledItem
670 \ingroup ubuntu
671 \brief A page is the basic Item that must be used inside the \l MainView,
672 \l PageStack and \l Tabs.
673@@ -69,7 +70,7 @@
674 use a Page inside a Loader, but in that case do not set the anchors or size of the Loader
675 so that the Page can control its width and height.
676 */
677-Toolkit13.PageTreeNode {
678+PageTreeNode {
679 id: page
680 anchors {
681 left: parent ? parent.left : undefined
682@@ -81,6 +82,20 @@
683 height: parentNode ? page.flickable ? parentNode.height : parentNode.height - internal.headerHeight : undefined
684
685 /*!
686+ \qmlproperty ActrionContext Page::actionContext
687+ \readonly
688+ \since Ubuntu.Components 1.3
689+ The action context of the page.
690+ */
691+ readonly property alias actionContext: localContext
692+ ActionContext {
693+ id: localContext
694+ active: page.active
695+ objectName: page.objectName + "Context"
696+ }
697+
698+ /*!
699+ \since Ubuntu.Components 1.3
700 The header property for this page. Setting this property will reparent the
701 header to the page and disable the \l MainView's application header.
702 \qml
703@@ -157,13 +172,13 @@
704 Deprecated: This configuration will be replaced by setting the \l header property.
705 */
706 readonly property alias head: headerConfig
707- Toolkit13.PageHeadConfiguration {
708+ PageHeadConfiguration {
709 id: headerConfig
710 title: page.title
711 flickable: page.flickable
712 }
713
714- Toolkit13.Object {
715+ Object {
716 id: internal
717
718 property Item previousHeader: null
719
720=== modified file 'src/Ubuntu/Components/1.3/PageHeader.qml'
721--- src/Ubuntu/Components/1.3/PageHeader.qml 2015-12-15 14:20:33 +0000
722+++ src/Ubuntu/Components/1.3/PageHeader.qml 2016-01-15 07:23:58 +0000
723@@ -32,7 +32,7 @@
724 StyleHints {
725 foregroundColor: UbuntuColors.orange
726 backgroundColor: "black"
727- dividerColor: UbuntuColors.darkGrey
728+ dividerColor: UbuntuColors.slate
729 }
730 }
731 \endqml
732
733=== modified file 'src/Ubuntu/Components/1.3/TextArea.qml'
734--- src/Ubuntu/Components/1.3/TextArea.qml 2015-12-14 15:15:46 +0000
735+++ src/Ubuntu/Components/1.3/TextArea.qml 2016-01-15 07:23:58 +0000
736@@ -757,7 +757,6 @@
737
738 //internals
739
740- opacity: enabled ? 1.0 : 0.3
741 activeFocusOnPress: true
742 activeFocusOnTab: true
743
744@@ -827,7 +826,7 @@
745 }
746 // hint is shown till user types something in the field
747 visible: (editor.text == "") && !editor.inputMethodComposing
748- color: theme.palette.normal.backgroundText
749+ color: theme.palette.normal.base
750 font: editor.font
751 elide: Text.ElideRight
752 wrapMode: Text.WordWrap
753
754=== modified file 'src/Ubuntu/Components/1.3/TextField.qml'
755--- src/Ubuntu/Components/1.3/TextField.qml 2015-12-22 09:56:19 +0000
756+++ src/Ubuntu/Components/1.3/TextField.qml 2016-01-15 07:23:58 +0000
757@@ -833,7 +833,6 @@
758
759 // internals
760
761- opacity: enabled ? 1.0 : 0.3
762 activeFocusOnPress: true
763 activeFocusOnTab: true
764
765@@ -977,7 +976,7 @@
766 }
767 // hint is shown till user types something in the field
768 visible: (editor.text == "") && !editor.inputMethodComposing
769- color: theme.palette.normal.backgroundText
770+ color: theme.palette.normal.base
771 font: editor.font
772 elide: Text.ElideRight
773 }
774
775=== modified file 'src/Ubuntu/Components/1.3/Toolbar.qml'
776--- src/Ubuntu/Components/1.3/Toolbar.qml 2015-12-15 15:08:49 +0000
777+++ src/Ubuntu/Components/1.3/Toolbar.qml 2016-01-15 07:23:58 +0000
778@@ -35,7 +35,7 @@
779 width: label.width + units.gu(4)
780 height: parent.height
781 Rectangle {
782- color: UbuntuColors.darkGrey
783+ color: UbuntuColors.slate
784 opacity: 0.1
785 anchors.fill: parent
786 visible: button.pressed
787
788=== modified file 'src/Ubuntu/Components/1.3/UbuntuColors.qml'
789--- src/Ubuntu/Components/1.3/UbuntuColors.qml 2015-04-25 08:54:58 +0000
790+++ src/Ubuntu/Components/1.3/UbuntuColors.qml 2016-01-15 07:23:58 +0000
791@@ -19,7 +19,7 @@
792
793 /*!
794 \qmltype UbuntuColors
795- \inqmlmodule Ubuntu.Components 1.1
796+ \inqmlmodule Ubuntu.Components 1.3
797 \ingroup ubuntu
798 \brief Singleton defining the Ubuntu color palette.
799
800@@ -37,13 +37,10 @@
801 \endqml
802 */
803 QtObject {
804- // old colors from UbuntuColors 1.0:
805
806- /*!
807- Orange. Recommended for branded elements, display progress
808- and intensity, textual links on light backgrounds.
809- */
810- readonly property color orange: "#DD4814"
811+ /*---------------------------------------------------------------
812+ Deprecated colors
813+ ---------------------------------------------------------------*/
814 /*!
815 \deprecated
816 Ubuntu supporting color: light aubergine
817@@ -72,7 +69,7 @@
818
819 /*!
820 Ubuntu orange gradient
821-
822+ \deprecated
823 \sa Button::gradient
824 */
825 property Gradient orangeGradient: Gradient {
826@@ -81,7 +78,7 @@
827 }
828 /*!
829 Ubuntu grey gradient
830-
831+ \deprecated
832 \sa Button::gradient
833 */
834 property Gradient greyGradient: Gradient {
835@@ -89,39 +86,61 @@
836 GradientStop { position: 1.0; color: "#BBBBBB" }
837 }
838
839- // New colors introduced in UbuntuColors 1.1:
840+ /*---------------------------------------------------------------
841+ Supported colors
842+ ---------------------------------------------------------------*/
843+ /*!
844+ Orange. Recommended for branded elements, display progress
845+ and intensity, textual links on light backgrounds.
846+ */
847+ readonly property color orange: "#E95420"
848
849 /*!
850+ \deprecated
851 Light grey. Recommended for neutral action buttons and
852 secondary text.
853 \since Ubuntu.Components 1.1
854 */
855- readonly property color lightGrey: "#929292"
856-
857- /*!
858+ readonly property color lightGrey: "#cdcdcd"
859+
860+ /*!
861+ Silk. Recommended for neutral action buttons and
862+ secondary text.
863+ \since Ubuntu.Components 1.3
864+ */
865+ readonly property color silk: "#cdcdcd"
866+
867+ /*!
868+ \deprecated
869 Dark grey. Recommended for text and action icons.
870 \since Ubuntu.Components 1.1
871 */
872 readonly property color darkGrey: "#5d5d5d"
873
874 /*!
875+ Slate. Recommended for text and action icons.
876+ \since Ubuntu.Components 1.3
877+ */
878+ readonly property color slate: "#5d5d5d"
879+
880+ /*!
881 Red. Recommended for negative and irreversible action
882 buttons, errors and alerts.
883 \since Ubuntu.Components 1.1
884 */
885- readonly property color red: "#f32c36"
886+ readonly property color red: "#ed3146"
887
888 /*!
889 Green. Recommended for positive action buttons.
890 \since Ubuntu.Components 1.1
891 */
892- readonly property color green: "#00a132"
893+ readonly property color green: "#3eb34f"
894
895 /*!
896 Blue. Recommended for text selection and text cursor.
897 \since Ubuntu.Components 1.1
898 */
899- readonly property color blue: "#12a3d8"
900+ readonly property color blue: "#19b6ee"
901
902 /*!
903 Purple. Recommended for proper nouns in
904@@ -129,4 +148,34 @@
905 \since Ubuntu.Components 1.1
906 */
907 readonly property color purple: "#762572"
908+
909+ /*!
910+ Porcelain. Recommended for foregrounds.
911+ \since Ubuntu.Components 1.3
912+ */
913+ readonly property color porcelain: "#f7f7f7"
914+
915+ /*!
916+ Ash. Recommended for subtitles and other tertiary content.
917+ \since Ubuntu.Components 1.3
918+ */
919+ readonly property color ash: "#888888"
920+
921+ /*!
922+ Graphite. Recommended for coloring dark themes' background.
923+ \since Ubuntu.Components 1.3
924+ */
925+ readonly property color graphite: "#666666"
926+
927+ /*!
928+ Inkstone. Recommended for foreground colors in dark themes.
929+ \since Ubuntu.Components 1.3
930+ */
931+ readonly property color inkstone: "#3b3b3b"
932+
933+ /*!
934+ Jet. Recommended for content coloring.
935+ \since Ubuntu.Components 1.3
936+ */
937+ readonly property color jet: "#292929"
938 }
939
940=== modified file 'src/Ubuntu/Components/ComponentModule.pro'
941--- src/Ubuntu/Components/ComponentModule.pro 2015-12-17 13:48:23 +0000
942+++ src/Ubuntu/Components/ComponentModule.pro 2016-01-15 07:23:58 +0000
943@@ -131,7 +131,8 @@
944 1.3/PageColumnsLayout.qml \
945 1.3/ProgressionSlot.qml \
946 1.3/ScrollView.qml \
947- 1.3/PageHeader.qml
948+ 1.3/PageHeader.qml \
949+ 1.3/Icon.qml
950
951 OTHER_FILES+= qmldir \
952 1.3/CrossFadeImage.qdoc \
953
954=== modified file 'src/Ubuntu/Components/ListItems/1.3/LabelVisual.qml'
955--- src/Ubuntu/Components/ListItems/1.3/LabelVisual.qml 2015-09-07 10:05:58 +0000
956+++ src/Ubuntu/Components/ListItems/1.3/LabelVisual.qml 2016-01-15 07:23:58 +0000
957@@ -31,7 +31,14 @@
958 }
959
960 elide: Text.ElideRight
961- color: selected ? UbuntuColors.orange : secondary ? overlay ? theme.palette.normal.overlayText : theme.palette.normal.backgroundText
962- : overlay ? theme.palette.selected.overlayText : theme.palette.selected.backgroundText
963+ color: selected
964+ ? UbuntuColors.orange
965+ : (secondary
966+ ? (overlay
967+ ? theme.palette.normal.overlayText
968+ : theme.palette.normal.backgroundText)
969+ : (overlay
970+ ? theme.palette.normal.overlayText
971+ : theme.palette.normal.backgroundText))
972 opacity: label.enabled ? 1.0 : 0.5
973 }
974
975=== modified file 'src/Ubuntu/Components/Popups/1.3/Dialog.qml'
976--- src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-12-14 08:27:39 +0000
977+++ src/Ubuntu/Components/Popups/1.3/Dialog.qml 2016-01-15 07:23:58 +0000
978@@ -180,6 +180,13 @@
979 height: childrenRect.height + foreground.margins
980 onWidthChanged: updateChildrenWidths();
981
982+ // put the context into this component to save ActionContext lookup
983+ PopupContext {
984+ id: localContext
985+ objectName: dialog.objectName + "DialogContext"
986+ active: foreground.visible
987+ }
988+
989 Label {
990 horizontalAlignment: Text.AlignHCenter
991 text: dialog.title
992@@ -187,14 +194,14 @@
993 maximumLineCount: 2
994 elide: Text.ElideRight
995 textSize: Label.Large
996- color: UbuntuColors.darkGrey
997+ color: UbuntuColors.slate
998 visible: (text !== "")
999 }
1000
1001 Label {
1002 horizontalAlignment: Text.AlignHCenter
1003 text: dialog.text
1004- color: UbuntuColors.darkGrey
1005+ color: UbuntuColors.slate
1006 wrapMode: Text.Wrap
1007 visible: (text !== "")
1008 }
1009
1010=== modified file 'src/Ubuntu/Components/Popups/1.3/Popover.qml'
1011--- src/Ubuntu/Components/Popups/1.3/Popover.qml 2015-12-09 12:34:18 +0000
1012+++ src/Ubuntu/Components/Popups/1.3/Popover.qml 2016-01-15 07:23:58 +0000
1013@@ -227,6 +227,14 @@
1014 right: parent.right
1015 }
1016 height: childrenRect.height
1017+
1018+ // put the PopupContext inside the container to save one step
1019+ // in the context lookup
1020+ PopupContext {
1021+ id: popupContext
1022+ objectName: popover.objectName + "PopupContext"
1023+ active: foreground.visible
1024+ }
1025 }
1026
1027 onWidthChanged: internal.updatePosition()
1028
1029=== modified file 'src/Ubuntu/Components/Themes/1.3/Palette.qml'
1030--- src/Ubuntu/Components/Themes/1.3/Palette.qml 2015-04-24 14:34:39 +0000
1031+++ src/Ubuntu/Components/Themes/1.3/Palette.qml 2016-01-15 07:23:58 +0000
1032@@ -48,12 +48,24 @@
1033 */
1034 QtObject {
1035 /*!
1036- Color palette to use when the widget is not in any particular state.
1037+ Color palette to use when the widget is in the default state.
1038 */
1039 property PaletteValues normal: PaletteValues{}
1040+
1041+ /*!
1042+ Color palette to use when the widget is in the inactive (disabled) state.
1043+ */
1044+ property PaletteValues inactive: PaletteValues{}
1045+
1046 /*!
1047 Color palette to use when the widget is selected, for example when
1048 a tab is the current one.
1049 */
1050 property PaletteValues selected: PaletteValues{}
1051+
1052+ /*!
1053+ Color palette values to use when the widget is selected and inactive.
1054+ \since Ubuntu.Components.Themes 1.3
1055+ */
1056+ property PaletteValues selectedInactive: PaletteValues{}
1057 }
1058
1059=== modified file 'src/Ubuntu/Components/Themes/1.3/PaletteValues.qml'
1060--- src/Ubuntu/Components/Themes/1.3/PaletteValues.qml 2015-04-24 14:34:39 +0000
1061+++ src/Ubuntu/Components/Themes/1.3/PaletteValues.qml 2016-01-15 07:23:58 +0000
1062@@ -33,6 +33,17 @@
1063 */
1064 property color backgroundText
1065 /*!
1066+ Color applied to secondary content on the \l background color.
1067+ \since Ubuntu.Components.Themes 1.3
1068+ */
1069+ property color backgroundSecondaryText
1070+ /*!
1071+ Color applied to tertiary content on the \l background color.
1072+ \since Ubuntu.Components.Themes 1.3
1073+ */
1074+ property color backgroundTertiaryText
1075+
1076+ /*!
1077 Color applied to the background of widgets.
1078 */
1079 property color base
1080@@ -41,6 +52,7 @@
1081 Typically used for labels and images.
1082 */
1083 property color baseText
1084+
1085 /*!
1086 Color applied to widgets on top of the base colour.
1087 */
1088@@ -50,9 +62,26 @@
1089 Typically used for labels and images.
1090 */
1091 property color foregroundText
1092+
1093+ /*!
1094+ Color applied to widgets on top of any layer, background or base.
1095+ \since Ubuntu.Components.Themes 1.3
1096+ */
1097+ property color raised
1098+ /*!
1099+ Color applied to elements placed on top of the \l raised color.
1100+ \since Ubuntu.Components.Themes 1.3
1101+ */
1102+ property color raisedText
1103+ /*!
1104+ Color applied to seconday elements placed on top of the \l raised color.
1105+ \since Ubuntu.Components.Themes 1.3
1106+ */
1107+ property color raisedSecondaryText
1108+
1109 /*!
1110 Color applied to the background of widgets floating over other widgets.
1111- For example: popovers, Toolbar.
1112+ For example popovers, menus, dialogs.
1113 */
1114 property color overlay
1115 /*!
1116@@ -61,7 +90,13 @@
1117 */
1118 property color overlayText
1119 /*!
1120- Colour applied to the backgrouhnd of text input fields.
1121+ Color applied to secondary elements placed on top of the \l overlay color.
1122+ \since Ubuntu.Components.Themes 1.3
1123+ */
1124+ property color overlaySecondaryText
1125+
1126+ /*!
1127+ Colour applied to the background of text input fields.
1128 */
1129 property color field
1130 /*!
1131@@ -69,8 +104,48 @@
1132 Typically used for labels and images.
1133 */
1134 property color fieldText
1135+
1136+ /*!
1137+ Colour applied to the positive actions.
1138+ \since Ubuntu.Components.Themes 1.3
1139+ */
1140+ property color positive
1141+ /*!
1142+ Color applied to elements placed on top of the \l positive color.
1143+ \since Ubuntu.Components.Themes 1.3
1144+ */
1145+ property color positiveText
1146+
1147+ /*!
1148+ Colour applied to the negative actions.
1149+ \since Ubuntu.Components.Themes 1.3
1150+ */
1151+ property color negative
1152+ /*!
1153+ Color applied to elements placed on top of the \l negative color.
1154+ \since Ubuntu.Components.Themes 1.3
1155+ */
1156+ property color negativeText
1157+
1158+ /*!
1159+ Colour applied to the activity colors. Typical example is progress indication,
1160+ activity indication.
1161+ \since Ubuntu.Components.Themes 1.3
1162+ */
1163+ property color activity
1164+ /*!
1165+ Color applied to elements placed on top of the \l activity color.
1166+ \since Ubuntu.Components.Themes 1.3
1167+ */
1168+ property color activityText
1169+
1170 /*!
1171 Color applied to selected text in editable components.
1172 */
1173 property color selection
1174+ /*!
1175+ Color applied to elements placed on top of the \l selection color.
1176+ \since Ubuntu.Components.Themes 1.3
1177+ */
1178+ property color selectionText
1179 }
1180
1181=== added file 'src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml'
1182--- src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml 1970-01-01 00:00:00 +0000
1183+++ src/Ubuntu/Components/Themes/Ambiance/1.3/AmbianceNormal.qml 2016-01-15 07:23:58 +0000
1184@@ -0,0 +1,47 @@
1185+/*
1186+ * Copyright 2015 Canonical Ltd.
1187+ *
1188+ * This program is free software; you can redistribute it and/or modify
1189+ * it under the terms of the GNU Lesser General Public License as published by
1190+ * the Free Software Foundation; version 3.
1191+ *
1192+ * This program is distributed in the hope that it will be useful,
1193+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1194+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1195+ * GNU Lesser General Public License for more details.
1196+ *
1197+ * You should have received a copy of the GNU Lesser General Public License
1198+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1199+ */
1200+
1201+import QtQuick 2.4
1202+import Ubuntu.Components 1.3
1203+import Ubuntu.Components.Themes 1.3
1204+
1205+PaletteValues {
1206+ background: "#FFFFFF"
1207+ backgroundText: UbuntuColors.jet
1208+ backgroundSecondaryText: UbuntuColors.slate
1209+ backgroundTertiaryText: UbuntuColors.ash
1210+ base: UbuntuColors.silk
1211+ baseText: UbuntuColors.slate
1212+ foreground: UbuntuColors.porcelain
1213+ foregroundText: UbuntuColors.jet
1214+ raised: "#FFFFFF"
1215+ raisedText: UbuntuColors.slate
1216+ raisedSecondaryText: UbuntuColors.silk
1217+ overlay: "#FFFFFF"
1218+ overlayText: UbuntuColors.slate
1219+ overlaySecondaryText: UbuntuColors.silk
1220+ field: "#FFFFFF"
1221+ fieldText: UbuntuColors.jet
1222+ selection: Qt.rgba(UbuntuColors.orange.r, UbuntuColors.orange.g, UbuntuColors.orange.b, 0.2)
1223+ selectionText: UbuntuColors.jet
1224+ positive: UbuntuColors.green
1225+ positiveText: "#FFFFFF"
1226+ negative: UbuntuColors.red
1227+ negativeText: "#FFFFFF"
1228+ activity: UbuntuColors.blue
1229+ activityText: "#FFFFFF"
1230+}
1231+
1232
1233=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml'
1234--- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2015-11-06 06:29:11 +0000
1235+++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2016-01-15 07:23:58 +0000
1236@@ -102,7 +102,8 @@
1237 centerIn: parent
1238 topMargin: styledItem.height
1239 }
1240- name: "up"
1241+ name: "toolkit_bottom-edge-hint"
1242+ color: theme.palette.normal.overlayText
1243 }
1244
1245 Rectangle {
1246
1247=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml'
1248--- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml 2015-12-10 16:39:45 +0000
1249+++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml 2016-01-15 07:23:58 +0000
1250@@ -27,7 +27,9 @@
1251 revealThreshold: bottomEdge.hint.height + units.gu(2)
1252
1253 // own styling properties
1254- property color backgroundColor: Qt.rgba(0, 0, 0, Math.min(0.25, (height - revealThreshold - panelItem.y) / (height - revealThreshold)))
1255+ property color backgroundColor: !panelItem.collapsing
1256+ ? Qt.rgba(0, 0, 0, Math.min(0.25, (height - revealThreshold - panelItem.y) / (height - revealThreshold)))
1257+ : "transparent"
1258 property color panelColor: theme.palette.normal.overlay
1259 property color shadowColor: "#000000"
1260
1261@@ -43,6 +45,7 @@
1262 Rectangle {
1263 id: panelItem
1264 objectName: "bottomedge_panel"
1265+ property bool collapsing: false
1266 anchors {
1267 left: parent.left
1268 right: parent.right
1269@@ -57,6 +60,12 @@
1270
1271 Behavior on anchors.topMargin { UbuntuNumberAnimation { id: panelBehavior } }
1272
1273+ Connections {
1274+ target: bottomEdge
1275+ onCollapseStarted: panelItem.collapsing = true
1276+ onCollapseCompleted: panelItem.collapsing = false
1277+ }
1278+
1279 state: bottomEdge.status > BottomEdge.Hidden ? "drop-hint" : ""
1280 states: [
1281 State {
1282
1283=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml'
1284--- src/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml 2015-07-22 13:14:43 +0000
1285+++ src/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml 2016-01-15 07:23:58 +0000
1286@@ -28,7 +28,7 @@
1287 /*!
1288 The background color of the bubble.
1289 */
1290- property color color: square ? theme.palette.normal.background : theme.palette.normal.overlay
1291+ property color color: square ? theme.palette.normal.background : theme.palette.normal.raised
1292
1293 property point target
1294 property string direction: "down"
1295@@ -111,7 +111,7 @@
1296 UbuntuShape {
1297 anchors.fill: parent
1298 aspect: UbuntuShape.Flat
1299- backgroundColor: theme.palette.normal.overlay
1300+ backgroundColor: theme.palette.normal.raised
1301 source: bubbleShape.clipContent ? shapeSource : null
1302 visible: !square
1303 }
1304
1305=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml'
1306--- src/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2015-12-09 14:45:54 +0000
1307+++ src/Ubuntu/Components/Themes/Ambiance/1.3/CheckBoxStyle.qml 2016-01-15 07:23:58 +0000
1308@@ -23,19 +23,19 @@
1309 /*!
1310 The padding between the background shape and the outside border of the checkbox.
1311 */
1312- property real backgroundPadding: units.gu(0.33)
1313+ property real backgroundPadding: 0
1314
1315 /*!
1316 The background color when the checkbox is not checked.
1317 */
1318- property color uncheckedBackgroundColor: Qt.rgba(theme.palette.normal.foreground.r,
1319- theme.palette.normal.foreground.g,
1320- theme.palette.normal.foreground.b, 0.2)
1321+ property color uncheckedBackgroundColor: styledItem.enabled
1322+ ? theme.palette.normal.foreground
1323+ : theme.palette.inactive.foreground
1324
1325 /*!
1326 The background color when the checkbox is checked.
1327 */
1328- property color checkedBackgroundColor: UbuntuColors.green
1329+ property color checkedBackgroundColor: styledItem.enabled ? theme.palette.normal.positive : theme.palette.inactive.raised
1330
1331 /*!
1332 The image to show inside the checkbox when it is checked.
1333@@ -45,17 +45,15 @@
1334 /*!
1335 The color of the icon.
1336 */
1337- property color iconColor: theme.palette.normal.foregroundText
1338+ property color iconColor: styledItem.enabled ? theme.palette.normal.positiveText : theme.palette.inactive.raisedText
1339
1340 /*!
1341 The padding between the icon and the border of the thumb.
1342 */
1343- property real iconPadding: backgroundPadding
1344-
1345- opacity: enabled ? 1.0 : 0.5
1346-
1347- implicitWidth: units.gu(3)
1348- implicitHeight: units.gu(3)
1349+ property real iconPadding: units.gu(0.4)
1350+
1351+ implicitWidth: units.gu(2)
1352+ implicitHeight: units.gu(2)
1353
1354 FocusShape {
1355 }
1356
1357=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml'
1358--- src/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml 2015-12-14 15:49:19 +0000
1359+++ src/Ubuntu/Components/Themes/Ambiance/1.3/IconButtonStyle.qml 2016-01-15 07:23:58 +0000
1360@@ -26,7 +26,9 @@
1361 /*!
1362 The color of the icons.
1363 */
1364- property color foregroundColor: "#808080"
1365+ property color foregroundColor: styledItem.enabled
1366+ ? theme.palette.normal.backgroundText
1367+ : theme.palette.inactive.backgroundText
1368
1369 /*!
1370 The background color of the button.
1371@@ -59,7 +61,6 @@
1372 height: iconButtonStyle.iconHeight
1373 source: styledItem.iconSource
1374 color: iconButtonStyle.foregroundColor
1375- opacity: styledItem.enabled ? 1.0 : 0.3
1376 }
1377
1378 Component {
1379@@ -67,7 +68,6 @@
1380 Label {
1381 objectName: styledItem.objectName + "_label"
1382 color: iconButtonStyle.foregroundColor
1383- opacity: styledItem.enabled ? 1.0 : 0.3
1384 text: styledItem.text
1385 textSize: Label.XxSmall
1386 }
1387
1388=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml'
1389--- src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-11-16 16:24:42 +0000
1390+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2016-01-15 07:23:58 +0000
1391@@ -25,10 +25,10 @@
1392 /*
1393 * Coloring properties
1394 */
1395- property color leadingPanelColor: UbuntuColors.red
1396- property color trailingPanelColor: "white"
1397- property color leadingForegroundColor: "white"
1398- property color trailingForegroundColor: theme.palette.normal.foreground
1399+ property color leadingPanelColor: theme.palette.normal.foreground
1400+ property color trailingPanelColor: theme.palette.normal.foreground
1401+ property color leadingForegroundColor: theme.palette.normal.negative
1402+ property color trailingForegroundColor: theme.palette.normal.foregroundText
1403
1404 // anchoring
1405 anchors {
1406@@ -189,6 +189,7 @@
1407 name: "view-grid-symbolic"
1408 opacity: 0.0
1409 scale: 0.5
1410+ color: theme.palette.normal.base
1411 }
1412 Binding {
1413 target: listItemStyle
1414
1415=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/OverflowPanel.qml'
1416--- src/Ubuntu/Components/Themes/Ambiance/1.3/OverflowPanel.qml 2015-09-30 19:03:51 +0000
1417+++ src/Ubuntu/Components/Themes/Ambiance/1.3/OverflowPanel.qml 2016-01-15 07:23:58 +0000
1418@@ -42,7 +42,7 @@
1419 /*!
1420 The foreground color (icon and text) of actions in the panel.
1421 */
1422- property color foregroundColor: theme.palette.selected.backgroundText
1423+ property color foregroundColor: theme.palette.normal.backgroundText
1424
1425 property bool square: true
1426 callerMargin: -units.gu(1) + units.dp(4)
1427
1428=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml'
1429--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2015-12-15 15:39:31 +0000
1430+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-01-15 07:23:58 +0000
1431@@ -21,9 +21,9 @@
1432 Style.PageHeaderStyle {
1433 id: pageHeaderStyle
1434
1435- foregroundColor: theme.palette.selected.backgroundText
1436+ foregroundColor: theme.palette.normal.backgroundText
1437 backgroundColor: theme.palette.normal.background
1438- dividerColor: Qt.rgba(0, 0, 0, 0.1)
1439+ dividerColor: theme.palette.normal.base
1440 property int fontWeight: Font.Light
1441 property int textSize: Label.Large
1442
1443@@ -44,6 +44,7 @@
1444 height: parent ? parent.height : undefined
1445 action: modelData
1446 StyleHints {
1447+ // FIXME: introduce inactiveForegroundColor to PageHeaderStyle
1448 foregroundColor: pageHeaderStyle.foregroundColor
1449 }
1450 }
1451
1452=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml'
1453--- src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml 2015-08-06 22:32:02 +0000
1454+++ src/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml 2016-01-15 07:23:58 +0000
1455@@ -19,25 +19,33 @@
1456 import Ubuntu.Components.Themes 1.3
1457
1458 Palette {
1459- normal {
1460- background: "#FFFFFF"
1461- backgroundText: "#81888888"
1462- base: Qt.rgba(0, 0, 0, 0.1)
1463- baseText: UbuntuColors.lightGrey
1464- foreground: UbuntuColors.lightGrey
1465- foregroundText: "#FFFFFF"
1466- overlay: "#FDFDFD"
1467- overlayText: UbuntuColors.lightGrey
1468- field: "lightgray"
1469- fieldText: UbuntuColors.darkGrey
1470- }
1471- selected {
1472- background: Qt.rgba(0, 0, 0, 0.05)
1473- backgroundText: UbuntuColors.darkGrey
1474- selection: selected.foreground
1475- foreground: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
1476- foregroundText: UbuntuColors.darkGrey
1477- field: "#FFFFFF"
1478- fieldText: UbuntuColors.darkGrey
1479+ normal: AmbianceNormal {}
1480+ inactive: AmbianceNormal {
1481+ field: UbuntuColors.porcelain;
1482+ // inactive is 30% transparent normal
1483+ Component.onCompleted: {
1484+ for (var p in normal) {
1485+ // skip objectName and all change signals
1486+ if (p == "objectName" || p == "field" || p.indexOf("Changed") > 0) continue;
1487+ inactive[p] = Qt.rgba(normal[p].r, normal[p].g, normal[p].b, 0.3);
1488+ }
1489+ }
1490+ }
1491+
1492+ // selected differs from normal in background, base, foreground
1493+ selected: AmbianceNormal {
1494+ background: UbuntuColors.porcelain
1495+ backgroundText: UbuntuColors.blue
1496+ base: UbuntuColors.ash
1497+ baseText: UbuntuColors.blue
1498+ foreground: UbuntuColors.silk
1499+ foregroundText: UbuntuColors.blue
1500+ }
1501+
1502+ // selected differs from normal in background, base, foreground
1503+ selectedInactive: AmbianceNormal {
1504+ background: UbuntuColors.porcelain
1505+ base: UbuntuColors.porcelain
1506+ foreground: UbuntuColors.porcelain
1507 }
1508 }
1509
1510=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml'
1511--- src/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml 2015-09-23 08:39:29 +0000
1512+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PickerStyle.qml 2016-01-15 07:23:58 +0000
1513@@ -24,7 +24,9 @@
1514 /*!
1515 Specifies the background color
1516 */
1517- property color backgroundColor: "#0A000000"
1518+ property color backgroundColor: styledItem.enabled
1519+ ? theme.palette.normal.foreground
1520+ : theme.palette.inactive.foreground
1521 /*!
1522 Background color for highlight.
1523 */
1524
1525=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml'
1526--- src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml 2015-09-07 10:05:58 +0000
1527+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ProgressBarStyle.qml 2016-01-15 07:23:58 +0000
1528@@ -20,8 +20,8 @@
1529 Item {
1530 id: progressBarStyle
1531
1532- property color foregroundColor: UbuntuColors.orange
1533- property color foregroundTextColor: '#FFFFFF'
1534+ property color foregroundColor: theme.palette.normal.activity
1535+ property color foregroundTextColor: theme.palette.normal.activityText
1536 property color backgroundColor: theme.palette.normal.base
1537 property color backgroundTextColor: theme.palette.normal.baseText
1538
1539
1540=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml'
1541--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2015-09-22 14:39:47 +0000
1542+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-01-15 07:23:58 +0000
1543@@ -28,7 +28,7 @@
1544 /*!
1545 The foreground color of unselected sections.
1546 */
1547- property color sectionColor: theme.palette.selected.backgroundText
1548+ property color sectionColor: theme.palette.normal.backgroundText
1549
1550 /*!
1551 The foreground color of the selected section.
1552
1553=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml'
1554--- src/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml 2015-09-21 14:44:13 +0000
1555+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SliderStyle.qml 2016-01-15 07:23:58 +0000
1556@@ -26,7 +26,7 @@
1557 Item {
1558 id: sliderStyle
1559
1560- property color foregroundColor: UbuntuColors.orange
1561+ property color foregroundColor: theme.palette.normal.activity
1562 property color backgroundColor: theme.palette.normal.base
1563
1564 property real thumbSpacing: units.gu(0)
1565@@ -43,8 +43,9 @@
1566 right: parent.right
1567 left: parent.left
1568 }
1569- height: units.dp(4)
1570+ height: units.dp(2)
1571 backgroundColor: sliderStyle.backgroundColor
1572+ aspect: UbuntuShape.Flat
1573 overlayColor: sliderStyle.foregroundColor
1574 overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
1575 Qt.rect(0.0, 0.0, thumb.x / thumb.barMinusThumbWidth, 1.0) :
1576@@ -80,18 +81,17 @@
1577 }
1578 width: units.gu(2)
1579 height: units.gu(2)
1580- opacity: 0.97
1581- backgroundColor: theme.palette.normal.overlay
1582+ backgroundColor: theme.palette.normal.raised
1583 }
1584
1585 BubbleShape {
1586 id: bubbleShape
1587
1588- property real minimumWidth: units.gu(8)
1589+ property real minimumWidth: units.gu(6)
1590 property real horizontalPadding: units.gu(1)
1591
1592- width: Math.max(minimumWidth, label.implicitWidth + 2*horizontalPadding)
1593- height: units.gu(6)
1594+ width: label.implicitWidth + 2*horizontalPadding
1595+ height: label.implicitHeight + 2*horizontalPadding
1596
1597 // FIXME: very temporary implementation
1598 property real minX: 0.0
1599@@ -117,7 +117,7 @@
1600 anchors.centerIn: parent
1601 text: styledItem.formatValue(SliderUtils.liveValue(styledItem))
1602 textSize: Label.Large
1603- color: theme.palette.normal.overlayText
1604+ color: theme.palette.normal.raisedText
1605 }
1606 }
1607 }
1608
1609=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml'
1610--- src/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml 2015-12-09 14:45:54 +0000
1611+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SwitchStyle.qml 2016-01-15 07:23:58 +0000
1612@@ -23,53 +23,26 @@
1613 /*!
1614 The padding between the thumb and the outside border of the switch.
1615 */
1616- property real thumbPadding: units.gu(0.33)
1617-
1618- /*!
1619- The padding between the icon and the border of the thumb.
1620- */
1621- property real iconPadding: thumbPadding
1622-
1623- implicitWidth: units.gu(6)
1624- implicitHeight: units.gu(3)
1625- opacity: styledItem.enabled ? 1.0 : 0.5
1626+ property real thumbPadding: 0
1627+
1628+ implicitWidth: units.gu(5)
1629+ implicitHeight: units.gu(2.5)
1630 LayoutMirroring.enabled: false
1631 LayoutMirroring.childrenInherit: true
1632
1633 /*!
1634 The background color of the switch.
1635 */
1636- property color backgroundColor: theme.palette.normal.base
1637-
1638- /*!
1639- The background color of the thumb when the switch is checked.
1640- */
1641- property color checkedThumbColor: UbuntuColors.green
1642-
1643- /*!
1644- The background color of the thumb when the switch is not checked.
1645- */
1646- property color uncheckedThumbColor: Qt.rgba(0, 0, 0, 0.2)
1647-
1648- /*!
1649- The foreground color of the icon that is currently selected.
1650- */
1651- property color selectedIconColor: theme.palette.normal.foregroundText
1652-
1653- /*!
1654- The color of the icon that is not currently selected.
1655- */
1656- property color unselectedIconColor: theme.palette.normal.backgroundText
1657-
1658- /*!
1659- The source of the selected icon when the switch is checked.
1660- */
1661- property url checkedIconSource: "image://theme/tick"
1662-
1663- /*!
1664- The source of the selected icon when the switch is not checked.
1665- */
1666- property url uncheckedIconSource: "image://theme/close"
1667+ property color backgroundColor: styledItem.enabled ? theme.palette.normal.base : theme.palette.inactive.base
1668+
1669+ /*!
1670+ The background color of the checked switch.
1671+ */
1672+ property color checkedBackgroundColor: styledItem.enabled ? theme.palette.normal.positive : theme.palette.inactive.base
1673+ /*!
1674+ The background color of the thumb.
1675+ */
1676+ property color thumbColor: styledItem.enabled ? theme.palette.normal.raised : theme.palette.inactive.raised
1677
1678 FocusShape {
1679 }
1680@@ -86,19 +59,14 @@
1681 State {
1682 name: "checked"
1683 when: styledItem.checked
1684- PropertyChanges {
1685+ AnchorChanges {
1686 target: thumb
1687- x: rightThumbPosition.x
1688- backgroundColor: switchStyle.checkedThumbColor
1689+ anchors.left: undefined
1690+ anchors.right: parent.right
1691 }
1692- },
1693- State {
1694- name: "unchecked"
1695- when: !styledItem.checked
1696 PropertyChanges {
1697- target: thumb
1698- x: leftThumbPosition.x
1699- backgroundColor: switchStyle.uncheckedThumbColor
1700+ target: background
1701+ backgroundColor: switchStyle.checkedBackgroundColor
1702 }
1703 }
1704 ]
1705@@ -107,27 +75,12 @@
1706 // Avoid animations on width changes (during initialization)
1707 // by explicitly setting from and to for the Transitions.
1708 Transition {
1709- from: "unchecked"
1710+ from: "*"
1711 to: "checked"
1712- UbuntuNumberAnimation {
1713- target: thumb
1714- properties: "x"
1715- duration: UbuntuAnimation.FastDuration
1716- easing: UbuntuAnimation.StandardEasing
1717- }
1718- ColorAnimation {
1719- target: thumb
1720- properties: "backgroundColor"
1721- duration: UbuntuAnimation.FastDuration
1722- easing: UbuntuAnimation.StandardEasing
1723- }
1724- },
1725- Transition {
1726- from: "checked"
1727- to: "unchecked"
1728- UbuntuNumberAnimation {
1729- target: thumb
1730- properties: "x"
1731+ reversible: true
1732+ enabled: animated
1733+ AnchorAnimation {
1734+ targets: thumb
1735 duration: UbuntuAnimation.FastDuration
1736 easing: UbuntuAnimation.StandardEasing
1737 }
1738@@ -140,99 +93,16 @@
1739 }
1740 ]
1741
1742+ backgroundColor: switchStyle.thumbColor
1743 width: (background.width - switchStyle.thumbPadding * 3.0) / 2.0
1744 anchors {
1745 top: parent.top
1746 bottom: parent.bottom
1747+ left: parent.left
1748 topMargin: switchStyle.thumbPadding
1749 bottomMargin: switchStyle.thumbPadding
1750 }
1751
1752- property real iconSize: Math.min(width, height) - 2*switchStyle.iconPadding
1753-
1754- PartialColorize {
1755- anchors {
1756- verticalCenter: parent.verticalCenter
1757- right: parent.left
1758- rightMargin: switchStyle.iconPadding + switchStyle.thumbPadding
1759- }
1760- rightColor: switchStyle.unselectedIconColor
1761- source: Image {
1762- source: switchStyle.uncheckedIconSource
1763- sourceSize {
1764- width: thumb.iconSize
1765- height: thumb.iconSize
1766- }
1767- }
1768- }
1769-
1770- PartialColorize {
1771- anchors {
1772- verticalCenter: parent.verticalCenter
1773- left: parent.right
1774- leftMargin: switchStyle.iconPadding + switchStyle.thumbPadding
1775- }
1776- rightColor: switchStyle.unselectedIconColor
1777- source: Image {
1778- source: switchStyle.checkedIconSource
1779- sourceSize {
1780- width: thumb.iconSize
1781- height: thumb.iconSize
1782- }
1783- }
1784- }
1785- }
1786-
1787- Item {
1788- id: leftThumbPosition
1789- anchors {
1790- left: parent.left
1791- top: parent.top
1792- leftMargin: switchStyle.thumbPadding
1793- topMargin: switchStyle.thumbPadding
1794- }
1795- height: thumb.height
1796- width: thumb.width
1797-
1798- PartialColorize {
1799- anchors.centerIn: parent
1800- source: Image {
1801- source: switchStyle.uncheckedIconSource
1802- sourceSize {
1803- width: thumb.iconSize
1804- height: thumb.iconSize
1805- }
1806- }
1807- progress: MathUtils.clamp((thumb.x - parent.x - x) / width, 0.0, 1.0)
1808- leftColor: "transparent"
1809- rightColor: switchStyle.selectedIconColor
1810- }
1811- }
1812-
1813- Item {
1814- id: rightThumbPosition
1815- anchors {
1816- right: parent.right
1817- top: parent.top
1818- rightMargin: switchStyle.thumbPadding
1819- topMargin: switchStyle.thumbPadding
1820- }
1821- height: thumb.height
1822- width: thumb.width
1823-
1824- PartialColorize {
1825- anchors.centerIn: parent
1826- source: Image {
1827- source: switchStyle.checkedIconSource
1828- sourceSize {
1829- width: thumb.iconSize
1830- height: thumb.iconSize
1831- }
1832- }
1833- progress: MathUtils.clamp((thumb.x + thumb.width - parent.x - x) / width, 0.0, 1.0)
1834- leftColor: switchStyle.selectedIconColor
1835- rightColor: "transparent"
1836- }
1837 }
1838 }
1839 }
1840
1841=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml'
1842--- src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2015-07-22 13:14:43 +0000
1843+++ src/Ubuntu/Components/Themes/Ambiance/1.3/TextAreaStyle.qml 2016-01-15 07:23:58 +0000
1844@@ -25,14 +25,22 @@
1845 // FIXME: needs type checking in themes to define the proper type to be used
1846 // if color type is used, alpha value gets lost
1847
1848- property color color: (styledItem.activeFocus || styledItem.highlighted) ? theme.palette.selected.fieldText : theme.palette.normal.fieldText
1849- property color selectedTextColor: theme.palette.selected.foregroundText
1850- property color selectionColor: theme.palette.selected.foreground
1851+ property color color: styledItem.enabled
1852+ ? ((styledItem.activeFocus || styledItem.highlighted)
1853+ ? theme.palette.selected.fieldText
1854+ : theme.palette.normal.fieldText)
1855+ : theme.palette.inactive.fieldText
1856+ property color selectedTextColor: styledItem.enabled ? theme.palette.selected.selectionText : theme.palette.inactive.selectionText
1857+ property color selectionColor: styledItem.enabled ? theme.palette.selected.selection : theme.palette.inactive.selection
1858 /*!
1859 Background fill color
1860 */
1861- property color backgroundColor: (styledItem.activeFocus || styledItem.highlighted) ? theme.palette.selected.field : theme.palette.normal.field
1862- property color errorColor: UbuntuColors.orange
1863+ property color backgroundColor: styledItem.enabled
1864+ ? ((styledItem.activeFocus || styledItem.highlighted)
1865+ ? theme.palette.selected.field
1866+ : theme.palette.normal.field)
1867+ : theme.palette.inactive.field
1868+ property color errorColor: styledItem.enabled ? theme.palette.normal.negative : theme.palette.inactive.negative
1869
1870 /*!
1871 Spacing between the frame and the text editor area
1872
1873=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ToolbarButtonStyle.qml'
1874--- src/Ubuntu/Components/Themes/Ambiance/1.3/ToolbarButtonStyle.qml 2015-09-21 14:44:13 +0000
1875+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ToolbarButtonStyle.qml 2016-01-15 07:23:58 +0000
1876@@ -31,6 +31,8 @@
1877 height: icon.height + label.height + label.anchors.topMargin
1878 opacity: styledItem.enabled ? 1.0 : 0.3
1879
1880+ // FIXME: is there a reason we are still using styledItem.iconSource instead of iconName
1881+ // so we coudl use the Icon?
1882 Image {
1883 id: icon
1884 anchors {
1885@@ -53,6 +55,9 @@
1886 width: paintedWidth
1887 text: styledItem.text
1888 textSize: Label.XSmall
1889+ color: styledItem.enabled
1890+ ? theme.palette.normal.raisedText
1891+ : theme.palette.inactive.raisedText
1892 }
1893 }
1894
1895
1896=== modified file 'src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro'
1897--- src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-12-16 10:01:07 +0000
1898+++ src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2016-01-15 07:23:58 +0000
1899@@ -73,6 +73,7 @@
1900 1.2/TextFieldStyle.qml \
1901 1.2/ToolbarButtonStyle.qml \
1902 1.2/DeprecatedToolbarStyle.qml \
1903+ 1.3/AmbianceNormal.qml \
1904 1.3/ActionBarStyle.qml \
1905 1.3/ActivityIndicatorStyle.qml \
1906 1.3/BubbleShape.qml \
1907
1908=== modified file 'src/Ubuntu/Components/Themes/Ambiance/qmldir'
1909--- src/Ubuntu/Components/Themes/Ambiance/qmldir 2015-12-16 10:01:07 +0000
1910+++ src/Ubuntu/Components/Themes/Ambiance/qmldir 2016-01-15 07:23:58 +0000
1911@@ -57,6 +57,7 @@
1912
1913 #################################################
1914 #version 1.3
1915+AmbianceNormal 1.3 ./1.3/AmbianceNormal.qml
1916 ActionBarStyle 1.3 ./1.3/ActionBarStyle.qml
1917 MainViewStyle 1.3 ./1.3/MainViewStyle.qml
1918 ListItemOptionSelector 1.3 ./1.3/ListItemOptionSelector.qml
1919
1920=== removed file 'src/Ubuntu/Components/Themes/SuruDark/1.2/ListItemStyle.qml'
1921--- src/Ubuntu/Components/Themes/SuruDark/1.2/ListItemStyle.qml 2015-07-13 22:16:37 +0000
1922+++ src/Ubuntu/Components/Themes/SuruDark/1.2/ListItemStyle.qml 1970-01-01 00:00:00 +0000
1923@@ -1,25 +0,0 @@
1924-/*
1925- * Copyright 2015 Canonical Ltd.
1926- *
1927- * This program is free software; you can redistribute it and/or modify
1928- * it under the terms of the GNU Lesser General Public License as published by
1929- * the Free Software Foundation; version 3.
1930- *
1931- * This program is distributed in the hope that it will be useful,
1932- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1933- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1934- * GNU Lesser General Public License for more details.
1935- *
1936- * You should have received a copy of the GNU Lesser General Public License
1937- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1938- */
1939-
1940-import QtQuick 2.4
1941-import Ubuntu.Components.Themes.Ambiance 1.2 as Ambiance
1942-
1943-Ambiance.ListItemStyle {
1944- // 20% lighter that background color
1945- trailingPanelColor: Qt.lighter(theme.palette.normal.background, 1.2)
1946- // 40% lighter than foreground color
1947- trailingForegroundColor: Qt.lighter(theme.palette.normal.foreground, 1.4)
1948-}
1949
1950=== removed file 'src/Ubuntu/Components/Themes/SuruDark/1.3/ListItemStyle.qml'
1951--- src/Ubuntu/Components/Themes/SuruDark/1.3/ListItemStyle.qml 2015-08-11 10:01:34 +0000
1952+++ src/Ubuntu/Components/Themes/SuruDark/1.3/ListItemStyle.qml 1970-01-01 00:00:00 +0000
1953@@ -1,26 +0,0 @@
1954-/*
1955- * Copyright 2015 Canonical Ltd.
1956- *
1957- * This program is free software; you can redistribute it and/or modify
1958- * it under the terms of the GNU Lesser General Public License as published by
1959- * the Free Software Foundation; version 3.
1960- *
1961- * This program is distributed in the hope that it will be useful,
1962- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1963- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1964- * GNU Lesser General Public License for more details.
1965- *
1966- * You should have received a copy of the GNU Lesser General Public License
1967- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1968- */
1969-//![0]
1970-import QtQuick 2.4
1971-import Ubuntu.Components.Themes.Ambiance 1.3 as Ambiance
1972-
1973-Ambiance.ListItemStyle {
1974- // 20% lighter that background color
1975- trailingPanelColor: Qt.lighter(theme.palette.normal.background, 1.2)
1976- // 40% lighter than foreground color
1977- trailingForegroundColor: Qt.lighter(theme.palette.normal.foreground, 1.4)
1978-}
1979-//![0]
1980
1981=== modified file 'src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml'
1982--- src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2015-06-02 16:20:13 +0000
1983+++ src/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml 2016-01-15 07:23:58 +0000
1984@@ -20,26 +20,34 @@
1985 import Ubuntu.Components.Themes 1.3
1986
1987 Palette {
1988- normal {
1989- background: "#221E1C"
1990- backgroundText: "#5D5D5D78"
1991- base: "#19000000"
1992- baseText: "#FFFFFF"
1993- foreground: "#888888"
1994- foregroundText: "#FFFFFF"
1995- overlay: "#F2F2F2"
1996- overlayText: "#888888"
1997- field: "#19000000"
1998- fieldText: "#7F7F7F7F"
1999- }
2000- selected {
2001- background: "#88D6D6D6"
2002- backgroundText: "#FFFFFF"
2003- selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
2004- foreground: UbuntuColors.orange
2005- foregroundText: UbuntuColors.darkGrey
2006- field: "#FFFFFF"
2007- fieldText: "#888888"
2008+ normal: SuruDarkNormal {}
2009+ inactive: SuruDarkNormal {
2010+ field: UbuntuColors.inkstone
2011+ // inactive is 30% transparent normal
2012+ Component.onCompleted: {
2013+ for (var p in normal) {
2014+ // skip objectName and all change signals
2015+ if (p == "objectName" || p == "field" || p.indexOf("Changed") > 0) continue;
2016+ inactive[p] = Qt.rgba(normal[p].r, normal[p].g, normal[p].b, 0.3);
2017+ }
2018+ }
2019+ }
2020+
2021+ // selected differs from normal in background, base, foreground
2022+ selected: SuruDarkNormal {
2023+ background: UbuntuColors.inkstone
2024+ backgroundText: UbuntuColors.blue
2025+ base: UbuntuColors.ash
2026+ baseText:UbuntuColors.blue
2027+ foreground: UbuntuColors.slate
2028+ foregroundText: UbuntuColors.blue
2029+ }
2030+
2031+ // selected differs from normal in background, base, foreground
2032+ selectedInactive: SuruDarkNormal {
2033+ background: UbuntuColors.inkstone
2034+ base: UbuntuColors.inkstone
2035+ foreground: UbuntuColors.inkstone
2036 }
2037 }
2038 //![0]
2039
2040=== added file 'src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml'
2041--- src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml 1970-01-01 00:00:00 +0000
2042+++ src/Ubuntu/Components/Themes/SuruDark/1.3/SuruDarkNormal.qml 2016-01-15 07:23:58 +0000
2043@@ -0,0 +1,47 @@
2044+/*
2045+ * Copyright 2015 Canonical Ltd.
2046+ *
2047+ * This program is free software; you can redistribute it and/or modify
2048+ * it under the terms of the GNU Lesser General Public License as published by
2049+ * the Free Software Foundation; version 3.
2050+ *
2051+ * This program is distributed in the hope that it will be useful,
2052+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2053+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2054+ * GNU Lesser General Public License for more details.
2055+ *
2056+ * You should have received a copy of the GNU Lesser General Public License
2057+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2058+ */
2059+
2060+import QtQuick 2.4
2061+import Ubuntu.Components 1.3
2062+import Ubuntu.Components.Themes 1.3
2063+
2064+PaletteValues {
2065+ background: UbuntuColors.jet
2066+ backgroundText: "#FFFFFF"
2067+ backgroundSecondaryText: UbuntuColors.silk
2068+ backgroundTertiaryText: UbuntuColors.ash
2069+ base: UbuntuColors.graphite
2070+ baseText: UbuntuColors.silk
2071+ foreground: UbuntuColors.inkstone
2072+ foregroundText: "#FFFFFF"
2073+ raised: "#FFFFFF"
2074+ raisedText: UbuntuColors.slate
2075+ raisedSecondaryText: UbuntuColors.silk
2076+ overlay: UbuntuColors.inkstone
2077+ overlayText: "#FFFFFF"
2078+ overlaySecondaryText: UbuntuColors.slate
2079+ field: UbuntuColors.jet
2080+ fieldText: "#FFFFFF"
2081+ selection: Qt.rgba(UbuntuColors.orange.r, UbuntuColors.orange.g, UbuntuColors.orange.b, 0.4)
2082+ selectionText: "#FFFFFF"
2083+ positive: UbuntuColors.green
2084+ positiveText: "#FFFFFF"
2085+ negative: UbuntuColors.red
2086+ negativeText: "#FFFFFF"
2087+ activity: UbuntuColors.blue
2088+ activityText: "#FFFFFF"
2089+}
2090+
2091
2092=== modified file 'src/Ubuntu/Components/Themes/SuruDark/SuruDark.pro'
2093--- src/Ubuntu/Components/Themes/SuruDark/SuruDark.pro 2015-08-06 22:47:38 +0000
2094+++ src/Ubuntu/Components/Themes/SuruDark/SuruDark.pro 2016-01-15 07:23:58 +0000
2095@@ -7,11 +7,10 @@
2096 1.2/OptionSelectorStyle.qml \
2097 1.2/Palette.qml \
2098 1.2/TabBarStyle.qml \
2099- 1.2/ListItemStyle.qml \
2100 1.3/OptionSelectorStyle.qml \
2101+ 1.3/SuruDarkNormal.qml \
2102 1.3/Palette.qml \
2103 1.3/TabBarStyle.qml \
2104- 1.3/ListItemStyle.qml \
2105 $$ARTWORK_FILES \
2106 $$PARENT_THEME_FILE
2107
2108
2109=== modified file 'src/Ubuntu/Components/Themes/SuruDark/qmldir'
2110--- src/Ubuntu/Components/Themes/SuruDark/qmldir 2015-04-24 14:48:00 +0000
2111+++ src/Ubuntu/Components/Themes/SuruDark/qmldir 2016-01-15 07:23:58 +0000
2112@@ -5,3 +5,4 @@
2113
2114 #version 1.3
2115 Palette 1.3 ./1.3/Palette.qml
2116+SuruDarkNormal 1.3 ./1.3/SuruDarkNormal.qml
2117
2118=== modified file 'src/Ubuntu/Components/plugin/adapters/actionsproxy_p.cpp'
2119--- src/Ubuntu/Components/plugin/adapters/actionsproxy_p.cpp 2015-09-01 10:49:47 +0000
2120+++ src/Ubuntu/Components/plugin/adapters/actionsproxy_p.cpp 2016-01-15 07:23:58 +0000
2121@@ -19,29 +19,23 @@
2122
2123 #include <QDebug>
2124
2125+Q_LOGGING_CATEGORY(ucActionProxy, "ubuntu.components.ActionProxy", QtMsgType::QtWarningMsg)
2126+
2127+#define AP_TRACE(params) qCDebug(ucActionProxy) << params
2128+
2129 ActionProxy::ActionProxy()
2130- : QObject(0)
2131- , globalContext(new UCActionContext)
2132+ : globalContext(new UCActionContext)
2133 {
2134 // for testing purposes
2135 globalContext->setObjectName("GlobalActionContext");
2136 }
2137 ActionProxy::~ActionProxy()
2138 {
2139- // if there is still an active context clear it
2140- if (!m_activeContext.isNull()) {
2141- m_activeContext->setActive(false);
2142- }
2143 // clear context explicitly, as global context is not connected to
2144 clearContextActions(globalContext);
2145 delete globalContext;
2146 }
2147
2148-UCActionContext *ActionProxy::currentContext()
2149-{
2150- return instance().m_activeContext;
2151-}
2152-
2153 const QSet<UCActionContext*> &ActionProxy::localContexts()
2154 {
2155 return instance().m_localContexts;
2156@@ -67,8 +61,7 @@
2157 return;
2158 }
2159 instance().m_localContexts.insert(context);
2160- // watch context activation changes
2161- instance().watchContextActivation(context, true);
2162+ AP_TRACE("ADD CONTEXT" << context);
2163 }
2164 // Remove a local context. If the context was active, removes the actions from the system.
2165 void ActionProxy::removeContext(UCActionContext *context)
2166@@ -78,60 +71,77 @@
2167 }
2168 // make sure the context is deactivated
2169 context->setActive(false);
2170- instance().watchContextActivation(context, false);
2171 instance().m_localContexts.remove(context);
2172-}
2173-
2174-// toggles context activation watching for a given context
2175-void ActionProxy::watchContextActivation(UCActionContext *context, bool watch)
2176-{
2177- if (!context) {
2178- return;
2179- }
2180- if (watch) {
2181- // connect to action proxy
2182- QObject::connect(context, SIGNAL(activeChanged()),
2183- this, SLOT(handleContextActivation()),
2184- Qt::DirectConnection);
2185- } else {
2186- // disconnect
2187- QObject::disconnect(context, SIGNAL(activeChanged()),
2188- this, SLOT(handleContextActivation()));
2189- }
2190-}
2191-
2192-// handles the local context activation
2193-void ActionProxy::handleContextActivation()
2194-{
2195- // sender is the context changing activation
2196- UCActionContext *context = qobject_cast<UCActionContext*>(sender());
2197- if (!context) {
2198- return;
2199- }
2200- // deactivate the previous context if any
2201- if (!m_activeContext.isNull()) {
2202- if (!context->active()) {
2203- // the slot has been called due to the previous active deactivation,
2204- // so perform system cleanup
2205- clearContextActions(m_activeContext);
2206- m_activeContext->markActionsPublished(false);
2207- // finally clear the context and leave
2208- m_activeContext.clear();
2209- return;
2210- } else {
2211- // deactivate previous actiev context, this will cause the slot to
2212- // be called with active = false within this call context
2213- m_activeContext->setActive(false);
2214- }
2215- }
2216+ AP_TRACE("REMOVE CONTEXT FROM REGISTRY" << context);
2217+}
2218+
2219+// publishes/removes context actions on activation/deactivation
2220+void ActionProxy::activateContext(UCActionContext *context)
2221+{
2222+ if (!context) {
2223+ return;
2224+ }
2225+
2226+ // if a context to be activated is a popup one, we must deactivate all other ones
2227+ // and then activate this
2228 if (context->active()) {
2229 // publish the context's actions to the system
2230- publishContextActions(context);
2231+ instance().publishContextActions(context);
2232 context->markActionsPublished(true);
2233- // and finally set it as active
2234- m_activeContext = context;
2235- }
2236-}
2237+
2238+ if (context->isPopup()) {
2239+ instance().addPopupContext(static_cast<UCPopupContext*>(context));
2240+ } else {
2241+ AP_TRACE("ACTIVATE CONTEXT" << context);
2242+ }
2243+ } else {
2244+ // remove actions from the system
2245+ instance().clearContextActions(context);
2246+ context->markActionsPublished(false);
2247+
2248+ if (context->isPopup()) {
2249+ instance().removePopupContext(static_cast<UCPopupContext*>(context));
2250+ } else {
2251+ AP_TRACE("DEACTIVATE CONTEXT" << context);
2252+ }
2253+ }
2254+}
2255+
2256+void ActionProxy::addPopupContext(UCPopupContext *context)
2257+{
2258+ // deactivate last context and append
2259+ UCPopupContext *lastActive = m_popupContexts.isEmpty() ?
2260+ Q_NULLPTR : m_popupContexts.top();
2261+ if (lastActive) {
2262+ lastActive->setEffectiveActive(false);
2263+ AP_TRACE("DEACTIVATE POPUPCONTEXT" << lastActive);
2264+ }
2265+ m_popupContexts.push(context);
2266+ AP_TRACE("ACTIVATE POPUPCONTEXT" << context);
2267+}
2268+
2269+void ActionProxy::removePopupContext(UCPopupContext *context)
2270+{
2271+ UCPopupContext *last = m_popupContexts.isEmpty() ?
2272+ Q_NULLPTR : m_popupContexts.top();
2273+
2274+ if (last == context) {
2275+ // we are about to remove the last one
2276+ AP_TRACE("DEACTIVATE POPUPCONTEXT" << last);
2277+ m_popupContexts.pop();
2278+ // and then re-activate the second last one
2279+ last = m_popupContexts.isEmpty() ? Q_NULLPTR : m_popupContexts.top();
2280+ if (last) {
2281+ AP_TRACE("REACTIVATE POPUPCONTEXT" << last);
2282+ last->setEffectiveActive(true);
2283+ }
2284+ } else {
2285+ // we simply remove the context and leave
2286+ AP_TRACE("REMOVE POPUPCONTEXT" << context);
2287+ m_popupContexts.removeAll(context);
2288+ }
2289+}
2290+
2291 // empty functions for context activation/deactivation, connect to HUD
2292 void ActionProxy::clearContextActions(UCActionContext *context)
2293 {
2294
2295=== modified file 'src/Ubuntu/Components/plugin/adapters/actionsproxy_p.h'
2296--- src/Ubuntu/Components/plugin/adapters/actionsproxy_p.h 2015-09-01 10:49:47 +0000
2297+++ src/Ubuntu/Components/plugin/adapters/actionsproxy_p.h 2016-01-15 07:23:58 +0000
2298@@ -23,9 +23,9 @@
2299 #include "ucaction.h"
2300
2301 class UCActionContext;
2302-class ActionProxy : public QObject
2303+class UCPopupContext;
2304+class ActionProxy
2305 {
2306- Q_OBJECT
2307 public:
2308
2309 ~ActionProxy();
2310@@ -37,24 +37,25 @@
2311
2312 UCActionContext *globalContext;
2313
2314- static UCActionContext *currentContext();
2315 static const QSet<UCActionContext*> &localContexts();
2316 static void publishGlobalContext();
2317 static void addContext(UCActionContext *context);
2318 static void removeContext(UCActionContext *context);
2319+ static void activateContext(UCActionContext *context);
2320
2321 protected:
2322 ActionProxy();
2323
2324-protected Q_SLOTS:
2325- void watchContextActivation(UCActionContext *context, bool watch);
2326- void handleContextActivation();
2327+protected:
2328 virtual void clearContextActions(UCActionContext *context);
2329 virtual void publishContextActions(UCActionContext *context);
2330
2331 private:
2332 QSet<UCActionContext*> m_localContexts;
2333- QPointer<UCActionContext> m_activeContext;
2334+ QStack<UCPopupContext*> m_popupContexts;
2335+
2336+ void addPopupContext(UCPopupContext *context);
2337+ void removePopupContext(UCPopupContext *context);
2338 };
2339
2340 #endif // ACTIONSPROXY_P_H
2341
2342=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
2343--- src/Ubuntu/Components/plugin/plugin.cpp 2015-12-17 15:23:26 +0000
2344+++ src/Ubuntu/Components/plugin/plugin.cpp 2016-01-15 07:23:58 +0000
2345@@ -1,5 +1,5 @@
2346 /*
2347- * Copyright 2015 Canonical Ltd.
2348+ * Copyright 2016 Canonical Ltd.
2349 *
2350 * This program is free software; you can redistribute it and/or modify
2351 * it under the terms of the GNU Lesser General Public License as published by
2352@@ -263,6 +263,7 @@
2353 qmlRegisterType<UCBottomEdge>(uri, 1, 3, "BottomEdge");
2354 qmlRegisterType<UCBottomEdgeRegion>(uri, 1, 3, "BottomEdgeRegion");
2355 qmlRegisterType<UCPageTreeNode>(uri, 1, 3, "PageTreeNode");
2356+ qmlRegisterType<UCPopupContext>(uri, 1, 3, "PopupContext");
2357 }
2358
2359 void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
2360@@ -283,12 +284,9 @@
2361 // that can be accessed from any object
2362 context->setContextProperty("QuickUtils", &QuickUtils::instance());
2363
2364- // register theme context property
2365- UCTheme::registerToContext(context);
2366-
2367- UCDeprecatedTheme::instance().registerToContext(context);
2368-
2369- HapticsProxy::instance().setEngine(context->engine());
2370+ UCDeprecatedTheme::registerToContext(context);
2371+
2372+ HapticsProxy::instance().setEngine(engine);
2373
2374 context->setContextProperty("i18n", &UbuntuI18n::instance());
2375 ContextPropertyChangeListener *i18nChangeListener =
2376
2377=== modified file 'src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp'
2378--- src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp 2015-11-08 21:39:34 +0000
2379+++ src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp 2016-01-15 07:23:58 +0000
2380@@ -38,7 +38,10 @@
2381 void UCThreeLabelsSlotPrivate::setTitleProperties()
2382 {
2383 if (m_title != Q_NULLPTR) {
2384- m_title->setWrapMode(UCLabel::WordWrap);
2385+ //Using WrapAnywhere because ElideRight elides too early when used
2386+ //together with WrapWord, and that produces an unexpected result.
2387+ //This will cover most of the usecases.
2388+ m_title->setWrapMode(UCLabel::WrapAnywhere);
2389 m_title->setElideMode(UCLabel::ElideRight);
2390 m_title->setMaximumLineCount(1);
2391 m_title->setTextSize(UCLabel::Medium);
2392@@ -48,7 +51,7 @@
2393 void UCThreeLabelsSlotPrivate::setSubtitleProperties()
2394 {
2395 if (m_subtitle != Q_NULLPTR) {
2396- m_subtitle->setWrapMode(UCLabel::WordWrap);
2397+ m_subtitle->setWrapMode(UCLabel::WrapAnywhere);
2398 m_subtitle->setElideMode(UCLabel::ElideRight);
2399 m_subtitle->setMaximumLineCount(1);
2400 m_subtitle->setTextSize(UCLabel::Small);
2401@@ -58,7 +61,7 @@
2402 void UCThreeLabelsSlotPrivate::setSummaryProperties()
2403 {
2404 if (m_summary != Q_NULLPTR) {
2405- m_summary->setWrapMode(UCLabel::WordWrap);
2406+ m_summary->setWrapMode(UCLabel::WrapAnywhere);
2407 m_summary->setElideMode(UCLabel::ElideRight);
2408 m_summary->setMaximumLineCount(2);
2409 m_summary->setTextSize(UCLabel::Small);
2410@@ -99,19 +102,19 @@
2411 QQuickAnchors *subtitleAnchors = QQuickItemPrivate::get(m_subtitle)->anchors();
2412 subtitleAnchors->setTop(skipTitle
2413 ? top()
2414- : QQuickItemPrivate::get(m_title)->baseline());
2415+ : QQuickItemPrivate::get(m_title)->bottom());
2416 subtitleAnchors->setTopMargin(skipTitle
2417 ? 0
2418- : UCUnits::instance().dp(LABELSBLOCK_SPACING_DP));
2419+ : UCUnits::instance().dp(TITLE_SPACING_DP));
2420 }
2421
2422 if (!skipSummary) {
2423 QQuickAnchors *summaryAnchors = QQuickItemPrivate::get(m_summary)->anchors();
2424 summaryAnchors->setTop(skipSubtitle
2425- ? (skipTitle ? top() : QQuickItemPrivate::get(m_title)->baseline())
2426+ ? (skipTitle ? top() : QQuickItemPrivate::get(m_title)->bottom())
2427 : QQuickItemPrivate::get(m_subtitle)->bottom());
2428 summaryAnchors->setTopMargin(skipSubtitle
2429- ? (skipTitle ? 0 : UCUnits::instance().dp(LABELSBLOCK_SPACING_DP))
2430+ ? (skipTitle ? 0 : UCUnits::instance().dp(TITLE_SPACING_DP))
2431 : 0);
2432 }
2433 //Update height of the labels box
2434
2435=== modified file 'src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h'
2436--- src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h 2015-10-01 08:47:31 +0000
2437+++ src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h 2016-01-15 07:23:58 +0000
2438@@ -20,7 +20,9 @@
2439 #include <QQuickItem>
2440 #include <private/qquickitem_p.h>
2441
2442-#define LABELSBLOCK_SPACING_DP 4
2443+//The padding between title and the string below it (i.e. subtitle, or
2444+//summary, when subtitle is empty)
2445+#define TITLE_SPACING_DP 2
2446
2447 class UCLabel;
2448 class UCThreeLabelsSlotPrivate;
2449
2450=== modified file 'src/Ubuntu/Components/plugin/ucaction.cpp'
2451--- src/Ubuntu/Components/plugin/ucaction.cpp 2015-12-18 15:20:48 +0000
2452+++ src/Ubuntu/Components/plugin/ucaction.cpp 2016-01-15 07:23:58 +0000
2453@@ -16,6 +16,7 @@
2454
2455 #include "ucaction.h"
2456 #include "quickutils.h"
2457+#include "ucactioncontext.h"
2458
2459 #include <QtDebug>
2460 #include <QtQml/QQmlInfo>
2461@@ -23,12 +24,16 @@
2462 #include <QtQuick/qquickwindow.h>
2463 #include <private/qguiapplication_p.h>
2464
2465+Q_LOGGING_CATEGORY(ucAction, "ubuntu.components.Action", QtMsgType::QtWarningMsg)
2466+
2467+#define ACT_TRACE(params) qCDebug(ucAction) << params
2468+
2469 bool shortcutContextMatcher(QObject* object, Qt::ShortcutContext context)
2470 {
2471 UCAction* action = static_cast<UCAction*>(object);
2472- // Can't access member here because it's not public
2473- if (!action->property("enabled").toBool())
2474+ if (!action->isEnabled()) {
2475 return false;
2476+ }
2477
2478 switch (context) {
2479 case Qt::ApplicationShortcut:
2480@@ -37,10 +42,39 @@
2481 QObject* window = object;
2482 while (window && !window->isWindowType()) {
2483 window = window->parent();
2484- if (QQuickItem* item = qobject_cast<QQuickItem*>(window))
2485+ if (QQuickItem* item = qobject_cast<QQuickItem*>(window)) {
2486 window = item->window();
2487- }
2488- return window && window == QGuiApplication::focusWindow();
2489+ }
2490+ }
2491+ bool activatable = window && window == QGuiApplication::focusWindow();
2492+
2493+ if (activatable) {
2494+ // is the last action owner item in an active context?
2495+ QQuickItem *pl = action->lastOwningItem();
2496+ activatable = false;
2497+ while (pl) {
2498+ UCActionContextAttached *attached = static_cast<UCActionContextAttached*>(
2499+ qmlAttachedPropertiesObject<UCActionContext>(pl, false));
2500+ if (attached) {
2501+ activatable = attached->context()->active();
2502+ if (!activatable) {
2503+ ACT_TRACE(action << "Inactive context found" << attached->context());
2504+ break;
2505+ }
2506+ }
2507+ pl = pl->parentItem();
2508+ }
2509+ if (!activatable) {
2510+ // check if the action is in an active context
2511+ UCActionContext *context = qobject_cast<UCActionContext*>(action->parent());
2512+ activatable = context && context->active();
2513+ }
2514+ }
2515+ if (activatable) {
2516+ ACT_TRACE("SELECTED ACTION" << action);
2517+ }
2518+
2519+ return activatable;
2520 }
2521 default: break;
2522 }
2523@@ -152,6 +186,7 @@
2524 mnemonic = mnemonic.toLower();
2525 mnemonicIndex = m_text.indexOf(mnemonic);
2526 }
2527+ ACT_TRACE("MNEM" << mnemonic);
2528 QString displayText(m_text);
2529 // FIXME: we need QInputDeviceInfo to detect the keyboard attechment
2530 // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808
2531@@ -192,6 +227,7 @@
2532 m_mnemonic = sequence;
2533
2534 if (!m_mnemonic.isEmpty()) {
2535+ ACT_TRACE("MNEMONIC SET" << m_mnemonic.toString());
2536 Qt::ShortcutContext context = Qt::WindowShortcut;
2537 QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_mnemonic, context, shortcutContextMatcher);
2538 }
2539@@ -356,10 +392,12 @@
2540 }
2541
2542 QKeySequence sequenceFromVariant(const QVariant& variant) {
2543- if (variant.type() == QVariant::Int)
2544+ if (variant.type() == QVariant::Int) {
2545 return static_cast<QKeySequence::StandardKey>(variant.toInt());
2546- if (variant.type() == QVariant::String)
2547+ }
2548+ if (variant.type() == QVariant::String) {
2549 return QKeySequence::fromString(variant.toString());
2550+ }
2551 return QKeySequence();
2552 }
2553
2554@@ -376,10 +414,12 @@
2555 QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, sequenceFromVariant(m_shortcut));
2556
2557 QKeySequence sequence(sequenceFromVariant(shortcut));
2558- if (!sequence.toString().isEmpty())
2559+ if (!sequence.isEmpty()) {
2560+ ACT_TRACE("ADD SHORTCUT" << sequence.toString());
2561 QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, sequence, Qt::WindowShortcut, shortcutContextMatcher);
2562- else
2563+ } else {
2564 qmlInfo(this) << "Invalid shortcut: " << shortcut.toString();
2565+ }
2566
2567 m_shortcut = shortcut;
2568 Q_EMIT shortcutChanged();
2569@@ -399,6 +439,8 @@
2570 if (event->type() != QEvent::Shortcut)
2571 return false;
2572
2573+ // when we reach this point, we can be sure the Action is used
2574+ // by a component belonging to an active ActionContext.
2575 QShortcutEvent *shortcut_event(static_cast<QShortcutEvent*>(event));
2576 if (shortcut_event->isAmbiguous()) {
2577 qmlInfo(this) << "Ambiguous shortcut: " << shortcut_event->key().toString();
2578@@ -437,3 +479,17 @@
2579 Q_EMIT triggered(value);
2580 }
2581 }
2582+
2583+void UCAction::addOwningItem(QQuickItem *item)
2584+{
2585+ if (!m_owningItems.contains(item)) {
2586+ m_owningItems.append(item);
2587+ ACT_TRACE("ADD ACTION OWNER" << item->objectName() << "TO" << this);
2588+ }
2589+}
2590+
2591+void UCAction::removeOwningItem(QQuickItem *item)
2592+{
2593+ m_owningItems.removeOne(item);
2594+ ACT_TRACE("REMOVE ACTION OWNER" << item->objectName() << "FROM" << this);
2595+}
2596
2597=== modified file 'src/Ubuntu/Components/plugin/ucaction.h'
2598--- src/Ubuntu/Components/plugin/ucaction.h 2015-12-18 12:42:58 +0000
2599+++ src/Ubuntu/Components/plugin/ucaction.h 2016-01-15 07:23:58 +0000
2600@@ -21,6 +21,9 @@
2601 #include <QtCore/QVariant>
2602 #include <QtCore/QUrl>
2603 #include <QtGui/QKeySequence>
2604+#include <QtQml>
2605+#include <QtQml/QQmlListProperty>
2606+#include <QtQml/private/qpodvector_p.h>
2607
2608 // the function detects whether QML has an overridden trigger() slot available
2609 // and invokes the one with the appropriate signature
2610@@ -45,6 +48,8 @@
2611 }
2612
2613 class QQmlComponent;
2614+class QQuickItem;
2615+class UCActionAttached;
2616 class UCAction : public QObject
2617 {
2618 Q_OBJECT
2619@@ -83,6 +88,17 @@
2620 {
2621 return m_published;
2622 }
2623+ inline bool isEnabled() const
2624+ {
2625+ return m_enabled;
2626+ }
2627+ inline QQuickItem *lastOwningItem() const
2628+ {
2629+ return m_owningItems.count() > 0 ?
2630+ m_owningItems.at(m_owningItems.count() - 1) : Q_NULLPTR;
2631+ }
2632+ void addOwningItem(QQuickItem *item);
2633+ void removeOwningItem(QQuickItem *item);
2634
2635 void setName(const QString &name);
2636 QString text();
2637@@ -111,6 +127,7 @@
2638 void trigger(const QVariant &value = QVariant());
2639
2640 private:
2641+ QPODVector<QQuickItem*, 4> m_owningItems;
2642 QString m_name;
2643 QString m_text;
2644 QString m_iconName;
2645@@ -139,5 +156,6 @@
2646 bool event(QEvent *event);
2647 void onKeyboardAttached();
2648 };
2649+QML_DECLARE_TYPE(UCAction)
2650
2651 #endif // UCACTION_H
2652
2653=== modified file 'src/Ubuntu/Components/plugin/ucactioncontext.cpp'
2654--- src/Ubuntu/Components/plugin/ucactioncontext.cpp 2015-09-01 10:49:47 +0000
2655+++ src/Ubuntu/Components/plugin/ucactioncontext.cpp 2016-01-15 07:23:58 +0000
2656@@ -17,6 +17,18 @@
2657 #include "ucactioncontext.h"
2658 #include "ucaction.h"
2659 #include "adapters/actionsproxy_p.h"
2660+#include <QtQuick/QQuickItem>
2661+
2662+Q_LOGGING_CATEGORY(ucActionContext, "ubuntu.components.ActionContext", QtMsgType::QtWarningMsg)
2663+
2664+#define CONTEXT_TRACE(params) qCDebug(ucActionContext) << params
2665+
2666+UCActionContextAttached::UCActionContextAttached(QObject *owner)
2667+ : QObject(owner)
2668+ , m_owner(qobject_cast<QQuickItem*>(owner))
2669+ , m_context(Q_NULLPTR)
2670+{
2671+}
2672
2673 /*!
2674 * \qmltype ActionContext
2675@@ -26,10 +38,72 @@
2676 * \brief ActionContext groups actions together and by providing multiple contexts
2677 * the developer is able to control the visibility of the actions. The \l ActionManager
2678 * then exposes the actions from these different contexts.
2679+ *
2680+ * ActionContext drives the state of its \l actions. Shortcuts and mnemonics are
2681+ * only registered if the context is active or if the action is assigned to an
2682+ * \l ActionItem all of whose parent contexts are active. In the following
2683+ * example the ActionContext drives the underlaying \c action1 and \c action2
2684+ * shortcuts, and \c orphanAction will never trigger as it is neither enclosed
2685+ * in an active context nor assigned to an ActionItem.
2686+ * \qml
2687+ * import QtQuick 2.4
2688+ * import ubuntu.Componenst 1.3
2689+ *
2690+ * Rectangle {
2691+ * id: root
2692+ * width: units.gu(40)
2693+ * height: units.gu(71)
2694+ * ActionContext {
2695+ * id: rootContext
2696+ * active: true
2697+ * actions: Action {
2698+ * shortcut: 'Ctrl+A'
2699+ * text: rootContext.active ? "Deactivate" : "Activate"
2700+ * onTriggered: rootContext.active = !rootContext.active
2701+ * }
2702+ * }
2703+ *
2704+ * Action {
2705+ * id: orphanAction
2706+ * text: "Orphan"
2707+ * shortcut: 'Ctrl+O'
2708+ * onTriggered: console.log("This will not be called")
2709+ * }
2710+ *
2711+ * Column {
2712+ * Button {
2713+ * text: rootContext.active ? "Deactivate" : "Activate"
2714+ * onClicked: rootContext.active = !rootContext.active
2715+ * }
2716+ * Button {
2717+ * action: Action {
2718+ * id: action1
2719+ * text: "F&irst Button"
2720+ * onTriggered: console.log("First Button triggered")
2721+ * }
2722+ * }
2723+ * Button {
2724+ * action: Action {
2725+ * id: action2
2726+ * text: "S&econd Button"
2727+ * shortcut: 'Ctrl+Alt+2'
2728+ * onTriggered: console.log("Second Button triggered")
2729+ * }
2730+ * }
2731+ * }
2732+ * }
2733+ * \endqml
2734+ *
2735+ * The toolkit assigns an ActionContext to each Page component, which is
2736+ * activated/deactivated together with the Page itself, driving the shortcut
2737+ * activations on the components and actions declared in the Page.
2738+ * \sa PopupContext
2739 */
2740 UCActionContext::UCActionContext(QObject *parent)
2741 : QObject(parent)
2742 , m_active(false)
2743+ , m_effectiveActive(true)
2744+ , m_popup(false)
2745 {
2746 }
2747 UCActionContext::~UCActionContext()
2748@@ -37,10 +111,23 @@
2749 ActionProxy::removeContext(this);
2750 }
2751
2752-void UCActionContext::componentComplete()
2753+UCActionContextAttached *UCActionContext::qmlAttachedProperties(QObject *owner)
2754+{
2755+ return new UCActionContextAttached(owner);
2756+}
2757+
2758+void UCActionContext::classBegin()
2759 {
2760 // add the context to the management
2761 ActionProxy::addContext(this);
2762+ // make sure we attach to the parent
2763+ UCActionContextAttached *attached = static_cast<UCActionContextAttached*>(
2764+ qmlAttachedPropertiesObject<UCActionContext>(parent(), true));
2765+ attached->m_context = this;
2766+}
2767+
2768+void UCActionContext::componentComplete()
2769+{
2770 }
2771
2772 /*
2773@@ -97,18 +184,16 @@
2774 * whether or not the actions in a context are available to external components.
2775 *
2776 * The \l ActionManager monitors the active property of each of the local contexts
2777- * that has been added to it. There can be only one active local context at a time.
2778- * When one of the local contexts sets itself active the manager will notice this,
2779- * export the actions from that given context and set the previously active local
2780- * context as inactive. This way setting active to true on a local context is
2781- * sufficient to manage the active local context of the manager and no additional
2782- * calls are necessary to manually inactivate the other contexts.
2783+ * that has been added to it. There can be more than one local context active at a.
2784+ * time. When a local context is set active the manager will notice this and will
2785+ * export the actions from the context.
2786+ * \note An Action declared to a component falling under an item that is a child of
2787+ * an inactive ActiveContext can be triggered manually using the mouse or connections.
2788 */
2789 bool UCActionContext::active()
2790 {
2791- return m_active;
2792+ return m_active && m_effectiveActive;
2793 }
2794-
2795 void UCActionContext::setActive(bool active)
2796 {
2797 if (m_active == active) {
2798@@ -118,7 +203,26 @@
2799 if (!active && (ActionProxy::instance().globalContext == this)) {
2800 return;
2801 }
2802+ CONTEXT_TRACE("ACTIVATE CONTEXT" << this << active);
2803+
2804 m_active = active;
2805+ ActionProxy::activateContext(this);
2806+ Q_EMIT activeChanged();
2807+}
2808+
2809+// similar to setActive() but does not alter the actions from the proxy
2810+void UCActionContext::setEffectiveActive(bool active)
2811+{
2812+ if (m_effectiveActive == active) {
2813+ return;
2814+ }
2815+ // skip deactivation for global context
2816+ if (!active && (ActionProxy::instance().globalContext == this)) {
2817+ return;
2818+ }
2819+ CONTEXT_TRACE("EFECTIVE ACTIVATE CONTEXT" << this << active);
2820+
2821+ m_effectiveActive = active;
2822 Q_EMIT activeChanged();
2823 }
2824
2825@@ -147,3 +251,28 @@
2826 }
2827 m_actions.remove(action);
2828 }
2829+
2830+
2831+/*!
2832+ * \qmltype PopupContext
2833+ * \instantiates UCPopupContext
2834+ * \inqmlmodule Ubuntu.Components 1.3
2835+ * \since Ubuntu.Components 1.3
2836+ * \inherits ActionContext
2837+ * \ingroup ubuntu
2838+ * \brief A special ActionContext used in Dialogs and Popups.
2839+ *
2840+ * A PopupContext is similar to the ActionContext, with the only difference being
2841+ * that there can be only one PopupContext active at a time in an application.
2842+ * A PopupContext can have several active ActionContext children declared, however
2843+ * when deactivated all child contexts will be deactivated as well, and no Action
2844+ * declared in these contexts will be available through shortcuts.
2845+ *
2846+ * The toolkit provides this kind of contexts in MainView, Popup and Dialog. It is
2847+ * highly recommended for applications to have a PopupContext defined in their rootItem.
2848+ */
2849+UCPopupContext::UCPopupContext(QObject *parent)
2850+ : UCActionContext(parent)
2851+{
2852+ m_popup = true;
2853+}
2854
2855=== modified file 'src/Ubuntu/Components/plugin/ucactioncontext.h'
2856--- src/Ubuntu/Components/plugin/ucactioncontext.h 2015-09-01 10:49:47 +0000
2857+++ src/Ubuntu/Components/plugin/ucactioncontext.h 2016-01-15 07:23:58 +0000
2858@@ -24,6 +24,7 @@
2859 #include <QtQml>
2860
2861 class UCAction;
2862+class UCActionContextAttached;
2863 class UCActionContext : public QObject, public QQmlParserStatus
2864 {
2865 Q_OBJECT
2866@@ -35,14 +36,21 @@
2867 explicit UCActionContext(QObject *parent = 0);
2868 ~UCActionContext();
2869
2870- void classBegin(){}
2871+ static UCActionContextAttached *qmlAttachedProperties(QObject *owner);
2872+
2873+ void classBegin();
2874 void componentComplete();
2875 void markActionsPublished(bool mark);
2876+ bool isPopup() const
2877+ {
2878+ return m_popup;
2879+ }
2880
2881 QQmlListProperty<UCAction> actions();
2882
2883 bool active();
2884 void setActive(bool active);
2885+ void setEffectiveActive(bool active);
2886
2887 Q_SIGNALS:
2888 void activeChanged();
2889@@ -51,9 +59,13 @@
2890 void addAction(UCAction *action);
2891 void removeAction(UCAction *action);
2892
2893-private:
2894- bool m_active;
2895+protected:
2896 QSet<UCAction*> m_actions;
2897+ bool m_active:1;
2898+ bool m_effectiveActive:1;
2899+ // declare popup flag within ActionContext to avoid unnecessary object-casting
2900+ // to detect whether a context is a popup or normal context.
2901+ bool m_popup:1;
2902 friend class UCActionManager;
2903
2904 static void append(QQmlListProperty<UCAction> *list, UCAction *action);
2905@@ -61,6 +73,36 @@
2906 static int count(QQmlListProperty<UCAction> *list);
2907 };
2908
2909+class UCPopupContext : public UCActionContext
2910+{
2911+ Q_OBJECT
2912+public:
2913+ explicit UCPopupContext(QObject *parent = 0);
2914+};
2915+
2916+class QQuickItem;
2917+class UCActionContextAttached : public QObject
2918+{
2919+ Q_OBJECT
2920+public:
2921+ explicit UCActionContextAttached(QObject *owner);
2922+
2923+ inline QQuickItem *owner() const
2924+ {
2925+ return m_owner;
2926+ }
2927+ inline UCActionContext *context() const
2928+ {
2929+ return m_context;
2930+ }
2931+
2932+private:
2933+ QQuickItem *m_owner;
2934+ UCActionContext *m_context;
2935+ friend class UCActionContext;
2936+};
2937+
2938 QML_DECLARE_TYPE(UCActionContext)
2939+QML_DECLARE_TYPEINFO(UCActionContext, QML_HAS_ATTACHED_PROPERTIES)
2940
2941 #endif // UCACTIONCONTEXT_H
2942
2943=== modified file 'src/Ubuntu/Components/plugin/ucactionitem.cpp'
2944--- src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-12-18 12:42:58 +0000
2945+++ src/Ubuntu/Components/plugin/ucactionitem.cpp 2016-01-15 07:23:58 +0000
2946@@ -139,6 +139,7 @@
2947 {
2948 Q_Q(UCActionItem);
2949 if (attach) {
2950+ action->addOwningItem(q);
2951 QObject::connect(q, SIGNAL(triggered(QVariant)),
2952 q, SLOT(_q_invokeActionTrigger(QVariant)), Qt::DirectConnection);
2953 if (!(flags & CustomVisible)) {
2954@@ -162,6 +163,7 @@
2955 q, &UCActionItem::iconNameChanged, Qt::DirectConnection);
2956 }
2957 } else {
2958+ action->removeOwningItem(q);
2959 QObject::disconnect(q, SIGNAL(triggered(QVariant)),
2960 q, SLOT(_q_invokeActionTrigger(QVariant)));
2961 if (!(flags & CustomVisible)) {
2962@@ -228,7 +230,7 @@
2963 if (d->flags & UCActionItemPrivate::CustomText) {
2964 return d->text;
2965 }
2966- return d->action ? d->action->m_text : QString();
2967+ return d->action ? d->action->text() : QString();
2968 }
2969 void UCActionItem::setText(const QString &text)
2970 {
2971
2972=== modified file 'src/Ubuntu/Components/plugin/ucbottomedge.cpp'
2973--- src/Ubuntu/Components/plugin/ucbottomedge.cpp 2015-12-17 15:23:26 +0000
2974+++ src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-01-15 07:23:58 +0000
2975@@ -1,5 +1,5 @@
2976 /*
2977- * Copyright 2015 Canonical Ltd.
2978+ * Copyright 2016 Canonical Ltd.
2979 *
2980 * This program is free software; you can redistribute it and/or modify
2981 * it under the terms of the GNU Lesser General Public License as published by
2982@@ -62,7 +62,6 @@
2983 Q_Q(UCBottomEdge);
2984 // initialize hint
2985 QQml_setParent_noEvent(hint, q);
2986- hint->setParentItem(q);
2987
2988 // create default regions
2989 createDefaultRegions();
2990@@ -589,7 +588,7 @@
2991 * BottomEdgeRegion {
2992 * from: 0.6
2993 * to: 1.0
2994- * property color color: UbuntuColors.lightGrey
2995+ * property color color: UbuntuColors.silk
2996 * }
2997 * ]
2998 * }
2999@@ -706,6 +705,7 @@
3000 {
3001 Q_D(UCBottomEdge);
3002 // initialize hint
3003+ d->hint->setParentItem(this);
3004 d->hint->init();
3005
3006 // hint click() always commits
3007
3008=== modified file 'src/Ubuntu/Components/plugin/ucbottomedge_p.h'
3009--- src/Ubuntu/Components/plugin/ucbottomedge_p.h 2015-12-11 12:10:54 +0000
3010+++ src/Ubuntu/Components/plugin/ucbottomedge_p.h 2016-01-15 07:23:58 +0000
3011@@ -109,6 +109,5 @@
3012 UCCollapseAction(QObject *parent = 0);
3013 void activate();
3014 };
3015-Q_DECLARE_METATYPE(QQmlListProperty<UCAction>)
3016
3017 #endif // UCBOTTOMEDGE_P_H
3018
3019=== modified file 'src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp'
3020--- src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2015-09-28 07:00:37 +0000
3021+++ src/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp 2016-01-15 07:23:58 +0000
3022@@ -1,5 +1,5 @@
3023 /*
3024- * Copyright 2015 Canonical Ltd.
3025+ * Copyright 2016 Canonical Ltd.
3026 *
3027 * This program is free software; you can redistribute it and/or modify
3028 * it under the terms of the GNU Lesser General Public License as published by
3029@@ -64,14 +64,21 @@
3030
3031 \sa {StyledItem}
3032 */
3033-UCDeprecatedTheme::UCDeprecatedTheme(QObject *parent)
3034- : QObject(parent)
3035+UCDeprecatedTheme::UCDeprecatedTheme(UCTheme *theme)
3036+ : QObject(theme)
3037 {
3038 m_notes = QHash<QString, bool>();
3039- connect(&UCTheme::defaultTheme(), &UCTheme::nameChanged,
3040- this, &UCDeprecatedTheme::nameChanged);
3041- connect(&UCTheme::defaultTheme(), &UCTheme::paletteChanged,
3042- this, &UCDeprecatedTheme::paletteChanged);
3043+ connect(theme, SIGNAL(nameChanged()),
3044+ this, SIGNAL(nameChanged()));
3045+ connect(theme, SIGNAL(paletteChanged()),
3046+ this, SIGNAL(paletteChanged()));
3047+}
3048+
3049+UCTheme *UCDeprecatedTheme::defaultTheme()
3050+{
3051+ QQmlEngine *engine = qmlEngine(this);
3052+ Q_ASSERT(engine);
3053+ return UCTheme::defaultTheme(engine);
3054 }
3055
3056 void UCDeprecatedTheme::showDeprecatedNote(QObject *onItem, const char *note)
3057@@ -103,17 +110,17 @@
3058 QString UCDeprecatedTheme::name()
3059 {
3060 showDeprecatedNote(this, "Theme.name is deprecated. Use ThemeSettings instead.");
3061- return UCTheme::defaultTheme().name();
3062+ return defaultTheme()->name();
3063 }
3064 void UCDeprecatedTheme::setName(const QString& name)
3065 {
3066 showDeprecatedNote(this, "Theme.name is deprecated. Use ThemeSettings instead.");
3067- UCTheme::defaultTheme().setName(name);
3068+ defaultTheme()->setName(name);
3069 }
3070 void UCDeprecatedTheme::resetName()
3071 {
3072 showDeprecatedNote(this, "Theme.name is deprecated. Use ThemeSettings instead.");
3073- UCTheme::defaultTheme().resetName();
3074+ defaultTheme()->resetName();
3075 }
3076
3077 /*!
3078@@ -124,7 +131,7 @@
3079 QObject* UCDeprecatedTheme::palette()
3080 {
3081 showDeprecatedNote(this, "Theme.palette is deprecated. Use ThemeSettings instead.");
3082- return UCTheme::defaultTheme().palette();
3083+ return defaultTheme()->palette();
3084 }
3085
3086 /*!
3087@@ -135,18 +142,24 @@
3088 QQmlComponent* UCDeprecatedTheme::createStyleComponent(const QString& styleName, QObject* parent)
3089 {
3090 showDeprecatedNote(parent, "Theme.createStyleComponent() is deprecated. Use ThemeSettings instead.");
3091- return UCTheme::defaultTheme().createStyleComponent(styleName, parent, BUILD_VERSION(1, 2));
3092+ return defaultTheme()->createStyleComponent(styleName, parent, BUILD_VERSION(1, 2));
3093 }
3094
3095 void UCDeprecatedTheme::registerToContext(QQmlContext* context)
3096 {
3097- UCTheme::defaultTheme().m_engine = context->engine();
3098- UCTheme::defaultTheme().updateEnginePaths();
3099+ // the default theme must be set up prior to this call
3100+ QQmlEngine *engine = context->engine();
3101+ UCTheme *theme = UCTheme::defaultTheme(engine);
3102+ Q_ASSERT(theme);
3103+ // initialize deprecated theme using the default theme from the engine
3104+ UCDeprecatedTheme *oldTheme = new UCDeprecatedTheme(theme);
3105+ QQmlEngine::setContextForObject(oldTheme, context);
3106+
3107 // register deprecated Theme property
3108- context->setContextProperty("Theme", this);
3109+ context->setContextProperty("Theme", oldTheme);
3110
3111 ContextPropertyChangeListener *themeChangeListener =
3112 new ContextPropertyChangeListener(context, "Theme");
3113- QObject::connect(this, SIGNAL(nameChanged()),
3114+ QObject::connect(oldTheme, SIGNAL(nameChanged()),
3115 themeChangeListener, SLOT(updateContextProperty()));
3116 }
3117
3118=== modified file 'src/Ubuntu/Components/plugin/ucdeprecatedtheme.h'
3119--- src/Ubuntu/Components/plugin/ucdeprecatedtheme.h 2015-05-18 05:42:05 +0000
3120+++ src/Ubuntu/Components/plugin/ucdeprecatedtheme.h 2016-01-15 07:23:58 +0000
3121@@ -1,5 +1,5 @@
3122 /*
3123- * Copyright 2015 Canonical Ltd.
3124+ * Copyright 2016 Canonical Ltd.
3125 *
3126 * This program is free software; you can redistribute it and/or modify
3127 * it under the terms of the GNU Lesser General Public License as published by
3128@@ -25,17 +25,14 @@
3129 class QQmlComponent;
3130 class QQmlContext;
3131 class UCTheme;
3132+class QQmlEngine;
3133 class UCDeprecatedTheme : public QObject
3134 {
3135 Q_OBJECT
3136 Q_PROPERTY(QString name READ name WRITE setName RESET resetName NOTIFY nameChanged)
3137 Q_PROPERTY(QObject* palette READ palette NOTIFY paletteChanged)
3138 public:
3139- static UCDeprecatedTheme& instance() {
3140- static UCDeprecatedTheme instance;
3141- return instance;
3142- }
3143- explicit UCDeprecatedTheme(QObject *parent = 0);
3144+ explicit UCDeprecatedTheme(UCTheme *theme);
3145
3146 // getter/setters
3147 QString name();
3148@@ -44,7 +41,7 @@
3149 QObject* palette();
3150
3151 Q_INVOKABLE QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent);
3152- void registerToContext(QQmlContext* context);
3153+ static void registerToContext(QQmlContext* context);
3154
3155 Q_SIGNALS:
3156 void nameChanged();
3157@@ -52,6 +49,7 @@
3158
3159 private:
3160 void showDeprecatedNote(QObject *onItem, const char *note);
3161+ UCTheme *defaultTheme();
3162 QHash<QString, bool> m_notes;
3163 };
3164
3165
3166=== modified file 'src/Ubuntu/Components/plugin/uclabel.cpp'
3167--- src/Ubuntu/Components/plugin/uclabel.cpp 2015-12-07 12:09:45 +0000
3168+++ src/Ubuntu/Components/plugin/uclabel.cpp 2016-01-15 07:23:58 +0000
3169@@ -1,5 +1,5 @@
3170 /*
3171- * Copyright 2015 Canonical Ltd.
3172+ * Copyright 2016 Canonical Ltd.
3173 *
3174 * This program is free software; you can redistribute it and/or modify
3175 * it under the terms of the GNU Lesser General Public License as published by
3176@@ -108,8 +108,11 @@
3177 if (m_flags & ColorSet) {
3178 return;
3179 }
3180- setColor(theme->getPaletteColor("selected", "backgroundText"));
3181- m_flags &= ~ColorSet;
3182+ UCTheme *theme = getTheme();
3183+ if (theme) {
3184+ setColor(theme->getPaletteColor("normal", "baseText"));
3185+ m_flags &= ~ColorSet;
3186+ }
3187 }
3188
3189 /*!
3190
3191=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
3192--- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-12-15 15:58:54 +0000
3193+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-01-15 07:23:58 +0000
3194@@ -94,20 +94,20 @@
3195 void UCListItemDivider::paletteChanged()
3196 {
3197 Q_D(UCListItemDivider);
3198- QColor background = d->listItem->getTheme()->getPaletteColor("normal", "background");
3199- if (!background.isValid()) {
3200- return;
3201- }
3202- // FIXME: we need a palette value for divider colors, till then base on the background
3203- // luminance
3204 if (!d->colorFromChanged || !d->colorToChanged) {
3205- qreal luminance = (background.red()*212 + background.green()*715 + background.blue()*73)/1000.0/255.0;
3206- bool lightBackground = (luminance > 0.85);
3207+ QColor themeColor;
3208+ UCTheme *theme = d->listItem->getTheme();
3209+ if (theme) {
3210+ themeColor = d->listItem->getTheme()->getPaletteColor("normal", "base");
3211+ }
3212+ if (!themeColor.isValid()) {
3213+ return;
3214+ }
3215 if (!d->colorFromChanged) {
3216- d->colorFrom = lightBackground ? QColor("#26000000") : QColor("#26FFFFFF");
3217+ d->colorFrom = themeColor;
3218 }
3219 if (!d->colorToChanged) {
3220- d->colorTo = lightBackground ? QColor("#14FFFFFF") : QColor("#14000000");
3221+ d->colorTo = themeColor;
3222 }
3223 updateGradient();
3224 }
3225@@ -117,13 +117,13 @@
3226 {
3227 Q_D(UCListItemDivider);
3228 d->gradient.clear();
3229- d->gradient.append(QGradientStop(0.0, d->colorFrom));
3230- d->gradient.append(QGradientStop(0.49, d->colorFrom));
3231- d->gradient.append(QGradientStop(0.5, d->colorTo));
3232- d->gradient.append(QGradientStop(1.0, d->colorTo));
3233- if (d->listItem) {
3234- d->listItem->update();
3235+ if (height() > UCUnits::instance().dp(1)) {
3236+ d->gradient.append(QGradientStop(0.0, d->colorFrom));
3237+ d->gradient.append(QGradientStop(0.49, d->colorFrom));
3238+ d->gradient.append(QGradientStop(0.5, d->colorTo));
3239+ d->gradient.append(QGradientStop(1.0, d->colorTo));
3240 }
3241+ update();
3242 }
3243
3244 QSGNode *UCListItemDivider::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
3245@@ -137,9 +137,13 @@
3246
3247 UCListItemPrivate *pListItem = UCListItemPrivate::get(d->listItem);
3248 bool lastItem = pListItem->countOwner ? (pListItem->index() == (pListItem->countOwner->property("count").toInt() - 1)): false;
3249- if (!lastItem && (d->gradient.size() > 0) && ((d->colorFrom.alphaF() >= (1.0f / 255.0f)) || (d->colorTo.alphaF() >= (1.0f / 255.0f)))) {
3250+ if (!lastItem && ((d->colorFrom.alphaF() >= (1.0f / 255.0f)) || (d->colorTo.alphaF() >= (1.0f / 255.0f)))) {
3251 dividerNode->setRect(boundingRect());
3252- dividerNode->setGradientStops(d->gradient);
3253+ if (d->gradient.size() > 0) {
3254+ dividerNode->setGradientStops(d->gradient);
3255+ } else {
3256+ dividerNode->setColor(d->colorFrom);
3257+ }
3258 dividerNode->update();
3259 return dividerNode;
3260 } else if (node) {
3261@@ -1648,7 +1652,10 @@
3262 {
3263 Q_D(UCListItem);
3264 d->customColor = false;
3265- d->highlightColor = getTheme()->getPaletteColor("selected", "background");
3266+ UCTheme *theme = getTheme();
3267+ if (theme) {
3268+ d->highlightColor = theme->getPaletteColor("selected", "foreground");
3269+ }
3270 update();
3271 Q_EMIT highlightColorChanged();
3272 }
3273@@ -1745,10 +1752,16 @@
3274 if (mainAction == action) {
3275 return;
3276 }
3277+ if (mainAction) {
3278+ mainAction->removeOwningItem(q);
3279+ }
3280 mainAction = action;
3281- if (mainAction && (mainAction->m_parameterType == UCAction::None)) {
3282- // call setProperty to invoke notify signal
3283- mainAction->setProperty("parameterType", UCAction::Integer);
3284+ if (mainAction) {
3285+ mainAction->addOwningItem(q);
3286+ if (mainAction->m_parameterType == UCAction::None) {
3287+ // call setProperty to invoke notify signal
3288+ mainAction->setProperty("parameterType", UCAction::Integer);
3289+ }
3290 }
3291 Q_EMIT q->actionChanged();
3292 }
3293
3294=== modified file 'src/Ubuntu/Components/plugin/uclistitem_p.h'
3295--- src/Ubuntu/Components/plugin/uclistitem_p.h 2015-11-16 06:35:05 +0000
3296+++ src/Ubuntu/Components/plugin/uclistitem_p.h 2016-01-15 07:23:58 +0000
3297@@ -26,7 +26,7 @@
3298
3299 #define IMPLICIT_LISTITEM_WIDTH_GU 40
3300 #define IMPLICIT_LISTITEM_HEIGHT_GU 7
3301-#define DIVIDER_THICKNESS_DP 2
3302+#define DIVIDER_THICKNESS_DP 1
3303 #define DEFAULT_SWIPE_THRESHOLD_GU 1.5
3304
3305 class QQuickFlickable;
3306
3307=== modified file 'src/Ubuntu/Components/plugin/uclistitemlayout.cpp'
3308--- src/Ubuntu/Components/plugin/uclistitemlayout.cpp 2015-11-10 11:39:51 +0000
3309+++ src/Ubuntu/Components/plugin/uclistitemlayout.cpp 2016-01-15 07:23:58 +0000
3310@@ -27,6 +27,7 @@
3311 \qmltype ListItemLayout
3312 \instantiates UCListItemLayout
3313 \inqmlmodule Ubuntu.Components 1.3
3314+ \since Ubuntu.Components 1.3
3315 \inherits SlotsLayout
3316 \ingroup ubuntu
3317
3318@@ -74,7 +75,7 @@
3319 \l ListItem and ListItemLayout:
3320 \qml
3321 ListItem {
3322- height: layout.height + divider.height
3323+ height: layout.height + (divider.visible ? divider.height : 0)
3324 ListItemLayout {
3325 id: layout
3326 title.text: "Hello developers!"
3327@@ -103,7 +104,7 @@
3328 \qml
3329 ListItem {
3330 id: listItem
3331- height: layout.height + divider.height
3332+ height: layout.height + (divider.visible ? divider.height : 0)
3333
3334 ListItemLayout {
3335 id: layout
3336@@ -155,8 +156,8 @@
3337 The \l title is positioned at the top, followed by \l subtitle and \l summary,
3338 respectively.
3339
3340- The \l subtitle has its top anchored to \l {title}'s baseline, with a margin of
3341- 4 DPs.
3342+ The \l subtitle has its top anchored to \l {title}'s bottom, with a margin of
3343+ 2 DPs.
3344
3345 The \l summary has its top tightly anchored to \l {subtitle}'s bottom.
3346
3347@@ -208,6 +209,81 @@
3348 }
3349 \endqml
3350
3351+ \section1 About aliasing labels properties
3352+ Due to the way ListItemsLayout's labels are created (see
3353+ \l {Optimizing memory consumption}) it is not possible to
3354+ directly alias their properties. It is still possible, however,
3355+ to expose an API that gives indirect read-write access to those
3356+ properties.
3357+ The following code:
3358+
3359+ \qml
3360+ ListItem {
3361+ property alias titleText: layout.title.text
3362+ ListItemLayout {
3363+ id: layout
3364+ }
3365+ }
3366+ \endqml
3367+
3368+ will return the error "Invalid alias location", because
3369+ the title object does not yet exist at time when the alias
3370+ is created.
3371+
3372+ If you need to expose an API for your component that allows
3373+ changing the properties of the labels, we recommend aliasing
3374+ the labels themselves. Let's assume you want to create a
3375+ QML component to use as a delegate of many
3376+ list views inside your application: you will probably have a qml
3377+ file holding the definition of the that delegate, and the content
3378+ of that file will be similar to:
3379+ \qml
3380+ //Content of CustomListItem.qml
3381+ import QtQuick 2.4
3382+ import Ubuntu.Components 1.3
3383+
3384+ ListItem {
3385+ id: listitem
3386+ property alias title: layout.title
3387+ property alias iconName: icon.name
3388+
3389+ height: layout.height + (divider.visible ? divider.height : 0)
3390+
3391+ ListItemLayout {
3392+ id: layout
3393+ Icon {
3394+ id: icon
3395+ width: units.gu(2)
3396+ }
3397+ }
3398+ }
3399+ \endqml
3400+
3401+ As you can see, we alias the label item itself instead of its
3402+ properties. This also has the advantage of only exposing one alias
3403+ instead of one for each property, thus making your QML app a bit more performant.
3404+ Once your delegate is defined, you can use it in your ListViews like usual.
3405+ \qml
3406+ //other UI code...
3407+
3408+ ListView {
3409+ anchors.fill: parent
3410+ model: ListModel {
3411+ id: listViewModel
3412+ ListElement { titleText: "Hello1"; icon: "message" }
3413+ ListElement { titleText: "Hello2"; icon: "email" }
3414+ ListElement { titleText: "Hello3"; icon: "email" }
3415+ ListElement { titleText: "Hello4"; icon: "message" }
3416+ }
3417+ delegate: CustomListItem {
3418+ title.text: model.titleText
3419+ iconName: model.icon
3420+ }
3421+ }
3422+ \endqml
3423+
3424+ Note how title's properties are all accessible via the "title" identifier.
3425+
3426 */
3427 UCListItemLayout::UCListItemLayout(QQuickItem *parent)
3428 : UCSlotsLayout(parent)
3429
3430=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
3431--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-12-16 10:01:07 +0000
3432+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2016-01-15 07:23:58 +0000
3433@@ -327,8 +327,9 @@
3434 Q_Q(UCStyledItemBase);
3435 // either styleComponent or styleName is valid
3436 QQmlComponent *component = styleComponent;
3437- if (!component) {
3438- component = q->getTheme()->createStyleComponent(styleDocument + ".qml", q, styleVersion);
3439+ UCTheme *theme = q->getTheme();
3440+ if (!component && theme) {
3441+ component = theme->createStyleComponent(styleDocument + ".qml", q, styleVersion);
3442 }
3443 if (!component) {
3444 return false;
3445
3446=== modified file 'src/Ubuntu/Components/plugin/uctheme.cpp'
3447--- src/Ubuntu/Components/plugin/uctheme.cpp 2015-10-20 11:32:09 +0000
3448+++ src/Ubuntu/Components/plugin/uctheme.cpp 2016-01-15 07:23:58 +0000
3449@@ -1,5 +1,5 @@
3450 /*
3451- * Copyright 2015 Canonical Ltd.
3452+ * Copyright 2016 Canonical Ltd.
3453 *
3454 * This program is free software; you can redistribute it and/or modify
3455 * it under the terms of the GNU Lesser General Public License as published by
3456@@ -44,7 +44,7 @@
3457 #include <QtQml/private/qqmlbinding_p.h>
3458 #undef foreach
3459
3460-
3461+const char *CONTEXT_THEME = "theme";
3462 quint16 UCTheme::previousVersion = 0;
3463 /*!
3464 * \qmltype ThemeSettings
3465@@ -345,20 +345,31 @@
3466 */
3467 UCTheme::UCTheme(QObject *parent)
3468 : QObject(parent)
3469- , m_palette(UCTheme::defaultTheme().m_palette)
3470- , m_engine(UCTheme::defaultTheme().m_engine)
3471- , m_defaultStyle(false)
3472-{
3473- init();
3474-}
3475-
3476-UCTheme::UCTheme(bool defaultStyle, QObject *parent)
3477- : QObject(parent)
3478- , m_palette(NULL)
3479- , m_engine(NULL)
3480- , m_defaultStyle(defaultStyle)
3481-{
3482- init();
3483+ , m_parentTheme(Q_NULLPTR)
3484+ , m_palette(Q_NULLPTR)
3485+ , m_completed(false)
3486+{
3487+ init();
3488+}
3489+
3490+UCTheme *UCTheme::defaultTheme(QQmlEngine *engine)
3491+{
3492+ if (!engine || !engine->rootContext()) {
3493+ return Q_NULLPTR;
3494+ }
3495+ UCTheme *theme = Q_NULLPTR;
3496+ for (int tryCount = 0; !theme && tryCount < 2; tryCount++) {
3497+ theme = engine->rootContext()->contextProperty(CONTEXT_THEME).value<UCTheme*>();
3498+ if (!theme) {
3499+ createDefaultTheme(engine);
3500+ }
3501+ }
3502+ return theme;
3503+}
3504+
3505+void UCTheme::setupDefault()
3506+{
3507+ // FIXME: move this into QPA
3508 // set the default font
3509 QFont defaultFont = QGuiApplication::font();
3510 defaultFont.setFamily("Ubuntu");
3511@@ -378,21 +389,24 @@
3512
3513 void UCTheme::classBegin()
3514 {
3515- m_engine = qmlEngine(this);
3516- updateEnginePaths();
3517- loadPalette();
3518+ QQmlEngine *engine = qmlEngine(this);
3519+ updateEnginePaths(engine);
3520+ m_palette = UCTheme::defaultTheme(engine)->m_palette;
3521+ if (!m_palette) {
3522+ loadPalette(engine);
3523+ }
3524 }
3525
3526-void UCTheme::updateEnginePaths()
3527+void UCTheme::updateEnginePaths(QQmlEngine *engine)
3528 {
3529- if (!m_engine) {
3530+ if (!engine) {
3531 return;
3532 }
3533
3534 QStringList paths = themeSearchPath();
3535 Q_FOREACH(const QString &path, paths) {
3536- if (QDir(path).exists() && !m_engine->importPathList().contains(path)) {
3537- m_engine->addImportPath(path);
3538+ if (QDir(path).exists() && !engine->importPathList().contains(path)) {
3539+ engine->addImportPath(path);
3540 }
3541 }
3542 }
3543@@ -458,7 +472,7 @@
3544 this, &UCTheme::_q_defaultThemeChanged);
3545 updateThemePaths();
3546 }
3547- loadPalette();
3548+ loadPalette(qmlEngine(this));
3549 Q_EMIT nameChanged();
3550 updateThemedItems();
3551 }
3552@@ -526,7 +540,7 @@
3553 QObject* UCTheme::palette()
3554 {
3555 if (!m_palette) {
3556- loadPalette(false);
3557+ loadPalette(qmlEngine(this), false);
3558 }
3559 return m_palette;
3560 }
3561@@ -611,16 +625,20 @@
3562 }
3563
3564 // registers the default theme property to the root context
3565-void UCTheme::registerToContext(QQmlContext* context)
3566+void UCTheme::createDefaultTheme(QQmlEngine* engine)
3567 {
3568- UCTheme *defaultTheme = &UCTheme::defaultTheme();
3569- defaultTheme->m_engine = context->engine();
3570- defaultTheme->updateEnginePaths();
3571-
3572- context->setContextProperty("theme", defaultTheme);
3573+ QQmlContext *context = engine->rootContext();
3574+
3575+ UCTheme *theme = new UCTheme(engine);
3576+ QQmlEngine::setContextForObject(theme, context);
3577+ context->setContextProperty(CONTEXT_THEME, theme);
3578+
3579+ theme->setupDefault();
3580+ theme->updateEnginePaths(engine);
3581+
3582 ContextPropertyChangeListener *listener =
3583- new ContextPropertyChangeListener(context, "theme");
3584- QObject::connect(defaultTheme, &UCTheme::nameChanged,
3585+ new ContextPropertyChangeListener(context, CONTEXT_THEME);
3586+ QObject::connect(theme, &UCTheme::nameChanged,
3587 listener, &ContextPropertyChangeListener::updateContextProperty);
3588 }
3589
3590@@ -674,42 +692,38 @@
3591
3592 if (parent != NULL) {
3593 QQmlEngine* engine = qmlEngine(parent);
3594- if (engine != m_engine && !m_engine) {
3595- m_engine = engine;
3596- updateEnginePaths();
3597- }
3598+ Q_ASSERT(engine);
3599+ Q_ASSERT(engine == qmlEngine(this));
3600 // make sure we have the paths
3601- if (engine != NULL) {
3602- bool fallback = false;
3603- QUrl url = styleUrl(styleName, version, &fallback);
3604- if (url.isValid()) {
3605- if (fallback) {
3606- qmlInfo(parent) << QStringLiteral("Theme '%1' has no '%2' style for version %3.%4, fall back to version %5.%6.")
3607- .arg(name()).arg(styleName).arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version))
3608- .arg(MAJOR_VERSION(LATEST_UITK_VERSION)).arg(MINOR_VERSION(LATEST_UITK_VERSION));
3609- }
3610- component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, parent);
3611- if (component->isError()) {
3612- qmlInfo(parent) << component->errorString();
3613- delete component;
3614- component = NULL;
3615- } else {
3616- // set context for the component
3617- QQmlEngine::setContextForObject(component, qmlContext(parent));
3618- }
3619+ bool fallback = false;
3620+ QUrl url = styleUrl(styleName, version, &fallback);
3621+ if (url.isValid()) {
3622+ if (fallback) {
3623+ qmlInfo(parent) << QStringLiteral("Theme '%1' has no '%2' style for version %3.%4, fall back to version %5.%6.")
3624+ .arg(name()).arg(styleName).arg(MAJOR_VERSION(version)).arg(MINOR_VERSION(version))
3625+ .arg(MAJOR_VERSION(LATEST_UITK_VERSION)).arg(MINOR_VERSION(LATEST_UITK_VERSION));
3626+ }
3627+ component = new QQmlComponent(engine, url, QQmlComponent::PreferSynchronous, parent);
3628+ if (component->isError()) {
3629+ qmlInfo(parent) << component->errorString();
3630+ delete component;
3631+ component = NULL;
3632 } else {
3633- qmlInfo(parent) <<
3634- UbuntuI18n::instance().tr(QString("Warning: Style %1 not found in theme %2").arg(styleName).arg(name()));
3635+ // set context for the component
3636+ QQmlEngine::setContextForObject(component, qmlContext(parent));
3637 }
3638+ } else {
3639+ qmlInfo(parent) <<
3640+ UbuntuI18n::instance().tr(QString("Warning: Style %1 not found in theme %2").arg(styleName).arg(name()));
3641 }
3642 }
3643
3644 return component;
3645 }
3646
3647-void UCTheme::loadPalette(bool notify)
3648+void UCTheme::loadPalette(QQmlEngine *engine, bool notify)
3649 {
3650- if (!m_engine) {
3651+ if (!engine) {
3652 return;
3653 }
3654 if (m_palette) {
3655@@ -721,7 +735,7 @@
3656 // theme may not have palette defined
3657 QUrl paletteUrl = styleUrl("Palette.qml", previousVersion ? previousVersion : LATEST_UITK_VERSION);
3658 if (paletteUrl.isValid()) {
3659- m_palette = QuickUtils::instance().createQmlObject(paletteUrl, m_engine);
3660+ m_palette = QuickUtils::instance().createQmlObject(paletteUrl, engine);
3661 if (m_palette) {
3662 m_palette->setParent(this);
3663 }
3664@@ -731,7 +745,7 @@
3665 }
3666 } else {
3667 // use the default palette if none defined
3668- m_palette = defaultTheme().m_palette;
3669+ m_palette = defaultTheme(engine)->m_palette;
3670 }
3671 }
3672
3673@@ -747,4 +761,3 @@
3674 }
3675 return result;
3676 }
3677-
3678
3679=== modified file 'src/Ubuntu/Components/plugin/uctheme.h'
3680--- src/Ubuntu/Components/plugin/uctheme.h 2015-10-20 11:32:09 +0000
3681+++ src/Ubuntu/Components/plugin/uctheme.h 2016-01-15 07:23:58 +0000
3682@@ -1,5 +1,5 @@
3683 /*
3684- * Copyright 2015 Canonical Ltd.
3685+ * Copyright 2016 Canonical Ltd.
3686 *
3687 * This program is free software; you can redistribute it and/or modify
3688 * it under the terms of the GNU Lesser General Public License as published by
3689@@ -64,11 +64,7 @@
3690 };
3691
3692 explicit UCTheme(QObject *parent = 0);
3693- static UCTheme &defaultTheme()
3694- {
3695- static UCTheme instance(true);
3696- return instance;
3697- }
3698+ static UCTheme *defaultTheme(QQmlEngine *engine);
3699
3700 // getter/setters
3701 UCTheme *parentTheme();
3702@@ -82,7 +78,6 @@
3703
3704 // internal, used by the deprecated Theme.createStyledComponent()
3705 QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent, quint16 version = 0);
3706- static void registerToContext(QQmlContext* context);
3707 void attachItem(QQuickItem *item, bool attach);
3708
3709 // helper functions
3710@@ -106,12 +101,13 @@
3711 void _q_defaultThemeChanged();
3712
3713 private:
3714- UCTheme(bool defaultStyle, QObject *parent = 0);
3715+ static void createDefaultTheme(QQmlEngine* engine);
3716+ void setupDefault();
3717 void init();
3718- void updateEnginePaths();
3719+ void updateEnginePaths(QQmlEngine *engine);
3720 void updateThemePaths();
3721 QUrl styleUrl(const QString& styleName, quint16 version, bool *isFallback = NULL);
3722- void loadPalette(bool notify = true);
3723+ void loadPalette(QQmlEngine *engine, bool notify = true);
3724 void updateThemedItems();
3725
3726 class PaletteConfig
3727@@ -165,8 +161,6 @@
3728 QList<ThemeRecord> m_themePaths;
3729 UCDefaultTheme m_defaultTheme;
3730 QPODVector<QQuickItem*, 4> m_attachedItems;
3731- QQmlEngine *m_engine;
3732- bool m_defaultStyle:1;
3733 bool m_completed:1;
3734
3735 friend class UCDeprecatedTheme;
3736
3737=== modified file 'src/Ubuntu/Components/plugin/ucthemingextension.cpp'
3738--- src/Ubuntu/Components/plugin/ucthemingextension.cpp 2015-10-21 14:02:43 +0000
3739+++ src/Ubuntu/Components/plugin/ucthemingextension.cpp 2016-01-15 07:23:58 +0000
3740@@ -1,5 +1,5 @@
3741 /*
3742- * Copyright 2015 Canonical Ltd.
3743+ * Copyright 2016 Canonical Ltd.
3744 *
3745 * This program is free software; you can redistribute it and/or modify
3746 * it under the terms of the GNU Lesser General Public License as published by
3747@@ -107,13 +107,28 @@
3748 return;
3749 }
3750
3751+ // when we set a parent, the two items must be under the same engine
3752+ if (newParent && qmlEngine(m_item) != qmlEngine(newParent)) {
3753+ return;
3754+ }
3755+
3756+ if (!qmlEngine(m_item)) {
3757+ // the item is about to be deleted, parent change occurs as the parent is removed
3758+ Q_ASSERT(!newParent);
3759+ return;
3760+ }
3761+
3762 // make sure we have these handlers attached to each intermediate item
3763 QQuickItem *oldThemedAscendant = UCThemingExtension::ascendantThemed(m_prevParent);
3764 QQuickItem *newThemedAscendant = UCThemingExtension::ascendantThemed(newParent);
3765 UCThemingExtension *oldExtension = qobject_cast<UCThemingExtension*>(oldThemedAscendant);
3766 UCThemingExtension *newExtension = qobject_cast<UCThemingExtension*>(newThemedAscendant);
3767- UCTheme *oldTheme = oldExtension ? oldExtension->getTheme() : &UCTheme::defaultTheme();
3768- UCTheme *newTheme = newExtension ? newExtension->getTheme() : &UCTheme::defaultTheme();
3769+ UCTheme *oldTheme = oldExtension ? oldExtension->getTheme() : UCTheme::defaultTheme(qmlEngine(m_item));
3770+ UCTheme *newTheme = newExtension ? newExtension->getTheme() : UCTheme::defaultTheme(qmlEngine(m_item));
3771+
3772+ // neither of the themes can be null!
3773+ Q_ASSERT(oldTheme);
3774+ Q_ASSERT(newTheme);
3775
3776 if (oldTheme != newTheme) {
3777 UCThemingExtension *extension = qobject_cast<UCThemingExtension*>(m_item);
3778@@ -134,11 +149,10 @@
3779 *
3780 */
3781 UCThemingExtension::UCThemingExtension(QQuickItem *extendedItem)
3782- : theme(&UCTheme::defaultTheme())
3783+ : theme(Q_NULLPTR)
3784 , themedItem(extendedItem)
3785 , themeType(Inherited)
3786 {
3787- theme->attachItem(themedItem, true);
3788 themedItem->setUserData(xdata, new UCItemAttached(themedItem));
3789 }
3790
3791@@ -157,7 +171,7 @@
3792 }
3793 QQuickItem *upperThemed = ascendantThemed(QQuickItemPrivate::get(themedItem)->parentItem);
3794 UCThemingExtension *extension = qobject_cast<UCThemingExtension*>(upperThemed);
3795- UCTheme *parentTheme = extension ? extension->getTheme() : &UCTheme::defaultTheme();
3796+ UCTheme *parentTheme = extension ? extension->getTheme() : UCTheme::defaultTheme(qmlEngine(themedItem));
3797 if (parentTheme != theme) {
3798 theme->setParentTheme(parentTheme);
3799 }
3800@@ -203,8 +217,18 @@
3801 }
3802 }
3803
3804-UCTheme *UCThemingExtension::getTheme() const
3805+UCTheme *UCThemingExtension::getTheme()
3806 {
3807+ if (!theme) {
3808+ theme = UCTheme::defaultTheme(qmlEngine(themedItem));
3809+ if (!theme) {
3810+ QString msg = QStringLiteral("The item %1 was created without a valid QML Engine. Styling will not be possible.")
3811+ .arg(themedItem->metaObject()->className());
3812+ qCritical().noquote() << msg;
3813+ return Q_NULLPTR;
3814+ }
3815+ theme->attachItem(themedItem, true);
3816+ }
3817 return theme;
3818 }
3819 void UCThemingExtension::setTheme(UCTheme *newTheme, ThemeType type)
3820@@ -244,7 +268,7 @@
3821 {
3822 QQuickItem *upperThemed = ascendantThemed(QQuickItemPrivate::get(themedItem)->parentItem);
3823 UCThemingExtension *extension = qobject_cast<UCThemingExtension*>(upperThemed);
3824- UCTheme *theme = extension ? extension->getTheme() : &UCTheme::defaultTheme();
3825+ UCTheme *theme = extension ? extension->getTheme() : UCTheme::defaultTheme(qmlEngine(themedItem));
3826 setTheme(theme, Inherited);
3827 }
3828
3829
3830=== modified file 'src/Ubuntu/Components/plugin/ucthemingextension.h'
3831--- src/Ubuntu/Components/plugin/ucthemingextension.h 2015-10-20 10:19:10 +0000
3832+++ src/Ubuntu/Components/plugin/ucthemingextension.h 2016-01-15 07:23:58 +0000
3833@@ -1,5 +1,5 @@
3834 /*
3835- * Copyright 2015 Canonical Ltd.
3836+ * Copyright 2016 Canonical Ltd.
3837 *
3838 * This program is free software; you can redistribute it and/or modify
3839 * it under the terms of the GNU Lesser General Public License as published by
3840@@ -44,14 +44,14 @@
3841 virtual void itemThemeChanged(UCTheme *, UCTheme*);
3842 virtual void itemThemeReloaded(UCTheme *);
3843
3844- UCTheme *getTheme() const;
3845+ UCTheme *getTheme();
3846 void setTheme(UCTheme *newTheme, ThemeType type = Custom);
3847 void resetTheme();
3848
3849 static bool isThemed(QQuickItem *item);
3850 static QQuickItem *ascendantThemed(QQuickItem *item);
3851
3852-protected:
3853+private:
3854 QPointer<UCTheme> theme;
3855 QQuickItem *themedItem;
3856 ThemeType themeType;
3857
3858=== modified file 'src/Ubuntu/Components/qmldir'
3859--- src/Ubuntu/Components/qmldir 2015-12-17 13:48:23 +0000
3860+++ src/Ubuntu/Components/qmldir 2016-01-15 07:23:58 +0000
3861@@ -138,3 +138,5 @@
3862 ScrollView 1.3 1.3/ScrollView.qml
3863 PageHeader 1.3 1.3/PageHeader.qml
3864 Toolbar 1.3 1.3/Toolbar.qml
3865+singleton UbuntuColors 1.3 1.3/UbuntuColors.qml
3866+Icon 1.3 1.3/Icon.qml
3867
3868=== modified file 'src/Ubuntu/UbuntuGestures/ucswipearea.cpp'
3869--- src/Ubuntu/UbuntuGestures/ucswipearea.cpp 2015-12-17 15:23:26 +0000
3870+++ src/Ubuntu/UbuntuGestures/ucswipearea.cpp 2016-01-15 07:23:58 +0000
3871@@ -813,10 +813,13 @@
3872
3873 // FIXME: Handle window->screen() changes (ie window changing screens)
3874 Q_D(UCSwipeArea);
3875- qreal pixelsPerMm = value.window->screen()->physicalDotsPerInch() / 25.4;
3876- // FIXME: dpi can be negative lp#1525293
3877- if (pixelsPerMm > 0)
3878- d->setPixelsPerMm(pixelsPerMm);
3879+ qreal pixelsPerInch = value.window->screen()->physicalDotsPerInch();
3880+ if (pixelsPerInch < 0) {
3881+ // FIXME: dpi can be negative lp#1525293
3882+ // It can return garbage when run in a XVFB server (Virtual Framebuffer 'fake' X server)
3883+ pixelsPerInch = 72;
3884+ }
3885+ d->setPixelsPerMm(pixelsPerInch / 25.4);
3886 }
3887 }
3888 if (change == ItemVisibleHasChanged) {
3889
3890=== modified file 'src/src.pro'
3891--- src/src.pro 2015-11-05 11:00:10 +0000
3892+++ src/src.pro 2016-01-15 07:23:58 +0000
3893@@ -15,6 +15,7 @@
3894
3895 src_test.subdir = Ubuntu/Test
3896 src_test.target = sub-test
3897+src_test.depends = sub-components
3898
3899 #order is important
3900 SUBDIRS += src_gestures src_components src_layouts src_performance_metrics src_test
3901
3902=== modified file 'tests/unit/tst_components/tst_action.qml'
3903--- tests/unit/tst_components/tst_action.qml 2015-12-12 07:22:08 +0000
3904+++ tests/unit/tst_components/tst_action.qml 2016-01-15 07:23:58 +0000
3905@@ -37,6 +37,8 @@
3906 function cleanup() {
3907 triggeredSignalSpy.target = action;
3908 triggeredSignalSpy.clear();
3909+ context1.active = false;
3910+ context2.active = false;
3911 }
3912
3913 function initTestCase() {
3914@@ -126,15 +128,21 @@
3915
3916 function test_activate_contexts_data() {
3917 return [
3918- {tag: "Activate context1", active: context1, inactive: context2},
3919- {tag: "Activate context2", active: context2, inactive: context1},
3920- {tag: "Activate context1 again", active: context1, inactive: context2},
3921+ {tag: "Activate context1", active: [context1], inactive: [context2]},
3922+ {tag: "Activate context2", active: [context2], inactive: [context1]},
3923+ {tag: "Activate context1, context2", active: [context1, context2], inactive: []},
3924 ];
3925 }
3926 function test_activate_contexts(data) {
3927- data.active.active = true;
3928- verify(data.active.active, "Context activation error");
3929- verify(!data.inactive.active, "Context deactivation error");
3930+ for (var i = 0; i < data.active.length; i++) {
3931+ data.active[i].active = true;
3932+ }
3933+ for (var i = 0; i < data.active.length; i++) {
3934+ verify(data.active[i].active, "Context activation error");
3935+ }
3936+ for (var i = 0; i < data.inactive.length; i++) {
3937+ verify(!data.inactive[i].active, "Context deactivation error");
3938+ }
3939 }
3940
3941 function test_overloaded_action_trigger_data() {
3942
3943=== modified file 'tests/unit_x11/tst_bottomedge/LeanActiveRegionChange.qml'
3944--- tests/unit_x11/tst_bottomedge/LeanActiveRegionChange.qml 2015-11-27 10:36:08 +0000
3945+++ tests/unit_x11/tst_bottomedge/LeanActiveRegionChange.qml 2016-01-15 07:23:58 +0000
3946@@ -30,7 +30,7 @@
3947 contentComponent: Rectangle {
3948 width: bottomEdge.width
3949 height: bottomEdge.height
3950- color: UbuntuColors.lightGrey
3951+ color: UbuntuColors.silk
3952 }
3953
3954 BottomEdgeRegion {
3955
3956=== modified file 'tests/unit_x11/tst_components/AppTheme/Palette.qml'
3957--- tests/unit_x11/tst_components/AppTheme/Palette.qml 2015-04-24 14:34:39 +0000
3958+++ tests/unit_x11/tst_components/AppTheme/Palette.qml 2016-01-15 07:23:58 +0000
3959@@ -20,5 +20,5 @@
3960
3961 Suru.Palette {
3962 normal.background: "#A21E1C"
3963- selected.backgroundText: "lightblue"
3964+ normal.baseText: "lightblue"
3965 }
3966
3967=== modified file 'tests/unit_x11/tst_components/MockKeyboard.qml'
3968--- tests/unit_x11/tst_components/MockKeyboard.qml 2015-07-02 17:39:03 +0000
3969+++ tests/unit_x11/tst_components/MockKeyboard.qml 2016-01-15 07:23:58 +0000
3970@@ -32,7 +32,7 @@
3971 visible: inputMethod.visible
3972
3973 parent: QuickUtils.rootItem(inputMethod)
3974- color: UbuntuColors.lightGrey
3975+ color: UbuntuColors.silk
3976 opacity: 0.5
3977 // Always on top, even modal Dialog overlay
3978 z: 100
3979
3980=== added file 'tests/unit_x11/tst_components/tst_contextual_actions.qml'
3981--- tests/unit_x11/tst_components/tst_contextual_actions.qml 1970-01-01 00:00:00 +0000
3982+++ tests/unit_x11/tst_components/tst_contextual_actions.qml 2016-01-15 07:23:58 +0000
3983@@ -0,0 +1,326 @@
3984+/*
3985+ * Copyright 2015 Canonical Ltd.
3986+ *
3987+ * This program is free software; you can redistribute it and/or modify
3988+ * it under the terms of the GNU Lesser General Public License as published by
3989+ * the Free Software Foundation; version 3.
3990+ *
3991+ * This program is distributed in the hope that it will be useful,
3992+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3993+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3994+ * GNU Lesser General Public License for more details.
3995+ *
3996+ * You should have received a copy of the GNU Lesser General Public License
3997+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3998+ */
3999+
4000+import QtQuick 2.4
4001+import QtTest 1.0
4002+import Ubuntu.Test 1.0
4003+import Ubuntu.Components 1.3
4004+import Ubuntu.Components.Popups 1.3
4005+
4006+Item {
4007+ width: units.gu(40)
4008+ height: units.gu(71)
4009+
4010+ Loader {
4011+ id: testLoader
4012+ anchors.fill: parent
4013+ }
4014+
4015+ Component {
4016+ id: inactiveActionContextInChain
4017+
4018+ Item {
4019+ anchors.fill: parent
4020+ ActionContext {
4021+ active: true
4022+ }
4023+ Item {
4024+ anchors.fill: parent
4025+ ActionContext {
4026+ objectName: "testContext"
4027+ active: true
4028+ }
4029+
4030+ ActionItem {
4031+ objectName: "testActionItem"
4032+ action: Action {
4033+ text: "Test"
4034+ shortcut: 'Ctrl+T'
4035+ }
4036+ }
4037+ }
4038+ }
4039+ }
4040+
4041+ Component {
4042+ id: ambiguiousShortcutsInSameContext
4043+ Item {
4044+ ActionContext {
4045+ active: true
4046+ }
4047+ Column {
4048+ ActionItem {
4049+ action: Action {
4050+ shortcut: "Ctrl+T"
4051+ }
4052+ }
4053+ ActionItem {
4054+ action: Action {
4055+ shortcut: "Ctrl+T"
4056+ }
4057+ }
4058+ }
4059+ }
4060+ }
4061+
4062+ Component {
4063+ id: ambiguiousShortcutsInDifferentContexts
4064+ Item {
4065+ id: root
4066+ anchors.fill: parent
4067+ ActionContext {
4068+ active: true
4069+ }
4070+ Row {
4071+ Item {
4072+ width: root.width / 2
4073+ height: root.height
4074+ ActionContext {
4075+ active: true
4076+ }
4077+ ActionItem {
4078+ action: Action {
4079+ shortcut: "Ctrl+T"
4080+ }
4081+ }
4082+ }
4083+ Item {
4084+ width: root.width / 2
4085+ height: root.height
4086+ ActionContext {
4087+ active: true
4088+ }
4089+ ActionItem {
4090+ action: Action {
4091+ shortcut: "Ctrl+T"
4092+ }
4093+ }
4094+ }
4095+ }
4096+ }
4097+ }
4098+
4099+ Component {
4100+ id: onePopupContextActive
4101+ Item {
4102+ PopupContext {
4103+ objectName: "popup1"
4104+ active: true
4105+ }
4106+ PopupContext {
4107+ objectName: "popup2"
4108+ }
4109+ PopupContext {
4110+ objectName: "popup3"
4111+ }
4112+ }
4113+ }
4114+
4115+ Component {
4116+ id: popupTest
4117+ MainView {
4118+ id: main
4119+ anchors.fill: parent
4120+ applicationName: "testApp"
4121+
4122+ property Popover popover: null
4123+
4124+ Button {
4125+ id: button
4126+ objectName: "mainButton"
4127+ anchors.centerIn: parent
4128+ action: Action {
4129+ objectName: "mainAction"
4130+ text: "Test &button"
4131+ shortcut: "Ctrl+T"
4132+ }
4133+ onClicked: main.popover = PopupUtils.open(popup, button)
4134+ }
4135+
4136+ Component {
4137+ id: popup
4138+ Popover {
4139+ contentWidth: units.gu(30)
4140+ contentHeight: units.gu(30)
4141+ Button {
4142+ objectName: "popupButton"
4143+ action: Action {
4144+ objectName: "popupAction"
4145+ text: "Test &button"
4146+ shortcut: "Ctrl+T"
4147+ }
4148+ }
4149+ }
4150+ }
4151+ }
4152+ }
4153+
4154+ Component {
4155+ id: dialogTest
4156+ MainView {
4157+ id: main
4158+ anchors.fill: parent
4159+ applicationName: "testApp"
4160+
4161+ property Dialog popover: null
4162+
4163+ Button {
4164+ id: button
4165+ objectName: "mainButton"
4166+ anchors.centerIn: parent
4167+ action: Action {
4168+ objectName: "mainAction"
4169+ text: "Test &button"
4170+ shortcut: "Ctrl+T"
4171+ }
4172+ onClicked: main.popover = PopupUtils.open(dialog)
4173+ }
4174+
4175+ Component {
4176+ id: dialog
4177+ Dialog {
4178+ contentWidth: units.gu(30)
4179+ contentHeight: units.gu(30)
4180+ Button {
4181+ objectName: "popupButton"
4182+ action: Action {
4183+ objectName: "popupAction"
4184+ text: "Test &button"
4185+ shortcut: "Ctrl+T"
4186+ }
4187+ }
4188+ }
4189+ }
4190+ }
4191+ }
4192+
4193+ UbuntuTestCase {
4194+ name: "ContextualActions"
4195+ when: windowShown
4196+
4197+ SignalSpy {
4198+ id: triggeredSpy
4199+ signalName: "triggered"
4200+ }
4201+
4202+ function createTest(component) {
4203+ testLoader.sourceComponent = component;
4204+ tryCompareFunction(function() { return testLoader.item != null }, true, 1000);
4205+ waitForRendering(testLoader.item);
4206+ wait(200)
4207+ return testLoader.item;
4208+ }
4209+
4210+ function cleanup() {
4211+ testLoader.sourceComponent = null;
4212+ triggeredSpy.target = null;
4213+ triggeredSpy.clear();
4214+ wait(200);
4215+ }
4216+
4217+ function test_inactive_actioncontext_in_chain() {
4218+ var item = createTest(inactiveActionContextInChain);
4219+ var testContext = findInvisibleChild(item, "testContext");
4220+ verify(testContext);
4221+ var testActionItem = findInvisibleChild(item, "testActionItem");
4222+ verify(testActionItem);
4223+
4224+ testContext.active = true;
4225+ triggeredSpy.target = testActionItem.action;
4226+ keyPress(Qt.Key_T, Qt.ControlModifier);
4227+ triggeredSpy.wait(200);
4228+
4229+ testContext.active = false;
4230+ triggeredSpy.clear();
4231+ keyPress(Qt.Key_T, Qt.ControlModifier);
4232+ expectFailContinue("", "No trigger when a context is inactive");
4233+ triggeredSpy.wait(200);
4234+ }
4235+
4236+ function test_ambiguous_actions_when_multiple_contexts_active_data() {
4237+ return [
4238+ {tag: "within same ActionContext", test: ambiguiousShortcutsInSameContext, message: warningFormat(66, 29, "QML Action: Ambiguous shortcut: Ctrl+T")},
4239+ {tag: "within different ActionContexts", test: ambiguiousShortcutsInDifferentContexts, message: warningFormat(107, 33, "QML Action: Ambiguous shortcut: Ctrl+T")},
4240+ ];
4241+ }
4242+ function test_ambiguous_actions_when_multiple_contexts_active(data) {
4243+ var test = createTest(data.test);
4244+ ignoreWarning(data.message);
4245+ keyClick(Qt.Key_T, Qt.ControlModifier);
4246+ }
4247+
4248+ function test_one_popup_context_active() {
4249+ var test = createTest(onePopupContextActive);
4250+ var popup1 = findInvisibleChild(test, "popup1");
4251+ var popup2 = findInvisibleChild(test, "popup2");
4252+ var popup3 = findInvisibleChild(test, "popup3");
4253+ verify(popup1);
4254+ verify(popup2);
4255+ verify(popup3);
4256+ verify(popup1.active);
4257+ verify(!popup2.active);
4258+ verify(!popup3.active);
4259+
4260+ // activate popup2
4261+ popup2.active = true;
4262+ verify(!popup1.active);
4263+ verify(popup2.active);
4264+ verify(!popup3.active);
4265+
4266+ // activate popup2
4267+ popup3.active = true;
4268+ verify(!popup1.active);
4269+ verify(!popup2.active);
4270+ verify(popup3.active);
4271+
4272+ // deactivate popup3, popup2 should be re-activated
4273+ popup3.active = false;
4274+ verify(!popup1.active);
4275+ verify(popup2.active);
4276+ }
4277+
4278+ function test_popovers_data() {
4279+ return [
4280+ {tag: "Popup", component: popupTest},
4281+ {tag: "Dialog", component: dialogTest},
4282+ ];
4283+ }
4284+ function test_popovers(data) {
4285+ var test = createTest(data.component);
4286+
4287+ var mainButton = findChild(test, "mainButton");
4288+ verify(mainButton);
4289+ triggeredSpy.target = mainButton.action;
4290+ keyClick(Qt.Key_T, Qt.ControlModifier);
4291+ triggeredSpy.wait(200);
4292+ mouseClick(mainButton, centerOf(mainButton).x, centerOf(mainButton).y);
4293+ tryCompareFunction(function() { return test.popover != null;}, true, 1000);
4294+
4295+ // trigger the action
4296+ triggeredSpy.clear();
4297+ keyClick(Qt.Key_T, Qt.ControlModifier);
4298+ expectFailContinue(data.tag, "Popup is active now");
4299+ triggeredSpy.wait(200);
4300+
4301+ var actionItem = findChild(test.popover, "popupButton");
4302+ verify(actionItem);
4303+ triggeredSpy.target = actionItem.action;
4304+ triggeredSpy.clear();
4305+ keyClick(Qt.Key_B, Qt.AltModifier);
4306+ triggeredSpy.wait(200);
4307+ }
4308+ }
4309+}
4310
4311=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
4312--- tests/unit_x11/tst_components/tst_listitem.qml 2015-10-01 06:42:47 +0000
4313+++ tests/unit_x11/tst_components/tst_listitem.qml 2016-01-15 07:23:58 +0000
4314@@ -254,11 +254,9 @@
4315 var mappedDividerPos = defaults.mapFromItem(defaults.divider, defaults.divider.x, defaults.divider.y);
4316 compare(mappedDividerPos.x, 0, "divider's left anchor is wrong");
4317 compare(mappedDividerPos.x + defaults.divider.width, defaults.width, "divider's right anchor is wrong");
4318- compare(defaults.divider.height, units.dp(2), "divider's thickness is wrong");
4319- compare(defaults.divider.colorFrom, "#000000", "colorFrom differs.");
4320- fuzzyCompare(defaults.divider.colorFrom.a, 0.14, 0.01, "colorFrom alpha differs");
4321- compare(defaults.divider.colorTo, "#ffffff", "colorTo differs.");
4322- fuzzyCompare(defaults.divider.colorTo.a, 0.07, 0.01, "colorTo alpha differs");
4323+ compare(defaults.divider.height, units.dp(1), "divider's thickness is wrong");
4324+ compare(defaults.divider.colorFrom, theme.palette.normal.base, "colorFrom differs.");
4325+ compare(defaults.divider.colorTo, theme.palette.normal.base, "colorTo differs.");
4326 compare(defaults.action, null, "No action by default.");
4327 compare(defaults.style, null, "Style is loaded upon first use.");
4328 compare(defaults.__styleInstance, null, "__styleInstance must be null.");
4329
4330=== modified file 'tests/unit_x11/tst_components/tst_listitem13.qml'
4331--- tests/unit_x11/tst_components/tst_listitem13.qml 2015-10-01 06:42:47 +0000
4332+++ tests/unit_x11/tst_components/tst_listitem13.qml 2016-01-15 07:23:58 +0000
4333@@ -254,11 +254,9 @@
4334 var mappedDividerPos = defaults.mapFromItem(defaults.divider, defaults.divider.x, defaults.divider.y);
4335 compare(mappedDividerPos.x, 0, "divider's left anchor is wrong");
4336 compare(mappedDividerPos.x + defaults.divider.width, defaults.width, "divider's right anchor is wrong");
4337- compare(defaults.divider.height, units.dp(2), "divider's thickness is wrong");
4338- compare(defaults.divider.colorFrom, "#000000", "colorFrom differs.");
4339- fuzzyCompare(defaults.divider.colorFrom.a, 0.14, 0.01, "colorFrom alpha differs");
4340- compare(defaults.divider.colorTo, "#ffffff", "colorTo differs.");
4341- fuzzyCompare(defaults.divider.colorTo.a, 0.07, 0.01, "colorTo alpha differs");
4342+ compare(defaults.divider.height, units.dp(1), "divider's thickness is wrong");
4343+ compare(defaults.divider.colorFrom, theme.palette.normal.base, "colorFrom differs.");
4344+ compare(defaults.divider.colorTo, theme.palette.normal.base, "colorTo differs.");
4345 compare(defaults.action, null, "No action by default.");
4346 compare(defaults.style, null, "Style is loaded upon first use.");
4347 compare(defaults.__styleInstance, null, "__styleInstance must be null.");
4348
4349=== modified file 'tests/unit_x11/tst_components/tst_pagestack.qml'
4350--- tests/unit_x11/tst_components/tst_pagestack.qml 2015-10-21 19:33:28 +0000
4351+++ tests/unit_x11/tst_components/tst_pagestack.qml 2016-01-15 07:23:58 +0000
4352@@ -54,9 +54,15 @@
4353 id: tabs
4354 Tab {
4355 id: tab1
4356+ page: Page {
4357+ title: "Tab 1"
4358+ }
4359 }
4360 Tab {
4361 id: tab2
4362+ page: Page {
4363+ title: "Tab 2"
4364+ }
4365 }
4366 }
4367 Page {
4368
4369=== modified file 'tests/unit_x11/tst_components/tst_shortcuts.qml'
4370--- tests/unit_x11/tst_components/tst_shortcuts.qml 2015-12-18 15:20:48 +0000
4371+++ tests/unit_x11/tst_components/tst_shortcuts.qml 2016-01-15 07:23:58 +0000
4372@@ -24,12 +24,17 @@
4373 width: 400
4374 height: 600
4375
4376- Action {
4377- id: action
4378- }
4379- Action {
4380- id: other
4381- shortcut: 'Ctrl+G'
4382+ // actions must be either assigned to an active ActionContext or to an ActionItem to activate shortcuts
4383+ ActionContext {
4384+ id: context
4385+ active: true
4386+ Action {
4387+ id: action
4388+ }
4389+ Action {
4390+ id: other
4391+ shortcut: 'Ctrl+G'
4392+ }
4393 }
4394
4395 TestUtil {
4396@@ -45,6 +50,8 @@
4397 }
4398
4399 function init() {
4400+ context.active = true;
4401+ spy.target = action;
4402 }
4403 function cleanup() {
4404 spy.clear();
4405@@ -84,12 +91,12 @@
4406 ];
4407 }
4408 function test_shortcut_invalid(data) {
4409- ignoreQMLWarning(':27:5: QML Action: Invalid shortcut: ');
4410+ ignoreQMLWarning(':31:9: QML Action: Invalid shortcut: ');
4411 action.shortcut = data;
4412 }
4413
4414 function test_shortcut_duplicate() {
4415- ignoreQMLWarning(':30:5: QML Action: Ambiguous shortcut: Ctrl+G');
4416+ ignoreQMLWarning(':34:9: QML Action: Ambiguous shortcut: Ctrl+G');
4417 action.shortcut = other.shortcut;
4418 keyClick(Qt.Key_G, Qt.ControlModifier);
4419 }
4420@@ -161,5 +168,22 @@
4421 }
4422 textSpy.wait(200);
4423 }
4424+
4425+ function test_contextual_action_shortcut_data() {
4426+ return [
4427+ {tag: "Active context", active: true, xfail: false},
4428+ {tag: "Inactive context", active: false, xfail: true},
4429+ ];
4430+ }
4431+ function test_contextual_action_shortcut(data) {
4432+ context.active = data.active;
4433+ spy.target = other;
4434+ spy.clear();
4435+ keyClick(Qt.Key_G, Qt.ControlModifier);
4436+ if (data.xfail) {
4437+ expectFailContinue("", "No shortcut fires");
4438+ }
4439+ spy.wait(200);
4440+ }
4441 }
4442 }
4443
4444=== modified file 'tests/unit_x11/tst_components/tst_slotslayout.qml'
4445--- tests/unit_x11/tst_components/tst_slotslayout.qml 2015-11-09 16:20:34 +0000
4446+++ tests/unit_x11/tst_components/tst_slotslayout.qml 2016-01-15 07:23:58 +0000
4447@@ -66,6 +66,17 @@
4448 readonly property var trailingSlots: []
4449 }
4450 ListItemLayout {
4451+ id: layoutMultilineLabels
4452+ title.text: "test \n test"
4453+ title.maximumLineCount: 2
4454+ subtitle.text: "test2 \n test2 \n test2"
4455+ subtitle.maximumLineCount: 3
4456+ summary.text: "test3 \n test3"
4457+ summary.maximumLineCount: 2
4458+ readonly property var leadingSlots: []
4459+ readonly property var trailingSlots: []
4460+ }
4461+ ListItemLayout {
4462 id: layoutOneLeading
4463 readonly property var leadingSlots: [layoutOneLeading_leading1]
4464 readonly property var trailingSlots: []
4465@@ -375,6 +386,17 @@
4466 compare(item.padding.trailing, units.gu(1), "Default trailing padding")
4467 }
4468
4469+ function checkDefaultWrapping(item) {
4470+ //we have to use WrapAnywhere because otherwise it will have unexpected behaviour
4471+ //when used together with ElideRight when the string wraps (it will elide too early).
4472+ compare(item.title.wrapMode, Label.WrapAnywhere, "Wrong default title wrapMode")
4473+ compare(item.subtitle.wrapMode, Label.WrapAnywhere, "Wrong default subtitle wrapMode")
4474+ compare(item.summary.wrapMode, Label.WrapAnywhere, "Wrong default summary wrapMode")
4475+ compare(item.title.elide, Label.ElideRight, "Wrong default title elide")
4476+ compare(item.subtitle.elide, Label.ElideRight, "Wrong default subtitle elide")
4477+ compare(item.summary.elide, Label.ElideRight, "Wrong default summary elide")
4478+ }
4479+
4480 function checkImplicitSize(item) {
4481 compare(item.implicitHeight, expectedImplicitHeight(item), "Implicit height check")
4482 compare(item.implicitWidth, column.width, "Fill parent's width")
4483@@ -718,7 +740,7 @@
4484 "Default labels positioning, subtitle's y")
4485 } else {
4486 compare(listitemlayout.subtitle.y,
4487- listitemlayout.title.baselineOffset + units.dp(4),
4488+ listitemlayout.title.y + listitemlayout.title.height + units.dp(2),
4489 "Default labels positioning, subtitle's y")
4490 }
4491 }
4492@@ -734,7 +756,7 @@
4493 compare(listitemlayout.summary.y, 0,
4494 "Default labels positioning, summary's y")
4495 } else {
4496- compare(listitemlayout.summary.y, listitemlayout.title.baselineOffset + units.dp(4),
4497+ compare(listitemlayout.summary.y, listitemlayout.title.y + listitemlayout.title.height + units.dp(2),
4498 "Default labels positioning, summary's y")
4499 }
4500 } else {
4501@@ -744,6 +766,10 @@
4502 }
4503 }
4504
4505+ function test_defaultLabelsWrappingAndElide() {
4506+ checkDefaultWrapping(layoutLabels)
4507+ }
4508+
4509 function test_defaultMainSlotHeight() {
4510 var titleText = layoutLabels.title.text
4511 var subtitleText = layoutLabels.subtitle.text
4512@@ -873,5 +899,24 @@
4513 compare(obj !== null, true, "QML ListItemLayout: testing labels' QML context.")
4514 obj.destroy()
4515 }
4516+
4517+ //first version of ListItemLayout anchored subtitle to title's baseline, but that breaks
4518+ //when title is multiline
4519+ function test_multilineLabelsPositioning() {
4520+ compare(layoutMultilineLabels.title.maximumLineCount, 2,
4521+ "Multiline labels positioning: wrong title maximumLineCount")
4522+ compare(layoutMultilineLabels.subtitle.maximumLineCount, 3,
4523+ "Multiline labels positioning: wrong subtitle maximumLineCount")
4524+ compare(layoutMultilineLabels.summary.maximumLineCount, 2,
4525+ "Multiline labels positioning: wrong summary maximumLineCount")
4526+
4527+ compare(layoutMultilineLabels.title.lineCount, 2,
4528+ "Multiline labels positioning: wrong title lineCount")
4529+ compare(layoutMultilineLabels.subtitle.lineCount, 3,
4530+ "Multiline labels positioning: wrong subtitle lineCount")
4531+ compare(layoutMultilineLabels.summary.lineCount, 2,
4532+ "Multiline labels positioning: wrong summary lineCount")
4533+ checkLabelsY(layoutMultilineLabels)
4534+ }
4535 }
4536 }
4537
4538=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp'
4539--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2015-11-09 11:51:16 +0000
4540+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp 2016-01-15 07:23:58 +0000
4541@@ -1,5 +1,5 @@
4542 /*
4543- * Copyright 2013-2015 Canonical Ltd.
4544+ * Copyright 2013-2016 Canonical Ltd.
4545 *
4546 * This program is free software; you can redistribute it and/or modify
4547 * it under the terms of the GNU Lesser General Public License as published by
4548@@ -21,6 +21,7 @@
4549 #include <QtQml/QQmlContext>
4550 #include <QtQml/QQmlComponent>
4551 #include "ucdeprecatedtheme.h"
4552+#include "uctheme.h"
4553 #include "uctestcase.h"
4554 #include <private/qquicktext_p.h>
4555
4556@@ -68,10 +69,18 @@
4557 private:
4558 QString m_xdgDataPath;
4559
4560+ UCDeprecatedTheme *instance(QQmlEngine &engine)
4561+ {
4562+ return engine.rootContext()->contextProperty("Theme").value<UCDeprecatedTheme*>();
4563+ }
4564+ void initDeprecatedTheme(QQmlEngine &engine)
4565+ {
4566+ UCDeprecatedTheme::registerToContext(engine.rootContext());
4567+ }
4568+
4569 private Q_SLOTS:
4570 void initTestCase();
4571 void cleanupTestCase();
4572- void testInstance();
4573 void testNameDefault();
4574 void testNameSet();
4575 void testCreateStyleComponent();
4576@@ -97,24 +106,21 @@
4577 qputenv("XDG_DATA_DIRS", m_xdgDataPath.toLocal8Bit());
4578 }
4579
4580-void tst_UCDeprecatedTheme::testInstance()
4581-{
4582- UCDeprecatedTheme::instance();
4583-}
4584-
4585 void tst_UCDeprecatedTheme::testNameDefault()
4586 {
4587- UCDeprecatedTheme theme;
4588- QCOMPARE(theme.name(), QString("Ubuntu.Components.Themes.Ambiance"));
4589+ QQmlEngine engine;
4590+ initDeprecatedTheme(engine);
4591+ QCOMPARE(instance(engine)->name(), QString("Ubuntu.Components.Themes.Ambiance"));
4592 }
4593
4594 void tst_UCDeprecatedTheme::testNameSet()
4595 {
4596 QTest::ignoreMessage(QtWarningMsg, "Theme not found: \"MyBeautifulTheme\"");
4597
4598- UCDeprecatedTheme theme;
4599- theme.setName("MyBeautifulTheme");
4600- QCOMPARE(theme.name(), QString("MyBeautifulTheme"));
4601+ QQmlEngine engine;
4602+ initDeprecatedTheme(engine);
4603+ instance(engine)->setName("MyBeautifulTheme");
4604+ QCOMPARE(instance(engine)->name(), QString("MyBeautifulTheme"));
4605 }
4606
4607 void tst_UCDeprecatedTheme::testCreateStyleComponent()
4608@@ -217,8 +223,9 @@
4609 qputenv("XDG_DATA_DIRS", "");
4610 qputenv("QML2_IMPORT_PATH", "");
4611
4612- UCDeprecatedTheme theme;
4613- QCOMPARE(theme.name(), QString("Ubuntu.Components.Themes.Ambiance"));
4614+ QQmlEngine engine;
4615+ initDeprecatedTheme(engine);
4616+ QCOMPARE(instance(engine)->name(), QString("Ubuntu.Components.Themes.Ambiance"));
4617 }
4618
4619 void tst_UCDeprecatedTheme::testBogusImportPathSet()
4620@@ -230,8 +237,9 @@
4621 qputenv("XDG_DATA_DIRS", "");
4622 qputenv("QML2_IMPORT_PATH", "/no/plugins/here");
4623
4624- UCDeprecatedTheme theme;
4625- QCOMPARE(theme.name(), QString("Ubuntu.Components.Themes.Ambiance"));
4626+ QQmlEngine engine;
4627+ initDeprecatedTheme(engine);
4628+ QCOMPARE(instance(engine)->name(), QString("Ubuntu.Components.Themes.Ambiance"));
4629 }
4630
4631 void tst_UCDeprecatedTheme::testMultipleImportPathsSet()
4632
4633=== modified file 'tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro'
4634--- tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2015-03-23 16:28:35 +0000
4635+++ tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.pro 2016-01-15 07:23:58 +0000
4636@@ -1,5 +1,5 @@
4637 include(../test-include.pri)
4638-QT += quick-private gui-private
4639+QT += quick-private gui-private qml-private
4640 SOURCES += tst_deprecated_theme_engine.cpp
4641
4642 OTHER_FILES += \
4643
4644=== added file 'tests/unit_x11/tst_subtheming/DefaultTheme.qml'
4645--- tests/unit_x11/tst_subtheming/DefaultTheme.qml 1970-01-01 00:00:00 +0000
4646+++ tests/unit_x11/tst_subtheming/DefaultTheme.qml 2016-01-15 07:23:58 +0000
4647@@ -0,0 +1,28 @@
4648+/*
4649+ * Copyright 2016 Canonical Ltd.
4650+ *
4651+ * This program is free software; you can redistribute it and/or modify
4652+ * it under the terms of the GNU Lesser General Public License as published by
4653+ * the Free Software Foundation; version 3.
4654+ *
4655+ * This program is distributed in the hope that it will be useful,
4656+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4657+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4658+ * GNU Lesser General Public License for more details.
4659+ *
4660+ * You should have received a copy of the GNU Lesser General Public License
4661+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4662+ */
4663+
4664+import QtQuick 2.4
4665+import Ubuntu.Components 1.3
4666+
4667+Label {
4668+ id: label
4669+ width: 400
4670+ height: width
4671+ text: "HOLA"
4672+
4673+ Label { }
4674+ Button { }
4675+}
4676
4677=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.cpp'
4678--- tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-11-09 11:51:16 +0000
4679+++ tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2016-01-15 07:23:58 +0000
4680@@ -1,5 +1,5 @@
4681 /*
4682- * Copyright 2015 Canonical Ltd.
4683+ * Copyright 2016 Canonical Ltd.
4684 *
4685 * This program is free software; you can redistribute it and/or modify
4686 * it under the terms of the GNU Lesser General Public License as published by
4687@@ -26,6 +26,7 @@
4688 #include "ucstyleditembase_p.h"
4689 #include "ucnamespace.h"
4690 #include "ucunits.h"
4691+#include "uclabel.h"
4692
4693 class ThemeTestCase : public UbuntuTestCase
4694 {
4695@@ -100,7 +101,8 @@
4696
4697 void test_default_theme()
4698 {
4699- UCTheme::defaultTheme();
4700+ QQmlEngine engine;
4701+ UCTheme::defaultTheme(&engine);
4702 }
4703
4704 void test_default_name()
4705@@ -128,6 +130,53 @@
4706 QCOMPARE(theme.name(), QString("Ubuntu.Components.Themes.Ambiance"));
4707 }
4708
4709+ void test_create_without_engine()
4710+ {
4711+ QTest::ignoreMessage(QtCriticalMsg, "The item UCLabel was created without a valid QML Engine. Styling will not be possible.");
4712+ QScopedPointer<UCLabel> item(new UCLabel);
4713+ QVERIFY(!item->getTheme());
4714+ }
4715+
4716+ void test_default_theme_cleared_with_engine_bug1527546()
4717+ {
4718+ qputenv("QV4_FORCE_INTERPRETER", "1");
4719+ qputenv("QV4_MM_AGGRESSIVE_GC", "1");
4720+ for (int i = 0; i < 2; i++)
4721+ {
4722+ ThemeTestCase *view = new ThemeTestCase("DefaultTheme.qml");
4723+ QVERIFY(view->globalTheme());
4724+ QVERIFY(UCTheme::defaultTheme(view->engine()));
4725+ QObjectCleanupHandler themeCleanup;
4726+ themeCleanup.add(UCTheme::defaultTheme(view->engine()));
4727+ delete view;
4728+ QVERIFY(themeCleanup.isEmpty());
4729+ }
4730+ }
4731+
4732+ void test_multiple_view_instances_bug1527546()
4733+ {
4734+ qputenv("QV4_FORCE_INTERPRETER", "1");
4735+ qputenv("QV4_MM_AGGRESSIVE_GC", "1");
4736+
4737+ QScopedPointer<ThemeTestCase> view1(new ThemeTestCase("DefaultTheme.qml"));
4738+ QScopedPointer<ThemeTestCase> view2(new ThemeTestCase("DefaultTheme.qml"));
4739+
4740+ // the two views must have different default themes
4741+ QVERIFY(view1->globalTheme() != view2->globalTheme());
4742+ }
4743+
4744+ void test_multiple_themes_on_engine_bug1527546()
4745+ {
4746+ qputenv("QV4_FORCE_INTERPRETER", "1");
4747+ qputenv("QV4_MM_AGGRESSIVE_GC", "1");
4748+
4749+ QQmlEngine engine;
4750+ UCTheme *theme0 = UCTheme::defaultTheme(&engine);
4751+
4752+ UCTheme *theme1 = new UCTheme(&engine);
4753+ QVERIFY(theme0 != theme1);
4754+ }
4755+
4756 void test_create_style_component_data() {
4757 QTest::addColumn<QString>("styleName");
4758 QTest::addColumn<QString>("parentName");
4759@@ -304,7 +353,7 @@
4760 mainItem->resetTheme();
4761 parentChangeSpy.wait(200);
4762 QCOMPARE(parentChangeSpy.count(), 1);
4763- QCOMPARE(mainItem->getTheme(), &UCTheme::defaultTheme());
4764+ QCOMPARE(mainItem->getTheme(), UCTheme::defaultTheme(view->engine()));
4765 QCOMPARE(testSet->parentTheme(), mainItem->getTheme());
4766 }
4767
4768@@ -605,7 +654,7 @@
4769 movableItem->setParentItem(Q_NULLPTR);
4770 spy.wait(500);
4771 QCOMPARE(spy.count(), 1);
4772- QCOMPARE(movableItem->getTheme(), &UCTheme::defaultTheme());
4773+ QCOMPARE(movableItem->getTheme(), UCTheme::defaultTheme(view->engine()));
4774 }
4775
4776 void test_reparented_styleditem_special_case()
4777
4778=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.pro'
4779--- tests/unit_x11/tst_subtheming/tst_subtheming.pro 2015-09-28 16:57:11 +0000
4780+++ tests/unit_x11/tst_subtheming/tst_subtheming.pro 2016-01-15 07:23:58 +0000
4781@@ -44,4 +44,7 @@
4782 HintedButton.qml \
4783 OtherVersion.qml
4784
4785+DISTFILES += \
4786+ DefaultTheme.qml
4787+
4788

Subscribers

People subscribed via source and target branches

to all changes: