summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp172
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h36
2 files changed, 131 insertions, 77 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index db6533a..3b8f6d7 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1,891 +1,941 @@
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
22
21#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
23#include <qpe/fileselector.h> 25#include <qpe/fileselector.h>
24#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/lnkproperties.h>
25 28
26#include <qpe/applnk.h> 29#include <qpe/applnk.h>
27#include <qpe/config.h> 30#include <qpe/config.h>
28#include <qpe/global.h> 31#include <qpe/global.h>
29#include <qpe/resource.h> 32#include <qpe/resource.h>
30#include <qaction.h> 33#include <qaction.h>
31#include <qimage.h> 34#include <qimage.h>
32#include <qfile.h> 35#include <qfile.h>
33#include <qdir.h> 36#include <qdir.h>
34#include <qlayout.h> 37#include <qlayout.h>
35#include <qlabel.h> 38#include <qlabel.h>
36#include <qlist.h> 39#include <qlist.h>
37#include <qlistbox.h> 40#include <qlistbox.h>
38#include <qmainwindow.h> 41#include <qmainwindow.h>
39#include <qmessagebox.h> 42#include <qmessagebox.h>
40#include <qtoolbutton.h> 43#include <qtoolbutton.h>
41#include <qtabwidget.h> 44#include <qtabwidget.h>
42#include <qlistview.h> 45#include <qlistview.h>
43#include <qpoint.h> 46#include <qpoint.h>
44#include <qlineedit.h> 47#include <qlineedit.h>
45#include <qpushbutton.h> 48#include <qpushbutton.h>
46 49
47//#include <qtimer.h> 50//#include <qtimer.h>
48 51
49#include "playlistselection.h" 52#include "playlistselection.h"
50#include "playlistwidget.h" 53#include "playlistwidget.h"
51#include "mediaplayerstate.h" 54#include "mediaplayerstate.h"
52 55
53#include "inputDialog.h" 56#include "inputDialog.h"
54 57
55#include <stdlib.h> 58#include <stdlib.h>
56 59
57#define BUTTONS_ON_TOOLBAR 60#define BUTTONS_ON_TOOLBAR
58#define SIDE_BUTTONS 61#define SIDE_BUTTONS
59#define CAN_SAVE_LOAD_PLAYLISTS 62#define CAN_SAVE_LOAD_PLAYLISTS
60 63
61extern MediaPlayerState *mediaPlayerState; 64extern MediaPlayerState *mediaPlayerState;
62 65
63// class myFileSelector { 66// class myFileSelector {
64 67
65// }; 68// };
66class PlayListWidgetPrivate { 69class PlayListWidgetPrivate {
67public: 70public:
68 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 71 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
69 QFrame *playListFrame; 72 QFrame *playListFrame;
70 FileSelector *files; 73 FileSelector *files;
71 PlayListSelection *selectedFiles; 74 PlayListSelection *selectedFiles;
72 bool setDocumentUsed; 75 bool setDocumentUsed;
73 DocLnk *current; 76 DocLnk *current;
74}; 77};
75 78
76 79
77class ToolButton : public QToolButton { 80class ToolButton : public QToolButton {
78public: 81public:
79 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 82 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
80 : QToolButton( parent, name ) { 83 : QToolButton( parent, name ) {
81 setTextLabel( name ); 84 setTextLabel( name );
82 setPixmap( Resource::loadPixmap( icon ) ); 85 setPixmap( Resource::loadPixmap( icon ) );
83 setAutoRaise( TRUE ); 86 setAutoRaise( TRUE );
84 setFocusPolicy( QWidget::NoFocus ); 87 setFocusPolicy( QWidget::NoFocus );
85 setToggleButton( t ); 88 setToggleButton( t );
86 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 89 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
87 QPEMenuToolFocusManager::manager()->addWidget( this ); 90 QPEMenuToolFocusManager::manager()->addWidget( this );
88 } 91 }
89}; 92};
90 93
91 94
92class MenuItem : public QAction { 95class MenuItem : public QAction {
93public: 96public:
94 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 97 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
95 : QAction( text, QString::null, 0, 0 ) { 98 : QAction( text, QString::null, 0, 0 ) {
96 connect( this, SIGNAL( activated() ), handler, slot ); 99 connect( this, SIGNAL( activated() ), handler, slot );
97 addTo( parent ); 100 addTo( parent );
98 } 101 }
99}; 102};
100 103
101 104
102PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 105PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
103 : QMainWindow( parent, name, fl ) { 106 : QMainWindow( parent, name, fl ) {
104 107
105 d = new PlayListWidgetPrivate; 108 d = new PlayListWidgetPrivate;
106 d->setDocumentUsed = FALSE; 109 d->setDocumentUsed = FALSE;
107 d->current = NULL; 110 d->current = NULL;
108 fromSetDocument = FALSE; 111 fromSetDocument = FALSE;
109 insanityBool=FALSE; 112 insanityBool=FALSE;
110// menuTimer = new QTimer( this ,"menu timer"), 113// menuTimer = new QTimer( this ,"menu timer"),
111// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 114// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
112 115
113 setBackgroundMode( PaletteButton ); 116 setBackgroundMode( PaletteButton );
114 117
115 setCaption( tr("OpiePlayer") ); 118 setCaption( tr("OpiePlayer") );
116 setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); 119 setIcon( Resource::loadPixmap( "MPEGPlayer" ) );
117 120
118 setToolBarsMovable( FALSE ); 121 setToolBarsMovable( FALSE );
119 122
120 // Create Toolbar 123 // Create Toolbar
121 QPEToolBar *toolbar = new QPEToolBar( this ); 124 QPEToolBar *toolbar = new QPEToolBar( this );
122 toolbar->setHorizontalStretchable( TRUE ); 125 toolbar->setHorizontalStretchable( TRUE );
123 126
124 // Create Menubar 127 // Create Menubar
125 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 128 QPEMenuBar *menu = new QPEMenuBar( toolbar );
126 menu->setMargin( 0 ); 129 menu->setMargin( 0 );
127 130
128 QPEToolBar *bar = new QPEToolBar( this ); 131 QPEToolBar *bar = new QPEToolBar( this );
129 bar->setLabel( tr( "Play Operations" ) ); 132 bar->setLabel( tr( "Play Operations" ) );
130// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", 133// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list",
131// this , SLOT( addSelected()) ); 134// this , SLOT( addSelected()) );
132 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 135 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
133 tbDeletePlaylist->setFlat(TRUE); 136 tbDeletePlaylist->setFlat(TRUE);
134 tbDeletePlaylist->setFixedSize(20,20); 137 tbDeletePlaylist->setFixedSize(20,20);
135 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 138 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
136 139
137 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", 140 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist",
138 this , SLOT(addSelected()) ); 141 this , SLOT(addSelected()) );
139 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", 142 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist",
140 this , SLOT(removeSelected()) ); 143 this , SLOT(removeSelected()) );
141// d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); 144// d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE );
142 d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", 145 d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play",
143 this , SLOT( btnPlay(bool) ), TRUE ); 146 this , SLOT( btnPlay(bool) ), TRUE );
144 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", 147 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle",
145 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 148 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
146 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", 149 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop",
147 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 150 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
148 tbDeletePlaylist->hide(); 151 tbDeletePlaylist->hide();
149 152
150 QPopupMenu *pmPlayList = new QPopupMenu( this ); 153 QPopupMenu *pmPlayList = new QPopupMenu( this );
151 menu->insertItem( tr( "File" ), pmPlayList ); 154 menu->insertItem( tr( "File" ), pmPlayList );
152 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 155 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
153 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 156 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
154 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 157 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
155 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 158 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
156 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 159 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
157 // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); 160 // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
158 161
159 QPopupMenu *pmView = new QPopupMenu( this ); 162 QPopupMenu *pmView = new QPopupMenu( this );
160 menu->insertItem( tr( "View" ), pmView ); 163 menu->insertItem( tr( "View" ), pmView );
161 164
162 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 165 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
163 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 166 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
164 fullScreenButton->addTo(pmView); 167 fullScreenButton->addTo(pmView);
165 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); 168 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0);
166 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 169 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
167 scaleButton->addTo(pmView); 170 scaleButton->addTo(pmView);
168 171
169 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 172 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
170 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 173 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
171 174
172 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 175 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
173 176
174 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 177 tabWidget = new QTabWidget( hbox6, "tabWidget" );
175 tabWidget->setTabShape(QTabWidget::Triangular); 178 tabWidget->setTabShape(QTabWidget::Triangular);
176 179
177 QWidget *pTab; 180 QWidget *pTab;
178 pTab = new QWidget( tabWidget, "pTab" ); 181 pTab = new QWidget( tabWidget, "pTab" );
179// playlistView = new QListView( pTab, "playlistview" ); 182// playlistView = new QListView( pTab, "playlistview" );
180// playlistView->setMinimumSize(236,260); 183// playlistView->setMinimumSize(236,260);
181 tabWidget->insertTab( pTab,"Playlist"); 184 tabWidget->insertTab( pTab,"Playlist");
182 185
183 186
184 // Add the playlist area 187 // Add the playlist area
185 188
186 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 189 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
187 d->playListFrame = vbox3; 190 d->playListFrame = vbox3;
188 d->playListFrame ->setMinimumSize(235,260); 191 d->playListFrame ->setMinimumSize(235,260);
189 192
190 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 193 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
191 194
192 d->selectedFiles = new PlayListSelection( hbox2); 195 d->selectedFiles = new PlayListSelection( hbox2);
193 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 196 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
194 197
195 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 198 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
196 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 199 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
197 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 200 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
198 201
199 202
200 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 203 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
201 new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 204 new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
202 new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 205 new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
203 new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 206 new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
204 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 207 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
205 208
206 QWidget *aTab; 209 QWidget *aTab;
207 aTab = new QWidget( tabWidget, "aTab" ); 210 aTab = new QWidget( tabWidget, "aTab" );
208 audioView = new QListView( aTab, "Audioview" ); 211 audioView = new QListView( aTab, "Audioview" );
209 audioView->setMinimumSize(233,260); 212 audioView->setMinimumSize(233,260);
210 audioView->addColumn( "Title",140); 213 audioView->addColumn( tr("Title"),140);
211 audioView->addColumn("Size", -1); 214 audioView->addColumn(tr("Size"), -1);
212 audioView->addColumn("Media",-1); 215 audioView->addColumn(tr("Media"),-1);
213 audioView->setColumnAlignment(1, Qt::AlignRight); 216 audioView->setColumnAlignment(1, Qt::AlignRight);
214 audioView->setColumnAlignment(2, Qt::AlignRight); 217 audioView->setColumnAlignment(2, Qt::AlignRight);
215 audioView->setAllColumnsShowFocus(TRUE); 218 audioView->setAllColumnsShowFocus(TRUE);
216 tabWidget->insertTab(aTab,"Audio"); 219 tabWidget->insertTab(aTab,tr("Audio"));
217 220
218 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 221 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
219 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 222 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
220 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 223 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
221 224
222 225
223// audioView 226// audioView
224 Global::findDocuments(&files, "audio/*"); 227 populateAudioView();
225 QListIterator<DocLnk> dit( files.children() );
226 QString storage;
227 for ( ; dit.current(); ++dit ) {
228 QListViewItem * newItem;
229 if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
230 else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
231 else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD";
232 else storage="RAM";
233 if ( QFile( dit.current()->file()).exists() ) {
234 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage);
235 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" ));
236 }
237 }
238// videowidget 228// videowidget
239 229
240 QWidget *vTab; 230 QWidget *vTab;
241 vTab = new QWidget( tabWidget, "vTab" ); 231 vTab = new QWidget( tabWidget, "vTab" );
242 videoView = new QListView( vTab, "Videoview" ); 232 videoView = new QListView( vTab, "Videoview" );
243 videoView->setMinimumSize(233,260); 233 videoView->setMinimumSize(233,260);
244 234
245 videoView->addColumn("Title",140); 235 videoView->addColumn(tr("Title"),140);
246 videoView->addColumn("Size",-1); 236 videoView->addColumn(tr("Size"),-1);
247 videoView->addColumn("Media",-1); 237 videoView->addColumn(tr("Media"),-1);
248 videoView->setColumnAlignment(1, Qt::AlignRight); 238 videoView->setColumnAlignment(1, Qt::AlignRight);
249 videoView->setColumnAlignment(2, Qt::AlignRight); 239 videoView->setColumnAlignment(2, Qt::AlignRight);
250 videoView->setAllColumnsShowFocus(TRUE); 240 videoView->setAllColumnsShowFocus(TRUE);
251 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 241 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
252 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 242 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
253 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 243 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
254 244
255 tabWidget->insertTab( vTab,"Video"); 245 tabWidget->insertTab( vTab,tr("Video"));
256 246
257 Global::findDocuments(&vFiles, "video/*");
258 QListIterator<DocLnk> Vdit( vFiles.children() );
259 for ( ; Vdit.current(); ++Vdit ) {
260 if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF";
261 else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF";
262 else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD";
263 else storage="RAM";
264 QListViewItem * newItem;
265 if ( QFile( Vdit.current()->file()).exists() ) {
266 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
267 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
268 }
269 }
270 247
271//playlists list 248//playlists list
272 QWidget *LTab; 249 QWidget *LTab;
273 LTab = new QWidget( tabWidget, "LTab" ); 250 LTab = new QWidget( tabWidget, "LTab" );
274 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 251 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
275 playLists->setMinimumSize(233,260);; 252 playLists->setMinimumSize(233,260);;
276 tabWidget->insertTab(LTab,"Lists"); 253 tabWidget->insertTab(LTab,tr("Lists"));
277 254
278 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 255 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
279// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 256// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
280 257
281 258
282// add the library area 259// add the library area
283 260
284// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 261// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
285// this, SLOT( fauxPlay( QListViewItem *) ) ); 262// this, SLOT( fauxPlay( QListViewItem *) ) );
286// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), 263// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
287// this, SLOT( fauxPlay( QListViewItem *)) ); 264// this, SLOT( fauxPlay( QListViewItem *)) );
288 265
289// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 266// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
290// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 267// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
291 268
292 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 269 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
293 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 270 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
294 271
295 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 272 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
296 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 273 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
297 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 274 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
298 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 275 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
299 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 276 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
300 277
301 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 278 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
302// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); 279// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
303 280
304 setCentralWidget( vbox5 ); 281 setCentralWidget( vbox5 );
305 282
306 Config cfg( "MediaPlayer" ); 283 Config cfg( "MediaPlayer" );
307 readConfig( cfg ); 284 readConfig( cfg );
308 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 285 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
309// qDebug("currentList is "+currentPlaylist); 286// qDebug("currentList is "+currentPlaylist);
310 loadList(DocLnk( currentPlaylist)); 287 loadList(DocLnk( currentPlaylist));
311 setCaption("OpiePlayer: "+ currentPlaylist ); 288 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
312 289
313 initializeStates(); 290 initializeStates();
314} 291}
315 292
316 293
317PlayListWidget::~PlayListWidget() { 294PlayListWidget::~PlayListWidget() {
318 Config cfg( "MediaPlayer" ); 295 Config cfg( "MediaPlayer" );
319 writeConfig( cfg ); 296 writeConfig( cfg );
320 297
321 298
322 if ( d->current ) 299 if ( d->current )
323 delete d->current; 300 delete d->current;
324 delete d; 301 delete d;
325} 302}
326 303
327 304
328void PlayListWidget::initializeStates() { 305void PlayListWidget::initializeStates() {
329 306
330 d->tbPlay->setOn( mediaPlayerState->playing() ); 307 d->tbPlay->setOn( mediaPlayerState->playing() );
331 d->tbLoop->setOn( mediaPlayerState->looping() ); 308 d->tbLoop->setOn( mediaPlayerState->looping() );
332 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 309 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
333// d->tbFull->setOn( mediaPlayerState->fullscreen() ); 310// d->tbFull->setOn( mediaPlayerState->fullscreen() );
334// d->tbScale->setOn( mediaPlayerState->scaled() ); 311// d->tbScale->setOn( mediaPlayerState->scaled() );
335// d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); 312// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
336// setPlaylist( mediaPlayerState->playlist() ); 313// setPlaylist( mediaPlayerState->playlist() );
337 setPlaylist( true); 314 setPlaylist( true);
338 d->selectedFiles->first(); 315 d->selectedFiles->first();
339} 316}
340 317
341 318
342void PlayListWidget::readConfig( Config& cfg ) { 319void PlayListWidget::readConfig( Config& cfg ) {
343 cfg.setGroup("PlayList"); 320 cfg.setGroup("PlayList");
344 321
345 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 322 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
346 323
347 for ( int i = 0; i < noOfFiles; i++ ) { 324 for ( int i = 0; i < noOfFiles; i++ ) {
348 QString entryName; 325 QString entryName;
349 entryName.sprintf( "File%i", i + 1 ); 326 entryName.sprintf( "File%i", i + 1 );
350 QString linkFile = cfg.readEntry( entryName ); 327 QString linkFile = cfg.readEntry( entryName );
351 DocLnk lnk( linkFile ); 328 DocLnk lnk( linkFile );
352 if ( lnk.isValid() ) 329 if ( lnk.isValid() )
353 d->selectedFiles->addToSelection( lnk ); 330 d->selectedFiles->addToSelection( lnk );
354 } 331 }
355} 332}
356 333
357 334
358void PlayListWidget::writeConfig( Config& cfg ) const { 335void PlayListWidget::writeConfig( Config& cfg ) const {
359 cfg.setGroup("PlayList"); 336 cfg.setGroup("PlayList");
360 337
361 int noOfFiles = 0; 338 int noOfFiles = 0;
362 339
363 d->selectedFiles->first(); 340 d->selectedFiles->first();
364 do { 341 do {
365 const DocLnk *lnk = d->selectedFiles->current(); 342 const DocLnk *lnk = d->selectedFiles->current();
366 if ( lnk ) { 343 if ( lnk ) {
367 QString entryName; 344 QString entryName;
368 entryName.sprintf( "File%i", noOfFiles + 1 ); 345 entryName.sprintf( "File%i", noOfFiles + 1 );
369 cfg.writeEntry( entryName, lnk->linkFile() ); 346 cfg.writeEntry( entryName, lnk->linkFile() );
370 // if this link does exist, add it so we have the file 347 // if this link does exist, add it so we have the file
371 // next time... 348 // next time...
372 if ( !QFile::exists( lnk->linkFile() ) ) { 349 if ( !QFile::exists( lnk->linkFile() ) ) {
373 // the way writing lnks doesn't really check for out 350 // the way writing lnks doesn't really check for out
374 // of disk space, but check it anyway. 351 // of disk space, but check it anyway.
375 if ( !lnk->writeLink() ) { 352 if ( !lnk->writeLink() ) {
376 QMessageBox::critical( 0, tr("Out of space"), 353 QMessageBox::critical( 0, tr("Out of space"),
377 tr( "There was a problem saving " 354 tr( "There was a problem saving "
378 "the playlist.\n" 355 "the playlist.\n"
379 "Your playlist " 356 "Your playlist "
380 "may be missing some entries\n" 357 "may be missing some entries\n"
381 "the next time you start it." ) 358 "the next time you start it." )
382 ); 359 );
383 } 360 }
384 } 361 }
385 noOfFiles++; 362 noOfFiles++;
386 } 363 }
387 } while ( d->selectedFiles->next() ); 364 } while ( d->selectedFiles->next() );
388 365
389 cfg.writeEntry("NumberOfFiles", noOfFiles ); 366 cfg.writeEntry("NumberOfFiles", noOfFiles );
390 367
391 368
392} 369}
393 370
394 371
395void PlayListWidget::addToSelection( const DocLnk& lnk ) { 372void PlayListWidget::addToSelection( const DocLnk& lnk ) {
396// qDebug("add"); 373// qDebug("add");
397 d->setDocumentUsed = FALSE; 374 d->setDocumentUsed = FALSE;
398 if ( mediaPlayerState->playlist() ) 375 if ( mediaPlayerState->playlist() )
399 d->selectedFiles->addToSelection( lnk ); 376 d->selectedFiles->addToSelection( lnk );
400 else 377 else
401 mediaPlayerState->setPlaying( TRUE ); 378 mediaPlayerState->setPlaying( TRUE );
402} 379}
403 380
404 381
405void PlayListWidget::clearList() { 382void PlayListWidget::clearList() {
406 while ( first() ) 383 while ( first() )
407 d->selectedFiles->removeSelected(); 384 d->selectedFiles->removeSelected();
408} 385}
409 386
410 387
411void PlayListWidget::addAllToList() { 388void PlayListWidget::addAllToList() {
412 DocLnkSet files; 389 DocLnkSet files;
413 Global::findDocuments(&files, "video/*;audio/*"); 390 Global::findDocuments(&files, "video/*;audio/*");
414 QListIterator<DocLnk> dit( files.children() ); 391 QListIterator<DocLnk> dit( files.children() );
415 for ( ; dit.current(); ++dit ) 392 for ( ; dit.current(); ++dit )
416 d->selectedFiles->addToSelection( **dit ); 393 d->selectedFiles->addToSelection( **dit );
417} 394}
418 395
419 396
420void PlayListWidget::addAllMusicToList() { 397void PlayListWidget::addAllMusicToList() {
421 DocLnkSet files; 398 DocLnkSet files;
422 Global::findDocuments(&files, "audio/*"); 399 Global::findDocuments(&files, "audio/*");
423 QListIterator<DocLnk> dit( files.children() ); 400 QListIterator<DocLnk> dit( files.children() );
424 for ( ; dit.current(); ++dit ) 401 for ( ; dit.current(); ++dit )
425 d->selectedFiles->addToSelection( **dit ); 402 d->selectedFiles->addToSelection( **dit );
426} 403}
427 404
428 405
429void PlayListWidget::addAllVideoToList() { 406void PlayListWidget::addAllVideoToList() {
430 DocLnkSet files; 407 DocLnkSet files;
431 Global::findDocuments(&files, "video/*"); 408 Global::findDocuments(&files, "video/*");
432 QListIterator<DocLnk> dit( files.children() ); 409 QListIterator<DocLnk> dit( files.children() );
433 for ( ; dit.current(); ++dit ) 410 for ( ; dit.current(); ++dit )
434 d->selectedFiles->addToSelection( **dit ); 411 d->selectedFiles->addToSelection( **dit );
435} 412}
436 413
437 414
438void PlayListWidget::setDocument(const QString& fileref) { 415void PlayListWidget::setDocument(const QString& fileref) {
439 fromSetDocument = TRUE; 416 fromSetDocument = TRUE;
440 if ( fileref.isNull() ) { 417 if ( fileref.isNull() ) {
441 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 418 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
442 return; 419 return;
443 } 420 }
444// qDebug("setDocument "+fileref); 421// qDebug("setDocument "+fileref);
445 if(fileref.find("playlist",0,TRUE) == -1) { 422 if(fileref.find("playlist",0,TRUE) == -1) {
446 clearList(); 423 clearList();
447 addToSelection( DocLnk( fileref ) ); 424 addToSelection( DocLnk( fileref ) );
448 d->setDocumentUsed = TRUE; 425 d->setDocumentUsed = TRUE;
449 mediaPlayerState->setPlaying( FALSE ); 426 mediaPlayerState->setPlaying( FALSE );
450 qApp->processEvents(); 427 qApp->processEvents();
451 mediaPlayerState->setPlaying( TRUE ); 428 mediaPlayerState->setPlaying( TRUE );
452 qApp->processEvents(); 429 qApp->processEvents();
453 setCaption("OpiePlayer"); 430 setCaption(tr("OpiePlayer"));
454 431
455 } else { //is playlist 432 } else { //is playlist
456 clearList(); 433 clearList();
457 loadList(DocLnk(fileref)); 434 loadList(DocLnk(fileref));
458 d->selectedFiles->first(); 435 d->selectedFiles->first();
459 } 436 }
460} 437}
461 438
462 439
463void PlayListWidget::setActiveWindow() { 440void PlayListWidget::setActiveWindow() {
464 // When we get raised we need to ensure that it switches views 441 // When we get raised we need to ensure that it switches views
465 char origView = mediaPlayerState->view(); 442 char origView = mediaPlayerState->view();
466 mediaPlayerState->setView( 'l' ); // invalidate 443 mediaPlayerState->setView( 'l' ); // invalidate
467 mediaPlayerState->setView( origView ); // now switch back 444 mediaPlayerState->setView( origView ); // now switch back
468} 445}
469 446
470 447
471void PlayListWidget::useSelectedDocument() { 448void PlayListWidget::useSelectedDocument() {
472 d->setDocumentUsed = FALSE; 449 d->setDocumentUsed = FALSE;
473} 450}
474 451
475 452
476const DocLnk *PlayListWidget::current() { // this is fugly 453const DocLnk *PlayListWidget::current() { // this is fugly
477 454
478// if( fromSetDocument) { 455// if( fromSetDocument) {
479// qDebug("from setDoc"); 456// qDebug("from setDoc");
480// DocLnkSet files; 457// DocLnkSet files;
481// Global::findDocuments(&files, "video/*;audio/*"); 458// Global::findDocuments(&files, "video/*;audio/*");
482// QListIterator<DocLnk> dit( files.children() ); 459// QListIterator<DocLnk> dit( files.children() );
483// for ( ; dit.current(); ++dit ) { 460// for ( ; dit.current(); ++dit ) {
484// if(dit.current()->linkFile() == setDocFileRef) { 461// if(dit.current()->linkFile() == setDocFileRef) {
485// qDebug(setDocFileRef); 462// qDebug(setDocFileRef);
486// return dit; 463// return dit;
487// } 464// }
488// } 465// }
489// } else 466// } else
490// qDebug("current"); 467// qDebug("current");
491// switch (tabWidget->currentPageIndex()) { 468// switch (tabWidget->currentPageIndex()) {
492// case 0: //playlist 469// case 0: //playlist
493// { 470// {
494 qDebug("playlist"); 471 qDebug("playlist");
495 if ( mediaPlayerState->playlist() ) { 472 if ( mediaPlayerState->playlist() ) {
496 return d->selectedFiles->current(); 473 return d->selectedFiles->current();
497 } 474 }
498 else if ( d->setDocumentUsed && d->current ) { 475 else if ( d->setDocumentUsed && d->current ) {
499 return d->current; 476 return d->current;
500 } else { 477 } else {
501 return d->files->selected(); 478 return d->files->selected();
502 } 479 }
503// } 480// }
504// break; 481// break;
505// case 1://audio 482// case 1://audio
506// { 483// {
507// qDebug("audioView"); 484// qDebug("audioView");
508// Global::findDocuments(&files, "audio/*"); 485// Global::findDocuments(&files, "audio/*");
509// QListIterator<DocLnk> dit( files.children() ); 486// QListIterator<DocLnk> dit( files.children() );
510// for ( ; dit.current(); ++dit ) { 487// for ( ; dit.current(); ++dit ) {
511// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { 488// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
512// qDebug("here"); 489// qDebug("here");
513// insanityBool=TRUE; 490// insanityBool=TRUE;
514// return dit; 491// return dit;
515// } 492// }
516// } 493// }
517// } 494// }
518// break; 495// break;
519// case 2: // video 496// case 2: // video
520// { 497// {
521// qDebug("videoView"); 498// qDebug("videoView");
522// Global::findDocuments(&vFiles, "video/*"); 499// Global::findDocuments(&vFiles, "video/*");
523// QListIterator<DocLnk> Vdit( vFiles.children() ); 500// QListIterator<DocLnk> Vdit( vFiles.children() );
524// for ( ; Vdit.current(); ++Vdit ) { 501// for ( ; Vdit.current(); ++Vdit ) {
525// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { 502// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
526// insanityBool=TRUE; 503// insanityBool=TRUE;
527// return Vdit; 504// return Vdit;
528// } 505// }
529// } 506// }
530// } 507// }
531// break; 508// break;
532// }; 509// };
533// return 0; 510// return 0;
534} 511}
535 512
536bool PlayListWidget::prev() { 513bool PlayListWidget::prev() {
537 if ( mediaPlayerState->playlist() ) { 514 if ( mediaPlayerState->playlist() ) {
538 if ( mediaPlayerState->shuffled() ) { 515 if ( mediaPlayerState->shuffled() ) {
539 const DocLnk *cur = current(); 516 const DocLnk *cur = current();
540 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 517 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
541 for ( int i = 0; i < j; i++ ) { 518 for ( int i = 0; i < j; i++ ) {
542 if ( !d->selectedFiles->next() ) 519 if ( !d->selectedFiles->next() )
543 d->selectedFiles->first(); 520 d->selectedFiles->first();
544 } 521 }
545 if ( cur == current() ) 522 if ( cur == current() )
546 if ( !d->selectedFiles->next() ) 523 if ( !d->selectedFiles->next() )
547 d->selectedFiles->first(); 524 d->selectedFiles->first();
548 return TRUE; 525 return TRUE;
549 } else { 526 } else {
550 if ( !d->selectedFiles->prev() ) { 527 if ( !d->selectedFiles->prev() ) {
551 if ( mediaPlayerState->looping() ) { 528 if ( mediaPlayerState->looping() ) {
552 return d->selectedFiles->last(); 529 return d->selectedFiles->last();
553 } else { 530 } else {
554 return FALSE; 531 return FALSE;
555 } 532 }
556 } 533 }
557 return TRUE; 534 return TRUE;
558 } 535 }
559 } else { 536 } else {
560 return mediaPlayerState->looping(); 537 return mediaPlayerState->looping();
561 } 538 }
562} 539}
563 540
564 541
565bool PlayListWidget::next() { 542bool PlayListWidget::next() {
566 if ( mediaPlayerState->playlist() ) { 543 if ( mediaPlayerState->playlist() ) {
567 if ( mediaPlayerState->shuffled() ) { 544 if ( mediaPlayerState->shuffled() ) {
568 return prev(); 545 return prev();
569 } else { 546 } else {
570 if ( !d->selectedFiles->next() ) { 547 if ( !d->selectedFiles->next() ) {
571 if ( mediaPlayerState->looping() ) { 548 if ( mediaPlayerState->looping() ) {
572 return d->selectedFiles->first(); 549 return d->selectedFiles->first();
573 } else { 550 } else {
574 return FALSE; 551 return FALSE;
575 } 552 }
576 } 553 }
577 return TRUE; 554 return TRUE;
578 } 555 }
579 } else { 556 } else {
580 return mediaPlayerState->looping(); 557 return mediaPlayerState->looping();
581 } 558 }
582} 559}
583 560
584 561
585bool PlayListWidget::first() { 562bool PlayListWidget::first() {
586 if ( mediaPlayerState->playlist() ) 563 if ( mediaPlayerState->playlist() )
587 return d->selectedFiles->first(); 564 return d->selectedFiles->first();
588 else 565 else
589 return mediaPlayerState->looping(); 566 return mediaPlayerState->looping();
590} 567}
591 568
592 569
593bool PlayListWidget::last() { 570bool PlayListWidget::last() {
594 if ( mediaPlayerState->playlist() ) 571 if ( mediaPlayerState->playlist() )
595 return d->selectedFiles->last(); 572 return d->selectedFiles->last();
596 else 573 else
597 return mediaPlayerState->looping(); 574 return mediaPlayerState->looping();
598} 575}
599 576
600 577
601void PlayListWidget::saveList() { 578void PlayListWidget::saveList() {
602 579
603 QString filename; 580 QString filename;
604 InputDialog *fileDlg; 581 InputDialog *fileDlg;
605 fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); 582 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
606 fileDlg->exec(); 583 fileDlg->exec();
607 if( fileDlg->result() == 1 ) { 584 if( fileDlg->result() == 1 ) {
608 if ( d->current ) 585 if ( d->current )
609 delete d->current; 586 delete d->current;
610 filename = fileDlg->LineEdit1->text();//+".playlist"; 587 filename = fileDlg->LineEdit1->text();//+".playlist";
611// qDebug("saving playlist "+filename+".playlist"); 588// qDebug("saving playlist "+filename+".playlist");
612 Config cfg( filename +".playlist"); 589 Config cfg( filename +".playlist");
613 writeConfig( cfg ); 590 writeConfig( cfg );
614 if( playLists->selected()->name() == filename) { 591 if( playLists->selected()->name() == filename) {
615// qDebug("same name so delete lnk"); 592// qDebug("same name so delete lnk");
616 QFile().remove(playLists->selected()->file()); 593 QFile().remove(playLists->selected()->file());
617 QFile().remove(playLists->selected()->linkFile()); 594 QFile().remove(playLists->selected()->linkFile());
618 playLists->reread(); 595 playLists->reread();
619 } 596 }
620 597
621 DocLnk lnk; 598 DocLnk lnk;
622// lnk.setComment( ""); 599// lnk.setComment( "");
623 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 600 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
624 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D 601 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
625 lnk.setIcon("mpegplayer/playlist2"); 602 lnk.setIcon("mpegplayer/playlist2");
626 lnk.setName( filename); //sets file name 603 lnk.setName( filename); //sets file name
627 if(!lnk.writeLink()) 604 if(!lnk.writeLink())
628 qDebug("Writing doclink did not work"); 605 qDebug("Writing doclink did not work");
629 } 606 }
630 Config config( "MediaPlayer" ); 607 Config config( "MediaPlayer" );
631 config.writeEntry("CurrentPlaylist",filename); 608 config.writeEntry("CurrentPlaylist",filename);
632 setCaption("OpiePlayer: "+filename); 609 setCaption(tr("OpiePlayer: ")+filename);
633 d->selectedFiles->first(); 610 d->selectedFiles->first();
634 if(fileDlg) 611 if(fileDlg)
635 delete fileDlg; 612 delete fileDlg;
636} 613}
637 614
638void PlayListWidget::loadList( const DocLnk & lnk) { 615void PlayListWidget::loadList( const DocLnk & lnk) {
639 QString name= lnk.name(); 616 QString name= lnk.name();
640// qDebug("currentList is "+name); 617// qDebug("currentList is "+name);
641 if( name.length()>1) { 618 if( name.length()>1) {
642 setCaption("OpiePlayer: "+name); 619 setCaption("OpiePlayer: "+name);
643// qDebug("load list "+ name+".playlist"); 620// qDebug("load list "+ name+".playlist");
644 clearList(); 621 clearList();
645 Config cfg( name+".playlist"); 622 Config cfg( name+".playlist");
646 readConfig(cfg); 623 readConfig(cfg);
647 tabWidget->setCurrentPage(0); 624 tabWidget->setCurrentPage(0);
648 Config config( "MediaPlayer" ); 625 Config config( "MediaPlayer" );
649 config.writeEntry("CurrentPlaylist", name); 626 config.writeEntry("CurrentPlaylist", name);
650 d->selectedFiles->first(); 627 d->selectedFiles->first();
651 } 628 }
652} 629}
653 630
654void PlayListWidget::setPlaylist( bool shown ) { 631void PlayListWidget::setPlaylist( bool shown ) {
655 if ( shown ) 632 if ( shown )
656 d->playListFrame->show(); 633 d->playListFrame->show();
657 else 634 else
658 d->playListFrame->hide(); 635 d->playListFrame->hide();
659} 636}
660 637
661void PlayListWidget::setView( char view ) { 638void PlayListWidget::setView( char view ) {
662 if ( view == 'l' ) 639 if ( view == 'l' )
663 showMaximized(); 640 showMaximized();
664 else 641 else
665 hide(); 642 hide();
666} 643}
667 644
668void PlayListWidget::addSelected() { 645void PlayListWidget::addSelected() {
669 646
670 Config cfg( "MediaPlayer" ); 647 Config cfg( "MediaPlayer" );
671 cfg.setGroup("PlayList"); 648 cfg.setGroup("PlayList");
672 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 649 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
673 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 650 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
674 651
675 switch (tabWidget->currentPageIndex()) { 652 switch (tabWidget->currentPageIndex()) {
676 case 0: //playlist 653 case 0: //playlist
677 break; 654 break;
678 case 1: { //audio 655 case 1: { //audio
679 for ( int i = 0; i < noOfFiles; i++ ) { 656 for ( int i = 0; i < noOfFiles; i++ ) {
680 QString entryName; 657 QString entryName;
681 entryName.sprintf( "File%i", i + 1 ); 658 entryName.sprintf( "File%i", i + 1 );
682 QString linkFile = cfg.readEntry( entryName ); 659 QString linkFile = cfg.readEntry( entryName );
683 if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { 660 if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) {
684 int result= QMessageBox::warning(this,"OpiePlayer", 661 int result= QMessageBox::warning(this,tr("OpiePlayer"),
685 tr("This is all ready in your playlist.\nContinue?"), 662 tr("This is all ready in your playlist.\nContinue?"),
686 tr("Yes"),tr("No"),0,0,1); 663 tr("Yes"),tr("No"),0,0,1);
687 if (result !=0) 664 if (result !=0)
688 return; 665 return;
689 } 666 }
690 } 667 }
691 addToSelection( audioView->selectedItem() ); 668 addToSelection( audioView->selectedItem() );
692 tabWidget->setCurrentPage(1); 669 tabWidget->setCurrentPage(1);
693 } 670 }
694 break; 671 break;
695 case 2: { // video 672 case 2: { // video
696 for ( int i = 0; i < noOfFiles; i++ ) { 673 for ( int i = 0; i < noOfFiles; i++ ) {
697 QString entryName; 674 QString entryName;
698 entryName.sprintf( "File%i", i + 1 ); 675 entryName.sprintf( "File%i", i + 1 );
699 QString linkFile = cfg.readEntry( entryName ); 676 QString linkFile = cfg.readEntry( entryName );
700 if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { 677 if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
701 int result= QMessageBox::warning(this,"OpiePlayer", 678 int result= QMessageBox::warning(this,tr("OpiePlayer"),
702 tr("This is all ready in your playlist.\nContinue?"), 679 tr("This is all ready in your playlist.\nContinue?"),
703 tr("Yes"),tr("No"),0,0,1); 680 tr("Yes"),tr("No"),0,0,1);
704 if (result !=0) 681 if (result !=0)
705 return; 682 return;
706 } 683 }
707 } 684 }
708 addToSelection( videoView->selectedItem() ); 685 addToSelection( videoView->selectedItem() );
709 tabWidget->setCurrentPage(2); 686 tabWidget->setCurrentPage(2);
710 } 687 }
711 break; 688 break;
712 }; 689 };
713} 690}
714 691
715void PlayListWidget::removeSelected() { 692void PlayListWidget::removeSelected() {
716 d->selectedFiles->removeSelected( ); 693 d->selectedFiles->removeSelected( );
717} 694}
718 695
719
720void PlayListWidget::playIt( QListViewItem *it) { 696void PlayListWidget::playIt( QListViewItem *it) {
721// d->setDocumentUsed = FALSE; 697// d->setDocumentUsed = FALSE;
722 mediaPlayerState->setPlaying(TRUE); 698 mediaPlayerState->setPlaying(TRUE);
723} 699}
724 700
725void PlayListWidget::addToSelection( QListViewItem *it) { 701void PlayListWidget::addToSelection( QListViewItem *it) {
726 d->setDocumentUsed = FALSE; 702 d->setDocumentUsed = FALSE;
727 703
728 if(it) { 704 if(it) {
729// qDebug("add to selection");
730 switch (tabWidget->currentPageIndex()) { 705 switch (tabWidget->currentPageIndex()) {
731 case 1: { 706 case 1: {
732// qDebug("case 1");
733 QListIterator<DocLnk> dit( files.children() ); 707 QListIterator<DocLnk> dit( files.children() );
734 for ( ; dit.current(); ++dit ) { 708 for ( ; dit.current(); ++dit ) {
735// qDebug(dit.current()->name());
736 if( dit.current()->name() == it->text(0)) { 709 if( dit.current()->name() == it->text(0)) {
737 d->selectedFiles->addToSelection( **dit ); 710 d->selectedFiles->addToSelection( **dit );
738 } 711 }
739 } 712 }
740 } 713 }
741 break; 714 break;
742 case 2: { 715 case 2: {
743// qDebug("case 2");
744 QListIterator<DocLnk> dit( vFiles.children() ); 716 QListIterator<DocLnk> dit( vFiles.children() );
745 for ( ; dit.current(); ++dit ) { 717 for ( ; dit.current(); ++dit ) {
746// qDebug(dit.current()->name());
747 if( dit.current()->name() == it->text(0)) { 718 if( dit.current()->name() == it->text(0)) {
748 d->selectedFiles->addToSelection( **dit ); 719 d->selectedFiles->addToSelection( **dit );
749 } 720 }
750 } 721 }
751 } 722 }
752 break; 723 break;
753 case 0: 724 case 0:
754 break; 725 break;
755 }; 726 };
756 tabWidget->setCurrentPage(0); 727 tabWidget->setCurrentPage(0);
757// mediaPlayerState->setPlaying( TRUE );
758 } 728 }
759} 729}
760 730
761void PlayListWidget::tabChanged(QWidget *widg) { 731void PlayListWidget::tabChanged(QWidget *widg) {
762 732
763 switch ( tabWidget->currentPageIndex()) { 733 switch ( tabWidget->currentPageIndex()) {
764 case 0: 734 case 0:
765 { 735 {
766 if( !tbDeletePlaylist->isHidden()) 736 if( !tbDeletePlaylist->isHidden())
767 tbDeletePlaylist->hide(); 737 tbDeletePlaylist->hide();
768 d->tbRemoveFromList->setEnabled(TRUE); 738 d->tbRemoveFromList->setEnabled(TRUE);
769 d->tbAddToList->setEnabled(FALSE); 739 d->tbAddToList->setEnabled(FALSE);
770 } 740 }
771 break; 741 break;
772 case 1: 742 case 1:
773 { 743 {
774 if( !tbDeletePlaylist->isHidden()) 744 if( !tbDeletePlaylist->isHidden())
775 tbDeletePlaylist->hide(); 745 tbDeletePlaylist->hide();
776 d->tbRemoveFromList->setEnabled(FALSE); 746 d->tbRemoveFromList->setEnabled(FALSE);
777 d->tbAddToList->setEnabled(TRUE); 747 d->tbAddToList->setEnabled(TRUE);
778 } 748 }
779 break; 749 break;
780 case 2: 750 case 2:
781 { 751 {
782 if( !tbDeletePlaylist->isHidden()) 752 if( !tbDeletePlaylist->isHidden())
783 tbDeletePlaylist->hide(); 753 tbDeletePlaylist->hide();
784 d->tbRemoveFromList->setEnabled(FALSE); 754 d->tbRemoveFromList->setEnabled(FALSE);
785 d->tbAddToList->setEnabled(TRUE); 755 d->tbAddToList->setEnabled(TRUE);
786 } 756 }
787 break; 757 break;
788 case 3: 758 case 3:
789 { 759 {
790 if( tbDeletePlaylist->isHidden()) 760 if( tbDeletePlaylist->isHidden())
791 tbDeletePlaylist->show(); 761 tbDeletePlaylist->show();
792 playLists->reread(); 762 playLists->reread();
793 } 763 }
794 break; 764 break;
795 }; 765 };
796} 766}
797 767
798 768
799/* 769
800 play button is pressed*/
801void PlayListWidget::btnPlay(bool b) { 770void PlayListWidget::btnPlay(bool b) {
771
802// mediaPlayerState->setPlaying(b); 772// mediaPlayerState->setPlaying(b);
803 switch ( tabWidget->currentPageIndex()) { 773 switch ( tabWidget->currentPageIndex()) {
804 case 0: 774 case 0:
805 { 775 {
806 mediaPlayerState->setPlaying(b); 776 mediaPlayerState->setPlaying(b);
807 } 777 }
808 break; 778 break;
809 case 1: 779 case 1:
810 { 780 {
811 addToSelection( audioView->selectedItem() ); 781 addToSelection( audioView->selectedItem() );
812 mediaPlayerState->setPlaying(b); 782 mediaPlayerState->setPlaying(b);
813// qApp->processEvents(); 783// qApp->processEvents();
814 d->selectedFiles->removeSelected( ); 784 d->selectedFiles->removeSelected( );
815 tabWidget->setCurrentPage(1); 785 tabWidget->setCurrentPage(1);
816 d->selectedFiles->unSelect(); 786 d->selectedFiles->unSelect();
817// mediaPlayerState->setPlaying(FALSE); 787// mediaPlayerState->setPlaying(FALSE);
818 } 788 }
819 break; 789 break;
820 case 2: 790 case 2:
821 { 791 {
822 addToSelection( videoView->selectedItem() ); 792 addToSelection( videoView->selectedItem() );
823 mediaPlayerState->setPlaying(b); 793 mediaPlayerState->setPlaying(b);
824 qApp->processEvents(); 794 qApp->processEvents();
825 d->selectedFiles->removeSelected( ); 795 d->selectedFiles->removeSelected( );
826 tabWidget->setCurrentPage(2); 796 tabWidget->setCurrentPage(2);
827 d->selectedFiles->unSelect(); 797 d->selectedFiles->unSelect();
828// mediaPlayerState->setPlaying(FALSE); 798// mediaPlayerState->setPlaying(FALSE);
829 } 799 }
830 break; 800 break;
831 }; 801 };
832
833
834
835
836} 802}
837 803
838void PlayListWidget::deletePlaylist() { 804void PlayListWidget::deletePlaylist() {
839 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 805 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
840 (tr("You really want to delete\nthis playlist?")), 806 (tr("You really want to delete\nthis playlist?")),
841 (tr("Yes")), (tr("No")), 0 )){ 807 (tr("Yes")), (tr("No")), 0 )){
842 case 0: // Yes clicked, 808 case 0: // Yes clicked,
843 QFile().remove(playLists->selected()->file()); 809 QFile().remove(playLists->selected()->file());
844 QFile().remove(playLists->selected()->linkFile()); 810 QFile().remove(playLists->selected()->linkFile());
845 playLists->reread(); 811 playLists->reread();
846 break; 812 break;
847 case 1: // Cancel 813 case 1: // Cancel
848 break; 814 break;
849 }; 815 };
850 816
851} 817}
852 818
853void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 819void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
854{ 820{
855 switch (mouse) { 821 switch (mouse) {
856 case 1: 822 case 1:
857 break; 823 break;
858 case 2:{ 824 case 2:{
859 QPopupMenu m; 825 QPopupMenu m;
860 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 826 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
861 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 827 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
862// m.insertSeparator(); 828 m.insertSeparator();
863// m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 829 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
864 m.exec( QCursor::pos() ); 830 m.exec( QCursor::pos() );
865 } 831 }
866 break; 832 break;
867 }; 833 };
868
869} 834}
870 835
871void PlayListWidget::playSelected() 836void PlayListWidget::playSelected()
872{ 837{
873 btnPlay( TRUE); 838 btnPlay( TRUE);
874} 839}
875 840
876void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 841void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
877{ 842{
878 switch (mouse) { 843 switch (mouse) {
879 case 1: 844 case 1:
880 break; 845 break;
881 case 2:{ 846 case 2:{
882 QPopupMenu m; 847 QPopupMenu m;
883 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 848 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
884 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 849 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
885// m.insertSeparator(); 850// m.insertSeparator();
886 m.exec( QCursor::pos() ); 851 m.exec( QCursor::pos() );
887 } 852 }
888 break; 853 break;
889 }; 854 };
890 855
891} 856}
857
858void PlayListWidget::listDelete() {
859 Config cfg( "MediaPlayer" );
860 cfg.setGroup("PlayList");
861 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
862 QString file;
863 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
864 switch ( tabWidget->currentPageIndex()) {
865 case 0:
866 break;
867 case 1:
868 {
869 file = audioView->selectedItem()->text(0);
870// Global::findDocuments(&files, "audio/*");
871// AppLnkSet appFiles;
872 QListIterator<DocLnk> dit( files.children() );
873 for ( ; dit.current(); ++dit ) {
874 if( dit.current()->name() == file) {
875 qDebug(file);
876 LnkProperties prop( dit.current() );
877// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
878 prop.showMaximized();
879 prop.exec();
880 }
881 }
882 populateAudioView();
883 }
884 break;
885 case 2:
886 {
887// file = videoView->selectedItem()->text(0);
888// for ( int i = 0; i < noOfFiles; i++ ) {
889// QString entryName;
890// entryName.sprintf( "File%i", i + 1 );
891// QString linkFile = cfg.readEntry( entryName );
892// AppLnk lnk( AppLnk(linkFile));
893// if( lnk.name() == file ) {
894// LnkProperties prop( &lnk);
895// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
896// prop.showMaximized();
897// prop.exec();
898// }
899// }
900 }
901 break;
902 };
903}
904
905void PlayListWidget::populateAudioView() {
906// if(files)
907// files.~DocLnkSet();
908 Global::findDocuments(&files, "audio/*");
909 QListIterator<DocLnk> dit( files.children() );
910 audioView->clear();
911 QString storage;
912 for ( ; dit.current(); ++dit ) {
913 QListViewItem * newItem;
914 if(dit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF");
915 else if(dit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF");
916 else if(dit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD");
917 else storage=tr("RAM");
918 if ( QFile( dit.current()->file()).exists() ) {
919 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage);
920 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" ));
921 }
922 }
923}
924
925void PlayListWidget::populateVideoView() {
926 Global::findDocuments(&vFiles, "video/*");
927 QListIterator<DocLnk> Vdit( vFiles.children() );
928 videoView->clear();
929 QString storage;
930 for ( ; Vdit.current(); ++Vdit ) {
931 if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF");
932 else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF");
933 else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD");
934 else storage=tr("RAM");
935 QListViewItem * newItem;
936 if ( QFile( Vdit.current()->file()).exists() ) {
937 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
938 newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" ));
939 }
940 }
941}
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 10a42df..186ca1b 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -1,108 +1,112 @@
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#ifndef PLAY_LIST_WIDGET_H 20#ifndef PLAY_LIST_WIDGET_H
21#define PLAY_LIST_WIDGET_H 21#define PLAY_LIST_WIDGET_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qtabwidget.h> 25#include <qtabwidget.h>
26#include <qpe/fileselector.h> 26#include <qpe/fileselector.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28 28
29/* #include <qtimer.h> */ 29/* #include <qtimer.h> */
30 30
31 31
32class PlayListWidgetPrivate; 32class PlayListWidgetPrivate;
33class Config; 33class Config;
34class QListViewItem; 34class QListViewItem;
35class QListView; 35class QListView;
36class QPoint; 36class QPoint;
37class QAction; 37class QAction;
38class QLabel; 38class QLabel;
39 39
40class PlayListWidget : public QMainWindow { 40class PlayListWidget : public QMainWindow {
41 Q_OBJECT 41 Q_OBJECT
42public: 42public:
43 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 43 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
44 ~PlayListWidget(); 44 ~PlayListWidget();
45 QTabWidget * tabWidget; 45 QTabWidget * tabWidget;
46 QAction *fullScreenButton, *scaleButton; 46 QAction *fullScreenButton, *scaleButton;
47 DocLnkSet files; 47 DocLnkSet files;
48 DocLnkSet vFiles; 48 DocLnkSet vFiles;
49 QListView *audioView, *videoView, *playlistView; 49 QListView *audioView, *videoView, *playlistView;
50 QLabel *libString; 50 QLabel *libString;
51 bool fromSetDocument; 51 bool fromSetDocument;
52 bool insanityBool; 52 bool insanityBool;
53 QString setDocFileRef; 53 QString setDocFileRef;
54 // retrieve the current playlist entry (media file link) 54 // retrieve the current playlist entry (media file link)
55 const DocLnk *current(); 55 const DocLnk *current();
56 void useSelectedDocument(); 56 void useSelectedDocument();
57/* QTimer * menuTimer; */ 57/* QTimer * menuTimer; */
58 FileSelector* playLists; 58 FileSelector* playLists;
59 QPushButton *tbDeletePlaylist; 59 QPushButton *tbDeletePlaylist;
60public slots: 60public slots:
61 bool first();
62 bool last();
63 bool next();
64 bool prev();
65/* void setFullScreen(); */
66/* void setScaled(); */
67protected:
68/* void contentsMousePressEvent( QMouseEvent * e ); */
69/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
70
71private:
72 void initializeStates();
73 void readConfig( Config& cfg );
74 void writeConfig( Config& cfg ) const;
75 PlayListWidgetPrivate *d; // Private implementation data
76 void populateAudioView();
77 void populateVideoView();
78private slots:
61 void setDocument( const QString& fileref ); 79 void setDocument( const QString& fileref );
62 void addToSelection( const DocLnk& ); // Add a media file to the playlist 80 void addToSelection( const DocLnk& ); // Add a media file to the playlist
63 void addToSelection( QListViewItem* ); // Add a media file to the playlist 81 void addToSelection( QListViewItem* ); // Add a media file to the playlist
64 void setActiveWindow(); // need to handle this to show the right view 82 void setActiveWindow(); // need to handle this to show the right view
65 void setPlaylist( bool ); // Show/Hide the playlist 83 void setPlaylist( bool ); // Show/Hide the playlist
66 void setView( char ); 84 void setView( char );
67 void clearList(); 85 void clearList();
68 void addAllToList(); 86 void addAllToList();
69 void addAllMusicToList(); 87 void addAllMusicToList();
70 void addAllVideoToList(); 88 void addAllVideoToList();
71 void saveList(); // Save the playlist 89 void saveList(); // Save the playlist
72 void loadList( const DocLnk &); // Load a playlist 90 void loadList( const DocLnk &); // Load a playlist
73 void playIt( QListViewItem *); 91 void playIt( QListViewItem *);
74 92
75 void btnPlay(bool); 93 void btnPlay(bool);
76 void deletePlaylist(); 94 void deletePlaylist();
77 bool first();
78 bool last();
79 bool next();
80 bool prev();
81 void addSelected(); 95 void addSelected();
82 void removeSelected(); 96 void removeSelected();
83 void tabChanged(QWidget*); 97 void tabChanged(QWidget*);
84 void viewPressed( int, QListViewItem *, const QPoint&, int); 98 void viewPressed( int, QListViewItem *, const QPoint&, int);
85 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 99 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
86 void playSelected(); 100 void playSelected();
87/* void setFullScreen(); */ 101 void listDelete();
88/* void setScaled(); */ 102
89protected:
90/* void contentsMousePressEvent( QMouseEvent * e ); */
91/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
92
93private:
94 void initializeStates();
95 void readConfig( Config& cfg );
96 void writeConfig( Config& cfg ) const;
97 PlayListWidgetPrivate *d; // Private implementation data
98
99protected slots: 103protected slots:
100/* void cancelMenuTimer(); */ 104/* void cancelMenuTimer(); */
101/* void showFileMenu(); */ 105/* void showFileMenu(); */
102 106
103 107
104}; 108};
105 109
106 110
107#endif // PLAY_LIST_WIDGET_H 111#endif // PLAY_LIST_WIDGET_H
108 112