on xenial help sign in
review fixes

centralize color definition fix variable name update (C) year bind some anchors to -height

commit4e68c9f48bb7dc8f157e7343e9037463b4e3e6f5 authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 9 May 2016, 17:24 (10 years ago) parente355bba
5 files changed+35−30
qml/Components/MediaServices/MediaServices.qml+18−18 qml/Components/MediaServices/MediaServicesControls.qml+8−5 qml/Components/MediaServices/MediaServicesHeader.qml+2−2 qml/Components/MediaServices/VideoPlayer.qml+4−2 qml/Components/MediaServices/VideoPlayerControls.qml+3−3
qml/Components/MediaServices/MediaServices.qml+18−18
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2015 Canonical, Ltd.
2+ * Copyright (C) 2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -37,6 +37,9 @@ FocusScope {
3737 if (!fullscreen) rotationAction.checked = false;
3838 }
3939
40+ readonly property color backgroundColor: "#1B1B1B"
41+ readonly property color iconColor: "#F3F3E7"
42+
4043 OrientationHelper {
4144 id: orientationHelper
4245 automaticOrientation: fullscreen
@@ -88,7 +91,7 @@ FocusScope {
8891
8992 Rectangle {
9093 anchors.fill: parent
91− color: "#1B1B1B"
94+ color: root.backgroundColor
9295 opacity: 0.85
9396 }
9497
@@ -104,6 +107,9 @@ FocusScope {
104107 fixedHeight: fullscreen
105108 orientation: orientationState.state == "landscape" ? Qt.LandscapeOrientation : Qt.PortraitOrientation
106109
110+ playButtonBackgroundColor: root.backgroundColor
111+ playButtonIconColor: root.iconColor
112+
107113 screenshot: {
108114 var screenshot = root.sourceData["screenshot"];
109115 if (screenshot) return screenshot;
@@ -145,7 +151,7 @@ FocusScope {
145151 top: contentLoader.top
146152 left: parent.left
147153 right: parent.right
148− topMargin: -units.gu(6)
154+ topMargin: -headerContent.height
149155 }
150156 height: units.gu(6)
151157 visible: false
@@ -157,7 +163,7 @@ FocusScope {
157163
158164 Rectangle {
159165 anchors.fill: parent
160− color: "#1B1B1B"
166+ color: root.backgroundColor
161167 opacity: 0.85
162168 visible: headerContent.status === Loader.Ready
163169 }
@@ -172,14 +178,6 @@ FocusScope {
172178 rotationAction.checked = false;
173179 root.close();
174180 }
175−
176− component: {
177− switch (context) {
178− case "video":
179− break;
180− }
181− return undefined;
182− }
183181 }
184182 }
185183
@@ -199,7 +197,7 @@ FocusScope {
199197 left: parent.left
200198 right: parent.right
201199 bottom: contentLoader.bottom
202− bottomMargin: -units.gu(7)
200+ bottomMargin: -footerContent.height
203201 }
204202 height: units.gu(7)
205203 visible: false
@@ -218,7 +216,7 @@ FocusScope {
218216
219217 Rectangle {
220218 anchors.fill: parent
221− color: "#1B1B1B"
219+ color: root.backgroundColor
222220 opacity: 0.85
223221 visible: footerContent.status === Loader.Ready
224222 }
@@ -231,15 +229,17 @@ FocusScope {
231229
232230 viewAction: rotationAction.enabled ? rotationAction : fullscreenAction
233231 userActions: root.actions
232+ iconColor: root.iconColor
233+ backgroundColor: root.backgroundColor
234234
235235 mediaPlayer.source: {
236236 if (!root.sourceData) return "";
237237
238− var x = root.sourceData["source"];
239− if (x.toString().indexOf("video://") === 0) {
240− return x.toString().substr(6);
238+ var source = root.sourceData["source"];
239+ if (source.toString().indexOf("video://") === 0) {
240+ return source.toString().substr(6);
241241 }
242− return x;
242+ return source;
243243 }
244244 mediaPlayer.onPlaybackStateChanged: {
245245 controlHideTimer.restart();
qml/Components/MediaServices/MediaServicesControls.qml+8−5
@@ -31,6 +31,9 @@ Item {
3131 property list<Action> userActions
3232 property Action viewAction
3333
34+ property color iconColor
35+ property color backgroundColor
36+
3437 RowLayout {
3538 anchors {
3639 left: parent.left
@@ -68,7 +71,7 @@ Item {
6871 anchors.fill: parent
6972 visible: actionButton.action && actionButton.action.iconSource !== "" || false
7073 source: actionButton.action ? actionButton.action.iconSource : ""
71− color: "#F3F3E7"
74+ color: root.iconColor
7275 opacity: actionButton.action && actionButton.action.enabled ? 1.0 : 0.5
7376 }
7477 }
@@ -91,7 +94,7 @@ Item {
9194 anchors.fill: parent
9295 visible: viewAction.iconSource !== ""
9396 source: viewAction.iconSource
94− color: "#F3F3E7"
97+ color: root.iconColor
9598 opacity: viewAction.enabled ? 1.0 : 0.5
9699 }
97100 }
@@ -102,7 +105,7 @@ Item {
102105
103106 Rectangle {
104107 id: popup
105− color: "#1B1B1B"
108+ color: root.backgroundColor
106109 width: userActionsColumn.width
107110 height: userActionsColumn.height
108111
@@ -147,7 +150,7 @@ Item {
147150 id: actionIcon
148151 visible: "" !== action.iconSource
149152 source: action.iconSource
150− color: "#F3F3E7"
153+ color: root.iconColor
151154 anchors {
152155 verticalCenter: parent.verticalCenter
153156 verticalCenterOffset: units.dp(-1)
@@ -172,7 +175,7 @@ Item {
172175 fontSize: actionIcon.visible ? "small" : "medium"
173176 elide: Text.ElideRight
174177 text: action.text
175− color: "#F3F3E7"
178+ color: root.iconColor
176179 opacity: action.enabled ? 1.0 : 0.5
177180 }
178181
qml/Components/MediaServices/MediaServicesHeader.qml+2−2
@@ -23,6 +23,7 @@ Item {
2323
2424 property alias title: _title.text
2525 property alias component: loader.sourceComponent
26+ property alias iconColor: _title.color
2627
2728 signal goPrevious
2829
@@ -47,7 +48,7 @@ Item {
4748 Icon {
4849 anchors.fill: parent
4950 name: "go-previous"
50− color: "#F3F3E7"
51+ color: _title.color
5152 }
5253
5354 onTriggered: {
@@ -60,7 +61,6 @@ Item {
6061 Layout.fillWidth: true
6162 Layout.alignment: Qt.AlignVCenter
6263 elide: Text.ElideRight
63− color: "#F3F3E7"
6464 }
6565
6666 Loader {
qml/Components/MediaServices/VideoPlayer.qml+4−2
@@ -29,6 +29,9 @@ Item {
2929 property bool fixedHeight: false
3030 property var maximumEmbeddedHeight
3131
32+ property alias playButtonBackgroundColor: playButton.color
33+ property alias playButtonIconColor: playButtonIcon.color
34+
3235 implicitHeight: {
3336 if (parent && orientation == Qt.LandscapeOrientation) {
3437 return parent.height;
@@ -112,17 +115,16 @@ Item {
112115 width: bigButton ? units.gu(10) : units.gu(8)
113116 height: width
114117 visible: mediaPlayer && mediaPlayer.playbackState !== MediaPlayer.PlayingState || false
115− color: "#1B1B1B"
116118 opacity: 0.85
117119 radius: width/2
118120
119121 Behavior on width { UbuntuNumberAnimation {} }
120122
121123 Icon {
124+ id: playButtonIcon
122125 anchors.fill: parent
123126 anchors.margins: units.gu(1)
124127 name: errorTimer.running ? "dialog-warning-symbolic" : "media-playback-start"
125− color: "#F3F3E7"
126128 }
127129 }
128130
qml/Components/MediaServices/VideoPlayerControls.qml+3−3
@@ -81,7 +81,7 @@ MediaServicesControls {
8181 }
8282 verticalAlignment: Text.AlignBottom
8383 fontSize: "x-small"
84− color: "#F3F3E7"
84+ color: root.iconColor
8585
8686 text: priv.formatProgress(mediaPlayer.position)
8787 }
@@ -102,7 +102,7 @@ MediaServicesControls {
102102 value: mediaPlayer.position
103103
104104 onStyleInstanceChanged: {
105− if (__styleInstance) __styleInstance.backgroundColor = "#F3F3E7";
105+ if (__styleInstance) __styleInstance.backgroundColor = root.iconColor;
106106 }
107107
108108 onValueChanged: {
@@ -141,7 +141,7 @@ MediaServicesControls {
141141 }
142142 verticalAlignment: Text.AlignBottom
143143 fontSize: "x-small"
144− color: "#F3F3E7"
144+ color: root.iconColor
145145
146146 text: priv.formatProgress(mediaPlayer.duration)
147147 }