-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 809d5ac..d9a70ce 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -157,193 +157,193 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
157 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 157 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
158 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 158 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
159 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 159 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
160 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 160 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
161 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 161 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
162 | 162 | ||
163 | QPopupMenu *pmView = new QPopupMenu( this ); | 163 | QPopupMenu *pmView = new QPopupMenu( this ); |
164 | menu->insertItem( tr( "View" ), pmView ); | 164 | menu->insertItem( tr( "View" ), pmView ); |
165 | 165 | ||
166 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 166 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
167 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 167 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
168 | fullScreenButton->addTo(pmView); | 168 | fullScreenButton->addTo(pmView); |
169 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | 169 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); |
170 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 170 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
171 | scaleButton->addTo(pmView); | 171 | scaleButton->addTo(pmView); |
172 | 172 | ||
173 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 173 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
174 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 174 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
175 | 175 | ||
176 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 176 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
177 | 177 | ||
178 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 178 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
179 | tabWidget->setTabShape(QTabWidget::Triangular); | 179 | tabWidget->setTabShape(QTabWidget::Triangular); |
180 | 180 | ||
181 | QWidget *pTab; | 181 | QWidget *pTab; |
182 | pTab = new QWidget( tabWidget, "pTab" ); | 182 | pTab = new QWidget( tabWidget, "pTab" ); |
183 | // playlistView = new QListView( pTab, "playlistview" ); | 183 | // playlistView = new QListView( pTab, "playlistview" ); |
184 | // playlistView->setMinimumSize(236,260); | 184 | // playlistView->setMinimumSize(236,260); |
185 | tabWidget->insertTab( pTab,"Playlist"); | 185 | tabWidget->insertTab( pTab,"Playlist"); |
186 | 186 | ||
187 | 187 | ||
188 | // Add the playlist area | 188 | // Add the playlist area |
189 | 189 | ||
190 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 190 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
191 | d->playListFrame = vbox3; | 191 | d->playListFrame = vbox3; |
192 | d->playListFrame ->setMinimumSize(235,260); | 192 | d->playListFrame ->setMinimumSize(235,260); |
193 | 193 | ||
194 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 194 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
195 | 195 | ||
196 | d->selectedFiles = new PlayListSelection( hbox2); | 196 | d->selectedFiles = new PlayListSelection( hbox2); |
197 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 197 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
198 | 198 | ||
199 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 199 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
200 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 200 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
201 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 201 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
202 | 202 | ||
203 | 203 | ||
204 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 204 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
205 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 205 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
206 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 206 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
207 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 207 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
208 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 208 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
209 | 209 | ||
210 | QWidget *aTab; | 210 | QWidget *aTab; |
211 | aTab = new QWidget( tabWidget, "aTab" ); | 211 | aTab = new QWidget( tabWidget, "aTab" ); |
212 | audioView = new QListView( aTab, "Audioview" ); | 212 | audioView = new QListView( aTab, "Audioview" ); |
213 | audioView->setMinimumSize(233,260); | 213 | audioView->setMinimumSize(233,260); |
214 | audioView->addColumn( tr("Title"),140); | 214 | audioView->addColumn( tr("Title"),140); |
215 | audioView->addColumn(tr("Size"), -1); | 215 | audioView->addColumn(tr("Size"), -1); |
216 | audioView->addColumn(tr("Media"),-1); | 216 | audioView->addColumn(tr("Media"),-1); |
217 | audioView->setColumnAlignment(1, Qt::AlignRight); | 217 | audioView->setColumnAlignment(1, Qt::AlignRight); |
218 | audioView->setColumnAlignment(2, Qt::AlignRight); | 218 | audioView->setColumnAlignment(2, Qt::AlignRight); |
219 | audioView->setAllColumnsShowFocus(TRUE); | 219 | audioView->setAllColumnsShowFocus(TRUE); |
220 | // audioView->setMultiSelection( TRUE ); | 220 | // audioView->setMultiSelection( TRUE ); |
221 | // audioView->setSelectionMode( QListView::Extended); | 221 | // audioView->setSelectionMode( QListView::Extended); |
222 | 222 | ||
223 | tabWidget->insertTab(aTab,tr("Audio")); | 223 | tabWidget->insertTab(aTab,tr("Audio")); |
224 | 224 | ||
225 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 225 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
226 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 226 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
227 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 227 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
228 | 228 | ||
229 | 229 | ||
230 | // audioView | 230 | // audioView |
231 | populateAudioView(); | 231 | populateAudioView(); |
232 | // videowidget | 232 | // videowidget |
233 | 233 | ||
234 | QWidget *vTab; | 234 | QWidget *vTab; |
235 | vTab = new QWidget( tabWidget, "vTab" ); | 235 | vTab = new QWidget( tabWidget, "vTab" ); |
236 | videoView = new QListView( vTab, "Videoview" ); | 236 | videoView = new QListView( vTab, "Videoview" ); |
237 | videoView->setMinimumSize(233,260); | 237 | videoView->setMinimumSize(233,260); |
238 | 238 | ||
239 | videoView->addColumn(tr("Title"),140); | 239 | videoView->addColumn(tr("Title"),140); |
240 | videoView->addColumn(tr("Size"),-1); | 240 | videoView->addColumn(tr("Size"),-1); |
241 | videoView->addColumn(tr("Media"),-1); | 241 | videoView->addColumn(tr("Media"),-1); |
242 | videoView->setColumnAlignment(1, Qt::AlignRight); | 242 | videoView->setColumnAlignment(1, Qt::AlignRight); |
243 | videoView->setColumnAlignment(2, Qt::AlignRight); | 243 | videoView->setColumnAlignment(2, Qt::AlignRight); |
244 | videoView->setAllColumnsShowFocus(TRUE); | 244 | videoView->setAllColumnsShowFocus(TRUE); |
245 | // videoView->setMultiSelection( TRUE ); | 245 | // videoView->setMultiSelection( TRUE ); |
246 | // videoView->setSelectionMode( QListView::Extended); | 246 | // videoView->setSelectionMode( QListView::Extended); |
247 | 247 | ||
248 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 248 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
249 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 249 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
250 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 250 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
251 | 251 | ||
252 | tabWidget->insertTab( vTab,tr("Video")); | 252 | tabWidget->insertTab( vTab,tr("Video")); |
253 | 253 | populateVideoView(); | |
254 | 254 | ||
255 | //playlists list | 255 | //playlists list |
256 | QWidget *LTab; | 256 | QWidget *LTab; |
257 | LTab = new QWidget( tabWidget, "LTab" ); | 257 | LTab = new QWidget( tabWidget, "LTab" ); |
258 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 258 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
259 | playLists->setMinimumSize(233,260);; | 259 | playLists->setMinimumSize(233,260);; |
260 | tabWidget->insertTab(LTab,tr("Lists")); | 260 | tabWidget->insertTab(LTab,tr("Lists")); |
261 | 261 | ||
262 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 262 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
263 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 263 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
264 | 264 | ||
265 | 265 | ||
266 | // add the library area | 266 | // add the library area |
267 | 267 | ||
268 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 268 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
269 | // this, SLOT( fauxPlay( QListViewItem *) ) ); | 269 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
270 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 270 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
271 | // this, SLOT( fauxPlay( QListViewItem *)) ); | 271 | // this, SLOT( fauxPlay( QListViewItem *)) ); |
272 | 272 | ||
273 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 273 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
274 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); | 274 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
275 | 275 | ||
276 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 276 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
277 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 277 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
278 | 278 | ||
279 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 279 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
280 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 280 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
281 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 281 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
282 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 282 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
283 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 283 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
284 | 284 | ||
285 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 285 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
286 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 286 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
287 | 287 | ||
288 | setCentralWidget( vbox5 ); | 288 | setCentralWidget( vbox5 ); |
289 | 289 | ||
290 | Config cfg( "MediaPlayer" ); | 290 | Config cfg( "MediaPlayer" ); |
291 | readConfig( cfg ); | 291 | readConfig( cfg ); |
292 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 292 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
293 | // qDebug("currentList is "+currentPlaylist); | 293 | // qDebug("currentList is "+currentPlaylist); |
294 | loadList(DocLnk( currentPlaylist)); | 294 | loadList(DocLnk( currentPlaylist)); |
295 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 295 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
296 | 296 | ||
297 | initializeStates(); | 297 | initializeStates(); |
298 | } | 298 | } |
299 | 299 | ||
300 | 300 | ||
301 | PlayListWidget::~PlayListWidget() { | 301 | PlayListWidget::~PlayListWidget() { |
302 | Config cfg( "MediaPlayer" ); | 302 | Config cfg( "MediaPlayer" ); |
303 | writeConfig( cfg ); | 303 | writeConfig( cfg ); |
304 | 304 | ||
305 | 305 | ||
306 | if ( d->current ) | 306 | if ( d->current ) |
307 | delete d->current; | 307 | delete d->current; |
308 | delete d; | 308 | delete d; |
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
312 | void PlayListWidget::initializeStates() { | 312 | void PlayListWidget::initializeStates() { |
313 | 313 | ||
314 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 314 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
315 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 315 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
316 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 316 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
317 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); | 317 | // d->tbFull->setOn( mediaPlayerState->fullscreen() ); |
318 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 318 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
319 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 319 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
320 | // setPlaylist( mediaPlayerState->playlist() ); | 320 | // setPlaylist( mediaPlayerState->playlist() ); |
321 | setPlaylist( true); | 321 | setPlaylist( true); |
322 | // d->selectedFiles->first(); | 322 | // d->selectedFiles->first(); |
323 | 323 | ||
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | void PlayListWidget::readConfig( Config& cfg ) { | 327 | void PlayListWidget::readConfig( Config& cfg ) { |
328 | cfg.setGroup("PlayList"); | 328 | cfg.setGroup("PlayList"); |
329 | QString currentString = cfg.readEntry("current", "" ); | 329 | QString currentString = cfg.readEntry("current", "" ); |
330 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 330 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
331 | for ( int i = 0; i < noOfFiles; i++ ) { | 331 | for ( int i = 0; i < noOfFiles; i++ ) { |
332 | QString entryName; | 332 | QString entryName; |
333 | entryName.sprintf( "File%i", i + 1 ); | 333 | entryName.sprintf( "File%i", i + 1 ); |
334 | QString linkFile = cfg.readEntry( entryName ); | 334 | QString linkFile = cfg.readEntry( entryName ); |
335 | DocLnk lnk( linkFile ); | 335 | DocLnk lnk( linkFile ); |
336 | if ( lnk.isValid() ) { | 336 | if ( lnk.isValid() ) { |
337 | d->selectedFiles->addToSelection( lnk ); | 337 | d->selectedFiles->addToSelection( lnk ); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | d->selectedFiles->setSelectedItem( currentString); | 340 | d->selectedFiles->setSelectedItem( currentString); |
341 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); | 341 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | void PlayListWidget::writeConfig( Config& cfg ) const { | 345 | void PlayListWidget::writeConfig( Config& cfg ) const { |
346 | 346 | ||
347 | d->selectedFiles->writeCurrent( cfg); | 347 | d->selectedFiles->writeCurrent( cfg); |
348 | cfg.setGroup("PlayList"); | 348 | cfg.setGroup("PlayList"); |
349 | int noOfFiles = 0; | 349 | int noOfFiles = 0; |