on xenial help sign in
Review nitpicks
commit117f45f16cd583da043f186fce3e1834b7992956 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 11 May 2016, 17:58 (10 years ago) parent4e68c9f
12 files changed+29−50
qml/Components/MediaServices/MediaServices.qml+5−4 qml/Components/MediaServices/MediaServicesControls.qml+3−3 qml/Components/MediaServices/MediaServicesHeader.qml+7−7 qml/Components/MediaServices/VideoPlayer.qml+4−4 qml/Components/MediaServices/VideoPlayerControls.qml+1−23 qml/Dash/Previews/PreviewInlineVideo.qml+1−2 tests/mocks/QtMultimedia/VideoSurface.qml+1−1 tests/mocks/QtMultimedia/mediaplayer.cpp+1−2 tests/mocks/QtMultimedia/videooutput.cpp+1−1 tests/mocks/QtMultimedia/videooutput.h+1−1 tests/qmltests/Components/tst_MediaServices.qml+3−1 tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+1−1
qml/Components/MediaServices/MediaServices.qml+5−4
@@ -105,14 +105,14 @@ FocusScope {
105105 height: orientationHelper.height
106106 maximumEmbeddedHeight: root.maximumEmbeddedHeight
107107 fixedHeight: fullscreen
108− orientation: orientationState.state == "landscape" ? Qt.LandscapeOrientation : Qt.PortraitOrientation
108+ orientation: orientationState.state === "landscape" ? Qt.LandscapeOrientation : Qt.PortraitOrientation
109109
110110 playButtonBackgroundColor: root.backgroundColor
111111 playButtonIconColor: root.iconColor
112112
113113 screenshot: {
114− var screenshot = root.sourceData["screenshot"];
115− if (screenshot) return screenshot;
114+ var screenshotData = root.sourceData["screenshot"];
115+ if (screenshotData) return screenshotData;
116116
117117 var source = root.sourceData["source"];
118118 if (source) {
@@ -168,7 +168,8 @@ FocusScope {
168168 visible: headerContent.status === Loader.Ready
169169 }
170170
171− sourceComponent: root.fullscreen ? headerComponent : undefined
171+ active: root.fullscreen
172+ sourceComponent: headerComponent
172173
173174 Component {
174175 id: headerComponent
qml/Components/MediaServices/MediaServicesControls.qml+3−3
@@ -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
@@ -38,9 +38,9 @@ Item {
3838 anchors {
3939 left: parent.left
4040 right: parent.right
41+ verticalCenter: parent.verticalCenter
42+ margins: units.gu(2)
4143 }
42− anchors.verticalCenter: parent.verticalCenter
43− anchors.margins: units.gu(2)
4444 spacing: units.gu(2)
4545
4646 AbstractButton {
qml/Components/MediaServices/MediaServicesHeader.qml+7−7
@@ -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
@@ -21,9 +21,9 @@ import Ubuntu.Components 1.3
2121Item {
2222 id: root
2323
24− property alias title: _title.text
24+ property alias title: titleLabel.text
2525 property alias component: loader.sourceComponent
26− property alias iconColor: _title.color
26+ property alias iconColor: titleLabel.color
2727
2828 signal goPrevious
2929
@@ -32,9 +32,9 @@ Item {
3232 anchors {
3333 left: parent.left
3434 right: parent.right
35+ verticalCenter: parent.verticalCenter
36+ margins: units.gu(2)
3537 }
36− anchors.verticalCenter: parent.verticalCenter
37− anchors.margins: units.gu(2)
3838 spacing: units.gu(2)
3939
4040 // eater
@@ -48,7 +48,7 @@ Item {
4848 Icon {
4949 anchors.fill: parent
5050 name: "go-previous"
51− color: _title.color
51+ color: titleLabel.color
5252 }
5353
5454 onTriggered: {
@@ -57,7 +57,7 @@ Item {
5757 }
5858
5959 Label {
60− id: _title
60+ id: titleLabel
6161 Layout.fillWidth: true
6262 Layout.alignment: Qt.AlignVCenter
6363 elide: Text.ElideRight
qml/Components/MediaServices/VideoPlayer.qml+4−4
@@ -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
@@ -33,7 +33,7 @@ Item {
3333 property alias playButtonIconColor: playButtonIcon.color
3434
3535 implicitHeight: {
36− if (parent && orientation == Qt.LandscapeOrientation) {
36+ if (parent && orientation === Qt.LandscapeOrientation) {
3737 return parent.height;
3838 }
3939 return content.height;
@@ -50,7 +50,7 @@ Item {
5050 verticalCenter: parent.verticalCenter
5151 }
5252 height: {
53− if (root.orientation == Qt.LandscapeOrientation || fixedHeight) {
53+ if (root.orientation === Qt.LandscapeOrientation || fixedHeight) {
5454 return root.height;
5555 }
5656 var proposedHeight = videoOutput.height;
@@ -67,8 +67,8 @@ Item {
6767 anchors {
6868 left: parent.left
6969 right: parent.right
70+ verticalCenter: parent.verticalCenter
7071 }
71− anchors.verticalCenter: parent.verticalCenter
7272 scaleTo: "width"
7373 lastScaledDimension: playButton.height + units.gu(2)
7474 initialHeight: lastScaledDimension
qml/Components/MediaServices/VideoPlayerControls.qml+1−23
@@ -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
@@ -147,26 +147,6 @@ MediaServicesControls {
147147 }
148148 }
149149
150− function getPlaybackState(playbackState) {
151− if (playbackState === MediaPlayer.PlayingState) return "PlayingState";
152− else if (playbackState === MediaPlayer.PausedState) return "PausedState";
153− else if (playbackState === MediaPlayer.StoppedState) return "StoppedState";
154− return "";
155− }
156−
157− function getPlayerStatus(status) {
158− if (status === MediaPlayer.NoMedia) return "NoMedia";
159− else if (status === MediaPlayer.Loading) return "Loading";
160− else if (status === MediaPlayer.Loaded) return "Loaded";
161− else if (status === MediaPlayer.Buffering) return "Buffering";
162− else if (status === MediaPlayer.Stalled) return "Stalled";
163− else if (status === MediaPlayer.Buffered) return "Buffered";
164− else if (status === MediaPlayer.EndOfMedia) return "EndOfMedia";
165− else if (status === MediaPlayer.InvalidMedia) return "InvalidMedia";
166− else if (status === MediaPlayer.UnknownStatus) return "UnknownStatus";
167− return "";
168− }
169−
170150 MediaPlayer {
171151 id: _mediaPlayer
172152 objectName: "mediaPlayer"
@@ -176,7 +156,5 @@ MediaServicesControls {
176156 stop();
177157 }
178158 }
179−// onPlaybackStateChanged: console.log("PLAYBACK STATE CHANGED", getPlaybackState(playbackState));
180−// onStatusChanged: console.log("PLAYER STATUS CHANGED", getPlayerStatus(status));
181159 }
182160}
qml/Dash/Previews/PreviewInlineVideo.qml+1−2
@@ -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
@@ -18,7 +18,6 @@ import QtQuick 2.4
1818import QtMultimedia 5.0
1919import Ubuntu.Components 1.3
2020import Ubuntu.Thumbnailer 0.1
21−//import Ubuntu.Content 0.1
2221import "../../Components/MediaServices"
2322
2423/*! \brief Preview widget for video.
tests/mocks/QtMultimedia/VideoSurface.qml+1−1
@@ -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
tests/mocks/QtMultimedia/mediaplayer.cpp+1−2
@@ -120,7 +120,6 @@ void MediaPlayer::setPlaylist(DeclarativePlaylist *playlist)
120120 Q_EMIT playlistChanged();
121121}
122122
123−
124123MediaPlayer::PlaybackState MediaPlayer::playbackState() const
125124{
126125 return m_playbackState;
@@ -186,7 +185,6 @@ void MediaPlayer::seek(int position)
186185 m_position = newPosition;
187186 Q_EMIT positionChanged(m_position);
188187 }
189−
190188}
191189
192190void MediaPlayer::timerEvent()
@@ -229,6 +227,7 @@ QObject *MediaPlayer::metaData() const
229227}
230228
231229
230+
232231MediaDataSource::MediaDataSource(QObject *parent)
233232 : QObject(parent)
234233 , m_seekable(true)
tests/mocks/QtMultimedia/videooutput.cpp+1−1
@@ -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
tests/mocks/QtMultimedia/videooutput.h+1−1
@@ -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
tests/qmltests/Components/tst_MediaServices.qml+3−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 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
@@ -28,11 +28,13 @@ Rectangle {
2828 color: "lightgrey"
2929
3030 property var sourceData: {
31+ // TODO do we want a video or make this fake
3132 "source": "file:///home/nick/Videos/test-mpeg.ogv",
3233 "screenshot": Qt.resolvedUrl("../Dash/artwork/avatar.png")
3334 }
3435
3536 property var sourceData2: {
37+ // TODO do we want a video or make this fake
3638 "source": "file:///home/nick/Videos/test-mpeg2.ogv",
3739 "screenshot": Qt.resolvedUrl("../Dash/artwork/checkers.png")
3840 }
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+1−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2015 Canonical Ltd.
2+ * Copyright 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