summaryrefslogtreecommitdiffstats
path: root/basicsuite/Media Player/ControlBar.qml
diff options
context:
space:
mode:
authorKalle Viironen <kalle.viironen@digia.com>2014-02-21 12:03:35 +0200
committerKalle Viironen <kalle.viironen@digia.com>2014-02-21 12:04:13 +0200
commitb1f9ebae32c44ff0dc2315a1c1c363ad98aaf145 (patch)
treebad33c0a01cc4274dee43c8370a0bdcd08d6fc7f /basicsuite/Media Player/ControlBar.qml
parent9c48ce0535c7a89e32a4b0f932dc3f61e973018a (diff)
parent0325d7b4156098ef064f04208905712c5bf0174e (diff)
Merge branch 'stable' into release
* stable: (50 commits) Fix deployment of QML import plugins when building in Qt Creator Add QtWidgets dependecy to shared.pri Update title and description for Text Input demo Update content for About Boot to Qt demo Fix QML GroupBox: Binding loop detected for property [controls-touch] Deploy images Remove Sensors demo from the Qt Creator's list of examples Remove Sensor Explorer and Particles demos from launcher Fix layout issues with Qt-Everywhere (touchgallery) [qt5-launchpresentation] Don't crop the description text on nexus [launcher settings] improve visual appearance [qt5-everywhere] update preview image Fix vkb import path Fix issues in qt5-launcher presentation Remove Raspberry Pi logo from demo Fix Canvas2D error Qt5-Everywhere: show network error message fix glsl syntax in graphical effects demo Update copyright year Limit camera & mediaplayer demos to working devices ... Change-Id: I1ed9233a89ea989013b398c8480e1932949fff19
Diffstat (limited to 'basicsuite/Media Player/ControlBar.qml')
-rwxr-xr-xbasicsuite/Media Player/ControlBar.qml285
1 files changed, 0 insertions, 285 deletions
diff --git a/basicsuite/Media Player/ControlBar.qml b/basicsuite/Media Player/ControlBar.qml
deleted file mode 100755
index 1778728..0000000
--- a/basicsuite/Media Player/ControlBar.qml
+++ /dev/null
@@ -1,285 +0,0 @@
-
-import QtQuick 2.0
-import QtMultimedia 5.0
-
-Rectangle {
- id: controlBar
- height: 150
- color: "#88333333"
-
- property MediaPlayer mediaPlayer: null
- property bool isMouseAbove: false
-
- signal openFile()
- signal openCamera()
- signal openURL()
- signal openFX()
- signal toggleFullScreen()
-
- state: "VISIBLE"
-
- onMediaPlayerChanged: {
- if (mediaPlayer === null)
- return;
- volumeControl.volume = mediaPlayer.volume;
- }
-
-// MouseArea {
-// anchors.fill: controlBar
-// hoverEnabled: true
-
-// onEntered: controlBar.isMouseAbove = true;
-// onExited: controlBar.isMouseAbove = false;
-// }
-
- function statusString(stat)
- {
- if (stat === MediaPlayer.NoMedia)
- return "No Media";
- else if (stat === MediaPlayer.Loading)
- return "Loading";
- else if (stat === MediaPlayer.Loaded)
- return "Loaded";
- else if (stat === MediaPlayer.Buffering)
- return "Buffering";
- else if (stat === MediaPlayer.Stalled)
- return "Stalled";
- else if (stat === MediaPlayer.Buffered)
- return "Buffered";
- else if (stat === MediaPlayer.EndOfMedia)
- return "EndOfMedia";
- else if (stat === MediaPlayer.InvalidMedia)
- return "InvalidMedia";
- else if (stat === MediaPlayer.UnknownStatus)
- 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
-
- onPlayButtonPressed: {
- if (isPlaying) {
- mediaPlayer.pause();
- } else {
- mediaPlayer.play();
- }
- }
-
- onReverseButtonPressed: {
- if (mediaPlayer.seekable) {
- //Subtract 10 seconds
- mediaPlayer.seek(normalizeSeek(Math.round(-mediaPlayer.duration * 0.1)));
- }
- }
-
- onForwardButtonPressed: {
- if (mediaPlayer.seekable) {
- //Add 10 seconds
- mediaPlayer.seek(normalizeSeek(Math.round(mediaPlayer.duration * 0.1)));
- }
- }
-
- onStopButtonPressed: mediaPlayer.stop();
- }
-
- //Toolbar Controls
- Row {
- id: toolbarMenuButtons
- anchors.right: controlBar.right
- anchors.rightMargin: 15
- anchors.verticalCenter: playbackControl.verticalCenter
- spacing: 22
-
- ImageButton {
- id: fxButton
- imageSource: "images/FXButton.png"
- checkable: true
- checked: effectSelectionPanel.visible
- onClicked: {
- openFX();
- }
- }
- ImageButton {
- id: fileButton
- imageSource: "images/FileButton.png"
- onClicked: {
- openFile();
- }
- }
- ImageButton {
- id: urlButton
- imageSource: "images/UrlButton.png"
- onClicked: {
- openURL();
- }
- }
- }
-
-// 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;
- }
-
- Component.onCompleted: {
- seekable = mediaPlayer.seekable;
- }
- }
-
- Connections {
- target: mediaPlayer
- onPositionChanged: {
- if (!seekControl.pressed) seekControl.position = mediaPlayer.position;
- }
- onStatusChanged: {
- if ((mediaPlayer.status == MediaPlayer.Loaded) || (mediaPlayer.status == MediaPlayer.Buffered) || mediaPlayer.status === MediaPlayer.Buffering || mediaPlayer.status === MediaPlayer.EndOfMedia)
- playbackControl.isPlaybackEnabled = true;
- else
- playbackControl.isPlaybackEnabled = false;
- }
- onPlaybackStateChanged: {
- if (mediaPlayer.playbackState === MediaPlayer.PlayingState) {
- playbackControl.isPlaying = true;
- applicationWindow.resetTimer();
- } else {
- show();
- playbackControl.isPlaying = false;
- }
- }
-
- onSeekableChanged: {
- // console.log("seekableChanged: " + mediaPlayer.seekable);
- seekControl.seekable = mediaPlayer.seekable;
- }
- }
-
- function hide() {
- controlBar.state = "HIDDEN";
- }
-
- function show() {
- controlBar.state = "VISIBLE";
- }
-
- //Usage: give the value you wish to modify position,
- //returns a value between 0 and duration
- function normalizeSeek(value) {
- var newPosition = mediaPlayer.position + value;
- if (newPosition < 0)
- newPosition = 0;
- else if (newPosition > mediaPlayer.duration)
- newPosition = mediaPlayer.duration;
- return newPosition;
- }
-
- states: [
- State {
- name: "HIDDEN"
- PropertyChanges {
- target: controlBar
- opacity: 0.0
- }
- },
- State {
- name: "VISIBLE"
- PropertyChanges {
- target: controlBar
- opacity: 0.95
- }
- }
- ]
-
- transitions: [
- Transition {
- from: "HIDDEN"
- to: "VISIBLE"
- NumberAnimation {
- id: showAnimation
- target: controlBar
- properties: "opacity"
- from: 0.0
- to: 1.0
- duration: 200
- }
- },
- Transition {
- from: "VISIBLE"
- to: "HIDDEN"
- NumberAnimation {
- id: hideAnimation
- target: controlBar
- properties: "opacity"
- from: 0.95
- to: 0.0
- duration: 200
- }
- }
- ]
-}