author | llornkcor <llornkcor> | 2002-11-03 21:45:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-03 21:45:32 (UTC) |
commit | bf62b8f48d08f5a5e92681e1487a5f43d5c7a231 (patch) (unidiff) | |
tree | f2a02844f411d874e9afd703c18b6ebd70d97172 /core/multimedia/opieplayer/mediaplayer.cpp | |
parent | 5ba841a12e67b326833751ea502cf054e423114d (diff) | |
download | opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.zip opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.tar.gz opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.tar.bz2 |
m3u stuff and op2 skins
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index 64fdc01..b0963cf 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp | |||
@@ -80,56 +80,61 @@ void MediaPlayer::play() { | |||
80 | 80 | ||
81 | 81 | ||
82 | void MediaPlayer::setPlaying( bool play ) { | 82 | void MediaPlayer::setPlaying( bool play ) { |
83 | qDebug("MediaPlayer setPlaying"); | ||
83 | if ( !play ) { | 84 | if ( !play ) { |
84 | mediaPlayerState->setPaused( FALSE ); | 85 | mediaPlayerState->setPaused( FALSE ); |
85 | loopControl->stop( FALSE ); | 86 | loopControl->stop( FALSE ); |
86 | return; | 87 | return; |
87 | } | 88 | } |
88 | 89 | ||
89 | if ( mediaPlayerState->paused() ) { | 90 | if ( mediaPlayerState->paused() ) { |
90 | mediaPlayerState->setPaused( FALSE ); | 91 | mediaPlayerState->setPaused( FALSE ); |
91 | return; | 92 | return; |
92 | } | 93 | } |
93 | 94 | qDebug("about to ctrash"); | |
94 | const DocLnk *playListCurrent = playList->current(); | 95 | const DocLnk *playListCurrent = playList->current(); |
96 | |||
95 | if ( playListCurrent != NULL ) { | 97 | if ( playListCurrent != NULL ) { |
96 | loopControl->stop( TRUE ); | 98 | loopControl->stop( TRUE ); |
97 | currentFile = playListCurrent; | 99 | currentFile = playListCurrent; |
98 | } | 100 | } |
99 | if ( currentFile == NULL ) { | 101 | if ( currentFile == NULL ) { |
100 | QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); | 102 | QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); |
101 | mediaPlayerState->setPlaying( FALSE ); | 103 | mediaPlayerState->setPlaying( FALSE ); |
102 | return; | 104 | return; |
103 | } | 105 | } |
104 | 106 | ||
105 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { | 107 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { |
106 | QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); | 108 | QMessageBox::critical( 0, tr( "File not found"), |
107 | mediaPlayerState->setPlaying( FALSE ); | 109 | tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); |
108 | return; | 110 | mediaPlayerState->setPlaying( FALSE ); |
111 | return; | ||
109 | } | 112 | } |
110 | 113 | ||
111 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { | 114 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { |
112 | QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); | 115 | QMessageBox::critical( 0, tr( "No decoder found"), |
113 | mediaPlayerState->setPlaying( FALSE ); | 116 | tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); |
114 | return; | 117 | mediaPlayerState->setPlaying( FALSE ); |
118 | return; | ||
115 | } | 119 | } |
116 | 120 | ||
117 | if ( !loopControl->init( currentFile->file() ) ) { | 121 | if ( !loopControl->init( currentFile->file() ) ) { |
118 | QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); | 122 | QMessageBox::critical( 0, tr( "Error opening file"), |
119 | mediaPlayerState->setPlaying( FALSE ); | 123 | tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); |
120 | return; | 124 | mediaPlayerState->setPlaying( FALSE ); |
125 | return; | ||
121 | } | 126 | } |
122 | long seconds = loopControl->totalPlaytime(); | 127 | long seconds = loopControl->totalPlaytime(); |
123 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 128 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
124 | QString tickerText; | 129 | QString tickerText; |
125 | if( currentFile->file().left(4) == "http" ) | 130 | if( currentFile->file().left(4) == "http" ) |
126 | tickerText= tr( " File: " ) + currentFile->name(); | 131 | tickerText= tr( " File: " ) + currentFile->name(); |
127 | else | 132 | else |
128 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 133 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
129 | 134 | ||
130 | QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | 135 | QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); |
131 | if ( !fileInfo.isEmpty() ) | 136 | if ( !fileInfo.isEmpty() ) |
132 | tickerText += ", " + fileInfo; | 137 | tickerText += ", " + fileInfo; |
133 | audioUI->setTickerText( tickerText + "." ); | 138 | audioUI->setTickerText( tickerText + "." ); |
134 | 139 | ||
135 | loopControl->play(); | 140 | loopControl->play(); |