examples/QtQuick/qmlaudioplayer/qml/qmlaudioplayer/AudioPlayerPage.qml

00001 import QtQuick 1.0
00002 import QtMultimediaKit 1.1
00003 import com.nokia.symbian 1.0
00004 
00005 Page{
00006     tools: commonTools
00007 
00008     property alias myaudio: audio
00009 
00010     ToolBarLayout {
00011         id: commonTools
00012         ToolButton {
00013             flat: true
00014             iconSource: "toolbar_back.svg"
00015             onClicked: Qt.quit()
00016         }
00017         ToolButton {
00018             flat: true
00019             iconSource: "toolbar_options.svg"
00020             onClicked: pageStack.push(filePickerPage)
00021         }
00022     }
00023 
00024 
00025 
00026     Audio{ id: audio; source: "music.wav"; volume: 0.5 }
00027 
00028     Row{
00029         id: audioControls
00030         width: parent.width
00031         anchors.bottom: parent.bottom
00032         height: 80
00033         Button{
00034             width: parent.width/2
00035             iconSource: "toolbar_play.svg"
00036             onClicked: audio.play()
00037         }
00038         Button{
00039             width: parent.width/2
00040             iconSource: "toolbar_stop.svg"
00041             onClicked: audio.stop()
00042         }
00043     }
00044 
00045     Item {
00046         id: seekSlider
00047 
00048         anchors { bottom: audioControls.top; bottomMargin: 25 }
00049         width: parent.width
00050         height: slider.height + positionTime.height
00051 
00053         Slider {
00054             id: slider
00055 
00056             anchors.top: parent.top
00057             width: parent.width
00058             maximumValue: audio.duration
00059             stepSize: 1000
00060 
00061             onPressedChanged: {
00062                 if (!pressed)
00063                     audio.position = value
00064             }
00065 
00066             Binding {
00067                 target: slider
00068                 property: "value"
00069                 value: audio.position
00070                 when: !slider.pressed
00071             }
00072         }
00074 
00075         Text {
00076             id: positionTime
00077 
00078             anchors { left: parent.left; top: slider.bottom; leftMargin: 15; topMargin: 4 }
00079             color: "white"
00080             font.pixelSize: 18
00081             text: audio.position/1000
00082         }
00083 
00084         Text {
00085             id: durationTime
00086 
00087             anchors { right: parent.right; top: slider.bottom; rightMargin: 15; topMargin: 4 }
00088             color: "white"
00089             font.pixelSize: 18
00090             text: audio.duration/1000 - audio.position/1000
00091         }
00092     }
00093 
00094     Item {
00095         id: infoText
00096 
00097         anchors { bottom: seekSlider.top; bottomMargin: 36 }
00098         width: parent.width
00099         height: title.height + artist.height + 15
00100         clip: true
00101 
00102         Text {
00103             id: artist
00104 
00105             width: parent.width
00106             anchors { bottom: title.top; bottomMargin: 18 }
00107             horizontalAlignment: Text.AlignHCenter
00108             //audio.metaData.albumArtist
00109             text: audio.metaData.albumArtist
00110             color: "white"
00111             font.pixelSize: 28
00112             wrapMode: Text.WordWrap
00113             visible: audio.metaData.albumArtist != "" ? true : false
00114 
00115             Behavior on text {
00116                 NumberAnimation {
00117                     target: artist
00118                     property: "opacity"
00119                     from: 0
00120                     to: 1
00121                     duration: 1000
00122                 }
00123             }
00124         }
00125 
00126         Text {
00127             id: title
00128 
00129             width: parent.width
00130             anchors.bottom: parent.bottom
00131             horizontalAlignment: Text.AlignHCenter
00132             //audio.metaData.title
00133             text: audio.metaData.title
00134             color: "white"
00135             font.pixelSize: 20
00136             wrapMode: Text.WordWrap
00137 
00138             Behavior on text {
00139                 NumberAnimation {
00140                     target: title
00141                     property: "opacity"
00142                     from: 0
00143                     to: 1
00144                     duration: 1000
00145                 }
00146             }
00147         }
00148 
00149     }
00150 
00151 }
00152 

Generated by  doxygen 1.6.2