@@ -19,26 +19,57 @@ import Ubuntu.Components 1.1
19import Ubuntu.Components.Themes 0.1
19import Ubuntu.Components.Themes 0.1
20import "../Components"
20import "../Components"
22−StyledItem {
22+import Ubuntu.Components.Themes.Ambiance 1.1 as Ambiance
25− property string title: ""
26− property string image: ""
27− property bool showHeader: true
28− // mimic API of toolkit's MainView component required by MainViewStyle
29− property color backgroundColor: theme.palette.normal.background
27+ property color backgroundColor: d.undefinedColor
30− property color headerColor: backgroundColor
28+ property color headerColor: d.undefinedColor
31− property color footerColor: backgroundColor
29+ property color footerColor: d.undefinedColor
32−
30+ property alias imageSource: overlaidImage.source
33− // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
31+ property alias title: header.title
34− property var theme: QtObject {
32+ property alias showHeader: header.visible
35− property string name: "Ambiance"
33+
36− property Palette palette: Qt.createQmlObject("import QtQuick 2.2; import Ubuntu.Components.Themes.%1 1.1; Palette {}".arg(theme.name), root, "dynamicPalette");
34+ Ambiance.Palette {
41+ // As specified in qtmir, it will set the color value to this for fields left undefined
42+ // This is also the default value of a color property in QML.
43+ readonly property color undefinedColor: "#00000000"
45+ readonly property color defaultBackgroundColor: ambiancePalette.normal.background
52+ // mimic API of toolkit's MainView component required by MainViewStyle
53+ property color backgroundColor: Qt.colorEqual(root.backgroundColor, d.undefinedColor) ? d.defaultBackgroundColor
54+ : root.backgroundColor
55+ property color headerColor: Qt.colorEqual(root.headerColor, d.undefinedColor) ? styledItem.backgroundColor
57+ property color footerColor: Qt.colorEqual(root.footerColor, d.undefinedColor) ? styledItem.backgroundColor
60+ // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
61+ property var theme: QtObject {
63+ property Palette palette: Qt.createQmlObject("import QtQuick 2.2;\
64+ import Ubuntu.Components.Themes.%1 1.1;\
65+ Palette {}".arg(styledItem.theme.name),
66+ styledItem, "dynamicPalette");
39− // FIXME: should instead use future toolkit API:
69+ // FIXME: should instead use future toolkit API:
40− // style: theme.createStyleComponent("MainViewStyle.qml", root)
70+ // style: theme.createStyleComponent("MainViewStyle.qml", styledItem)
41− style: Component { MainViewStyle {theme: root.theme} }
71+ style: Component { MainViewStyle {theme: styledItem.theme} }
43 StyledItem {
74 StyledItem {
44 id: header
75 id: header
@@ -47,39 +78,36 @@ StyledItem {
47 right: parent.right
78 right: parent.right
50− visible: root.showHeader
52 // mimic API of toolkit's AppHeader component required by PageHeadStyle
81 // mimic API of toolkit's AppHeader component required by PageHeadStyle
53 property Item pageStack
82 property Item pageStack
54 property Item contents
83 property Item contents
55− property string title: root.title
84+ property string title
56 property var tabsModel
85 property var tabsModel
57 property var config: QtObject {
86 property var config: QtObject {
58− property color foregroundColor: theme.palette.selected.backgroundText
87+ property color foregroundColor: styledItem.theme.palette.selected.backgroundText
59− property var sections
88+ property var sections: QtObject {}
62 // FIXME: should instead use future toolkit API:
91 // FIXME: should instead use future toolkit API:
63 // style: theme.createStyleComponent("PageHeadStyle.qml", header)
92 // style: theme.createStyleComponent("PageHeadStyle.qml", header)
64− style: Component { PageHeadStyle {theme: root.theme} }
93+ style: Component { PageHeadStyle {theme: styledItem.theme} }
68 id: overlaidImage
97 id: overlaidImage
69 anchors.centerIn: parent
98 anchors.centerIn: parent
70− anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
99+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
71 sourceSize {
100 sourceSize {
72 width: root.width
101 width: root.width
73 height: root.height
102 height: root.height
76 asynchronous: true
104 asynchronous: true
77 cache: false
105 cache: false
80 ActivityIndicator {
108 ActivityIndicator {
81 anchors.centerIn: parent
109 anchors.centerIn: parent
82− anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
110+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
83 running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
111 running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null