summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 4ee784e..5f750ba 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,369 +1,369 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
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#include <qpe/config.h> 40#include <qpe/config.h>
41 41
42#include <opie/ofiledialog.h> 42#include <opie/ofiledialog.h>
43 43
44#include <qdatetime.h> 44#include <qdatetime.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47#include <qregexp.h> 47#include <qregexp.h>
48#include <qtextstream.h> 48#include <qtextstream.h>
49 49
50#include "playlistselection.h" 50#include "playlistselection.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52#include "mediaplayerstate.h" 52#include "mediaplayerstate.h"
53#include "inputDialog.h" 53#include "inputDialog.h"
54#include "om3u.h" 54#include "om3u.h"
55#include "playlistfileview.h" 55#include "playlistfileview.h"
56 56
57//only needed for the random play 57//only needed for the random play
58#include <stdlib.h> 58#include <stdlib.h>
59#include <assert.h> 59#include <assert.h>
60 60
61PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 61PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
62 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) 62 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
63{ 63{
64 64
65 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 65 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
66 "opieplayer2/add_to_playlist", 66 "opieplayer2/add_to_playlist",
67 this , SLOT(addSelected() ) ); 67 this , SLOT(addSelected() ) );
68 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 68 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
69 "opieplayer2/remove_from_playlist", 69 "opieplayer2/remove_from_playlist",
70 this , SLOT(removeSelected() ) ); 70 this , SLOT(removeSelected() ) );
71 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 71 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
72 this , SLOT( btnPlay( bool) ), TRUE ); 72 this , SLOT( btnPlay( bool) ), TRUE );
73 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 73 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
74 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 74 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
75 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 75 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
76 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 76 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
77 77
78 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 78 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
79 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 79 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
80 this, SLOT( addAllMusicToList() ) ); 80 this, SLOT( addAllMusicToList() ) );
81 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 81 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
82 this, SLOT( addAllVideoToList() ) ); 82 this, SLOT( addAllVideoToList() ) );
83 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 83 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
84 this, SLOT( addAllToList() ) ); 84 this, SLOT( addAllToList() ) );
85 pmPlayList->insertSeparator(-1); 85 pmPlayList->insertSeparator(-1);
86 (void)new MenuItem( pmPlayList, tr( "Add File" ), 86 (void)new MenuItem( pmPlayList, tr( "Add File" ),
87 this,SLOT( openFile() ) ); 87 this,SLOT( openFile() ) );
88 (void)new MenuItem( pmPlayList, tr("Add URL"), 88 (void)new MenuItem( pmPlayList, tr("Add URL"),
89 this,SLOT( openURL() ) ); 89 this,SLOT( openURL() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
92 this, SLOT(writem3u() ) ); 92 this, SLOT(writem3u() ) );
93 pmPlayList->insertSeparator(-1); 93 pmPlayList->insertSeparator(-1);
94 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 94 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
95 audioView, SLOT( scanFiles() ) ); 95 audioView, SLOT( scanFiles() ) );
96 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 96 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
97 videoView, SLOT( scanFiles() ) ); 97 videoView, SLOT( scanFiles() ) );
98 98
99 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 99 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
100 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 100 &mediaPlayerState, SLOT( toggleFullscreen() ) );
101 101
102 Config cfg( "OpiePlayer" ); 102 Config cfg( "OpiePlayer" );
103 bool b= cfg.readBoolEntry("FullScreen", 0); 103 bool b= cfg.readBoolEntry("FullScreen", 0);
104 mediaPlayerState.setFullscreen( b ); 104 mediaPlayerState.setFullscreen( b );
105 pmView->setItemChecked( -16, b ); 105 pmView->setItemChecked( -16, b );
106 106
107 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 107 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
108 d->selectedFiles, SLOT(moveSelectedUp() ) ); 108 d->selectedFiles, SLOT(moveSelectedUp() ) );
109 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 109 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
110 d->selectedFiles, SLOT(removeSelected() ) ); 110 d->selectedFiles, SLOT(removeSelected() ) );
111 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 111 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
112 d->selectedFiles, SLOT(moveSelectedDown() ) ); 112 d->selectedFiles, SLOT(moveSelectedDown() ) );
113 // QVBox *stretch2 = new QVBox( vbox1 ); 113 QVBox *stretch2 = new QVBox( vbox1 );
114 114
115 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 115 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
116 SLOT( deletePlaylist() ) ); 116 SLOT( deletePlaylist() ) );
117 connect( pmView, SIGNAL( activated( int ) ), 117 connect( pmView, SIGNAL( activated( int ) ),
118 this, SLOT( pmViewActivated( int ) ) ); 118 this, SLOT( pmViewActivated( int ) ) );
119 connect( skinsMenu, SIGNAL( activated( int ) ) , 119 connect( skinsMenu, SIGNAL( activated( int ) ) ,
120 this, SLOT( skinsMenuActivated( int ) ) ); 120 this, SLOT( skinsMenuActivated( int ) ) );
121 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 121 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
122 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 122 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
123 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 123 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
124 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 124 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
125 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 125 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
126 this,SLOT( playIt( QListViewItem *) ) ); 126 this,SLOT( playIt( QListViewItem *) ) );
127 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 127 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
128 this, SLOT( addToSelection( QListViewItem *) ) ); 128 this, SLOT( addToSelection( QListViewItem *) ) );
129 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 129 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
130 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 130 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
131 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 131 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
132 this,SLOT( playIt( QListViewItem *) ) ); 132 this,SLOT( playIt( QListViewItem *) ) );
133 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 133 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
134 this, SLOT( addToSelection( QListViewItem *) ) ); 134 this, SLOT( addToSelection( QListViewItem *) ) );
135 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 135 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
136 this, SLOT( loadList( const DocLnk & ) ) ); 136 this, SLOT( loadList( const DocLnk & ) ) );
137 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 137 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
138 this, SLOT( tabChanged( QWidget* ) ) ); 138 this, SLOT( tabChanged( QWidget* ) ) );
139 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 139 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
140 d->tbPlay, SLOT( setOn( bool ) ) ); 140 d->tbPlay, SLOT( setOn( bool ) ) );
141 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 141 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
142 d->tbLoop, SLOT( setOn( bool ) ) ); 142 d->tbLoop, SLOT( setOn( bool ) ) );
143 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 143 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
144 d->tbShuffle, SLOT( setOn( bool ) ) ); 144 d->tbShuffle, SLOT( setOn( bool ) ) );
145 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 145 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
146 this, SLOT( playIt( QListViewItem *) ) ); 146 this, SLOT( playIt( QListViewItem *) ) );
147 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 147 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
148 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 148 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
149 149
150 // see which skins are installed 150 // see which skins are installed
151 populateSkinsMenu(); 151 populateSkinsMenu();
152 initializeStates(); 152 initializeStates();
153 153
154 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 154 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
155 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 155 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
156 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 156 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
157 157
158 158
159 cfg.setGroup("PlayList"); 159 cfg.setGroup("PlayList");
160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
161 loadList(DocLnk( currentPlaylist ) ); 161 loadList(DocLnk( currentPlaylist ) );
162 162
163 tabWidget->showPage( playListTab ); 163 tabWidget->showPage( playListTab );
164} 164}
165 165
166 166
167PlayListWidget::~PlayListWidget() { 167PlayListWidget::~PlayListWidget() {
168 delete d; 168 delete d;
169} 169}
170 170
171 171
172void PlayListWidget::initializeStates() { 172void PlayListWidget::initializeStates() {
173 d->tbPlay->setOn( mediaPlayerState.isPlaying() ); 173 d->tbPlay->setOn( mediaPlayerState.isPlaying() );
174 d->tbLoop->setOn( mediaPlayerState.isLooping() ); 174 d->tbLoop->setOn( mediaPlayerState.isLooping() );
175 d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); 175 d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
176 d->playListFrame->show(); 176 d->playListFrame->show();
177} 177}
178 178
179void PlayListWidget::writeDefaultPlaylist() { 179void PlayListWidget::writeDefaultPlaylist() {
180 180
181 Config config( "OpiePlayer" ); 181 Config config( "OpiePlayer" );
182 config.setGroup( "PlayList" ); 182 config.setGroup( "PlayList" );
183 QString filename=QPEApplication::documentDir() + "/default.m3u"; 183 QString filename=QPEApplication::documentDir() + "/default.m3u";
184 QString currentString = config.readEntry( "CurrentPlaylist", filename); 184 QString currentString = config.readEntry( "CurrentPlaylist", filename);
185 if( currentString == filename) { 185 if( currentString == filename) {
186 Om3u *m3uList; 186 Om3u *m3uList;
187 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 187 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
188 if( d->selectedFiles->first() ) { 188 if( d->selectedFiles->first() ) {
189 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 189 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
190 do { 190 do {
191 // qDebug(d->selectedFiles->current()->file()); 191 // qDebug(d->selectedFiles->current()->file());
192 m3uList->add( d->selectedFiles->current()->file() ); 192 m3uList->add( d->selectedFiles->current()->file() );
193 } 193 }
194 while ( d->selectedFiles->next() ); 194 while ( d->selectedFiles->next() );
195 195
196 m3uList->write(); 196 m3uList->write();
197 m3uList->close(); 197 m3uList->close();
198 delete m3uList; 198 delete m3uList;
199 199
200 } 200 }
201 } 201 }
202} 202}
203 203
204void PlayListWidget::addToSelection( const DocLnk& lnk ) { 204void PlayListWidget::addToSelection( const DocLnk& lnk ) {
205 d->setDocumentUsed = FALSE; 205 d->setDocumentUsed = FALSE;
206 if( QFileInfo( lnk.file() ).exists() || 206 if( QFileInfo( lnk.file() ).exists() ||
207 lnk.file().left(4) == "http" ) { 207 lnk.file().left(4) == "http" ) {
208 d->selectedFiles->addToSelection( lnk ); 208 d->selectedFiles->addToSelection( lnk );
209 } 209 }
210// writeCurrentM3u(); 210// writeCurrentM3u();
211} 211}
212 212
213 213
214void PlayListWidget::clearList() { 214void PlayListWidget::clearList() {
215 while ( first() ) { 215 while ( first() ) {
216 d->selectedFiles->removeSelected(); 216 d->selectedFiles->removeSelected();
217 } 217 }
218 Config cfg( "OpiePlayer" ); 218 Config cfg( "OpiePlayer" );
219 cfg.setGroup("PlayList"); 219 cfg.setGroup("PlayList");
220 cfg.writeEntry("CurrentPlaylist","default"); 220 cfg.writeEntry("CurrentPlaylist","default");
221 setCaption("OpiePlayer"); 221 setCaption("OpiePlayer");
222} 222}
223 223
224void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 224void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
225 switch (mouse) { 225 switch (mouse) {
226 case LeftButton: 226 case LeftButton:
227 break; 227 break;
228 case RightButton: 228 case RightButton:
229 { 229 {
230 QPopupMenu m; 230 QPopupMenu m;
231 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 231 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
232 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 232 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
233 m.exec( QCursor::pos() ); 233 m.exec( QCursor::pos() );
234 } 234 }
235 break; 235 break;
236 } 236 }
237} 237}
238 238
239 239
240void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 240void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
241 switch (mouse) { 241 switch (mouse) {
242 case LeftButton: 242 case LeftButton:
243 break; 243 break;
244 case RightButton: 244 case RightButton:
245 { 245 {
246 QPopupMenu m; 246 QPopupMenu m;
247 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 247 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
248 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 248 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
249 m.exec( QCursor::pos() ); 249 m.exec( QCursor::pos() );
250 } 250 }
251 break; 251 break;
252 } 252 }
253} 253}
254 254
255 255
256void PlayListWidget::addAllToList() { 256void PlayListWidget::addAllToList() {
257 257
258 258
259 audioView->populateView(); 259 audioView->populateView();
260 260
261 QListViewItemIterator audioIt( audioView ); 261 QListViewItemIterator audioIt( audioView );
262 DocLnk lnk; 262 DocLnk lnk;
263 QString filename; 263 QString filename;
264 // iterate through all items of the listview 264 // iterate through all items of the listview
265 for ( ; audioIt.current(); ++audioIt ) { 265 for ( ; audioIt.current(); ++audioIt ) {
266 filename = audioIt.current()->text(3); 266 filename = audioIt.current()->text(3);
267 lnk.setName( QFileInfo(filename).baseName() ); //sets name 267 lnk.setName( QFileInfo(filename).baseName() ); //sets name
268 lnk.setFile( filename ); //sets file name 268 lnk.setFile( filename ); //sets file name
269 d->selectedFiles->addToSelection( lnk); 269 d->selectedFiles->addToSelection( lnk);
270 } 270 }
271 271
272 videoView->populateView(); 272 videoView->populateView();
273 273
274 QListViewItemIterator videoIt( videoView ); 274 QListViewItemIterator videoIt( videoView );
275 for ( ; videoIt.current(); ++videoIt ) { 275 for ( ; videoIt.current(); ++videoIt ) {
276 filename = videoIt.current()->text(3); 276 filename = videoIt.current()->text(3);
277 lnk.setName( QFileInfo(filename).baseName() ); //sets name 277 lnk.setName( QFileInfo(filename).baseName() ); //sets name
278 lnk.setFile( filename ); //sets file name 278 lnk.setFile( filename ); //sets file name
279 d->selectedFiles->addToSelection( lnk); 279 d->selectedFiles->addToSelection( lnk);
280 } 280 }
281 281
282 tabWidget->setCurrentPage(0); 282 tabWidget->setCurrentPage(0);
283 283
284 writeCurrentM3u(); 284 writeCurrentM3u();
285 d->selectedFiles->first(); 285 d->selectedFiles->first();
286} 286}
287 287
288 288
289void PlayListWidget::addAllMusicToList() { 289void PlayListWidget::addAllMusicToList() {
290 290
291 audioView->populateView(); 291 audioView->populateView();
292 292
293 QListViewItemIterator audioIt( audioView ); 293 QListViewItemIterator audioIt( audioView );
294 DocLnk lnk; 294 DocLnk lnk;
295 QString filename; 295 QString filename;
296 // iterate through all items of the listview 296 // iterate through all items of the listview
297 for ( ; audioIt.current(); ++audioIt ) { 297 for ( ; audioIt.current(); ++audioIt ) {
298 filename = audioIt.current()->text(3); 298 filename = audioIt.current()->text(3);
299 lnk.setName( QFileInfo(filename).baseName() ); //sets name 299 lnk.setName( QFileInfo(filename).baseName() ); //sets name
300 lnk.setFile( filename ); //sets file name 300 lnk.setFile( filename ); //sets file name
301 d->selectedFiles->addToSelection( lnk); 301 d->selectedFiles->addToSelection( lnk);
302 } 302 }
303 303
304 tabWidget->setCurrentPage(0); 304 tabWidget->setCurrentPage(0);
305 writeCurrentM3u(); 305 writeCurrentM3u();
306 d->selectedFiles->first(); 306 d->selectedFiles->first();
307} 307}
308 308
309 309
310void PlayListWidget::addAllVideoToList() { 310void PlayListWidget::addAllVideoToList() {
311 311
312 videoView->populateView(); 312 videoView->populateView();
313 313
314 QListViewItemIterator videoIt( videoView ); 314 QListViewItemIterator videoIt( videoView );
315 DocLnk lnk; 315 DocLnk lnk;
316 QString filename; 316 QString filename;
317 for ( ; videoIt.current(); ++videoIt ) { 317 for ( ; videoIt.current(); ++videoIt ) {
318 filename = videoIt.current()->text(3); 318 filename = videoIt.current()->text(3);
319 lnk.setName( QFileInfo(filename).baseName() ); //sets name 319 lnk.setName( QFileInfo(filename).baseName() ); //sets name
320 lnk.setFile( filename ); //sets file name 320 lnk.setFile( filename ); //sets file name
321 d->selectedFiles->addToSelection( lnk); 321 d->selectedFiles->addToSelection( lnk);
322 } 322 }
323 tabWidget->setCurrentPage(0); 323 tabWidget->setCurrentPage(0);
324 writeCurrentM3u(); 324 writeCurrentM3u();
325 d->selectedFiles->first(); 325 d->selectedFiles->first();
326} 326}
327 327
328 328
329void PlayListWidget::setDocument( const QString& fileref ) { 329void PlayListWidget::setDocument( const QString& fileref ) {
330 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 330 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
331 fromSetDocument = TRUE; 331 fromSetDocument = TRUE;
332 QFileInfo fileInfo(fileref); 332 QFileInfo fileInfo(fileref);
333 333
334 if ( !fileInfo.exists() ) { 334 if ( !fileInfo.exists() ) {
335 QMessageBox::warning( this, tr( "Invalid File" ), 335 QMessageBox::warning( this, tr( "Invalid File" ),
336 tr( "There was a problem in getting the file." ) ); 336 tr( "There was a problem in getting the file." ) );
337 return; 337 return;
338 } 338 }
339 339
340 clearList(); 340 clearList();
341 QString extension = fileInfo.extension(false); 341 QString extension = fileInfo.extension(false);
342 342
343 if( extension.find( "m3u", 0, false) != -1 343 if( extension.find( "m3u", 0, false) != -1
344 || extension.find( "pls", 0, false) != -1 ) { 344 || extension.find( "pls", 0, false) != -1 ) {
345 readListFromFile( fileref ); 345 readListFromFile( fileref );
346 } else { 346 } else {
347 clearList(); 347 clearList();
348 DocLnk lnk; 348 DocLnk lnk;
349 lnk.setName( fileInfo.baseName() ); //sets name 349 lnk.setName( fileInfo.baseName() ); //sets name
350 lnk.setFile( fileref ); //sets file name 350 lnk.setFile( fileref ); //sets file name
351 addToSelection( lnk ); 351 addToSelection( lnk );
352 writeCurrentM3u(); 352 writeCurrentM3u();
353 353
354 d->setDocumentUsed = TRUE; 354 d->setDocumentUsed = TRUE;
355 mediaPlayerState.setPlaying( FALSE ); 355 mediaPlayerState.setPlaying( FALSE );
356 mediaPlayerState.setPlaying( TRUE ); 356 mediaPlayerState.setPlaying( TRUE );
357 } 357 }
358} 358}
359 359
360 360
361void PlayListWidget::useSelectedDocument() { 361void PlayListWidget::useSelectedDocument() {
362 d->setDocumentUsed = FALSE; 362 d->setDocumentUsed = FALSE;
363} 363}
364 364
365 365
366const DocLnk *PlayListWidget::current() const { // this is fugly 366const DocLnk *PlayListWidget::current() const { // this is fugly
367 assert( currentTab() == CurrentPlayList ); 367 assert( currentTab() == CurrentPlayList );
368 368
369 const DocLnk *lnk = d->selectedFiles->current(); 369 const DocLnk *lnk = d->selectedFiles->current();