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 ec5500f..7a79be1 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,420 +1,421 @@
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 35
36#include <qaction.h> 36#include <qaction.h>
37#include <qcursor.h>
37#include <qimage.h> 38#include <qimage.h>
38#include <qfile.h> 39#include <qfile.h>
39#include <qdir.h> 40#include <qdir.h>
40#include <qlayout.h> 41#include <qlayout.h>
41#include <qlabel.h> 42#include <qlabel.h>
42#include <qlist.h> 43#include <qlist.h>
43#include <qlistbox.h> 44#include <qlistbox.h>
44#include <qmainwindow.h> 45#include <qmainwindow.h>
45#include <qmessagebox.h> 46#include <qmessagebox.h>
46#include <qtoolbutton.h> 47#include <qtoolbutton.h>
47#include <qtabwidget.h> 48#include <qtabwidget.h>
48#include <qlistview.h> 49#include <qlistview.h>
49#include <qpoint.h> 50#include <qpoint.h>
50#include <qlineedit.h> 51#include <qlineedit.h>
51#include <qpushbutton.h> 52#include <qpushbutton.h>
52#include <qregexp.h> 53#include <qregexp.h>
53#include <qtextstream.h> 54#include <qtextstream.h>
54 55
55//#include <qtimer.h> 56//#include <qtimer.h>
56 57
57#include "playlistselection.h" 58#include "playlistselection.h"
58#include "playlistwidget.h" 59#include "playlistwidget.h"
59#include "mediaplayerstate.h" 60#include "mediaplayerstate.h"
60 61
61#include "inputDialog.h" 62#include "inputDialog.h"
62 63
63#include <stdlib.h> 64#include <stdlib.h>
64#include "audiowidget.h" 65#include "audiowidget.h"
65#include "videowidget.h" 66#include "videowidget.h"
66 67
67#include <unistd.h> 68#include <unistd.h>
68#include <sys/file.h> 69#include <sys/file.h>
69#include <sys/ioctl.h> 70#include <sys/ioctl.h>
70#include <sys/soundcard.h> 71#include <sys/soundcard.h>
71 72
72// for setBacklight() 73// for setBacklight()
73#include <linux/fb.h> 74#include <linux/fb.h>
74#include <sys/types.h> 75#include <sys/types.h>
75#include <sys/stat.h> 76#include <sys/stat.h>
76#include <stdlib.h> 77#include <stdlib.h>
77 78
78#define BUTTONS_ON_TOOLBAR 79#define BUTTONS_ON_TOOLBAR
79#define SIDE_BUTTONS 80#define SIDE_BUTTONS
80#define CAN_SAVE_LOAD_PLAYLISTS 81#define CAN_SAVE_LOAD_PLAYLISTS
81 82
82extern AudioWidget *audioUI; 83extern AudioWidget *audioUI;
83extern VideoWidget *videoUI; 84extern VideoWidget *videoUI;
84extern MediaPlayerState *mediaPlayerState; 85extern MediaPlayerState *mediaPlayerState;
85 86
86// class myFileSelector { 87// class myFileSelector {
87 88
88// }; 89// };
89class PlayListWidgetPrivate { 90class PlayListWidgetPrivate {
90public: 91public:
91 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 92 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
92 QFrame *playListFrame; 93 QFrame *playListFrame;
93 FileSelector *files; 94 FileSelector *files;
94 PlayListSelection *selectedFiles; 95 PlayListSelection *selectedFiles;
95 bool setDocumentUsed; 96 bool setDocumentUsed;
96 DocLnk *current; 97 DocLnk *current;
97}; 98};
98 99
99 100
100class ToolButton : public QToolButton { 101class ToolButton : public QToolButton {
101public: 102public:
102 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 103 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
103 : QToolButton( parent, name ) { 104 : QToolButton( parent, name ) {
104 setTextLabel( name ); 105 setTextLabel( name );
105 setPixmap( Resource::loadPixmap( icon ) ); 106 setPixmap( Resource::loadPixmap( icon ) );
106 setAutoRaise( TRUE ); 107 setAutoRaise( TRUE );
107 setFocusPolicy( QWidget::NoFocus ); 108 setFocusPolicy( QWidget::NoFocus );
108 setToggleButton( t ); 109 setToggleButton( t );
109 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 110 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
110 QPEMenuToolFocusManager::manager()->addWidget( this ); 111 QPEMenuToolFocusManager::manager()->addWidget( this );
111 } 112 }
112}; 113};
113 114
114 115
115class MenuItem : public QAction { 116class MenuItem : public QAction {
116public: 117public:
117 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 118 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
118 : QAction( text, QString::null, 0, 0 ) { 119 : QAction( text, QString::null, 0, 0 ) {
119 connect( this, SIGNAL( activated() ), handler, slot ); 120 connect( this, SIGNAL( activated() ), handler, slot );
120 addTo( parent ); 121 addTo( parent );
121 } 122 }
122}; 123};
123 124
124 125
125PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 126PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
126 : QMainWindow( parent, name, fl ) { 127 : QMainWindow( parent, name, fl ) {
127 128
128 d = new PlayListWidgetPrivate; 129 d = new PlayListWidgetPrivate;
129 d->setDocumentUsed = FALSE; 130 d->setDocumentUsed = FALSE;
130 d->current = NULL; 131 d->current = NULL;
131 fromSetDocument = FALSE; 132 fromSetDocument = FALSE;
132 insanityBool=FALSE; 133 insanityBool=FALSE;
133// menuTimer = new QTimer( this ,"menu timer"), 134// menuTimer = new QTimer( this ,"menu timer"),
134// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 135// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
135 136
136 setBackgroundMode( PaletteButton ); 137 setBackgroundMode( PaletteButton );
137 138
138 setCaption( tr("OpiePlayer") ); 139 setCaption( tr("OpiePlayer") );
139 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); 140 setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) );
140 141
141 setToolBarsMovable( FALSE ); 142 setToolBarsMovable( FALSE );
142 143
143 // Create Toolbar 144 // Create Toolbar
144 QPEToolBar *toolbar = new QPEToolBar( this ); 145 QPEToolBar *toolbar = new QPEToolBar( this );
145 toolbar->setHorizontalStretchable( TRUE ); 146 toolbar->setHorizontalStretchable( TRUE );
146 147
147 // Create Menubar 148 // Create Menubar
148 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 149 QPEMenuBar *menu = new QPEMenuBar( toolbar );
149 menu->setMargin( 0 ); 150 menu->setMargin( 0 );
150 151
151 QPEToolBar *bar = new QPEToolBar( this ); 152 QPEToolBar *bar = new QPEToolBar( this );
152 bar->setLabel( tr( "Play Operations" ) ); 153 bar->setLabel( tr( "Play Operations" ) );
153// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", 154// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list",
154// this , SLOT( addSelected()) ); 155// this , SLOT( addSelected()) );
155 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 156 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
156 tbDeletePlaylist->setFlat(TRUE); 157 tbDeletePlaylist->setFlat(TRUE);
157 tbDeletePlaylist->setFixedSize(20,20); 158 tbDeletePlaylist->setFixedSize(20,20);
158 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 159 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
159 160
160 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",
161 this , SLOT(addSelected()) ); 162 this , SLOT(addSelected()) );
162 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",
163 this , SLOT(removeSelected()) ); 164 this , SLOT(removeSelected()) );
164// 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 );
165 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", 166 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play",
166 this , SLOT( btnPlay(bool) ), TRUE ); 167 this , SLOT( btnPlay(bool) ), TRUE );
167 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", 168 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle",
168 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 169 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
169 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", 170 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop",
170 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 171 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
171 tbDeletePlaylist->hide(); 172 tbDeletePlaylist->hide();
172 173
173 QPopupMenu *pmPlayList = new QPopupMenu( this ); 174 QPopupMenu *pmPlayList = new QPopupMenu( this );
174 menu->insertItem( tr( "File" ), pmPlayList ); 175 menu->insertItem( tr( "File" ), pmPlayList );
175 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 176 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
176 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 177 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
177 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 178 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
178 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 179 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
179// pmPlayList->insertSeparator(-1); 180// pmPlayList->insertSeparator(-1);
180 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 181 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
181 pmPlayList->insertSeparator(-1); 182 pmPlayList->insertSeparator(-1);
182 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 183 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
183 184
184 QPopupMenu *pmView = new QPopupMenu( this ); 185 QPopupMenu *pmView = new QPopupMenu( this );
185 menu->insertItem( tr( "View" ), pmView ); 186 menu->insertItem( tr( "View" ), pmView );
186 187
187 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 188 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
188 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 189 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
189 fullScreenButton->addTo(pmView); 190 fullScreenButton->addTo(pmView);
190 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 191 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
191 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 192 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
192 scaleButton->addTo(pmView); 193 scaleButton->addTo(pmView);
193 194
194 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 195 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
195 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 196 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
196 197
197 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 198 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
198 199
199 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 200 tabWidget = new QTabWidget( hbox6, "tabWidget" );
200 tabWidget->setTabShape(QTabWidget::Triangular); 201 tabWidget->setTabShape(QTabWidget::Triangular);
201 202
202 QWidget *pTab; 203 QWidget *pTab;
203 pTab = new QWidget( tabWidget, "pTab" ); 204 pTab = new QWidget( tabWidget, "pTab" );
204// playlistView = new QListView( pTab, "playlistview" ); 205// playlistView = new QListView( pTab, "playlistview" );
205// playlistView->setMinimumSize(236,260); 206// playlistView->setMinimumSize(236,260);
206 tabWidget->insertTab( pTab,"Playlist"); 207 tabWidget->insertTab( pTab,"Playlist");
207 208
208 209
209 // Add the playlist area 210 // Add the playlist area
210 211
211 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 212 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
212 d->playListFrame = vbox3; 213 d->playListFrame = vbox3;
213 d->playListFrame ->setMinimumSize(235,260); 214 d->playListFrame ->setMinimumSize(235,260);
214 215
215 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 216 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
216 217
217 d->selectedFiles = new PlayListSelection( hbox2); 218 d->selectedFiles = new PlayListSelection( hbox2);
218 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 219 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
219 220
220 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 221 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
221 222
222 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 223 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
223 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 224 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
224 225
225 226
226 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 227 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
227 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 228 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
228 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 229 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
229 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 230 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
230 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 231 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
231 232
232 QWidget *aTab; 233 QWidget *aTab;
233 aTab = new QWidget( tabWidget, "aTab" ); 234 aTab = new QWidget( tabWidget, "aTab" );
234 audioView = new QListView( aTab, "Audioview" ); 235 audioView = new QListView( aTab, "Audioview" );
235 audioView->setMinimumSize(233,260); 236 audioView->setMinimumSize(233,260);
236 audioView->addColumn( tr("Title"),140); 237 audioView->addColumn( tr("Title"),140);
237 audioView->addColumn(tr("Size"), -1); 238 audioView->addColumn(tr("Size"), -1);
238 audioView->addColumn(tr("Media"),-1); 239 audioView->addColumn(tr("Media"),-1);
239 audioView->setColumnAlignment(1, Qt::AlignRight); 240 audioView->setColumnAlignment(1, Qt::AlignRight);
240 audioView->setColumnAlignment(2, Qt::AlignRight); 241 audioView->setColumnAlignment(2, Qt::AlignRight);
241 audioView->setAllColumnsShowFocus(TRUE); 242 audioView->setAllColumnsShowFocus(TRUE);
242 243
243 audioView->setMultiSelection( TRUE ); 244 audioView->setMultiSelection( TRUE );
244 audioView->setSelectionMode( QListView::Extended); 245 audioView->setSelectionMode( QListView::Extended);
245 246
246 tabWidget->insertTab(aTab,tr("Audio")); 247 tabWidget->insertTab(aTab,tr("Audio"));
247 248
248 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 249 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
249 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 250 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
250 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 251 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
251 252
252 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 253 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
253 this,SLOT( playIt( QListViewItem *)) ); 254 this,SLOT( playIt( QListViewItem *)) );
254 255
255// audioView 256// audioView
256 populateAudioView(); 257 populateAudioView();
257// videowidget 258// videowidget
258 259
259 QWidget *vTab; 260 QWidget *vTab;
260 vTab = new QWidget( tabWidget, "vTab" ); 261 vTab = new QWidget( tabWidget, "vTab" );
261 videoView = new QListView( vTab, "Videoview" ); 262 videoView = new QListView( vTab, "Videoview" );
262 videoView->setMinimumSize(233,260); 263 videoView->setMinimumSize(233,260);
263 264
264 videoView->addColumn(tr("Title"),140); 265 videoView->addColumn(tr("Title"),140);
265 videoView->addColumn(tr("Size"),-1); 266 videoView->addColumn(tr("Size"),-1);
266 videoView->addColumn(tr("Media"),-1); 267 videoView->addColumn(tr("Media"),-1);
267 videoView->setColumnAlignment(1, Qt::AlignRight); 268 videoView->setColumnAlignment(1, Qt::AlignRight);
268 videoView->setColumnAlignment(2, Qt::AlignRight); 269 videoView->setColumnAlignment(2, Qt::AlignRight);
269 videoView->setAllColumnsShowFocus(TRUE); 270 videoView->setAllColumnsShowFocus(TRUE);
270 videoView->setMultiSelection( TRUE ); 271 videoView->setMultiSelection( TRUE );
271 videoView->setSelectionMode( QListView::Extended); 272 videoView->setSelectionMode( QListView::Extended);
272 273
273 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 274 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
274 275
275 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 276 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
276 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 277 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
277 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 278 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
278 this,SLOT( playIt( QListViewItem *)) ); 279 this,SLOT( playIt( QListViewItem *)) );
279 280
280 tabWidget->insertTab( vTab,tr("Video")); 281 tabWidget->insertTab( vTab,tr("Video"));
281populateVideoView(); 282populateVideoView();
282 283
283//playlists list 284//playlists list
284 QWidget *LTab; 285 QWidget *LTab;
285 LTab = new QWidget( tabWidget, "LTab" ); 286 LTab = new QWidget( tabWidget, "LTab" );
286 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 287 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
287 playLists->setMinimumSize(233,260);; 288 playLists->setMinimumSize(233,260);;
288 tabWidget->insertTab(LTab,tr("Lists")); 289 tabWidget->insertTab(LTab,tr("Lists"));
289 290
290 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
291// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 292// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
292 293
293 294
294// add the library area 295// add the library area
295 296
296// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 297// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
297// this, SLOT( fauxPlay( QListViewItem *) ) ); 298// this, SLOT( fauxPlay( QListViewItem *) ) );
298// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 299// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
299// this, SLOT( fauxPlay( QListViewItem *)) ); 300// this, SLOT( fauxPlay( QListViewItem *)) );
300 301
301// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 302// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
302// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 303// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
303 304
304 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 305 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
305 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 306 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
306 307
307 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 308 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
308 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 309 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
309 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 310 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
310 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 311 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
311 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 312 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
312 313
313 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 314 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
314// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 315// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
315 316
316 setCentralWidget( vbox5 ); 317 setCentralWidget( vbox5 );
317 318
318 Config cfg( "OpiePlayer" ); 319 Config cfg( "OpiePlayer" );
319 readConfig( cfg ); 320 readConfig( cfg );
320 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 321 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
321// qDebug("currentList is "+currentPlaylist); 322// qDebug("currentList is "+currentPlaylist);
322 loadList(DocLnk( currentPlaylist)); 323 loadList(DocLnk( currentPlaylist));
323 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 324 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
324 325
325 initializeStates(); 326 initializeStates();
326} 327}
327 328
328 329
329PlayListWidget::~PlayListWidget() { 330PlayListWidget::~PlayListWidget() {
330 Config cfg( "OpiePlayer" ); 331 Config cfg( "OpiePlayer" );
331 writeConfig( cfg ); 332 writeConfig( cfg );
332 333
333 334
334 if ( d->current ) 335 if ( d->current )
335 delete d->current; 336 delete d->current;
336 delete d; 337 delete d;
337} 338}
338 339
339 340
340void PlayListWidget::initializeStates() { 341void PlayListWidget::initializeStates() {
341 342
342 d->tbPlay->setOn( mediaPlayerState->playing() ); 343 d->tbPlay->setOn( mediaPlayerState->playing() );
343 d->tbLoop->setOn( mediaPlayerState->looping() ); 344 d->tbLoop->setOn( mediaPlayerState->looping() );
344 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 345 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
345// d->tbFull->setOn( mediaPlayerState->fullscreen() ); 346// d->tbFull->setOn( mediaPlayerState->fullscreen() );
346// d->tbScale->setOn( mediaPlayerState->scaled() ); 347// d->tbScale->setOn( mediaPlayerState->scaled() );
347// d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); 348// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
348// setPlaylist( mediaPlayerState->playlist() ); 349// setPlaylist( mediaPlayerState->playlist() );
349 setPlaylist( true); 350 setPlaylist( true);
350// d->selectedFiles->first(); 351// d->selectedFiles->first();
351 352
352} 353}
353 354
354 355
355void PlayListWidget::readConfig( Config& cfg ) { 356void PlayListWidget::readConfig( Config& cfg ) {
356 cfg.setGroup("PlayList"); 357 cfg.setGroup("PlayList");
357 QString currentString = cfg.readEntry("current", "" ); 358 QString currentString = cfg.readEntry("current", "" );
358 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 359 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
359 for ( int i = 0; i < noOfFiles; i++ ) { 360 for ( int i = 0; i < noOfFiles; i++ ) {
360 QString entryName; 361 QString entryName;
361 entryName.sprintf( "File%i", i + 1 ); 362 entryName.sprintf( "File%i", i + 1 );
362 QString linkFile = cfg.readEntry( entryName ); 363 QString linkFile = cfg.readEntry( entryName );
363 DocLnk lnk( linkFile ); 364 DocLnk lnk( linkFile );
364 if ( lnk.isValid() ) { 365 if ( lnk.isValid() ) {
365 d->selectedFiles->addToSelection( lnk ); 366 d->selectedFiles->addToSelection( lnk );
366 } 367 }
367 } 368 }
368 d->selectedFiles->setSelectedItem( currentString); 369 d->selectedFiles->setSelectedItem( currentString);
369// d->selectedFiles->setSelectedItem( (const QString &)currentString); 370// d->selectedFiles->setSelectedItem( (const QString &)currentString);
370} 371}
371 372
372 373
373void PlayListWidget::writeConfig( Config& cfg ) const { 374void PlayListWidget::writeConfig( Config& cfg ) const {
374 375
375 d->selectedFiles->writeCurrent( cfg); 376 d->selectedFiles->writeCurrent( cfg);
376 cfg.setGroup("PlayList"); 377 cfg.setGroup("PlayList");
377 int noOfFiles = 0; 378 int noOfFiles = 0;
378 d->selectedFiles->first(); 379 d->selectedFiles->first();
379 do { 380 do {
380 const DocLnk *lnk = d->selectedFiles->current(); 381 const DocLnk *lnk = d->selectedFiles->current();
381 if ( lnk ) { 382 if ( lnk ) {
382 QString entryName; 383 QString entryName;
383 entryName.sprintf( "File%i", noOfFiles + 1 ); 384 entryName.sprintf( "File%i", noOfFiles + 1 );
384// qDebug(entryName); 385// qDebug(entryName);
385 cfg.writeEntry( entryName, lnk->linkFile() ); 386 cfg.writeEntry( entryName, lnk->linkFile() );
386 // if this link does exist, add it so we have the file 387 // if this link does exist, add it so we have the file
387 // next time... 388 // next time...
388 if ( !QFile::exists( lnk->linkFile() ) ) { 389 if ( !QFile::exists( lnk->linkFile() ) ) {
389 // the way writing lnks doesn't really check for out 390 // the way writing lnks doesn't really check for out
390 // of disk space, but check it anyway. 391 // of disk space, but check it anyway.
391 if ( !lnk->writeLink() ) { 392 if ( !lnk->writeLink() ) {
392 QMessageBox::critical( 0, tr("Out of space"), 393 QMessageBox::critical( 0, tr("Out of space"),
393 tr( "There was a problem saving " 394 tr( "There was a problem saving "
394 "the playlist.\n" 395 "the playlist.\n"
395 "Your playlist " 396 "Your playlist "
396 "may be missing some entries\n" 397 "may be missing some entries\n"
397 "the next time you start it." ) 398 "the next time you start it." )
398 ); 399 );
399 } 400 }
400 } 401 }
401 noOfFiles++; 402 noOfFiles++;
402 } 403 }
403 } 404 }
404 while ( d->selectedFiles->next() ); 405 while ( d->selectedFiles->next() );
405 cfg.writeEntry("NumberOfFiles", noOfFiles ); 406 cfg.writeEntry("NumberOfFiles", noOfFiles );
406} 407}
407 408
408 409
409void PlayListWidget::addToSelection( const DocLnk& lnk ) { 410void PlayListWidget::addToSelection( const DocLnk& lnk ) {
410// qDebug("add"); 411// qDebug("add");
411 d->setDocumentUsed = FALSE; 412 d->setDocumentUsed = FALSE;
412 if ( mediaPlayerState->playlist() ) 413 if ( mediaPlayerState->playlist() )
413 d->selectedFiles->addToSelection( lnk ); 414 d->selectedFiles->addToSelection( lnk );
414 else 415 else
415 mediaPlayerState->setPlaying( TRUE ); 416 mediaPlayerState->setPlaying( TRUE );
416} 417}
417 418
418 419
419void PlayListWidget::clearList() { 420void PlayListWidget::clearList() {
420 while ( first() ) 421 while ( first() )