00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 import QtQuick 1.0
00041 import com.nokia.symbian 1.0
00042 import SampleFileBrowser 1.0
00043
00044 ApplicationWindow{
00045 id:main
00046
00047
00048 Player{ id: player }
00049
00050 ToolBarLayout {
00051 id: commonTools
00052 ToolButton {
00053 flat: true
00054 iconSource: "toolbar_back.svg"
00055 onClicked: Qt.quit()
00056 }
00057 ToolButton {
00058 flat: true
00059 iconSource: "toolbar_options.svg"
00060 onClicked: browseFile.openDialog()
00061 }
00062 }
00063
00064
00065 Page{
00066 id: simpleAudioPlayerPage
00067 tools: commonTools
00068
00069
00070 MyFileBrowser{ id: browseFile }
00071
00072 PageHeading{
00073 id: heading
00074 anchors.top: parent.top
00075 width: parent.width
00076 text: qsTr("Simple Audio player")
00077 }
00078
00079 Row{
00080 id: audioControls
00081 width: parent.width
00082 height: 80
00083 anchors.bottom: parent.bottom
00084
00085 Button{
00086 width: parent.width/2
00087 iconSource: player.playing ? "toolbar_pause.svg" : "toolbar_play.svg"
00088 onClicked: player.playing ? player.pause() : player.play()
00089 }
00090
00091 Button{
00092 width: parent.width/2
00093 iconSource: "toolbar_stop.svg"
00094 onClicked: player.stop()
00095 }
00096 }
00097
00098 Item {
00099 id: seekSlider
00100
00101 anchors { bottom: audioControls.top; bottomMargin: 25 }
00102 width: parent.width
00103 height: slider.height + positionTime.height
00104
00105 Slider {
00106 id: slider
00107
00108 anchors.top: parent.top
00109 width: parent.width
00110 maximumValue: player.duration
00111 stepSize: 1000
00112
00113 onPressedChanged: {
00114 if (!pressed)
00115 player.position = value
00116 }
00117
00118 Binding {
00119 target: slider
00120 property: "value"
00121 value: player.position
00122 when: !slider.pressed
00123 }
00124 }
00125
00126 Text {
00127 id: positionTime
00128
00129 anchors { left: parent.left; top: slider.bottom; leftMargin: 15; topMargin: 4 }
00130 color: "white"
00131 font.pixelSize: 18
00132 text: player.positionTime
00133 }
00134
00135 Text {
00136 id: durationTime
00137
00138 anchors { right: parent.right; top: slider.bottom; rightMargin: 15; topMargin: 4 }
00139 color: "white"
00140 font.pixelSize: 18
00141 text: player.durationTime
00142 }
00143 }
00144
00145 Item {
00146 id: infoText
00147
00148 anchors { bottom: seekSlider.top; bottomMargin: 36 }
00149 width: parent.width
00150 height: title.height + artist.height + 15
00151 clip: true
00152
00153 Text {
00154 id: artist
00155
00156 width: parent.width
00157 anchors { bottom: title.top; bottomMargin: 18 }
00158 horizontalAlignment: Text.AlignHCenter
00159
00160 text: player.artist
00161 color: "white"
00162 font.pixelSize: 28
00163 wrapMode: Text.WordWrap
00164 visible: player.artist != "" ? true : false
00165
00166 Behavior on text {
00167 NumberAnimation {
00168 target: artist
00169 property: "opacity"
00170 from: 0
00171 to: 1
00172 duration: 1000
00173 }
00174 }
00175 }
00176
00177 Text {
00178 id: title
00179
00180 width: parent.width
00181 anchors.bottom: parent.bottom
00182 horizontalAlignment: Text.AlignHCenter
00183 text: player.title
00184 color: "white"
00185 font.pixelSize: 20
00186 wrapMode: Text.WordWrap
00187
00188 Behavior on text {
00189 NumberAnimation {
00190 target: title
00191 property: "opacity"
00192 from: 0
00193 to: 1
00194 duration: 1000
00195 }
00196 }
00197 }
00198
00199 }
00200
00201 Connections{
00202 target: browseFile
00203 onFileSelected: player.source = newSourceFile
00204 }
00205
00206 }
00207
00208
00209 Component.onCompleted: pageStack.push(simpleAudioPlayerPage)
00210 }
00211