on xenial help sign in
App launch: display real background and header when launching apps.
commit880c1f8c5568a7d5b18a40a0cebf3e1807cc8a12 authorFlorian Boucault <florian.boucault@canonical.com> dateWed 6 Aug 2014, 17:38 (12 years ago) parent4b6a6fb
13 files changed+354−135
qml/Stages/AmbiancePalette.qml+48 qml/Stages/Dot.qml−25 qml/Stages/MainViewStyle.qml+76 qml/Stages/PageHeadStyle.qml+71 qml/Stages/Splash.qml+40−32 qml/Stages/SpreadDelegate.qml+28−2 qml/Stages/SuruDarkPalette.qml+44 qml/Stages/SuruGradientPalette.qml+42 qml/Stages/WaitingDots.qml−76 qml/Stages/graphics/PageHeaderBaseDividerBottom@18.png qml/Stages/graphics/PageHeaderBaseDividerLight@18.png qml/Stages/graphics/PageHeaderBaseDividerLight@18.sci+5 qml/Stages/graphics/background_paper@27.png
qml/Stages/AmbiancePalette.qmlnew file+48
@@ -0,0 +1,48 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 1.1
19+import Ubuntu.Components.Themes 0.1
20+
21+// FIXME: copied without modifications from Ubuntu UI Toolkit's Ambiance's theme
22+Palette {
23+ normal: PaletteValues {
24+ background: "#EDEDED"
25+ backgroundText: "#81888888"
26+ base: Qt.rgba(0, 0, 0, 0.1)
27+ baseText: UbuntuColors.lightGrey
28+ foreground: UbuntuColors.lightGrey
29+ foregroundText: "#F3F3E7"
30+ overlay: "#FDFDFD"
31+ overlayText: UbuntuColors.lightGrey
32+ field: "#1A000000"
33+ fieldText: UbuntuColors.darkGrey
34+ }
35+ selected: PaletteValues {
36+ /* FIXME: 'background' does not come from design
37+ it is used solely in the list items for the selection highlight
38+ that will go away with the new design.
39+ */
40+ background: "#B2E6E6E6"
41+ backgroundText: UbuntuColors.darkGrey
42+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
43+ foreground: UbuntuColors.orange
44+ foregroundText: UbuntuColors.darkGrey
45+ field: "#FFFFFF"
46+ fieldText: UbuntuColors.darkGrey
47+ }
48+}
qml/Stages/Dot.qmldeleted−25
@@ -1,25 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Rectangle {
21− radius: width
22− width: units.dp(6)
23− height: width
24− color: UbuntuColors.orange
25−}
qml/Stages/MainViewStyle.qmlnew file+76
@@ -0,0 +1,76 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+import QtQuick 2.0
17+import Ubuntu.Components 1.1
18+
19+// FIXME: copied with slight modifications from Ubuntu UI Toolkit's Ambiance's theme
20+Item {
21+ // styling properties
22+ anchors.fill: parent
23+ z: -1
24+ id: mainViewStyle
25+
26+ /*!
27+ The background texture of the main view. The image will be drawn over the background color,
28+ so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
29+ */
30+ property url backgroundSource: "graphics/background_paper.png"
31+ property var theme
32+
33+ Gradient {
34+ id: backgroundGradient
35+ GradientStop { position: 0.0; color: styledItem.headerColor }
36+ GradientStop { position: 0.83; color: styledItem.backgroundColor }
37+ GradientStop { position: 1.0; color: styledItem.footerColor }
38+ }
39+
40+ Rectangle {
41+ id: backgroundColor
42+ anchors.fill: parent
43+ color: styledItem.backgroundColor
44+ gradient: internals.isGradient ? backgroundGradient : null
45+ }
46+
47+ Image {
48+ id: backgroundTexture
49+ anchors.fill: parent
50+ source: mainViewStyle.backgroundSource
51+ fillMode: Image.Tile
52+ }
53+
54+ QtObject {
55+ id: internals
56+ property bool isGradient: styledItem.backgroundColor != styledItem.headerColor ||
57+ styledItem.backgroundColor != styledItem.footerColor
58+ /*
59+ As we don't know the order the property bindings and onXXXChanged signals are evaluated
60+ we should rely only on one property when changing the theme to avoid intermediate
61+ theme changes due to properties being evaluated separately.
62+
63+ Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
64+ */
65+ property string theme: (ColorUtils.luminance(styledItem.backgroundColor) >= 0.85) ? "Ambiance" :
66+ (isGradient ? "SuruGradient" : "SuruDark")
67+ }
68+
69+ // automatically select the appropriate theme depending on the background colors
70+ Binding {
71+ target: theme
72+ property: "name"
73+ value: internals.theme
74+ when: internals.theme !== ""
75+ }
76+}
qml/Stages/PageHeadStyle.qmlnew file+71
@@ -0,0 +1,71 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+import QtQuick 2.2
17+import Ubuntu.Components 1.1
18+import Ubuntu.Components.Styles 1.1 as Style
19+
20+// FIXME: copied with large modifications from Ubuntu UI Toolkit's Ambiance's theme
21+Style.PageHeadStyle {
22+ id: headerStyle
23+
24+ contentHeight: units.gu(7)
25+ separatorSource: "graphics/PageHeaderBaseDividerLight.sci"
26+ separatorBottomSource: "graphics/PageHeaderBaseDividerBottom.png"
27+ fontWeight: Font.Light
28+ fontSize: "x-large"
29+ textColor: styledItem.config.foregroundColor
30+ textLeftMargin: units.gu(2)
31+
32+ implicitHeight: headerStyle.contentHeight
33+ property var theme
34+
35+ Label {
36+ anchors {
37+ left: parent.left
38+ leftMargin: headerStyle.textLeftMargin
39+ right: parent.right
40+ verticalCenter: parent.verticalCenter
41+ }
42+ LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
43+ text: styledItem.title
44+ font.weight: headerStyle.fontWeight
45+ fontSize: headerStyle.fontSize
46+ color: headerStyle.textColor
47+ elide: Text.ElideRight
48+ }
49+
50+ BorderImage {
51+ id: separator
52+ anchors {
53+ top: parent.bottom
54+ topMargin: separatorBottom.height
55+ left: parent.left
56+ right: parent.right
57+ }
58+ source: headerStyle.separatorSource
59+ height: styledItem.config.sections.model !== undefined ? units.gu(3) : units.gu(2)
60+ }
61+
62+ Image {
63+ id: separatorBottom
64+ anchors {
65+ top: separator.bottom
66+ left: parent.left
67+ right: parent.right
68+ }
69+ source: headerStyle.separatorBottomSource
70+ }
71+}
qml/Stages/Splash.qml+40−32
@@ -14,50 +14,58 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515*/
1616
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
19+import Ubuntu.Components.Themes 0.1
1920import "../Components"
2021
21−Rectangle {
22+StyledItem {
2223 id: root
23− color: "black"
2424
2525 property string name: ""
2626 property url image: ""
2727
28− UbuntuShape {
29− id: iconShape
30− anchors.horizontalCenter: parent.horizontalCenter
31− anchors.verticalCenter: parent.verticalCenter
32− anchors.verticalCenterOffset: -units.gu(4)
33− width: units.gu(8)
34− height: units.gu(7.5)
28+ // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
29+ property var theme: QtObject {
30+ property string name
31+ property Palette palette: paletteLoader.item
32+ }
33+
34+ Loader {
35+ id: paletteLoader
36+ source: "%1Palette.qml".arg(theme.name)
37+ }
38+
39+ // mimic API of toolkit's MainView component required by MainViewStyle
40+ property color headerColor: backgroundColor
41+ // FIXME: should be read from desktop file and set by SpreadDelegate
42+ property color backgroundColor: theme.palette.normal.background
43+ property color footerColor: backgroundColor
3544
36− radius: "medium"
37− borderSource: "none"
45+ // FIXME: should instead use to be created API from toolkit
46+ // style: theme.createStyleComponent("MainViewStyle.qml", root)
47+ style: Component { MainViewStyle {theme: root.theme} }
3848
39− image: Image {
40− id: iconImage
41− sourceSize.width: iconShape.width
42− sourceSize.height: iconShape.height
43− source: root.image
44− fillMode: Image.PreserveAspectCrop
49+ StyledItem {
50+ id: header
51+ anchors {
52+ left: parent.left
53+ right: parent.right
4554 }
46− }
4755
48− Label {
49− text: root.name
50− anchors.horizontalCenter: parent.horizontalCenter
51− anchors.top: iconShape.bottom
52− anchors.topMargin: units.gu(2)
53− fontSize: "large"
54− }
56+ // mimic API of toolkit's AppHeader component required by PageHeadStyle
57+ property Item pageStack
58+ property Item contents
59+ property string title: root.name
60+ property var tabsModel
61+ property var config: QtObject {
62+ property color foregroundColor: theme.palette.selected.backgroundText
63+ property var sections
64+ }
5565
56− WaitingDots {
57− visible: parent.visible
58− anchors.horizontalCenter: parent.horizontalCenter
59− anchors.bottom: parent.bottom
60− anchors.bottomMargin: units.gu(12)
66+ // FIXME: should instead use to be created API from toolkit:
67+ // style: theme.createStyleComponent("PageHeadStyle.qml", header)
68+ style: Component { PageHeadStyle {theme: root.theme} }
6169 }
6270
6371 MouseArea {
qml/Stages/SpreadDelegate.qml+28−2
@@ -52,8 +52,33 @@ Item {
5252 }
5353
5454 function revealSurface() {
55− surface.visible = true;
56− splashLoader.source = "";
55+ revealAnimation.start();
56+ }
57+
58+ SequentialAnimation {
59+ id: revealAnimation
60+
61+ PropertyAction {
62+ target: surface
63+ property: "opacity"
64+ value: 0.0
65+ }
66+ PropertyAction {
67+ target: surface
68+ property: "visible"
69+ value: true
70+ }
71+ UbuntuNumberAnimation {
72+ target: surface
73+ property: "opacity"
74+ from: 0.0
75+ to: 1.0
76+ }
77+ PropertyAction {
78+ target: splashLoader
79+ property: "source"
80+ value: ""
81+ }
5782 }
5883
5984 Binding {
@@ -143,6 +168,7 @@ Item {
143168 Loader {
144169 id: splashLoader
145170 anchors.fill: surfaceContainer
171+ anchors.topMargin: maximizedAppTopMargin
146172 }
147173
148174 DraggingArea {
qml/Stages/SuruDarkPalette.qmlnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 1.1
19+import Ubuntu.Components.Themes 0.1
20+
21+// FIXME: copied without modifications from Ubuntu UI Toolkit's SuruDark's theme
22+Palette {
23+ normal: PaletteValues {
24+ background: "#221E1C"
25+ backgroundText: "#33F3F3E7"
26+ base: "#19000000"
27+ baseText: "#F3F3E7"
28+ foreground: "#888888"
29+ foregroundText: "#F3F3E7"
30+ overlay: "#F2F2F2"
31+ overlayText: "#888888"
32+ field: "#19000000"
33+ fieldText: "#7F7F7F7F"
34+ }
35+ selected: PaletteValues {
36+ background: "#88D6D6D6" // FIXME: not from design
37+ backgroundText: "#F3F3E7"
38+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
39+ foreground: UbuntuColors.orange
40+ foregroundText: UbuntuColors.darkGrey
41+ field: "#FFFFFF"
42+ fieldText: "#888888"
43+ }
44+}
qml/Stages/SuruGradientPalette.qmlnew file+42
@@ -0,0 +1,42 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components.Themes 0.1
19+
20+// FIXME: copied without modifications from Ubuntu UI Toolkit's SuruGradient's theme
21+Palette {
22+ normal: PaletteValues {
23+ background: "#5E2750"
24+ backgroundText: "#33F3F3E7"
25+ base: "#19000000"
26+ baseText: "#F3F3E7"
27+ foreground: "#888888"
28+ foregroundText: "#F3F3E7"
29+ overlay: "#F5F5F5"
30+ overlayText: "#888888"
31+ field: "#19000000"
32+ fieldText: "#7F7F7F7F"
33+ }
34+ selected: PaletteValues {
35+ background: "#88D6D6D6" // FIXME: not from design
36+ backgroundText: "#F3F3E7"
37+ foreground: "#DD4814"
38+ foregroundText: "#F3F3E7"
39+ field: "#FFFFFF"
40+ fieldText: "#888888"
41+ }
42+}
qml/Stages/WaitingDots.qmldeleted−76
@@ -1,76 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.2
18−import Ubuntu.Components 0.1
19−
20−Item {
21− id: waitingDots
22−
23− // center in parent; waitingDots has no size therefore anchors.centerIn cannot be used
24− x: parent.width / 2
25− y: parent.height / 2
26−
27− property var dots: [dot1, dot2, dot3]
28− property var vertices: [[-units.gu(1), -units.gu(1)],
29− [units.gu(1), -units.gu(1)],
30− [0, units.gu(1)]]
31− property int shift: 0
32−
33− function cycle () {
34− var n = vertices.length;
35− shift = (shift + 1) % n;
36−
37− for (var i = 0; i < n; i++) {
38− dots[i].x = vertices[(i+shift) % n][0];
39− dots[i].y = vertices[(i+shift) % n][1];
40− }
41− }
42−
43− Timer {
44− interval: 800
45− running: waitingDots.visible
46− repeat: true
47− triggeredOnStart: true
48− onTriggered: waitingDots.cycle()
49− }
50−
51−
52− Dot {
53− id: dot1
54− x: vertices[0][0]
55− y: vertices[0][1]
56− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
57− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
58− }
59−
60− Dot {
61− id: dot2
62− x: vertices[1][0]
63− y: vertices[1][1]
64− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
65− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
66−
67− }
68−
69− Dot {
70− id: dot3
71− x: vertices[2][0]
72− y: vertices[2][1]
73− Behavior on x {XAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
74− Behavior on y {YAnimator {duration: UbuntuAnimation.BriskDuration; easing: UbuntuAnimation.StandardEasing}}
75− }
76−}
qml/Stages/graphics/PageHeaderBaseDividerBottom@18.pngnew file

Binary file not shown.

qml/Stages/graphics/PageHeaderBaseDividerLight@18.pngnew file

Binary file not shown.

qml/Stages/graphics/PageHeaderBaseDividerLight@18.scinew file+5
@@ -0,0 +1,5 @@
1+border.top: 4
2+border.bottom: 0
3+border.left: 0
4+border.right: 0
5+source: PageHeaderBaseDividerLight@18.png
qml/Stages/graphics/background_paper@27.pngnew file

Binary file not shown.