summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 5d0f6de..7ea95ab 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,1011 +1,1012 @@
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
86static inline QString fullBaseName ( const QFileInfo &fi ) 86static inline QString fullBaseName ( const QFileInfo &fi )
87{ 87{
88 QString str = fi. fileName ( ); 88 QString str = fi. fileName ( );
89 return str. left ( str. findRev ( '.' )); 89 return str. left ( str. findRev ( '.' ));
90} 90}
91 91
92 92
93QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod;audio/x-ogg"; 93QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod;audio/x-ogg";
94// class myFileSelector { 94// class myFileSelector {
95 95
96// }; 96// };
97class PlayListWidgetPrivate { 97class PlayListWidgetPrivate {
98public: 98public:
99 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 99 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
100 QFrame *playListFrame; 100 QFrame *playListFrame;
101 FileSelector *files; 101 FileSelector *files;
102 PlayListSelection *selectedFiles; 102 PlayListSelection *selectedFiles;
103 bool setDocumentUsed; 103 bool setDocumentUsed;
104 DocLnk *current; 104 DocLnk *current;
105}; 105};
106 106
107 107
108class ToolButton : public QToolButton { 108class ToolButton : public QToolButton {
109public: 109public:
110 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 110 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
111 : QToolButton( parent, name ) { 111 : QToolButton( parent, name ) {
112 setTextLabel( name ); 112 setTextLabel( name );
113 setPixmap( Resource::loadPixmap( icon ) ); 113 setPixmap( Resource::loadPixmap( icon ) );
114 setAutoRaise( TRUE ); 114 setAutoRaise( TRUE );
115 setFocusPolicy( QWidget::NoFocus ); 115 setFocusPolicy( QWidget::NoFocus );
116 setToggleButton( t ); 116 setToggleButton( t );
117 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 117 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
118 QPEMenuToolFocusManager::manager()->addWidget( this ); 118 QPEMenuToolFocusManager::manager()->addWidget( this );
119 } 119 }
120}; 120};
121 121
122 122
123class MenuItem : public QAction { 123class MenuItem : public QAction {
124public: 124public:
125 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 125 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
126 : QAction( text, QString::null, 0, 0 ) { 126 : QAction( text, QString::null, 0, 0 ) {
127 connect( this, SIGNAL( activated() ), handler, slot ); 127 connect( this, SIGNAL( activated() ), handler, slot );
128 addTo( parent ); 128 addTo( parent );
129 } 129 }
130}; 130};
131 131
132 132
133PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 133PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
134 : QMainWindow( parent, name, fl ) { 134 : QMainWindow( parent, name, fl ) {
135 135
136 d = new PlayListWidgetPrivate; 136 d = new PlayListWidgetPrivate;
137 d->setDocumentUsed = FALSE; 137 d->setDocumentUsed = FALSE;
138 d->current = NULL; 138 d->current = NULL;
139 fromSetDocument = FALSE; 139 fromSetDocument = FALSE;
140 insanityBool=FALSE; 140 insanityBool=FALSE;
141 audioScan = FALSE; 141 audioScan = FALSE;
142 videoScan = FALSE; 142 videoScan = FALSE;
143// menuTimer = new QTimer( this ,"menu timer"), 143// menuTimer = new QTimer( this ,"menu timer"),
144// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 144// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
145 channel = new QCopChannel( "QPE/Application/opieplayer", this ); 145 channel = new QCopChannel( "QPE/Application/opieplayer", this );
146 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 146 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
147 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 147 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
148 148
149 setBackgroundMode( PaletteButton ); 149 setBackgroundMode( PaletteButton );
150 150
151 setCaption( tr("OpiePlayer") ); 151 setCaption( tr("OpiePlayer") );
152 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 152 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
153 153
154 setToolBarsMovable( FALSE ); 154 setToolBarsMovable( FALSE );
155 155
156 // Create Toolbar 156 // Create Toolbar
157 QPEToolBar *toolbar = new QPEToolBar( this ); 157 QPEToolBar *toolbar = new QPEToolBar( this );
158 toolbar->setHorizontalStretchable( TRUE ); 158 toolbar->setHorizontalStretchable( TRUE );
159 159
160 // Create Menubar 160 // Create Menubar
161 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 161 QPEMenuBar *menu = new QPEMenuBar( toolbar );
162 menu->setMargin( 0 ); 162 menu->setMargin( 0 );
163 163
164 QPEToolBar *bar = new QPEToolBar( this ); 164 QPEToolBar *bar = new QPEToolBar( this );
165 bar->setLabel( tr( "Play Operations" ) ); 165 bar->setLabel( tr( "Play Operations" ) );
166// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 166// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
167// this , SLOT( addSelected()) ); 167// this , SLOT( addSelected()) );
168 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 168 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
169 tbDeletePlaylist->setFlat(TRUE); 169 tbDeletePlaylist->setFlat(TRUE);
170 170
171 tbDeletePlaylist->setFixedSize(20,20); 171 tbDeletePlaylist->setFixedSize(20,20);
172 172
173 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 173 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
174 this , SLOT(addSelected()) ); 174 this , SLOT(addSelected()) );
175 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", 175 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist",
176 this , SLOT(removeSelected()) ); 176 this , SLOT(removeSelected()) );
177// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 177// d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
178 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 178 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
179 this , SLOT( btnPlay(bool) ), TRUE ); 179 this , SLOT( btnPlay(bool) ), TRUE );
180 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 180 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
181 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 181 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
182 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 182 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
183 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 183 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
184 tbDeletePlaylist->hide(); 184 tbDeletePlaylist->hide();
185 185
186 QPopupMenu *pmPlayList = new QPopupMenu( this ); 186 QPopupMenu *pmPlayList = new QPopupMenu( this );
187 menu->insertItem( tr( "File" ), pmPlayList ); 187 menu->insertItem( tr( "File" ), pmPlayList );
188 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 188 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
189 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 189 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
190 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 190 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
191 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 191 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
192 pmPlayList->insertSeparator(-1); 192 pmPlayList->insertSeparator(-1);
193 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 193 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
194 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 194 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
195 pmPlayList->insertSeparator(-1); 195 pmPlayList->insertSeparator(-1);
196 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 196 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
197 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 197 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
198 198
199 QPopupMenu *pmView = new QPopupMenu( this ); 199 QPopupMenu *pmView = new QPopupMenu( this );
200 menu->insertItem( tr( "View" ), pmView ); 200 menu->insertItem( tr( "View" ), pmView );
201 201
202 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 202 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
203 fullScreenButton->addTo(pmView); 203 fullScreenButton->addTo(pmView);
204 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 204 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
205 scaleButton->addTo(pmView); 205 scaleButton->addTo(pmView);
206 206
207 207
208 skinsMenu = new QPopupMenu( this ); 208 skinsMenu = new QPopupMenu( this );
209 menu->insertItem( tr( "Skins" ), skinsMenu ); 209 menu->insertItem( tr( "Skins" ), skinsMenu );
210 skinsMenu->isCheckable(); 210 skinsMenu->isCheckable();
211 connect( skinsMenu, SIGNAL( activated( int ) ) , 211 connect( skinsMenu, SIGNAL( activated( int ) ) ,
212 this, SLOT( skinsMenuActivated( int ) ) ); 212 this, SLOT( skinsMenuActivated( int ) ) );
213 populateSkinsMenu(); 213 populateSkinsMenu();
214 214
215 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 215 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
216 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 216 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
217 217
218 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 218 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
219 219
220 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 220 tabWidget = new QTabWidget( hbox6, "tabWidget" );
221// tabWidget->setTabShape(QTabWidget::Triangular); 221// tabWidget->setTabShape(QTabWidget::Triangular);
222 222
223 QWidget *pTab; 223 QWidget *pTab;
224 pTab = new QWidget( tabWidget, "pTab" ); 224 pTab = new QWidget( tabWidget, "pTab" );
225// playlistView = new QListView( pTab, "playlistview" ); 225// playlistView = new QListView( pTab, "playlistview" );
226// playlistView->setMinimumSize(236,260); 226// playlistView->setMinimumSize(236,260);
227 tabWidget->insertTab( pTab,"Playlist"); 227 tabWidget->insertTab( pTab,"Playlist");
228 228
229 229
230 // Add the playlist area 230 // Add the playlist area
231 231
232 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 232 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
233 d->playListFrame = vbox3; 233 d->playListFrame = vbox3;
234 234
235 QGridLayout *layoutF = new QGridLayout( pTab ); 235 QGridLayout *layoutF = new QGridLayout( pTab );
236 layoutF->setSpacing( 2); 236 layoutF->setSpacing( 2);
237 layoutF->setMargin( 2); 237 layoutF->setMargin( 2);
238 layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); 238 layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 );
239 239
240 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 240 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
241 241
242 d->selectedFiles = new PlayListSelection( hbox2); 242 d->selectedFiles = new PlayListSelection( hbox2);
243 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 243 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
244 244
245 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 245 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
246 246
247 247
248 248
249 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 249 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
250 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 250 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
251 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 251 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
252 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 252 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
253 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 253 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
254 254
255 QWidget *aTab; 255 QWidget *aTab;
256 aTab = new QWidget( tabWidget, "aTab" ); 256 aTab = new QWidget( tabWidget, "aTab" );
257 audioView = new QListView( aTab, "Audioview" ); 257 audioView = new QListView( aTab, "Audioview" );
258 258
259 QGridLayout *layoutA = new QGridLayout( aTab ); 259 QGridLayout *layoutA = new QGridLayout( aTab );
260 layoutA->setSpacing( 2); 260 layoutA->setSpacing( 2);
261 layoutA->setMargin( 2); 261 layoutA->setMargin( 2);
262 layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 262 layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 );
263 263
264 audioView->addColumn( tr("Title"),-1); 264 audioView->addColumn( tr("Title"),-1);
265 audioView->addColumn(tr("Size"), -1); 265 audioView->addColumn(tr("Size"), -1);
266 audioView->addColumn(tr("Media"),-1); 266 audioView->addColumn(tr("Media"),-1);
267 audioView->addColumn( tr( "Path" ), -1 ); 267 audioView->addColumn( tr( "Path" ), -1 );
268 268
269 audioView->setColumnAlignment(1, Qt::AlignRight); 269 audioView->setColumnAlignment(1, Qt::AlignRight);
270 audioView->setColumnAlignment(2, Qt::AlignRight); 270 audioView->setColumnAlignment(2, Qt::AlignRight);
271 audioView->setAllColumnsShowFocus(TRUE); 271 audioView->setAllColumnsShowFocus(TRUE);
272 272
273 audioView->setMultiSelection( TRUE ); 273 audioView->setMultiSelection( TRUE );
274 audioView->setSelectionMode( QListView::Extended); 274 audioView->setSelectionMode( QListView::Extended);
275 audioView->setSorting( 3, TRUE ); 275 audioView->setSorting( 3, TRUE );
276 276
277 tabWidget->insertTab(aTab,tr("Audio")); 277 tabWidget->insertTab(aTab,tr("Audio"));
278 278
279 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 279 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
280 280
281// audioView 281// audioView
282// populateAudioView(); 282// populateAudioView();
283// videowidget 283// videowidget
284 284
285 QWidget *vTab; 285 QWidget *vTab;
286 vTab = new QWidget( tabWidget, "vTab" ); 286 vTab = new QWidget( tabWidget, "vTab" );
287 videoView = new QListView( vTab, "Videoview" ); 287 videoView = new QListView( vTab, "Videoview" );
288 288
289 QGridLayout *layoutV = new QGridLayout( vTab ); 289 QGridLayout *layoutV = new QGridLayout( vTab );
290 layoutV->setSpacing( 2); 290 layoutV->setSpacing( 2);
291 layoutV->setMargin( 2); 291 layoutV->setMargin( 2);
292 layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 292 layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
293 293
294 videoView->addColumn(tr("Title"),-1); 294 videoView->addColumn(tr("Title"),-1);
295 videoView->addColumn(tr("Size"),-1); 295 videoView->addColumn(tr("Size"),-1);
296 videoView->addColumn(tr("Media"),-1); 296 videoView->addColumn(tr("Media"),-1);
297 videoView->addColumn(tr( "Path" ), -1 ); 297 videoView->addColumn(tr( "Path" ), -1 );
298 videoView->setColumnAlignment(1, Qt::AlignRight); 298 videoView->setColumnAlignment(1, Qt::AlignRight);
299 videoView->setColumnAlignment(2, Qt::AlignRight); 299 videoView->setColumnAlignment(2, Qt::AlignRight);
300 videoView->setAllColumnsShowFocus(TRUE); 300 videoView->setAllColumnsShowFocus(TRUE);
301 videoView->setMultiSelection( TRUE ); 301 videoView->setMultiSelection( TRUE );
302 videoView->setSelectionMode( QListView::Extended); 302 videoView->setSelectionMode( QListView::Extended);
303 303
304 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 304 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
305 305
306 tabWidget->insertTab( vTab,tr("Video")); 306 tabWidget->insertTab( vTab,tr("Video"));
307 307
308 QWidget *LTab; 308 QWidget *LTab;
309 LTab = new QWidget( tabWidget, "LTab" ); 309 LTab = new QWidget( tabWidget, "LTab" );
310 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 310 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
311 311
312 QGridLayout *layoutL = new QGridLayout( LTab ); 312 QGridLayout *layoutL = new QGridLayout( LTab );
313 layoutL->setSpacing( 2); 313 layoutL->setSpacing( 2);
314 layoutL->setMargin( 2); 314 layoutL->setMargin( 2);
315 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 315 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
316// playLists->setMinimumSize(233,260); 316// playLists->setMinimumSize(233,260);
317 317
318 tabWidget->insertTab(LTab,tr("Lists")); 318 tabWidget->insertTab(LTab,tr("Lists"));
319 319
320 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 320 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
321 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 321 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
322 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 322 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
323 323
324 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 324 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
325 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 325 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
326 326
327 327
328///audioView 328///audioView
329 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 329 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
330 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 330 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
331 331
332 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 332 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
333 this,SLOT( playIt( QListViewItem *)) ); 333 this,SLOT( playIt( QListViewItem *)) );
334 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 334 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
335 335
336 336
337//videoView 337//videoView
338 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 338 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
339 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 339 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
340 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 340 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
341 this,SLOT( playIt( QListViewItem *)) ); 341 this,SLOT( playIt( QListViewItem *)) );
342 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 342 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
343 343
344//playlists 344//playlists
345 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 345 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
346 346
347 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 347 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
348 348
349 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 349 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
350 350
351 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 351 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
352 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 352 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
353 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 353 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
354 354
355 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 355 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
356 356
357 setCentralWidget( vbox5 ); 357 setCentralWidget( vbox5 );
358 358
359 Config cfg( "OpiePlayer" ); 359 Config cfg( "OpiePlayer" );
360 readConfig( cfg ); 360 readConfig( cfg );
361 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 361 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
362 loadList(DocLnk( currentPlaylist)); 362 loadList(DocLnk( currentPlaylist));
363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); 363 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
364 364
365 initializeStates(); 365 initializeStates();
366 // audioUI->setFocus(); 366 // audioUI->setFocus();
367} 367}
368 368
369 369
370PlayListWidget::~PlayListWidget() { 370PlayListWidget::~PlayListWidget() {
371 Config cfg( "OpiePlayer" ); 371 Config cfg( "OpiePlayer" );
372 writeConfig( cfg ); 372 writeConfig( cfg );
373 373
374 if ( d->current ) 374 if ( d->current )
375 delete d->current; 375 delete d->current;
376 if(d) delete d; 376 if(d) delete d;
377} 377}
378 378
379 379
380void PlayListWidget::initializeStates() { 380void PlayListWidget::initializeStates() {
381 381
382 d->tbPlay->setOn( mediaPlayerState->playing() ); 382 d->tbPlay->setOn( mediaPlayerState->playing() );
383 d->tbLoop->setOn( mediaPlayerState->looping() ); 383 d->tbLoop->setOn( mediaPlayerState->looping() );
384 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 384 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
385 setPlaylist( true); 385 setPlaylist( true);
386} 386}
387 387
388 388
389void PlayListWidget::readConfig( Config& cfg ) { 389void PlayListWidget::readConfig( Config& cfg ) {
390 cfg.setGroup("PlayList"); 390 cfg.setGroup("PlayList");
391 QString currentString = cfg.readEntry("current", "" ); 391 QString currentString = cfg.readEntry("current", "" );
392 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 392 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
393 for ( int i = 0; i < noOfFiles; i++ ) { 393 for ( int i = 0; i < noOfFiles; i++ ) {
394 QString entryName; 394 QString entryName;
395 entryName.sprintf( "File%i", i + 1 ); 395 entryName.sprintf( "File%i", i + 1 );
396 QString linkFile = cfg.readEntry( entryName ); 396 QString linkFile = cfg.readEntry( entryName );
397 DocLnk lnk( linkFile ); 397 DocLnk lnk( linkFile );
398 if ( lnk.isValid() ) { 398 if ( lnk.isValid() ) {
399 d->selectedFiles->addToSelection( lnk ); 399 d->selectedFiles->addToSelection( lnk );
400 } 400 }
401 } 401 }
402 d->selectedFiles->setSelectedItem( currentString); 402 d->selectedFiles->setSelectedItem( currentString);
403} 403}
404 404
405 405
406void PlayListWidget::writeConfig( Config& cfg ) const { 406void PlayListWidget::writeConfig( Config& cfg ) const {
407 407
408 d->selectedFiles->writeCurrent( cfg); 408 d->selectedFiles->writeCurrent( cfg);
409 cfg.setGroup("PlayList"); 409 cfg.setGroup("PlayList");
410 int noOfFiles = 0; 410 int noOfFiles = 0;
411 d->selectedFiles->first(); 411 d->selectedFiles->first();
412 do { 412 do {
413 const DocLnk *lnk = d->selectedFiles->current(); 413 const DocLnk *lnk = d->selectedFiles->current();
414 if ( lnk ) { 414 if ( lnk ) {
415 QString entryName; 415 QString entryName;
416 entryName.sprintf( "File%i", noOfFiles + 1 ); 416 entryName.sprintf( "File%i", noOfFiles + 1 );
417// qDebug(entryName); 417// qDebug(entryName);
418 cfg.writeEntry( entryName, lnk->linkFile() ); 418 cfg.writeEntry( entryName, lnk->linkFile() );
419 // if this link does exist, add it so we have the file 419 // if this link does exist, add it so we have the file
420 // next time... 420 // next time...
421 if ( !QFile::exists( lnk->linkFile() ) ) { 421 if ( !QFile::exists( lnk->linkFile() ) ) {
422 // the way writing lnks doesn't really check for out 422 // the way writing lnks doesn't really check for out
423 // of disk space, but check it anyway. 423 // of disk space, but check it anyway.
424 if ( !lnk->writeLink() ) { 424 if ( !lnk->writeLink() ) {
425 QMessageBox::critical( 0, tr("Out of space"), 425 QMessageBox::critical( 0, tr("Out of space"),
426 tr( "There was a problem saving " 426 tr( "There was a problem saving "
427 "the playlist.\n" 427 "the playlist.\n"
428 "Your playlist " 428 "Your playlist "
429 "may be missing some entries\n" 429 "may be missing some entries\n"
430 "the next time you start it." ) 430 "the next time you start it." )
431 ); 431 );
432 } 432 }
433 } 433 }
434 noOfFiles++; 434 noOfFiles++;
435 } 435 }
436 } 436 }
437 while ( d->selectedFiles->next() ); 437 while ( d->selectedFiles->next() );
438 cfg.writeEntry("NumberOfFiles", noOfFiles ); 438 cfg.writeEntry("NumberOfFiles", noOfFiles );
439} 439}
440 440
441 441
442void PlayListWidget::addToSelection( const DocLnk& lnk ) { 442void PlayListWidget::addToSelection( const DocLnk& lnk ) {
443 d->setDocumentUsed = false; 443 d->setDocumentUsed = false;
444 if ( mediaPlayerState->playlist() ) { 444 if ( mediaPlayerState->playlist() ) {
445 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) 445 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
446 d->selectedFiles->addToSelection( lnk ); 446 d->selectedFiles->addToSelection( lnk );
447 } 447 }
448 else 448 else
449 mediaPlayerState->setPlaying( true); 449 mediaPlayerState->setPlaying( true);
450} 450}
451 451
452 452
453void PlayListWidget::clearList() { 453void PlayListWidget::clearList() {
454 while ( first() ) 454 while ( first() )
455 d->selectedFiles->removeSelected(); 455 d->selectedFiles->removeSelected();
456} 456}
457 457
458 458
459void PlayListWidget::addAllToList() { 459void PlayListWidget::addAllToList() {
460 DocLnkSet filesAll; 460 DocLnkSet filesAll;
461 Global::findDocuments(&filesAll, "video/*;audio/*"); 461 Global::findDocuments(&filesAll, "video/*;audio/*");
462 QListIterator<DocLnk> Adit( filesAll.children() ); 462 QListIterator<DocLnk> Adit( filesAll.children() );
463 for ( ; Adit.current(); ++Adit ) 463 for ( ; Adit.current(); ++Adit )
464 if(QFileInfo(Adit.current()->file()).exists()) 464 if(QFileInfo(Adit.current()->file()).exists())
465 d->selectedFiles->addToSelection( **Adit ); 465 d->selectedFiles->addToSelection( **Adit );
466 tabWidget->setCurrentPage(0); 466 tabWidget->setCurrentPage(0);
467 467
468 writeCurrentM3u(); 468 writeCurrentM3u();
469 d->selectedFiles->first(); 469 d->selectedFiles->first();
470} 470}
471 471
472 472
473void PlayListWidget::addAllMusicToList() { 473void PlayListWidget::addAllMusicToList() {
474 QListIterator<DocLnk> dit( files.children() ); 474 QListIterator<DocLnk> dit( files.children() );
475 for ( ; dit.current(); ++dit ) 475 for ( ; dit.current(); ++dit )
476 if(QFileInfo(dit.current()->file()).exists()) 476 if(QFileInfo(dit.current()->file()).exists())
477 d->selectedFiles->addToSelection( **dit ); 477 d->selectedFiles->addToSelection( **dit );
478 tabWidget->setCurrentPage(0); 478 tabWidget->setCurrentPage(0);
479 479
480 writeCurrentM3u(); 480 writeCurrentM3u();
481 d->selectedFiles->first(); 481 d->selectedFiles->first();
482} 482}
483 483
484 484
485void PlayListWidget::addAllVideoToList() { 485void PlayListWidget::addAllVideoToList() {
486 QListIterator<DocLnk> dit( vFiles.children() ); 486 QListIterator<DocLnk> dit( vFiles.children() );
487 for ( ; dit.current(); ++dit ) 487 for ( ; dit.current(); ++dit )
488 if(QFileInfo( dit.current()->file()).exists()) 488 if(QFileInfo( dit.current()->file()).exists())
489 d->selectedFiles->addToSelection( **dit ); 489 d->selectedFiles->addToSelection( **dit );
490 tabWidget->setCurrentPage(0); 490 tabWidget->setCurrentPage(0);
491 491
492 writeCurrentM3u(); 492 writeCurrentM3u();
493 d->selectedFiles->first(); 493 d->selectedFiles->first();
494} 494}
495 495
496 496
497void PlayListWidget::setDocument(const QString& fileref) { 497void PlayListWidget::setDocument(const QString& fileref) {
498 fromSetDocument = true; 498 fromSetDocument = true;
499 d->setDocumentUsed = TRUE; 499 d->setDocumentUsed = TRUE;
500 d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true );
500 mediaPlayerState->setPlaying( FALSE ); 501 mediaPlayerState->setPlaying( FALSE );
501 qApp->processEvents(); 502 qApp->processEvents();
502 mediaPlayerState->setPlaying( TRUE ); 503 mediaPlayerState->setPlaying( TRUE );
503} 504}
504 505
505void PlayListWidget::setDocumentEx(const QString& fileref) { 506void PlayListWidget::setDocumentEx(const QString& fileref) {
506 507
507 QFileInfo fileInfo(fileref); 508 QFileInfo fileInfo(fileref);
508 if ( !fileInfo.exists() ) { 509 if ( !fileInfo.exists() ) {
509 QMessageBox::critical( 0, tr( "Invalid File" ), 510 QMessageBox::critical( 0, tr( "Invalid File" ),
510 tr( "There was a problem in getting the file." ) ); 511 tr( "There was a problem in getting the file." ) );
511 return; 512 return;
512 } 513 }
513 qDebug("setDocument "+fileref); 514 qDebug("setDocument "+fileref);
514 QString extension = fileInfo.extension(false); 515 QString extension = fileInfo.extension(false);
515 if( extension.find( "m3u", 0, false) != -1) { //is m3u 516 if( extension.find( "m3u", 0, false) != -1) { //is m3u
516 readm3u( fileref); 517 readm3u( fileref);
517 } 518 }
518 else if( extension.find( "pls", 0, false) != -1 ) { //is pls 519 else if( extension.find( "pls", 0, false) != -1 ) { //is pls
519 readPls( fileref); 520 readPls( fileref);
520 } 521 }
521 else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist 522 else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist
522 clearList(); 523 clearList();
523 DocLnk lnk; 524 DocLnk lnk;
524 lnk.setName( fileInfo.baseName() ); //sets name 525 lnk.setName( fileInfo.baseName() ); //sets name
525 lnk.setFile( fileref ); //sets file name 526 lnk.setFile( fileref ); //sets file name
526 //addToSelection( lnk ); 527 //addToSelection( lnk );
527 528
528 loadList( lnk); 529 loadList( lnk);
529 d->selectedFiles->first(); 530 d->selectedFiles->first();
530 } else { 531 } else {
531 clearList(); 532 clearList();
532 DocLnk lnk; 533 DocLnk lnk;
533 lnk.setName( fileInfo.baseName() ); //sets name 534 lnk.setName( fileInfo.baseName() ); //sets name
534 lnk.setFile( fileref ); //sets file name 535 lnk.setFile( fileref ); //sets file name
535 addToSelection( lnk ); 536 addToSelection( lnk );
536// addToSelection( DocLnk( fileref ) ); 537// addToSelection( DocLnk( fileref ) );
537 d->setDocumentUsed = TRUE; 538 d->setDocumentUsed = TRUE;
538 mediaPlayerState->setPlaying( FALSE ); 539 mediaPlayerState->setPlaying( FALSE );
539 qApp->processEvents(); 540 qApp->processEvents();
540 mediaPlayerState->setPlaying( TRUE ); 541 mediaPlayerState->setPlaying( TRUE );
541 // qApp->processEvents(); 542 // qApp->processEvents();
542 setCaption(tr("OpiePlayer")); 543 setCaption(tr("OpiePlayer"));
543 } 544 }
544} 545}
545 546
546 547
547void PlayListWidget::setActiveWindow() { 548void PlayListWidget::setActiveWindow() {
548 qDebug("SETTING active window"); 549 qDebug("SETTING active window");
549 550
550 // When we get raised we need to ensure that it switches views 551 // When we get raised we need to ensure that it switches views
551 char origView = mediaPlayerState->view(); 552 char origView = mediaPlayerState->view();
552 mediaPlayerState->setView( 'l' ); // invalidate 553 mediaPlayerState->setView( 'l' ); // invalidate
553 mediaPlayerState->setView( origView ); // now switch back 554 mediaPlayerState->setView( origView ); // now switch back
554} 555}
555 556
556 557
557void PlayListWidget::useSelectedDocument() { 558void PlayListWidget::useSelectedDocument() {
558 d->setDocumentUsed = FALSE; 559 d->setDocumentUsed = FALSE;
559} 560}
560 561
561 562
562const DocLnk *PlayListWidget::current() { // this is fugly 563const DocLnk *PlayListWidget::current() { // this is fugly
563 564
564// if( fromSetDocument) { 565// if( fromSetDocument) {
565// qDebug("from setDoc"); 566// qDebug("from setDoc");
566// DocLnkSet files; 567// DocLnkSet files;
567// Global::findDocuments(&files, "video/*;audio/*"); 568// Global::findDocuments(&files, "video/*;audio/*");
568// QListIterator<DocLnk> dit( files.children() ); 569// QListIterator<DocLnk> dit( files.children() );
569// for ( ; dit.current(); ++dit ) { 570// for ( ; dit.current(); ++dit ) {
570// if(dit.current()->linkFile() == setDocFileRef) { 571// if(dit.current()->linkFile() == setDocFileRef) {
571// qDebug(setDocFileRef); 572// qDebug(setDocFileRef);
572// return dit; 573// return dit;
573// } 574// }
574// } 575// }
575// } else 576// } else
576 577
577 qDebug("current"); 578 qDebug("current");
578 579
579 switch (tabWidget->currentPageIndex()) { 580 switch (tabWidget->currentPageIndex()) {
580 case 0: //playlist 581 case 0: //playlist
581 { 582 {
582 qDebug("playlist"); 583 qDebug("playlist");
583 if ( mediaPlayerState->playlist() ) { 584 if ( mediaPlayerState->playlist() ) {
584 return d->selectedFiles->current(); 585 return d->selectedFiles->current();
585 } 586 }
586 else if ( d->setDocumentUsed && d->current ) { 587 else if ( d->setDocumentUsed && d->current ) {
587 return d->current; 588 return d->current;
588 } else { 589 } else {
589 return &(d->files->selectedDocument()); 590 return &(d->files->selectedDocument());
590 } 591 }
591 } 592 }
592 break; 593 break;
593 case 1://audio 594 case 1://audio
594 { 595 {
595 qDebug("audioView"); 596 qDebug("audioView");
596 QListIterator<DocLnk> dit( files.children() ); 597 QListIterator<DocLnk> dit( files.children() );
597 for ( ; dit.current(); ++dit ) { 598 for ( ; dit.current(); ++dit ) {
598 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { 599 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
599 qDebug("here"); 600 qDebug("here");
600 insanityBool=TRUE; 601 insanityBool=TRUE;
601 return dit; 602 return dit;
602 } 603 }
603 } 604 }
604 } 605 }
605 break; 606 break;
606 case 2: // video 607 case 2: // video
607 { 608 {
608 qDebug("videoView"); 609 qDebug("videoView");
609 QListIterator<DocLnk> Vdit( vFiles.children() ); 610 QListIterator<DocLnk> Vdit( vFiles.children() );
610 for ( ; Vdit.current(); ++Vdit ) { 611 for ( ; Vdit.current(); ++Vdit ) {
611 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { 612 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
612 insanityBool=TRUE; 613 insanityBool=TRUE;
613 return Vdit; 614 return Vdit;
614 } 615 }
615 } 616 }
616 } 617 }
617 break; 618 break;
618 }; 619 };
619 return 0; 620 return 0;
620} 621}
621 622
622bool PlayListWidget::prev() { 623bool PlayListWidget::prev() {
623 if ( mediaPlayerState->playlist() ) { 624 if ( mediaPlayerState->playlist() ) {
624 if ( mediaPlayerState->shuffled() ) { 625 if ( mediaPlayerState->shuffled() ) {
625 const DocLnk *cur = current(); 626 const DocLnk *cur = current();
626 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 627 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
627 for ( int i = 0; i < j; i++ ) { 628 for ( int i = 0; i < j; i++ ) {
628 if ( !d->selectedFiles->next() ) 629 if ( !d->selectedFiles->next() )
629 d->selectedFiles->first(); 630 d->selectedFiles->first();
630 } 631 }
631 if ( cur == current() ) 632 if ( cur == current() )
632 if ( !d->selectedFiles->next() ) 633 if ( !d->selectedFiles->next() )
633 d->selectedFiles->first(); 634 d->selectedFiles->first();
634 return TRUE; 635 return TRUE;
635 } else { 636 } else {
636 if ( !d->selectedFiles->prev() ) { 637 if ( !d->selectedFiles->prev() ) {
637 if ( mediaPlayerState->looping() ) { 638 if ( mediaPlayerState->looping() ) {
638 return d->selectedFiles->last(); 639 return d->selectedFiles->last();
639 } else { 640 } else {
640 return FALSE; 641 return FALSE;
641 } 642 }
642 } 643 }
643 return TRUE; 644 return TRUE;
644 } 645 }
645 } else { 646 } else {
646 return mediaPlayerState->looping(); 647 return mediaPlayerState->looping();
647 } 648 }
648} 649}
649 650
650 651
651bool PlayListWidget::next() { 652bool PlayListWidget::next() {
652 if ( mediaPlayerState->playlist() ) { 653 if ( mediaPlayerState->playlist() ) {
653 if ( mediaPlayerState->shuffled() ) { 654 if ( mediaPlayerState->shuffled() ) {
654 return prev(); 655 return prev();
655 } else { 656 } else {
656 if ( !d->selectedFiles->next() ) { 657 if ( !d->selectedFiles->next() ) {
657 if ( mediaPlayerState->looping() ) { 658 if ( mediaPlayerState->looping() ) {
658 return d->selectedFiles->first(); 659 return d->selectedFiles->first();
659 } else { 660 } else {
660 return FALSE; 661 return FALSE;
661 } 662 }
662 } 663 }
663 return TRUE; 664 return TRUE;
664 } 665 }
665 } else { 666 } else {
666 return mediaPlayerState->looping(); 667 return mediaPlayerState->looping();
667 } 668 }
668} 669}
669 670
670 671
671bool PlayListWidget::first() { 672bool PlayListWidget::first() {
672 if ( mediaPlayerState->playlist() ) 673 if ( mediaPlayerState->playlist() )
673 return d->selectedFiles->first(); 674 return d->selectedFiles->first();
674 else 675 else
675 return mediaPlayerState->looping(); 676 return mediaPlayerState->looping();
676} 677}
677 678
678 679
679bool PlayListWidget::last() { 680bool PlayListWidget::last() {
680 if ( mediaPlayerState->playlist() ) 681 if ( mediaPlayerState->playlist() )
681 return d->selectedFiles->last(); 682 return d->selectedFiles->last();
682 else 683 else
683 return mediaPlayerState->looping(); 684 return mediaPlayerState->looping();
684} 685}
685 686
686 687
687void PlayListWidget::saveList() { 688void PlayListWidget::saveList() {
688 writem3u(); 689 writem3u();
689} 690}
690 691
691void PlayListWidget::loadList( const DocLnk & lnk) { 692void PlayListWidget::loadList( const DocLnk & lnk) {
692 QString name = lnk.name(); 693 QString name = lnk.name();
693// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 694// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
694 695
695 if( name.length()>0) { 696 if( name.length()>0) {
696 setCaption("OpiePlayer: "+name); 697 setCaption("OpiePlayer: "+name);
697// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 698// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
698 clearList(); 699 clearList();
699 readm3u(lnk.file()); 700 readm3u(lnk.file());
700 tabWidget->setCurrentPage(0); 701 tabWidget->setCurrentPage(0);
701 } 702 }
702} 703}
703 704
704void PlayListWidget::setPlaylist( bool shown ) { 705void PlayListWidget::setPlaylist( bool shown ) {
705 if ( shown ) 706 if ( shown )
706 d->playListFrame->show(); 707 d->playListFrame->show();
707 else 708 else
708 d->playListFrame->hide(); 709 d->playListFrame->hide();
709} 710}
710 711
711void PlayListWidget::setView( char view ) { 712void PlayListWidget::setView( char view ) {
712 if ( view == 'l' ) 713 if ( view == 'l' )
713 showMaximized(); 714 showMaximized();
714 else 715 else
715 hide(); 716 hide();
716} 717}
717 718
718void PlayListWidget::addSelected() { 719void PlayListWidget::addSelected() {
719 qDebug("addSelected"); 720 qDebug("addSelected");
720 DocLnk lnk; 721 DocLnk lnk;
721 QString filename; 722 QString filename;
722 switch (tabWidget->currentPageIndex()) { 723 switch (tabWidget->currentPageIndex()) {
723 724
724 case 0: //playlist 725 case 0: //playlist
725 return; 726 return;
726 break; 727 break;
727 case 1: { //audio 728 case 1: { //audio
728 QListViewItemIterator it( audioView ); 729 QListViewItemIterator it( audioView );
729 for ( ; it.current(); ++it ) { 730 for ( ; it.current(); ++it ) {
730 if ( it.current()->isSelected() ) { 731 if ( it.current()->isSelected() ) {
731 filename = it.current()->text(3); 732 filename = it.current()->text(3);
732 lnk.setName( QFileInfo(filename).baseName() ); //sets name 733 lnk.setName( QFileInfo(filename).baseName() ); //sets name
733 lnk.setFile( filename ); //sets file name 734 lnk.setFile( filename ); //sets file name
734 d->selectedFiles->addToSelection( lnk); 735 d->selectedFiles->addToSelection( lnk);
735 } 736 }
736 } 737 }
737 audioView->clearSelection(); 738 audioView->clearSelection();
738 // d->selectedFiles->next(); 739 // d->selectedFiles->next();
739 } 740 }
740 break; 741 break;
741 742
742 case 2: { // video 743 case 2: { // video
743 QListViewItemIterator it( videoView ); 744 QListViewItemIterator it( videoView );
744 for ( ; it.current(); ++it ) { 745 for ( ; it.current(); ++it ) {
745 if ( it.current()->isSelected() ) { 746 if ( it.current()->isSelected() ) {
746 747
747 filename = it.current()->text(3); 748 filename = it.current()->text(3);
748 lnk.setName( QFileInfo(filename).baseName() ); //sets name 749 lnk.setName( QFileInfo(filename).baseName() ); //sets name
749 lnk.setFile( filename ); //sets file name 750 lnk.setFile( filename ); //sets file name
750 d->selectedFiles->addToSelection( lnk); 751 d->selectedFiles->addToSelection( lnk);
751 } 752 }
752 } 753 }
753 videoView->clearSelection(); 754 videoView->clearSelection();
754 } 755 }
755 break; 756 break;
756 }; 757 };
757// tabWidget->setCurrentPage(0); 758// tabWidget->setCurrentPage(0);
758 writeCurrentM3u(); 759 writeCurrentM3u();
759 760
760} 761}
761 762
762void PlayListWidget::removeSelected() { 763void PlayListWidget::removeSelected() {
763 d->selectedFiles->removeSelected( ); 764 d->selectedFiles->removeSelected( );
764} 765}
765 766
766void PlayListWidget::playIt( QListViewItem *) { 767void PlayListWidget::playIt( QListViewItem *) {
767// d->setDocumentUsed = FALSE; 768// d->setDocumentUsed = FALSE;
768// mediaPlayerState->curPosition =0; 769// mediaPlayerState->curPosition =0;
769 qDebug("playIt"); 770 qDebug("playIt");
770 // mediaPlayerState->setPlaying(FALSE); 771 // mediaPlayerState->setPlaying(FALSE);
771 mediaPlayerState->setPlaying(TRUE); 772 mediaPlayerState->setPlaying(TRUE);
772 d->selectedFiles->unSelect(); 773 d->selectedFiles->unSelect();
773} 774}
774 775
775void PlayListWidget::addToSelection( QListViewItem *it) { 776void PlayListWidget::addToSelection( QListViewItem *it) {
776 d->setDocumentUsed = FALSE; 777 d->setDocumentUsed = FALSE;
777 778
778 if(it) { 779 if(it) {
779 switch ( tabWidget->currentPageIndex()) { 780 switch ( tabWidget->currentPageIndex()) {
780 case 0: //playlist 781 case 0: //playlist
781 return; 782 return;
782 break; 783 break;
783 }; 784 };
784 // case 1: { 785 // case 1: {
785 DocLnk lnk; 786 DocLnk lnk;
786 QString filename; 787 QString filename;
787 788
788 filename=it->text(3); 789 filename=it->text(3);
789 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name 790 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
790 lnk.setFile( filename ); //sets file name 791 lnk.setFile( filename ); //sets file name
791 d->selectedFiles->addToSelection( lnk); 792 d->selectedFiles->addToSelection( lnk);
792 793
793 if(tabWidget->currentPageIndex() == 0) 794 if(tabWidget->currentPageIndex() == 0)
794 writeCurrentM3u(); 795 writeCurrentM3u();
795// tabWidget->setCurrentPage(0); 796// tabWidget->setCurrentPage(0);
796 797
797 } 798 }
798} 799}
799 800
800void PlayListWidget::tabChanged(QWidget *) { 801void PlayListWidget::tabChanged(QWidget *) {
801 802
802 switch ( tabWidget->currentPageIndex()) { 803 switch ( tabWidget->currentPageIndex()) {
803 case 0: 804 case 0:
804 { 805 {
805 if( !tbDeletePlaylist->isHidden()) 806 if( !tbDeletePlaylist->isHidden())
806 tbDeletePlaylist->hide(); 807 tbDeletePlaylist->hide();
807 d->tbRemoveFromList->setEnabled(TRUE); 808 d->tbRemoveFromList->setEnabled(TRUE);
808 d->tbAddToList->setEnabled(FALSE); 809 d->tbAddToList->setEnabled(FALSE);
809 } 810 }
810 break; 811 break;
811 case 1: 812 case 1:
812 { 813 {
813 audioView->clear(); 814 audioView->clear();
814 populateAudioView(); 815 populateAudioView();
815 816
816 if( !tbDeletePlaylist->isHidden()) 817 if( !tbDeletePlaylist->isHidden())
817 tbDeletePlaylist->hide(); 818 tbDeletePlaylist->hide();
818 d->tbRemoveFromList->setEnabled(FALSE); 819 d->tbRemoveFromList->setEnabled(FALSE);
819 d->tbAddToList->setEnabled(TRUE); 820 d->tbAddToList->setEnabled(TRUE);
820 } 821 }
821 break; 822 break;
822 case 2: 823 case 2:
823 { 824 {
824 videoView->clear(); 825 videoView->clear();
825 populateVideoView(); 826 populateVideoView();
826 if( !tbDeletePlaylist->isHidden()) 827 if( !tbDeletePlaylist->isHidden())
827 tbDeletePlaylist->hide(); 828 tbDeletePlaylist->hide();
828 d->tbRemoveFromList->setEnabled(FALSE); 829 d->tbRemoveFromList->setEnabled(FALSE);
829 d->tbAddToList->setEnabled(TRUE); 830 d->tbAddToList->setEnabled(TRUE);
830 } 831 }
831 break; 832 break;
832 case 3: 833 case 3:
833 { 834 {
834 if( tbDeletePlaylist->isHidden()) 835 if( tbDeletePlaylist->isHidden())
835 tbDeletePlaylist->show(); 836 tbDeletePlaylist->show();
836 playLists->reread(); 837 playLists->reread();
837 } 838 }
838 break; 839 break;
839 }; 840 };
840} 841}
841 842
842void PlayListWidget::btnPlay(bool b) { 843void PlayListWidget::btnPlay(bool b) {
843 qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b); 844 qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b);
844// mediaPlayerState->setPlaying(b); 845// mediaPlayerState->setPlaying(b);
845 switch ( tabWidget->currentPageIndex()) { 846 switch ( tabWidget->currentPageIndex()) {
846 case 0: 847 case 0:
847 { 848 {
848 qDebug("1"); 849 qDebug("1");
849// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 850// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
850// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 851// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
851// QMessageBox::message("Note","You are trying to play\na malformed url."); 852// QMessageBox::message("Note","You are trying to play\na malformed url.");
852// } else { 853// } else {
853 mediaPlayerState->setPlaying(b); 854 mediaPlayerState->setPlaying(b);
854 insanityBool=FALSE; 855 insanityBool=FALSE;
855 qDebug("insanity"); 856 qDebug("insanity");
856// } 857// }
857 } 858 }
858 break; 859 break;
859 case 1: 860 case 1:
860 { 861 {
861 qDebug("2"); 862 qDebug("2");
862// d->selectedFiles->unSelect(); 863// d->selectedFiles->unSelect();
863 addToSelection( audioView->currentItem() ); 864 addToSelection( audioView->currentItem() );
864 mediaPlayerState->setPlaying( b); 865 mediaPlayerState->setPlaying( b);
865 d->selectedFiles->removeSelected( ); 866 d->selectedFiles->removeSelected( );
866 d->selectedFiles->unSelect(); 867 d->selectedFiles->unSelect();
867 tabWidget->setCurrentPage(1); 868 tabWidget->setCurrentPage(1);
868 insanityBool=FALSE; 869 insanityBool=FALSE;
869 }// audioView->clearSelection(); 870 }// audioView->clearSelection();
870 break; 871 break;
871 case 2: 872 case 2:
872 { 873 {
873 qDebug("3"); 874 qDebug("3");
874 875
875 addToSelection( videoView->currentItem() ); 876 addToSelection( videoView->currentItem() );
876 mediaPlayerState->setPlaying( b); 877 mediaPlayerState->setPlaying( b);
877// qApp->processEvents(); 878// qApp->processEvents();
878 d->selectedFiles->removeSelected( ); 879 d->selectedFiles->removeSelected( );
879 d->selectedFiles->unSelect(); 880 d->selectedFiles->unSelect();
880 tabWidget->setCurrentPage(2); 881 tabWidget->setCurrentPage(2);
881 insanityBool=FALSE; 882 insanityBool=FALSE;
882 }// videoView->clearSelection(); 883 }// videoView->clearSelection();
883 break; 884 break;
884 }; 885 };
885 886
886} 887}
887 888
888void PlayListWidget::deletePlaylist() { 889void PlayListWidget::deletePlaylist() {
889 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 890 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
890 (tr("You really want to delete\nthis playlist?")), 891 (tr("You really want to delete\nthis playlist?")),
891 (tr("Yes")), (tr("No")), 0 )){ 892 (tr("Yes")), (tr("No")), 0 )){
892 case 0: // Yes clicked, 893 case 0: // Yes clicked,
893 QFile().remove(playLists->selectedDocument().file()); 894 QFile().remove(playLists->selectedDocument().file());
894 QFile().remove(playLists->selectedDocument().linkFile()); 895 QFile().remove(playLists->selectedDocument().linkFile());
895 playLists->reread(); 896 playLists->reread();
896 break; 897 break;
897 case 1: // Cancel 898 case 1: // Cancel
898 break; 899 break;
899 }; 900 };
900} 901}
901 902
902void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) 903void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int )
903{ 904{
904 switch (mouse) { 905 switch (mouse) {
905 case 1: 906 case 1:
906 break; 907 break;
907 case 2:{ 908 case 2:{
908 909
909 QPopupMenu m; 910 QPopupMenu m;
910 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 911 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
911 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 912 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
912 m.insertSeparator(); 913 m.insertSeparator();
913 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 914 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
914 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 915 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
915 916
916 m.exec( QCursor::pos() ); 917 m.exec( QCursor::pos() );
917 } 918 }
918 break; 919 break;
919 }; 920 };
920} 921}
921 922
922void PlayListWidget::playSelected() 923void PlayListWidget::playSelected()
923{ 924{
924 qDebug("playSelected"); 925 qDebug("playSelected");
925 btnPlay( true); 926 btnPlay( true);
926// d->selectedFiles->unSelect(); 927// d->selectedFiles->unSelect();
927} 928}
928 929
929void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) 930void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int)
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->currentItem()->text(0); 960 file = audioView->currentItem()->text(0);
960 QListIterator<DocLnk> Pdit( files.children() ); 961 QListIterator<DocLnk> Pdit( files.children() );
961 for ( ; Pdit.current(); ++Pdit ) { 962 for ( ; Pdit.current(); ++Pdit ) {
962 if( Pdit.current()->name() == file) { 963 if( Pdit.current()->name() == file) {
963 LnkProperties prop( Pdit.current() ); 964 LnkProperties prop( Pdit.current() );
964 prop.showMaximized(); 965 prop.showMaximized();
965 prop.exec(); 966 prop.exec();
966 } 967 }
967 } 968 }
968 populateAudioView(); 969 populateAudioView();
969 } 970 }
970 break; 971 break;
971 case 2: 972 case 2:
972 { 973 {
973// file = videoView->selectedItem()->text(0); 974// file = videoView->selectedItem()->text(0);
974// for ( int i = 0; i < noOfFiles; i++ ) { 975// for ( int i = 0; i < noOfFiles; i++ ) {
975// QString entryName; 976// QString entryName;
976// entryName.sprintf( "File%i", i + 1 ); 977// entryName.sprintf( "File%i", i + 1 );
977// QString linkFile = cfg.readEntry( entryName ); 978// QString linkFile = cfg.readEntry( entryName );
978// AppLnk lnk( AppLnk(linkFile)); 979// AppLnk lnk( AppLnk(linkFile));
979// if( lnk.name() == file ) { 980// if( lnk.name() == file ) {
980// LnkProperties prop( &lnk); 981// LnkProperties prop( &lnk);
981// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 982// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
982// prop.showMaximized(); 983// prop.showMaximized();
983// prop.exec(); 984// prop.exec();
984// } 985// }
985// } 986// }
986 } 987 }
987 break; 988 break;
988 }; 989 };
989} 990}
990 991
991void PlayListWidget::scanForAudio() { 992void PlayListWidget::scanForAudio() {
992// qDebug("scan for audio"); 993// qDebug("scan for audio");
993 files.detachChildren(); 994 files.detachChildren();
994 QListIterator<DocLnk> sdit( files.children() ); 995 QListIterator<DocLnk> sdit( files.children() );
995 for ( ; sdit.current(); ++sdit ) { 996 for ( ; sdit.current(); ++sdit ) {
996 delete sdit.current(); 997 delete sdit.current();
997 } 998 }
998 Global::findDocuments( &files, audioMimes); 999 Global::findDocuments( &files, audioMimes);
999 audioScan = true; 1000 audioScan = true;
1000} 1001}
1001void PlayListWidget::scanForVideo() { 1002void PlayListWidget::scanForVideo() {
1002// qDebug("scan for video"); 1003// qDebug("scan for video");
1003 vFiles.detachChildren(); 1004 vFiles.detachChildren();
1004 QListIterator<DocLnk> sdit( vFiles.children() ); 1005 QListIterator<DocLnk> sdit( vFiles.children() );
1005 for ( ; sdit.current(); ++sdit ) { 1006 for ( ; sdit.current(); ++sdit ) {
1006 delete sdit.current(); 1007 delete sdit.current();
1007 } 1008 }
1008 Global::findDocuments(&vFiles, "video/*"); 1009 Global::findDocuments(&vFiles, "video/*");
1009 videoScan = true; 1010 videoScan = true;
1010} 1011}
1011 1012