diff options
author | Juho Annunen <juho.annunen@qt.io> | 2018-04-17 15:02:13 +0300 |
---|---|---|
committer | Juho Annunen <juho.annunen@qt.io> | 2018-05-04 10:02:42 +0000 |
commit | 04e4798de567c64a08e962f541b5dd35d60fedd3 (patch) | |
tree | bbcfbc6f8c6bbc5be45c72b2e869c84fa588e478 /basicsuite/mediaplayer/ControlBar.qml | |
parent | 2e8942fe7661ba75da5c45d214d2efd6212910c8 (diff) |
Update Mediaplayer demo to new UI theme
Task-number: QTBUG-62791
Change-Id: Id7cb520669fc696cec65da591414b045fe45754a
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Diffstat (limited to 'basicsuite/mediaplayer/ControlBar.qml')
-rw-r--r--[-rwxr-xr-x] | basicsuite/mediaplayer/ControlBar.qml | 128 |
1 files changed, 44 insertions, 84 deletions
diff --git a/basicsuite/mediaplayer/ControlBar.qml b/basicsuite/mediaplayer/ControlBar.qml index 05d253e..e65a3a3 100755..100644 --- a/basicsuite/mediaplayer/ControlBar.qml +++ b/basicsuite/mediaplayer/ControlBar.qml @@ -53,8 +53,8 @@ import QtMultimedia 5.0 Rectangle { id: controlBar - height: 150 - color: "#88333333" + height: parent.height * 0.225 + color: defaultBackground property MediaPlayer mediaPlayer: null property bool isMouseAbove: false @@ -73,13 +73,13 @@ Rectangle { volumeControl.volume = mediaPlayer.volume; } -// MouseArea { -// anchors.fill: controlBar -// hoverEnabled: true + MouseArea { + anchors.fill: controlBar + hoverEnabled: true -// onEntered: controlBar.isMouseAbove = true; -// onExited: controlBar.isMouseAbove = false; -// } + onEntered: controlBar.isMouseAbove = true; + onExited: controlBar.isMouseAbove = false; + } function statusString(stat) { @@ -103,48 +103,12 @@ Rectangle { return "UnknownStatus"; } -// Text { -// id: statusText -// anchors.left: parent.left -// anchors.bottom: parent.top -// anchors.bottomMargin: 12 -// font.pixelSize: 18 -// color: "white" -// text: "Status: " + statusString(mediaPlayer.status) -// } - -// Text { -// anchors.verticalCenter: statusText.verticalCenter -// anchors.left: statusText.right -// anchors.leftMargin: 16 -// font.pixelSize: 18 -// color: "white" -// text: Math.round(mediaPlayer.bufferProgress * 100.0) + "%" -// } - - VolumeControl { - id: volumeControl - anchors.verticalCenter: playbackControl.verticalCenter - anchors.left: controlBar.left - anchors.leftMargin: 15 - onVolumeChanged: mediaPlayer.volume = volume - - Component.onCompleted: { - volumeControl.volume = 0.5; - } - - Connections { - target: mediaPlayer - onVolumeChanged: volumeControl.volume = mediaPlayer.volume - } - } - //Playback Controls PlaybackControl { id: playbackControl - anchors.horizontalCenter: controlBar.horizontalCenter - anchors.bottom: seekControl.top - anchors.bottomMargin: 20 + anchors.left: controlBar.left + anchors.top: controlBar.top + anchors.bottom: controlBar.bottom onPlayButtonPressed: { if (isPlaying) { @@ -171,12 +135,35 @@ Rectangle { onStopButtonPressed: mediaPlayer.stop(); } + //Seek controls + SeekControl { + id: seekControl + anchors.bottom: controlBar.bottom + anchors.bottomMargin: controlBar.height * 0.1 + anchors.right: volumeControl.left + anchors.left: playbackControl.right + anchors.rightMargin: 15 + anchors.leftMargin: 15 + enabled: playbackControl.isPlaybackEnabled + + duration: mediaPlayer.duration + + onSeekValueChanged: { + mediaPlayer.seek(newPosition); + position = mediaPlayer.position; + } + + Component.onCompleted: { + seekable = mediaPlayer.seekable; + } + } + //Toolbar Controls Row { id: toolbarMenuButtons - anchors.right: controlBar.right + anchors.right: volumeControl.left anchors.rightMargin: 15 - anchors.verticalCenter: playbackControl.verticalCenter + anchors.bottom: seekControl.top spacing: 22 ImageButton { @@ -204,41 +191,15 @@ Rectangle { } } -// ImageButton { -// id: fullscreenButton -// imageSource: "images/FullscreenButton.png" -// onClicked: { -// //Toggle fullscreen -// toggleFullScreen(); -// } -// checkable: true -// checked: applicationWindow.isFullScreen -// anchors.right: controlBar.right -// anchors.top: controlBar.top -// anchors.rightMargin: 15 -// anchors.topMargin: 15 -// } - - //Seek controls - SeekControl { - id: seekControl - anchors.bottom: controlBar.bottom - anchors.bottomMargin: 10 - anchors.right: controlBar.right - anchors.left: controlBar.left - anchors.rightMargin: 15 - anchors.leftMargin: 15 - enabled: playbackControl.isPlaybackEnabled - - duration: mediaPlayer.duration - - onSeekValueChanged: { - mediaPlayer.seek(newPosition); - position = mediaPlayer.position; - } + VolumeControl { + id: volumeControl + anchors.bottom: parent.bottom + anchors.right: parent.right + onVolumeChanged: mediaPlayer.volume = volume - Component.onCompleted: { - seekable = mediaPlayer.seekable; + Connections { + target: mediaPlayer + onVolumeChanged: volumeControl.volume = mediaPlayer.volume } } @@ -264,7 +225,6 @@ Rectangle { } onSeekableChanged: { - // console.log("seekableChanged: " + mediaPlayer.seekable); seekControl.seekable = mediaPlayer.seekable; } } |