summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 2323ac2..eeaed33 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,1311 +1,1321 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// code added by L. J. Potter Sat 03-02-2002 06:17:54 20// code added by L. J. Potter Sat 03-02-2002 06:17:54
21#define QTOPIA_INTERNAL_FSLP 21#define QTOPIA_INTERNAL_FSLP
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23 23
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/fileselector.h> 26#include <qpe/fileselector.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/lnkproperties.h> 28#include <qpe/lnkproperties.h>
29#include <qpe/storage.h> 29#include <qpe/storage.h>
30 30
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qpe/global.h> 33#include <qpe/global.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qaction.h> 35#include <qaction.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qimage.h> 37#include <qimage.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <qdir.h> 39#include <qdir.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlist.h> 42#include <qlist.h>
43#include <qlistbox.h> 43#include <qlistbox.h>
44#include <qmainwindow.h> 44#include <qmainwindow.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qtoolbutton.h> 46#include <qtoolbutton.h>
47#include <qtabwidget.h> 47#include <qtabwidget.h>
48#include <qlistview.h> 48#include <qlistview.h>
49#include <qpoint.h> 49#include <qpoint.h>
50#include <qlineedit.h> 50#include <qlineedit.h>
51#include <qpushbutton.h> 51#include <qpushbutton.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qtextstream.h> 53#include <qtextstream.h>
54 54
55//#include <qtimer.h> 55//#include <qtimer.h>
56 56
57#include "playlistselection.h" 57#include "playlistselection.h"
58#include "playlistwidget.h" 58#include "playlistwidget.h"
59#include "mediaplayerstate.h" 59#include "mediaplayerstate.h"
60 60
61#include "inputDialog.h" 61#include "inputDialog.h"
62 62
63#include <stdlib.h> 63#include <stdlib.h>
64#include "audiowidget.h" 64#include "audiowidget.h"
65#include "videowidget.h" 65#include "videowidget.h"
66 66
67#include <unistd.h> 67#include <unistd.h>
68#include <sys/file.h> 68#include <sys/file.h>
69#include <sys/ioctl.h> 69#include <sys/ioctl.h>
70#include <sys/soundcard.h> 70#include <sys/soundcard.h>
71 71
72// for setBacklight() 72// for setBacklight()
73#include <linux/fb.h> 73#include <linux/fb.h>
74#include <sys/types.h> 74#include <sys/types.h>
75#include <sys/stat.h> 75#include <sys/stat.h>
76#include <stdlib.h> 76#include <stdlib.h>
77 77
78#define BUTTONS_ON_TOOLBAR 78#define BUTTONS_ON_TOOLBAR
79#define SIDE_BUTTONS 79#define SIDE_BUTTONS
80#define CAN_SAVE_LOAD_PLAYLISTS 80#define CAN_SAVE_LOAD_PLAYLISTS
81 81
82extern AudioWidget *audioUI; 82extern AudioWidget *audioUI;
83extern VideoWidget *videoUI; 83extern VideoWidget *videoUI;
84extern MediaPlayerState *mediaPlayerState; 84extern MediaPlayerState *mediaPlayerState;
85 85
86// class myFileSelector { 86// class myFileSelector {
87 87
88// }; 88// };
89class PlayListWidgetPrivate { 89class PlayListWidgetPrivate {
90public: 90public:
91 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 91 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
92 QFrame *playListFrame; 92 QFrame *playListFrame;
93 FileSelector *files; 93 FileSelector *files;
94 PlayListSelection *selectedFiles; 94 PlayListSelection *selectedFiles;
95 bool setDocumentUsed; 95 bool setDocumentUsed;
96 DocLnk *current; 96 DocLnk *current;
97}; 97};
98 98
99 99
100class ToolButton : public QToolButton { 100class ToolButton : public QToolButton {
101public: 101public:
102 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 102 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
103 : QToolButton( parent, name ) { 103 : QToolButton( parent, name ) {
104 setTextLabel( name ); 104 setTextLabel( name );
105 setPixmap( Resource::loadPixmap( icon ) ); 105 setPixmap( Resource::loadPixmap( icon ) );
106 setAutoRaise( TRUE ); 106 setAutoRaise( TRUE );
107 setFocusPolicy( QWidget::NoFocus ); 107 setFocusPolicy( QWidget::NoFocus );
108 setToggleButton( t ); 108 setToggleButton( t );
109 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 109 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
110 QPEMenuToolFocusManager::manager()->addWidget( this ); 110 QPEMenuToolFocusManager::manager()->addWidget( this );
111 } 111 }
112}; 112};
113 113
114 114
115class MenuItem : public QAction { 115class MenuItem : public QAction {
116public: 116public:
117 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 117 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
118 : QAction( text, QString::null, 0, 0 ) { 118 : QAction( text, QString::null, 0, 0 ) {
119 connect( this, SIGNAL( activated() ), handler, slot ); 119 connect( this, SIGNAL( activated() ), handler, slot );
120 addTo( parent ); 120 addTo( parent );
121 } 121 }
122}; 122};
123 123
124 124
125PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 125PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
126 : QMainWindow( parent, name, fl ) { 126 : QMainWindow( parent, name, fl ) {
127 127
128 d = new PlayListWidgetPrivate; 128 d = new PlayListWidgetPrivate;
129 d->setDocumentUsed = FALSE; 129 d->setDocumentUsed = FALSE;
130 d->current = NULL; 130 d->current = NULL;
131 fromSetDocument = FALSE; 131 fromSetDocument = FALSE;
132 insanityBool=FALSE; 132 insanityBool=FALSE;
133 audioScan = FALSE; 133 audioScan = FALSE;
134 videoScan = FALSE; 134 videoScan = FALSE;
135// menuTimer = new QTimer( this ,"menu timer"), 135// menuTimer = new QTimer( this ,"menu timer"),
136// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 136// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
137 137
138 setBackgroundMode( PaletteButton ); 138 setBackgroundMode( PaletteButton );
139 139
140 setCaption( tr("OpiePlayer") ); 140 setCaption( tr("OpiePlayer") );
141 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 141 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
142 142
143 setToolBarsMovable( FALSE ); 143 setToolBarsMovable( FALSE );
144 144
145 // Create Toolbar 145 // Create Toolbar
146 QPEToolBar *toolbar = new QPEToolBar( this ); 146 QPEToolBar *toolbar = new QPEToolBar( this );
147 toolbar->setHorizontalStretchable( TRUE ); 147 toolbar->setHorizontalStretchable( TRUE );
148 148
149 // Create Menubar 149 // Create Menubar
150 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 150 QPEMenuBar *menu = new QPEMenuBar( toolbar );
151 menu->setMargin( 0 ); 151 menu->setMargin( 0 );
152 152
153 QPEToolBar *bar = new QPEToolBar( this ); 153 QPEToolBar *bar = new QPEToolBar( this );
154 bar->setLabel( tr( "Play Operations" ) ); 154 bar->setLabel( tr( "Play Operations" ) );
155// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 155// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
156// this , SLOT( addSelected()) ); 156// this , SLOT( addSelected()) );
157 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 157 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
158 tbDeletePlaylist->setFlat(TRUE); 158 tbDeletePlaylist->setFlat(TRUE);
159 tbDeletePlaylist->setFixedSize(20,20); 159 tbDeletePlaylist->setFixedSize(20,20);
160 160
161 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 161 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
162 this , SLOT(addSelected()) ); 162 this , SLOT(addSelected()) );
163 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 163 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
164 this , SLOT(removeSelected()) ); 164 this , SLOT(removeSelected()) );
165// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 165// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
166 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 166 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
167 this , SLOT( btnPlay(bool) ), TRUE ); 167 this , SLOT( btnPlay(bool) ), TRUE );
168 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 168 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
169 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 169 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
170 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 170 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
171 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 171 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
172 tbDeletePlaylist->hide(); 172 tbDeletePlaylist->hide();
173 173
174 QPopupMenu *pmPlayList = new QPopupMenu( this ); 174 QPopupMenu *pmPlayList = new QPopupMenu( this );
175 menu->insertItem( tr( "File" ), pmPlayList ); 175 menu->insertItem( tr( "File" ), pmPlayList );
176 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 176 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
177 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 177 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
178 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 178 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
179 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 179 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
180// pmPlayList->insertSeparator(-1); 180// pmPlayList->insertSeparator(-1);
181 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 181 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
182 pmPlayList->insertSeparator(-1); 182 pmPlayList->insertSeparator(-1);
183 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 183 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
184 pmPlayList->insertSeparator(-1); 184 pmPlayList->insertSeparator(-1);
185 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 185 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
186 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 186 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
187 187
188 QPopupMenu *pmView = new QPopupMenu( this ); 188 QPopupMenu *pmView = new QPopupMenu( this );
189 menu->insertItem( tr( "View" ), pmView ); 189 menu->insertItem( tr( "View" ), pmView );
190 190
191 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 191 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
192 fullScreenButton->addTo(pmView); 192 fullScreenButton->addTo(pmView);
193 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 193 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
194 scaleButton->addTo(pmView); 194 scaleButton->addTo(pmView);
195 195
196 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 196 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
197 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 197 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
198 198
199 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 199 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
200 200
201 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 201 tabWidget = new QTabWidget( hbox6, "tabWidget" );
202 tabWidget->setTabShape(QTabWidget::Triangular); 202 tabWidget->setTabShape(QTabWidget::Triangular);
203 203
204 QWidget *pTab; 204 QWidget *pTab;
205 pTab = new QWidget( tabWidget, "pTab" ); 205 pTab = new QWidget( tabWidget, "pTab" );
206// playlistView = new QListView( pTab, "playlistview" ); 206// playlistView = new QListView( pTab, "playlistview" );
207// playlistView->setMinimumSize(236,260); 207// playlistView->setMinimumSize(236,260);
208 tabWidget->insertTab( pTab,"Playlist"); 208 tabWidget->insertTab( pTab,"Playlist");
209 209
210 210
211 // Add the playlist area 211 // Add the playlist area
212 212
213 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 213 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
214 d->playListFrame = vbox3; 214 d->playListFrame = vbox3;
215 d->playListFrame ->setMinimumSize(235,260); 215 d->playListFrame ->setMinimumSize(235,260);
216 216
217 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 217 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
218 218
219 d->selectedFiles = new PlayListSelection( hbox2); 219 d->selectedFiles = new PlayListSelection( hbox2);
220 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 220 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
221 221
222 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 222 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
223 223
224 224
225 225
226 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 226 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
227 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 227 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
228 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 228 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
229 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 229 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
230 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 230 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
231 231
232 QWidget *aTab; 232 QWidget *aTab;
233 aTab = new QWidget( tabWidget, "aTab" ); 233 aTab = new QWidget( tabWidget, "aTab" );
234 audioView = new QListView( aTab, "Audioview" ); 234 audioView = new QListView( aTab, "Audioview" );
235 audioView->setMinimumSize(233,260); 235 audioView->setMinimumSize(233,260);
236 audioView->addColumn( tr("Title"),140); 236 audioView->addColumn( tr("Title"),140);
237 audioView->addColumn(tr("Size"), -1); 237 audioView->addColumn(tr("Size"), -1);
238 audioView->addColumn(tr("Media"),-1); 238 audioView->addColumn(tr("Media"),-1);
239 audioView->setColumnAlignment(1, Qt::AlignRight); 239 audioView->setColumnAlignment(1, Qt::AlignRight);
240 audioView->setColumnAlignment(2, Qt::AlignRight); 240 audioView->setColumnAlignment(2, Qt::AlignRight);
241 audioView->setAllColumnsShowFocus(TRUE); 241 audioView->setAllColumnsShowFocus(TRUE);
242 242
243 audioView->setMultiSelection( TRUE ); 243 audioView->setMultiSelection( TRUE );
244 audioView->setSelectionMode( QListView::Extended); 244 audioView->setSelectionMode( QListView::Extended);
245 245
246 tabWidget->insertTab(aTab,tr("Audio")); 246 tabWidget->insertTab(aTab,tr("Audio"));
247 247
248 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 248 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
249 249
250// audioView 250// audioView
251// populateAudioView(); 251// populateAudioView();
252// videowidget 252// videowidget
253 253
254 QWidget *vTab; 254 QWidget *vTab;
255 vTab = new QWidget( tabWidget, "vTab" ); 255 vTab = new QWidget( tabWidget, "vTab" );
256 videoView = new QListView( vTab, "Videoview" ); 256 videoView = new QListView( vTab, "Videoview" );
257 videoView->setMinimumSize(233,260); 257 videoView->setMinimumSize(233,260);
258 258
259 videoView->addColumn(tr("Title"),140); 259 videoView->addColumn(tr("Title"),140);
260 videoView->addColumn(tr("Size"),-1); 260 videoView->addColumn(tr("Size"),-1);
261 videoView->addColumn(tr("Media"),-1); 261 videoView->addColumn(tr("Media"),-1);
262 videoView->setColumnAlignment(1, Qt::AlignRight); 262 videoView->setColumnAlignment(1, Qt::AlignRight);
263 videoView->setColumnAlignment(2, Qt::AlignRight); 263 videoView->setColumnAlignment(2, Qt::AlignRight);
264 videoView->setAllColumnsShowFocus(TRUE); 264 videoView->setAllColumnsShowFocus(TRUE);
265 videoView->setMultiSelection( TRUE ); 265 videoView->setMultiSelection( TRUE );
266 videoView->setSelectionMode( QListView::Extended); 266 videoView->setSelectionMode( QListView::Extended);
267 267
268 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 268 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
269 269
270 tabWidget->insertTab( vTab,tr("Video")); 270 tabWidget->insertTab( vTab,tr("Video"));
271// populateVideoView(); 271// populateVideoView();
272 272
273//playlists list 273//playlists list
274 QWidget *LTab; 274 QWidget *LTab;
275 LTab = new QWidget( tabWidget, "LTab" ); 275 LTab = new QWidget( tabWidget, "LTab" );
276 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 276 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
277 playLists->setMinimumSize(233,260); 277 playLists->setMinimumSize(233,260);
278 tabWidget->insertTab(LTab,tr("Lists")); 278 tabWidget->insertTab(LTab,tr("Lists"));
279 279
280// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 280// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
281 281
282// add the library area 282// add the library area
283 283
284// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 284// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
285// this, SLOT( fauxPlay( QListViewItem *) ) ); 285// this, SLOT( fauxPlay( QListViewItem *) ) );
286// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 286// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
287// this, SLOT( fauxPlay( QListViewItem *)) ); 287// this, SLOT( fauxPlay( QListViewItem *)) );
288 288
289// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 289// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
290// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 290// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
291 291
292 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 292 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
293 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 293 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
294 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 294 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
295 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 295 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
296 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 296 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
297 297
298 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 298 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
299 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 299 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
300 300
301 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 301 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
302 this,SLOT( playIt( QListViewItem *)) ); 302 this,SLOT( playIt( QListViewItem *)) );
303 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 303 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
304 304
305 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 305 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
306 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 306 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
307 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 307 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
308 this,SLOT( playIt( QListViewItem *)) ); 308 this,SLOT( playIt( QListViewItem *)) );
309 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 309 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
310 310
311 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 311 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
312 312
313 313
314 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 314 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
315 315
316 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 316 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
317 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 317 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
318 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 318 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
319 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 319 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
320 320
321 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 321 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
322// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 322// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
323 323
324 setCentralWidget( vbox5 ); 324 setCentralWidget( vbox5 );
325 325
326 Config cfg( "OpiePlayer" ); 326 Config cfg( "OpiePlayer" );
327 readConfig( cfg ); 327 readConfig( cfg );
328 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 328 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
329// qDebug("currentList is "+currentPlaylist); 329// qDebug("currentList is "+currentPlaylist);
330 loadList(DocLnk( currentPlaylist)); 330 loadList(DocLnk( currentPlaylist));
331 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 331 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
332 332
333 initializeStates(); 333 initializeStates();
334} 334}
335 335
336 336
337PlayListWidget::~PlayListWidget() { 337PlayListWidget::~PlayListWidget() {
338 Config cfg( "OpiePlayer" ); 338 Config cfg( "OpiePlayer" );
339 writeConfig( cfg ); 339 writeConfig( cfg );
340 340
341 341
342 if ( d->current ) 342 if ( d->current )
343 delete d->current; 343 delete d->current;
344 delete d; 344 delete d;
345} 345}
346 346
347 347
348void PlayListWidget::initializeStates() { 348void PlayListWidget::initializeStates() {
349 349
350 d->tbPlay->setOn( mediaPlayerState->playing() ); 350 d->tbPlay->setOn( mediaPlayerState->playing() );
351 d->tbLoop->setOn( mediaPlayerState->looping() ); 351 d->tbLoop->setOn( mediaPlayerState->looping() );
352 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 352 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
353// d->tbFull->setOn( mediaPlayerState->fullscreen() ); 353// d->tbFull->setOn( mediaPlayerState->fullscreen() );
354// d->tbScale->setOn( mediaPlayerState->scaled() ); 354// d->tbScale->setOn( mediaPlayerState->scaled() );
355// d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); 355// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
356// setPlaylist( mediaPlayerState->playlist() ); 356// setPlaylist( mediaPlayerState->playlist() );
357 setPlaylist( true); 357 setPlaylist( true);
358// d->selectedFiles->first(); 358// d->selectedFiles->first();
359 359
360} 360}
361 361
362 362
363void PlayListWidget::readConfig( Config& cfg ) { 363void PlayListWidget::readConfig( Config& cfg ) {
364 cfg.setGroup("PlayList"); 364 cfg.setGroup("PlayList");
365 QString currentString = cfg.readEntry("current", "" ); 365 QString currentString = cfg.readEntry("current", "" );
366 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 366 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
367 for ( int i = 0; i < noOfFiles; i++ ) { 367 for ( int i = 0; i < noOfFiles; i++ ) {
368 QString entryName; 368 QString entryName;
369 entryName.sprintf( "File%i", i + 1 ); 369 entryName.sprintf( "File%i", i + 1 );
370 QString linkFile = cfg.readEntry( entryName ); 370 QString linkFile = cfg.readEntry( entryName );
371 DocLnk lnk( linkFile ); 371 DocLnk lnk( linkFile );
372 if ( lnk.isValid() ) { 372 if ( lnk.isValid() ) {
373 d->selectedFiles->addToSelection( lnk ); 373 d->selectedFiles->addToSelection( lnk );
374 } 374 }
375 } 375 }
376 d->selectedFiles->setSelectedItem( currentString); 376 d->selectedFiles->setSelectedItem( currentString);
377// d->selectedFiles->setSelectedItem( (const QString &)currentString); 377// d->selectedFiles->setSelectedItem( (const QString &)currentString);
378} 378}
379 379
380 380
381void PlayListWidget::writeConfig( Config& cfg ) const { 381void PlayListWidget::writeConfig( Config& cfg ) const {
382 382
383 d->selectedFiles->writeCurrent( cfg); 383 d->selectedFiles->writeCurrent( cfg);
384 cfg.setGroup("PlayList"); 384 cfg.setGroup("PlayList");
385 int noOfFiles = 0; 385 int noOfFiles = 0;
386 d->selectedFiles->first(); 386 d->selectedFiles->first();
387 do { 387 do {
388 const DocLnk *lnk = d->selectedFiles->current(); 388 const DocLnk *lnk = d->selectedFiles->current();
389 if ( lnk ) { 389 if ( lnk ) {
390 QString entryName; 390 QString entryName;
391 entryName.sprintf( "File%i", noOfFiles + 1 ); 391 entryName.sprintf( "File%i", noOfFiles + 1 );
392// qDebug(entryName); 392// qDebug(entryName);
393 cfg.writeEntry( entryName, lnk->linkFile() ); 393 cfg.writeEntry( entryName, lnk->linkFile() );
394 // if this link does exist, add it so we have the file 394 // if this link does exist, add it so we have the file
395 // next time... 395 // next time...
396 if ( !QFile::exists( lnk->linkFile() ) ) { 396 if ( !QFile::exists( lnk->linkFile() ) ) {
397 // the way writing lnks doesn't really check for out 397 // the way writing lnks doesn't really check for out
398 // of disk space, but check it anyway. 398 // of disk space, but check it anyway.
399 if ( !lnk->writeLink() ) { 399 if ( !lnk->writeLink() ) {
400 QMessageBox::critical( 0, tr("Out of space"), 400 QMessageBox::critical( 0, tr("Out of space"),
401 tr( "There was a problem saving " 401 tr( "There was a problem saving "
402 "the playlist.\n" 402 "the playlist.\n"
403 "Your playlist " 403 "Your playlist "
404 "may be missing some entries\n" 404 "may be missing some entries\n"
405 "the next time you start it." ) 405 "the next time you start it." )
406 ); 406 );
407 } 407 }
408 } 408 }
409 noOfFiles++; 409 noOfFiles++;
410 } 410 }
411 } 411 }
412 while ( d->selectedFiles->next() ); 412 while ( d->selectedFiles->next() );
413 cfg.writeEntry("NumberOfFiles", noOfFiles ); 413 cfg.writeEntry("NumberOfFiles", noOfFiles );
414} 414}
415 415
416 416
417void PlayListWidget::addToSelection( const DocLnk& lnk ) { 417void PlayListWidget::addToSelection( const DocLnk& lnk ) {
418// qDebug("add"); 418// qDebug("add");
419 if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) { 419 if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
420 QMessageBox::message("Note","You are trying to play\na malformed url."); 420 QMessageBox::message("Note","You are trying to play\na malformed url.");
421 421
422 } else { 422 } else {
423 423
424 d->setDocumentUsed = FALSE; 424 d->setDocumentUsed = FALSE;
425 if ( mediaPlayerState->playlist() ) { 425 if ( mediaPlayerState->playlist() ) {
426 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) 426 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
427 d->selectedFiles->addToSelection( lnk ); 427 d->selectedFiles->addToSelection( lnk );
428 } 428 }
429 else 429 else
430 mediaPlayerState->setPlaying( TRUE ); 430 mediaPlayerState->setPlaying( TRUE );
431 } 431 }
432} 432}
433 433
434 434
435void PlayListWidget::clearList() { 435void PlayListWidget::clearList() {
436 while ( first() ) 436 while ( first() )
437 d->selectedFiles->removeSelected(); 437 d->selectedFiles->removeSelected();
438} 438}
439 439
440 440
441void PlayListWidget::addAllToList() { 441void PlayListWidget::addAllToList() {
442 DocLnkSet filesAll; 442 DocLnkSet filesAll;
443 Global::findDocuments(&filesAll, "video/*;audio/*"); 443 Global::findDocuments(&filesAll, "video/*;audio/*");
444 QListIterator<DocLnk> Adit( filesAll.children() ); 444 QListIterator<DocLnk> Adit( filesAll.children() );
445 for ( ; Adit.current(); ++Adit ) 445 for ( ; Adit.current(); ++Adit )
446 if(QFileInfo(Adit.current()->file()).exists()) 446 if(QFileInfo(Adit.current()->file()).exists())
447 d->selectedFiles->addToSelection( **Adit ); 447 d->selectedFiles->addToSelection( **Adit );
448} 448}
449 449
450 450
451void PlayListWidget::addAllMusicToList() { 451void PlayListWidget::addAllMusicToList() {
452 QListIterator<DocLnk> dit( files.children() ); 452 QListIterator<DocLnk> dit( files.children() );
453 for ( ; dit.current(); ++dit ) 453 for ( ; dit.current(); ++dit )
454 if(QFileInfo(dit.current()->file()).exists()) 454 if(QFileInfo(dit.current()->file()).exists())
455 d->selectedFiles->addToSelection( **dit ); 455 d->selectedFiles->addToSelection( **dit );
456} 456}
457 457
458 458
459void PlayListWidget::addAllVideoToList() { 459void PlayListWidget::addAllVideoToList() {
460 QListIterator<DocLnk> dit( vFiles.children() ); 460 QListIterator<DocLnk> dit( vFiles.children() );
461 for ( ; dit.current(); ++dit ) 461 for ( ; dit.current(); ++dit )
462 if(QFileInfo( dit.current()->file()).exists()) 462 if(QFileInfo( dit.current()->file()).exists())
463 d->selectedFiles->addToSelection( **dit ); 463 d->selectedFiles->addToSelection( **dit );
464} 464}
465 465
466 466
467void PlayListWidget::setDocument(const QString& fileref) { 467void PlayListWidget::setDocument(const QString& fileref) {
468 qDebug(fileref); 468 qDebug(fileref);
469 fromSetDocument = TRUE; 469 fromSetDocument = TRUE;
470 if ( fileref.isNull() ) { 470 if ( fileref.isNull() ) {
471 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 471 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
472 return; 472 return;
473 } 473 }
474// qDebug("setDocument "+fileref); 474// qDebug("setDocument "+fileref);
475 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u 475 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
476 readm3u( fileref); 476 readm3u( fileref);
477 } 477 }
478 else if(fileref.find("pls",0,TRUE) != -1) { //is pls 478 else if(fileref.find("pls",0,TRUE) != -1) { //is pls
479 readPls( fileref); 479 readPls( fileref);
480 } 480 }
481 else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist 481 else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
482 clearList(); 482 clearList();
483 loadList(DocLnk(fileref)); 483 loadList(DocLnk(fileref));
484 d->selectedFiles->first(); 484 d->selectedFiles->first();
485 } else { 485 } else {
486 clearList(); 486 clearList();
487 addToSelection( DocLnk( fileref ) ); 487 addToSelection( DocLnk( fileref ) );
488 d->setDocumentUsed = TRUE; 488 d->setDocumentUsed = TRUE;
489 mediaPlayerState->setPlaying( FALSE ); 489 mediaPlayerState->setPlaying( FALSE );
490 qApp->processEvents(); 490 qApp->processEvents();
491 mediaPlayerState->setPlaying( TRUE ); 491 mediaPlayerState->setPlaying( TRUE );
492 qApp->processEvents(); 492 qApp->processEvents();
493 setCaption(tr("OpiePlayer")); 493 setCaption(tr("OpiePlayer"));
494 } 494 }
495} 495}
496 496
497 497
498void PlayListWidget::setActiveWindow() { 498void PlayListWidget::setActiveWindow() {
499 // When we get raised we need to ensure that it switches views 499 // When we get raised we need to ensure that it switches views
500 char origView = mediaPlayerState->view(); 500 char origView = mediaPlayerState->view();
501 mediaPlayerState->setView( 'l' ); // invalidate 501 mediaPlayerState->setView( 'l' ); // invalidate
502 mediaPlayerState->setView( origView ); // now switch back 502 mediaPlayerState->setView( origView ); // now switch back
503} 503}
504 504
505 505
506void PlayListWidget::useSelectedDocument() { 506void PlayListWidget::useSelectedDocument() {
507 d->setDocumentUsed = FALSE; 507 d->setDocumentUsed = FALSE;
508} 508}
509 509
510 510
511const DocLnk *PlayListWidget::current() { // this is fugly 511const DocLnk *PlayListWidget::current() { // this is fugly
512 512
513// if( fromSetDocument) { 513// if( fromSetDocument) {
514// qDebug("from setDoc"); 514// qDebug("from setDoc");
515// DocLnkSet files; 515// DocLnkSet files;
516// Global::findDocuments(&files, "video/*;audio/*"); 516// Global::findDocuments(&files, "video/*;audio/*");
517// QListIterator<DocLnk> dit( files.children() ); 517// QListIterator<DocLnk> dit( files.children() );
518// for ( ; dit.current(); ++dit ) { 518// for ( ; dit.current(); ++dit ) {
519// if(dit.current()->linkFile() == setDocFileRef) { 519// if(dit.current()->linkFile() == setDocFileRef) {
520// qDebug(setDocFileRef); 520// qDebug(setDocFileRef);
521// return dit; 521// return dit;
522// } 522// }
523// } 523// }
524// } else 524// } else
525 525
526 526
527 switch (tabWidget->currentPageIndex()) { 527 switch (tabWidget->currentPageIndex()) {
528 case 0: //playlist 528 case 0: //playlist
529 { 529 {
530 qDebug("playlist"); 530 qDebug("playlist");
531 if ( mediaPlayerState->playlist() ) { 531 if ( mediaPlayerState->playlist() ) {
532 return d->selectedFiles->current(); 532 return d->selectedFiles->current();
533 } 533 }
534 else if ( d->setDocumentUsed && d->current ) { 534 else if ( d->setDocumentUsed && d->current ) {
535 return d->current; 535 return d->current;
536 } else { 536 } else {
537 return d->files->selected(); 537 return d->files->selected();
538 } 538 }
539 } 539 }
540 break; 540 break;
541 case 1://audio 541 case 1://audio
542 { 542 {
543 qDebug("audioView"); 543 qDebug("audioView");
544 QListIterator<DocLnk> dit( files.children() ); 544 QListIterator<DocLnk> dit( files.children() );
545 for ( ; dit.current(); ++dit ) { 545 for ( ; dit.current(); ++dit ) {
546 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { 546 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
547 qDebug("here"); 547 qDebug("here");
548 insanityBool=TRUE; 548 insanityBool=TRUE;
549 return dit; 549 return dit;
550 } 550 }
551 } 551 }
552 } 552 }
553 break; 553 break;
554 case 2: // video 554 case 2: // video
555 { 555 {
556 qDebug("videoView"); 556 qDebug("videoView");
557 QListIterator<DocLnk> Vdit( vFiles.children() ); 557 QListIterator<DocLnk> Vdit( vFiles.children() );
558 for ( ; Vdit.current(); ++Vdit ) { 558 for ( ; Vdit.current(); ++Vdit ) {
559 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { 559 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
560 insanityBool=TRUE; 560 insanityBool=TRUE;
561 return Vdit; 561 return Vdit;
562 } 562 }
563 } 563 }
564 } 564 }
565 break; 565 break;
566 }; 566 };
567 return 0; 567 return 0;
568} 568}
569 569
570bool PlayListWidget::prev() { 570bool PlayListWidget::prev() {
571 if ( mediaPlayerState->playlist() ) { 571 if ( mediaPlayerState->playlist() ) {
572 if ( mediaPlayerState->shuffled() ) { 572 if ( mediaPlayerState->shuffled() ) {
573 const DocLnk *cur = current(); 573 const DocLnk *cur = current();
574 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 574 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
575 for ( int i = 0; i < j; i++ ) { 575 for ( int i = 0; i < j; i++ ) {
576 if ( !d->selectedFiles->next() ) 576 if ( !d->selectedFiles->next() )
577 d->selectedFiles->first(); 577 d->selectedFiles->first();
578 } 578 }
579 if ( cur == current() ) 579 if ( cur == current() )
580 if ( !d->selectedFiles->next() ) 580 if ( !d->selectedFiles->next() )
581 d->selectedFiles->first(); 581 d->selectedFiles->first();
582 return TRUE; 582 return TRUE;
583 } else { 583 } else {
584 if ( !d->selectedFiles->prev() ) { 584 if ( !d->selectedFiles->prev() ) {
585 if ( mediaPlayerState->looping() ) { 585 if ( mediaPlayerState->looping() ) {
586 return d->selectedFiles->last(); 586 return d->selectedFiles->last();
587 } else { 587 } else {
588 return FALSE; 588 return FALSE;
589 } 589 }
590 } 590 }
591 return TRUE; 591 return TRUE;
592 } 592 }
593 } else { 593 } else {
594 return mediaPlayerState->looping(); 594 return mediaPlayerState->looping();
595 } 595 }
596} 596}
597 597
598 598
599bool PlayListWidget::next() { 599bool PlayListWidget::next() {
600 if ( mediaPlayerState->playlist() ) { 600 if ( mediaPlayerState->playlist() ) {
601 if ( mediaPlayerState->shuffled() ) { 601 if ( mediaPlayerState->shuffled() ) {
602 return prev(); 602 return prev();
603 } else { 603 } else {
604 if ( !d->selectedFiles->next() ) { 604 if ( !d->selectedFiles->next() ) {
605 if ( mediaPlayerState->looping() ) { 605 if ( mediaPlayerState->looping() ) {
606 return d->selectedFiles->first(); 606 return d->selectedFiles->first();
607 } else { 607 } else {
608 return FALSE; 608 return FALSE;
609 } 609 }
610 } 610 }
611 return TRUE; 611 return TRUE;
612 } 612 }
613 } else { 613 } else {
614 return mediaPlayerState->looping(); 614 return mediaPlayerState->looping();
615 } 615 }
616} 616}
617 617
618 618
619bool PlayListWidget::first() { 619bool PlayListWidget::first() {
620 if ( mediaPlayerState->playlist() ) 620 if ( mediaPlayerState->playlist() )
621 return d->selectedFiles->first(); 621 return d->selectedFiles->first();
622 else 622 else
623 return mediaPlayerState->looping(); 623 return mediaPlayerState->looping();
624} 624}
625 625
626 626
627bool PlayListWidget::last() { 627bool PlayListWidget::last() {
628 if ( mediaPlayerState->playlist() ) 628 if ( mediaPlayerState->playlist() )
629 return d->selectedFiles->last(); 629 return d->selectedFiles->last();
630 else 630 else
631 return mediaPlayerState->looping(); 631 return mediaPlayerState->looping();
632} 632}
633 633
634 634
635void PlayListWidget::saveList() { 635void PlayListWidget::saveList() {
636 636
637 QString filename; 637 QString filename;
638 InputDialog *fileDlg; 638 InputDialog *fileDlg;
639 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); 639 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
640 fileDlg->exec(); 640 fileDlg->exec();
641 if( fileDlg->result() == 1 ) { 641 if( fileDlg->result() == 1 ) {
642 if ( d->current ) 642 if ( d->current )
643 delete d->current; 643 delete d->current;
644 filename = fileDlg->LineEdit1->text();//+".playlist"; 644 filename = fileDlg->LineEdit1->text();//+".playlist";
645// qDebug("saving playlist "+filename+".playlist"); 645// qDebug("saving playlist "+filename+".playlist");
646 Config cfg( filename +".playlist"); 646 Config cfg( filename +".playlist");
647 writeConfig( cfg ); 647 writeConfig( cfg );
648 648
649 DocLnk lnk; 649 DocLnk lnk;
650// lnk.setComment( ""); 650// lnk.setComment( "");
651 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 651 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
652 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D 652 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
653 lnk.setIcon("opieplayer/playlist2"); 653 lnk.setIcon("opieplayer/playlist2");
654 lnk.setName( filename); //sets file name 654 lnk.setName( filename); //sets file name
655// qDebug(filename); 655// qDebug(filename);
656 if(!lnk.writeLink()) 656 if(!lnk.writeLink())
657 qDebug("Writing doclink did not work"); 657 qDebug("Writing doclink did not work");
658 } 658 }
659 Config config( "OpiePlayer" ); 659 Config config( "OpiePlayer" );
660 config.writeEntry("CurrentPlaylist",filename); 660 config.writeEntry("CurrentPlaylist",filename);
661 setCaption(tr("OpiePlayer: ")+filename); 661 setCaption(tr("OpiePlayer: ")+filename);
662 d->selectedFiles->first(); 662 d->selectedFiles->first();
663 if(fileDlg) 663 if(fileDlg)
664 delete fileDlg; 664 delete fileDlg;
665} 665}
666 666
667void PlayListWidget::loadList( const DocLnk & lnk) { 667void PlayListWidget::loadList( const DocLnk & lnk) {
668 QString name= lnk.name(); 668 QString name= lnk.name();
669// qDebug("currentList is "+name); 669// qDebug("currentList is "+name);
670 if( name.length()>1) { 670 if( name.length()>1) {
671 setCaption("OpiePlayer: "+name); 671 setCaption("OpiePlayer: "+name);
672// qDebug("load list "+ name+".playlist"); 672// qDebug("load list "+ name+".playlist");
673 clearList(); 673 clearList();
674 Config cfg( name+".playlist"); 674 Config cfg( name+".playlist");
675 readConfig(cfg); 675 readConfig(cfg);
676 676
677 tabWidget->setCurrentPage(0); 677 tabWidget->setCurrentPage(0);
678 678
679 Config config( "OpiePlayer" ); 679 Config config( "OpiePlayer" );
680 config.writeEntry("CurrentPlaylist", name); 680 config.writeEntry("CurrentPlaylist", name);
681// d->selectedFiles->first(); 681// d->selectedFiles->first();
682 } 682 }
683 683
684} 684}
685 685
686void PlayListWidget::setPlaylist( bool shown ) { 686void PlayListWidget::setPlaylist( bool shown ) {
687 if ( shown ) 687 if ( shown )
688 d->playListFrame->show(); 688 d->playListFrame->show();
689 else 689 else
690 d->playListFrame->hide(); 690 d->playListFrame->hide();
691} 691}
692 692
693void PlayListWidget::setView( char view ) { 693void PlayListWidget::setView( char view ) {
694 if ( view == 'l' ) 694 if ( view == 'l' )
695 showMaximized(); 695 showMaximized();
696 else 696 else
697 hide(); 697 hide();
698} 698}
699 699
700void PlayListWidget::addSelected() { 700void PlayListWidget::addSelected() {
701 701
702 Config cfg( "OpiePlayer" ); 702 Config cfg( "OpiePlayer" );
703 cfg.setGroup("PlayList"); 703 cfg.setGroup("PlayList");
704 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 704 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
705 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 705 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
706 706
707 switch (tabWidget->currentPageIndex()) { 707 switch (tabWidget->currentPageIndex()) {
708 case 0: //playlist 708 case 0: //playlist
709 break; 709 break;
710 case 1: { //audio 710 case 1: { //audio
711// QString entryName; 711// QString entryName;
712// entryName.sprintf( "File%i", i + 1 ); 712// entryName.sprintf( "File%i", i + 1 );
713// QString linkFile = cfg.readEntry( entryName ); 713// QString linkFile = cfg.readEntry( entryName );
714 QListViewItemIterator it( audioView ); 714 QListViewItemIterator it( audioView );
715 // iterate through all items of the listview 715 // iterate through all items of the listview
716 for ( ; it.current(); ++it ) { 716 for ( ; it.current(); ++it ) {
717 if ( it.current()->isSelected() ) { 717 if ( it.current()->isSelected() ) {
718 QListIterator<DocLnk> dit( files.children() ); 718 QListIterator<DocLnk> dit( files.children() );
719 for ( ; dit.current(); ++dit ) { 719 for ( ; dit.current(); ++dit ) {
720 if( dit.current()->name() == it.current()->text(0) ) { 720 if( dit.current()->name() == it.current()->text(0) ) {
721 d->selectedFiles->addToSelection( **dit ); 721 d->selectedFiles->addToSelection( **dit );
722 } 722 }
723 } 723 }
724 audioView->setSelected( it.current(),FALSE); 724 audioView->setSelected( it.current(),FALSE);
725 } 725 }
726 } 726 }
727 tabWidget->setCurrentPage(0); 727 tabWidget->setCurrentPage(0);
728 } 728 }
729 break; 729 break;
730 case 2: { // video 730 case 2: { // video
731 QListViewItemIterator it( videoView ); 731 QListViewItemIterator it( videoView );
732 // iterate through all items of the listview 732 // iterate through all items of the listview
733 for ( ; it.current(); ++it ) { 733 for ( ; it.current(); ++it ) {
734 if ( it.current()->isSelected() ) { 734 if ( it.current()->isSelected() ) {
735 QListIterator<DocLnk> dit( vFiles.children() ); 735 QListIterator<DocLnk> dit( vFiles.children() );
736 for ( ; dit.current(); ++dit ) { 736 for ( ; dit.current(); ++dit ) {
737 if( dit.current()->name() == it.current()->text(0) ) { 737 if( dit.current()->name() == it.current()->text(0) ) {
738 d->selectedFiles->addToSelection( **dit ); 738 d->selectedFiles->addToSelection( **dit );
739 } 739 }
740 } 740 }
741 741
742 videoView->setSelected( it.current(),FALSE); 742 videoView->setSelected( it.current(),FALSE);
743 } 743 }
744 } 744 }
745// for ( int i = 0; i < noOfFiles; i++ ) { 745// for ( int i = 0; i < noOfFiles; i++ ) {
746// QString entryName; 746// QString entryName;
747// entryName.sprintf( "File%i", i + 1 ); 747// entryName.sprintf( "File%i", i + 1 );
748// QString linkFile = cfg.readEntry( entryName ); 748// QString linkFile = cfg.readEntry( entryName );
749// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { 749// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
750// int result= QMessageBox::warning(this,tr("OpiePlayer"), 750// int result= QMessageBox::warning(this,tr("OpiePlayer"),
751// tr("This is all ready in your playlist.\nContinue?"), 751// tr("This is all ready in your playlist.\nContinue?"),
752// tr("Yes"),tr("No"),0,0,1); 752// tr("Yes"),tr("No"),0,0,1);
753// if (result !=0) 753// if (result !=0)
754// return; 754// return;
755// } 755// }
756// } 756// }
757// addToSelection( videoView->selectedItem() ); 757// addToSelection( videoView->selectedItem() );
758 tabWidget->setCurrentPage(0); 758 tabWidget->setCurrentPage(0);
759 } 759 }
760 break; 760 break;
761 }; 761 };
762} 762}
763 763
764void PlayListWidget::removeSelected() { 764void PlayListWidget::removeSelected() {
765 d->selectedFiles->removeSelected( ); 765 d->selectedFiles->removeSelected( );
766} 766}
767 767
768void PlayListWidget::playIt( QListViewItem *it) { 768void PlayListWidget::playIt( QListViewItem *it) {
769// d->setDocumentUsed = FALSE; 769// d->setDocumentUsed = FALSE;
770// mediaPlayerState->curPosition =0; 770// mediaPlayerState->curPosition =0;
771 qDebug("playIt"); 771 qDebug("playIt");
772 mediaPlayerState->setPlaying(FALSE); 772 mediaPlayerState->setPlaying(FALSE);
773 mediaPlayerState->setPlaying(TRUE); 773 mediaPlayerState->setPlaying(TRUE);
774 d->selectedFiles->unSelect(); 774 d->selectedFiles->unSelect();
775} 775}
776 776
777void PlayListWidget::addToSelection( QListViewItem *it) { 777void PlayListWidget::addToSelection( QListViewItem *it) {
778 d->setDocumentUsed = FALSE; 778 d->setDocumentUsed = FALSE;
779 779
780 if(it) { 780 if(it) {
781 switch (tabWidget->currentPageIndex()) { 781 switch (tabWidget->currentPageIndex()) {
782 case 1: { 782 case 1: {
783 QListIterator<DocLnk> dit( files.children() ); 783 QListIterator<DocLnk> dit( files.children() );
784 for ( ; dit.current(); ++dit ) { 784 for ( ; dit.current(); ++dit ) {
785 if( dit.current()->name() == it->text(0)) { 785 if( dit.current()->name() == it->text(0)) {
786 d->selectedFiles->addToSelection( **dit ); 786 d->selectedFiles->addToSelection( **dit );
787 } 787 }
788 } 788 }
789 } 789 }
790 break; 790 break;
791 case 2: { 791 case 2: {
792 QListIterator<DocLnk> dit( vFiles.children() ); 792 QListIterator<DocLnk> dit( vFiles.children() );
793 for ( ; dit.current(); ++dit ) { 793 for ( ; dit.current(); ++dit ) {
794 if( dit.current()->name() == it->text(0)) { 794 if( dit.current()->name() == it->text(0)) {
795 d->selectedFiles->addToSelection( **dit ); 795 d->selectedFiles->addToSelection( **dit );
796 } 796 }
797 } 797 }
798 } 798 }
799 break; 799 break;
800 case 0: 800 case 0:
801 break; 801 break;
802 }; 802 };
803 tabWidget->setCurrentPage(0); 803 tabWidget->setCurrentPage(0);
804 } 804 }
805} 805}
806 806
807void PlayListWidget::tabChanged(QWidget *widg) { 807void PlayListWidget::tabChanged(QWidget *widg) {
808 808
809 switch ( tabWidget->currentPageIndex()) { 809 switch ( tabWidget->currentPageIndex()) {
810 case 0: 810 case 0:
811 { 811 {
812 if( !tbDeletePlaylist->isHidden()) 812 if( !tbDeletePlaylist->isHidden())
813 tbDeletePlaylist->hide(); 813 tbDeletePlaylist->hide();
814 d->tbRemoveFromList->setEnabled(TRUE); 814 d->tbRemoveFromList->setEnabled(TRUE);
815 d->tbAddToList->setEnabled(FALSE); 815 d->tbAddToList->setEnabled(FALSE);
816 } 816 }
817 break; 817 break;
818 case 1: 818 case 1:
819 { 819 {
820 audioView->clear(); 820 audioView->clear();
821 populateAudioView(); 821 populateAudioView();
822 822
823 if( !tbDeletePlaylist->isHidden()) 823 if( !tbDeletePlaylist->isHidden())
824 tbDeletePlaylist->hide(); 824 tbDeletePlaylist->hide();
825 d->tbRemoveFromList->setEnabled(FALSE); 825 d->tbRemoveFromList->setEnabled(FALSE);
826 d->tbAddToList->setEnabled(TRUE); 826 d->tbAddToList->setEnabled(TRUE);
827 } 827 }
828 break; 828 break;
829 case 2: 829 case 2:
830 { 830 {
831 videoView->clear(); 831 videoView->clear();
832 populateVideoView(); 832 populateVideoView();
833 if( !tbDeletePlaylist->isHidden()) 833 if( !tbDeletePlaylist->isHidden())
834 tbDeletePlaylist->hide(); 834 tbDeletePlaylist->hide();
835 d->tbRemoveFromList->setEnabled(FALSE); 835 d->tbRemoveFromList->setEnabled(FALSE);
836 d->tbAddToList->setEnabled(TRUE); 836 d->tbAddToList->setEnabled(TRUE);
837 } 837 }
838 break; 838 break;
839 case 3: 839 case 3:
840 { 840 {
841 if( tbDeletePlaylist->isHidden()) 841 if( tbDeletePlaylist->isHidden())
842 tbDeletePlaylist->show(); 842 tbDeletePlaylist->show();
843 playLists->reread(); 843 playLists->reread();
844 } 844 }
845 break; 845 break;
846 }; 846 };
847} 847}
848 848
849void PlayListWidget::btnPlay(bool b) { 849void PlayListWidget::btnPlay(bool b) {
850 850
851// mediaPlayerState->setPlaying(b); 851// mediaPlayerState->setPlaying(b);
852 switch ( tabWidget->currentPageIndex()) { 852 switch ( tabWidget->currentPageIndex()) {
853 case 0: 853 case 0:
854 { 854 {
855 qDebug("here we are"); 855 qDebug("here we are");
856 if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 856 if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
857 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
857 QMessageBox::message("Note","You are trying to play\na malformed url."); 858 QMessageBox::message("Note","You are trying to play\na malformed url.");
858 859
859 } else { 860 } else {
860 861
861 mediaPlayerState->setPlaying(b); 862 mediaPlayerState->setPlaying(b);
862 } } 863 } }
863 break; 864 break;
864 case 1: 865 case 1:
865 { 866 {
866 addToSelection( audioView->currentItem() ); 867 addToSelection( audioView->currentItem() );
867 mediaPlayerState->setPlaying(b); 868 mediaPlayerState->setPlaying(b);
868 d->selectedFiles->removeSelected( ); 869 d->selectedFiles->removeSelected( );
869 tabWidget->setCurrentPage(1); 870 tabWidget->setCurrentPage(1);
870 d->selectedFiles->unSelect(); 871 d->selectedFiles->unSelect();
871 insanityBool=FALSE; 872 insanityBool=FALSE;
872 }// audioView->clearSelection(); 873 }// audioView->clearSelection();
873 break; 874 break;
874 case 2: 875 case 2:
875 { 876 {
876 addToSelection( videoView->currentItem() ); 877 addToSelection( videoView->currentItem() );
877 mediaPlayerState->setPlaying(b); 878 mediaPlayerState->setPlaying(b);
878 qApp->processEvents(); 879 qApp->processEvents();
879 d->selectedFiles->removeSelected( ); 880 d->selectedFiles->removeSelected( );
880 tabWidget->setCurrentPage(2); 881 tabWidget->setCurrentPage(2);
881 d->selectedFiles->unSelect(); 882 d->selectedFiles->unSelect();
882 insanityBool=FALSE; 883 insanityBool=FALSE;
883 }// videoView->clearSelection(); 884 }// videoView->clearSelection();
884 break; 885 break;
885 }; 886 };
886 887
887} 888}
888 889
889void PlayListWidget::deletePlaylist() { 890void PlayListWidget::deletePlaylist() {
890 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 891 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
891 (tr("You really want to delete\nthis playlist?")), 892 (tr("You really want to delete\nthis playlist?")),
892 (tr("Yes")), (tr("No")), 0 )){ 893 (tr("Yes")), (tr("No")), 0 )){
893 case 0: // Yes clicked, 894 case 0: // Yes clicked,
894 QFile().remove(playLists->selected()->file()); 895 QFile().remove(playLists->selected()->file());
895 QFile().remove(playLists->selected()->linkFile()); 896 QFile().remove(playLists->selected()->linkFile());
896 playLists->reread(); 897 playLists->reread();
897 break; 898 break;
898 case 1: // Cancel 899 case 1: // Cancel
899 break; 900 break;
900 }; 901 };
901} 902}
902 903
903void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 904void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
904{ 905{
905 switch (mouse) { 906 switch (mouse) {
906 case 1: 907 case 1:
907 break; 908 break;
908 case 2:{ 909 case 2:{
909 910
910 QPopupMenu m; 911 QPopupMenu m;
911 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 912 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
912 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 913 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
913 m.insertSeparator(); 914 m.insertSeparator();
914 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 915 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
915 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 916 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
916 917
917 m.exec( QCursor::pos() ); 918 m.exec( QCursor::pos() );
918 } 919 }
919 break; 920 break;
920 }; 921 };
921} 922}
922 923
923void PlayListWidget::playSelected() 924void PlayListWidget::playSelected()
924{ 925{
925 btnPlay( TRUE); 926 btnPlay( TRUE);
926// d->selectedFiles->unSelect(); 927// d->selectedFiles->unSelect();
927} 928}
928 929
929void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 930void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
930{ 931{
931 switch (mouse) { 932 switch (mouse) {
932 case 1: 933 case 1:
933 934
934 break; 935 break;
935 case 2:{ 936 case 2:{
936 QPopupMenu m; 937 QPopupMenu m;
937 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 938 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
938 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 939 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
939// m.insertSeparator(); 940// m.insertSeparator();
940// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 941// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
941 m.exec( QCursor::pos() ); 942 m.exec( QCursor::pos() );
942 } 943 }
943 break; 944 break;
944 }; 945 };
945 946
946} 947}
947 948
948void PlayListWidget::listDelete() { 949void PlayListWidget::listDelete() {
949 Config cfg( "OpiePlayer" ); 950 Config cfg( "OpiePlayer" );
950 cfg.setGroup("PlayList"); 951 cfg.setGroup("PlayList");
951 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 952 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
952 QString file; 953 QString file;
953 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 954 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
954 switch ( tabWidget->currentPageIndex()) { 955 switch ( tabWidget->currentPageIndex()) {
955 case 0: 956 case 0:
956 break; 957 break;
957 case 1: 958 case 1:
958 { 959 {
959 file = audioView->selectedItem()->text(0); 960 file = audioView->selectedItem()->text(0);
960// Global::findDocuments(&files, "audio/*"); 961// Global::findDocuments(&files, "audio/*");
961// AppLnkSet appFiles; 962// AppLnkSet appFiles;
962 QListIterator<DocLnk> dit( files.children() ); 963 QListIterator<DocLnk> dit( files.children() );
963 for ( ; dit.current(); ++dit ) { 964 for ( ; dit.current(); ++dit ) {
964 if( dit.current()->name() == file) { 965 if( dit.current()->name() == file) {
965// qDebug(file); 966// qDebug(file);
966 LnkProperties prop( dit.current() ); 967 LnkProperties prop( dit.current() );
967// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 968// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
968 prop.showMaximized(); 969 prop.showMaximized();
969 prop.exec(); 970 prop.exec();
970 } 971 }
971 } 972 }
972 populateAudioView(); 973 populateAudioView();
973 } 974 }
974 break; 975 break;
975 case 2: 976 case 2:
976 { 977 {
977// file = videoView->selectedItem()->text(0); 978// file = videoView->selectedItem()->text(0);
978// for ( int i = 0; i < noOfFiles; i++ ) { 979// for ( int i = 0; i < noOfFiles; i++ ) {
979// QString entryName; 980// QString entryName;
980// entryName.sprintf( "File%i", i + 1 ); 981// entryName.sprintf( "File%i", i + 1 );
981// QString linkFile = cfg.readEntry( entryName ); 982// QString linkFile = cfg.readEntry( entryName );
982// AppLnk lnk( AppLnk(linkFile)); 983// AppLnk lnk( AppLnk(linkFile));
983// if( lnk.name() == file ) { 984// if( lnk.name() == file ) {
984// LnkProperties prop( &lnk); 985// LnkProperties prop( &lnk);
985// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 986// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
986// prop.showMaximized(); 987// prop.showMaximized();
987// prop.exec(); 988// prop.exec();
988// } 989// }
989// } 990// }
990 } 991 }
991 break; 992 break;
992 }; 993 };
993} 994}
994 995
995void PlayListWidget::scanForAudio() { 996void PlayListWidget::scanForAudio() {
996 qDebug("scan for audio"); 997 qDebug("scan for audio");
997 files.detachChildren(); 998 files.detachChildren();
998 QListIterator<DocLnk> sdit( files.children() ); 999 QListIterator<DocLnk> sdit( files.children() );
999 for ( ; sdit.current(); ++sdit ) { 1000 for ( ; sdit.current(); ++sdit ) {
1000 delete sdit.current(); 1001 delete sdit.current();
1001 } 1002 }
1002 Global::findDocuments(&files, "audio/*"); 1003 Global::findDocuments(&files, "audio/*");
1003 audioScan = TRUE; 1004 audioScan = TRUE;
1004} 1005}
1005void PlayListWidget::scanForVideo() { 1006void PlayListWidget::scanForVideo() {
1006 qDebug("scan for video"); 1007 qDebug("scan for video");
1007 vFiles.detachChildren(); 1008 vFiles.detachChildren();
1008 QListIterator<DocLnk> sdit( vFiles.children() ); 1009 QListIterator<DocLnk> sdit( vFiles.children() );
1009 for ( ; sdit.current(); ++sdit ) { 1010 for ( ; sdit.current(); ++sdit ) {
1010 delete sdit.current(); 1011 delete sdit.current();
1011 } 1012 }
1012 Global::findDocuments(&vFiles, "video/*"); 1013 Global::findDocuments(&vFiles, "video/*");
1013 videoScan = TRUE; 1014 videoScan = TRUE;
1014} 1015}
1015 1016
1016void PlayListWidget::populateAudioView() { 1017void PlayListWidget::populateAudioView() {
1017 1018
1018 audioView->clear(); 1019 audioView->clear();
1019 StorageInfo storageInfo; 1020 StorageInfo storageInfo;
1020 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1021 const QList<FileSystem> &fs = storageInfo.fileSystems();
1021 if(!audioScan) scanForAudio(); 1022 if(!audioScan) scanForAudio();
1022 1023
1023 QListIterator<DocLnk> dit( files.children() ); 1024 QListIterator<DocLnk> dit( files.children() );
1024 QListIterator<FileSystem> it ( fs ); 1025 QListIterator<FileSystem> it ( fs );
1025 1026
1026 QString storage; 1027 QString storage;
1027 for ( ; dit.current(); ++dit ) { 1028 for ( ; dit.current(); ++dit ) {
1028 for( ; it.current(); ++it ){ 1029 for( ; it.current(); ++it ){
1029 const QString name = (*it)->name(); 1030 const QString name = (*it)->name();
1030 const QString path = (*it)->path(); 1031 const QString path = (*it)->path();
1031 if(dit.current()->file().find(path) != -1 ) storage=name; 1032 if(dit.current()->file().find(path) != -1 ) storage=name;
1032 } 1033 }
1033 1034
1034 QListViewItem * newItem; 1035 QListViewItem * newItem;
1035 if ( QFile( dit.current()->file()).exists() ) { 1036 if ( QFile( dit.current()->file()).exists() ) {
1036// qDebug(dit.current()->name()); 1037// qDebug(dit.current()->name());
1037 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 1038 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
1038 QString::number( QFile( dit.current()->file()).size() ), storage); 1039 QString::number( QFile( dit.current()->file()).size() ), storage);
1039 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); 1040 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
1040 } 1041 }
1041 } 1042 }
1042 1043
1043} 1044}
1044 1045
1045void PlayListWidget::populateVideoView() { 1046void PlayListWidget::populateVideoView() {
1046 videoView->clear(); 1047 videoView->clear();
1047 StorageInfo storageInfo; 1048 StorageInfo storageInfo;
1048 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1049 const QList<FileSystem> &fs = storageInfo.fileSystems();
1049 1050
1050 if(!videoScan ) scanForVideo(); 1051 if(!videoScan ) scanForVideo();
1051 1052
1052 QListIterator<DocLnk> Vdit( vFiles.children() ); 1053 QListIterator<DocLnk> Vdit( vFiles.children() );
1053 QListIterator<FileSystem> it ( fs ); 1054 QListIterator<FileSystem> it ( fs );
1054 videoView->clear(); 1055 videoView->clear();
1055 QString storage; 1056 QString storage;
1056 for ( ; Vdit.current(); ++Vdit ) { 1057 for ( ; Vdit.current(); ++Vdit ) {
1057 for( ; it.current(); ++it ){ 1058 for( ; it.current(); ++it ){
1058 const QString name = (*it)->name(); 1059 const QString name = (*it)->name();
1059 const QString path = (*it)->path(); 1060 const QString path = (*it)->path();
1060 if( Vdit.current()->file().find(path) != -1 ) storage=name; 1061 if( Vdit.current()->file().find(path) != -1 ) storage=name;
1061 } 1062 }
1062 1063
1063 QListViewItem * newItem; 1064 QListViewItem * newItem;
1064 if ( QFile( Vdit.current()->file()).exists() ) { 1065 if ( QFile( Vdit.current()->file()).exists() ) {
1065 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 1066 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
1066 QString::number( QFile( Vdit.current()->file()).size() ), storage); 1067 QString::number( QFile( Vdit.current()->file()).size() ), storage);
1067 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); 1068 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" ));
1068 } 1069 }
1069 } 1070 }
1070} 1071}
1071 1072
1072void PlayListWidget::openFile() { 1073void PlayListWidget::openFile() {
1073 QString filename, name; 1074 QString filename, name;
1074 InputDialog *fileDlg; 1075 InputDialog *fileDlg;
1075 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 1076 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
1076 fileDlg->exec(); 1077 fileDlg->exec();
1077 if( fileDlg->result() == 1 ) { 1078 if( fileDlg->result() == 1 ) {
1078 filename = fileDlg->LineEdit1->text(); 1079 filename = fileDlg->LineEdit1->text();
1079// http://205.188.234.129:8030 1080// http://205.188.234.129:8030
1080// http://66.28.68.70:8000 1081// http://66.28.68.70:8000
1081// filename.replace(QRegExp("%20")," "); 1082// filename.replace(QRegExp("%20")," ");
1082 if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { 1083 if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) {
1083 QMessageBox::message("Note","Spaces in urls are not allowed."); 1084 QMessageBox::message("Note","Spaces in urls are not allowed.");
1084 return; 1085 return;
1085 } else { 1086 } else {
1086 qDebug("Selected filename is "+filename); 1087 qDebug("Selected filename is "+filename);
1087 if(filename.right(3) == "m3u") 1088 if(filename.right(3) == "m3u")
1088 readm3u( filename); 1089 readm3u( filename);
1089 else if(filename.right(3) == "pls") 1090 else if(filename.right(3) == "pls")
1090 readPls( filename); 1091 readPls( filename);
1091 else { 1092 else {
1092 DocLnk lnk; 1093 DocLnk lnk;
1093 1094
1094 lnk.setName(filename); //sets file name 1095 lnk.setName(filename); //sets file name
1095 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") 1096 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
1096 filename += "/"; 1097 filename += "/";
1097 lnk.setFile(filename); //sets File property 1098 lnk.setFile(filename); //sets File property
1098 1099
1099 lnk.setType("audio/x-mpegurl"); 1100 lnk.setType("audio/x-mpegurl");
1100 lnk.setExec("opieplayer"); 1101 lnk.setExec("opieplayer");
1101 lnk.setIcon("opieplayer/MPEGPlayer"); 1102 lnk.setIcon("opieplayer/MPEGPlayer");
1102 1103
1103 if(!lnk.writeLink()) 1104 if(!lnk.writeLink())
1104 qDebug("Writing doclink did not work"); 1105 qDebug("Writing doclink did not work");
1105 d->selectedFiles->addToSelection( lnk); 1106 d->selectedFiles->addToSelection( lnk);
1106// if(fileDlg2) 1107// if(fileDlg2)
1107// delete fileDlg2; 1108// delete fileDlg2;
1108 } 1109 }
1109 } 1110 }
1110 } 1111 }
1111 if(fileDlg) 1112 if(fileDlg)
1112 delete fileDlg; 1113 delete fileDlg;
1113} 1114}
1114 1115
1115void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1116void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1116{ 1117{
1117 switch ( e->key() ) { 1118 switch ( e->key() ) {
1118////////////////////////////// Zaurus keys 1119////////////////////////////// Zaurus keys
1119 case Key_F9: //activity 1120 case Key_F9: //activity
1120// if(audioUI->isHidden()) 1121// if(audioUI->isHidden())
1121// audioUI->showMaximized(); 1122// audioUI->showMaximized();
1122 break; 1123 break;
1123 case Key_F10: //contacts 1124 case Key_F10: //contacts
1124// if( videoUI->isHidden()) 1125// if( videoUI->isHidden())
1125// videoUI->showMaximized(); 1126// videoUI->showMaximized();
1126 break; 1127 break;
1127 case Key_F11: //menu 1128 case Key_F11: //menu
1128 break; 1129 break;
1129 case Key_F12: //home 1130 case Key_F12: //home
1130// doBlank(); 1131// doBlank();
1131 break; 1132 break;
1132 case Key_F13: //mail 1133 case Key_F13: //mail
1133// doUnblank(); 1134// doUnblank();
1134 break; 1135 break;
1135 case Key_Q: //add to playlist 1136 case Key_Q: //add to playlist
1136 qDebug("Add"); 1137 qDebug("Add");
1137 addSelected(); 1138 addSelected();
1138 break; 1139 break;
1139 case Key_R: //remove from playlist 1140 case Key_R: //remove from playlist
1140 removeSelected(); 1141 removeSelected();
1141 break; 1142 break;
1142// case Key_P: //play 1143// case Key_P: //play
1143// qDebug("Play"); 1144// qDebug("Play");
1144// playSelected(); 1145// playSelected();
1145// break; 1146// break;
1146 case Key_Space: 1147 case Key_Space:
1147 qDebug("Play"); 1148 qDebug("Play");
1148// playSelected(); puh 1149// playSelected(); puh
1149 break; 1150 break;
1150 case Key_1: 1151 case Key_1:
1151 tabWidget->setCurrentPage(0); 1152 tabWidget->setCurrentPage(0);
1152 break; 1153 break;
1153 case Key_2: 1154 case Key_2:
1154 tabWidget->setCurrentPage(1); 1155 tabWidget->setCurrentPage(1);
1155 break; 1156 break;
1156 case Key_3: 1157 case Key_3:
1157 tabWidget->setCurrentPage(2); 1158 tabWidget->setCurrentPage(2);
1158 break; 1159 break;
1159 case Key_4: 1160 case Key_4:
1160 tabWidget->setCurrentPage(3); 1161 tabWidget->setCurrentPage(3);
1161 break; 1162 break;
1162 } 1163 }
1163} 1164}
1164 1165
1165void PlayListWidget::keyPressEvent( QKeyEvent *e) 1166void PlayListWidget::keyPressEvent( QKeyEvent *e)
1166{ 1167{
1167// qDebug("Key press"); 1168// qDebug("Key press");
1168// switch ( e->key() ) { 1169// switch ( e->key() ) {
1169// ////////////////////////////// Zaurus keys 1170// ////////////////////////////// Zaurus keys
1170// case Key_A: //add to playlist 1171// case Key_A: //add to playlist
1171// qDebug("Add"); 1172// qDebug("Add");
1172// addSelected(); 1173// addSelected();
1173// break; 1174// break;
1174// case Key_R: //remove from playlist 1175// case Key_R: //remove from playlist
1175// removeSelected(); 1176// removeSelected();
1176// break; 1177// break;
1177// case Key_P: //play 1178// case Key_P: //play
1178// qDebug("Play"); 1179// qDebug("Play");
1179// playSelected(); 1180// playSelected();
1180// break; 1181// break;
1181// case Key_Space: 1182// case Key_Space:
1182// qDebug("Play"); 1183// qDebug("Play");
1183// playSelected(); 1184// playSelected();
1184// break; 1185// break;
1185// } 1186// }
1186} 1187}
1187 1188
1188void PlayListWidget::doBlank() { 1189void PlayListWidget::doBlank() {
1189 qDebug("do blanking"); 1190 qDebug("do blanking");
1190 fd=open("/dev/fb0",O_RDWR); 1191 fd=open("/dev/fb0",O_RDWR);
1191 if (fd != -1) { 1192 if (fd != -1) {
1192 ioctl(fd,FBIOBLANK,1); 1193 ioctl(fd,FBIOBLANK,1);
1193// close(fd); 1194// close(fd);
1194 } 1195 }
1195} 1196}
1196 1197
1197void PlayListWidget::doUnblank() { 1198void PlayListWidget::doUnblank() {
1198 // this crashes opieplayer with a segfault 1199 // this crashes opieplayer with a segfault
1199// int fd; 1200// int fd;
1200// fd=open("/dev/fb0",O_RDWR); 1201// fd=open("/dev/fb0",O_RDWR);
1201 qDebug("do unblanking"); 1202 qDebug("do unblanking");
1202 if (fd != -1) { 1203 if (fd != -1) {
1203 ioctl(fd,FBIOBLANK,0); 1204 ioctl(fd,FBIOBLANK,0);
1204 close(fd); 1205 close(fd);
1205 } 1206 }
1206 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1207 QCopEnvelope h("QPE/System", "setBacklight(int)");
1207 h <<-3;// v[1]; // -3 Force on 1208 h <<-3;// v[1]; // -3 Force on
1208} 1209}
1209 1210
1210void PlayListWidget::readm3u(const QString &filename) { 1211void PlayListWidget::readm3u(const QString &filename) {
1211 1212
1212 qDebug("m3u filename is "+filename); 1213 qDebug("m3u filename is "+filename);
1213 QFile f(filename); 1214 QFile f(filename);
1214 1215
1215 if(f.open(IO_ReadOnly)) { 1216 if(f.open(IO_ReadOnly)) {
1216 QTextStream t(&f); 1217 QTextStream t(&f);
1217 QString s;//, first, second; 1218 QString s;//, first, second;
1218 int i=0; 1219 int i=0;
1219 while ( !t.atEnd()) { 1220 while ( !t.atEnd()) {
1220// Lview->insertLine(t.readLine(),-1); 1221// Lview->insertLine(t.readLine(),-1);
1221 s=t.readLine(); 1222 s=t.readLine();
1222 if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { 1223 if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) {
1223 QMessageBox::message("Note","Spaces in urls are not allowed."); 1224 QMessageBox::message("Note","Spaces in urls are not allowed.");
1224 } 1225 }
1225 else if(s.find("#",0,TRUE) == -1) { 1226 else if(s.find("#",0,TRUE) == -1) {
1226 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat 1227 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
1227 if(s.left(2) == "E:" || s.left(2) == "P:") { 1228 if(s.left(2) == "E:" || s.left(2) == "P:") {
1228 s=s.right(s.length()-2); 1229 s=s.right(s.length()-2);
1229 DocLnk lnk( s ); 1230 DocLnk lnk( s );
1230 QFileInfo f(s); 1231 QFileInfo f(s);
1231 QString name = f.baseName(); 1232 QString name = f.baseName();
1232 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1233 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1233 lnk.setName( name); 1234 lnk.setName( name);
1234 s=s.replace( QRegExp("\\"),"/"); 1235 s=s.replace( QRegExp("\\"),"/");
1235 lnk.setFile( s); 1236 lnk.setFile( s);
1237 lnk.writeLink();
1236// lnk.setIcon(opieplayer/MPEGPlayer); 1238// lnk.setIcon(opieplayer/MPEGPlayer);
1237 qDebug("add "+name); 1239 qDebug("add "+name);
1238 d->selectedFiles->addToSelection( lnk); 1240 d->selectedFiles->addToSelection( lnk);
1239 } else { // is url 1241 } else { // is url
1240 1242
1241 s.replace(QRegExp("%20")," "); 1243 s.replace(QRegExp("%20")," ");
1242 DocLnk lnk( s); 1244 DocLnk lnk( s);
1243 QString name = s.right( s.length() - 7); 1245 QString name;
1246 if(name.left(4)=="http")
1247 name = s.right( s.length() - 7);
1248 else
1249 name=s;
1244// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1250// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1245 lnk.setName(name); 1251 lnk.setName(name);
1246 lnk.setFile( s+"/"); 1252 if(s.at(s.length()-4) == '.')
1253 lnk.setFile( s);
1254 else
1255 lnk.setFile( s+"/");
1247// lnk.setFile( filename); 1256// lnk.setFile( filename);
1248// lnk.setComment( s+"/"); 1257// lnk.setComment( s+"/");
1249 lnk.setType("audio/x-mpegurl"); 1258 lnk.setType("audio/x-mpegurl");
1259 lnk.writeLink();
1250// lnk.setIcon( "opieplayer/MPEGPlayer"); 1260// lnk.setIcon( "opieplayer/MPEGPlayer");
1251// qDebug("add "+s); 1261// qDebug("add "+s);
1252 d->selectedFiles->addToSelection( lnk); 1262 d->selectedFiles->addToSelection( lnk);
1253 } 1263 }
1254 i++; 1264 i++;
1255 } 1265 }
1256 } 1266 }
1257 } 1267 }
1258 } 1268 }
1259 f.close(); 1269 f.close();
1260} 1270}
1261 1271
1262void PlayListWidget::writem3u(const QString &filename) { 1272void PlayListWidget::writem3u(const QString &filename) {
1263 1273
1264} 1274}
1265 1275
1266void PlayListWidget::readPls(const QString &filename) { 1276void PlayListWidget::readPls(const QString &filename) {
1267 1277
1268 qDebug("pls filename is "+filename); 1278 qDebug("pls filename is "+filename);
1269 QFile f(filename); 1279 QFile f(filename);
1270 1280
1271 if(f.open(IO_ReadOnly)) { 1281 if(f.open(IO_ReadOnly)) {
1272 QTextStream t(&f); 1282 QTextStream t(&f);
1273 QString s;//, first, second; 1283 QString s;//, first, second;
1274 int i=0; 1284 int i=0;
1275 while ( !t.atEnd()) { 1285 while ( !t.atEnd()) {
1276 s=t.readLine(); 1286 s=t.readLine();
1277 if(s.left(4) == "File") { 1287 if(s.left(4) == "File") {
1278 s=s.right(s.length() - 6); 1288 s=s.right(s.length() - 6);
1279 s.replace(QRegExp("%20")," "); 1289 s.replace(QRegExp("%20")," ");
1280 qDebug("adding "+s+" to playlist"); 1290 qDebug("adding "+s+" to playlist");
1281// numberofentries=2 1291// numberofentries=2
1282// File1=http 1292// File1=http
1283 // Title 1293 // Title
1284// Length 1294// Length
1285// Version 1295// Version
1286// File2=http 1296// File2=http
1287 1297
1288 s=s.replace( QRegExp("\\"),"/"); 1298 s=s.replace( QRegExp("\\"),"/");
1289// Lview->insertLine(t.readLine(),-1); 1299// Lview->insertLine(t.readLine(),-1);
1290// s=t.readLine(); 1300// s=t.readLine();
1291// s=s.right(s.length()-2); 1301// s=s.right(s.length()-2);
1292 DocLnk lnk( s ); 1302 DocLnk lnk( s );
1293 QFileInfo f(s); 1303 QFileInfo f(s);
1294 QString name = f.baseName(); 1304 QString name = f.baseName();
1295 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1305 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1296// QFileInfo f(s); 1306// QFileInfo f(s);
1297// QString name = f.baseName(); 1307// QString name = f.baseName();
1298// // name = name.left(name.length()-4); 1308// // name = name.left(name.length()-4);
1299// name = name.right(name.findRev("/",0,TRUE)); 1309// name = name.right(name.findRev("/",0,TRUE));
1300 lnk.setName( name); 1310 lnk.setName( name);
1301 lnk.setFile( s+"/"); 1311 lnk.setFile( s+"/");
1302 lnk.setType("audio/x-mpegurl"); 1312 lnk.setType("audio/x-mpegurl");
1303 1313
1304 qDebug("DocLnk add "+name); 1314 qDebug("DocLnk add "+name);
1305 d->selectedFiles->addToSelection( lnk); 1315 d->selectedFiles->addToSelection( lnk);
1306 } 1316 }
1307 } 1317 }
1308 i++; 1318 i++;
1309 } 1319 }
1310} 1320}
1311 1321