author | llornkcor <llornkcor> | 2002-11-10 18:46:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-10 18:46:52 (UTC) |
commit | 6078687cb1e389751503ae171ed1bea72846a4de (patch) (unidiff) | |
tree | 5d725ae35ece948a9184f89c6aa7fb3a89a5c469 | |
parent | 49e5bbbd35bef879faca0d680f1c4d64a61b7b32 (diff) | |
download | opie-6078687cb1e389751503ae171ed1bea72846a4de.zip opie-6078687cb1e389751503ae171ed1bea72846a4de.tar.gz opie-6078687cb1e389751503ae171ed1bea72846a4de.tar.bz2 |
added must restart messagebox when changing skins
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 86130d5..040ef71 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -27,64 +27,66 @@ | |||
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpetoolbar.h> | 34 | #include <qpe/qpetoolbar.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | #include <qpe/mimetype.h> | 37 | #include <qpe/mimetype.h> |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | 40 | ||
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | 45 | ||
46 | #include "playlistselection.h" | 46 | #include "playlistselection.h" |
47 | #include "playlistwidget.h" | 47 | #include "playlistwidget.h" |
48 | #include "mediaplayerstate.h" | 48 | #include "mediaplayerstate.h" |
49 | #include "inputDialog.h" | 49 | #include "inputDialog.h" |
50 | #include "om3u.h" | 50 | #include "om3u.h" |
51 | 51 | ||
52 | //only needed for the random play | 52 | //only needed for the random play |
53 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | 54 | ||
55 | #include "audiowidget.h" | 55 | #include "audiowidget.h" |
56 | #include "videowidget.h" | 56 | #include "videowidget.h" |
57 | 57 | ||
58 | extern MediaPlayerState *mediaPlayerState; | 58 | extern MediaPlayerState *mediaPlayerState; |
59 | // extern AudioWidget *audioUI; | ||
60 | // extern VideoWidget *videoUI; | ||
59 | 61 | ||
60 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | 62 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; |
61 | // no m3u's here please | 63 | // no m3u's here please |
62 | 64 | ||
63 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 65 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
64 | : PlayListWidgetGui( parent, name, fl ) { | 66 | : PlayListWidgetGui( parent, name, fl ) { |
65 | 67 | ||
66 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 68 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
67 | "opieplayer2/add_to_playlist", | 69 | "opieplayer2/add_to_playlist", |
68 | this , SLOT(addSelected() ) ); | 70 | this , SLOT(addSelected() ) ); |
69 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 71 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
70 | "opieplayer2/remove_from_playlist", | 72 | "opieplayer2/remove_from_playlist", |
71 | this , SLOT(removeSelected() ) ); | 73 | this , SLOT(removeSelected() ) ); |
72 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 74 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
73 | this , SLOT( btnPlay( bool) ), TRUE ); | 75 | this , SLOT( btnPlay( bool) ), TRUE ); |
74 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 76 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
75 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 77 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
76 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 78 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
77 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 79 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
78 | 80 | ||
79 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 81 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
80 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 82 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
81 | this, SLOT( addAllMusicToList() ) ); | 83 | this, SLOT( addAllMusicToList() ) ); |
82 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 84 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
83 | this, SLOT( addAllVideoToList() ) ); | 85 | this, SLOT( addAllVideoToList() ) ); |
84 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), | 86 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), |
85 | this, SLOT( addAllToList() ) ); | 87 | this, SLOT( addAllToList() ) ); |
86 | pmPlayList->insertSeparator(-1); | 88 | pmPlayList->insertSeparator(-1); |
87 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), | 89 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), |
88 | // this, SLOT( saveList() ) ); | 90 | // this, SLOT( saveList() ) ); |
89 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | 91 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), |
90 | this, SLOT(writem3u() ) ); | 92 | this, SLOT(writem3u() ) ); |
@@ -268,65 +270,65 @@ void PlayListWidget::addAllToList() { | |||
268 | 270 | ||
269 | 271 | ||
270 | void PlayListWidget::addAllMusicToList() { | 272 | void PlayListWidget::addAllMusicToList() { |
271 | if(!audioScan) | 273 | if(!audioScan) |
272 | scanForAudio(); | 274 | scanForAudio(); |
273 | QListIterator<DocLnk> dit( files.children() ); | 275 | QListIterator<DocLnk> dit( files.children() ); |
274 | for ( ; dit.current(); ++dit ) { | 276 | for ( ; dit.current(); ++dit ) { |
275 | if( QFileInfo(dit.current()->file() ).exists() ) { | 277 | if( QFileInfo(dit.current()->file() ).exists() ) { |
276 | d->selectedFiles->addToSelection( **dit ); | 278 | d->selectedFiles->addToSelection( **dit ); |
277 | } | 279 | } |
278 | } | 280 | } |
279 | writeCurrentM3u(); | 281 | writeCurrentM3u(); |
280 | } | 282 | } |
281 | 283 | ||
282 | 284 | ||
283 | void PlayListWidget::addAllVideoToList() { | 285 | void PlayListWidget::addAllVideoToList() { |
284 | if(!videoScan) | 286 | if(!videoScan) |
285 | scanForVideo(); | 287 | scanForVideo(); |
286 | QListIterator<DocLnk> dit( vFiles.children() ); | 288 | QListIterator<DocLnk> dit( vFiles.children() ); |
287 | for ( ; dit.current(); ++dit ) { | 289 | for ( ; dit.current(); ++dit ) { |
288 | if( QFileInfo( dit.current()->file() ).exists() ) { | 290 | if( QFileInfo( dit.current()->file() ).exists() ) { |
289 | d->selectedFiles->addToSelection( **dit ); | 291 | d->selectedFiles->addToSelection( **dit ); |
290 | } | 292 | } |
291 | } | 293 | } |
292 | writeCurrentM3u(); | 294 | writeCurrentM3u(); |
293 | } | 295 | } |
294 | 296 | ||
295 | 297 | ||
296 | void PlayListWidget::setDocument( const QString& fileref ) { | 298 | void PlayListWidget::setDocument( const QString& fileref ) { |
297 | qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 299 | qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
298 | fromSetDocument = TRUE; | 300 | fromSetDocument = TRUE; |
299 | if ( fileref.isNull() ) { | 301 | if ( fileref.isNull() ) { |
300 | QMessageBox::critical( 0, tr( "Invalid File" ), | 302 | QMessageBox::warning( this, tr( "Invalid File" ), |
301 | tr( "There was a problem in getting the file." ) ); | 303 | tr( "There was a problem in getting the file." ) ); |
302 | return; | 304 | return; |
303 | } | 305 | } |
304 | 306 | ||
305 | clearList(); | 307 | clearList(); |
306 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 308 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
307 | readm3u( fileref ); | 309 | readm3u( fileref ); |
308 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 310 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
309 | readm3u( DocLnk( fileref).file() ); | 311 | readm3u( DocLnk( fileref).file() ); |
310 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 312 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
311 | readPls( fileref ); | 313 | readPls( fileref ); |
312 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 314 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
313 | readPls( DocLnk( fileref).file() ); | 315 | readPls( DocLnk( fileref).file() ); |
314 | } else { | 316 | } else { |
315 | clearList(); | 317 | clearList(); |
316 | addToSelection( DocLnk( fileref ) ); | 318 | addToSelection( DocLnk( fileref ) ); |
317 | writeCurrentM3u(); | 319 | writeCurrentM3u(); |
318 | 320 | ||
319 | d->setDocumentUsed = TRUE; | 321 | d->setDocumentUsed = TRUE; |
320 | mediaPlayerState->setPlaying( FALSE ); | 322 | mediaPlayerState->setPlaying( FALSE ); |
321 | mediaPlayerState->setPlaying( TRUE ); | 323 | mediaPlayerState->setPlaying( TRUE ); |
322 | } | 324 | } |
323 | } | 325 | } |
324 | 326 | ||
325 | 327 | ||
326 | void PlayListWidget::useSelectedDocument() { | 328 | void PlayListWidget::useSelectedDocument() { |
327 | d->setDocumentUsed = FALSE; | 329 | d->setDocumentUsed = FALSE; |
328 | } | 330 | } |
329 | 331 | ||
330 | 332 | ||
331 | const DocLnk *PlayListWidget::current() { // this is fugly | 333 | const DocLnk *PlayListWidget::current() { // this is fugly |
332 | switch ( whichList() ) { | 334 | switch ( whichList() ) { |
@@ -1034,49 +1036,51 @@ void PlayListWidget::populateSkinsMenu() { | |||
1034 | 1036 | ||
1035 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1037 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1036 | skinsDir.setFilter( QDir::Dirs ); | 1038 | skinsDir.setFilter( QDir::Dirs ); |
1037 | skinsDir.setSorting(QDir::Name ); | 1039 | skinsDir.setSorting(QDir::Name ); |
1038 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1040 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1039 | QFileInfoListIterator it( *skinslist ); | 1041 | QFileInfoListIterator it( *skinslist ); |
1040 | QFileInfo *fi; | 1042 | QFileInfo *fi; |
1041 | while ( ( fi = it.current() ) ) { | 1043 | while ( ( fi = it.current() ) ) { |
1042 | skinName = fi->fileName(); | 1044 | skinName = fi->fileName(); |
1043 | // qDebug( fi->fileName() ); | 1045 | // qDebug( fi->fileName() ); |
1044 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1046 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1045 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1047 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1046 | } | 1048 | } |
1047 | if( skinName == "default" ) { | 1049 | if( skinName == "default" ) { |
1048 | defaultSkinIndex = item; | 1050 | defaultSkinIndex = item; |
1049 | } | 1051 | } |
1050 | if( skinName == skin ) { | 1052 | if( skinName == skin ) { |
1051 | skinsMenu->setItemChecked( item, TRUE ); | 1053 | skinsMenu->setItemChecked( item, TRUE ); |
1052 | } | 1054 | } |
1053 | ++it; | 1055 | ++it; |
1054 | } | 1056 | } |
1055 | } | 1057 | } |
1056 | 1058 | ||
1057 | void PlayListWidget::skinsMenuActivated( int item ) { | 1059 | void PlayListWidget::skinsMenuActivated( int item ) { |
1058 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1060 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1059 | skinsMenu->setItemChecked( i, FALSE ); | 1061 | skinsMenu->setItemChecked( i, FALSE ); |
1060 | } | 1062 | } |
1061 | skinsMenu->setItemChecked( item, TRUE ); | 1063 | skinsMenu->setItemChecked( item, TRUE ); |
1062 | 1064 | ||
1063 | Config cfg( "OpiePlayer" ); | 1065 | Config cfg( "OpiePlayer" ); |
1064 | cfg.setGroup("Options"); | 1066 | cfg.setGroup("Options"); |
1065 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1067 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1066 | } | 1068 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1069 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | ||
1070 | } | ||
1067 | 1071 | ||
1068 | int PlayListWidget::whichList() { | 1072 | int PlayListWidget::whichList() { |
1069 | return tabWidget->currentPageIndex(); | 1073 | return tabWidget->currentPageIndex(); |
1070 | } | 1074 | } |
1071 | 1075 | ||
1072 | QString PlayListWidget::currentFileListPathName() { | 1076 | QString PlayListWidget::currentFileListPathName() { |
1073 | switch (whichList()) { | 1077 | switch (whichList()) { |
1074 | case 1: | 1078 | case 1: |
1075 | return audioView->currentItem()->text(3); | 1079 | return audioView->currentItem()->text(3); |
1076 | break; | 1080 | break; |
1077 | case 2: | 1081 | case 2: |
1078 | return videoView->currentItem()->text(3); | 1082 | return videoView->currentItem()->text(3); |
1079 | break; | 1083 | break; |
1080 | }; | 1084 | }; |
1081 | return ""; | 1085 | return ""; |
1082 | } | 1086 | } |