summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp20
2 files changed, 4 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index abe1bb8..6eea2fc 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -1,33 +1,29 @@
1#ifndef PLAYLISTFILEVIEW_H 1#ifndef PLAYLISTFILEVIEW_H
2#define PLAYLISTFILEVIEW_H 2#define PLAYLISTFILEVIEW_H
3 3
4#include "playlistview.h" 4#include "playlistview.h"
5 5
6#include <qpe/applnk.h> 6#include <qpe/applnk.h>
7 7
8class PlayListFileView : public PlayListView 8class PlayListFileView : public PlayListView
9{ 9{
10 Q_OBJECT 10 Q_OBJECT
11public: 11public:
12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 ); 12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
13 virtual ~PlayListFileView(); 13 virtual ~PlayListFileView();
14 14
15 // both temporarily accessible that way until the caller code has
16 // been migrated into this class
17 bool &scannedFiles() { return m_scannedFiles; }
18
19public slots: 15public slots:
20 void scanFiles(); 16 void scanFiles();
21 void populateView(); 17 void populateView();
22 18
23private: 19private:
24 QString m_mimeTypePattern; 20 QString m_mimeTypePattern;
25 QString m_itemPixmapName; 21 QString m_itemPixmapName;
26 DocLnkSet m_files; 22 DocLnkSet m_files;
27 bool m_scannedFiles; 23 bool m_scannedFiles;
28 bool m_viewPopulated; 24 bool m_viewPopulated;
29}; 25};
30 26
31#endif // PLAYLISTFILEVIEW_H 27#endif // PLAYLISTFILEVIEW_H
32/* vim: et sw=4 ts=4 28/* vim: et sw=4 ts=4
33 */ 29 */
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index eb0606d..e754067 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1029 +1,1017 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 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 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#include "audiowidget.h" 58#include "audiowidget.h"
59#include "videowidget.h" 59#include "videowidget.h"
60 60
61extern MediaPlayerState *mediaPlayerState; 61extern MediaPlayerState *mediaPlayerState;
62// extern AudioWidget *audioUI; 62// extern AudioWidget *audioUI;
63// extern VideoWidget *videoUI; 63// extern VideoWidget *videoUI;
64 64
65PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 65PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
66 : PlayListWidgetGui( mediaPlayerState, parent, name ) { 66 : PlayListWidgetGui( mediaPlayerState, parent, name ) {
67 67
68 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 68 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
69 "opieplayer2/add_to_playlist", 69 "opieplayer2/add_to_playlist",
70 this , SLOT(addSelected() ) ); 70 this , SLOT(addSelected() ) );
71 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 71 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
72 "opieplayer2/remove_from_playlist", 72 "opieplayer2/remove_from_playlist",
73 this , SLOT(removeSelected() ) ); 73 this , SLOT(removeSelected() ) );
74 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 74 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
75 this , SLOT( btnPlay( bool) ), TRUE ); 75 this , SLOT( btnPlay( bool) ), TRUE );
76 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 76 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
77 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 77 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
78 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 78 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
79 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 79 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
80 80
81 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 81 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
82 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 82 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
83 this, SLOT( addAllMusicToList() ) ); 83 this, SLOT( addAllMusicToList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
85 this, SLOT( addAllVideoToList() ) ); 85 this, SLOT( addAllVideoToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
87 this, SLOT( addAllToList() ) ); 87 this, SLOT( addAllToList() ) );
88 pmPlayList->insertSeparator(-1); 88 pmPlayList->insertSeparator(-1);
89// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 89// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
90// this, SLOT( saveList() ) ); 90// this, SLOT( saveList() ) );
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( "Open File or URL" ), 94 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
95 this,SLOT( openFile() ) ); 95 this,SLOT( openFile() ) );
96 pmPlayList->insertSeparator(-1); 96 pmPlayList->insertSeparator(-1);
97 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 97 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
98 this,SLOT( scanForAudio() ) ); 98 this,SLOT( scanForAudio() ) );
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
100 this,SLOT( scanForVideo() ) ); 100 this,SLOT( scanForVideo() ) );
101 101
102 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 102 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
103 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 103 &mediaPlayerState, SLOT( toggleFullscreen() ) );
104 104
105 Config cfg( "OpiePlayer" ); 105 Config cfg( "OpiePlayer" );
106 bool b= cfg.readBoolEntry("FullScreen", 0); 106 bool b= cfg.readBoolEntry("FullScreen", 0);
107 mediaPlayerState.setFullscreen( b ); 107 mediaPlayerState.setFullscreen( b );
108 pmView->setItemChecked( -16, b ); 108 pmView->setItemChecked( -16, b );
109 109
110 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 110 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
111 d->selectedFiles, SLOT(moveSelectedUp() ) ); 111 d->selectedFiles, SLOT(moveSelectedUp() ) );
112 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 112 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
113 d->selectedFiles, SLOT(removeSelected() ) ); 113 d->selectedFiles, SLOT(removeSelected() ) );
114 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 114 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
115 d->selectedFiles, SLOT(moveSelectedDown() ) ); 115 d->selectedFiles, SLOT(moveSelectedDown() ) );
116 // QVBox *stretch2 = new QVBox( vbox1 ); 116 // QVBox *stretch2 = new QVBox( vbox1 );
117 117
118 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 118 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
119 SLOT( deletePlaylist() ) ); 119 SLOT( deletePlaylist() ) );
120 connect( pmView, SIGNAL( activated( int ) ), 120 connect( pmView, SIGNAL( activated( int ) ),
121 this, SLOT( pmViewActivated( int ) ) ); 121 this, SLOT( pmViewActivated( int ) ) );
122 connect( skinsMenu, SIGNAL( activated( int ) ) , 122 connect( skinsMenu, SIGNAL( activated( int ) ) ,
123 this, SLOT( skinsMenuActivated( int ) ) ); 123 this, SLOT( skinsMenuActivated( int ) ) );
124 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 124 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
125 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 125 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
126 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 126 connect( audioView, 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( audioView, SIGNAL( returnPressed( QListViewItem *) ), 128 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
129 this,SLOT( playIt( QListViewItem *) ) ); 129 this,SLOT( playIt( QListViewItem *) ) );
130 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 130 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
131 this, SLOT( addToSelection( QListViewItem *) ) ); 131 this, SLOT( addToSelection( QListViewItem *) ) );
132 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 132 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
133 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 133 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
134 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 134 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
135 this,SLOT( playIt( QListViewItem *) ) ); 135 this,SLOT( playIt( QListViewItem *) ) );
136 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 136 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
137 this, SLOT( addToSelection( QListViewItem *) ) ); 137 this, SLOT( addToSelection( QListViewItem *) ) );
138 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 138 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
139 this, SLOT( loadList( const DocLnk & ) ) ); 139 this, SLOT( loadList( const DocLnk & ) ) );
140 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 140 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
141 this, SLOT( tabChanged( QWidget* ) ) ); 141 this, SLOT( tabChanged( QWidget* ) ) );
142 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 142 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
143 d->tbPlay, SLOT( setOn( bool ) ) ); 143 d->tbPlay, SLOT( setOn( bool ) ) );
144 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 144 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
145 d->tbLoop, SLOT( setOn( bool ) ) ); 145 d->tbLoop, SLOT( setOn( bool ) ) );
146 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 146 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
147 d->tbShuffle, SLOT( setOn( bool ) ) ); 147 d->tbShuffle, SLOT( setOn( bool ) ) );
148 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 148 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
149 this, SLOT( playIt( QListViewItem *) ) ); 149 this, SLOT( playIt( QListViewItem *) ) );
150 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 150 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
151 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 151 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
152 152
153 // see which skins are installed 153 // see which skins are installed
154 populateSkinsMenu(); 154 populateSkinsMenu();
155 initializeStates(); 155 initializeStates();
156 156
157 cfg.setGroup("PlayList"); 157 cfg.setGroup("PlayList");
158 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 158 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
159 loadList(DocLnk( currentPlaylist ) ); 159 loadList(DocLnk( currentPlaylist ) );
160} 160}
161 161
162 162
163PlayListWidget::~PlayListWidget() { 163PlayListWidget::~PlayListWidget() {
164 delete d; 164 delete d;
165} 165}
166 166
167 167
168void PlayListWidget::initializeStates() { 168void PlayListWidget::initializeStates() {
169 d->tbPlay->setOn( mediaPlayerState.isPlaying() ); 169 d->tbPlay->setOn( mediaPlayerState.isPlaying() );
170 d->tbLoop->setOn( mediaPlayerState.isLooping() ); 170 d->tbLoop->setOn( mediaPlayerState.isLooping() );
171 d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); 171 d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
172 d->playListFrame->show(); 172 d->playListFrame->show();
173} 173}
174 174
175void PlayListWidget::writeDefaultPlaylist() { 175void PlayListWidget::writeDefaultPlaylist() {
176 176
177 Config config( "OpiePlayer" ); 177 Config config( "OpiePlayer" );
178 config.setGroup( "PlayList" ); 178 config.setGroup( "PlayList" );
179 QString filename=QPEApplication::documentDir() + "/default.m3u"; 179 QString filename=QPEApplication::documentDir() + "/default.m3u";
180 QString currentString = config.readEntry( "CurrentPlaylist", filename); 180 QString currentString = config.readEntry( "CurrentPlaylist", filename);
181 if( currentString == filename) { 181 if( currentString == filename) {
182 Om3u *m3uList; 182 Om3u *m3uList;
183 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 183 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
184 if( d->selectedFiles->first() ) { 184 if( d->selectedFiles->first() ) {
185 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 185 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
186 do { 186 do {
187 // qDebug(d->selectedFiles->current()->file()); 187 // qDebug(d->selectedFiles->current()->file());
188 m3uList->add( d->selectedFiles->current()->file() ); 188 m3uList->add( d->selectedFiles->current()->file() );
189 } 189 }
190 while ( d->selectedFiles->next() ); 190 while ( d->selectedFiles->next() );
191 191
192 m3uList->write(); 192 m3uList->write();
193 m3uList->close(); 193 m3uList->close();
194 if(m3uList) delete m3uList; 194 if(m3uList) delete m3uList;
195 195
196 } 196 }
197 } 197 }
198} 198}
199 199
200void PlayListWidget::addToSelection( const DocLnk& lnk ) { 200void PlayListWidget::addToSelection( const DocLnk& lnk ) {
201 d->setDocumentUsed = FALSE; 201 d->setDocumentUsed = FALSE;
202 if( QFileInfo( lnk.file() ).exists() || 202 if( QFileInfo( lnk.file() ).exists() ||
203 lnk.file().left(4) == "http" ) { 203 lnk.file().left(4) == "http" ) {
204 d->selectedFiles->addToSelection( lnk ); 204 d->selectedFiles->addToSelection( lnk );
205 } 205 }
206// writeCurrentM3u(); 206// writeCurrentM3u();
207} 207}
208 208
209 209
210void PlayListWidget::clearList() { 210void PlayListWidget::clearList() {
211 while ( first() ) { 211 while ( first() ) {
212 d->selectedFiles->removeSelected(); 212 d->selectedFiles->removeSelected();
213 } 213 }
214} 214}
215 215
216void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 216void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
217 switch (mouse) { 217 switch (mouse) {
218 case 1: 218 case 1:
219 break; 219 break;
220 case 2: 220 case 2:
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 }
227 break; 227 break;
228 } 228 }
229} 229}
230 230
231 231
232void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 232void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
233 switch (mouse) { 233 switch (mouse) {
234 case 1: 234 case 1:
235 break; 235 break;
236 case 2: 236 case 2:
237 { 237 {
238 QPopupMenu m; 238 QPopupMenu m;
239 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 239 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
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
248void PlayListWidget::addAllToList() { 248void PlayListWidget::addAllToList() {
249 249
250// QTime t; 250// QTime t;
251// t.start(); 251// t.start();
252 252
253 if(!audioView->scannedFiles()) { 253 audioView->populateView();
254 if(audioView->childCount() < 1)
255 audioView->populateView();
256 }
257 254
258 QListViewItemIterator audioIt( audioView ); 255 QListViewItemIterator audioIt( audioView );
259 DocLnk lnk; 256 DocLnk lnk;
260 QString filename; 257 QString filename;
261 // iterate through all items of the listview 258 // iterate through all items of the listview
262 for ( ; audioIt.current(); ++audioIt ) { 259 for ( ; audioIt.current(); ++audioIt ) {
263 filename = audioIt.current()->text(3); 260 filename = audioIt.current()->text(3);
264 lnk.setName( QFileInfo(filename).baseName() ); //sets name 261 lnk.setName( QFileInfo(filename).baseName() ); //sets name
265 lnk.setFile( filename ); //sets file name 262 lnk.setFile( filename ); //sets file name
266 d->selectedFiles->addToSelection( lnk); 263 d->selectedFiles->addToSelection( lnk);
267 } 264 }
268 265
269 if(!videoView->scannedFiles()) { 266 videoView->populateView();
270 if(videoView->childCount() < 1)
271 videoView->populateView();
272 }
273 267
274 QListViewItemIterator videoIt( videoView ); 268 QListViewItemIterator videoIt( videoView );
275 for ( ; videoIt.current(); ++videoIt ) { 269 for ( ; videoIt.current(); ++videoIt ) {
276 filename = videoIt.current()->text(3); 270 filename = videoIt.current()->text(3);
277 lnk.setName( QFileInfo(filename).baseName() ); //sets name 271 lnk.setName( QFileInfo(filename).baseName() ); //sets name
278 lnk.setFile( filename ); //sets file name 272 lnk.setFile( filename ); //sets file name
279 d->selectedFiles->addToSelection( lnk); 273 d->selectedFiles->addToSelection( lnk);
280 } 274 }
281 275
282 // d->selectedFiles->addToSelection( ); 276 // d->selectedFiles->addToSelection( );
283 // if ( it.current()->isSelected() ) 277 // if ( it.current()->isSelected() )
284 // lst->append( audioIt.current() ); 278 // lst->append( audioIt.current() );
285 // } 279 // }
286 280
287 281
288// if(!audioScan) 282// if(!audioScan)
289// scanForAudio(); 283// scanForAudio();
290// if(!videoScan) 284// if(!videoScan)
291// scanForVideo(); 285// scanForVideo();
292 286
293// DocLnkSet filesAll; 287// DocLnkSet filesAll;
294// Global::findDocuments(&filesAll, "video/*;"+audioMimes); 288// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
295// QListIterator<DocLnk> Adit( filesAll.children() ); 289// QListIterator<DocLnk> Adit( filesAll.children() );
296// for ( ; Adit.current(); ++Adit ) { 290// for ( ; Adit.current(); ++Adit ) {
297// if( QFileInfo( Adit.current()->file() ).exists() ) { 291// if( QFileInfo( Adit.current()->file() ).exists() ) {
298// d->selectedFiles->addToSelection( **Adit ); 292// d->selectedFiles->addToSelection( **Adit );
299// } 293// }
300// } 294// }
301 295
302 // qDebug("elapsed time %d", t.elapsed() ); 296 // qDebug("elapsed time %d", t.elapsed() );
303 297
304 tabWidget->setCurrentPage(0); 298 tabWidget->setCurrentPage(0);
305 299
306 writeCurrentM3u(); 300 writeCurrentM3u();
307 d->selectedFiles->first(); 301 d->selectedFiles->first();
308} 302}
309 303
310 304
311void PlayListWidget::addAllMusicToList() { 305void PlayListWidget::addAllMusicToList() {
312 306
313 if(!audioView->scannedFiles()) { 307 audioView->populateView();
314 if(audioView->childCount() < 1)
315 audioView->populateView();
316 }
317 308
318 QListViewItemIterator audioIt( audioView ); 309 QListViewItemIterator audioIt( audioView );
319 DocLnk lnk; 310 DocLnk lnk;
320 QString filename; 311 QString filename;
321 // iterate through all items of the listview 312 // iterate through all items of the listview
322 for ( ; audioIt.current(); ++audioIt ) { 313 for ( ; audioIt.current(); ++audioIt ) {
323 filename = audioIt.current()->text(3); 314 filename = audioIt.current()->text(3);
324 lnk.setName( QFileInfo(filename).baseName() ); //sets name 315 lnk.setName( QFileInfo(filename).baseName() ); //sets name
325 lnk.setFile( filename ); //sets file name 316 lnk.setFile( filename ); //sets file name
326 d->selectedFiles->addToSelection( lnk); 317 d->selectedFiles->addToSelection( lnk);
327 } 318 }
328 319
329 /* if(!audioScan) 320 /* if(!audioScan)
330 scanForAudio(); 321 scanForAudio();
331 QListIterator<DocLnk> dit( files.children() ); 322 QListIterator<DocLnk> dit( files.children() );
332 for ( ; dit.current(); ++dit ) { 323 for ( ; dit.current(); ++dit ) {
333 if( QFileInfo(dit.current()->file() ).exists() ) { 324 if( QFileInfo(dit.current()->file() ).exists() ) {
334 d->selectedFiles->addToSelection( **dit ); 325 d->selectedFiles->addToSelection( **dit );
335 } 326 }
336 } 327 }
337 */ 328 */
338 tabWidget->setCurrentPage(0); 329 tabWidget->setCurrentPage(0);
339 writeCurrentM3u(); 330 writeCurrentM3u();
340 d->selectedFiles->first(); 331 d->selectedFiles->first();
341} 332}
342 333
343 334
344void PlayListWidget::addAllVideoToList() { 335void PlayListWidget::addAllVideoToList() {
345 336
346 if(!videoView->scannedFiles()) { 337 videoView->populateView();
347 if(videoView->childCount() < 1)
348 videoView->populateView();
349 }
350 338
351 QListViewItemIterator videoIt( videoView ); 339 QListViewItemIterator videoIt( videoView );
352 DocLnk lnk; 340 DocLnk lnk;
353 QString filename; 341 QString filename;
354 for ( ; videoIt.current(); ++videoIt ) { 342 for ( ; videoIt.current(); ++videoIt ) {
355 filename = videoIt.current()->text(3); 343 filename = videoIt.current()->text(3);
356 lnk.setName( QFileInfo(filename).baseName() ); //sets name 344 lnk.setName( QFileInfo(filename).baseName() ); //sets name
357 lnk.setFile( filename ); //sets file name 345 lnk.setFile( filename ); //sets file name
358 d->selectedFiles->addToSelection( lnk); 346 d->selectedFiles->addToSelection( lnk);
359 } 347 }
360 348
361 349
362 /* if(!videoScan) 350 /* if(!videoScan)
363 scanForVideo(); 351 scanForVideo();
364 QListIterator<DocLnk> dit( vFiles.children() ); 352 QListIterator<DocLnk> dit( vFiles.children() );
365 for ( ; dit.current(); ++dit ) { 353 for ( ; dit.current(); ++dit ) {
366 if( QFileInfo( dit.current()->file() ).exists() ) { 354 if( QFileInfo( dit.current()->file() ).exists() ) {
367 d->selectedFiles->addToSelection( **dit ); 355 d->selectedFiles->addToSelection( **dit );
368 } 356 }
369 } 357 }
370*/ 358*/
371 tabWidget->setCurrentPage(0); 359 tabWidget->setCurrentPage(0);
372 writeCurrentM3u(); 360 writeCurrentM3u();
373 d->selectedFiles->first(); 361 d->selectedFiles->first();
374} 362}
375 363
376 364
377void PlayListWidget::setDocument( const QString& fileref ) { 365void PlayListWidget::setDocument( const QString& fileref ) {
378 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 366 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
379 fromSetDocument = TRUE; 367 fromSetDocument = TRUE;
380 if ( fileref.isNull() ) { 368 if ( fileref.isNull() ) {
381 QMessageBox::warning( this, tr( "Invalid File" ), 369 QMessageBox::warning( this, tr( "Invalid File" ),
382 tr( "There was a problem in getting the file." ) ); 370 tr( "There was a problem in getting the file." ) );
383 return; 371 return;
384 } 372 }
385 373
386 clearList(); 374 clearList();
387 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 375 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
388 readm3u( fileref ); 376 readm3u( fileref );
389 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 377 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
390 readm3u( DocLnk( fileref).file() ); 378 readm3u( DocLnk( fileref).file() );
391 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 379 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
392 readPls( fileref ); 380 readPls( fileref );
393 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 381 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
394 readPls( DocLnk( fileref).file() ); 382 readPls( DocLnk( fileref).file() );
395 } else { 383 } else {
396 clearList(); 384 clearList();
397 addToSelection( DocLnk( fileref ) ); 385 addToSelection( DocLnk( fileref ) );
398 writeCurrentM3u(); 386 writeCurrentM3u();
399 387
400 d->setDocumentUsed = TRUE; 388 d->setDocumentUsed = TRUE;
401 mediaPlayerState.setPlaying( FALSE ); 389 mediaPlayerState.setPlaying( FALSE );
402 mediaPlayerState.setPlaying( TRUE ); 390 mediaPlayerState.setPlaying( TRUE );
403 } 391 }
404} 392}
405 393
406 394
407void PlayListWidget::useSelectedDocument() { 395void PlayListWidget::useSelectedDocument() {
408 d->setDocumentUsed = FALSE; 396 d->setDocumentUsed = FALSE;
409} 397}
410 398
411 399
412const DocLnk *PlayListWidget::current() const { // this is fugly 400const DocLnk *PlayListWidget::current() const { // this is fugly
413 assert( currentTab() == CurrentPlayList ); 401 assert( currentTab() == CurrentPlayList );
414 402
415 const DocLnk *lnk = d->selectedFiles->current(); 403 const DocLnk *lnk = d->selectedFiles->current();
416 if ( !lnk ) { 404 if ( !lnk ) {
417 d->selectedFiles->first(); 405 d->selectedFiles->first();
418 lnk = d->selectedFiles->current(); 406 lnk = d->selectedFiles->current();
419 } 407 }
420 assert( lnk ); 408 assert( lnk );
421 return lnk; 409 return lnk;
422} 410}
423 411
424 412
425bool PlayListWidget::prev() { 413bool PlayListWidget::prev() {
426 if ( mediaPlayerState.isShuffled() ) { 414 if ( mediaPlayerState.isShuffled() ) {
427 const DocLnk *cur = current(); 415 const DocLnk *cur = current();
428 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 416 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
429 for ( int i = 0; i < j; i++ ) { 417 for ( int i = 0; i < j; i++ ) {
430 if ( !d->selectedFiles->next() ) 418 if ( !d->selectedFiles->next() )
431 d->selectedFiles->first(); 419 d->selectedFiles->first();
432 } 420 }
433 if ( cur == current() ) 421 if ( cur == current() )
434 if ( !d->selectedFiles->next() ) { 422 if ( !d->selectedFiles->next() ) {
435 d->selectedFiles->first(); 423 d->selectedFiles->first();
436 } 424 }
437 return TRUE; 425 return TRUE;
438 } else { 426 } else {
439 if ( !d->selectedFiles->prev() ) { 427 if ( !d->selectedFiles->prev() ) {
440 if ( mediaPlayerState.isLooping() ) { 428 if ( mediaPlayerState.isLooping() ) {
441 return d->selectedFiles->last(); 429 return d->selectedFiles->last();
442 } else { 430 } else {
443 return FALSE; 431 return FALSE;
444 } 432 }
445 } 433 }
446 return TRUE; 434 return TRUE;
447 } 435 }
448} 436}
449 437
450 438
451bool PlayListWidget::next() { 439bool PlayListWidget::next() {
452//qDebug("<<<<<<<<<<<<next()"); 440//qDebug("<<<<<<<<<<<<next()");
453 if ( mediaPlayerState.isShuffled() ) { 441 if ( mediaPlayerState.isShuffled() ) {
454 return prev(); 442 return prev();
455 } else { 443 } else {
456 if ( !d->selectedFiles->next() ) { 444 if ( !d->selectedFiles->next() ) {
457 if ( mediaPlayerState.isLooping() ) { 445 if ( mediaPlayerState.isLooping() ) {
458 return d->selectedFiles->first(); 446 return d->selectedFiles->first();
459 } else { 447 } else {
460 return FALSE; 448 return FALSE;
461 } 449 }
462 } 450 }
463 return TRUE; 451 return TRUE;
464 } 452 }
465} 453}
466 454
467 455
468bool PlayListWidget::first() { 456bool PlayListWidget::first() {
469 return d->selectedFiles->first(); 457 return d->selectedFiles->first();
470} 458}
471 459
472 460
473bool PlayListWidget::last() { 461bool PlayListWidget::last() {
474 return d->selectedFiles->last(); 462 return d->selectedFiles->last();
475} 463}
476 464
477 465
478 void PlayListWidget::saveList() { 466 void PlayListWidget::saveList() {
479 writem3u(); 467 writem3u();
480 } 468 }
481 469
482 470
483void PlayListWidget::loadList( const DocLnk & lnk) { 471void PlayListWidget::loadList( const DocLnk & lnk) {
484 QString name = lnk.name(); 472 QString name = lnk.name();
485 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 473 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
486 474
487 if( name.length()>0) { 475 if( name.length()>0) {
488 setCaption("OpiePlayer: "+name); 476 setCaption("OpiePlayer: "+name);
489// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 477// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
490 clearList(); 478 clearList();
491 readm3u(lnk.file()); 479 readm3u(lnk.file());
492 tabWidget->setCurrentPage(0); 480 tabWidget->setCurrentPage(0);
493 } 481 }
494} 482}
495 483
496void PlayListWidget::addSelected() { 484void PlayListWidget::addSelected() {
497 assert( inFileListMode() ); 485 assert( inFileListMode() );
498 486
499 QListView *fileListView = currentFileListView(); 487 QListView *fileListView = currentFileListView();
500 QListViewItemIterator it( fileListView ); 488 QListViewItemIterator it( fileListView );
501 for ( ; it.current(); ++it ) 489 for ( ; it.current(); ++it )
502 if ( it.current()->isSelected() ) { 490 if ( it.current()->isSelected() ) {
503 QString filename = it.current()->text(3); 491 QString filename = it.current()->text(3);
504 492
505 DocLnk lnk; 493 DocLnk lnk;
506 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 494 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
507 lnk.setFile( filename ); //sets file name 495 lnk.setFile( filename ); //sets file name
508 496
509 d->selectedFiles->addToSelection( lnk ); 497 d->selectedFiles->addToSelection( lnk );
510 } 498 }
511 499
512 fileListView->clearSelection(); 500 fileListView->clearSelection();
513 501
514 tabWidget->setCurrentPage( 0 ); 502 tabWidget->setCurrentPage( 0 );
515 writeCurrentM3u(); 503 writeCurrentM3u();
516} 504}
517 505
518 506
519void PlayListWidget::removeSelected() { 507void PlayListWidget::removeSelected() {
520 d->selectedFiles->removeSelected( ); 508 d->selectedFiles->removeSelected( );
521 writeCurrentM3u(); 509 writeCurrentM3u();
522} 510}
523 511
524 512
525void PlayListWidget::playIt( QListViewItem *it) { 513void PlayListWidget::playIt( QListViewItem *it) {
526 if(!it) return; 514 if(!it) return;
527 mediaPlayerState.setPlaying(FALSE); 515 mediaPlayerState.setPlaying(FALSE);
528 mediaPlayerState.setPlaying(TRUE); 516 mediaPlayerState.setPlaying(TRUE);
529 d->selectedFiles->unSelect(); 517 d->selectedFiles->unSelect();
530} 518}
531 519
532 520
533void PlayListWidget::addToSelection( QListViewItem *it) { 521void PlayListWidget::addToSelection( QListViewItem *it) {
534 d->setDocumentUsed = FALSE; 522 d->setDocumentUsed = FALSE;
535 523
536 if(it) { 524 if(it) {
537 if ( currentTab() == CurrentPlayList ) 525 if ( currentTab() == CurrentPlayList )
538 return; 526 return;
539 // case 1: { 527 // case 1: {
540 DocLnk lnk; 528 DocLnk lnk;
541 QString filename; 529 QString filename;
542 530
543 filename=it->text(3); 531 filename=it->text(3);
544 lnk.setName( QFileInfo(filename).baseName() ); //sets name 532 lnk.setName( QFileInfo(filename).baseName() ); //sets name
545 lnk.setFile( filename ); //sets file name 533 lnk.setFile( filename ); //sets file name
546 d->selectedFiles->addToSelection( lnk); 534 d->selectedFiles->addToSelection( lnk);
547 535
548 writeCurrentM3u(); 536 writeCurrentM3u();
549 tabWidget->setCurrentPage(0); 537 tabWidget->setCurrentPage(0);
550 538
551 } 539 }
552} 540}
553 541
554 542
555void PlayListWidget::tabChanged(QWidget *) { 543void PlayListWidget::tabChanged(QWidget *) {
556 544
557 d->tbPlay->setEnabled( true ); 545 d->tbPlay->setEnabled( true );
558 546
559 switch ( currentTab() ) { 547 switch ( currentTab() ) {
560 case CurrentPlayList: 548 case CurrentPlayList:
561 { 549 {
562 if( !tbDeletePlaylist->isHidden() ) { 550 if( !tbDeletePlaylist->isHidden() ) {
563 tbDeletePlaylist->hide(); 551 tbDeletePlaylist->hide();
564 } 552 }
565 d->tbRemoveFromList->setEnabled(TRUE); 553 d->tbRemoveFromList->setEnabled(TRUE);
566 d->tbAddToList->setEnabled(FALSE); 554 d->tbAddToList->setEnabled(FALSE);
567 555
568 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 556 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
569 } 557 }
570 break; 558 break;
571 case AudioFiles: 559 case AudioFiles:
572 { 560 {
573 audioView->populateView(); 561 audioView->populateView();
574 562
575 if( !tbDeletePlaylist->isHidden() ) { 563 if( !tbDeletePlaylist->isHidden() ) {
576 tbDeletePlaylist->hide(); 564 tbDeletePlaylist->hide();
577 } 565 }
578 d->tbRemoveFromList->setEnabled(FALSE); 566 d->tbRemoveFromList->setEnabled(FALSE);
579 d->tbAddToList->setEnabled(TRUE); 567 d->tbAddToList->setEnabled(TRUE);
580 } 568 }
581 break; 569 break;
582 case VideoFiles: 570 case VideoFiles:
583 { 571 {
584 videoView->populateView(); 572 videoView->populateView();
585 if( !tbDeletePlaylist->isHidden() ) { 573 if( !tbDeletePlaylist->isHidden() ) {
586 tbDeletePlaylist->hide(); 574 tbDeletePlaylist->hide();
587 } 575 }
588 d->tbRemoveFromList->setEnabled(FALSE); 576 d->tbRemoveFromList->setEnabled(FALSE);
589 d->tbAddToList->setEnabled(TRUE); 577 d->tbAddToList->setEnabled(TRUE);
590 } 578 }
591 break; 579 break;
592 case PlayLists: 580 case PlayLists:
593 { 581 {
594 if( tbDeletePlaylist->isHidden() ) { 582 if( tbDeletePlaylist->isHidden() ) {
595 tbDeletePlaylist->show(); 583 tbDeletePlaylist->show();
596 } 584 }
597 playLists->reread(); 585 playLists->reread();
598 d->tbAddToList->setEnabled(FALSE); 586 d->tbAddToList->setEnabled(FALSE);
599 587
600 d->tbPlay->setEnabled( false ); 588 d->tbPlay->setEnabled( false );
601 } 589 }
602 break; 590 break;
603 }; 591 };
604} 592}
605 593
606 594
607void PlayListWidget::btnPlay(bool b) { 595void PlayListWidget::btnPlay(bool b) {
608// mediaPlayerState->setPlaying(false); 596// mediaPlayerState->setPlaying(false);
609 mediaPlayerState.setPlaying(b); 597 mediaPlayerState.setPlaying(b);
610 insanityBool=FALSE; 598 insanityBool=FALSE;
611} 599}
612 600
613void PlayListWidget::deletePlaylist() { 601void PlayListWidget::deletePlaylist() {
614 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 602 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
615 (tr("You really want to delete\nthis playlist?")), 603 (tr("You really want to delete\nthis playlist?")),
616 (tr("Yes")), (tr("No")), 0 )){ 604 (tr("Yes")), (tr("No")), 0 )){
617 case 0: // Yes clicked, 605 case 0: // Yes clicked,
618 QFile().remove(playLists->selectedDocument().file()); 606 QFile().remove(playLists->selectedDocument().file());
619 QFile().remove(playLists->selectedDocument().linkFile()); 607 QFile().remove(playLists->selectedDocument().linkFile());
620 playLists->reread(); 608 playLists->reread();
621 break; 609 break;
622 case 1: // Cancel 610 case 1: // Cancel
623 break; 611 break;
624 }; 612 };
625} 613}
626 614
627 615
628void PlayListWidget::playSelected() { 616void PlayListWidget::playSelected() {
629 btnPlay( TRUE); 617 btnPlay( TRUE);
630} 618}
631 619
632 620
633void PlayListWidget::scanForAudio() { 621void PlayListWidget::scanForAudio() {
634 audioView->scanFiles(); 622 audioView->scanFiles();
635} 623}
636 624
637void PlayListWidget::scanForVideo() { 625void PlayListWidget::scanForVideo() {
638 videoView->scanFiles(); 626 videoView->scanFiles();
639} 627}
640 628
641QListView *PlayListWidget::currentFileListView() const 629QListView *PlayListWidget::currentFileListView() const
642{ 630{
643 switch ( currentTab() ) { 631 switch ( currentTab() ) {
644 case AudioFiles: return audioView; 632 case AudioFiles: return audioView;
645 case VideoFiles: return videoView; 633 case VideoFiles: return videoView;
646 default: assert( false ); 634 default: assert( false );
647 } 635 }
648 return 0; 636 return 0;
649} 637}
650 638
651bool PlayListWidget::inFileListMode() const 639bool PlayListWidget::inFileListMode() const
652{ 640{
653 TabType tab = currentTab(); 641 TabType tab = currentTab();
654 return tab == AudioFiles || tab == VideoFiles; 642 return tab == AudioFiles || tab == VideoFiles;
655} 643}
656 644
657void PlayListWidget::openFile() { 645void PlayListWidget::openFile() {
658 // http://66.28.164.33:2080 646 // http://66.28.164.33:2080
659 // http://somafm.com/star0242.m3u 647 // http://somafm.com/star0242.m3u
660 QString filename, name; 648 QString filename, name;
661 InputDialog *fileDlg; 649 InputDialog *fileDlg;
662 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 650 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
663 fileDlg->exec(); 651 fileDlg->exec();
664 if( fileDlg->result() == 1 ) { 652 if( fileDlg->result() == 1 ) {
665 filename = fileDlg->text(); 653 filename = fileDlg->text();
666 qDebug( "Selected filename is " + filename ); 654 qDebug( "Selected filename is " + filename );
667 // Om3u *m3uList; 655 // Om3u *m3uList;
668 DocLnk lnk; 656 DocLnk lnk;
669 Config cfg( "OpiePlayer" ); 657 Config cfg( "OpiePlayer" );
670 cfg.setGroup("PlayList"); 658 cfg.setGroup("PlayList");
671 659
672 if(filename.left(4) == "http") { 660 if(filename.left(4) == "http") {
673 QString m3uFile, m3uFilePath; 661 QString m3uFile, m3uFilePath;
674 if(filename.find(":",8,TRUE) != -1) { //found a port 662 if(filename.find(":",8,TRUE) != -1) { //found a port
675 m3uFile = filename.left( filename.find( ":",8,TRUE)); 663 m3uFile = filename.left( filename.find( ":",8,TRUE));
676 m3uFile = m3uFile.right( 7); 664 m3uFile = m3uFile.right( 7);
677 } else if(filename.left(4) == "http"){ 665 } else if(filename.left(4) == "http"){
678 m3uFile=filename; 666 m3uFile=filename;
679 m3uFile = m3uFile.right( m3uFile.length() - 7); 667 m3uFile = m3uFile.right( m3uFile.length() - 7);
680 } else{ 668 } else{
681 m3uFile=filename; 669 m3uFile=filename;
682 } 670 }
683 671
684// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 672// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
685 lnk.setName( filename ); //sets name 673 lnk.setName( filename ); //sets name
686 lnk.setFile( filename ); //sets file name 674 lnk.setFile( filename ); //sets file name
687 675
688// lnk.setIcon("opieplayer2/musicfile"); 676// lnk.setIcon("opieplayer2/musicfile");
689 677
690 d->selectedFiles->addToSelection( lnk ); 678 d->selectedFiles->addToSelection( lnk );
691 writeCurrentM3u(); 679 writeCurrentM3u();
692 d->selectedFiles->setSelectedItem( lnk.name()); 680 d->selectedFiles->setSelectedItem( lnk.name());
693 } 681 }
694 else if( filename.right( 3) == "m3u" ) { 682 else if( filename.right( 3) == "m3u" ) {
695 readm3u( filename ); 683 readm3u( filename );
696 684
697 } else if( filename.right(3) == "pls" ) { 685 } else if( filename.right(3) == "pls" ) {
698 readPls( filename ); 686 readPls( filename );
699 } else { 687 } else {
700 lnk.setName( QFileInfo(filename).baseName() ); //sets name 688 lnk.setName( QFileInfo(filename).baseName() ); //sets name
701 lnk.setFile( filename ); //sets file name 689 lnk.setFile( filename ); //sets file name
702 d->selectedFiles->addToSelection( lnk); 690 d->selectedFiles->addToSelection( lnk);
703 writeCurrentM3u(); 691 writeCurrentM3u();
704 d->selectedFiles->setSelectedItem( lnk.name()); 692 d->selectedFiles->setSelectedItem( lnk.name());
705 } 693 }
706 } 694 }
707 695
708 if( fileDlg ) { 696 if( fileDlg ) {
709 delete fileDlg; 697 delete fileDlg;
710 } 698 }
711} 699}
712 700
713/* 701/*
714reads m3u and shows files/urls to playlist widget */ 702reads m3u and shows files/urls to playlist widget */
715void PlayListWidget::readm3u( const QString &filename ) { 703void PlayListWidget::readm3u( const QString &filename ) {
716 qDebug( "read m3u filename " + filename ); 704 qDebug( "read m3u filename " + filename );
717 705
718 Om3u *m3uList; 706 Om3u *m3uList;
719 QString s, name; 707 QString s, name;
720 m3uList = new Om3u( filename, IO_ReadOnly ); 708 m3uList = new Om3u( filename, IO_ReadOnly );
721 m3uList->readM3u(); 709 m3uList->readM3u();
722 DocLnk lnk; 710 DocLnk lnk;
723 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 711 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
724 s = *it; 712 s = *it;
725// qDebug("reading "+ s); 713// qDebug("reading "+ s);
726 if(s.left(4)=="http") { 714 if(s.left(4)=="http") {
727 lnk.setName( s ); //sets file name 715 lnk.setName( s ); //sets file name
728 lnk.setIcon("opieplayer2/musicfile"); 716 lnk.setIcon("opieplayer2/musicfile");
729 lnk.setFile( s ); //sets file name 717 lnk.setFile( s ); //sets file name
730 718
731 } else { 719 } else {
732 // if( QFileInfo( s ).exists() ) { 720 // if( QFileInfo( s ).exists() ) {
733 lnk.setName( QFileInfo(s).baseName()); 721 lnk.setName( QFileInfo(s).baseName());
734 // if(s.right(4) == '.') {//if regular file 722 // if(s.right(4) == '.') {//if regular file
735 if(s.left(1) != "/") { 723 if(s.left(1) != "/") {
736 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 724 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
737 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 725 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
738// lnk.setIcon(MimeType(s).pixmap() ); 726// lnk.setIcon(MimeType(s).pixmap() );
739// lnk.setIcon("SoundPlayer"); 727// lnk.setIcon("SoundPlayer");
740 } else { 728 } else {
741 // qDebug("set link2 "+s); 729 // qDebug("set link2 "+s);
742 lnk.setFile( s); 730 lnk.setFile( s);
743// lnk.setIcon(MimeType(s).pixmap() ); 731// lnk.setIcon(MimeType(s).pixmap() );
744// lnk.setIcon("SoundPlayer"); 732// lnk.setIcon("SoundPlayer");
745 } 733 }
746 } 734 }
747 d->selectedFiles->addToSelection( lnk ); 735 d->selectedFiles->addToSelection( lnk );
748 } 736 }
749 Config config( "OpiePlayer" ); 737 Config config( "OpiePlayer" );
750 config.setGroup( "PlayList" ); 738 config.setGroup( "PlayList" );
751 739
752 config.writeEntry("CurrentPlaylist",filename); 740 config.writeEntry("CurrentPlaylist",filename);
753 config.write(); 741 config.write();
754 currentPlayList=filename; 742 currentPlayList=filename;
755 743
756// m3uList->write(); 744// m3uList->write();
757 m3uList->close(); 745 m3uList->close();
758 if(m3uList) delete m3uList; 746 if(m3uList) delete m3uList;
759 747
760 d->selectedFiles->setSelectedItem( s); 748 d->selectedFiles->setSelectedItem( s);
761 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 749 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
762 750
763} 751}
764 752
765/* 753/*
766reads pls and adds files/urls to playlist */ 754reads pls and adds files/urls to playlist */
767void PlayListWidget::readPls( const QString &filename ) { 755void PlayListWidget::readPls( const QString &filename ) {
768 756
769 qDebug( "pls filename is " + filename ); 757 qDebug( "pls filename is " + filename );
770 Om3u *m3uList; 758 Om3u *m3uList;
771 QString s, name; 759 QString s, name;
772 m3uList = new Om3u( filename, IO_ReadOnly ); 760 m3uList = new Om3u( filename, IO_ReadOnly );
773 m3uList->readPls(); 761 m3uList->readPls();
774 762
775 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 763 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
776 s = *it; 764 s = *it;
777 // s.replace( QRegExp( "%20" )," " ); 765 // s.replace( QRegExp( "%20" )," " );
778 DocLnk lnk( s ); 766 DocLnk lnk( s );
779 QFileInfo f( s ); 767 QFileInfo f( s );
780 QString name = f.baseName(); 768 QString name = f.baseName();
781 769
782 if( name.left( 4 ) == "http" ) { 770 if( name.left( 4 ) == "http" ) {
783 name = s.right( s.length() - 7); 771 name = s.right( s.length() - 7);
784 } else { 772 } else {
785 name = s; 773 name = s;
786 } 774 }
787 775
788 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 776 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
789 777
790 lnk.setName( name ); 778 lnk.setName( name );
791 if( s.at( s.length() - 4) == '.') {// if this is probably a file 779 if( s.at( s.length() - 4) == '.') {// if this is probably a file
792 lnk.setFile( s ); 780 lnk.setFile( s );
793 } else { //if its a url 781 } else { //if its a url
794// if( name.right( 1 ).find( '/' ) == -1) { 782// if( name.right( 1 ).find( '/' ) == -1) {
795// s += "/"; 783// s += "/";
796// } 784// }
797 lnk.setFile( s ); 785 lnk.setFile( s );
798 } 786 }
799 lnk.setType( "audio/x-mpegurl" ); 787 lnk.setType( "audio/x-mpegurl" );
800 788
801 lnk.writeLink(); 789 lnk.writeLink();
802 d->selectedFiles->addToSelection( lnk ); 790 d->selectedFiles->addToSelection( lnk );
803 } 791 }
804 792
805 m3uList->close(); 793 m3uList->close();
806 if(m3uList) delete m3uList; 794 if(m3uList) delete m3uList;
807} 795}
808 796
809/* 797/*
810 writes current playlist to current m3u file */ 798 writes current playlist to current m3u file */
811void PlayListWidget::writeCurrentM3u() { 799void PlayListWidget::writeCurrentM3u() {
812 qDebug("writing to current m3u"); 800 qDebug("writing to current m3u");
813 Config cfg( "OpiePlayer" ); 801 Config cfg( "OpiePlayer" );
814 cfg.setGroup("PlayList"); 802 cfg.setGroup("PlayList");
815 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 803 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
816 804
817 Om3u *m3uList; 805 Om3u *m3uList;
818 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 806 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
819 if( d->selectedFiles->first()) { 807 if( d->selectedFiles->first()) {
820 808
821 do { 809 do {
822 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 810 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
823 m3uList->add( d->selectedFiles->current()->file() ); 811 m3uList->add( d->selectedFiles->current()->file() );
824 } 812 }
825 while ( d->selectedFiles->next() ); 813 while ( d->selectedFiles->next() );
826 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 814 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
827 m3uList->write(); 815 m3uList->write();
828 m3uList->close(); 816 m3uList->close();
829 817
830 if(m3uList) delete m3uList; 818 if(m3uList) delete m3uList;
831 } 819 }
832 820
833} 821}
834 822
835 /* 823 /*
836 writes current playlist to m3u file */ 824 writes current playlist to m3u file */
837void PlayListWidget::writem3u() { 825void PlayListWidget::writem3u() {
838 InputDialog *fileDlg; 826 InputDialog *fileDlg;
839 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 827 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
840 fileDlg->exec(); 828 fileDlg->exec();
841 QString name, filename, list; 829 QString name, filename, list;
842 Om3u *m3uList; 830 Om3u *m3uList;
843 831
844 if( fileDlg->result() == 1 ) { 832 if( fileDlg->result() == 1 ) {
845 name = fileDlg->text(); 833 name = fileDlg->text();
846// qDebug( filename ); 834// qDebug( filename );
847 835
848 if( name.left( 1) != "/" ) { 836 if( name.left( 1) != "/" ) {
849 filename = QPEApplication::documentDir() + "/" + name; 837 filename = QPEApplication::documentDir() + "/" + name;
850 } 838 }
851 839
852 if( name.right( 3 ) != "m3u" ) { 840 if( name.right( 3 ) != "m3u" ) {
853 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 841 filename = QPEApplication::documentDir() + "/" +name+".m3u";
854 } 842 }
855 843
856 if( d->selectedFiles->first()) { 844 if( d->selectedFiles->first()) {
857 m3uList = new Om3u(filename, IO_ReadWrite); 845 m3uList = new Om3u(filename, IO_ReadWrite);
858 846
859 do { 847 do {
860 m3uList->add( d->selectedFiles->current()->file()); 848 m3uList->add( d->selectedFiles->current()->file());
861 } 849 }
862 while ( d->selectedFiles->next() ); 850 while ( d->selectedFiles->next() );
863 // qDebug( list ); 851 // qDebug( list );
864 m3uList->write(); 852 m3uList->write();
865 m3uList->close(); 853 m3uList->close();
866 if(m3uList) delete m3uList; 854 if(m3uList) delete m3uList;
867 855
868 if(fileDlg) delete fileDlg; 856 if(fileDlg) delete fileDlg;
869 857
870 DocLnk lnk; 858 DocLnk lnk;
871 lnk.setFile( filename); 859 lnk.setFile( filename);
872 lnk.setIcon("opieplayer2/playlist2"); 860 lnk.setIcon("opieplayer2/playlist2");
873 lnk.setName( name); //sets file name 861 lnk.setName( name); //sets file name
874 862
875 // qDebug(filename); 863 // qDebug(filename);
876 Config config( "OpiePlayer" ); 864 Config config( "OpiePlayer" );
877 config.setGroup( "PlayList" ); 865 config.setGroup( "PlayList" );
878 866
879 config.writeEntry("CurrentPlaylist",filename); 867 config.writeEntry("CurrentPlaylist",filename);
880 currentPlayList=filename; 868 currentPlayList=filename;
881 869
882 if(!lnk.writeLink()) { 870 if(!lnk.writeLink()) {
883 qDebug("Writing doclink did not work"); 871 qDebug("Writing doclink did not work");
884 } 872 }
885 873
886 setCaption(tr("OpiePlayer: ") + name); 874 setCaption(tr("OpiePlayer: ") + name);
887 } 875 }
888 } 876 }
889} 877}
890 878
891void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 879void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
892 switch ( e->key() ) { 880 switch ( e->key() ) {
893 ////////////////////////////// Zaurus keys 881 ////////////////////////////// Zaurus keys
894 case Key_F9: //activity 882 case Key_F9: //activity
895 // if(audioUI->isHidden()) 883 // if(audioUI->isHidden())
896 // audioUI->showMaximized(); 884 // audioUI->showMaximized();
897 break; 885 break;
898 case Key_F10: //contacts 886 case Key_F10: //contacts
899 // if( videoUI->isHidden()) 887 // if( videoUI->isHidden())
900 // videoUI->showMaximized(); 888 // videoUI->showMaximized();
901 break; 889 break;
902 case Key_F11: //menu 890 case Key_F11: //menu
903 break; 891 break;
904 case Key_F12: //home 892 case Key_F12: //home
905 // doBlank(); 893 // doBlank();
906 break; 894 break;
907 case Key_F13: //mail 895 case Key_F13: //mail
908 // doUnblank(); 896 // doUnblank();
909 break; 897 break;
910 case Key_Q: //add to playlist 898 case Key_Q: //add to playlist
911 addSelected(); 899 addSelected();
912 break; 900 break;
913 case Key_R: //remove from playlist 901 case Key_R: //remove from playlist
914 removeSelected(); 902 removeSelected();
915 break; 903 break;
916 // case Key_P: //play 904 // case Key_P: //play
917 // qDebug("Play"); 905 // qDebug("Play");
918 // playSelected(); 906 // playSelected();
919 // break; 907 // break;
920 case Key_Space: 908 case Key_Space:
921 // playSelected(); puh 909 // playSelected(); puh
922 break; 910 break;
923 case Key_1: 911 case Key_1:
924 tabWidget->setCurrentPage( 0 ); 912 tabWidget->setCurrentPage( 0 );
925 break; 913 break;
926 case Key_2: 914 case Key_2:
927 tabWidget->setCurrentPage( 1 ); 915 tabWidget->setCurrentPage( 1 );
928 break; 916 break;
929 case Key_3: 917 case Key_3:
930 tabWidget->setCurrentPage( 2 ); 918 tabWidget->setCurrentPage( 2 );
931 break; 919 break;
932 case Key_4: 920 case Key_4:
933 tabWidget->setCurrentPage( 3 ); 921 tabWidget->setCurrentPage( 3 );
934 break; 922 break;
935 case Key_Down: 923 case Key_Down:
936 if ( !d->selectedFiles->next() ) 924 if ( !d->selectedFiles->next() )
937 d->selectedFiles->first(); 925 d->selectedFiles->first();
938 break; 926 break;
939 case Key_Up: 927 case Key_Up:
940 if ( !d->selectedFiles->prev() ) 928 if ( !d->selectedFiles->prev() )
941 // d->selectedFiles->last(); 929 // d->selectedFiles->last();
942 break; 930 break;
943 } 931 }
944} 932}
945 933
946void PlayListWidget::pmViewActivated(int index) { 934void PlayListWidget::pmViewActivated(int index) {
947// qDebug("%d", index); 935// qDebug("%d", index);
948 switch(index) { 936 switch(index) {
949 case -16: 937 case -16:
950 { 938 {
951 mediaPlayerState.toggleFullscreen(); 939 mediaPlayerState.toggleFullscreen();
952 bool b=mediaPlayerState.isFullscreen(); 940 bool b=mediaPlayerState.isFullscreen();
953 pmView->setItemChecked( index, b); 941 pmView->setItemChecked( index, b);
954 Config cfg( "OpiePlayer" ); 942 Config cfg( "OpiePlayer" );
955 cfg.writeEntry( "FullScreen", b ); 943 cfg.writeEntry( "FullScreen", b );
956 } 944 }
957 break; 945 break;
958 }; 946 };
959} 947}
960 948
961void PlayListWidget::populateSkinsMenu() { 949void PlayListWidget::populateSkinsMenu() {
962 int item = 0; 950 int item = 0;
963 defaultSkinIndex = 0; 951 defaultSkinIndex = 0;
964 QString skinName; 952 QString skinName;
965 Config cfg( "OpiePlayer" ); 953 Config cfg( "OpiePlayer" );
966 cfg.setGroup("Options" ); 954 cfg.setGroup("Options" );
967 QString skin = cfg.readEntry( "Skin", "default" ); 955 QString skin = cfg.readEntry( "Skin", "default" );
968 956
969 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 957 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
970 skinsDir.setFilter( QDir::Dirs ); 958 skinsDir.setFilter( QDir::Dirs );
971 skinsDir.setSorting(QDir::Name ); 959 skinsDir.setSorting(QDir::Name );
972 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 960 const QFileInfoList *skinslist = skinsDir.entryInfoList();
973 QFileInfoListIterator it( *skinslist ); 961 QFileInfoListIterator it( *skinslist );
974 QFileInfo *fi; 962 QFileInfo *fi;
975 while ( ( fi = it.current() ) ) { 963 while ( ( fi = it.current() ) ) {
976 skinName = fi->fileName(); 964 skinName = fi->fileName();
977// qDebug( fi->fileName() ); 965// qDebug( fi->fileName() );
978 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 966 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
979 item = skinsMenu->insertItem( fi->fileName() ) ; 967 item = skinsMenu->insertItem( fi->fileName() ) ;
980 } 968 }
981 if( skinName == "default" ) { 969 if( skinName == "default" ) {
982 defaultSkinIndex = item; 970 defaultSkinIndex = item;
983 } 971 }
984 if( skinName == skin ) { 972 if( skinName == skin ) {
985 skinsMenu->setItemChecked( item, TRUE ); 973 skinsMenu->setItemChecked( item, TRUE );
986 } 974 }
987 ++it; 975 ++it;
988 } 976 }
989} 977}
990 978
991void PlayListWidget::skinsMenuActivated( int item ) { 979void PlayListWidget::skinsMenuActivated( int item ) {
992 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 980 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
993 skinsMenu->setItemChecked( i, FALSE ); 981 skinsMenu->setItemChecked( i, FALSE );
994 } 982 }
995 skinsMenu->setItemChecked( item, TRUE ); 983 skinsMenu->setItemChecked( item, TRUE );
996 984
997 { 985 {
998 Config cfg( "OpiePlayer" ); 986 Config cfg( "OpiePlayer" );
999 cfg.setGroup("Options"); 987 cfg.setGroup("Options");
1000 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 988 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1001 } 989 }
1002 990
1003 emit skinSelected(); 991 emit skinSelected();
1004} 992}
1005 993
1006PlayListWidget::TabType PlayListWidget::currentTab() const 994PlayListWidget::TabType PlayListWidget::currentTab() const
1007{ 995{
1008 static const TabType indexToTabType[ TabTypeCount ] = 996 static const TabType indexToTabType[ TabTypeCount ] =
1009 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 997 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1010 998
1011 int index = tabWidget->currentPageIndex(); 999 int index = tabWidget->currentPageIndex();
1012 assert( index < TabTypeCount && index >= 0 ); 1000 assert( index < TabTypeCount && index >= 0 );
1013 1001
1014 return indexToTabType[ index ]; 1002 return indexToTabType[ index ];
1015} 1003}
1016 1004
1017PlayListWidget::Entry PlayListWidget::currentEntry() const 1005PlayListWidget::Entry PlayListWidget::currentEntry() const
1018{ 1006{
1019 if ( currentTab() == CurrentPlayList ) { 1007 if ( currentTab() == CurrentPlayList ) {
1020 const DocLnk *lnk = current(); 1008 const DocLnk *lnk = current();
1021 return Entry( lnk->name(), lnk->file() ); 1009 return Entry( lnk->name(), lnk->file() );
1022 } 1010 }
1023 1011
1024 return Entry( currentFileListPathName() ); 1012 return Entry( currentFileListPathName() );
1025} 1013}
1026 1014
1027QString PlayListWidget::currentFileListPathName() const { 1015QString PlayListWidget::currentFileListPathName() const {
1028 return currentFileListView()->currentItem()->text( 3 ); 1016 return currentFileListView()->currentItem()->text( 3 );
1029} 1017}