author | harlekin <harlekin> | 2002-12-11 23:35:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-12-11 23:35:31 (UTC) |
commit | a1ff0243520fca8406d90b0875ef141b7555d748 (patch) (unidiff) | |
tree | 739fb7fbd60e1e19eb017e28afea3b8c6efd918b | |
parent | d4a0626f01fae21ed19d0eea88d8eca1935c6bc8 (diff) | |
download | opie-a1ff0243520fca8406d90b0875ef141b7555d748.zip opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.gz opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.bz2 |
buttons centered again
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c35e03d..a65495e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -35,100 +35,100 @@ | |||
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 <qdatetime.h> | 41 | #include <qdatetime.h> |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #include <qregexp.h> | 44 | #include <qregexp.h> |
45 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
46 | 46 | ||
47 | #include "playlistselection.h" | 47 | #include "playlistselection.h" |
48 | #include "playlistwidget.h" | 48 | #include "playlistwidget.h" |
49 | #include "mediaplayerstate.h" | 49 | #include "mediaplayerstate.h" |
50 | #include "inputDialog.h" | 50 | #include "inputDialog.h" |
51 | #include "om3u.h" | 51 | #include "om3u.h" |
52 | #include "playlistfileview.h" | 52 | #include "playlistfileview.h" |
53 | 53 | ||
54 | //only needed for the random play | 54 | //only needed for the random play |
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
56 | #include <assert.h> | 56 | #include <assert.h> |
57 | 57 | ||
58 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 58 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
59 | : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) | 59 | : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) |
60 | { | 60 | { |
61 | 61 | ||
62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
63 | "opieplayer2/add_to_playlist", | 63 | "opieplayer2/add_to_playlist", |
64 | this , SLOT(addSelected() ) ); | 64 | this , SLOT(addSelected() ) ); |
65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
66 | "opieplayer2/remove_from_playlist", | 66 | "opieplayer2/remove_from_playlist", |
67 | this , SLOT(removeSelected() ) ); | 67 | this , SLOT(removeSelected() ) ); |
68 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 68 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
69 | this , SLOT( btnPlay( bool) ), TRUE ); | 69 | this , SLOT( btnPlay( bool) ), TRUE ); |
70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 71 | &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 73 | &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
74 | 74 | ||
75 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 75 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
76 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 76 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
77 | this, SLOT( addAllMusicToList() ) ); | 77 | this, SLOT( addAllMusicToList() ) ); |
78 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 78 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
79 | this, SLOT( addAllVideoToList() ) ); | 79 | this, SLOT( addAllVideoToList() ) ); |
80 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), | 80 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), |
81 | this, SLOT( addAllToList() ) ); | 81 | this, SLOT( addAllToList() ) ); |
82 | pmPlayList->insertSeparator(-1); | 82 | pmPlayList->insertSeparator(-1); |
83 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), | 83 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), |
84 | // this, SLOT( saveList() ) ); | 84 | // this, SLOT( saveList() ) ); |
85 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | 85 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), |
86 | this, SLOT(writem3u() ) ); | 86 | this, SLOT(writem3u() ) ); |
87 | pmPlayList->insertSeparator(-1); | 87 | pmPlayList->insertSeparator(-1); |
88 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), | 88 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), |
89 | this,SLOT( openFile() ) ); | 89 | this,SLOT( openFile() ) ); |
90 | pmPlayList->insertSeparator(-1); | 90 | pmPlayList->insertSeparator(-1); |
91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
92 | audioView, SLOT( scanFiles() ) ); | 92 | audioView, SLOT( scanFiles() ) ); |
93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), | 93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), |
94 | videoView, SLOT( scanFiles() ) ); | 94 | videoView, SLOT( scanFiles() ) ); |
95 | 95 | ||
96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), | 96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), |
97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); | 97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); |
98 | 98 | ||
99 | Config cfg( "OpiePlayer" ); | 99 | Config cfg( "OpiePlayer" ); |
100 | bool b= cfg.readBoolEntry("FullScreen", 0); | 100 | bool b= cfg.readBoolEntry("FullScreen", 0); |
101 | mediaPlayerState.setFullscreen( b ); | 101 | mediaPlayerState.setFullscreen( b ); |
102 | pmView->setItemChecked( -16, b ); | 102 | pmView->setItemChecked( -16, b ); |
103 | 103 | ||
104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
107 | d->selectedFiles, SLOT(removeSelected() ) ); | 107 | d->selectedFiles, SLOT(removeSelected() ) ); |
108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
110 | // QVBox *stretch2 = new QVBox( vbox1 ); | 110 | QVBox *stretch2 = new QVBox( vbox1 ); |
111 | 111 | ||
112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
113 | SLOT( deletePlaylist() ) ); | 113 | SLOT( deletePlaylist() ) ); |
114 | connect( pmView, SIGNAL( activated( int ) ), | 114 | connect( pmView, SIGNAL( activated( int ) ), |
115 | this, SLOT( pmViewActivated( int ) ) ); | 115 | this, SLOT( pmViewActivated( int ) ) ); |
116 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 116 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
117 | this, SLOT( skinsMenuActivated( int ) ) ); | 117 | this, SLOT( skinsMenuActivated( int ) ) ); |
118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
123 | this,SLOT( playIt( QListViewItem *) ) ); | 123 | this,SLOT( playIt( QListViewItem *) ) ); |
124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
125 | this, SLOT( addToSelection( QListViewItem *) ) ); | 125 | this, SLOT( addToSelection( QListViewItem *) ) ); |
126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
128 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 128 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
129 | this,SLOT( playIt( QListViewItem *) ) ); | 129 | this,SLOT( playIt( QListViewItem *) ) ); |
130 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 130 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
131 | this, SLOT( addToSelection( QListViewItem *) ) ); | 131 | this, SLOT( addToSelection( QListViewItem *) ) ); |
132 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 132 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
133 | this, SLOT( loadList( const DocLnk & ) ) ); | 133 | this, SLOT( loadList( const DocLnk & ) ) ); |
134 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 134 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
@@ -167,60 +167,60 @@ void PlayListWidget::initializeStates() { | |||
167 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); | 167 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); |
168 | d->playListFrame->show(); | 168 | d->playListFrame->show(); |
169 | } | 169 | } |
170 | 170 | ||
171 | void PlayListWidget::writeDefaultPlaylist() { | 171 | void PlayListWidget::writeDefaultPlaylist() { |
172 | 172 | ||
173 | Config config( "OpiePlayer" ); | 173 | Config config( "OpiePlayer" ); |
174 | config.setGroup( "PlayList" ); | 174 | config.setGroup( "PlayList" ); |
175 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 175 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
176 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 176 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
177 | if( currentString == filename) { | 177 | if( currentString == filename) { |
178 | Om3u *m3uList; | 178 | Om3u *m3uList; |
179 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 179 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
180 | if( d->selectedFiles->first() ) { | 180 | if( d->selectedFiles->first() ) { |
181 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 181 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
182 | do { | 182 | do { |
183 | // qDebug(d->selectedFiles->current()->file()); | 183 | // qDebug(d->selectedFiles->current()->file()); |
184 | m3uList->add( d->selectedFiles->current()->file() ); | 184 | m3uList->add( d->selectedFiles->current()->file() ); |
185 | } | 185 | } |
186 | while ( d->selectedFiles->next() ); | 186 | while ( d->selectedFiles->next() ); |
187 | 187 | ||
188 | m3uList->write(); | 188 | m3uList->write(); |
189 | m3uList->close(); | 189 | m3uList->close(); |
190 | delete m3uList; | 190 | delete m3uList; |
191 | 191 | ||
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 196 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
197 | d->setDocumentUsed = FALSE; | 197 | d->setDocumentUsed = FALSE; |
198 | if( QFileInfo( lnk.file() ).exists() || | 198 | if( QFileInfo( lnk.file() ).exists() || |
199 | lnk.file().left(4) == "http" ) { | 199 | lnk.file().left(4) == "http" ) { |
200 | d->selectedFiles->addToSelection( lnk ); | 200 | d->selectedFiles->addToSelection( lnk ); |
201 | } | 201 | } |
202 | // writeCurrentM3u(); | 202 | // writeCurrentM3u(); |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | void PlayListWidget::clearList() { | 206 | void PlayListWidget::clearList() { |
207 | while ( first() ) { | 207 | while ( first() ) { |
208 | d->selectedFiles->removeSelected(); | 208 | d->selectedFiles->removeSelected(); |
209 | } | 209 | } |
210 | Config cfg( "OpiePlayer" ); | 210 | Config cfg( "OpiePlayer" ); |
211 | cfg.setGroup("PlayList"); | 211 | cfg.setGroup("PlayList"); |
212 | cfg.writeEntry("CurrentPlaylist","default"); | 212 | cfg.writeEntry("CurrentPlaylist","default"); |
213 | setCaption("OpiePlayer"); | 213 | setCaption("OpiePlayer"); |
214 | } | 214 | } |
215 | 215 | ||
216 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 216 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
217 | switch (mouse) { | 217 | switch (mouse) { |
218 | case LeftButton: | 218 | case LeftButton: |
219 | break; | 219 | break; |
220 | case RightButton: | 220 | case RightButton: |
221 | { | 221 | { |
222 | QPopupMenu m; | 222 | QPopupMenu m; |
223 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 223 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
224 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 224 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
225 | m.exec( QCursor::pos() ); | 225 | m.exec( QCursor::pos() ); |
226 | } | 226 | } |
@@ -240,172 +240,172 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi | |||
240 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 240 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
241 | m.exec( QCursor::pos() ); | 241 | m.exec( QCursor::pos() ); |
242 | } | 242 | } |
243 | break; | 243 | break; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | void PlayListWidget::addAllToList() { | 248 | void PlayListWidget::addAllToList() { |
249 | 249 | ||
250 | // QTime t; | 250 | // QTime t; |
251 | // t.start(); | 251 | // t.start(); |
252 | 252 | ||
253 | audioView->populateView(); | 253 | audioView->populateView(); |
254 | 254 | ||
255 | QListViewItemIterator audioIt( audioView ); | 255 | QListViewItemIterator audioIt( audioView ); |
256 | DocLnk lnk; | 256 | DocLnk lnk; |
257 | QString filename; | 257 | QString filename; |
258 | // iterate through all items of the listview | 258 | // iterate through all items of the listview |
259 | for ( ; audioIt.current(); ++audioIt ) { | 259 | for ( ; audioIt.current(); ++audioIt ) { |
260 | filename = audioIt.current()->text(3); | 260 | filename = audioIt.current()->text(3); |
261 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 261 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
262 | lnk.setFile( filename ); //sets file name | 262 | lnk.setFile( filename ); //sets file name |
263 | d->selectedFiles->addToSelection( lnk); | 263 | d->selectedFiles->addToSelection( lnk); |
264 | } | 264 | } |
265 | 265 | ||
266 | videoView->populateView(); | 266 | videoView->populateView(); |
267 | 267 | ||
268 | QListViewItemIterator videoIt( videoView ); | 268 | QListViewItemIterator videoIt( videoView ); |
269 | for ( ; videoIt.current(); ++videoIt ) { | 269 | for ( ; videoIt.current(); ++videoIt ) { |
270 | filename = videoIt.current()->text(3); | 270 | filename = videoIt.current()->text(3); |
271 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 271 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
272 | lnk.setFile( filename ); //sets file name | 272 | lnk.setFile( filename ); //sets file name |
273 | d->selectedFiles->addToSelection( lnk); | 273 | d->selectedFiles->addToSelection( lnk); |
274 | } | 274 | } |
275 | 275 | ||
276 | // d->selectedFiles->addToSelection( ); | 276 | // d->selectedFiles->addToSelection( ); |
277 | // if ( it.current()->isSelected() ) | 277 | // if ( it.current()->isSelected() ) |
278 | // lst->append( audioIt.current() ); | 278 | // lst->append( audioIt.current() ); |
279 | // } | 279 | // } |
280 | 280 | ||
281 | 281 | ||
282 | // if(!audioScan) | 282 | // if(!audioScan) |
283 | // scanForAudio(); | 283 | // scanForAudio(); |
284 | // if(!videoScan) | 284 | // if(!videoScan) |
285 | // scanForVideo(); | 285 | // scanForVideo(); |
286 | 286 | ||
287 | // DocLnkSet filesAll; | 287 | // DocLnkSet filesAll; |
288 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); | 288 | // Global::findDocuments(&filesAll, "video/*;"+audioMimes); |
289 | // QListIterator<DocLnk> Adit( filesAll.children() ); | 289 | // QListIterator<DocLnk> Adit( filesAll.children() ); |
290 | // for ( ; Adit.current(); ++Adit ) { | 290 | // for ( ; Adit.current(); ++Adit ) { |
291 | // if( QFileInfo( Adit.current()->file() ).exists() ) { | 291 | // if( QFileInfo( Adit.current()->file() ).exists() ) { |
292 | // d->selectedFiles->addToSelection( **Adit ); | 292 | // d->selectedFiles->addToSelection( **Adit ); |
293 | // } | 293 | // } |
294 | // } | 294 | // } |
295 | 295 | ||
296 | // qDebug("elapsed time %d", t.elapsed() ); | 296 | // qDebug("elapsed time %d", t.elapsed() ); |
297 | 297 | ||
298 | tabWidget->setCurrentPage(0); | 298 | tabWidget->setCurrentPage(0); |
299 | 299 | ||
300 | writeCurrentM3u(); | 300 | writeCurrentM3u(); |
301 | d->selectedFiles->first(); | 301 | d->selectedFiles->first(); |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | void PlayListWidget::addAllMusicToList() { | 305 | void PlayListWidget::addAllMusicToList() { |
306 | 306 | ||
307 | audioView->populateView(); | 307 | audioView->populateView(); |
308 | 308 | ||
309 | QListViewItemIterator audioIt( audioView ); | 309 | QListViewItemIterator audioIt( audioView ); |
310 | DocLnk lnk; | 310 | DocLnk lnk; |
311 | QString filename; | 311 | QString filename; |
312 | // iterate through all items of the listview | 312 | // iterate through all items of the listview |
313 | for ( ; audioIt.current(); ++audioIt ) { | 313 | for ( ; audioIt.current(); ++audioIt ) { |
314 | filename = audioIt.current()->text(3); | 314 | filename = audioIt.current()->text(3); |
315 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 315 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
316 | lnk.setFile( filename ); //sets file name | 316 | lnk.setFile( filename ); //sets file name |
317 | d->selectedFiles->addToSelection( lnk); | 317 | d->selectedFiles->addToSelection( lnk); |
318 | } | 318 | } |
319 | 319 | ||
320 | /* if(!audioScan) | 320 | /* if(!audioScan) |
321 | scanForAudio(); | 321 | scanForAudio(); |
322 | QListIterator<DocLnk> dit( files.children() ); | 322 | QListIterator<DocLnk> dit( files.children() ); |
323 | for ( ; dit.current(); ++dit ) { | 323 | for ( ; dit.current(); ++dit ) { |
324 | if( QFileInfo(dit.current()->file() ).exists() ) { | 324 | if( QFileInfo(dit.current()->file() ).exists() ) { |
325 | d->selectedFiles->addToSelection( **dit ); | 325 | d->selectedFiles->addToSelection( **dit ); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | */ | 328 | */ |
329 | tabWidget->setCurrentPage(0); | 329 | tabWidget->setCurrentPage(0); |
330 | writeCurrentM3u(); | 330 | writeCurrentM3u(); |
331 | d->selectedFiles->first(); | 331 | d->selectedFiles->first(); |
332 | } | 332 | } |
333 | 333 | ||
334 | 334 | ||
335 | void PlayListWidget::addAllVideoToList() { | 335 | void PlayListWidget::addAllVideoToList() { |
336 | 336 | ||
337 | videoView->populateView(); | 337 | videoView->populateView(); |
338 | 338 | ||
339 | QListViewItemIterator videoIt( videoView ); | 339 | QListViewItemIterator videoIt( videoView ); |
340 | DocLnk lnk; | 340 | DocLnk lnk; |
341 | QString filename; | 341 | QString filename; |
342 | for ( ; videoIt.current(); ++videoIt ) { | 342 | for ( ; videoIt.current(); ++videoIt ) { |
343 | filename = videoIt.current()->text(3); | 343 | filename = videoIt.current()->text(3); |
344 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 344 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
345 | lnk.setFile( filename ); //sets file name | 345 | lnk.setFile( filename ); //sets file name |
346 | d->selectedFiles->addToSelection( lnk); | 346 | d->selectedFiles->addToSelection( lnk); |
347 | } | 347 | } |
348 | 348 | ||
349 | 349 | ||
350 | /* if(!videoScan) | 350 | /* if(!videoScan) |
351 | scanForVideo(); | 351 | scanForVideo(); |
352 | QListIterator<DocLnk> dit( vFiles.children() ); | 352 | QListIterator<DocLnk> dit( vFiles.children() ); |
353 | for ( ; dit.current(); ++dit ) { | 353 | for ( ; dit.current(); ++dit ) { |
354 | if( QFileInfo( dit.current()->file() ).exists() ) { | 354 | if( QFileInfo( dit.current()->file() ).exists() ) { |
355 | d->selectedFiles->addToSelection( **dit ); | 355 | d->selectedFiles->addToSelection( **dit ); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | */ | 358 | */ |
359 | tabWidget->setCurrentPage(0); | 359 | tabWidget->setCurrentPage(0); |
360 | writeCurrentM3u(); | 360 | writeCurrentM3u(); |
361 | d->selectedFiles->first(); | 361 | d->selectedFiles->first(); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | void PlayListWidget::setDocument( const QString& fileref ) { | 365 | void PlayListWidget::setDocument( const QString& fileref ) { |
366 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 366 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
367 | fromSetDocument = TRUE; | 367 | fromSetDocument = TRUE; |
368 | if ( fileref.isNull() ) { | 368 | if ( fileref.isNull() ) { |
369 | QMessageBox::warning( this, tr( "Invalid File" ), | 369 | QMessageBox::warning( this, tr( "Invalid File" ), |
370 | tr( "There was a problem in getting the file." ) ); | 370 | tr( "There was a problem in getting the file." ) ); |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | 373 | ||
374 | clearList(); | 374 | clearList(); |
375 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 375 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
376 | readm3u( fileref ); | 376 | readm3u( fileref ); |
377 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 377 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
378 | readm3u( DocLnk( fileref).file() ); | 378 | readm3u( DocLnk( fileref).file() ); |
379 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 379 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
380 | readPls( fileref ); | 380 | readPls( fileref ); |
381 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 381 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
382 | readPls( DocLnk( fileref).file() ); | 382 | readPls( DocLnk( fileref).file() ); |
383 | } else { | 383 | } else { |
384 | clearList(); | 384 | clearList(); |
385 | addToSelection( DocLnk( fileref ) ); | 385 | addToSelection( DocLnk( fileref ) ); |
386 | writeCurrentM3u(); | 386 | writeCurrentM3u(); |
387 | 387 | ||
388 | d->setDocumentUsed = TRUE; | 388 | d->setDocumentUsed = TRUE; |
389 | mediaPlayerState.setPlaying( FALSE ); | 389 | mediaPlayerState.setPlaying( FALSE ); |
390 | mediaPlayerState.setPlaying( TRUE ); | 390 | mediaPlayerState.setPlaying( TRUE ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | void PlayListWidget::useSelectedDocument() { | 395 | void PlayListWidget::useSelectedDocument() { |
396 | d->setDocumentUsed = FALSE; | 396 | d->setDocumentUsed = FALSE; |
397 | } | 397 | } |
398 | 398 | ||
399 | 399 | ||
400 | const DocLnk *PlayListWidget::current() const { // this is fugly | 400 | const DocLnk *PlayListWidget::current() const { // this is fugly |
401 | assert( currentTab() == CurrentPlayList ); | 401 | assert( currentTab() == CurrentPlayList ); |
402 | 402 | ||
403 | const DocLnk *lnk = d->selectedFiles->current(); | 403 | const DocLnk *lnk = d->selectedFiles->current(); |
404 | if ( !lnk ) { | 404 | if ( !lnk ) { |
405 | d->selectedFiles->first(); | 405 | d->selectedFiles->first(); |
406 | lnk = d->selectedFiles->current(); | 406 | lnk = d->selectedFiles->current(); |
407 | } | 407 | } |
408 | assert( lnk ); | 408 | assert( lnk ); |
409 | return lnk; | 409 | return lnk; |
410 | } | 410 | } |
411 | 411 | ||
@@ -484,78 +484,78 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
484 | void PlayListWidget::addSelected() { | 484 | void PlayListWidget::addSelected() { |
485 | assert( inFileListMode() ); | 485 | assert( inFileListMode() ); |
486 | 486 | ||
487 | QListViewItemIterator it( currentFileListView ); | 487 | QListViewItemIterator it( currentFileListView ); |
488 | for ( ; it.current(); ++it ) | 488 | for ( ; it.current(); ++it ) |
489 | if ( it.current()->isSelected() ) { | 489 | if ( it.current()->isSelected() ) { |
490 | QString filename = it.current()->text(3); | 490 | QString filename = it.current()->text(3); |
491 | 491 | ||
492 | DocLnk lnk; | 492 | DocLnk lnk; |
493 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name | 493 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name |
494 | lnk.setFile( filename ); //sets file name | 494 | lnk.setFile( filename ); //sets file name |
495 | 495 | ||
496 | d->selectedFiles->addToSelection( lnk ); | 496 | d->selectedFiles->addToSelection( lnk ); |
497 | } | 497 | } |
498 | 498 | ||
499 | currentFileListView->clearSelection(); | 499 | currentFileListView->clearSelection(); |
500 | 500 | ||
501 | // tabWidget->setCurrentPage( 0 ); | 501 | // tabWidget->setCurrentPage( 0 ); |
502 | writeCurrentM3u(); | 502 | writeCurrentM3u(); |
503 | } | 503 | } |
504 | 504 | ||
505 | 505 | ||
506 | void PlayListWidget::removeSelected() { | 506 | void PlayListWidget::removeSelected() { |
507 | d->selectedFiles->removeSelected( ); | 507 | d->selectedFiles->removeSelected( ); |
508 | writeCurrentM3u(); | 508 | writeCurrentM3u(); |
509 | } | 509 | } |
510 | 510 | ||
511 | 511 | ||
512 | void PlayListWidget::playIt( QListViewItem *it) { | 512 | void PlayListWidget::playIt( QListViewItem *it) { |
513 | if(!it) return; | 513 | if(!it) return; |
514 | mediaPlayerState.setPlaying(FALSE); | 514 | mediaPlayerState.setPlaying(FALSE); |
515 | mediaPlayerState.setPlaying(TRUE); | 515 | mediaPlayerState.setPlaying(TRUE); |
516 | d->selectedFiles->unSelect(); | 516 | d->selectedFiles->unSelect(); |
517 | } | 517 | } |
518 | 518 | ||
519 | 519 | ||
520 | void PlayListWidget::addToSelection( QListViewItem *it) { | 520 | void PlayListWidget::addToSelection( QListViewItem *it) { |
521 | d->setDocumentUsed = FALSE; | 521 | d->setDocumentUsed = FALSE; |
522 | 522 | ||
523 | if(it) { | 523 | if(it) { |
524 | if ( currentTab() == CurrentPlayList ) | 524 | if ( currentTab() == CurrentPlayList ) |
525 | return; | 525 | return; |
526 | // case 1: { | 526 | // case 1: { |
527 | DocLnk lnk; | 527 | DocLnk lnk; |
528 | QString filename; | 528 | QString filename; |
529 | 529 | ||
530 | filename=it->text(3); | 530 | filename=it->text(3); |
531 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 531 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
532 | lnk.setFile( filename ); //sets file name | 532 | lnk.setFile( filename ); //sets file name |
533 | d->selectedFiles->addToSelection( lnk); | 533 | d->selectedFiles->addToSelection( lnk); |
534 | 534 | ||
535 | writeCurrentM3u(); | 535 | writeCurrentM3u(); |
536 | // tabWidget->setCurrentPage(0); | 536 | // tabWidget->setCurrentPage(0); |
537 | 537 | ||
538 | } | 538 | } |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | void PlayListWidget::tabChanged(QWidget *) { | 542 | void PlayListWidget::tabChanged(QWidget *) { |
543 | 543 | ||
544 | d->tbPlay->setEnabled( true ); | 544 | d->tbPlay->setEnabled( true ); |
545 | 545 | ||
546 | disconnect( audioView, SIGNAL( itemsSelected( bool ) ), | 546 | disconnect( audioView, SIGNAL( itemsSelected( bool ) ), |
547 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 547 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
548 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), | 548 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), |
549 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 549 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
550 | 550 | ||
551 | currentFileListView = 0; | 551 | currentFileListView = 0; |
552 | 552 | ||
553 | switch ( currentTab() ) { | 553 | switch ( currentTab() ) { |
554 | case CurrentPlayList: | 554 | case CurrentPlayList: |
555 | { | 555 | { |
556 | if( !tbDeletePlaylist->isHidden() ) { | 556 | if( !tbDeletePlaylist->isHidden() ) { |
557 | tbDeletePlaylist->hide(); | 557 | tbDeletePlaylist->hide(); |
558 | } | 558 | } |
559 | d->tbRemoveFromList->setEnabled(TRUE); | 559 | d->tbRemoveFromList->setEnabled(TRUE); |
560 | d->tbAddToList->setEnabled(FALSE); | 560 | d->tbAddToList->setEnabled(FALSE); |
561 | 561 | ||
@@ -672,102 +672,102 @@ void PlayListWidget::openFile() { | |||
672 | 672 | ||
673 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 673 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
674 | lnk.setName( filename ); //sets name | 674 | lnk.setName( filename ); //sets name |
675 | lnk.setFile( filename ); //sets file name | 675 | lnk.setFile( filename ); //sets file name |
676 | 676 | ||
677 | // lnk.setIcon("opieplayer2/musicfile"); | 677 | // lnk.setIcon("opieplayer2/musicfile"); |
678 | 678 | ||
679 | d->selectedFiles->addToSelection( lnk ); | 679 | d->selectedFiles->addToSelection( lnk ); |
680 | writeCurrentM3u(); | 680 | writeCurrentM3u(); |
681 | d->selectedFiles->setSelectedItem( lnk.name()); | 681 | d->selectedFiles->setSelectedItem( lnk.name()); |
682 | } | 682 | } |
683 | else if( filename.right( 3) == "m3u" ) { | 683 | else if( filename.right( 3) == "m3u" ) { |
684 | readm3u( filename ); | 684 | readm3u( filename ); |
685 | 685 | ||
686 | } else if( filename.right(3) == "pls" ) { | 686 | } else if( filename.right(3) == "pls" ) { |
687 | readPls( filename ); | 687 | readPls( filename ); |
688 | } else { | 688 | } else { |
689 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 689 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
690 | lnk.setFile( filename ); //sets file name | 690 | lnk.setFile( filename ); //sets file name |
691 | d->selectedFiles->addToSelection( lnk); | 691 | d->selectedFiles->addToSelection( lnk); |
692 | writeCurrentM3u(); | 692 | writeCurrentM3u(); |
693 | d->selectedFiles->setSelectedItem( lnk.name()); | 693 | d->selectedFiles->setSelectedItem( lnk.name()); |
694 | } | 694 | } |
695 | } | 695 | } |
696 | 696 | ||
697 | delete fileDlg; | 697 | delete fileDlg; |
698 | } | 698 | } |
699 | 699 | ||
700 | /* | 700 | /* |
701 | reads m3u and shows files/urls to playlist widget */ | 701 | reads m3u and shows files/urls to playlist widget */ |
702 | void PlayListWidget::readm3u( const QString &filename ) { | 702 | void PlayListWidget::readm3u( const QString &filename ) { |
703 | qDebug( "read m3u filename " + filename ); | 703 | qDebug( "read m3u filename " + filename ); |
704 | 704 | ||
705 | Om3u *m3uList; | 705 | Om3u *m3uList; |
706 | QString s, name; | 706 | QString s, name; |
707 | m3uList = new Om3u( filename, IO_ReadOnly ); | 707 | m3uList = new Om3u( filename, IO_ReadOnly ); |
708 | m3uList->readM3u(); | 708 | m3uList->readM3u(); |
709 | DocLnk lnk; | 709 | DocLnk lnk; |
710 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 710 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
711 | s = *it; | 711 | s = *it; |
712 | // qDebug("reading "+ s); | 712 | // qDebug("reading "+ s); |
713 | if(s.left(4)=="http") { | 713 | if(s.left(4)=="http") { |
714 | lnk.setName( s ); //sets file name | 714 | lnk.setName( s ); //sets file name |
715 | lnk.setIcon("opieplayer2/musicfile"); | 715 | lnk.setIcon("opieplayer2/musicfile"); |
716 | lnk.setFile( s ); //sets file name | 716 | lnk.setFile( s ); //sets file name |
717 | 717 | ||
718 | } else { | 718 | } else { |
719 | // if( QFileInfo( s ).exists() ) { | 719 | // if( QFileInfo( s ).exists() ) { |
720 | lnk.setName( QFileInfo(s).baseName()); | 720 | lnk.setName( QFileInfo(s).baseName()); |
721 | // if(s.right(4) == '.') {//if regular file | 721 | // if(s.right(4) == '.') {//if regular file |
722 | if(s.left(1) != "/") { | 722 | if(s.left(1) != "/") { |
723 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 723 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
724 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 724 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
725 | // lnk.setIcon(MimeType(s).pixmap() ); | 725 | // lnk.setIcon(MimeType(s).pixmap() ); |
726 | // lnk.setIcon("SoundPlayer"); | 726 | // lnk.setIcon("SoundPlayer"); |
727 | } else { | 727 | } else { |
728 | // qDebug("set link2 "+s); | 728 | // qDebug("set link2 "+s); |
729 | lnk.setFile( s); | 729 | lnk.setFile( s); |
730 | // lnk.setIcon(MimeType(s).pixmap() ); | 730 | // lnk.setIcon(MimeType(s).pixmap() ); |
731 | // lnk.setIcon("SoundPlayer"); | 731 | // lnk.setIcon("SoundPlayer"); |
732 | } | 732 | } |
733 | } | 733 | } |
734 | d->selectedFiles->addToSelection( lnk ); | 734 | d->selectedFiles->addToSelection( lnk ); |
735 | } | 735 | } |
736 | Config config( "OpiePlayer" ); | 736 | Config config( "OpiePlayer" ); |
737 | config.setGroup( "PlayList" ); | 737 | config.setGroup( "PlayList" ); |
738 | 738 | ||
739 | config.writeEntry("CurrentPlaylist",filename); | 739 | config.writeEntry("CurrentPlaylist",filename); |
740 | config.write(); | 740 | config.write(); |
741 | currentPlayList=filename; | 741 | currentPlayList=filename; |
742 | 742 | ||
743 | // m3uList->write(); | 743 | // m3uList->write(); |
744 | m3uList->close(); | 744 | m3uList->close(); |
745 | delete m3uList; | 745 | delete m3uList; |
746 | 746 | ||
747 | d->selectedFiles->setSelectedItem( s); | 747 | d->selectedFiles->setSelectedItem( s); |
748 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 748 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
749 | 749 | ||
750 | } | 750 | } |
751 | 751 | ||
752 | /* | 752 | /* |
753 | reads pls and adds files/urls to playlist */ | 753 | reads pls and adds files/urls to playlist */ |
754 | void PlayListWidget::readPls( const QString &filename ) { | 754 | void PlayListWidget::readPls( const QString &filename ) { |
755 | 755 | ||
756 | qDebug( "pls filename is " + filename ); | 756 | qDebug( "pls filename is " + filename ); |
757 | Om3u *m3uList; | 757 | Om3u *m3uList; |
758 | QString s, name; | 758 | QString s, name; |
759 | m3uList = new Om3u( filename, IO_ReadOnly ); | 759 | m3uList = new Om3u( filename, IO_ReadOnly ); |
760 | m3uList->readPls(); | 760 | m3uList->readPls(); |
761 | 761 | ||
762 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 762 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
763 | s = *it; | 763 | s = *it; |
764 | // s.replace( QRegExp( "%20" )," " ); | 764 | // s.replace( QRegExp( "%20" )," " ); |
765 | DocLnk lnk( s ); | 765 | DocLnk lnk( s ); |
766 | QFileInfo f( s ); | 766 | QFileInfo f( s ); |
767 | QString name = f.baseName(); | 767 | QString name = f.baseName(); |
768 | 768 | ||
769 | if( name.left( 4 ) == "http" ) { | 769 | if( name.left( 4 ) == "http" ) { |
770 | name = s.right( s.length() - 7); | 770 | name = s.right( s.length() - 7); |
771 | } else { | 771 | } else { |
772 | name = s; | 772 | name = s; |
773 | } | 773 | } |
@@ -794,95 +794,95 @@ void PlayListWidget::readPls( const QString &filename ) { | |||
794 | } | 794 | } |
795 | 795 | ||
796 | /* | 796 | /* |
797 | writes current playlist to current m3u file */ | 797 | writes current playlist to current m3u file */ |
798 | void PlayListWidget::writeCurrentM3u() { | 798 | void PlayListWidget::writeCurrentM3u() { |
799 | qDebug("writing to current m3u"); | 799 | qDebug("writing to current m3u"); |
800 | Config cfg( "OpiePlayer" ); | 800 | Config cfg( "OpiePlayer" ); |
801 | cfg.setGroup("PlayList"); | 801 | cfg.setGroup("PlayList"); |
802 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); | 802 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); |
803 | 803 | ||
804 | Om3u *m3uList; | 804 | Om3u *m3uList; |
805 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | 805 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
806 | if( d->selectedFiles->first()) { | 806 | if( d->selectedFiles->first()) { |
807 | 807 | ||
808 | do { | 808 | do { |
809 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); | 809 | // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); |
810 | m3uList->add( d->selectedFiles->current()->file() ); | 810 | m3uList->add( d->selectedFiles->current()->file() ); |
811 | } | 811 | } |
812 | while ( d->selectedFiles->next() ); | 812 | while ( d->selectedFiles->next() ); |
813 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 813 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
814 | m3uList->write(); | 814 | m3uList->write(); |
815 | m3uList->close(); | 815 | m3uList->close(); |
816 | } | 816 | } |
817 | delete m3uList; | 817 | delete m3uList; |
818 | 818 | ||
819 | } | 819 | } |
820 | 820 | ||
821 | /* | 821 | /* |
822 | writes current playlist to m3u file */ | 822 | writes current playlist to m3u file */ |
823 | void PlayListWidget::writem3u() { | 823 | void PlayListWidget::writem3u() { |
824 | InputDialog *fileDlg; | 824 | InputDialog *fileDlg; |
825 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 825 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
826 | fileDlg->exec(); | 826 | fileDlg->exec(); |
827 | QString name, filename, list; | 827 | QString name, filename, list; |
828 | Om3u *m3uList; | 828 | Om3u *m3uList; |
829 | 829 | ||
830 | if( fileDlg->result() == 1 ) { | 830 | if( fileDlg->result() == 1 ) { |
831 | name = fileDlg->text(); | 831 | name = fileDlg->text(); |
832 | // qDebug( filename ); | 832 | // qDebug( filename ); |
833 | 833 | ||
834 | if( name.left( 1) != "/" ) { | 834 | if( name.left( 1) != "/" ) { |
835 | filename = QPEApplication::documentDir() + "/" + name; | 835 | filename = QPEApplication::documentDir() + "/" + name; |
836 | } | 836 | } |
837 | 837 | ||
838 | if( name.right( 3 ) != "m3u" ) { | 838 | if( name.right( 3 ) != "m3u" ) { |
839 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 839 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
840 | } | 840 | } |
841 | 841 | ||
842 | if( d->selectedFiles->first()) { | 842 | if( d->selectedFiles->first()) { |
843 | m3uList = new Om3u(filename, IO_ReadWrite); | 843 | m3uList = new Om3u(filename, IO_ReadWrite); |
844 | 844 | ||
845 | do { | 845 | do { |
846 | m3uList->add( d->selectedFiles->current()->file()); | 846 | m3uList->add( d->selectedFiles->current()->file()); |
847 | } | 847 | } |
848 | while ( d->selectedFiles->next() ); | 848 | while ( d->selectedFiles->next() ); |
849 | // qDebug( list ); | 849 | // qDebug( list ); |
850 | m3uList->write(); | 850 | m3uList->write(); |
851 | m3uList->close(); | 851 | m3uList->close(); |
852 | delete m3uList; | 852 | delete m3uList; |
853 | 853 | ||
854 | delete fileDlg; | 854 | delete fileDlg; |
855 | 855 | ||
856 | DocLnk lnk; | 856 | DocLnk lnk; |
857 | lnk.setFile( filename); | 857 | lnk.setFile( filename); |
858 | lnk.setIcon("opieplayer2/playlist2"); | 858 | lnk.setIcon("opieplayer2/playlist2"); |
859 | lnk.setName( name); //sets file name | 859 | lnk.setName( name); //sets file name |
860 | 860 | ||
861 | // qDebug(filename); | 861 | // qDebug(filename); |
862 | Config config( "OpiePlayer" ); | 862 | Config config( "OpiePlayer" ); |
863 | config.setGroup( "PlayList" ); | 863 | config.setGroup( "PlayList" ); |
864 | 864 | ||
865 | config.writeEntry("CurrentPlaylist",filename); | 865 | config.writeEntry("CurrentPlaylist",filename); |
866 | currentPlayList=filename; | 866 | currentPlayList=filename; |
867 | 867 | ||
868 | if(!lnk.writeLink()) { | 868 | if(!lnk.writeLink()) { |
869 | qDebug("Writing doclink did not work"); | 869 | qDebug("Writing doclink did not work"); |
870 | } | 870 | } |
871 | 871 | ||
872 | setCaption(tr("OpiePlayer: ") + name); | 872 | setCaption(tr("OpiePlayer: ") + name); |
873 | } | 873 | } |
874 | } | 874 | } |
875 | } | 875 | } |
876 | 876 | ||
877 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 877 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
878 | switch ( e->key() ) { | 878 | switch ( e->key() ) { |
879 | ////////////////////////////// Zaurus keys | 879 | ////////////////////////////// Zaurus keys |
880 | case Key_F9: //activity | 880 | case Key_F9: //activity |
881 | // if(audioUI->isHidden()) | 881 | // if(audioUI->isHidden()) |
882 | // audioUI->showMaximized(); | 882 | // audioUI->showMaximized(); |
883 | break; | 883 | break; |
884 | case Key_F10: //contacts | 884 | case Key_F10: //contacts |
885 | // if( videoUI->isHidden()) | 885 | // if( videoUI->isHidden()) |
886 | // videoUI->showMaximized(); | 886 | // videoUI->showMaximized(); |
887 | break; | 887 | break; |
888 | case Key_F11: //menu | 888 | case Key_F11: //menu |