Merge lp:~zsombi/ubuntu-ui-toolkit/theming-engine-versioner into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri on 2015-04-24
Status: Merged
Approved by: Zoltan Balogh on 2015-04-26
Approved revision: 1516
Merged at revision: 1498
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/theming-engine-versioner
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 7437 lines (+5959/-135)
127 files modified
components.api (+33/-5)
documentation/ubuntu-theming.qdoc (+76/-4)
modules/Ubuntu/Components/10/Button.qml (+2/-2)
modules/Ubuntu/Components/11/Button.qml (+1/-0)
modules/Ubuntu/Components/AbstractButton.qml (+1/-1)
modules/Ubuntu/Components/ActionItem.qml (+1/-1)
modules/Ubuntu/Components/AnimatedItem.qml (+1/-0)
modules/Ubuntu/Components/AppHeader.qml (+1/-0)
modules/Ubuntu/Components/CheckBox.qml (+2/-1)
modules/Ubuntu/Components/ListItems/ItemSelector.qml (+1/-0)
modules/Ubuntu/Components/ListItems/ProgressionVisual.qml (+1/-0)
modules/Ubuntu/Components/MainViewBase.qml (+1/-0)
modules/Ubuntu/Components/OptionSelector.qml (+1/-0)
modules/Ubuntu/Components/PageTreeNode.qml (+2/-0)
modules/Ubuntu/Components/Pickers/DatePicker.qml (+1/-0)
modules/Ubuntu/Components/Pickers/Dialer.qml (+1/-0)
modules/Ubuntu/Components/Pickers/DialerHand.qml (+1/-0)
modules/Ubuntu/Components/Pickers/Picker.qml (+1/-0)
modules/Ubuntu/Components/Pickers/PickerDelegate.qml (+1/-0)
modules/Ubuntu/Components/Popups/Dialog.qml (+1/-0)
modules/Ubuntu/Components/Popups/Popover.qml (+1/-0)
modules/Ubuntu/Components/Popups/SheetBase.qml (+1/-0)
modules/Ubuntu/Components/ProgressBar10.qml (+1/-0)
modules/Ubuntu/Components/PullToRefresh.qml (+1/-0)
modules/Ubuntu/Components/Scrollbar.qml (+1/-0)
modules/Ubuntu/Components/Slider.qml (+1/-0)
modules/Ubuntu/Components/TabBar.qml (+1/-1)
modules/Ubuntu/Components/TextArea.qml (+1/-0)
modules/Ubuntu/Components/TextCursor.qml (+1/-0)
modules/Ubuntu/Components/TextField.qml (+1/-0)
modules/Ubuntu/Components/TextInputPopover.qml (+1/-0)
modules/Ubuntu/Components/Themes/1.2/Palette.qml (+59/-0)
modules/Ubuntu/Components/Themes/1.2/PaletteValues.qml (+76/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ActivityIndicatorStyle.qml (+38/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/BubbleShape.qml (+172/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonForeground.qml (+117/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonStyle.qml (+177/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/CheckBoxStyle.qml (+162/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ComboButtonStyle.qml (+197/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/DatePickerStyle.qml (+164/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerHandStyle.qml (+63/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerStyle.qml (+126/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/DialogForegroundStyle.qml (+28/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/HeadDividerStyle.qml (+53/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/HeaderStyle.qml (+124/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/HighlightMagnifier.qml (+56/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemOptionSelectorStyle.qml (+27/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemStyle.qml (+413/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/MainViewStyle.qml (+59/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml (+37/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/OverflowPanel.qml (+22/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml (+70/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadStyle.qml (+628/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/Palette.qml (+43/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PartialColorize.qml (+51/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerDelegateStyle.qml (+57/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerStyle.qml (+136/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PopoverForegroundStyle.qml (+40/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressBarStyle.qml (+76/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml (+52/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/PullToRefreshStyle.qml (+251/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml (+490/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/SheetForegroundStyle.qml (+104/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/SliderStyle.qml (+123/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/SwitchStyle.qml (+235/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/TabBarStyle.qml (+387/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/TextAreaStyle.qml (+66/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/TextCursorStyle.qml (+91/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/TextFieldStyle.qml (+22/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ToolbarButtonStyle.qml (+60/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.2/ToolbarStyle.qml (+45/-0)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ActivityIndicatorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/BubbleShape.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ButtonStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml (+3/-3)
modules/Ubuntu/Components/Themes/Ambiance/1.3/HeaderStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ListItemOptionSelectorStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/Palette.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ProgressionVisualStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml (+4/-4)
modules/Ubuntu/Components/Themes/Ambiance/1.3/TabBarStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/TextCursorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/1.3/ToolbarStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/Ambiance.pro (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/qmldir (+74/-48)
modules/Ubuntu/Components/Themes/SuruDark/1.2/MainViewStyle.qml (+22/-0)
modules/Ubuntu/Components/Themes/SuruDark/1.2/OptionSelectorStyle.qml (+23/-0)
modules/Ubuntu/Components/Themes/SuruDark/1.2/Palette.qml (+43/-0)
modules/Ubuntu/Components/Themes/SuruDark/1.2/TabBarStyle.qml (+22/-0)
modules/Ubuntu/Components/Themes/SuruDark/1.3/MainViewStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/1.3/OptionSelectorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/1.3/Palette.qml (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/1.3/TabBarStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/SuruDark/SuruDark.pro (+1/-1)
modules/Ubuntu/Components/Themes/SuruDark/qmldir (+4/-1)
modules/Ubuntu/Components/Themes/qmldir (+5/-5)
modules/Ubuntu/Components/Toolbar.qml (+1/-0)
modules/Ubuntu/Components/ToolbarButton.qml (+2/-0)
modules/Ubuntu/Components/plugin/plugin.cpp (+9/-0)
modules/Ubuntu/Components/plugin/ucdeprecatedtheme.cpp (+8/-7)
modules/Ubuntu/Components/plugin/ucdeprecatedtheme.h (+1/-1)
modules/Ubuntu/Components/plugin/ucnamespace.cpp (+35/-5)
modules/Ubuntu/Components/plugin/ucnamespace.h (+43/-2)
modules/Ubuntu/Components/plugin/uctheme.cpp (+57/-4)
modules/Ubuntu/Components/plugin/uctheme.h (+7/-1)
tests/unit/tst_components/tst_components.pro (+2/-1)
tests/unit/tst_components/tst_ubuntu_namespace_v12.qml (+35/-0)
tests/unit/tst_components/tst_ubuntu_namespace_v13.qml (+60/-0)
tests/unit_x11/tst_components/AppTheme/Palette.qml (+2/-2)
tests/unit_x11/tst_subtheming/ChangeDefaultPaletteInChildren.qml (+1/-1)
tests/unit_x11/tst_subtheming/ChangePaletteValueWhenParentChanges.qml (+1/-1)
tests/unit_x11/tst_subtheming/DynamicPalette.qml (+1/-1)
tests/unit_x11/tst_subtheming/MultiplePaletteInstances.qml (+1/-1)
tests/unit_x11/tst_subtheming/SameNamedPaletteSettings.qml (+1/-1)
tests/unit_x11/tst_subtheming/StyledItemV12.qml (+24/-0)
tests/unit_x11/tst_subtheming/StyledItemV13.qml (+24/-0)
tests/unit_x11/tst_subtheming/themes/CustomTheme/1.3/TestStyle.qml (+21/-0)
tests/unit_x11/tst_subtheming/themes/CustomTheme/Palette.qml (+1/-1)
tests/unit_x11/tst_subtheming/themes/CustomTheme/TestStyle.qml (+0/-1)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/1.3/TestStyle.qml (+21/-0)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/TestStyle.qml (+0/-2)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/parent_theme (+0/-1)
tests/unit_x11/tst_subtheming/themes/TestModule/TestTheme/qmldir (+4/-1)
tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+30/-0)
tests/unit_x11/tst_subtheming/tst_subtheming.pro (+5/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/theming-engine-versioner
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-04-26
Ubuntu SDK team 2015-04-24 Pending
Review via email: mp+257348@code.launchpad.net

Commit message

Provide versioning for theme loading. Each toolkit must be released with a well defined system theme version, and theme modules must have the same version as the toolkit.

To post a comment you must log in.
1512. By Zsombor Egri on 2015-04-25

API updated

1513. By Zsombor Egri on 2015-04-25

change theme version lookup to minimum minor version 2

1514. By Zsombor Egri on 2015-04-25

Ubuntu namespace tests

1515. By Zsombor Egri on 2015-04-25

theme version loading tests added

1516. By Zsombor Egri on 2015-04-25

documentation fixes

review: Approve (continuous-integration)

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-04-17 07:44:17 +0000
3+++ components.api 2015-04-25 07:11:10 +0000
4@@ -622,11 +622,28 @@
5 function undo()
6 function remove(start, end)
7 function getText(start, end)
8-Palette 0.1 1.0
9-QtObject
10- property PaletteValues normal
11- property PaletteValues selected
12-PaletteValues 0.1 1.0
13+Palette 0.1
14+QtObject
15+ property PaletteValues normal
16+ property PaletteValues selected
17+PaletteValues 0.1
18+QtObject
19+ property color background
20+ property color backgroundText
21+ property color base
22+ property color baseText
23+ property color foreground
24+ property color foregroundText
25+ property color overlay
26+ property color overlayText
27+ property color field
28+ property color fieldText
29+ property color selection
30+Palette 1.3
31+QtObject
32+ property PaletteValues normal
33+ property PaletteValues selected
34+PaletteValues 1.3
35 QtObject
36 property color background
37 property color backgroundText
38@@ -1022,6 +1039,16 @@
39 prototype: "QObject"
40 exports: ["Ubuntu 1.2"]
41 name: "CaptionsStyle"
42+ name: "UCNamespaceV13"
43+ prototype: "UCNamespace"
44+ exports: ["Ubuntu 1.3"]
45+ Property { name: "toolkitVersion"; type: "ushort"; isReadonly: true }
46+ Property { name: "toolkitVersionMajor"; type: "ushort"; isReadonly: true }
47+ Property { name: "toolkitVersionMinor"; type: "ushort"; isReadonly: true }
48+ Method {
49+ name: "version"
50+ Parameter { name: "major"; type: "uchar" }
51+ Parameter { name: "minor"; type: "uchar" }
52 name: "UCQQuickImageExtension"
53 prototype: "QQuickImageBase"
54 exports: ["QQuickImageBase 0.1", "QQuickImageBase 1.0"]
55@@ -1075,6 +1102,7 @@
56 Property { name: "parentTheme"; type: "UCTheme"; isReadonly: true; isPointer: true }
57 Property { name: "name"; type: "string" }
58 Property { name: "palette"; type: "QObject"; isPointer: true }
59+ Property { name: "version"; type: "ushort" }
60 Method {
61 name: "createStyleComponent"
62 Parameter { name: "styleName"; type: "string" }
63
64=== added file 'documentation/images/surudark-theme-13.png'
65Binary files documentation/images/surudark-theme-13.png 1970-01-01 00:00:00 +0000 and documentation/images/surudark-theme-13.png 2015-04-25 07:11:10 +0000 differ
66=== modified file 'documentation/images/surudark-theme.png'
67Binary files documentation/images/surudark-theme.png 2015-04-15 07:16:01 +0000 and documentation/images/surudark-theme.png 2015-04-25 07:11:10 +0000 differ
68=== modified file 'documentation/ubuntu-theming.qdoc'
69--- documentation/ubuntu-theming.qdoc 2015-04-20 11:23:33 +0000
70+++ documentation/ubuntu-theming.qdoc 2015-04-25 07:11:10 +0000
71@@ -231,6 +231,13 @@
72 * typically there to configure the style itself, or to turn on/off features provided by styles
73 * in derived themes.
74 *
75+ * Starting with Ubuntu Components version 1.3, themes must provide versioned styles. This means
76+ * that themes must store the styles in subfolders, meaning that toolkit version 1.3 must have
77+ * the version specific styles under the theme's 1.3/ subfolder. The styling engine will look
78+ * for the styles based on the theme version used by the component. If the style is not found
79+ * with the requested version, it will fall back to the previous version of that style.
80+ * \image surudark-theme-13.png
81+ *
82 * \section3 Standalone theme
83 * A standalone theme is a theme which defines all style documents and theme palette,
84 * and it is not derived from any theme. The only standalone theme UI Toolkit provides is
85@@ -259,12 +266,12 @@
86 *
87 * SuruDark theme overrides the Ambiance theme's MainViewStyle, therefore declares the
88 * MainViewStyle.qml document, with the following content:
89- * \snippet Themes/SuruDark/MainViewStyle.qml 0
90+ * \snippet Themes/SuruDark/1.3/MainViewStyle.qml 0
91 *
92 * The style imports the Ambiance theme module, and extends the Ambiance MainViewStyle
93 * component. The same is done in the other style components. However, Palette defines
94 * own values, and does not re-use Ambiance palette values.
95- * \snippet Themes/SuruDark/Palette.qml 0
96+ * \snippet Themes/SuruDark/1.3/Palette.qml 0
97 *
98 * The same is done with TabBarStyle and OptionSelectorStyle components.
99 *
100@@ -276,7 +283,7 @@
101 * \qml
102 * import QtQuick 2.4
103 * import Ubuntu.Components 1.3
104- * import Ubuntu.Components.Themes.Ambiance 1.2 as Ambiance
105+ * import Ubuntu.Components.Themes.Ambiance 1.3 as Ambiance
106 * Ambiance.SwitchStyle {
107 * // [...]
108 * }
109@@ -308,6 +315,11 @@
110 *
111 * The application can use its own theme in the following way:
112 * \snippet customtheme/main.qml 0
113+ *
114+ * \note An application, which overrides multiple shared theme versions must provide separate
115+ * style versions in its theme so the styling engine can identify the proper styles for the
116+ * components. Note however that this is not mandatory, and it is up to the application developer
117+ * to decide whether the application should support multiple style versions or not.
118 */
119
120 /*!
121@@ -374,7 +386,7 @@
122 * \qml
123 * import QtQuick 2.4
124 * import Ubuntu.Components 1.3
125- * import Ubuntu.Components.Themes 1.0
126+ * import Ubuntu.Components.Themes 1.3
127 *
128 * MainView {
129 * width: units.gu(40)
130@@ -444,6 +456,66 @@
131 * foregroundText and \c overlayText of \c normal, as well as \c fieldText, \c foregroundText,
132 * \c overlayText and \c foreground on \c selected groups.
133 *
134+ * There may be cases when a subset of components wants to use different style versions
135+ * than the one provided by the module version. Remember, using earlier minor versions
136+ * of the theme is perfectly fine while using newer versions may not work, as component
137+ * styles may use newer APIs of the component which is not present in the component, thus
138+ * the style will fail.
139+ *
140+ * Let's take the example above, and assume that we want to show the Dialog with the same
141+ * theme as the application but with an earlier version. We can do this by specifying the
142+ * theme version with \l {Ubuntu::version}{Ubuntu.version()} as follows:
143+ * \qml
144+ * import QtQuick 2.4
145+ * import Ubuntu.Components 1.3
146+ * import Ubuntu.Components.Themes 1.3
147+ *
148+ * MainView {
149+ * width: units.gu(40)
150+ * height: units.gu(71)
151+ *
152+ * applicationName: "subthemed"
153+ *
154+ * Component {
155+ * id: dialogComponent
156+ * Dialog {
157+ * id: dialog
158+ * title: "Input dialog"
159+ * // make sure the dialog and its children will use the same
160+ * // theme as the rest of the application
161+ * theme: ThemeSettings {
162+ * name: parentTheme.name
163+ * // use version 1.2 of the theme
164+ * version: Ubuntu.version(1, 2)
165+ * }
166+ * TextField {
167+ * placeholderText: "enter text"
168+ * }
169+ * Button {
170+ * text: "Close"
171+ * onClicked: PopupUtils.close(dialog)
172+ * }
173+ * }
174+ * }
175+ *
176+ * Column {
177+ * spacing: units.gu(1)
178+ * Button {
179+ * text: "Set Ambiance theme"
180+ * onClicked: theme.name = "Ubuntu.Components.Themes.Ambiance"
181+ * }
182+ * Button {
183+ * text: "Set SuruDark theme"
184+ * onClicked: theme.name = "Ubuntu.Components.Themes.SuruDark"
185+ * }
186+ * Button {
187+ * text: "Open dialog"
188+ * onClicked: PopupUtils.open(dialogComponent)
189+ * }
190+ * }
191+ * }
192+ * \endqml
193+ *
194 * \section1 That's it
195 * By now you should have learned what the styling means, what are the themes, what
196 * kind of themes the toolkit has, how can you create shared or application themes, where should
197
198=== modified file 'modules/Ubuntu/Components/10/Button.qml'
199--- modules/Ubuntu/Components/10/Button.qml 2015-04-09 09:42:36 +0000
200+++ modules/Ubuntu/Components/10/Button.qml 2015-04-25 07:11:10 +0000
201@@ -15,7 +15,7 @@
202 */
203
204 import QtQuick 2.4
205-import Ubuntu.Components 1.3
206+import Ubuntu.Components 1.2
207
208 /*!
209 \internal
210@@ -32,5 +32,5 @@
211
212 property string iconPosition: "left"
213
214- style: theme.createStyleComponent("ButtonStyle.qml", button)
215+ style: Theme.createStyleComponent("ButtonStyle.qml", button)
216 }
217
218=== modified file 'modules/Ubuntu/Components/11/Button.qml'
219--- modules/Ubuntu/Components/11/Button.qml 2015-04-09 09:42:36 +0000
220+++ modules/Ubuntu/Components/11/Button.qml 2015-04-25 07:11:10 +0000
221@@ -121,5 +121,6 @@
222 */
223 property string iconPosition: "left"
224
225+ theme.version: Ubuntu.toolkitVersion
226 style: theme.createStyleComponent("ButtonStyle.qml", button)
227 }
228
229=== modified file 'modules/Ubuntu/Components/AbstractButton.qml'
230--- modules/Ubuntu/Components/AbstractButton.qml 2015-03-03 13:47:48 +0000
231+++ modules/Ubuntu/Components/AbstractButton.qml 2015-04-25 07:11:10 +0000
232@@ -15,7 +15,7 @@
233 */
234
235 import QtQuick 2.4
236-import Ubuntu.Components 1.2
237+import Ubuntu.Components 1.3
238
239 /*!
240 \qmlabstract AbstractButton
241
242=== modified file 'modules/Ubuntu/Components/ActionItem.qml'
243--- modules/Ubuntu/Components/ActionItem.qml 2015-03-03 13:47:48 +0000
244+++ modules/Ubuntu/Components/ActionItem.qml 2015-04-25 07:11:10 +0000
245@@ -15,7 +15,7 @@
246 */
247
248 import QtQuick 2.4
249-import Ubuntu.Components 1.2
250+import Ubuntu.Components 1.3
251
252 /*!
253 \qmlabstract ActionItem
254
255=== modified file 'modules/Ubuntu/Components/AnimatedItem.qml'
256--- modules/Ubuntu/Components/AnimatedItem.qml 2015-04-10 06:52:20 +0000
257+++ modules/Ubuntu/Components/AnimatedItem.qml 2015-04-25 07:11:10 +0000
258@@ -33,5 +33,6 @@
259 \deprecated
260 Specifies whether the component is on the visible area of the Flickable or not.
261 */
262+ theme.version: Toolkit.Ubuntu.toolkitVersion
263 property bool onScreen: true
264 }
265
266=== modified file 'modules/Ubuntu/Components/AppHeader.qml'
267--- modules/Ubuntu/Components/AppHeader.qml 2015-04-10 06:52:20 +0000
268+++ modules/Ubuntu/Components/AppHeader.qml 2015-04-25 07:11:10 +0000
269@@ -342,6 +342,7 @@
270 }
271 }
272
273+ theme.version: Components.Ubuntu.toolkitVersion
274 style: header.useDeprecatedToolbar ? theme.createStyleComponent("HeaderStyle.qml", header) :
275 theme.createStyleComponent("PageHeadStyle.qml", header)
276 }
277
278=== modified file 'modules/Ubuntu/Components/CheckBox.qml'
279--- modules/Ubuntu/Components/CheckBox.qml 2015-04-09 09:42:36 +0000
280+++ modules/Ubuntu/Components/CheckBox.qml 2015-04-25 07:11:10 +0000
281@@ -15,7 +15,7 @@
282 */
283
284 import QtQuick 2.4
285-
286+import Ubuntu.Components 1.3
287 /*!
288 \qmltype CheckBox
289 \inqmlmodule Ubuntu.Components 1.1
290@@ -49,5 +49,6 @@
291 */
292 onTriggered: checked = !checked
293
294+ theme.version: Ubuntu.toolkitVersion
295 style: theme.createStyleComponent("CheckBoxStyle.qml", checkBox)
296 }
297
298=== modified file 'modules/Ubuntu/Components/ListItems/ItemSelector.qml'
299--- modules/Ubuntu/Components/ListItems/ItemSelector.qml 2015-04-09 09:42:36 +0000
300+++ modules/Ubuntu/Components/ListItems/ItemSelector.qml 2015-04-25 07:11:10 +0000
301@@ -216,6 +216,7 @@
302 right: parent.right
303 }
304 state: itemSelector.expanded ? "expanded" : "collapsed"
305+ theme.version: Ubuntu.toolkitVersion
306 style: theme.createStyleComponent("ListItemOptionSelectorStyle.qml", listContainer)
307
308 states: [ State {
309
310=== modified file 'modules/Ubuntu/Components/ListItems/ProgressionVisual.qml'
311--- modules/Ubuntu/Components/ListItems/ProgressionVisual.qml 2015-04-09 09:42:36 +0000
312+++ modules/Ubuntu/Components/ListItems/ProgressionVisual.qml 2015-04-25 07:11:10 +0000
313@@ -25,5 +25,6 @@
314 property bool showSplit: false
315 property real splitMargin
316
317+ theme.version: Ubuntu.toolkitVersion
318 style: theme.createStyleComponent("ProgressionVisualStyle.qml", progressionVisual)
319 }
320
321=== modified file 'modules/Ubuntu/Components/MainViewBase.qml'
322--- modules/Ubuntu/Components/MainViewBase.qml 2015-04-10 06:52:20 +0000
323+++ modules/Ubuntu/Components/MainViewBase.qml 2015-04-25 07:11:10 +0000
324@@ -35,6 +35,7 @@
325 Toolkit.StyledItem {
326 id: background
327 anchors.fill: parent
328+ // theme is inherited from PageTreeNode, no need to update versioning
329 style: theme.createStyleComponent("MainViewStyle.qml", background)
330
331 property color headerColor: backgroundColor
332
333=== modified file 'modules/Ubuntu/Components/OptionSelector.qml'
334--- modules/Ubuntu/Components/OptionSelector.qml 2015-04-10 06:52:20 +0000
335+++ modules/Ubuntu/Components/OptionSelector.qml 2015-04-25 07:11:10 +0000
336@@ -225,6 +225,7 @@
337 right: parent.right
338 }
339 state: optionSelector.expanded ? "expanded" : "collapsed"
340+ theme.version: Toolkit.Ubuntu.toolkitVersion
341 style: theme.createStyleComponent("OptionSelectorStyle.qml", listContainer)
342 states: [ State {
343 name: "expanded"
344
345=== modified file 'modules/Ubuntu/Components/PageTreeNode.qml'
346--- modules/Ubuntu/Components/PageTreeNode.qml 2015-04-10 06:52:20 +0000
347+++ modules/Ubuntu/Components/PageTreeNode.qml 2015-04-25 07:11:10 +0000
348@@ -155,4 +155,6 @@
349 node.parentNode = internal.getParentPageTreeNode(node);
350 }
351 }
352+
353+ theme.version: Toolkit.Ubuntu.toolkitVersion
354 }
355
356=== modified file 'modules/Ubuntu/Components/Pickers/DatePicker.qml'
357--- modules/Ubuntu/Components/Pickers/DatePicker.qml 2015-04-09 09:42:36 +0000
358+++ modules/Ubuntu/Components/Pickers/DatePicker.qml 2015-04-25 07:11:10 +0000
359@@ -420,6 +420,7 @@
360 }
361 }
362
363+ theme.version: Ubuntu.toolkitVersion
364 style: theme.createStyleComponent("DatePickerStyle.qml", datePicker)
365 Binding {
366 target: __styleInstance
367
368=== modified file 'modules/Ubuntu/Components/Pickers/Dialer.qml'
369--- modules/Ubuntu/Components/Pickers/Dialer.qml 2015-04-09 09:42:36 +0000
370+++ modules/Ubuntu/Components/Pickers/Dialer.qml 2015-04-25 07:11:10 +0000
371@@ -145,6 +145,7 @@
372 implicitHeight: size
373 activeFocusOnPress: true
374
375+ theme.version: Ubuntu.toolkitVersion
376 style: theme.createStyleComponent("DialerStyle.qml", dialer)
377
378 Item {
379
380=== modified file 'modules/Ubuntu/Components/Pickers/DialerHand.qml'
381--- modules/Ubuntu/Components/Pickers/DialerHand.qml 2015-04-09 09:42:36 +0000
382+++ modules/Ubuntu/Components/Pickers/DialerHand.qml 2015-04-25 07:11:10 +0000
383@@ -143,6 +143,7 @@
384 width: parent.width
385 height: parent.height
386 activeFocusOnPress: true
387+ theme.version: Ubuntu.toolkitVersion
388 style: theme.createStyleComponent("DialerHandStyle.qml", dialerHand)
389
390 /*! \internal */
391
392=== modified file 'modules/Ubuntu/Components/Pickers/Picker.qml'
393--- modules/Ubuntu/Components/Pickers/Picker.qml 2015-04-09 09:42:36 +0000
394+++ modules/Ubuntu/Components/Pickers/Picker.qml 2015-04-25 07:11:10 +0000
395@@ -159,6 +159,7 @@
396 implicitHeight: units.gu(20)
397 activeFocusOnPress: true
398
399+ theme.version: Ubuntu.toolkitVersion
400 style: theme.createStyleComponent("PickerStyle.qml", picker)
401
402 /*! \internal */
403
404=== modified file 'modules/Ubuntu/Components/Pickers/PickerDelegate.qml'
405--- modules/Ubuntu/Components/Pickers/PickerDelegate.qml 2015-04-09 09:42:36 +0000
406+++ modules/Ubuntu/Components/Pickers/PickerDelegate.qml 2015-04-25 07:11:10 +0000
407@@ -47,6 +47,7 @@
408 internal.itemList.currentIndex = index;
409 }
410
411+ theme.version: Ubuntu.toolkitVersion
412 style: theme.createStyleComponent("PickerDelegateStyle.qml", pickerDelegate)
413
414 QtObject {
415
416=== modified file 'modules/Ubuntu/Components/Popups/Dialog.qml'
417--- modules/Ubuntu/Components/Popups/Dialog.qml 2015-04-09 09:42:36 +0000
418+++ modules/Ubuntu/Components/Popups/Dialog.qml 2015-04-25 07:11:10 +0000
419@@ -213,6 +213,7 @@
420 }
421 }
422
423+ theme.version: Ubuntu.toolkitVersion
424 style: theme.createStyleComponent("DialogForegroundStyle.qml", foreground)
425 }
426 }
427
428=== modified file 'modules/Ubuntu/Components/Popups/Popover.qml'
429--- modules/Ubuntu/Components/Popups/Popover.qml 2015-04-09 09:42:36 +0000
430+++ modules/Ubuntu/Components/Popups/Popover.qml 2015-04-25 07:11:10 +0000
431@@ -237,6 +237,7 @@
432 signal showCompleted()
433 signal hideCompleted()
434
435+ theme.version: Ubuntu.toolkitVersion
436 style: theme.createStyleComponent("PopoverForegroundStyle.qml", foreground)
437 }
438
439
440=== modified file 'modules/Ubuntu/Components/Popups/SheetBase.qml'
441--- modules/Ubuntu/Components/Popups/SheetBase.qml 2015-04-09 09:42:36 +0000
442+++ modules/Ubuntu/Components/Popups/SheetBase.qml 2015-04-25 07:11:10 +0000
443@@ -109,6 +109,7 @@
444 }
445 }
446
447+ theme.version: Ubuntu.toolkitVersion
448 style: theme.createStyleComponent("SheetForegroundStyle.qml", sheet)
449 }
450 }
451
452=== modified file 'modules/Ubuntu/Components/ProgressBar10.qml'
453--- modules/Ubuntu/Components/ProgressBar10.qml 2015-04-09 09:42:36 +0000
454+++ modules/Ubuntu/Components/ProgressBar10.qml 2015-04-25 07:11:10 +0000
455@@ -64,5 +64,6 @@
456 */
457 property real value: 0.5
458
459+ theme.version: Ubuntu.toolkitVersion
460 style: theme.createStyleComponent("ProgressBarStyle.qml", progressBar)
461 }
462
463=== modified file 'modules/Ubuntu/Components/PullToRefresh.qml'
464--- modules/Ubuntu/Components/PullToRefresh.qml 2015-04-09 09:42:36 +0000
465+++ modules/Ubuntu/Components/PullToRefresh.qml 2015-04-25 07:11:10 +0000
466@@ -222,6 +222,7 @@
467 */
468 signal refresh()
469
470+ theme.version: Ubuntu.toolkitVersion
471 style: theme.createStyleComponent("PullToRefreshStyle.qml", control)
472 implicitHeight: __styleInstance.implicitHeight
473 anchors {
474
475=== modified file 'modules/Ubuntu/Components/Scrollbar.qml'
476--- modules/Ubuntu/Components/Scrollbar.qml 2015-04-10 06:52:20 +0000
477+++ modules/Ubuntu/Components/Scrollbar.qml 2015-04-25 07:11:10 +0000
478@@ -146,5 +146,6 @@
479 }
480 }
481
482+ theme.version: Toolkit.Ubuntu.toolkitVersion
483 style: theme.createStyleComponent("ScrollbarStyle.qml", scrollbar)
484 }
485
486=== modified file 'modules/Ubuntu/Components/Slider.qml'
487--- modules/Ubuntu/Components/Slider.qml 2015-04-10 06:52:20 +0000
488+++ modules/Ubuntu/Components/Slider.qml 2015-04-25 07:11:10 +0000
489@@ -207,5 +207,6 @@
490 onLiveValueChanged: if (isPressed) slider.requestFocus(Qt.MouseFocusReason)
491 }
492
493+ theme.version: Toolkit.Ubuntu.toolkitVersion
494 style: theme.createStyleComponent("SliderStyle.qml", slider)
495 }
496
497=== modified file 'modules/Ubuntu/Components/TabBar.qml'
498--- modules/Ubuntu/Components/TabBar.qml 2015-04-10 06:52:20 +0000
499+++ modules/Ubuntu/Components/TabBar.qml 2015-04-25 07:11:10 +0000
500@@ -97,7 +97,7 @@
501
502 implicitHeight: units.gu(7.5)
503 activeFocusOnPress: true
504-
505+ theme.version: Toolkit.Ubuntu.toolkitVersion
506 style: theme.createStyleComponent("TabBarStyle.qml", tabBar)
507
508 QtObject {
509
510=== modified file 'modules/Ubuntu/Components/TextArea.qml'
511--- modules/Ubuntu/Components/TextArea.qml 2015-04-17 07:44:17 +0000
512+++ modules/Ubuntu/Components/TextArea.qml 2015-04-25 07:11:10 +0000
513@@ -873,5 +873,6 @@
514 }
515 }
516
517+ theme.version: Ubuntu.Ubuntu.toolkitVersion
518 style: theme.createStyleComponent("TextAreaStyle.qml", control)
519 }
520
521=== modified file 'modules/Ubuntu/Components/TextCursor.qml'
522--- modules/Ubuntu/Components/TextCursor.qml 2015-04-09 09:42:36 +0000
523+++ modules/Ubuntu/Components/TextCursor.qml 2015-04-25 07:11:10 +0000
524@@ -41,6 +41,7 @@
525 handler.main.cursorDelegate :
526 __styleInstance.cursorDelegate
527
528+ theme.version: Ubuntu.Ubuntu.toolkitVersion
529 style: theme.createStyleComponent("TextCursorStyle.qml", cursorItem);
530
531 objectName: "textCursor"
532
533=== modified file 'modules/Ubuntu/Components/TextField.qml'
534--- modules/Ubuntu/Components/TextField.qml 2015-04-16 15:03:56 +0000
535+++ modules/Ubuntu/Components/TextField.qml 2015-04-25 07:11:10 +0000
536@@ -1019,5 +1019,6 @@
537 cursorPosition = 0;
538 }
539
540+ theme.version: Ubuntu.Ubuntu.toolkitVersion
541 style: theme.createStyleComponent("TextFieldStyle.qml", control)
542 }
543
544=== modified file 'modules/Ubuntu/Components/TextInputPopover.qml'
545--- modules/Ubuntu/Components/TextInputPopover.qml 2015-04-09 09:42:36 +0000
546+++ modules/Ubuntu/Components/TextInputPopover.qml 2015-04-25 07:11:10 +0000
547@@ -96,6 +96,7 @@
548 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)
549 height: units.gu(6)
550 action: actions[modelData]
551+ theme.version: Ubuntu.toolkitVersion
552 style: theme.createStyleComponent("ToolbarButtonStyle.qml", button)
553 }
554 }
555
556=== added directory 'modules/Ubuntu/Components/Themes/1.2'
557=== added file 'modules/Ubuntu/Components/Themes/1.2/Palette.qml'
558--- modules/Ubuntu/Components/Themes/1.2/Palette.qml 1970-01-01 00:00:00 +0000
559+++ modules/Ubuntu/Components/Themes/1.2/Palette.qml 2015-04-25 07:11:10 +0000
560@@ -0,0 +1,59 @@
561+/*
562+ * Copyright 2013 Canonical Ltd.
563+ *
564+ * This program is free software; you can redistribute it and/or modify
565+ * it under the terms of the GNU Lesser General Public License as published by
566+ * the Free Software Foundation; version 3.
567+ *
568+ * This program is distributed in the hope that it will be useful,
569+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
570+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
571+ * GNU Lesser General Public License for more details.
572+ *
573+ * You should have received a copy of the GNU Lesser General Public License
574+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
575+ */
576+
577+import QtQuick 2.4
578+
579+/*!
580+ \qmltype Palette
581+ \inqmlmodule Ubuntu.Components.Themes 0.1
582+ \ingroup theming
583+ \brief Palette of colors from the theme that widgets use to draw themselves.
584+
585+ Palette provides access to colors defined by the current theme. The actual
586+ color palette to use depends on the state of the widget being drawn.
587+
588+ A color palette (\l PaletteValues) has various roles to choose from depending
589+ on what part of the widget is being drawn (the base of the widget, the
590+ foreground, etc.).
591+
592+ For each color there is a corresponding 'text' color that is guaranteed to
593+ provide good legibility for text or icons placed on top of a background
594+ of the corresponding color.
595+
596+ Example of a Text on top of a background Rectangle:
597+ \qml
598+ Item {
599+ Rectangle {
600+ color: Theme.palette.normal.base
601+ }
602+
603+ Text {
604+ color: Theme.palette.normal.baseText
605+ }
606+ }
607+ \endqml
608+*/
609+QtObject {
610+ /*!
611+ Color palette to use when the widget is not in any particular state.
612+ */
613+ property PaletteValues normal
614+ /*!
615+ Color palette to use when the widget is selected, for example when
616+ a tab is the current one.
617+ */
618+ property PaletteValues selected
619+}
620
621=== added file 'modules/Ubuntu/Components/Themes/1.2/PaletteValues.qml'
622--- modules/Ubuntu/Components/Themes/1.2/PaletteValues.qml 1970-01-01 00:00:00 +0000
623+++ modules/Ubuntu/Components/Themes/1.2/PaletteValues.qml 2015-04-25 07:11:10 +0000
624@@ -0,0 +1,76 @@
625+/*
626+ * Copyright 2013 Canonical Ltd.
627+ *
628+ * This program is free software; you can redistribute it and/or modify
629+ * it under the terms of the GNU Lesser General Public License as published by
630+ * the Free Software Foundation; version 3.
631+ *
632+ * This program is distributed in the hope that it will be useful,
633+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
634+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
635+ * GNU Lesser General Public License for more details.
636+ *
637+ * You should have received a copy of the GNU Lesser General Public License
638+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
639+ */
640+
641+import QtQuick 2.4
642+
643+/*!
644+ \qmltype PaletteValues
645+ \inqmlmodule Ubuntu.Components.Themes 0.1
646+ \ingroup theming
647+ \brief Color values used for a given widget state.
648+*/
649+QtObject {
650+ /*!
651+ Color applied to the background of the application.
652+ */
653+ property color background
654+ /*!
655+ Color applied to elements placed on top of the \l background color.
656+ Typically used for labels and images.
657+ */
658+ property color backgroundText
659+ /*!
660+ Color applied to the background of widgets.
661+ */
662+ property color base
663+ /*!
664+ Color applied to elements placed on top of the \l base color.
665+ Typically used for labels and images.
666+ */
667+ property color baseText
668+ /*!
669+ Color applied to widgets on top of the base colour.
670+ */
671+ property color foreground
672+ /*!
673+ Color applied to elements placed on top of the \l foreground color.
674+ Typically used for labels and images.
675+ */
676+ property color foregroundText
677+ /*!
678+ Color applied to the background of widgets floating over other widgets.
679+ For example: popovers, Toolbar.
680+ */
681+ property color overlay
682+ /*!
683+ Color applied to elements placed on top of the \l overlay color.
684+ Typically used for labels and images.
685+ */
686+ property color overlayText
687+ /*!
688+ Colour applied to the backgrouhnd of text input fields.
689+ */
690+ property color field
691+ /*!
692+ Color applied to elements placed on top of the \l field color.
693+ Typically used for labels and images.
694+ */
695+ property color fieldText
696+ /*!
697+ Color applied to selected text in editable components.
698+ */
699+ property color selection
700+}
701
702=== added directory 'modules/Ubuntu/Components/Themes/1.3'
703=== renamed file 'modules/Ubuntu/Components/Themes/Palette.qml' => 'modules/Ubuntu/Components/Themes/1.3/Palette.qml'
704=== renamed file 'modules/Ubuntu/Components/Themes/PaletteValues.qml' => 'modules/Ubuntu/Components/Themes/1.3/PaletteValues.qml'
705=== added directory 'modules/Ubuntu/Components/Themes/Ambiance/1.2'
706=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ActivityIndicatorStyle.qml'
707--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ActivityIndicatorStyle.qml 1970-01-01 00:00:00 +0000
708+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ActivityIndicatorStyle.qml 2015-04-25 07:11:10 +0000
709@@ -0,0 +1,38 @@
710+/*
711+ * Copyright 2012 Canonical Ltd.
712+ *
713+ * This program is free software; you can redistribute it and/or modify
714+ * it under the terms of the GNU Lesser General Public License as published by
715+ * the Free Software Foundation; version 3.
716+ *
717+ * This program is distributed in the hope that it will be useful,
718+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
719+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
720+ * GNU Lesser General Public License for more details.
721+ *
722+ * You should have received a copy of the GNU Lesser General Public License
723+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
724+ */
725+
726+import QtQuick 2.4
727+import Ubuntu.Components 1.2
728+
729+Image {
730+ id: container
731+
732+ anchors.fill: parent
733+ smooth: true
734+ visible: styledItem.running
735+ fillMode: Image.PreserveAspectFit
736+ horizontalAlignment: Image.AlignHCenter
737+ verticalAlignment: Image.AlignVCenter
738+ source: Qt.resolvedUrl("../artwork/spinner.png")
739+
740+ RotationAnimator on rotation {
741+ running: styledItem.running
742+ from: 0
743+ to: 360
744+ loops: Animation.Infinite
745+ duration: UbuntuAnimation.SleepyDuration
746+ }
747+}
748
749=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/BubbleShape.qml'
750--- modules/Ubuntu/Components/Themes/Ambiance/1.2/BubbleShape.qml 1970-01-01 00:00:00 +0000
751+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/BubbleShape.qml 2015-04-25 07:11:10 +0000
752@@ -0,0 +1,172 @@
753+/*
754+ * Copyright 2013-2014 Canonical Ltd.
755+ *
756+ * This program is free software; you can redistribute it and/or modify
757+ * it under the terms of the GNU Lesser General Public License as published by
758+ * the Free Software Foundation; version 3.
759+ *
760+ * This program is distributed in the hope that it will be useful,
761+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
762+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
763+ * GNU Lesser General Public License for more details.
764+ *
765+ * You should have received a copy of the GNU Lesser General Public License
766+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
767+ */
768+
769+import QtQuick 2.4
770+import Ubuntu.Components 1.2
771+
772+Item {
773+ id: bubbleShape
774+
775+ /*!
776+ Do not use an UbuntuShape but a Rectangle as the background of the BubbleShape.
777+ */
778+ property bool square: false
779+
780+ /*!
781+ The background color of the bubble.
782+ */
783+ property color color: square ? Theme.palette.normal.background : Theme.palette.normal.overlay
784+
785+ property point target
786+ property string direction: "down"
787+ property bool clipContent: false
788+ default property alias children: content.children
789+ // FIXME: This should not be necessary. See
790+ // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1214978
791+ property alias arrowSource: arrow.source
792+
793+ implicitWidth: units.gu(10)
794+ implicitHeight: units.gu(8)
795+
796+ signal showCompleted()
797+ signal hideCompleted()
798+
799+ opacity: 0.0
800+
801+ function show() {
802+ hideAnimation.stop();
803+ showAnimation.start();
804+ }
805+
806+ function hide() {
807+ showAnimation.stop();
808+ hideAnimation.start();
809+ }
810+
811+ ParallelAnimation {
812+ id: showAnimation
813+
814+ NumberAnimation {
815+ target: bubbleShape
816+ property: "opacity"
817+ from: 0.0
818+ to: 1.0
819+ duration: UbuntuAnimation.FastDuration
820+ easing: UbuntuAnimation.StandardEasing
821+ }
822+ NumberAnimation {
823+ target: scaleTransform
824+ property: (direction === "up" || direction === "down") ? "yScale" : "xScale"
825+ from: 0.91
826+ to: 1.0
827+ duration: UbuntuAnimation.FastDuration
828+ easing: UbuntuAnimation.StandardEasing
829+ }
830+ onStopped: showCompleted()
831+ }
832+
833+ NumberAnimation {
834+ id: hideAnimation
835+ target: bubbleShape
836+ property: "opacity"
837+ from: 1.0
838+ to: 0.0
839+ duration: UbuntuAnimation.FastDuration
840+ easing: UbuntuAnimation.StandardEasing
841+ onStopped: hideCompleted()
842+ }
843+
844+ transform: Scale {
845+ id: scaleTransform
846+ origin.x: direction === "right" ? bubbleShape.width :
847+ direction === "left" ? 0 :
848+ bubbleShape.width/2.0
849+ origin.y: direction === "up" ? 0 :
850+ direction === "down" ? bubbleShape.height :
851+ bubbleShape.height/2.0
852+ }
853+
854+ BorderImage {
855+ id: shadow
856+ anchors.fill: parent
857+ anchors.margins: square ? -units.gu(1) : -units.dp(2)
858+ anchors.topMargin: square ? 0 : anchors.margins
859+ source: !square ? Qt.resolvedUrl("../artwork/bubble_shadow.sci") : Qt.resolvedUrl("../artwork/header_overflow_dropshadow.sci")
860+ opacity: 0.8
861+ }
862+
863+ UbuntuShape {
864+ anchors.fill: parent
865+ borderSource: "none"
866+ color: Theme.palette.normal.overlay
867+ image: bubbleShape.clipContent ? shapeSource : null
868+ visible: !square
869+ }
870+
871+ ShaderEffectSource {
872+ id: shapeSource
873+ visible: bubbleShape.clipContent
874+ sourceItem: bubbleShape.clipContent ? content : null
875+ hideSource: !square
876+ // FIXME: visible: false prevents rendering so make it a nearly
877+ // transparent 1x1 pixel instead
878+ opacity: 0.01
879+ width: 1
880+ height: 1
881+ }
882+
883+ Item {
884+ id: content
885+ anchors.fill: parent
886+
887+ Rectangle {
888+ id: colorRect
889+ anchors.fill: parent
890+ color: bubbleShape.color
891+ visible: bubbleShape.clipContent
892+ }
893+ }
894+
895+ Item {
896+ x: target.x
897+ y: target.y
898+
899+ Image {
900+ id: arrow
901+
902+ visible: !square && bubbleShape.direction != "none"
903+
904+ function directionToRotation(direction) {
905+ switch (direction) {
906+ case "up":
907+ return 180;
908+ case "left":
909+ return 90;
910+ case "right":
911+ return -90;
912+ default: // "down" or "none"
913+ return 0;
914+ }
915+ }
916+
917+ x: -width / 2.0
918+ y: -height
919+ transformOrigin: Item.Bottom
920+ rotation: directionToRotation(bubbleShape.direction)
921+ source: Qt.resolvedUrl("../artwork/bubble_arrow.png")
922+ }
923+ }
924+}
925
926=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonForeground.qml'
927--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonForeground.qml 1970-01-01 00:00:00 +0000
928+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonForeground.qml 2015-04-25 07:11:10 +0000
929@@ -0,0 +1,117 @@
930+/*
931+ * Copyright 2013 Canonical Ltd.
932+ *
933+ * This program is free software; you can redistribute it and/or modify
934+ * it under the terms of the GNU Lesser General Public License as published by
935+ * the Free Software Foundation; version 3.
936+ *
937+ * This program is distributed in the hope that it will be useful,
938+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
939+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
940+ * GNU Lesser General Public License for more details.
941+ *
942+ * You should have received a copy of the GNU Lesser General Public License
943+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
944+ *
945+ * Author: Florian Boucault <florian.boucault@canonical.com>
946+ */
947+
948+import QtQuick 2.4
949+import Ubuntu.Components 1.2
950+
951+Item {
952+ id: buttonForeground
953+
954+ property alias text: label.text
955+ property alias textColor: label.color
956+ property alias iconSource: icon.source
957+ property string iconPosition
958+ property real iconSize
959+ property real spacing
960+ property bool hasIcon: iconSource != ""
961+ property bool hasText: text != ""
962+ property alias font: label.font
963+
964+ opacity: enabled ? 1.0 : 0.5
965+ implicitHeight: Math.max(icon.height, label.height)
966+ state: hasIcon && hasText ? iconPosition : "center"
967+
968+ Image {
969+ id: icon
970+ anchors.verticalCenter: parent.verticalCenter
971+ fillMode: Image.PreserveAspectFit
972+ width: iconSize
973+ height: iconSize
974+ }
975+
976+ Label {
977+ id: label
978+ anchors {
979+ verticalCenter: parent.verticalCenter
980+ verticalCenterOffset: units.dp(-1)
981+ }
982+ fontSize: "medium"
983+ elide: Text.ElideRight
984+ }
985+
986+ states: [
987+ State {
988+ name: "left"
989+ AnchorChanges {
990+ target: icon
991+ anchors.left: buttonForeground.left
992+ }
993+ AnchorChanges {
994+ target: label
995+ anchors.left: icon.right
996+ }
997+ PropertyChanges {
998+ target: label
999+ anchors.leftMargin: spacing
1000+ width: buttonForeground.width - icon.width - spacing
1001+ }
1002+ PropertyChanges {
1003+ target: buttonForeground
1004+ implicitWidth: icon.implicitWidth + spacing + label.implicitWidth
1005+ }
1006+ },
1007+ State {
1008+ name: "right"
1009+ AnchorChanges {
1010+ target: icon
1011+ anchors.right: buttonForeground.right
1012+ }
1013+ AnchorChanges {
1014+ target: label
1015+ anchors.left: buttonForeground.left
1016+ }
1017+ PropertyChanges {
1018+ target: label
1019+ width: buttonForeground.width - icon.width - spacing
1020+ }
1021+ PropertyChanges {
1022+ target: buttonForeground
1023+ implicitWidth: label.implicitWidth + spacing + icon.implicitWidth
1024+ }
1025+ },
1026+ State {
1027+ name: "center"
1028+ AnchorChanges {
1029+ target: icon
1030+ anchors.horizontalCenter: buttonForeground.horizontalCenter
1031+ }
1032+ AnchorChanges {
1033+ target: label
1034+ anchors.horizontalCenter: buttonForeground.horizontalCenter
1035+ }
1036+ PropertyChanges {
1037+ target: label
1038+ width: Math.min(label.implicitWidth, buttonForeground.width)
1039+ }
1040+ PropertyChanges {
1041+ target: buttonForeground
1042+ implicitWidth: hasText ? label.implicitWidth : icon.implicitWidth
1043+ }
1044+ }
1045+ ]
1046+}
1047
1048=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonStyle.qml'
1049--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonStyle.qml 1970-01-01 00:00:00 +0000
1050+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ButtonStyle.qml 2015-04-25 07:11:10 +0000
1051@@ -0,0 +1,177 @@
1052+/*
1053+ * Copyright 2013 Canonical Ltd.
1054+ *
1055+ * This program is free software; you can redistribute it and/or modify
1056+ * it under the terms of the GNU Lesser General Public License as published by
1057+ * the Free Software Foundation; version 3.
1058+ *
1059+ * This program is distributed in the hope that it will be useful,
1060+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1061+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1062+ * GNU Lesser General Public License for more details.
1063+ *
1064+ * You should have received a copy of the GNU Lesser General Public License
1065+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1066+ *
1067+ * Author: Florian Boucault <florian.boucault@canonical.com>
1068+ */
1069+
1070+import QtQuick 2.4
1071+import Ubuntu.Components 1.2
1072+
1073+Item {
1074+ id: buttonStyle
1075+
1076+ property var button: styledItem
1077+ property real minimumWidth: units.gu(10)
1078+ property real horizontalPadding: units.gu(1)
1079+ // FIXME: Add this color to the palette
1080+ property color defaultColor: "#b2b2b2"
1081+ property font defaultFont: Qt.font({family: "Ubuntu", pixelSize: FontUtils.sizeToPixels("medium")})
1082+ property Gradient defaultGradient
1083+ property real buttonFaceOffset: 0
1084+ property bool stroke: button.hasOwnProperty("strokeColor") && button.strokeColor != Qt.rgba(0.0, 0.0, 0.0, 0.0)
1085+ /*!
1086+ The property overrides the button's default background with an item. This
1087+ item can be used by derived styles to reuse the ButtonStyle and override
1088+ the default coloured background with an image or any other drawing.
1089+ The default value is null.
1090+ */
1091+ property Item backgroundSource: null
1092+
1093+ width: button.width
1094+ height: button.height
1095+ implicitWidth: Math.max(minimumWidth, foreground.implicitWidth + 2*horizontalPadding)
1096+ implicitHeight: units.gu(4)
1097+
1098+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
1099+ LayoutMirroring.childrenInherit: true
1100+
1101+ /*! \internal */
1102+ // Color properties in a JS ternary operator don't work as expected in
1103+ // QML because it overwrites alpha values with 1. A workaround is to use
1104+ // Qt.rgba(). For more information, see
1105+ // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1197802 and
1106+ // https://bugreports.qt-project.org/browse/QTBUG-32238.
1107+ function __colorHack(color) { return Qt.rgba(color.r, color.g, color.b, color.a); }
1108+
1109+
1110+ /* The proxy is necessary because Gradient.stops and GradientStop.color are
1111+ non-NOTIFYable properties. They cannot be written to so it is fine but
1112+ the proxy avoids the warnings.
1113+ */
1114+ property QtObject gradientProxy: gradientProxyObject
1115+ QtObject {
1116+ id: gradientProxyObject
1117+ property color topColor
1118+ property color bottomColor
1119+
1120+ function updateGradient() {
1121+ if (button.gradient) {
1122+ topColor = button.gradient.stops[0].color;
1123+ bottomColor = button.gradient.stops[1].color;
1124+ }
1125+ }
1126+
1127+ Component.onCompleted: {
1128+ updateGradient();
1129+ button.gradientChanged.connect(updateGradient);
1130+ }
1131+ }
1132+
1133+ // Use the gradient if it is defined and the color has not been set manually
1134+ // or the gradient has been set manually
1135+ property bool isGradient: button.gradient && (button.color == defaultColor ||
1136+ button.gradient != defaultGradient)
1137+
1138+ Image {
1139+ id: strokeBorder
1140+ anchors.fill: parent
1141+ anchors.margins: -units.gu(0.5)
1142+ // FIXME: this PNG is way too big (462x108) and do not scale properly
1143+ // ie. the corners are visually incorrect at most sizes
1144+ source: stroke ? Qt.resolvedUrl("../artwork/stroke_button.png") : ""
1145+ visible: false
1146+ cache: false
1147+ asynchronous: true
1148+ }
1149+
1150+ ShaderEffect {
1151+ id: colorizedImage
1152+
1153+ anchors.fill: parent
1154+ visible: stroke && strokeBorder.status == Image.Ready
1155+
1156+ property Item source: visible ? strokeBorder : null
1157+ property color keyColorOut: stroke ? strokeColor : Qt.rgba(0.0, 0.0, 0.0, 0.0)
1158+ property color keyColorIn: Qt.rgba(1.0, 1.0, 1.0, 1.0)
1159+ property real threshold: 1.0
1160+
1161+ fragmentShader: "
1162+ varying highp vec2 qt_TexCoord0;
1163+ uniform sampler2D source;
1164+ uniform highp vec4 keyColorOut;
1165+ uniform highp vec4 keyColorIn;
1166+ uniform lowp float threshold;
1167+ uniform lowp float qt_Opacity;
1168+ void main() {
1169+ lowp vec4 sourceColor = texture2D(source, qt_TexCoord0);
1170+ gl_FragColor = mix(vec4(keyColorOut.rgb, 1.0) * sourceColor.a, sourceColor, step(threshold, distance(sourceColor.rgb / sourceColor.a, keyColorIn.rgb))) * qt_Opacity;
1171+ }"
1172+ }
1173+
1174+ UbuntuShape {
1175+ id: background
1176+ anchors.fill: parent
1177+ borderSource: "radius_idle.sci"
1178+ visible: stroke ? false : ((color.a != 0.0) || backgroundSource)
1179+ image: backgroundSource
1180+
1181+ color: stroke ? "" : (backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.topColor) : __colorHack(button.color)))
1182+ opacity: styledItem.enabled ? 1.0 : 0.6
1183+ gradientColor: stroke ? "" : (backgroundSource ? "#00000000" : (isGradient ? __colorHack(gradientProxy.bottomColor) : __colorHack(button.color)))
1184+ }
1185+
1186+ UbuntuShape {
1187+ id: backgroundPressed
1188+ anchors.fill: parent
1189+ color: stroke ? strokeColor : background.color
1190+ gradientColor: stroke ? strokeColor : background.gradientColor
1191+ borderSource: "radius_pressed.sci"
1192+ opacity: button.pressed ? 1.0 : 0.0
1193+ Behavior on opacity {
1194+ NumberAnimation {
1195+ duration: UbuntuAnimation.SnapDuration
1196+ easing.type: Easing.Linear
1197+ }
1198+ }
1199+ visible: stroke || background.visible
1200+ }
1201+
1202+ ButtonForeground {
1203+ id: foreground
1204+ width: parent.width - 2*horizontalPadding
1205+ anchors {
1206+ centerIn: parent
1207+ horizontalCenterOffset: buttonFaceOffset
1208+ }
1209+ text: button.text
1210+ /* Pick either a clear or dark text color depending on the luminance of the
1211+ background color to maintain good contrast (works in most cases)
1212+ */
1213+ textColor: ColorUtils.luminance(button.color) <= 0.85 && !(stroke && !pressed) ? "#FFFFFF" : "#888888"
1214+ iconSource: button.iconSource
1215+ iconPosition: button.iconPosition
1216+ iconSize: units.gu(3)
1217+ font: button.font
1218+ spacing: horizontalPadding
1219+ transformOrigin: Item.Top
1220+ scale: button.pressed ? 0.98 : 1.0
1221+ Behavior on scale {
1222+ NumberAnimation {
1223+ duration: UbuntuAnimation.SnapDuration
1224+ easing.type: Easing.Linear
1225+ }
1226+ }
1227+ }
1228+}
1229
1230=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/CheckBoxStyle.qml'
1231--- modules/Ubuntu/Components/Themes/Ambiance/1.2/CheckBoxStyle.qml 1970-01-01 00:00:00 +0000
1232+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/CheckBoxStyle.qml 2015-04-25 07:11:10 +0000
1233@@ -0,0 +1,162 @@
1234+/*
1235+ * Copyright 2013 Canonical Ltd.
1236+ *
1237+ * This program is free software; you can redistribute it and/or modify
1238+ * it under the terms of the GNU Lesser General Public License as published by
1239+ * the Free Software Foundation; version 3.
1240+ *
1241+ * This program is distributed in the hope that it will be useful,
1242+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1243+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1244+ * GNU Lesser General Public License for more details.
1245+ *
1246+ * You should have received a copy of the GNU Lesser General Public License
1247+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1248+ */
1249+
1250+import QtQuick 2.4
1251+import Ubuntu.Components 1.2
1252+
1253+Item {
1254+ id: checkBoxStyle
1255+
1256+ /*!
1257+ The padding between the background shape and the outside border of the checkbox.
1258+ */
1259+ property real backgroundPadding: units.gu(0.33)
1260+
1261+ /*!
1262+ The background color when the checkbox is not checked.
1263+ */
1264+ property color uncheckedBackgroundColor: Qt.rgba(Theme.palette.normal.foreground.r,
1265+ Theme.palette.normal.foreground.g,
1266+ Theme.palette.normal.foreground.b, 0.2)
1267+
1268+ /*!
1269+ The background color when the checkbox is checked.
1270+ */
1271+ property color checkedBackgroundColor: UbuntuColors.green
1272+
1273+ /*!
1274+ The image to show inside the checkbox when it is checked.
1275+ */
1276+ property url iconSource: "image://theme/tick"
1277+
1278+ /*!
1279+ The color of the icon.
1280+ */
1281+ property color iconColor: Theme.palette.normal.foregroundText
1282+
1283+ /*!
1284+ The padding between the icon and the border of the thumb.
1285+ */
1286+ property real iconPadding: backgroundPadding
1287+
1288+ opacity: enabled ? 1.0 : 0.5
1289+
1290+ implicitWidth: units.gu(3)
1291+ implicitHeight: units.gu(3)
1292+
1293+ UbuntuShape {
1294+ id: background
1295+ anchors {
1296+ fill: parent
1297+ margins: checkBoxStyle.backgroundPadding
1298+ }
1299+ property real iconSize: Math.min(width, height) - 2*checkBoxStyle.iconPadding
1300+
1301+ Icon {
1302+ color: checkBoxStyle.iconColor
1303+ width: background.iconSize
1304+ height: background.iconSize
1305+ id: tick
1306+ anchors.centerIn: parent
1307+ smooth: true
1308+ source: checkBoxStyle.iconSource
1309+ visible: styledItem.checked || transitionToChecked.running || transitionToUnchecked.running
1310+ }
1311+
1312+ state: styledItem.checked ? "checked" : "unchecked"
1313+ states: [
1314+ State {
1315+ name: "checked"
1316+ PropertyChanges {
1317+ target: tick
1318+ anchors.verticalCenterOffset: 0
1319+ }
1320+ PropertyChanges {
1321+ target: background
1322+ color: checkBoxStyle.checkedBackgroundColor
1323+ }
1324+ },
1325+ State {
1326+ name: "unchecked"
1327+ PropertyChanges {
1328+ target: tick
1329+ anchors.verticalCenterOffset: checkBoxStyle.height
1330+ }
1331+ PropertyChanges {
1332+ target: background
1333+ color: checkBoxStyle.uncheckedBackgroundColor
1334+ }
1335+ }
1336+ ]
1337+
1338+ transitions: [
1339+ Transition {
1340+ id: transitionToUnchecked
1341+ to: "unchecked"
1342+ ColorAnimation {
1343+ target: background
1344+ duration: UbuntuAnimation.FastDuration
1345+ easing: UbuntuAnimation.StandardEasingReverse
1346+ }
1347+ SequentialAnimation {
1348+ PropertyAction {
1349+ target: background
1350+ property: "clip"
1351+ value: true
1352+ }
1353+ NumberAnimation {
1354+ target: tick
1355+ property: "anchors.verticalCenterOffset"
1356+ duration: UbuntuAnimation.FastDuration
1357+ easing: UbuntuAnimation.StandardEasingReverse
1358+ }
1359+ PropertyAction {
1360+ target: background
1361+ property: "clip"
1362+ value: false
1363+ }
1364+ }
1365+ },
1366+ Transition {
1367+ id: transitionToChecked
1368+ to: "checked"
1369+ ColorAnimation {
1370+ target: background
1371+ duration: UbuntuAnimation.FastDuration
1372+ easing: UbuntuAnimation.StandardEasing
1373+ }
1374+ SequentialAnimation {
1375+ PropertyAction {
1376+ target: background
1377+ property: "clip"
1378+ value: true
1379+ }
1380+ NumberAnimation {
1381+ target: tick
1382+ property: "anchors.verticalCenterOffset"
1383+ duration: UbuntuAnimation.FastDuration
1384+ easing: UbuntuAnimation.StandardEasing
1385+ }
1386+ PropertyAction {
1387+ target: background
1388+ property: "clip"
1389+ value: false
1390+ }
1391+ }
1392+ }
1393+ ]
1394+ }
1395+}
1396
1397=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ComboButtonStyle.qml'
1398--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ComboButtonStyle.qml 1970-01-01 00:00:00 +0000
1399+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ComboButtonStyle.qml 2015-04-25 07:11:10 +0000
1400@@ -0,0 +1,197 @@
1401+/*
1402+ * Copyright 2014 Canonical Ltd.
1403+ *
1404+ * This program is free software; you can redistribute it and/or modify
1405+ * it under the terms of the GNU Lesser General Public License as published by
1406+ * the Free Software Foundation; version 3.
1407+ *
1408+ * This program is distributed in the hope that it will be useful,
1409+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1410+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1411+ * GNU Lesser General Public License for more details.
1412+ *
1413+ * You should have received a copy of the GNU Lesser General Public License
1414+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1415+ */
1416+
1417+import QtQuick 2.4
1418+import Ubuntu.Components 1.2
1419+import Ubuntu.Components.Styles 1.2 as Style
1420+
1421+Style.ComboButtonStyle {
1422+ id: comboStyle
1423+
1424+ // configurations
1425+ dropDownWidth: units.gu(5)
1426+ dropDownSeparatorWidth: units.dp(2)
1427+ comboListMargin: units.gu(0.8)
1428+ comboListHolder: comboListContent
1429+ comboListPanel: panelItem
1430+ defaultColor: mainButton.defaultColor
1431+ defaultGradient: mainButton.defaultGradient
1432+ defaultDropdownColor: combo.expanded ? Qt.rgba(0, 0, 0, 0.05) : defaultColor
1433+ defaultFont: mainButton.defaultFont
1434+
1435+
1436+ width: combo.width
1437+ height: combo.collapsedHeight
1438+
1439+ property ComboButton combo: styledItem
1440+
1441+ implicitWidth: mainButton.implicitWidth
1442+ implicitHeight: mainButton.implicitHeight
1443+
1444+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
1445+ LayoutMirroring.childrenInherit: true
1446+
1447+ ButtonStyle {
1448+ id: mainButton
1449+ anchors {
1450+ left: parent.left
1451+ top: parent.top
1452+ right: parent.right
1453+ }
1454+ height: combo.collapsedHeight
1455+ // overrides
1456+ backgroundSource: comboFace
1457+ buttonFaceOffset: -dropDownWidth/2 - dropDownSeparatorWidth
1458+ horizontalPadding: units.gu(4) - dropDownSeparatorWidth
1459+ minimumWidth: units.gu(36)
1460+
1461+ // FIXME: use hardcoded color while we get the theme palette updated
1462+ defaultColor: "#b2b2b2"
1463+ defaultGradient: null
1464+
1465+ // button face
1466+ ShaderEffectSource {
1467+ id: comboFace
1468+ sourceItem: content
1469+ hideSource: true
1470+ // FIXME: visible: false prevents rendering so make it a nearly
1471+ // transparent 1x1 pixel instead
1472+ opacity: 0.01
1473+ width: 1
1474+ height: 1
1475+ }
1476+
1477+ Item {
1478+ id: content
1479+ width: mainButton.width
1480+ height: mainButton.height
1481+
1482+ Rectangle {
1483+ anchors {
1484+ fill: parent
1485+ rightMargin: comboStyle.dropDownSeparatorWidth + comboStyle.dropDownWidth
1486+ }
1487+ color: combo.color
1488+ gradient: mainButton.isGradient ? combo.gradient : null
1489+ }
1490+
1491+ // distancer
1492+ Item {
1493+ anchors {
1494+ right: dropDownButton.right
1495+ top: parent.top
1496+ bottom: parent.bottom
1497+ }
1498+ width: comboStyle.dropDownSeparatorWidth
1499+ }
1500+
1501+ Rectangle {
1502+ id: dropDownButton
1503+ objectName: "combobutton_dropdown_visuals"
1504+ anchors {
1505+ right: parent.right
1506+ top: parent.top
1507+ bottom: parent.bottom
1508+ }
1509+ width: comboStyle.dropDownWidth
1510+ color: mainButton.__colorHack(combo.dropdownColor)
1511+ Image {
1512+ source: Qt.resolvedUrl("../artwork/chevron.png")
1513+ anchors.centerIn: parent
1514+ rotation: combo.expanded ? -90 : 90
1515+ }
1516+ }
1517+ }
1518+ }
1519+
1520+ Item {
1521+ id: panelItem
1522+ objectName: "combobutton_combopanel"
1523+ anchors {
1524+ left: parent.left
1525+ top: mainButton.bottom
1526+ right: parent.right
1527+ }
1528+ opacity: combo.expanded && (combo.comboList.length > 0)? 1.0 : 0.0
1529+
1530+ ShaderEffectSource {
1531+ id: listContent
1532+ sourceItem: comboListContent
1533+ hideSource: true
1534+ // FIXME: visible: false prevents rendering so make it a nearly
1535+ // transparent 1x1 pixel instead
1536+ opacity: 0.01
1537+ width: 1
1538+ height: 1
1539+ }
1540+ Rectangle {
1541+ id: comboListContent
1542+ anchors {
1543+ fill: parent
1544+ topMargin: comboListMargin
1545+ }
1546+ clip: true
1547+ color: mainButton.__colorHack(combo.dropdownColor)
1548+ }
1549+
1550+ BorderImage {
1551+ id: shadow
1552+ anchors {
1553+ fill: parent
1554+ leftMargin: -units.gu(0.5)
1555+ topMargin: comboListMargin - units.gu(0.5)
1556+ rightMargin: -units.gu(0.5)
1557+ bottomMargin: -units.gu(0.5)
1558+ }
1559+ source: Qt.resolvedUrl("../artwork/bubble_shadow.sci")
1560+ }
1561+ UbuntuShape {
1562+ id: shape
1563+ anchors {
1564+ fill: parent
1565+ topMargin: comboListMargin
1566+ }
1567+ visible: true
1568+ borderSource: "radius_idle.sci"
1569+ image: listContent
1570+ }
1571+
1572+ Image {
1573+ source: Qt.resolvedUrl("../artwork/bubble_arrow.png")
1574+ rotation: 180
1575+ anchors {
1576+ bottom: shape.top
1577+ bottomMargin: -1
1578+ right: parent.right
1579+ rightMargin: dropDownWidth / 2 - units.gu(0.5)
1580+ }
1581+
1582+ }
1583+
1584+ Behavior on height {
1585+ NumberAnimation {
1586+ duration: UbuntuAnimation.FastDuration
1587+ easing: UbuntuAnimation.StandardEasing
1588+ }
1589+ }
1590+ Behavior on opacity {
1591+ NumberAnimation {
1592+ duration: UbuntuAnimation.FastDuration
1593+ easing: UbuntuAnimation.StandardEasing
1594+ }
1595+ }
1596+ }
1597+}
1598
1599=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/DatePickerStyle.qml'
1600--- modules/Ubuntu/Components/Themes/Ambiance/1.2/DatePickerStyle.qml 1970-01-01 00:00:00 +0000
1601+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/DatePickerStyle.qml 2015-04-25 07:11:10 +0000
1602@@ -0,0 +1,164 @@
1603+/*
1604+ * Copyright 2012 Canonical Ltd.
1605+ *
1606+ * This program is free software; you can redistribute it and/or modify
1607+ * it under the terms of the GNU Lesser General Public License as published by
1608+ * the Free Software Foundation; version 3.
1609+ *
1610+ * This program is distributed in the hope that it will be useful,
1611+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1612+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1613+ * GNU Lesser General Public License for more details.
1614+ *
1615+ * You should have received a copy of the GNU Lesser General Public License
1616+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1617+ */
1618+
1619+import QtQuick 2.4
1620+import Ubuntu.Components 1.2
1621+import Ubuntu.Components.ListItems 1.0
1622+
1623+Item {
1624+ id: control
1625+ // style properties
1626+ /*!
1627+ Specifies the background color
1628+ */
1629+ property color backgroundColor: "#0A000000"
1630+ /*!
1631+ Background color for highlight.
1632+ */
1633+ property color highlightBackgroundColor: "#ffffffff"
1634+ /*!
1635+ Highlight color.
1636+ */
1637+ property color highlightColor: UbuntuColors.orange
1638+ /*!
1639+ Scale of the highlight item
1640+ */
1641+ property real highlightScaleFactor: 1.2
1642+ /*!
1643+ Thickness of the highlight component
1644+ */
1645+ property real highlightThickness: units.gu(5)
1646+
1647+ /*!
1648+ The content holder exposed to the Picker so tumbler list can be reparented to it.
1649+ */
1650+ property alias tumblerHolder: content
1651+
1652+ /*!
1653+ The property holds the separator to be shown between date and time units
1654+ */
1655+ property string unitSeparator: ""
1656+
1657+ property Item view: Item {}
1658+ property ListModel pickerModels: ListModel{}
1659+
1660+ anchors.fill: parent
1661+
1662+ // frame
1663+ UbuntuShape {
1664+ anchors.fill: parent
1665+ radius: "medium"
1666+ image: shapeSource
1667+ }
1668+
1669+ ShaderEffectSource {
1670+ id: shapeSource
1671+ sourceItem: background
1672+ hideSource: true
1673+ // FIXME: visible: false prevents rendering so make it a nearly
1674+ // transparent 1x1 pixel instead
1675+ opacity: 0.01
1676+ width: 1
1677+ height: 1
1678+ }
1679+
1680+ Rectangle {
1681+ id: background
1682+ anchors.fill: parent
1683+
1684+ MouseArea {
1685+ anchors.fill: parent
1686+ }
1687+ // background
1688+ color: backgroundColor
1689+
1690+ Item {
1691+ id: content
1692+ anchors.fill: parent
1693+ }
1694+
1695+ // highlight
1696+ Rectangle {
1697+ id: highlightItem
1698+ y: (content.height - control.highlightThickness) / 2
1699+ anchors {
1700+ left: content.left
1701+ right: content.right
1702+ }
1703+ height: control.highlightThickness
1704+ color: highlightBackgroundColor
1705+ }
1706+ ThinDivider {
1707+ anchors {
1708+ left: content.left
1709+ right: content.right
1710+ bottom: highlightItem.top
1711+ }
1712+ }
1713+ ThinDivider {
1714+ anchors {
1715+ left: content.left
1716+ right: content.right
1717+ top: highlightItem.bottom
1718+ }
1719+ }
1720+
1721+ ShaderEffectSource {
1722+ id: effectSource
1723+ visible: false
1724+ sourceItem: view
1725+
1726+ property real sourceRectMultiplier: 2.0
1727+ // XXX: This works because the parent of magnifier is the same as sourceItem
1728+ // in this case. Otherwise coordinate transformations will be needed.
1729+ sourceRect: Qt.rect(highlightItem.x, highlightItem.y, highlightItem.width, highlightItem.height)
1730+ textureSize: Qt.size(highlightItem.width*sourceRectMultiplier, highlightItem.height*sourceRectMultiplier)
1731+ }
1732+
1733+ Row {
1734+ id: magnifierRow
1735+ anchors {
1736+ top: highlightItem.top
1737+ bottom: highlightItem.bottom
1738+ horizontalCenter: highlightItem.horizontalCenter
1739+ }
1740+
1741+ Repeater {
1742+ model: pickerModels
1743+ HighlightMagnifier {
1744+ anchors {
1745+ top: magnifierRow.top
1746+ bottom: magnifierRow.bottom
1747+ }
1748+ width: pickerModel.pickerWidth
1749+ scaleFactor: control.highlightScaleFactor
1750+ outputColor: control.highlightColor
1751+ source: effectSource
1752+ texCoordRange: Qt.rect((x - source.sourceRect.x) / source.sourceRect.width, 0.0,
1753+ width / source.sourceRect.width, 1.0);
1754+
1755+ Label {
1756+ text: (index < (pickerModels.count - 1)) ? unitSeparator : ""
1757+ anchors {
1758+ right: parent.right
1759+ verticalCenter: parent.verticalCenter
1760+ }
1761+ }
1762+ }
1763+ }
1764+ }
1765+ }
1766+}
1767
1768=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerHandStyle.qml'
1769--- modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerHandStyle.qml 1970-01-01 00:00:00 +0000
1770+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerHandStyle.qml 2015-04-25 07:11:10 +0000
1771@@ -0,0 +1,63 @@
1772+/*
1773+ * Copyright 2013 Canonical Ltd.
1774+ *
1775+ * This program is free software; you can redistribute it and/or modify
1776+ * it under the terms of the GNU Lesser General Public License as published by
1777+ * the Free Software Foundation; version 3.
1778+ *
1779+ * This program is distributed in the hope that it will be useful,
1780+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1781+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1782+ * GNU Lesser General Public License for more details.
1783+ *
1784+ * You should have received a copy of the GNU Lesser General Public License
1785+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1786+ */
1787+
1788+import QtQuick 2.4
1789+import Ubuntu.Components 1.2
1790+
1791+Item {
1792+ // style API
1793+ property alias handPointer: pointer
1794+
1795+ function handPreset(index, property) {
1796+ switch (property) {
1797+ case "width" :
1798+ return (index === 0) ? units.gu(0.8) : units.gu(0.5);
1799+ case "height":
1800+ return (index === 0) ? dialer.handSpace /2 :
1801+ (index === 2) ? dialer.handSpace + units.gu(1.5) :
1802+ dialer.handSpace - units.gu(1.5);
1803+ case "z":
1804+ return (index === 2) ? -1 : 0;
1805+ case "visible":
1806+ case "draggable":
1807+ return true;
1808+ case "toCenterItem":
1809+ return false;
1810+ default:
1811+ return undefined;
1812+ }
1813+ }
1814+
1815+ // style
1816+ anchors.fill: parent
1817+ transformOrigin: Item.Center
1818+
1819+ Rectangle {
1820+ id: pointer
1821+ x: (parent.width - width) / 2
1822+ y: styledItem.dialer.handSpace - (styledItem.hand.toCenterItem ? 0 : styledItem.hand.height)
1823+ width: styledItem.hand.width
1824+ height: styledItem.hand.height
1825+ radius: units.gu(1)
1826+ color: styledItem.hand.visible ? Theme.palette.normal.baseText : "#00000000"
1827+ antialiasing: true
1828+ }
1829+
1830+ Behavior on rotation {
1831+ enabled: !styledItem.hand.draggable
1832+ RotationAnimation { direction: RotationAnimation.Shortest }
1833+ }
1834+}
1835
1836=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerStyle.qml'
1837--- modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerStyle.qml 1970-01-01 00:00:00 +0000
1838+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/DialerStyle.qml 2015-04-25 07:11:10 +0000
1839@@ -0,0 +1,126 @@
1840+/*
1841+ * Copyright 2013 Canonical Ltd.
1842+ *
1843+ * This program is free software; you can redistribute it and/or modify
1844+ * it under the terms of the GNU Lesser General Public License as published by
1845+ * the Free Software Foundation; version 3.
1846+ *
1847+ * This program is distributed in the hope that it will be useful,
1848+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1849+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1850+ * GNU Lesser General Public License for more details.
1851+ *
1852+ * You should have received a copy of the GNU Lesser General Public License
1853+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1854+ */
1855+
1856+import QtQuick 2.4
1857+import Ubuntu.Components 1.2
1858+import QtGraphicalEffects 1.0
1859+
1860+// FIXME: Replace this once UbuntuShape support for gradients and shading has landed
1861+Rectangle {
1862+ anchors.fill: parent
1863+ radius: width / 2
1864+ antialiasing: true
1865+
1866+ property real offset : units.gu(0.2)
1867+
1868+ gradient: Gradient {
1869+ GradientStop { position: 0.0; color: "#512F48" }
1870+ GradientStop { position: 0.25; color: "#583048" }
1871+ GradientStop { position: 0.5; color: "#653449" }
1872+ GradientStop { position: 0.75; color: "#6D384A" }
1873+ GradientStop { position: 1.0; color: "#753B4A" }
1874+ }
1875+ // draws the outter shadow/highlight
1876+ Rectangle {
1877+ id: sourceOutter
1878+ anchors { fill: parent; margins: -offset }
1879+ radius: (width / 2)
1880+ antialiasing: true
1881+ gradient: Gradient {
1882+ GradientStop { position: 0.0; color: "black" }
1883+ GradientStop { position: 0.5; color: "transparent" }
1884+ GradientStop { position: 1.0; color: "white" }
1885+ }
1886+ }
1887+
1888+ // mask for outer 3D effect
1889+ Rectangle {
1890+ id: maskOutter
1891+ anchors.fill: sourceOutter
1892+ color: "transparent"
1893+ radius: (width / 2)
1894+ antialiasing: true
1895+ border { width: offset; color: "black" }
1896+ }
1897+
1898+ // outter effect
1899+ OpacityMask {
1900+ anchors.fill: sourceOutter
1901+ opacity: 0.65
1902+ source: ShaderEffectSource {
1903+ sourceItem: sourceOutter
1904+ hideSource: true
1905+ }
1906+ maskSource: ShaderEffectSource {
1907+ sourceItem: maskOutter
1908+ hideSource: true
1909+ }
1910+ }
1911+
1912+ // center item
1913+ // FIXME: Replace this once UbuntuShape support for gradients and shading has landed
1914+ Rectangle {
1915+ parent: styledItem.centerItem.parent
1916+ anchors.fill: parent
1917+ radius: width / 2;
1918+ antialiasing: true;
1919+
1920+ gradient: Gradient {
1921+ GradientStop { position: 0.0; color: "#7A4C68" }
1922+ GradientStop { position: 0.25; color: "#804563" }
1923+ GradientStop { position: 0.5; color: "#864660" }
1924+ GradientStop { position: 0.75; color: "#86465E" }
1925+ GradientStop { position: 1.0; color: "#964E66" }
1926+ }
1927+
1928+ // draws the inner highlight / shadow
1929+ Rectangle {
1930+ id: sourceInner;
1931+ anchors { fill: parent; margins: -offset }
1932+ radius: (width / 2)
1933+ antialiasing: true
1934+ gradient: Gradient {
1935+ GradientStop { position: 0.0; color: "white" }
1936+ GradientStop { position: 0.5; color: "transparent" }
1937+ GradientStop { position: 1.0; color: "black" }
1938+ }
1939+ }
1940+
1941+ // mask for inner 3D effect
1942+ Rectangle {
1943+ id: maskInner
1944+ color: "transparent"
1945+ anchors.fill: sourceInner
1946+ radius: (width / 2)
1947+ antialiasing: true
1948+ border { width: offset; color: "black" }
1949+ }
1950+
1951+ // inner effect
1952+ OpacityMask {
1953+ opacity: 0.65
1954+ anchors.fill: sourceInner
1955+ source: ShaderEffectSource {
1956+ sourceItem: sourceInner
1957+ hideSource: true
1958+ }
1959+ maskSource: ShaderEffectSource {
1960+ sourceItem: maskInner
1961+ hideSource: true
1962+ }
1963+ }
1964+ }
1965+}
1966
1967=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/DialogForegroundStyle.qml'
1968--- modules/Ubuntu/Components/Themes/Ambiance/1.2/DialogForegroundStyle.qml 1970-01-01 00:00:00 +0000
1969+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/DialogForegroundStyle.qml 2015-04-25 07:11:10 +0000
1970@@ -0,0 +1,28 @@
1971+/*
1972+ * Copyright 2013 Canonical Ltd.
1973+ *
1974+ * This program is free software; you can redistribute it and/or modify
1975+ * it under the terms of the GNU Lesser General Public License as published by
1976+ * the Free Software Foundation; version 3.
1977+ *
1978+ * This program is distributed in the hope that it will be useful,
1979+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1980+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1981+ * GNU Lesser General Public License for more details.
1982+ *
1983+ * You should have received a copy of the GNU Lesser General Public License
1984+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1985+ */
1986+
1987+import QtQuick 2.4
1988+import Ubuntu.Components 1.2
1989+
1990+Item {
1991+ id: dialogForegroundStyle
1992+
1993+ UbuntuShape {
1994+ id: background
1995+ anchors.fill: parent
1996+ color: "white"
1997+ }
1998+}
1999
2000=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/HeadDividerStyle.qml'
2001--- modules/Ubuntu/Components/Themes/Ambiance/1.2/HeadDividerStyle.qml 1970-01-01 00:00:00 +0000
2002+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/HeadDividerStyle.qml 2015-04-25 07:11:10 +0000
2003@@ -0,0 +1,53 @@
2004+/*
2005+ * Copyright 2014 Canonical Ltd.
2006+ *
2007+ * This program is free software; you can redistribute it and/or modify
2008+ * it under the terms of the GNU Lesser General Public License as published by
2009+ * the Free Software Foundation; version 3.
2010+ *
2011+ * This program is distributed in the hope that it will be useful,
2012+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2013+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2014+ * GNU Lesser General Public License for more details.
2015+ *
2016+ * You should have received a copy of the GNU Lesser General Public License
2017+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2018+ */
2019+import QtQuick 2.4
2020+
2021+Item {
2022+ id: dividerStyle
2023+
2024+ property color color: styledItem.backgroundColor
2025+
2026+ // Do not make the following two colors part of the style API as they may be deprecated soon.
2027+ property color topColor: Qt.darker(color, 1.1)
2028+ property color bottomColor: Qt.lighter(color, 1.2)
2029+
2030+ Rectangle {
2031+ anchors.fill: parent
2032+ color: dividerStyle.color
2033+
2034+ gradient: Gradient {
2035+ // top shadow
2036+ GradientStop {
2037+ position: 0.02
2038+ color: dividerStyle.topColor
2039+ }
2040+ // middle (background)
2041+ GradientStop {
2042+ position: 0.05
2043+ color: dividerStyle.color
2044+ }
2045+ GradientStop {
2046+ position: 0.95
2047+ color: dividerStyle.color
2048+ }
2049+ // bottom highlight
2050+ GradientStop {
2051+ position: 0.98
2052+ color: dividerStyle.bottomColor
2053+ }
2054+ }
2055+ }
2056+}
2057
2058=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/HeaderStyle.qml'
2059--- modules/Ubuntu/Components/Themes/Ambiance/1.2/HeaderStyle.qml 1970-01-01 00:00:00 +0000
2060+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/HeaderStyle.qml 2015-04-25 07:11:10 +0000
2061@@ -0,0 +1,124 @@
2062+/*
2063+ * Copyright 2012 Canonical Ltd.
2064+ *
2065+ * This program is free software; you can redistribute it and/or modify
2066+ * it under the terms of the GNU Lesser General Public License as published by
2067+ * the Free Software Foundation; version 3.
2068+ *
2069+ * This program is distributed in the hope that it will be useful,
2070+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2071+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2072+ * GNU Lesser General Public License for more details.
2073+ *
2074+ * You should have received a copy of the GNU Lesser General Public License
2075+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2076+ */
2077+import QtQuick 2.4
2078+import Ubuntu.Components 1.2
2079+
2080+Item {
2081+ id: headerStyle
2082+ /*!
2083+ The height of the headercontents, which is the full height of
2084+ the header minus the separators shown at the bottom of it.
2085+ */
2086+ property real contentHeight: units.gu(7.5)
2087+
2088+ /*!
2089+ The source of the image that separates the header from the contents of a \l MainView.
2090+ The separator will be drawn over the contents.
2091+ */
2092+ property url separatorSource: Qt.resolvedUrl("../artwork/PageHeaderBaseDividerLight.sci")
2093+
2094+ /*!
2095+ The source of an additional image attached to the bottom of the separator. The contents
2096+ of the \l MainView will be drawn on top of the separator bottom image.
2097+ */
2098+ property url separatorBottomSource: Qt.resolvedUrl("../artwork/PageHeaderBaseDividerBottom.png")
2099+
2100+ property int fontWeight: Font.Light
2101+ property string fontSize: "x-large"
2102+ property color textColor: Theme.palette.selected.backgroundText
2103+ property real textLeftMargin: units.gu(2)
2104+
2105+ implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
2106+
2107+ /*!
2108+ \internal
2109+ Tabs needs to call sync of the TabBar
2110+ */
2111+ property TabBar __tabBar: tabBarLoader.sourceComponent ? tabBarLoader.item : null
2112+
2113+ BorderImage {
2114+ id: separator
2115+ anchors {
2116+ bottom: parent.bottom
2117+ left: parent.left
2118+ right: parent.right
2119+ }
2120+ source: headerStyle.separatorSource
2121+ }
2122+ Image {
2123+ id: separatorBottom
2124+ anchors {
2125+ top: separator.bottom
2126+ left: parent.left
2127+ right: parent.right
2128+ }
2129+ source: headerStyle.separatorBottomSource
2130+ }
2131+
2132+ Item {
2133+ id: foreground
2134+ anchors {
2135+ left: parent.left
2136+ right: parent.right
2137+ top: parent.top
2138+ }
2139+ height: headerStyle.contentHeight
2140+
2141+ Label {
2142+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
2143+
2144+ anchors {
2145+ left: parent.left
2146+ verticalCenter: parent.verticalCenter
2147+ leftMargin: headerStyle.textLeftMargin
2148+ }
2149+ text: styledItem.title
2150+ font.weight: headerStyle.fontWeight
2151+ visible: !styledItem.tabsModel && !styledItem.contents
2152+ fontSize: headerStyle.fontSize
2153+ color: headerStyle.textColor
2154+ }
2155+
2156+ Binding {
2157+ target: styledItem.contents
2158+ property: "anchors.fill"
2159+ value: foreground
2160+ when: styledItem.contents
2161+ }
2162+ Binding {
2163+ target: styledItem.contents
2164+ property: "parent"
2165+ value: foreground
2166+ when: styledItem.contents
2167+ }
2168+
2169+ Loader {
2170+ id: tabBarLoader
2171+ sourceComponent: styledItem.tabsModel && !styledItem.contents ? tabBarComponent : null
2172+ anchors.fill: parent
2173+ }
2174+
2175+ Component {
2176+ id: tabBarComponent
2177+ TabBar {
2178+ id: tabBar
2179+ anchors.fill: parent
2180+ model: styledItem.tabsModel
2181+ animate: styledItem.animate
2182+ }
2183+ }
2184+ }
2185+}
2186
2187=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/HighlightMagnifier.qml'
2188--- modules/Ubuntu/Components/Themes/Ambiance/1.2/HighlightMagnifier.qml 1970-01-01 00:00:00 +0000
2189+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/HighlightMagnifier.qml 2015-04-25 07:11:10 +0000
2190@@ -0,0 +1,56 @@
2191+/*
2192+ * Copyright 2013 Canonical Ltd.
2193+ *
2194+ * This program is free software; you can redistribute it and/or modify
2195+ * it under the terms of the GNU Lesser General Public License as published by
2196+ * the Free Software Foundation; version 3.
2197+ *
2198+ * This program is distributed in the hope that it will be useful,
2199+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2200+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2201+ * GNU Lesser General Public License for more details.
2202+ *
2203+ * You should have received a copy of the GNU Lesser General Public License
2204+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2205+ */
2206+
2207+import QtQuick 2.4
2208+
2209+ShaderEffect {
2210+ id: magnifier
2211+
2212+ property ShaderEffectSource source
2213+ property real scaleFactor: 1.2
2214+
2215+ // Everything in the sourceItem that is not transparent will be made this color
2216+ // in the output, but the transparency of the input is respected.
2217+ property color outputColor: "red"
2218+
2219+ // Specify the region of the sourceRect that must be enlarged as
2220+ // x, y, width, height in texture coordinates. (0, 0, 1, 1) is full sourceRect.
2221+ property rect texCoordRange: Qt.rect(0.0, 0.0, 1.0, 1.0);
2222+
2223+ vertexShader: "
2224+ uniform highp vec4 texCoordRange;
2225+ attribute highp vec4 qt_Vertex;
2226+ attribute highp vec2 qt_MultiTexCoord0;
2227+ uniform highp mat4 qt_Matrix;
2228+ uniform highp float scaleFactor;
2229+ varying highp vec2 qt_TexCoord0;
2230+ void main() {
2231+ vec2 texCoord = vec2(0.5 - 1.0 / (2.0 * scaleFactor)) + qt_MultiTexCoord0 / vec2(scaleFactor);
2232+ qt_TexCoord0 = texCoordRange.xy + texCoord*texCoordRange.zw;
2233+ gl_Position = qt_Matrix * qt_Vertex;
2234+ }"
2235+
2236+ fragmentShader: "
2237+ uniform lowp float qt_Opacity;
2238+ varying highp vec2 qt_TexCoord0;
2239+ uniform sampler2D source;
2240+ uniform highp vec4 outputColor;
2241+
2242+ void main() {
2243+ lowp vec4 tex = texture2D(source, qt_TexCoord0);
2244+ gl_FragColor = vec4(outputColor.rgb, outputColor.a*tex.a) * qt_Opacity;
2245+ }"
2246+}
2247
2248=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemOptionSelectorStyle.qml'
2249--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemOptionSelectorStyle.qml 1970-01-01 00:00:00 +0000
2250+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemOptionSelectorStyle.qml 2015-04-25 07:11:10 +0000
2251@@ -0,0 +1,27 @@
2252+/*
2253+ * Copyright 2013 Canonical Ltd.
2254+ *
2255+ * This program is free software; you can redistribute it and/or modify
2256+ * it under the terms of the GNU Lesser General Public License as published by
2257+ * the Free Software Foundation; version 3.
2258+ *
2259+ * This program is distributed in the hope that it will be useful,
2260+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2261+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2262+ * GNU Lesser General Public License for more details.
2263+ *
2264+ * You should have received a copy of the GNU Lesser General Public License
2265+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2266+ *
2267+ */
2268+
2269+import QtQuick 2.4
2270+import Ubuntu.Components 1.2
2271+
2272+Item {
2273+ id: ambianceStyle
2274+
2275+ property url chevron: Qt.resolvedUrl("../artwork/chevron_down.png")
2276+ property url tick: Qt.resolvedUrl("../artwork/tick.png")
2277+ property bool colourComponent: true
2278+}
2279
2280=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemStyle.qml'
2281--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemStyle.qml 1970-01-01 00:00:00 +0000
2282+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ListItemStyle.qml 2015-04-25 07:11:10 +0000
2283@@ -0,0 +1,413 @@
2284+/*
2285+ * Copyright 2014-2015 Canonical Ltd.
2286+ *
2287+ * This program is free software; you can redistribute it and/or modify
2288+ * it under the terms of the GNU Lesser General Public License as published by
2289+ * the Free Software Foundation; version 3.
2290+ *
2291+ * This program is distributed in the hope that it will be useful,
2292+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2293+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2294+ * GNU Lesser General Public License for more details.
2295+ *
2296+ * You should have received a copy of the GNU Lesser General Public License
2297+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2298+ */
2299+
2300+import QtQuick 2.4
2301+import Ubuntu.Components.Styles 1.2 as Styles
2302+import Ubuntu.Components 1.2
2303+
2304+Styles.ListItemStyle {
2305+
2306+ id: listItemStyle
2307+ /*
2308+ * Take over the ListItem's index context property as repeater used in panel
2309+ * overrides the property.
2310+ */
2311+ readonly property int listItemIndex: index
2312+
2313+ // anchoring
2314+ anchors {
2315+ top: parent ? parent.top : undefined
2316+ bottom: parent ? parent.bottom : undefined
2317+ bottomMargin: styledItem.divider.visible ? styledItem.divider.height : 0
2318+ left: styledItem.contentItem.left
2319+ leftMargin: -styledItem.contentItem.anchors.leftMargin
2320+ right: styledItem.contentItem.right
2321+ rightMargin: -styledItem.contentItem.anchors.rightMargin
2322+ }
2323+ LayoutMirroring.childrenInherit: true
2324+
2325+ // leading/trailing panels
2326+ Component {
2327+ id: panelComponent
2328+ Rectangle {
2329+ id: panel
2330+ objectName: "ListItemPanel" + (leading ? "Leading" : "Trailing")
2331+ readonly property real panelWidth: actionsRow.width
2332+
2333+ // FIXME use theme palette colors once stabilized
2334+ color: leading ? UbuntuColors.red : "white"
2335+ anchors.fill: parent
2336+ width: parent ? parent.width : 0
2337+
2338+ readonly property ListItemActions itemActions: leading ? styledItem.leadingActions : styledItem.trailingActions
2339+
2340+ Row {
2341+ id: actionsRow
2342+ anchors {
2343+ left: leading ? undefined : parent.left
2344+ right: leading ? parent.right : undefined
2345+ top: parent.top
2346+ bottom: parent.bottom
2347+ leftMargin: spacing
2348+ }
2349+
2350+ readonly property real maxItemWidth: parent.width / itemActions.actions.length
2351+
2352+ Repeater {
2353+ model: itemActions.actions
2354+ AbstractButton {
2355+ id: actionButton
2356+ action: modelData
2357+ enabled: action.enabled
2358+ opacity: action.enabled ? 1.0 : 0.5
2359+ width: MathUtils.clamp(delegateLoader.item ? delegateLoader.item.width : 0, height, actionsRow.maxItemWidth)
2360+ anchors {
2361+ top: parent ? parent.top : undefined
2362+ bottom: parent ? parent.bottom : undefined
2363+ }
2364+ function trigger() {
2365+ internals.selectedAction = modelData;
2366+ listItemStyle.rebound();
2367+ }
2368+
2369+ Rectangle {
2370+ anchors.fill: parent
2371+ color: Theme.palette.selected.background
2372+ visible: pressed
2373+ }
2374+
2375+ Loader {
2376+ id: delegateLoader
2377+ height: parent.height
2378+ sourceComponent: itemActions.delegate ? itemActions.delegate : defaultDelegate
2379+ property Action action: modelData
2380+ property int index: index
2381+ property bool pressed: actionButton.pressed
2382+ onItemChanged: {
2383+ // use action's objectName to identify the visualized action
2384+ if (item && item.objectName === "") {
2385+ item.objectName = modelData.objectName;
2386+ actionButton.objectName = "actionbutton_" + modelData.objectName
2387+ }
2388+ }
2389+ }
2390+ }
2391+ }
2392+ }
2393+
2394+ Component {
2395+ id: defaultDelegate
2396+ Item {
2397+ width: height
2398+ Icon {
2399+ width: units.gu(2.5)
2400+ height: width
2401+ name: action.iconName
2402+ // FIXME use theme palette colors once stabilized
2403+ color: leading ? "white" : UbuntuColors.darkGrey
2404+ anchors.centerIn: parent
2405+ }
2406+ }
2407+ }
2408+ }
2409+ }
2410+ // the selection/multiselection panel
2411+ Component {
2412+ id: selectionDelegate
2413+ Item {
2414+ id: selectPanel
2415+ objectName: "selection_panel" + listItemIndex
2416+ anchors.fill: parent ? parent : undefined
2417+
2418+ CheckBox {
2419+ id: checkbox
2420+ opacity: 0
2421+ // for unit and autopilot tests
2422+ objectName: "listitem_select"
2423+ anchors.centerIn: parent
2424+ // for the initial value
2425+ checked: styledItem.selected
2426+ onCheckedChanged: styledItem.selected = checked;
2427+ }
2428+
2429+ states: State {
2430+ name: "enabled"
2431+ when: loaded && styledItem.selectMode
2432+ PropertyChanges {
2433+ target: checkbox
2434+ opacity: 1.0
2435+ }
2436+ }
2437+ transitions: Transition {
2438+ from: ""
2439+ to: "*"
2440+ reversible: true
2441+ enabled: listItemStyle.animatePanels
2442+ OpacityAnimator {
2443+ easing: UbuntuAnimation.StandardEasing
2444+ duration: UbuntuAnimation.FastDuration
2445+ }
2446+ }
2447+ }
2448+ }
2449+ // drag panel
2450+ Component {
2451+ id: dragDelegate
2452+ Item {
2453+ id: dragPanel
2454+ objectName: "drag_panel" + index
2455+ anchors.fill: parent ? parent : undefined
2456+ Icon {
2457+ objectName: "icon"
2458+ id: dragIcon
2459+ anchors.centerIn: parent
2460+ width: units.gu(3)
2461+ height: width
2462+ name: "view-grid-symbolic"
2463+ opacity: 0.0
2464+ scale: 0.5
2465+ }
2466+ Binding {
2467+ target: listItemStyle
2468+ property: "dragPanel"
2469+ value: dragPanel
2470+ }
2471+
2472+ states: State {
2473+ name: "enabled"
2474+ when: loaded && styledItem.dragMode
2475+ PropertyChanges {
2476+ target: dragIcon
2477+ opacity: 1.0
2478+ scale: 1.0
2479+ }
2480+ }
2481+ transitions: Transition {
2482+ from: ""
2483+ to: "*"
2484+ reversible: true
2485+ enabled: listItemStyle.animatePanels
2486+ ParallelAnimation {
2487+ OpacityAnimator {
2488+ easing: UbuntuAnimation.StandardEasing
2489+ duration: UbuntuAnimation.FastDuration
2490+ }
2491+ ScaleAnimator {
2492+ easing: UbuntuAnimation.StandardEasing
2493+ duration: UbuntuAnimation.FastDuration
2494+ }
2495+ }
2496+ }
2497+ }
2498+ }
2499+
2500+ // leading panel loader
2501+ Loader {
2502+ id: leadingLoader
2503+ objectName: "leading_loader"
2504+ anchors {
2505+ top: parent.top
2506+ bottom: parent.bottom
2507+ right: parent.left
2508+ }
2509+ width: parent.width
2510+ sourceComponent: internals.swiped && styledItem.leadingActions && styledItem.leadingActions.actions.length > 0 ?
2511+ panelComponent : null
2512+ // context properties used in delegates
2513+ readonly property bool leading: true
2514+ readonly property bool loaded: status == Loader.Ready
2515+
2516+ // panel states
2517+ states: [
2518+ State {
2519+ name: "selectable"
2520+ when: styledItem.selectMode
2521+ PropertyChanges {
2522+ target: leadingLoader
2523+ sourceComponent: selectionDelegate
2524+ width: units.gu(5)
2525+ }
2526+ PropertyChanges {
2527+ target: listItemStyle
2528+ anchors.leftMargin: 0
2529+ }
2530+ PropertyChanges {
2531+ target: styledItem.contentItem
2532+ anchors.leftMargin: units.gu(5)
2533+ }
2534+ }
2535+ ]
2536+ transitions: Transition {
2537+ from: ""
2538+ to: "selectable"
2539+ reversible: true
2540+ enabled: listItemStyle.animatePanels
2541+ PropertyAnimation {
2542+ target: styledItem.contentItem
2543+ properties: "anchors.leftMargin"
2544+ easing: UbuntuAnimation.StandardEasing
2545+ duration: UbuntuAnimation.FastDuration
2546+ }
2547+ }
2548+ }
2549+ // trailing panel loader
2550+ Loader {
2551+ id: trailingLoader
2552+ objectName: "trailing_loader"
2553+ anchors {
2554+ top: parent.top
2555+ bottom: parent.bottom
2556+ left: parent.right
2557+ }
2558+ width: parent.width
2559+ sourceComponent: internals.swiped && styledItem.trailingActions && styledItem.trailingActions.actions.length > 0 ?
2560+ panelComponent : null
2561+ // context properties used in delegates
2562+ readonly property bool leading: false
2563+ readonly property bool loaded: status == Loader.Ready
2564+
2565+ // panel states
2566+ states: State {
2567+ name: "draggable"
2568+ when: styledItem.dragMode
2569+ PropertyChanges {
2570+ target: trailingLoader
2571+ sourceComponent: dragDelegate
2572+ width: units.gu(5)
2573+ }
2574+ PropertyChanges {
2575+ target: listItemStyle
2576+ anchors.rightMargin: 0
2577+ }
2578+ PropertyChanges {
2579+ target: styledItem.contentItem
2580+ anchors.rightMargin: units.gu(5)
2581+ }
2582+ }
2583+ transitions: Transition {
2584+ from: ""
2585+ to: "*"
2586+ reversible: true
2587+ enabled: listItemStyle.animatePanels
2588+ PropertyAnimation {
2589+ target: styledItem.contentItem
2590+ properties: "anchors.rightMargin"
2591+ easing: UbuntuAnimation.StandardEasing
2592+ duration: UbuntuAnimation.FastDuration
2593+ }
2594+ }
2595+ }
2596+
2597+ // internals
2598+ QtObject {
2599+ id: internals
2600+ // action triggered
2601+ property Action selectedAction
2602+ // swipe handling
2603+ readonly property bool swiped: listItemStyle.x != styledItem.x && !styledItem.selectMode && !styledItem.dragMode
2604+ readonly property Item swipedPanel: leadingPanel ? leadingLoader.item : trailingLoader.item
2605+ readonly property bool leadingPanel: listItemStyle.LayoutMirroring.enabled ? (listItemStyle.x < 0) : (listItemStyle.x > 0)
2606+ readonly property real swipedOffset: (leadingPanel ? listItemStyle.x : -listItemStyle.x) *
2607+ (listItemStyle.LayoutMirroring.enabled ? -1 : 1)
2608+ readonly property real panelWidth: swipedPanel && swipedPanel.hasOwnProperty("panelWidth") ? swipedPanel.panelWidth : 0
2609+ property real prevX: 0.0
2610+ property real snapChangerLimit: 0.0
2611+ readonly property real threshold: units.gu(1.5)
2612+ property bool snapIn: false
2613+
2614+ // update snap direction
2615+ function updateSnapDirection() {
2616+ if (prevX < listItemStyle.x && (snapChangerLimit <= listItemStyle.x)) {
2617+ snapIn = (listItemStyle.LayoutMirroring.enabled !== leadingPanel);
2618+ snapChangerLimit = listItemStyle.x - threshold;
2619+ } else if (prevX > listItemStyle.x && (listItemStyle.x < snapChangerLimit)) {
2620+ snapIn = (listItemStyle.LayoutMirroring.enabled === leadingPanel);
2621+ snapChangerLimit = listItemStyle.x + threshold;
2622+ }
2623+ prevX = listItemStyle.x;
2624+ }
2625+ // perform snapIn/Out
2626+ function snap() {
2627+ var snapPos = (swipedOffset > units.gu(2) && snapIn) ? panelWidth : 0.0;
2628+ snapPos *= leadingPanel ? 1 : -1;
2629+ // invert snapPos on RTL
2630+ snapPos *= listItemStyle.LayoutMirroring.enabled ? -1 : 1;
2631+ snapAnimation.snapTo(snapPos);
2632+ }
2633+ // handle elasticity on overshoot
2634+ function overshoot(event) {
2635+ var offset = event.content.x - styledItem.contentItem.anchors.leftMargin;
2636+ offset *= leadingPanel ? 1 : -1;
2637+ // invert offset on RTL
2638+ offset *= listItemStyle.LayoutMirroring.enabled ? -1 : 1;
2639+ if (offset > panelWidth) {
2640+ // do elastic move
2641+ event.content.x = styledItem.contentItem.x + (event.to.x - event.from.x) / 2;
2642+ }
2643+ }
2644+ }
2645+ snapAnimation: SmoothedAnimation {
2646+ objectName: "snap_animation"
2647+ target: styledItem.contentItem
2648+ property: "x"
2649+ // use 50GU/second velocity
2650+ velocity: units.gu(60)
2651+ onStopped: {
2652+ // trigger action
2653+ if (to == styledItem.contentItem.anchors.leftMargin && internals.selectedAction) {
2654+ internals.selectedAction.trigger(listItemIndex);
2655+ internals.selectedAction = null;
2656+ }
2657+ }
2658+ // animated snapping
2659+ function snapTo(pos) {
2660+ if (pos == to && styledItem.contentItem.x == to) {
2661+ return;
2662+ }
2663+
2664+ stop();
2665+ from = styledItem.contentItem.x;
2666+ if (!pos) {
2667+ pos = styledItem.contentItem.anchors.leftMargin;
2668+ }
2669+ to = pos;
2670+ start();
2671+ }
2672+ }
2673+
2674+ // simple drop animation
2675+ dropAnimation: SmoothedAnimation {
2676+ properties: "y"
2677+ velocity: units.gu(60)
2678+ }
2679+
2680+ onXChanged: internals.updateSnapDirection()
2681+ // overriding default functions
2682+ function swipeEvent(event) {
2683+ if (event.status == SwipeEvent.Started) {
2684+ internals.prevX = x;
2685+ snapAnimation.stop();
2686+ } else if (event.status == SwipeEvent.Finished) {
2687+ internals.snap();
2688+ } else if (event.status == SwipeEvent.Updated) {
2689+ // handle elasticity when overshooting
2690+ internals.overshoot(event)
2691+ }
2692+ }
2693+ function rebound() {
2694+ snapAnimation.snapTo(0);
2695+ }
2696+}
2697
2698=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/MainViewStyle.qml'
2699--- modules/Ubuntu/Components/Themes/Ambiance/1.2/MainViewStyle.qml 1970-01-01 00:00:00 +0000
2700+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/MainViewStyle.qml 2015-04-25 07:11:10 +0000
2701@@ -0,0 +1,59 @@
2702+/*
2703+ * Copyright 2012 Canonical Ltd.
2704+ *
2705+ * This program is free software; you can redistribute it and/or modify
2706+ * it under the terms of the GNU Lesser General Public License as published by
2707+ * the Free Software Foundation; version 3.
2708+ *
2709+ * This program is distributed in the hope that it will be useful,
2710+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2711+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2712+ * GNU Lesser General Public License for more details.
2713+ *
2714+ * You should have received a copy of the GNU Lesser General Public License
2715+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2716+ */
2717+import QtQuick 2.4
2718+import Ubuntu.Components 1.2
2719+
2720+Item {
2721+ // styling properties
2722+ anchors.fill: parent
2723+ z: -1
2724+ id: mainViewStyle
2725+
2726+ /*!
2727+ The background texture of the main view. The image will be drawn over the background color,
2728+ so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
2729+ */
2730+ property url backgroundSource: Qt.resolvedUrl("../artwork/background_paper.png")
2731+
2732+ Gradient {
2733+ id: backgroundGradient
2734+ GradientStop { position: 0.0; color: styledItem.headerColor }
2735+ GradientStop { position: 0.83; color: styledItem.backgroundColor }
2736+ GradientStop { position: 1.0; color: styledItem.footerColor }
2737+ }
2738+
2739+ Rectangle {
2740+ id: backgroundColor
2741+ anchors.fill: parent
2742+ color: styledItem.backgroundColor
2743+ gradient: internals.isGradient ? backgroundGradient : null
2744+ }
2745+
2746+ Image {
2747+ id: backgroundTexture
2748+ anchors.fill: parent
2749+ source: mainViewStyle.backgroundSource
2750+ fillMode: Image.Tile
2751+ asynchronous: true
2752+ cache: false
2753+ }
2754+
2755+ QtObject {
2756+ id: internals
2757+ property bool isGradient: styledItem.backgroundColor != styledItem.headerColor ||
2758+ styledItem.backgroundColor != styledItem.footerColor
2759+ }
2760+}
2761
2762=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml'
2763--- modules/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml 1970-01-01 00:00:00 +0000
2764+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml 2015-04-25 07:11:10 +0000
2765@@ -0,0 +1,37 @@
2766+/*
2767+ * Copyright 2013 Canonical Ltd.
2768+ *
2769+ * This program is free software; you can redistribute it and/or modify
2770+ * it under the terms of the GNU Lesser General Public License as published by
2771+ * the Free Software Foundation; version 3.
2772+ *
2773+ * This program is distributed in the hope that it will be useful,
2774+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2775+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2776+ * GNU Lesser General Public License for more details.
2777+ *
2778+ * You should have received a copy of the GNU Lesser General Public License
2779+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2780+ *
2781+ */
2782+
2783+import QtQuick 2.4
2784+import Ubuntu.Components 1.2
2785+
2786+Item {
2787+ id: ambianceStyle
2788+
2789+ property url chevron: Qt.resolvedUrl("../artwork/chevron_down.png")
2790+ property url tick: Qt.resolvedUrl("../artwork/tick.png")
2791+ property bool colourComponent: true
2792+
2793+ UbuntuShape {
2794+ id: background
2795+
2796+ width: styledItem.width
2797+ height: styledItem.height
2798+ radius: "medium"
2799+
2800+ color: Qt.rgba(0, 0, 0, 0.05)
2801+ }
2802+}
2803
2804=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/OverflowPanel.qml'
2805--- modules/Ubuntu/Components/Themes/Ambiance/1.2/OverflowPanel.qml 1970-01-01 00:00:00 +0000
2806+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/OverflowPanel.qml 2015-04-25 07:11:10 +0000
2807@@ -0,0 +1,22 @@
2808+/*
2809+ * Copyright 2014 Canonical Ltd.
2810+ *
2811+ * This program is free software; you can redistribute it and/or modify
2812+ * it under the terms of the GNU Lesser General Public License as published by
2813+ * the Free Software Foundation; version 3.
2814+ *
2815+ * This program is distributed in the hope that it will be useful,
2816+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2817+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2818+ * GNU Lesser General Public License for more details.
2819+ *
2820+ * You should have received a copy of the GNU Lesser General Public License
2821+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2822+ */
2823+
2824+import QtQuick 2.4
2825+import Ubuntu.Components.Popups 1.0
2826+
2827+Popover {
2828+ property bool square: true
2829+}
2830
2831=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml'
2832--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml 1970-01-01 00:00:00 +0000
2833+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadButton.qml 2015-04-25 07:11:10 +0000
2834@@ -0,0 +1,70 @@
2835+/*
2836+ * Copyright 2014 Canonical Ltd.
2837+ *
2838+ * This program is free software; you can redistribute it and/or modify
2839+ * it under the terms of the GNU Lesser General Public License as published by
2840+ * the Free Software Foundation; version 3.
2841+ *
2842+ * This program is distributed in the hope that it will be useful,
2843+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2844+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2845+ * GNU Lesser General Public License for more details.
2846+ *
2847+ * You should have received a copy of the GNU Lesser General Public License
2848+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2849+ */
2850+
2851+import QtQuick 2.4
2852+import Ubuntu.Components 1.2
2853+
2854+AbstractButton {
2855+ id: button
2856+
2857+ property real iconWidth: units.gu(2.5)
2858+ property real iconHeight: iconWidth
2859+
2860+ width: visible ? units.gu(5) : 0
2861+ height: parent ? parent.height : undefined
2862+
2863+ property alias color: icon.color
2864+
2865+ Rectangle {
2866+ visible: button.pressed
2867+ anchors.fill: parent
2868+ color: Theme.palette.selected.background
2869+ }
2870+
2871+ Icon {
2872+ id: icon
2873+ anchors {
2874+ centerIn: parent
2875+ }
2876+ // prevent trying to render the icon with an invalid source
2877+ // when the button is invisible by setting width and height to 0
2878+ width: visible ? button.iconWidth : 0
2879+ height: visible ? button.iconHeight : 0
2880+ source: button.iconSource
2881+ color: Qt.rgba(0, 0, 0, 0)
2882+ opacity: button.enabled ? 1.0 : 0.3
2883+ }
2884+
2885+ Component {
2886+ id: labelComponent
2887+ Label {
2888+ id: label
2889+ objectName: button.objectName + "_label"
2890+ color: button.color
2891+ opacity: button.enabled ? 1.0 : 0.3
2892+ text: button.text
2893+ fontSize: "xx-small"
2894+ }
2895+ }
2896+ Loader {
2897+ anchors {
2898+ top: icon.bottom
2899+ topMargin: units.gu(0.5)
2900+ horizontalCenter: parent.horizontalCenter
2901+ }
2902+ sourceComponent: button.state === "IconAndLabel" ? labelComponent : null
2903+ }
2904+}
2905
2906=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadStyle.qml'
2907--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadStyle.qml 1970-01-01 00:00:00 +0000
2908+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PageHeadStyle.qml 2015-04-25 07:11:10 +0000
2909@@ -0,0 +1,628 @@
2910+/*
2911+ * Copyright 2014 Canonical Ltd.
2912+ *
2913+ * This program is free software; you can redistribute it and/or modify
2914+ * it under the terms of the GNU Lesser General Public License as published by
2915+ * the Free Software Foundation; version 3.
2916+ *
2917+ * This program is distributed in the hope that it will be useful,
2918+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2919+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2920+ * GNU Lesser General Public License for more details.
2921+ *
2922+ * You should have received a copy of the GNU Lesser General Public License
2923+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2924+ */
2925+import QtQuick 2.4
2926+import Ubuntu.Components 1.2
2927+import Ubuntu.Components.Popups 1.0
2928+import Ubuntu.Components.ListItems 1.0 as ListItem
2929+import Ubuntu.Components.Styles 1.2 as Style
2930+
2931+Style.PageHeadStyle {
2932+ id: headerStyle
2933+ objectName: "PageHeadStyle" // used in unit tests
2934+ contentHeight: units.gu(7)
2935+ fontWeight: Font.Light
2936+ fontSize: "x-large"
2937+ textLeftMargin: units.gu(2)
2938+ maximumNumberOfActions: 3
2939+
2940+ /*!
2941+ The color of the buttons in the header.
2942+ */
2943+ property color buttonColor: styledItem.config.foregroundColor
2944+
2945+ /*!
2946+ The color of the title text.
2947+ */
2948+ property color titleColor: styledItem.config.foregroundColor
2949+
2950+ /*!
2951+ The background color of the tabs panel and the actions overflow panel.
2952+ */
2953+ property color panelBackgroundColor: styledItem.panelColor
2954+
2955+ /*!
2956+ The background color of the tapped item in the panel.
2957+ */
2958+ property color panelHighlightColor: Theme.palette.selected.background
2959+
2960+ /*!
2961+ The foreground color (icon and text) of actions in the panel.
2962+ */
2963+ property color panelForegroundColor: Theme.palette.selected.backgroundText
2964+
2965+ /*!
2966+ The text color of unselected sections and the section divider.
2967+ */
2968+ property color sectionColor: Theme.palette.selected.backgroundText
2969+
2970+ /*!
2971+ The text color of the selected section.
2972+ */
2973+ property color selectedSectionColor: UbuntuColors.orange
2974+
2975+ /*!
2976+ The background color of the pressed section.
2977+ */
2978+ property color sectionHighlightColor: Theme.palette.selected.background
2979+
2980+ implicitHeight: headerStyle.contentHeight + divider.height
2981+
2982+ // FIXME: Workaround to get sectionsRepeater.count in autopilot tests,
2983+ // see also FIXME in AppHeader where this property is used.
2984+ property alias __sections_repeater_for_autopilot: sectionsRepeater
2985+
2986+ // Used by unit tests and autopilot tests to wait for animations to finish
2987+ readonly property bool animating: headerStyle.state == "OUT"
2988+ || leftAnchor.anchors.leftMargin < 0
2989+
2990+ // for Unity8
2991+ // FIXME: Remove this property when we introduce a header preset that does not
2992+ // have a separator.
2993+ property alias __separator_visible: divider.visible
2994+
2995+ StyledItem {
2996+ id: divider
2997+ anchors {
2998+ bottom: parent.bottom
2999+ left: parent.left
3000+ right: parent.right
3001+ }
3002+
3003+ height: sectionsRow.visible ? units.gu(3) : units.gu(2)
3004+
3005+ // separatorSource and separatorBottomSource are needed for the deprecated
3006+ // HeadSeparatorImageStyle.
3007+ property url separatorSource: headerStyle.separatorSource
3008+ property url separatorBottomSource: headerStyle.separatorBottomSource
3009+
3010+ // backgroundColor is used in the new HeadDividerStyle
3011+ property color backgroundColor: styledItem.dividerColor
3012+
3013+ style: Theme.createStyleComponent("HeadDividerStyle.qml", divider)
3014+
3015+ property PageHeadSections sections: styledItem.config.sections
3016+
3017+ Row {
3018+ id: sectionsRow
3019+ anchors.centerIn: parent
3020+ width: childrenRect.width
3021+ height: parent.height
3022+ enabled: divider.sections.enabled
3023+ visible: divider.sections.model !== undefined
3024+ opacity: enabled ? 1.0 : 0.5
3025+
3026+ Repeater {
3027+ id: sectionsRepeater
3028+ model: divider.sections.model
3029+ objectName: "page_head_sections_repeater"
3030+ AbstractButton {
3031+ id: sectionButton
3032+ anchors.verticalCenter: parent ? parent.verticalCenter : undefined
3033+ objectName: "section_button_" + index
3034+ enabled: sectionsRow.enabled
3035+ width: label.width + units.gu(4)
3036+ height: sectionsRow.height + units.gu(2)
3037+ property bool selected: index === divider.sections.selectedIndex
3038+ onClicked: divider.sections.selectedIndex = index;
3039+
3040+ Rectangle {
3041+ visible: parent.pressed
3042+ anchors {
3043+ verticalCenter: parent.verticalCenter
3044+ left: parent.left
3045+ right: parent.right
3046+ rightMargin: verticalDividerLine.width
3047+ }
3048+ height: sectionsRow.height
3049+ color: headerStyle.sectionHighlightColor
3050+ }
3051+
3052+ Label {
3053+ id: label
3054+ text: modelData
3055+ fontSize: "small"
3056+ anchors.centerIn: sectionButton
3057+ horizontalAlignment: Text.AlignHCenter
3058+ color: sectionButton.selected ?
3059+ headerStyle.selectedSectionColor :
3060+ headerStyle.sectionColor
3061+ }
3062+
3063+ // vertical divider line
3064+ Rectangle {
3065+ id: verticalDividerLine
3066+ anchors {
3067+ verticalCenter: parent.verticalCenter
3068+ right: parent.right
3069+ }
3070+ height: units.dp(10)
3071+ width: units.dp(1)
3072+ visible: index < sectionsRepeater.model.length - 1
3073+ color: headerStyle.sectionColor
3074+ opacity: 0.2
3075+ }
3076+ }
3077+ }
3078+ }
3079+ }
3080+
3081+ states: [
3082+ State {
3083+ name: "IN"
3084+ PropertyChanges {
3085+ target: allContents
3086+ opacity: 1.0
3087+ }
3088+ },
3089+ State {
3090+ name: "OUT"
3091+ PropertyChanges {
3092+ target: allContents
3093+ opacity: 0.0
3094+ }
3095+ }
3096+ ]
3097+
3098+ function animateOut() {
3099+ state = "OUT";
3100+ }
3101+ function animateIn() {
3102+ state = "IN";
3103+ }
3104+
3105+ signal animateOutFinished()
3106+ signal animateInFinished()
3107+
3108+ transitions: [
3109+ Transition {
3110+ id: transitionOut
3111+ from: "IN"
3112+ to: "OUT"
3113+ SequentialAnimation {
3114+ ParallelAnimation {
3115+ UbuntuNumberAnimation {
3116+ target: allContents
3117+ property: "opacity"
3118+ from: 1.0
3119+ to: 0.0
3120+ }
3121+ UbuntuNumberAnimation {
3122+ target: leftAnchor
3123+ properties: "anchors.leftMargin"
3124+ from: 0.0
3125+ to: -units.gu(5)
3126+ }
3127+ UbuntuNumberAnimation {
3128+ target: rightAnchor
3129+ properties: "anchors.rightMargin"
3130+ from: 0
3131+ to: -units.gu(5)
3132+ }
3133+ }
3134+ ScriptAction {
3135+ script: headerStyle.animateOutFinished()
3136+ }
3137+ }
3138+ },
3139+ Transition {
3140+ id: transitionIn
3141+ from: "OUT"
3142+ to: "IN"
3143+ SequentialAnimation {
3144+ ParallelAnimation {
3145+ UbuntuNumberAnimation {
3146+ target: allContents
3147+ property: "opacity"
3148+ from: 0.0
3149+ to: 1.0
3150+ }
3151+ UbuntuNumberAnimation {
3152+ target: leftAnchor
3153+ properties: "anchors.leftMargin"
3154+ from: -units.gu(5)
3155+ to: 0
3156+ }
3157+ UbuntuNumberAnimation {
3158+ target: rightAnchor
3159+ properties: "anchors.rightMargin"
3160+ from: -units.gu(5)
3161+ to: 0
3162+ }
3163+ }
3164+ ScriptAction {
3165+ script: headerStyle.animateInFinished()
3166+ }
3167+ }
3168+ }
3169+ ]
3170+
3171+ Item {
3172+ id: allContents
3173+ anchors.fill: parent
3174+
3175+ Item {
3176+ id: leftAnchor
3177+ anchors {
3178+ top: parent.top
3179+ bottom: parent.bottom
3180+ left: parent.left
3181+ leftMargin: 0
3182+ }
3183+ width: 0
3184+ }
3185+ Item {
3186+ id: rightAnchor
3187+ anchors {
3188+ top: parent.top
3189+ bottom: parent.bottom
3190+ right: parent.right
3191+ rightMargin: 0
3192+ }
3193+ width: 0
3194+ }
3195+
3196+ Item {
3197+ id: leftButtonContainer
3198+ anchors {
3199+ left: leftAnchor.right
3200+ top: parent.top
3201+ leftMargin: width > 0 ? units.gu(1) : 0
3202+ }
3203+ width: childrenRect.width
3204+ height: headerStyle.contentHeight
3205+
3206+ PageHeadButton {
3207+ id: customBackButton
3208+ objectName: "customBackButton"
3209+ action: styledItem.config.backAction
3210+ visible: null !== styledItem.config.backAction &&
3211+ styledItem.config.backAction.visible
3212+ color: styledItem.config.foregroundColor
3213+ }
3214+
3215+ PageHeadButton {
3216+ id: backButton
3217+ objectName: "backButton"
3218+
3219+ iconName: "back"
3220+ visible: styledItem.pageStack !== null &&
3221+ styledItem.pageStack !== undefined &&
3222+ styledItem.pageStack.depth > 1 &&
3223+ !styledItem.config.backAction
3224+
3225+ text: "back"
3226+ color: styledItem.config.foregroundColor
3227+
3228+ onTriggered: {
3229+ styledItem.pageStack.pop();
3230+ }
3231+ }
3232+
3233+ PageHeadButton {
3234+ id: tabsButton
3235+ objectName: "tabsButton"
3236+
3237+ iconName: "navigation-menu"
3238+ visible: styledItem.tabsModel !== null &&
3239+ styledItem.tabsModel !== undefined &&
3240+ !backButton.visible &&
3241+ !customBackButton.visible
3242+ text: visible ? styledItem.tabsModel.count + " tabs" : ""
3243+ color: headerStyle.buttonColor
3244+
3245+ onTriggered: PopupUtils.open(tabsPopoverComponent, tabsButton)
3246+
3247+ Component {
3248+ id: tabsPopoverComponent
3249+
3250+ OverflowPanel {
3251+ id: tabsPopover
3252+ objectName: "tabsPopover"
3253+ callerMargin: -units.gu(1) + units.dp(4)
3254+ contentWidth: units.gu(20)
3255+
3256+ Binding {
3257+ target: tabsPopover.__foreground.__styleInstance
3258+ property: "color"
3259+ value: headerStyle.panelBackgroundColor
3260+ when: tabsPopover.__foreground &&
3261+ tabsPopover.__foreground.__styleInstance
3262+ }
3263+
3264+ Column {
3265+ anchors {
3266+ left: parent.left
3267+ top: parent.top
3268+ right: parent.right
3269+ }
3270+ Repeater {
3271+ model: styledItem.tabsModel
3272+ AbstractButton {
3273+ objectName: "tabButton" + index
3274+ onClicked: {
3275+ styledItem.tabsModel.selectedIndex = index;
3276+ tabsPopover.hide();
3277+ }
3278+ implicitHeight: units.gu(6) + bottomDividerLine.height
3279+ width: parent ? parent.width : units.gu(31)
3280+
3281+ Rectangle {
3282+ visible: parent.pressed
3283+ anchors {
3284+ left: parent.left
3285+ right: parent.right
3286+ top: parent.top
3287+ }
3288+ height: parent.height - bottomDividerLine.height
3289+ color: headerStyle.panelHighlightColor
3290+ }
3291+
3292+ Label {
3293+ anchors {
3294+ verticalCenter: parent.verticalCenter
3295+ verticalCenterOffset: units.dp(-1)
3296+ left: parent.left
3297+ leftMargin: units.gu(2)
3298+ right: parent.right
3299+ }
3300+ fontSize: "medium"
3301+ elide: Text.ElideRight
3302+ text: tab.title // FIXME: only "title" doesn't work with i18n.tr(). Why not?
3303+ color: headerStyle.panelForegroundColor
3304+ }
3305+
3306+ ListItem.ThinDivider {
3307+ id: bottomDividerLine
3308+ anchors.bottom: parent.bottom
3309+ visible: index < styledItem.tabsModel.count - 1
3310+ }
3311+ }
3312+ }
3313+ }
3314+ }
3315+ }
3316+ }
3317+ }
3318+
3319+ Item {
3320+ id: foreground
3321+ anchors {
3322+ left: leftButtonContainer.right
3323+ top: parent.top
3324+ // don't keep a margin if there is already a button with spacing
3325+ leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin
3326+ }
3327+ width: parent.width - anchors.leftMargin
3328+ - leftButtonContainer.anchors.leftMargin - leftButtonContainer.width
3329+ - actionsContainer.anchors.rightMargin - actionsContainer.width
3330+ height: headerStyle.contentHeight
3331+
3332+ Label {
3333+ objectName: "header_title_label"
3334+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
3335+ visible: !contentsContainer.visible && styledItem.config.preset === ""
3336+ anchors {
3337+ left: parent.left
3338+ right: parent.right
3339+ verticalCenter: parent.verticalCenter
3340+ }
3341+ text: styledItem.title
3342+ font.weight: headerStyle.fontWeight
3343+ fontSize: headerStyle.fontSize
3344+ color: headerStyle.titleColor
3345+ elide: Text.ElideRight
3346+ }
3347+
3348+ Item {
3349+ // This Item is used to make the custom header item invisible
3350+ // when styledItem.contents is unset and its parent is not updated
3351+ // when the bindings below is no longer active
3352+ id: contentsContainer
3353+ anchors.fill: parent
3354+ visible: styledItem.contents || styledItem.config.contents
3355+ }
3356+ Binding {
3357+ target: styledItem.contents
3358+ property: "anchors.fill"
3359+ value: contentsContainer
3360+ when: styledItem.contents
3361+ }
3362+ Binding {
3363+ target: styledItem.contents
3364+ property: "parent"
3365+ value: contentsContainer
3366+ when: styledItem.contents
3367+ }
3368+ Binding {
3369+ target: styledItem.config.contents
3370+ property: "parent"
3371+ value: contentsContainer
3372+ when: styledItem.config.contents && !styledItem.contents
3373+ }
3374+ }
3375+
3376+ Row {
3377+ id: actionsContainer
3378+
3379+ property var visibleActions: getVisibleActions(styledItem.config.actions)
3380+ function getVisibleActions(actions) {
3381+ var visibleActionList = [];
3382+ for (var i in actions) {
3383+ var action = actions[i];
3384+ if (action && action.hasOwnProperty("visible") && action.visible) {
3385+ visibleActionList.push(action);
3386+ }
3387+ }
3388+ return visibleActionList;
3389+ }
3390+
3391+ QtObject {
3392+ id: numberOfSlots
3393+ property int requested: actionsContainer.visibleActions.length
3394+ property int left: tabsButton.visible || backButton.visible ||
3395+ customBackButton.visible ? 1 : 0
3396+ property int right: headerStyle.maximumNumberOfActions - left
3397+ property int overflow: actionsOverflowButton.visible ? 1 : 0
3398+ property int used: Math.min(right - overflow, requested)
3399+ }
3400+
3401+ anchors {
3402+ top: parent.top
3403+ right: rightAnchor.left
3404+ rightMargin: actionsContainer.width > 0 ? units.gu(1) : 0
3405+ }
3406+ width: childrenRect.width
3407+ height: headerStyle.contentHeight
3408+
3409+ Repeater {
3410+ model: numberOfSlots.used
3411+ PageHeadButton {
3412+ id: actionButton
3413+ objectName: action.objectName + "_header_button"
3414+ action: actionsContainer.visibleActions[index]
3415+ color: headerStyle.buttonColor
3416+ state: styledItem.config.preset === "select" ?
3417+ "IconAndLabel" : ""
3418+ }
3419+ }
3420+
3421+ PageHeadButton {
3422+ id: actionsOverflowButton
3423+ objectName: "actions_overflow_button"
3424+ visible: numberOfSlots.requested > numberOfSlots.right
3425+ // Ensure resetting of X when this button is not visible to avoid
3426+ // miscalculation of actionsContainer.width. Fixes bug #1408481.
3427+ onVisibleChanged: if (!visible) x = 0
3428+ iconName: "contextual-menu"
3429+ color: headerStyle.buttonColor
3430+ height: actionsContainer.height
3431+ onTriggered: PopupUtils.open(actionsOverflowPopoverComponent, actionsOverflowButton)
3432+
3433+ Component {
3434+ id: actionsOverflowPopoverComponent
3435+
3436+ OverflowPanel {
3437+ id: actionsOverflowPopover
3438+ objectName: "actions_overflow_popover"
3439+ callerMargin: -units.gu(1) + units.dp(4)
3440+ contentWidth: units.gu(20)
3441+
3442+ Binding {
3443+ target: actionsOverflowPopover.__foreground.__styleInstance
3444+ property: "color"
3445+ value: headerStyle.panelBackgroundColor
3446+ when: actionsOverflowPopover.__foreground &&
3447+ actionsOverflowPopover.__foreground.__styleInstance
3448+ }
3449+
3450+ // Ensure the popover closes when actions change and
3451+ // the list item below may be destroyed before its
3452+ // onClicked is executed. See bug
3453+ // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1326963
3454+ Connections {
3455+ target: styledItem.config
3456+ onActionsChanged: {
3457+ actionsOverflowPopover.hide();
3458+ }
3459+ }
3460+ Connections {
3461+ target: styledItem
3462+ onConfigChanged: {
3463+ actionsOverflowPopover.hide();
3464+ }
3465+ }
3466+
3467+ Column {
3468+ anchors {
3469+ left: parent.left
3470+ top: parent.top
3471+ right: parent.right
3472+ }
3473+ Repeater {
3474+ id: overflowRepeater
3475+ model: numberOfSlots.requested - numberOfSlots.used
3476+ AbstractButton {
3477+ action: actionsContainer.visibleActions[numberOfSlots.used + index]
3478+ objectName: action.objectName + "_header_overflow_button"
3479+ onClicked: actionsOverflowPopover.hide()
3480+ implicitHeight: units.gu(6) + bottomDividerLine.height
3481+ width: parent ? parent.width : units.gu(31)
3482+
3483+ Rectangle {
3484+ visible: parent.pressed
3485+ anchors {
3486+ left: parent.left
3487+ right: parent.right
3488+ top: parent.top
3489+ }
3490+ height: parent.height - bottomDividerLine.height
3491+ color: headerStyle.panelHighlightColor
3492+ }
3493+
3494+ Icon {
3495+ id: actionIcon
3496+ source: action.iconSource
3497+ color: headerStyle.panelForegroundColor
3498+ anchors {
3499+ verticalCenter: parent.verticalCenter
3500+ verticalCenterOffset: units.dp(-1)
3501+ left: parent.left
3502+ leftMargin: units.gu(2)
3503+ }
3504+ width: units.gu(2)
3505+ height: units.gu(2)
3506+ opacity: action.enabled ? 1.0 : 0.5
3507+ }
3508+
3509+ Label {
3510+ anchors {
3511+ verticalCenter: parent.verticalCenter
3512+ verticalCenterOffset: units.dp(-1)
3513+ left: actionIcon.right
3514+ leftMargin: units.gu(2)
3515+ right: parent.right
3516+ }
3517+ fontSize: "small"
3518+ elide: Text.ElideRight
3519+ text: action.text
3520+ color: headerStyle.panelForegroundColor
3521+ opacity: action.enabled ? 1.0 : 0.5
3522+ }
3523+
3524+ ListItem.ThinDivider {
3525+ id: bottomDividerLine
3526+ anchors.bottom: parent.bottom
3527+ visible: index !== overflowRepeater.count - 1
3528+ }
3529+ }
3530+ }
3531+ }
3532+ }
3533+ }
3534+ }
3535+ }
3536+ }
3537+}
3538
3539=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/Palette.qml'
3540--- modules/Ubuntu/Components/Themes/Ambiance/1.2/Palette.qml 1970-01-01 00:00:00 +0000
3541+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/Palette.qml 2015-04-25 07:11:10 +0000
3542@@ -0,0 +1,43 @@
3543+/*
3544+ * Copyright 2013 Canonical Ltd.
3545+ *
3546+ * This program is free software; you can redistribute it and/or modify
3547+ * it under the terms of the GNU Lesser General Public License as published by
3548+ * the Free Software Foundation; version 3.
3549+ *
3550+ * This program is distributed in the hope that it will be useful,
3551+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3552+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3553+ * GNU Lesser General Public License for more details.
3554+ *
3555+ * You should have received a copy of the GNU Lesser General Public License
3556+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3557+ */
3558+
3559+import QtQuick 2.4
3560+import Ubuntu.Components 1.2
3561+import Ubuntu.Components.Themes 0.1
3562+
3563+Palette {
3564+ normal: PaletteValues {
3565+ background: "#EDEDED"
3566+ backgroundText: "#81888888"
3567+ base: Qt.rgba(0, 0, 0, 0.1)
3568+ baseText: UbuntuColors.lightGrey
3569+ foreground: UbuntuColors.lightGrey
3570+ foregroundText: "#FFFFFF"
3571+ overlay: "#FDFDFD"
3572+ overlayText: UbuntuColors.lightGrey
3573+ field: "#FAFAFA"
3574+ fieldText: UbuntuColors.darkGrey
3575+ }
3576+ selected: PaletteValues {
3577+ background: Qt.rgba(0, 0, 0, 0.05)
3578+ backgroundText: UbuntuColors.darkGrey
3579+ selection: foreground // unused
3580+ foreground: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
3581+ foregroundText: UbuntuColors.darkGrey
3582+ field: "#FFFFFF"
3583+ fieldText: UbuntuColors.darkGrey
3584+ }
3585+}
3586
3587=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PartialColorize.qml'
3588--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PartialColorize.qml 1970-01-01 00:00:00 +0000
3589+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PartialColorize.qml 2015-04-25 07:11:10 +0000
3590@@ -0,0 +1,51 @@
3591+/*
3592+ * Copyright 2013 Canonical Ltd.
3593+ *
3594+ * This program is free software; you can redistribute it and/or modify
3595+ * it under the terms of the GNU Lesser General Public License as published by
3596+ * the Free Software Foundation; version 3.
3597+ *
3598+ * This program is distributed in the hope that it will be useful,
3599+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3600+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3601+ * GNU Lesser General Public License for more details.
3602+ *
3603+ * You should have received a copy of the GNU Lesser General Public License
3604+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3605+ */
3606+
3607+import QtQuick 2.4
3608+
3609+ShaderEffect {
3610+ id: partialColorize
3611+
3612+ implicitWidth: source.implicitWidth
3613+ implicitHeight: source.implicitHeight
3614+ visible: source != null && source.visible
3615+
3616+ property Item sourceItem
3617+ property var source: ShaderEffectSource {
3618+ hideSource: true
3619+ sourceItem: partialColorize.sourceItem
3620+ visible: sourceItem != null
3621+ }
3622+ property color leftColor
3623+ property color rightColor
3624+ property real progress
3625+ property bool mirror: false
3626+ property string texCoord: mirror ? "1.0 - qt_TexCoord0.x" : "qt_TexCoord0.x"
3627+
3628+ fragmentShader: "
3629+ varying highp vec2 qt_TexCoord0;
3630+ uniform sampler2D source;
3631+ uniform lowp vec4 leftColor;
3632+ uniform lowp vec4 rightColor;
3633+ uniform lowp float progress;
3634+ uniform lowp float qt_Opacity;
3635+
3636+ void main() {
3637+ lowp vec4 sourceColor = texture2D(source, qt_TexCoord0);
3638+ lowp vec4 newColor = mix(leftColor, rightColor, step(progress, " + texCoord + "));
3639+ gl_FragColor = newColor * sourceColor.a * qt_Opacity;
3640+ }"
3641+}
3642
3643=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerDelegateStyle.qml'
3644--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerDelegateStyle.qml 1970-01-01 00:00:00 +0000
3645+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerDelegateStyle.qml 2015-04-25 07:11:10 +0000
3646@@ -0,0 +1,57 @@
3647+/*
3648+ * Copyright 2012 Canonical Ltd.
3649+ *
3650+ * This program is free software; you can redistribute it and/or modify
3651+ * it under the terms of the GNU Lesser General Public License as published by
3652+ * the Free Software Foundation; version 3.
3653+ *
3654+ * This program is distributed in the hope that it will be useful,
3655+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3656+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3657+ * GNU Lesser General Public License for more details.
3658+ *
3659+ * You should have received a copy of the GNU Lesser General Public License
3660+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3661+ */
3662+
3663+import QtQuick 2.4
3664+import Ubuntu.Components 1.2
3665+
3666+Item {
3667+ property real minFade: 0.2
3668+ property real maxFade: 0.95
3669+ property bool fadingEnabled: true
3670+
3671+ property bool inListView: styledItem.parent && (QuickUtils.className(styledItem.parent) !== "QQuickPathView")
3672+ property Item itemList: inListView ? styledItem.ListView.view : styledItem.PathView.view
3673+ property Item picker: styledItem.picker
3674+ property Item highlightItem: itemList.highlightItem
3675+
3676+ Binding {
3677+ target: styledItem
3678+ when: fadingEnabled
3679+ property: "opacity"
3680+ value: opacityCalc()
3681+ }
3682+
3683+ function opacityCalc() {
3684+ if (!picker || !highlightItem || (index === itemList.currentIndex)) return 1.0;
3685+ var highlightY = highlightItem.y;
3686+ var delegateY = styledItem.y;
3687+ if (inListView) {
3688+ highlightY -= itemList.contentY;
3689+ delegateY -= itemList.contentY;
3690+ }
3691+ var midY = delegateY + styledItem.height / 2;
3692+ if (delegateY < highlightY) {
3693+ return MathUtils.clamp(MathUtils.projectValue(midY, 0, highlightY, minFade, maxFade), minFade, maxFade);
3694+ }
3695+ var highlightH = highlightY + highlightItem.height;
3696+ if (delegateY >= highlightH) {
3697+ delegateY -= highlightH;
3698+ midY = delegateY + styledItem.height / 2;
3699+ return MathUtils.clamp(1.0 - MathUtils.projectValue(midY, 0, highlightY, minFade, maxFade), minFade, maxFade);
3700+ }
3701+ return 1.0;
3702+ }
3703+}
3704
3705=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerStyle.qml'
3706--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerStyle.qml 1970-01-01 00:00:00 +0000
3707+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PickerStyle.qml 2015-04-25 07:11:10 +0000
3708@@ -0,0 +1,136 @@
3709+/*
3710+ * Copyright 2012 Canonical Ltd.
3711+ *
3712+ * This program is free software; you can redistribute it and/or modify
3713+ * it under the terms of the GNU Lesser General Public License as published by
3714+ * the Free Software Foundation; version 3.
3715+ *
3716+ * This program is distributed in the hope that it will be useful,
3717+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3718+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3719+ * GNU Lesser General Public License for more details.
3720+ *
3721+ * You should have received a copy of the GNU Lesser General Public License
3722+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3723+ */
3724+
3725+import QtQuick 2.4
3726+import Ubuntu.Components 1.2
3727+import Ubuntu.Components.ListItems 1.0
3728+
3729+Item {
3730+ id: control
3731+ // style properties
3732+ /*!
3733+ Specifies the background color
3734+ */
3735+ property color backgroundColor: "#0A000000"
3736+ /*!
3737+ Background color for highlight.
3738+ */
3739+ property color highlightBackgroundColor: "#ffffffff"
3740+ /*!
3741+ Highlight color.
3742+ */
3743+ property color highlightColor: UbuntuColors.orange
3744+ /*!
3745+ Scale of the highlight item
3746+ */
3747+ property real highlightScaleFactor: 1.2
3748+ /*!
3749+ Thickness of the highlight component
3750+ */
3751+ property real highlightThickness: units.gu(5)
3752+
3753+ /*!
3754+ The content holder exposed to the Picker so tumbler list can be reparented to it.
3755+ */
3756+ property alias tumblerHolder: content
3757+
3758+ /*!
3759+ \internal
3760+ View instance listing the model
3761+ */
3762+ property Item view: Item{}
3763+
3764+ anchors.fill: parent
3765+
3766+ // frame
3767+ UbuntuShape {
3768+ anchors.fill: parent
3769+ radius: "medium"
3770+ color: Theme.palette.normal.overlay
3771+ image: shapeSource
3772+ }
3773+
3774+ ShaderEffectSource {
3775+ id: shapeSource
3776+ sourceItem: background
3777+ hideSource: true
3778+ // FIXME: visible: false prevents rendering so make it a nearly
3779+ // transparent 1x1 pixel instead
3780+ opacity: 0.01
3781+ width: 1
3782+ height: 1
3783+ }
3784+
3785+ Rectangle {
3786+ id: background
3787+ anchors.fill: parent
3788+
3789+ MouseArea {
3790+ anchors.fill: parent
3791+ }
3792+ // background
3793+ color: backgroundColor
3794+
3795+ Item {
3796+ id: content
3797+ anchors.fill: parent
3798+ }
3799+
3800+ // highlight
3801+ Rectangle {
3802+ id: highlightItem
3803+ y: (content.height - control.highlightThickness) / 2
3804+ anchors {
3805+ left: content.left
3806+ right: content.right
3807+ }
3808+ height: control.highlightThickness
3809+ color: highlightBackgroundColor
3810+ }
3811+ ThinDivider {
3812+ anchors {
3813+ left: content.left
3814+ right: content.right
3815+ bottom: highlightItem.top
3816+ }
3817+ }
3818+ ThinDivider {
3819+ anchors {
3820+ left: content.left
3821+ right: content.right
3822+ top: highlightItem.bottom
3823+ }
3824+ }
3825+
3826+ ShaderEffectSource {
3827+ id: effectSource
3828+ visible: false
3829+ sourceItem: view
3830+
3831+ property real sourceRectMultiplier: 2.0
3832+ // XXX: This works because the parent of magnifier is the same as sourceItem
3833+ // in this case. Otherwise coordinate transformations will be needed.
3834+ sourceRect: Qt.rect(highlightItem.x, highlightItem.y, highlightItem.width, highlightItem.height)
3835+ textureSize: Qt.size(highlightItem.width*sourceRectMultiplier, highlightItem.height*sourceRectMultiplier)
3836+ }
3837+ HighlightMagnifier {
3838+ anchors.fill: highlightItem
3839+ scaleFactor: control.highlightScaleFactor
3840+ outputColor: control.highlightColor
3841+ source: effectSource
3842+ }
3843+ }
3844+}
3845
3846=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PopoverForegroundStyle.qml'
3847--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PopoverForegroundStyle.qml 1970-01-01 00:00:00 +0000
3848+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PopoverForegroundStyle.qml 2015-04-25 07:11:10 +0000
3849@@ -0,0 +1,40 @@
3850+/*
3851+ * Copyright 2013 Canonical Ltd.
3852+ *
3853+ * This program is free software; you can redistribute it and/or modify
3854+ * it under the terms of the GNU Lesser General Public License as published by
3855+ * the Free Software Foundation; version 3.
3856+ *
3857+ * This program is distributed in the hope that it will be useful,
3858+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3859+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3860+ * GNU Lesser General Public License for more details.
3861+ *
3862+ * You should have received a copy of the GNU Lesser General Public License
3863+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3864+ */
3865+
3866+import QtQuick 2.4
3867+
3868+BubbleShape {
3869+ property alias contentItem: content
3870+
3871+ target: styledItem.target
3872+ direction: styledItem.direction
3873+ clipContent: styledItem.clipContent
3874+ square: styledItem.square
3875+
3876+ onShowCompleted: styledItem.showCompleted()
3877+ onHideCompleted: styledItem.hideCompleted()
3878+
3879+ Item {
3880+ id: content
3881+ anchors.fill: parent
3882+
3883+ Connections {
3884+ target: styledItem
3885+ onShow: show()
3886+ onHide: hide()
3887+ }
3888+ }
3889+}
3890
3891=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressBarStyle.qml'
3892--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressBarStyle.qml 1970-01-01 00:00:00 +0000
3893+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressBarStyle.qml 2015-04-25 07:11:10 +0000
3894@@ -0,0 +1,76 @@
3895+/*
3896+ * Copyright 2013 Canonical Ltd.
3897+ *
3898+ * This program is free software; you can redistribute it and/or modify
3899+ * it under the terms of the GNU Lesser General Public License as published by
3900+ * the Free Software Foundation; version 3.
3901+ *
3902+ * This program is distributed in the hope that it will be useful,
3903+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3904+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3905+ * GNU Lesser General Public License for more details.
3906+ *
3907+ * You should have received a copy of the GNU Lesser General Public License
3908+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3909+ */
3910+
3911+import QtQuick 2.4
3912+import Ubuntu.Components 1.2
3913+
3914+Item {
3915+ id: progressBarStyle
3916+
3917+ property color foregroundColor: UbuntuColors.orange
3918+ property color foregroundTextColor: '#FFFFFF'
3919+ property color backgroundColor: Theme.palette.normal.base
3920+ property color backgroundTextColor: Theme.palette.normal.baseText
3921+
3922+ property var progressBar: styledItem
3923+
3924+ implicitWidth: units.gu(38)
3925+ implicitHeight: units.gu(4)
3926+
3927+ UbuntuShapeOverlay {
3928+ id: background
3929+ anchors.fill: parent
3930+ backgroundColor: progressBarStyle.backgroundColor
3931+ overlayColor: foregroundColor
3932+ overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
3933+ Qt.rect(0.0, 0.0, progressBarStyle.progress, 1.0) :
3934+ Qt.rect(1.0 - progressBarStyle.progress, 0.0, 1.0, 1.0)
3935+ }
3936+
3937+ property real progress: progressBar.indeterminate ? 0.0
3938+ : progressBar.value / (progressBar.maximumValue - progressBar.minimumValue)
3939+
3940+ Label {
3941+ id: valueLabel
3942+ anchors.centerIn: background
3943+ fontSize: "medium"
3944+ color: backgroundTextColor
3945+ text: progressBar.indeterminate ? i18n.dtr("ubuntu-ui-toolkit", "In Progress")
3946+ : "%1%".arg(Number(progressBarStyle.progress * 100.0).toFixed(0))
3947+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
3948+
3949+ SequentialAnimation on opacity {
3950+ loops: Animation.Infinite
3951+ running: progressBar.indeterminate
3952+ UbuntuNumberAnimation {
3953+ to: 0.2; duration: UbuntuAnimation.BriskDuration
3954+ }
3955+ UbuntuNumberAnimation {
3956+ to: 1.0; duration: UbuntuAnimation.BriskDuration
3957+ }
3958+ }
3959+ }
3960+
3961+ PartialColorize {
3962+ anchors.fill: valueLabel
3963+ sourceItem: progressBar.indeterminate ? null : valueLabel
3964+ leftColor: foregroundTextColor
3965+ rightColor: backgroundTextColor
3966+ progress: (progressBarStyle.progress * background.width - valueLabel.x) / valueLabel.width
3967+ mirror: Qt.application.layoutDirection == Qt.RightToLeft
3968+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
3969+ }
3970+}
3971
3972=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml'
3973--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml 1970-01-01 00:00:00 +0000
3974+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ProgressionVisualStyle.qml 2015-04-25 07:11:10 +0000
3975@@ -0,0 +1,52 @@
3976+/*
3977+ * Copyright 2013 Canonical Ltd.
3978+ *
3979+ * This program is free software; you can redistribute it and/or modify
3980+ * it under the terms of the GNU Lesser General Public License as published by
3981+ * the Free Software Foundation; version 3.
3982+ *
3983+ * This program is distributed in the hope that it will be useful,
3984+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3985+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3986+ * GNU Lesser General Public License for more details.
3987+ *
3988+ * You should have received a copy of the GNU Lesser General Public License
3989+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3990+ */
3991+
3992+import QtQuick 2.4
3993+import Ubuntu.Components 1.2
3994+
3995+Item {
3996+ id: progressionVisualStyle
3997+
3998+ property url progressionDividerSource: Qt.resolvedUrl("../artwork/progression_divider.png")
3999+ property url progressionIconSource: Qt.resolvedUrl("../artwork/chevron.png")
4000+
4001+ implicitWidth: progressIcon.width + (styledItem.showSplit ? styledItem.splitMargin + progressionDivider.width : 0)
4002+
4003+ Image {
4004+ id: progressIcon
4005+ source: progressionIconSource
4006+ anchors {
4007+ verticalCenter: parent.verticalCenter
4008+ right: parent.right
4009+ }
4010+
4011+ opacity: enabled ? 1.0 : 0.5
4012+ mirror: Qt.application.layoutDirection == Qt.RightToLeft
4013+ }
4014+
4015+ Image {
4016+ id: progressionDivider
4017+ visible: styledItem.showSplit
4018+ anchors {
4019+ top: parent.top
4020+ bottom: parent.bottom
4021+ right: progressIcon.left
4022+ rightMargin: styledItem.splitMargin
4023+ }
4024+ source: progressionDividerSource
4025+ opacity: enabled ? 1.0 : 0.5
4026+ }
4027+}
4028
4029=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/PullToRefreshStyle.qml'
4030--- modules/Ubuntu/Components/Themes/Ambiance/1.2/PullToRefreshStyle.qml 1970-01-01 00:00:00 +0000
4031+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/PullToRefreshStyle.qml 2015-04-25 07:11:10 +0000
4032@@ -0,0 +1,251 @@
4033+/*
4034+ * Copyright 2014 Canonical Ltd.
4035+ *
4036+ * This program is free software; you can redistribute it and/or modify
4037+ * it under the terms of the GNU Lesser General Public License as published by
4038+ * the Free Software Foundation; version 3.
4039+ *
4040+ * This program is distributed in the hope that it will be useful,
4041+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4042+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4043+ * GNU Lesser General Public License for more details.
4044+ *
4045+ * You should have received a copy of the GNU Lesser General Public License
4046+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4047+ */
4048+
4049+import QtQuick 2.4
4050+import Ubuntu.Components 1.2
4051+import Ubuntu.Components.Styles 1.2 as Style
4052+
4053+Style.PullToRefreshStyle {
4054+ id: style
4055+ implicitHeight: refreshIndicatorItem.height + units.gu(5)
4056+
4057+ defaultContent: Label {
4058+ id: labelComponent
4059+ visible: control.enabled
4060+ text: releaseToRefresh ? i18n.tr("Release to refresh...") : i18n.tr("Pull to refresh...")
4061+ horizontalAlignment: Text.AlignHCenter
4062+ verticalAlignment: Text.AlignVCenter
4063+ Behavior on text {
4064+ SequentialAnimation {
4065+ UbuntuNumberAnimation {
4066+ target: labelComponent
4067+ property: "opacity"
4068+ from: 1.0
4069+ to: 0.0
4070+ }
4071+ UbuntuNumberAnimation {
4072+ target: labelComponent
4073+ property: "opacity"
4074+ from: 0.0
4075+ to: 1.0
4076+ }
4077+ }
4078+ }
4079+ }
4080+
4081+ // additional configuration properties provided by the Ambiance theme
4082+ // these properties can be used by the deriving themes to configure the label
4083+ // and the activity indicator
4084+ property Item label: contentLoader.item
4085+ property alias refreshIndicator: refreshIndicatorItem
4086+
4087+ /*
4088+ Local properties
4089+ */
4090+ readonly property PullToRefresh control: styledItem
4091+ // property to store Flickable's toipMargin at the time the pull or auto-refresh is started
4092+ property real flickableTopMargin: 0.0
4093+ // store when the drag has happened at the beginning of the Flickable's content
4094+ property bool wasAtYBeginning: false
4095+ // initial contentY value when pull started
4096+ property real initialContentY: 0.0
4097+ // drives the refreshing state
4098+ property bool refreshing: false
4099+ // point of release used in rebind animation between the ready-to-refresh and refreshing states
4100+ property real pointOfRelease
4101+ // specifies the component completion
4102+ property bool ready: false
4103+ // root item
4104+ property Item rootItem: QuickUtils.rootItem(control)
4105+
4106+ anchors.fill: parent
4107+
4108+ Component.onCompleted: {
4109+ /*
4110+ When the model attached to the component is refreshing during initialization,
4111+ this refresh will happen after the style gets completed. This refresh will
4112+ cause the style to enter in refreshing state, which alters the topMargin.
4113+ However in the same time the MainView Header will be also updated, so that
4114+ will also alter the topMargin. But when refreshing completes, the topMargin
4115+ will be restored to the default value before the animation, and the content
4116+ will be pushed under the header. We need to connect to the header changes
4117+ so we can reset the state and the topMargin.
4118+ */
4119+ if (rootItem && rootItem.__propagated && rootItem.__propagated.header) {
4120+ rootItem.__propagated.header.visibleChanged.connect(fixTopMargin);
4121+ rootItem.__propagated.header.heightChanged.connect(fixTopMargin);
4122+ }
4123+ ready = true;
4124+ }
4125+ function fixTopMargin() {
4126+ if (style.state === "refreshing") {
4127+ /*
4128+ Fetch the topMargin, force state to disabled (idle will be turned on
4129+ automatically when refreshing completes) and set the topMargin from
4130+ the header change.
4131+ */
4132+ var topMargin = control.target.topMargin;
4133+ style.state = "disabled";
4134+ control.target.topMargin = topMargin;
4135+ }
4136+ }
4137+
4138+ // visuals
4139+ Loader {
4140+ id: contentLoader
4141+ sourceComponent: control.content
4142+ onItemChanged: {
4143+ if (item) {
4144+ item.parent = style;
4145+ item.anchors.fill = style;
4146+ }
4147+ }
4148+ asynchronous: false
4149+ }
4150+
4151+ ActivityIndicator {
4152+ id: refreshIndicatorItem
4153+ running: false
4154+ anchors.centerIn: parent
4155+ }
4156+
4157+ // state and content controlling
4158+ Connections {
4159+ target: control
4160+ onRefreshingChanged: {
4161+ if (!ready || !control.enabled) {
4162+ return;
4163+ }
4164+ if (!style.releaseToRefresh && target.refreshing) {
4165+ // not a manual refresh, update flickable's starting topMargin
4166+ style.flickableTopMargin = control.target.topMargin;
4167+ style.wasAtYBeginning = control.target.atYBeginning;
4168+ }
4169+ /*
4170+ We cannot bind refreshing state activation clause with the
4171+ control.refreshing property dirrectly as when the model is
4172+ refreshed automatically (not manually via the component), we
4173+ need to remember the flickable's topMargin in order to proceed
4174+ with a proper Flickable rebinding. If we use property binding,
4175+ the Connections' onRefreshingChanged will update the flickableTopMargin
4176+ only after the binding is evaluated.
4177+ */
4178+ style.refreshing = target.refreshing;
4179+ }
4180+ }
4181+ Connections {
4182+ target: control.target
4183+ onMovementStarted: {
4184+ style.wasAtYBeginning = control.target.atYBeginning;
4185+ style.initialContentY = control.target.contentY;
4186+ style.refreshing = false;
4187+ style.releaseToRefresh = false;
4188+ }
4189+ onMovementEnded: style.wasAtYBeginning = control.target.atYBeginning
4190+
4191+ // catch when to initiate refresh
4192+ onDraggingChanged: {
4193+ if (!control.parent.dragging && style.releaseToRefresh) {
4194+ pointOfRelease = -(control.target.contentY - control.target.originY)
4195+ style.flickableTopMargin = control.target.topMargin;
4196+ style.refreshing = true;
4197+ style.releaseToRefresh = false;
4198+ }
4199+ }
4200+ onContentYChanged: {
4201+ if (style.wasAtYBeginning && control.enabled && control.target.dragging) {
4202+ style.releaseToRefresh = ((style.initialContentY - control.target.contentY) > style.activationThreshold);
4203+ }
4204+ }
4205+ }
4206+
4207+ onStateChanged: {
4208+ /*
4209+ Label might not be ready when the component enters in refreshing
4210+ state, therefore the visible property will not be properly returned to
4211+ true. Because of the same reason we cannot have a PropertyChanges either
4212+ as the target is not yet ready at that point.
4213+ */
4214+ if (label) {
4215+ label.visible = (state === "idle" || state === "ready-to-refresh");
4216+ }
4217+ }
4218+ states: [
4219+ State {
4220+ name: "disabled"
4221+ when: !control.enabled
4222+ },
4223+ State {
4224+ name: "idle"
4225+ extend: ""
4226+ when: ready && control.enabled && !style.refreshing && !style.releaseToRefresh
4227+ },
4228+ State {
4229+ name: "ready-to-refresh"
4230+ when: ready && control.enabled && style.releaseToRefresh && !style.refreshing
4231+ },
4232+ State {
4233+ name: "refreshing"
4234+ when: ready && control.enabled && style.wasAtYBeginning && style.refreshing
4235+ PropertyChanges {
4236+ target: refreshIndicatorItem
4237+ running: true
4238+ }
4239+ PropertyChanges {
4240+ target: control.target
4241+ topMargin: style.flickableTopMargin + control.height
4242+ }
4243+ }
4244+ ]
4245+
4246+ transitions: [
4247+ Transition {
4248+ from: "ready-to-refresh"
4249+ to: "refreshing"
4250+ SequentialAnimation {
4251+ UbuntuNumberAnimation {
4252+ target: control.target
4253+ property: "topMargin"
4254+ from: style.pointOfRelease
4255+ to: style.flickableTopMargin + control.height
4256+ }
4257+ ScriptAction {
4258+ script: control.refresh()
4259+ }
4260+ }
4261+ },
4262+ // transition to be applied when the model is auto-updating
4263+ Transition {
4264+ from: "idle"
4265+ to: "refreshing"
4266+ UbuntuNumberAnimation {
4267+ target: control.target
4268+ property: "contentY"
4269+ from: -style.flickableTopMargin
4270+ to: -style.flickableTopMargin - control.height
4271+ }
4272+ },
4273+ Transition {
4274+ from: "refreshing"
4275+ to: "idle"
4276+ UbuntuNumberAnimation {
4277+ target: control.target
4278+ property: "topMargin"
4279+ }
4280+ }
4281+ ]
4282+}
4283+
4284
4285=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml'
4286--- modules/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml 1970-01-01 00:00:00 +0000
4287+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml 2015-04-25 07:11:10 +0000
4288@@ -0,0 +1,490 @@
4289+/*
4290+ * Copyright 2012 Canonical Ltd.
4291+ *
4292+ * This program is free software; you can redistribute it and/or modify
4293+ * it under the terms of the GNU Lesser General Public License as published by
4294+ * the Free Software Foundation; version 3.
4295+ *
4296+ * This program is distributed in the hope that it will be useful,
4297+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4298+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4299+ * GNU Lesser General Public License for more details.
4300+ *
4301+ * You should have received a copy of the GNU Lesser General Public License
4302+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4303+ */
4304+
4305+import QtQuick 2.4
4306+import Ubuntu.Components 1.2
4307+
4308+/*
4309+ The visuals handle both active and passive modes. This behavior is driven yet by
4310+ the styledItem's __inactive property, however should be detected upon runtime based on
4311+ the device type.
4312+ On active scrollbars, positioning is handled so that the logic updates the flickable's
4313+ X/Y content positions, which is then synched with the contentPosition by the main
4314+ element.
4315+
4316+ Style properties used:
4317+ - interactive: bool - drives the interactive behavior of the scrollbar
4318+ - minimumSliderSize: real - specifies the minimum size of the slider
4319+ * overlay
4320+ - overlay: bool - true if the scrollbar is overlay type
4321+ - overlayOpacityWhenHidden: opacity when hidden
4322+ - overlayOpacityWhenShown: opacity when shown
4323+ * animations - where duration and easing properties are used only
4324+ - scrollbarFadeInAnimation: PropertyAnimation - animation used when fade in
4325+ - scrollbarFadeOutAnimation: PropertyAnimation - animation used when fade out
4326+ - scrollbarFadeOutPause: int - miliseconds to pause before fade out
4327+ * behaviors - animations are used as declared
4328+ - sliderAnimation: PropertyAnimation - animation for the slider size
4329+ - thumbConnectorFading: PropertyAnimation - animation for the thumb connector
4330+ - thumbFading: PropertyAnimation - animation for the thumb fading
4331+ * other styling properties
4332+ - color sliderColor: color for the slider
4333+ - color thumbConnectorColor: thumb connector color
4334+ - url forwardThumbReleased: forward thumb image when released
4335+ - url forwardThumbPressed: forward thumb image when pressed
4336+ - url backwardThumbReleased: backward thumb image when released
4337+ - url backwardThumbPressed: backward thumb image when pressed
4338+ - real scrollAreaThickness: scrollbar area thickness, the area where the
4339+ slider, thumb and thumb-connector appear
4340+ - real thumbConnectorMargin: margin of the thumb connector aligned to the
4341+ thumb visuals
4342+ */
4343+
4344+Item {
4345+ id: visuals
4346+ // styling properties
4347+ property bool interactive: false
4348+ property real minimumSliderSize: units.gu(2)
4349+
4350+ property bool overlay: !interactive
4351+ property real overlayOpacityWhenShown: 0.6
4352+ property real overlayOpacityWhenHidden: 0.0
4353+
4354+ property PropertyAnimation scrollbarFadeInAnimation: UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
4355+ property PropertyAnimation scrollbarFadeOutAnimation: UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration }
4356+ property int scrollbarFadeOutPause: 300
4357+ property PropertyAnimation sliderAnimation: UbuntuNumberAnimation {}
4358+ property PropertyAnimation thumbConnectorFading: UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
4359+ property PropertyAnimation thumbFading: UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
4360+
4361+ property color sliderColor: Theme.palette.normal.base
4362+ property real sliderRadius: units.gu(0.5)
4363+ property color thumbConnectorColor: "white"
4364+ property url forwardThumbReleased: (styledItem.align === Qt.AlignLeading || styledItem.align === Qt.AlignTrailing) ? Qt.resolvedUrl("../artwork/ScrollbarBottomIdle.png") : Qt.resolvedUrl("../artwork/ScrollbarRightIdle.png")
4365+ property url forwardThumbPressed: (styledItem.align === Qt.AlignLeading || styledItem.align === Qt.AlignTrailing) ? Qt.resolvedUrl("../artwork/ScrollbarBottomPressed.png") : Qt.resolvedUrl("../artwork/ScrollbarRightPressed.png")
4366+ property url backwardThumbReleased: (styledItem.align === Qt.AlignLeading || styledItem.align === Qt.AlignTrailing) ? Qt.resolvedUrl("../artwork/ScrollbarTopIdle.png") : Qt.resolvedUrl("../artwork/ScrollbarLeftIdle.png")
4367+ property url backwardThumbPressed: (styledItem.align === Qt.AlignLeading || styledItem.align === Qt.AlignTrailing) ? Qt.resolvedUrl("../artwork/ScrollbarTopPressed.png") : Qt.resolvedUrl("../artwork/ScrollbarLeftPressed.png")
4368+
4369+ property real scrollAreaThickness: units.gu(0.5)
4370+ property real thumbConnectorMargin: units.dp(3)
4371+
4372+ // helper properties to ease code readability
4373+ property Flickable flickableItem: styledItem.flickableItem
4374+ property bool isScrollable: styledItem.__private.scrollable && pageSize > 0.0
4375+ && contentSize > 0.0 && contentSize > pageSize
4376+ property bool isVertical: ScrollbarUtils.isVertical(styledItem)
4377+ property bool frontAligned: (styledItem.align === Qt.AlignLeading)
4378+ property bool rearAligned: (styledItem.align === Qt.AlignTrailing)
4379+ property bool topAligned: (styledItem.align === Qt.AlignTop)
4380+ property bool bottomAligned: (styledItem.align === Qt.AlignBottom)
4381+
4382+ property real pageSize: (isVertical) ? styledItem.height : styledItem.width
4383+ property real contentSize: (isVertical) ? styledItem.flickableItem.contentHeight : styledItem.flickableItem.contentWidth
4384+
4385+ /*****************************************
4386+ Visuals
4387+ *****************************************/
4388+ anchors.fill: parent
4389+
4390+ opacity: overlayOpacityWhenHidden
4391+ state: {
4392+ if (!isScrollable)
4393+ return '';
4394+ else if (overlay) {
4395+ if (flickableItem.moving)
4396+ return 'overlay';
4397+ else
4398+ return 'stopped';
4399+ } else
4400+ return 'shown';
4401+ }
4402+
4403+ states: [
4404+ State {
4405+ name: 'stopped'
4406+ extend: ''
4407+ PropertyChanges {
4408+ target: visuals
4409+ opacity: overlayOpacityWhenHidden
4410+ }
4411+ },
4412+ State {
4413+ name: "shown"
4414+ PropertyChanges {
4415+ target: visuals
4416+ opacity: overlayOpacityWhenShown
4417+ }
4418+ },
4419+ State {
4420+ name: 'overlay'
4421+ PropertyChanges {
4422+ target: visuals
4423+ opacity: overlayOpacityWhenShown
4424+ }
4425+ }
4426+ ]
4427+ transitions: [
4428+ Transition {
4429+ from: ''
4430+ to: 'shown'
4431+ NumberAnimation {
4432+ target: visuals
4433+ property: "opacity"
4434+ duration: scrollbarFadeInAnimation.duration
4435+ easing: scrollbarFadeInAnimation.easing
4436+ }
4437+ },
4438+ Transition {
4439+ from: '*'
4440+ to: 'overlay'
4441+ NumberAnimation {
4442+ target: visuals
4443+ property: "opacity"
4444+ duration: scrollbarFadeInAnimation.duration
4445+ easing: scrollbarFadeInAnimation.easing
4446+ }
4447+ },
4448+ Transition {
4449+ from: "overlay"
4450+ to: "stopped"
4451+ SequentialAnimation {
4452+ PauseAnimation { duration: scrollbarFadeOutPause }
4453+ NumberAnimation {
4454+ target: visuals
4455+ property: "opacity"
4456+ duration: scrollbarFadeOutAnimation.duration
4457+ easing: scrollbarFadeOutAnimation.easing
4458+ }
4459+ }
4460+ }
4461+ ]
4462+
4463+ function mapToPoint(map)
4464+ {
4465+ return Qt.point(map.x, map.y)
4466+ }
4467+
4468+ SmoothedAnimation {
4469+ id: scrollAnimation
4470+
4471+ duration: 200
4472+ easing.type: Easing.InOutQuad
4473+ target: styledItem.flickableItem
4474+ property: (isVertical) ? "contentY" : "contentX"
4475+ }
4476+
4477+ // represents the visible area of the scrollbar where slider and thumb connector are placed
4478+ Item {
4479+ id: scrollbarArea
4480+
4481+ property real thickness: scrollAreaThickness
4482+ property real proximityThickness: (isVertical) ? styledItem.width - thickness : styledItem.height - thickness
4483+ anchors {
4484+ fill: parent
4485+ leftMargin: (!isVertical || frontAligned) ? 0 : proximityThickness
4486+ rightMargin: (!isVertical || rearAligned) ? 0 : proximityThickness
4487+ topMargin: (isVertical || topAligned) ? 0 : proximityThickness
4488+ bottomMargin: (isVertical || bottomAligned) ? 0 : proximityThickness
4489+ }
4490+ }
4491+ // The thumb appears whenever the mouse gets close enough to the scrollbar
4492+ // and disappears after being for a long enough time far enough of it
4493+ MouseArea {
4494+ id: proximityArea
4495+
4496+ anchors {
4497+ fill: parent
4498+ leftMargin: (!isVertical) ? 0 : (frontAligned ? scrollbarArea.thickness : 0)
4499+ rightMargin: (!isVertical) ? 0 : (rearAligned ? scrollbarArea.thickness : 0)
4500+ topMargin: (isVertical) ? 0 : (topAligned ? scrollbarArea.thickness : 0)
4501+ bottomMargin: (isVertical) ? 0 : (bottomAligned ? scrollbarArea.thickness : 0)
4502+ }
4503+ propagateComposedEvents: true
4504+ enabled: isScrollable && interactive
4505+ hoverEnabled: true
4506+ onEntered: thumb.show();
4507+
4508+ onPressed: mouse.accepted = false
4509+ onClicked: mouse.accepted = false
4510+ onReleased: mouse.accepted = false
4511+ }
4512+
4513+ // The presence of a mouse enables the interactive thumb
4514+ // FIXME: Should use form factor hints
4515+ InverseMouse.onEntered: interactive = true
4516+
4517+ // The slider's position represents which part of the flickable is visible.
4518+ // The slider's size represents the size the visible part relative to the
4519+ // total size of the flickable.
4520+ Item {
4521+ id: scrollCursor
4522+ x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - scrollCursor.width)
4523+ y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - scrollCursor.height)
4524+ width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.width)
4525+ height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.height)
4526+
4527+ function drag() {
4528+ ScrollbarUtils.dragAndClamp(styledItem, scrollCursor, contentSize, pageSize);
4529+ }
4530+ }
4531+
4532+ Rectangle {
4533+ id: slider
4534+
4535+ color: visuals.sliderColor
4536+
4537+ anchors {
4538+ left: (isVertical) ? scrollbarArea.left : undefined
4539+ right: (isVertical) ? scrollbarArea.right : undefined
4540+ top: (!isVertical) ? scrollbarArea.top : undefined
4541+ bottom: (!isVertical) ? scrollbarArea.bottom : undefined
4542+ }
4543+
4544+ x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - slider.width)
4545+ y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - slider.height)
4546+ width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.width)
4547+ height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.height)
4548+ radius: visuals.sliderRadius
4549+
4550+ Behavior on width {
4551+ enabled: (!isVertical)
4552+ NumberAnimation {
4553+ duration: visuals.sliderAnimation.duration
4554+ easing: visuals.sliderAnimation.easing
4555+ }
4556+ }
4557+ Behavior on height {
4558+ enabled: (isVertical)
4559+ NumberAnimation {
4560+ duration: visuals.sliderAnimation.duration
4561+ easing: visuals.sliderAnimation.easing
4562+ }
4563+ }
4564+
4565+ function scroll(amount) {
4566+ scrollAnimation.to = ScrollbarUtils.scrollAndClamp(styledItem, amount, 0.0, contentSize - pageSize);
4567+ scrollAnimation.restart();
4568+ }
4569+ }
4570+
4571+ // The sliderThumbConnector ensures a visual connection between the slider and the thumb
4572+ Rectangle {
4573+ id: sliderThumbConnector
4574+
4575+ property real thumbConnectorMargin: visuals.thumbConnectorMargin
4576+ property bool isThumbAboveSlider: (isVertical) ? thumb.y < slider.y : thumb.x < slider.x
4577+ anchors {
4578+ left: (isVertical) ? scrollbarArea.left : (isThumbAboveSlider ? thumb.left : slider.right)
4579+ right: (isVertical) ? scrollbarArea.right : (isThumbAboveSlider ? slider.left : thumb.right)
4580+ top: (!isVertical) ? scrollbarArea.top : (isThumbAboveSlider ? thumb.top : slider.bottom)
4581+ bottom: (!isVertical) ? scrollbarArea.bottom : (isThumbAboveSlider ? slider.top : thumb.bottom)
4582+
4583+ leftMargin : (isVertical) ? 0 : (isThumbAboveSlider ? thumbConnectorMargin : 0)
4584+ rightMargin : (isVertical) ? 0 : (isThumbAboveSlider ? 0 : thumbConnectorMargin)
4585+ topMargin : (!isVertical) ? 0 : (isThumbAboveSlider ? thumbConnectorMargin : 0)
4586+ bottomMargin : (!isVertical) ? 0 : (isThumbAboveSlider ? 0 : thumbConnectorMargin)
4587+ }
4588+ color: visuals.thumbConnectorColor
4589+ opacity: thumb.shown ? 1.0 : 0.0
4590+ Behavior on opacity {
4591+ NumberAnimation {
4592+ duration: visuals.thumbConnectorFading.duration
4593+ easing: visuals.thumbConnectorFading.easing
4594+ }
4595+ }
4596+ }
4597+
4598+ MouseArea {
4599+ id: thumbArea
4600+
4601+ property point thumbPoint: mapToPoint(thumb.mapFromItem(thumbArea, mouseX, mouseY))
4602+ property point thumbTopPoint: mapToPoint(thumbTop.mapFromItem(thumb, thumbPoint.x, thumbPoint.y))
4603+ property point thumbBottomPoint: mapToPoint(thumbBottom.mapFromItem(thumb, thumbPoint.x, thumbPoint.y))
4604+ property bool inThumbTop: thumbTop.contains(thumbTopPoint)
4605+ property bool inThumbBottom: thumbBottom.contains(thumbBottomPoint)
4606+
4607+ anchors {
4608+ fill: scrollbarArea
4609+ // set margins adding 2 dp for error area
4610+ leftMargin: (!isVertical || frontAligned) ? 0 : units.dp(-2) - thumb.width
4611+ rightMargin: (!isVertical || rearAligned) ? 0 : units.dp(-2) - thumb.width
4612+ topMargin: (isVertical || topAligned) ? 0 : units.dp(-2) - thumb.height
4613+ bottomMargin: (isVertical || bottomAligned) ? 0 : units.dp(-2) - thumb.height
4614+ }
4615+ enabled: isScrollable && interactive
4616+ hoverEnabled: true
4617+ onEntered: thumb.show()
4618+ onPressed: {
4619+ if (isVertical) {
4620+ if (mouseY < thumb.y) {
4621+ thumb.placeThumbForeUnderMouse(mouse)
4622+ } else if (mouseY > (thumb.y + thumb.height)) {
4623+ thumb.placeThumbRearUnderMouse(mouse)
4624+ }
4625+ } else {
4626+ if (mouseX < thumb.x) {
4627+ thumb.placeThumbForeUnderMouse(mouse)
4628+ } else if (mouseX > (thumb.x + thumb.width)) {
4629+ thumb.placeThumbRearUnderMouse(mouse)
4630+ }
4631+ }
4632+ }
4633+ onClicked: {
4634+ if (inThumbBottom)
4635+ slider.scroll(pageSize)
4636+ else if (inThumbTop)
4637+ slider.scroll(-pageSize)
4638+ }
4639+
4640+ // Dragging behaviour
4641+ function resetDrag() {
4642+ thumbYStart = thumb.y
4643+ thumbXStart = thumb.x
4644+ dragYStart = drag.target.y
4645+ dragXStart = drag.target.x
4646+ }
4647+
4648+ property int thumbYStart
4649+ property int dragYStart
4650+ property int dragYAmount: thumbArea.drag.target.y - thumbArea.dragYStart
4651+ property int thumbXStart
4652+ property int dragXStart
4653+ property int dragXAmount: thumbArea.drag.target.x - thumbArea.dragXStart
4654+ drag {
4655+ target: scrollCursor
4656+ axis: (isVertical) ? Drag.YAxis : Drag.XAxis
4657+ minimumY: 0
4658+ maximumY: flickableItem.height - scrollCursor.height
4659+ minimumX: 0
4660+ maximumX: flickableItem.width - scrollCursor.width
4661+ onActiveChanged: {
4662+ if (drag.active) resetDrag()
4663+ }
4664+ }
4665+ // update thumb position
4666+ onDragYAmountChanged: {
4667+ if (drag.active) {
4668+ thumb.y = MathUtils.clamp(thumbArea.thumbYStart + thumbArea.dragYAmount, 0, thumb.maximumPos);
4669+ }
4670+ }
4671+ onDragXAmountChanged: {
4672+ if (drag.active) {
4673+ thumb.x = MathUtils.clamp(thumbArea.thumbXStart + thumbArea.dragXAmount, 0, thumb.maximumPos);
4674+ }
4675+ }
4676+
4677+ // drag slider and content to the proper position
4678+ onPositionChanged: {
4679+ if (pressedButtons == Qt.LeftButton) {
4680+ scrollCursor.drag()
4681+ }
4682+ }
4683+ }
4684+
4685+ Timer {
4686+ id: autohideTimer
4687+
4688+ interval: 1000
4689+ repeat: true
4690+ onTriggered: if (!proximityArea.containsMouse && !thumbArea.containsMouse && !thumbArea.pressed) thumb.hide()
4691+ }
4692+
4693+ Item {
4694+ id: thumb
4695+ objectName: "interactiveScrollbarThumb"
4696+
4697+ enabled: interactive
4698+
4699+ anchors {
4700+ left: frontAligned ? slider.left : undefined
4701+ right: rearAligned ? slider.right : undefined
4702+ top: topAligned ? slider.top : undefined
4703+ bottom: bottomAligned ? slider.bottom : undefined
4704+ }
4705+
4706+ width: childrenRect.width
4707+ height: childrenRect.height
4708+
4709+ property bool shown
4710+ property int maximumPos: (isVertical) ? styledItem.height - thumb.height : styledItem.width - thumb.width
4711+
4712+ /* Show the thumb as close as possible to the mouse pointer */
4713+ onShownChanged: {
4714+ if (shown) {
4715+ if (isVertical) {
4716+ var mouseY = proximityArea.containsMouse ? proximityArea.mouseY : thumbArea.mouseY;
4717+ y = MathUtils.clamp(mouseY - thumb.height / 2, 0, thumb.maximumPos);
4718+ } else {
4719+ var mouseX = proximityArea.containsMouse ? proximityArea.mouseX : thumbArea.mouseX;
4720+ x = MathUtils.clamp(mouseX - thumb.width / 2, 0, thumb.maximumPos);
4721+ }
4722+ }
4723+ }
4724+
4725+ function show() {
4726+ autohideTimer.restart();
4727+ shown = true;
4728+ }
4729+
4730+ function hide() {
4731+ autohideTimer.stop();
4732+ shown = false;
4733+ }
4734+
4735+ function placeThumbForeUnderMouse(mouse) {
4736+ var diff = (isVertical) ? mouse.y - height / 4 : mouse.x - width / 4;
4737+ positionAnimation.to = MathUtils.clamp(diff, 0, maximumPos);
4738+ positionAnimation.restart();
4739+ }
4740+
4741+ function placeThumbRearUnderMouse(mouse) {
4742+ var diff = (isVertical) ? mouse.y - height * 3 / 4 : mouse.x - width * 3 / 4;
4743+ positionAnimation.to = MathUtils.clamp(diff, 0, maximumPos);
4744+ positionAnimation.restart();
4745+ }
4746+
4747+ NumberAnimation {
4748+ id: positionAnimation
4749+
4750+ duration: 100
4751+ easing.type: Easing.InOutQuad
4752+ target: thumb
4753+ property: (isVertical) ? "y" : "x"
4754+ }
4755+
4756+ opacity: shown ? (thumbArea.containsMouse || thumbArea.drag.active ? 1.0 : 0.5) : 0.0
4757+ Behavior on opacity {
4758+ NumberAnimation {
4759+ duration: visuals.thumbFading.duration
4760+ easing: visuals.thumbFading.easing
4761+ }
4762+ }
4763+
4764+ Flow {
4765+ // disable mirroring as thumbs are placed in the same way no matter of RTL or LTR
4766+ LayoutMirroring.enabled: false
4767+ flow: (isVertical) ? Flow.TopToBottom : Flow.LeftToRight
4768+ Image {
4769+ id: thumbTop
4770+ source: thumbArea.inThumbTop && thumbArea.pressed ? visuals.backwardThumbPressed : visuals.backwardThumbReleased
4771+ }
4772+ Image {
4773+ id: thumbBottom
4774+ source: thumbArea.inThumbBottom && thumbArea.pressed ? visuals.forwardThumbPressed : visuals.forwardThumbReleased
4775+ }
4776+ }
4777+ }
4778+}
4779
4780=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/SheetForegroundStyle.qml'
4781--- modules/Ubuntu/Components/Themes/Ambiance/1.2/SheetForegroundStyle.qml 1970-01-01 00:00:00 +0000
4782+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/SheetForegroundStyle.qml 2015-04-25 07:11:10 +0000
4783@@ -0,0 +1,104 @@
4784+/*
4785+ * Copyright 2012 Canonical Ltd.
4786+ *
4787+ * This program is free software; you can redistribute it and/or modify
4788+ * it under the terms of the GNU Lesser General Public License as published by
4789+ * the Free Software Foundation; version 3.
4790+ *
4791+ * This program is distributed in the hope that it will be useful,
4792+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4793+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4794+ * GNU Lesser General Public License for more details.
4795+ *
4796+ * You should have received a copy of the GNU Lesser General Public License
4797+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4798+ */
4799+
4800+import QtQuick 2.4
4801+import Ubuntu.Components 1.2
4802+
4803+Item {
4804+ id: visuals
4805+ // styling properties
4806+ property color backgroundColor: "lightgray"
4807+ property color headerColor: "darkgray"
4808+ property real headerHeight: units.gu(8)
4809+ property real buttonContainerWidth: units.gu(14)
4810+
4811+ implicitWidth: MathUtils.clamp(styledItem.contentsWidth, styledItem.minWidth, styledItem.maxWidth)
4812+ implicitHeight: header.height + containerItem.height
4813+
4814+ property alias contentItem: containerItem
4815+
4816+ Rectangle {
4817+ id: header
4818+ color: visuals.headerColor
4819+ height: visuals.headerHeight
4820+ anchors {
4821+ top: parent.top
4822+ left: parent.left
4823+ right: parent.right
4824+ }
4825+
4826+ Label {
4827+ id: headerText
4828+ anchors {
4829+ verticalCenter: parent.verticalCenter
4830+ left: leftButtonContainer.right
4831+ right: rightButtonContainer.left
4832+ }
4833+ width: headerText.implicitWidth + units.gu(4)
4834+ elide: Text.ElideRight
4835+ horizontalAlignment: Text.AlignHCenter
4836+ text: styledItem.title
4837+ }
4838+
4839+ Item {
4840+ id: leftButtonContainer
4841+ anchors {
4842+ left: parent.left
4843+ top: parent.top
4844+ bottom: parent.bottom
4845+ }
4846+ width: styledItem.leftButton ? visuals.buttonContainerWidth : 0
4847+ Component.onCompleted: header.updateButton(styledItem.leftButton, leftButtonContainer)
4848+ }
4849+
4850+ Item {
4851+ id: rightButtonContainer
4852+ anchors {
4853+ right: parent.right
4854+ top: parent.top
4855+ bottom: parent.bottom
4856+ }
4857+ width: styledItem.rightButton ? visuals.buttonContainerWidth : 0
4858+ Component.onCompleted: header.updateButton(styledItem.rightButton, rightButtonContainer)
4859+ }
4860+
4861+ function updateButton(button, container) {
4862+ if (!button) return;
4863+ button.parent = container;
4864+ button.anchors.left = container.left;
4865+ button.anchors.right = container.right;
4866+ button.anchors.verticalCenter = container.verticalCenter;
4867+ button.anchors.margins = units.gu(1);
4868+ }
4869+
4870+ Connections {
4871+ target: styledItem
4872+ onLeftButtonChanged: header.updateButton(styledItem.leftButton, leftButtonContainer)
4873+ onRightButtonChanged: header.updateButton(styledItem.rightButton, rightButtonContainer)
4874+ }
4875+ }
4876+
4877+ Rectangle {
4878+ id: containerItem
4879+ color: visuals.backgroundColor
4880+ height: MathUtils.clamp(styledItem.contentsHeight, styledItem.minHeight - header.height, styledItem.maxHeight - header.height)
4881+ anchors {
4882+ top: header.bottom
4883+ left: parent.left
4884+ right: parent.right
4885+ }
4886+ }
4887+}
4888
4889=== added file 'modules/Ubuntu/Components/Themes/Ambiance/1.2/SliderStyle.qml'
4890--- modules/Ubuntu/Components/Themes/Ambiance/1.2/SliderStyle.qml 1970-01-01 00:00:00 +0000
4891+++ modules/Ubuntu/Components/Themes/Ambiance/1.2/SliderStyle.qml 2015-04-25 07:11:10 +0000
4892@@ -0,0 +1,123 @@
4893+/*
4894+ * Copyright 2013 Canonical Ltd.
4895+ *
4896+ * This program is free software; you can redistribute it and/or modify
4897+ * it under the terms of the GNU Lesser General Public License as published by
4898+ * the Free Software Foundation; version 3.
4899+ *
4900+ * This program is distributed in the hope that it will be useful,
4901+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4902+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4903+ * GNU Lesser General Public License for more details.
4904+ *
4905+ * You should have received a copy of the GNU Lesser General Public License
4906+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4907+ */
4908+
4909+import QtQuick 2.4
4910+import Ubuntu.Components 1.2
4911+
4912+/*
4913+ The default slider style consists of a bar and a thumb shape.
4914+
4915+ This style is themed using the following properties:
4916+ - thumbSpacing: spacing between the thumb and the bar
4917+*/
4918+Item {
4919+ id: sliderStyle
4920+
4921+ property color foregroundColor: UbuntuColors.orange
4922+ property color backgroundColor: Theme.palette.normal.base
4923+
4924+ property real thumbSpacing: units.gu(0)
4925+ property Item bar: background
4926+ property Item thumb: thumb
4927+
4928+ implicitWidth: units.gu(38)
4929+ implicitHeight: units.gu(5)
4930+
4931+ UbuntuShapeOverlay {
4932+ id: background
4933+ anchors {
4934+ verticalCenter: parent.verticalCenter
4935+ right: parent.right
4936+ left: parent.left
4937+ }
4938+ height: units.dp(4)
4939+ backgroundColor: sliderStyle.backgroundColor
4940+ overlayColor: sliderStyle.foregroundColor
4941+ overlayRect: Qt.application.layoutDirection == Qt.LeftToRight ?
4942+ Qt.rect(0.0, 0.0, thumb.x / thumb.barMinusThumbWidth, 1.0) :
4943+ Qt.rect(1.0 - (thumb.x / thumb.barMinusThumbWidth), 0.0, 1.0, 1.0)
4944+ }
4945+
4946+ UbuntuShape {
4947+ id: thumb
4948+
4949+ anchors {
4950+ verticalCenter: parent.verticalCenter
4951+ topMargin: thumbSpacing
4952+ bottomMargin: thumbSpacing
4953+ }
4954+
4955+ property real barMinusThumbWidth: background.width - (thumb.width + 2.0*thumbSpacing)
4956+ property real position: thumbSpacing + SliderUtils.normalizedValue(styledItem) * barMinusThumbWidth
4957+ property bool pressed: SliderUtils.isPressed(styledItem)
4958+ property bool positionReached: x == position
4959+ x: position
4960+
4961+ /* Enable the animation on x when pressing the slider.
4962+ Disable it when x has reached the target position.
4963+ */
4964+ onPressedChanged: if (pressed) xBehavior.enabled = true;
4965+ onPositionReachedChanged: if (positionReached) xBehavior.enabled = false;
4966+
4967+ Behavior on x {
4968+ id: xBehavior
4969+ SmoothedAnimation {
4970+ duration: UbuntuAnimation.FastDuration
4971+ }
4972+ }
4973+ width: units.gu(2)
4974+ height: units.gu(2)
4975+ opacity: 0.97
4976+ color: Theme.palette.normal.overlay
4977+ }
4978+
4979+ BubbleShape {
4980+ id: bubbleShape
4981+
4982+ property real minimumWidth: units.gu(8)
4983+ property real horizontalPadding: units.gu(1)
4984+
4985+ width: Math.max(minimumWidth, label.implicitWidth + 2*horizontalPadding)
4986+ height: units.gu(6)
4987+
4988+ // FIXME: very temporary implementation
4989+ property real minX: 0.0
4990+ property real maxX: background.width - width
4991+ property real pointerSize: units.dp(6)
4992+ property real targetMargin: units.gu(1)
4993+ property point globalTarget: Qt.point(thumb.x + thumb.width / 2.0, thumb.y - targetMargin)
4994+
4995+ x: MathUtils.clamp(globalTarget.x - width / 2.0, minX, maxX)
4996+ y: globalTarget.y - height - pointerSize
4997+ target: Qt.point(globalTarget.x - x, globalTarget.y - y)
4998+
4999+ property bool pressed: SliderUtils.isPressed(styledItem)
5000+ property bool shouldShow: pressed && label.text != ""
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches