summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-01-19 23:11:02 (UTC)
committer llornkcor <llornkcor>2003-01-19 23:11:02 (UTC)
commit512e600c777643230a032e89f7446b4099f54a86 (patch) (unidiff)
tree0a19e567b5acc6f44c5d5957fcaf097350f84a03
parent4e9ddbd0da3de7d0d03d7a39f05643dec07cc2cf (diff)
downloadopie-512e600c777643230a032e89f7446b4099f54a86.zip
opie-512e600c777643230a032e89f7446b4099f54a86.tar.gz
opie-512e600c777643230a032e89f7446b4099f54a86.tar.bz2
partly fix playing from audio and video views
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp11
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp22
2 files changed, 21 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 85228a9..67187f8 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -18,142 +18,143 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23 23
24#include <qpainter.h> 24#include <qpainter.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qheader.h> 26#include <qheader.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qlist.h> 28#include <qlist.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30 30
31#include "playlistselection.h" 31#include "playlistselection.h"
32 32
33#include <stdlib.h> 33#include <stdlib.h>
34 34
35class PlayListSelectionItem : public QListViewItem { 35class PlayListSelectionItem : public QListViewItem {
36public: 36public:
37 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { 37 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) {
38 setText( 0, f->name() ); 38 setText( 0, f->name() );
39 setPixmap( 0, f->pixmap() ); 39 setPixmap( 0, f->pixmap() );
40 } 40 }
41 41
42 ~PlayListSelectionItem() { 42 ~PlayListSelectionItem() {
43 }; 43 };
44 44
45 const DocLnk *file() const { return fl; } 45 const DocLnk *file() const { return fl; }
46 46
47private: 47private:
48 const DocLnk *fl; 48 const DocLnk *fl;
49}; 49};
50 50
51 51
52PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 52PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
53 : QListView( parent, name ) 53 : QListView( parent, name )
54{ 54{
55// qDebug("starting playlistselector"); 55// qDebug("starting playlistselector");
56// #ifdef USE_PLAYLIST_BACKGROUND 56// #ifdef USE_PLAYLIST_BACKGROUND
57// setStaticBackground( TRUE ); 57// setStaticBackground( TRUE );
58// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); 58// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) );
59 59
60// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 60// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
61// #endif 61// #endif
62// addColumn("Title",236); 62// addColumn("Title",236);
63// setAllColumnsShowFocus( TRUE ); 63// setAllColumnsShowFocus( TRUE );
64 addColumn( tr( "Playlist Selection" ) ); 64 addColumn( tr( "Playlist Selection" ) );
65 header()->hide(); 65 header()->hide();
66 setSorting( -1, FALSE ); 66// setSorting( -1, FALSE );
67 // FIXME
67} 68}
68 69
69 70
70PlayListSelection::~PlayListSelection() { 71PlayListSelection::~PlayListSelection() {
71} 72}
72 73
73 74
74// #ifdef USE_PLAYLIST_BACKGROUND 75// #ifdef USE_PLAYLIST_BACKGROUND
75void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 76void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
76// qDebug("drawBackground"); 77// qDebug("drawBackground");
77 p->fillRect( r, QBrush( white ) ); 78 p->fillRect( r, QBrush( white ) );
78// QImage logo = Resource::loadImage( "launcher/opielogo" ); 79// QImage logo = Resource::loadImage( "launcher/opielogo" );
79// if ( !logo.isNull() ) 80// if ( !logo.isNull() )
80// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 81// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
81} 82}
82// #endif 83// #endif
83 84
84 85
85void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 86void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
86 if ( event->state() == QMouseEvent::LeftButton ) { 87 if ( event->state() == QMouseEvent::LeftButton ) {
87 QListViewItem *currentItem = selectedItem(); 88 QListViewItem *currentItem = selectedItem();
88 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 89 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
89 if ( currentItem && currentItem->itemAbove() == itemUnder ) 90 if ( currentItem && currentItem->itemAbove() == itemUnder )
90 moveSelectedUp(); 91 moveSelectedUp();
91 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 92 else if ( currentItem && currentItem->itemBelow() == itemUnder )
92 moveSelectedDown(); 93 moveSelectedDown();
93 } 94 }
94} 95}
95 96
96 97
97const DocLnk *PlayListSelection::current() { 98const DocLnk *PlayListSelection::current() {
98 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 99 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
99 if ( item ) 100 if ( item )
100 return item->file(); 101 return item->file();
101 return NULL; 102 return NULL;
102} 103}
103 104
104 105
105void PlayListSelection::addToSelection( const DocLnk &lnk ) { 106void PlayListSelection::addToSelection( const DocLnk &lnk ) {
106 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 107 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
107 QListViewItem *current = selectedItem(); 108 QListViewItem *current = selectedItem();
108 if ( current ) 109 if ( current )
109 item->moveItem( current ); 110 item->moveItem( current );
110 setSelected( item, TRUE ); 111 setSelected( item, TRUE );
111 ensureItemVisible( selectedItem() ); 112 ensureItemVisible( item);
112} 113}
113 114
114 115
115void PlayListSelection::removeSelected() { 116void PlayListSelection::removeSelected() {
116 QListViewItem *item = selectedItem(); 117 QListViewItem *item = selectedItem();
117 if ( item ) 118 if ( item )
118 delete item; 119 delete item;
119 setSelected( currentItem(), TRUE ); 120 setSelected( currentItem(), TRUE );
120 ensureItemVisible( selectedItem() ); 121 ensureItemVisible( selectedItem() );
121} 122}
122 123
123 124
124void PlayListSelection::moveSelectedUp() { 125void PlayListSelection::moveSelectedUp() {
125 QListViewItem *item = selectedItem(); 126 QListViewItem *item = selectedItem();
126 if ( item && item->itemAbove() ) 127 if ( item && item->itemAbove() )
127 item->itemAbove()->moveItem( item ); 128 item->itemAbove()->moveItem( item );
128 ensureItemVisible( selectedItem() ); 129 ensureItemVisible( selectedItem() );
129} 130}
130 131
131 132
132void PlayListSelection::moveSelectedDown() { 133void PlayListSelection::moveSelectedDown() {
133 QListViewItem *item = selectedItem(); 134 QListViewItem *item = selectedItem();
134 if ( item && item->itemBelow() ) 135 if ( item && item->itemBelow() )
135 item->moveItem( item->itemBelow() ); 136 item->moveItem( item->itemBelow() );
136 ensureItemVisible( selectedItem() ); 137 ensureItemVisible( selectedItem() );
137} 138}
138 139
139 140
140bool PlayListSelection::prev() { 141bool PlayListSelection::prev() {
141 QListViewItem *item = selectedItem(); 142 QListViewItem *item = selectedItem();
142 if ( item && item->itemAbove() ) 143 if ( item && item->itemAbove() )
143 setSelected( item->itemAbove(), TRUE ); 144 setSelected( item->itemAbove(), TRUE );
144 else 145 else
145 return FALSE; 146 return FALSE;
146 ensureItemVisible( selectedItem() ); 147 ensureItemVisible( selectedItem() );
147 return TRUE; 148 return TRUE;
148} 149}
149 150
150bool PlayListSelection::next() { 151bool PlayListSelection::next() {
151 QListViewItem *item = selectedItem(); 152 QListViewItem *item = selectedItem();
152 if ( item && item->itemBelow() ) 153 if ( item && item->itemBelow() )
153 setSelected( item->itemBelow(), TRUE ); 154 setSelected( item->itemBelow(), TRUE );
154 else 155 else
155 return FALSE; 156 return FALSE;
156 ensureItemVisible( selectedItem() ); 157 ensureItemVisible( selectedItem() );
157 return TRUE; 158 return TRUE;
158} 159}
159 160
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 395037f..19c8056 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -214,150 +214,157 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
214 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 214 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
215 215
216 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 216 tabWidget = new QTabWidget( hbox6, "tabWidget" );
217 tabWidget->setTabShape(QTabWidget::Triangular); 217 tabWidget->setTabShape(QTabWidget::Triangular);
218 218
219 QWidget *pTab; 219 QWidget *pTab;
220 pTab = new QWidget( tabWidget, "pTab" ); 220 pTab = new QWidget( tabWidget, "pTab" );
221// playlistView = new QListView( pTab, "playlistview" ); 221// playlistView = new QListView( pTab, "playlistview" );
222// playlistView->setMinimumSize(236,260); 222// playlistView->setMinimumSize(236,260);
223 tabWidget->insertTab( pTab,"Playlist"); 223 tabWidget->insertTab( pTab,"Playlist");
224 224
225 225
226 // Add the playlist area 226 // Add the playlist area
227 227
228 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 228 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
229 d->playListFrame = vbox3; 229 d->playListFrame = vbox3;
230 d->playListFrame ->setMinimumSize(235,260); 230 d->playListFrame ->setMinimumSize(235,260);
231 231
232 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 232 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
233 233
234 d->selectedFiles = new PlayListSelection( hbox2); 234 d->selectedFiles = new PlayListSelection( hbox2);
235 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 235 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
236 236
237 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 237 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
238 238
239 239
240 240
241 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 241 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
242 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 242 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
243 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); 243 new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
244 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 244 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
245 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 245 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
246 246
247 QWidget *aTab; 247 QWidget *aTab;
248 aTab = new QWidget( tabWidget, "aTab" ); 248 aTab = new QWidget( tabWidget, "aTab" );
249 audioView = new QListView( aTab, "Audioview" ); 249 audioView = new QListView( aTab, "Audioview" );
250 audioView->setMinimumSize(233,260); 250 audioView->setMinimumSize(233,260);
251 audioView->addColumn( tr("Title"),140); 251 audioView->addColumn( tr("Title"),140);
252 audioView->addColumn(tr("Size"), -1); 252 audioView->addColumn(tr("Size"), -1);
253 audioView->addColumn(tr("Media"),-1); 253 audioView->addColumn(tr("Media"),-1);
254 audioView->addColumn( tr( "Path" ), 0 ); 254 audioView->addColumn( tr( "Path" ), 0 );
255 255
256 audioView->setColumnAlignment(1, Qt::AlignRight); 256 audioView->setColumnAlignment(1, Qt::AlignRight);
257 audioView->setColumnAlignment(2, Qt::AlignRight); 257 audioView->setColumnAlignment(2, Qt::AlignRight);
258 audioView->setAllColumnsShowFocus(TRUE); 258 audioView->setAllColumnsShowFocus(TRUE);
259 259
260 audioView->setMultiSelection( TRUE ); 260 audioView->setMultiSelection( TRUE );
261 audioView->setSelectionMode( QListView::Extended); 261 audioView->setSelectionMode( QListView::Extended);
262 audioView->setSorting( 3, TRUE );
262 263
263 tabWidget->insertTab(aTab,tr("Audio")); 264 tabWidget->insertTab(aTab,tr("Audio"));
264 265
265 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 266 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
266 267
267// audioView 268// audioView
268// populateAudioView(); 269// populateAudioView();
269// videowidget 270// videowidget
270 271
271 QWidget *vTab; 272 QWidget *vTab;
272 vTab = new QWidget( tabWidget, "vTab" ); 273 vTab = new QWidget( tabWidget, "vTab" );
273 videoView = new QListView( vTab, "Videoview" ); 274 videoView = new QListView( vTab, "Videoview" );
274 videoView->setMinimumSize(233,260); 275 videoView->setMinimumSize(233,260);
275 276
276 videoView->addColumn(tr("Title"),140); 277 videoView->addColumn(tr("Title"),140);
277 videoView->addColumn(tr("Size"),-1); 278 videoView->addColumn(tr("Size"),-1);
278 videoView->addColumn(tr("Media"),-1); 279 videoView->addColumn(tr("Media"),-1);
279 videoView->addColumn(tr( "Path" ), 0 ); 280 videoView->addColumn(tr( "Path" ), 0 );
280 videoView->setColumnAlignment(1, Qt::AlignRight); 281 videoView->setColumnAlignment(1, Qt::AlignRight);
281 videoView->setColumnAlignment(2, Qt::AlignRight); 282 videoView->setColumnAlignment(2, Qt::AlignRight);
282 videoView->setAllColumnsShowFocus(TRUE); 283 videoView->setAllColumnsShowFocus(TRUE);
283 videoView->setMultiSelection( TRUE ); 284 videoView->setMultiSelection( TRUE );
284 videoView->setSelectionMode( QListView::Extended); 285 videoView->setSelectionMode( QListView::Extended);
285 286
286 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 287 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
287 288
288 tabWidget->insertTab( vTab,tr("Video")); 289 tabWidget->insertTab( vTab,tr("Video"));
289 290
290 QWidget *LTab; 291 QWidget *LTab;
291 LTab = new QWidget( tabWidget, "LTab" ); 292 LTab = new QWidget( tabWidget, "LTab" );
292 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 293 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
293 playLists->setMinimumSize(233,260); 294 playLists->setMinimumSize(233,260);
294 tabWidget->insertTab(LTab,tr("Lists")); 295 tabWidget->insertTab(LTab,tr("Lists"));
295 296
296 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 297 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
297 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 298 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
298 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 299 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
299 300
300 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 301 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
301 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 302 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
302 303
304
305///audioView
303 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 306 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
304 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 307 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
305 308
306 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 309 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
307 this,SLOT( playIt( QListViewItem *)) ); 310 this,SLOT( playIt( QListViewItem *)) );
308 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 311 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
309 312
313
314//videoView
310 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 315 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
311 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 316 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
312 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 317 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
313 this,SLOT( playIt( QListViewItem *)) ); 318 this,SLOT( playIt( QListViewItem *)) );
314 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 319 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
315 320
321
322//playlists
316 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 323 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
317 324
318 325
319 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 326 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
320 327
321// connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 328// connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
322 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 329 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
323 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 330 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
324 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 331 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
325 332
326 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 333 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
327 334
328 setCentralWidget( vbox5 ); 335 setCentralWidget( vbox5 );
329 336
330 Config cfg( "OpiePlayer" ); 337 Config cfg( "OpiePlayer" );
331 readConfig( cfg ); 338 readConfig( cfg );
332 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 339 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
333 loadList(DocLnk( currentPlaylist)); 340 loadList(DocLnk( currentPlaylist));
334 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); 341 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
335 342
336 initializeStates(); 343 initializeStates();
337} 344}
338 345
339 346
340PlayListWidget::~PlayListWidget() { 347PlayListWidget::~PlayListWidget() {
341 Config cfg( "OpiePlayer" ); 348 Config cfg( "OpiePlayer" );
342 writeConfig( cfg ); 349 writeConfig( cfg );
343 350
344 if ( d->current ) 351 if ( d->current )
345 delete d->current; 352 delete d->current;
346 delete d; 353 delete d;
347} 354}
348 355
349 356
350void PlayListWidget::initializeStates() { 357void PlayListWidget::initializeStates() {
351 358
352 d->tbPlay->setOn( mediaPlayerState->playing() ); 359 d->tbPlay->setOn( mediaPlayerState->playing() );
353 d->tbLoop->setOn( mediaPlayerState->looping() ); 360 d->tbLoop->setOn( mediaPlayerState->looping() );
354 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 361 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
355 setPlaylist( true); 362 setPlaylist( true);
356} 363}
357 364
358 365
359void PlayListWidget::readConfig( Config& cfg ) { 366void PlayListWidget::readConfig( Config& cfg ) {
360 cfg.setGroup("PlayList"); 367 cfg.setGroup("PlayList");
361 QString currentString = cfg.readEntry("current", "" ); 368 QString currentString = cfg.readEntry("current", "" );
362 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 369 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
363 for ( int i = 0; i < noOfFiles; i++ ) { 370 for ( int i = 0; i < noOfFiles; i++ ) {
@@ -762,114 +769,115 @@ void PlayListWidget::tabChanged(QWidget *) {
762 populateAudioView(); 769 populateAudioView();
763 770
764 if( !tbDeletePlaylist->isHidden()) 771 if( !tbDeletePlaylist->isHidden())
765 tbDeletePlaylist->hide(); 772 tbDeletePlaylist->hide();
766 d->tbRemoveFromList->setEnabled(FALSE); 773 d->tbRemoveFromList->setEnabled(FALSE);
767 d->tbAddToList->setEnabled(TRUE); 774 d->tbAddToList->setEnabled(TRUE);
768 } 775 }
769 break; 776 break;
770 case 2: 777 case 2:
771 { 778 {
772 videoView->clear(); 779 videoView->clear();
773 populateVideoView(); 780 populateVideoView();
774 if( !tbDeletePlaylist->isHidden()) 781 if( !tbDeletePlaylist->isHidden())
775 tbDeletePlaylist->hide(); 782 tbDeletePlaylist->hide();
776 d->tbRemoveFromList->setEnabled(FALSE); 783 d->tbRemoveFromList->setEnabled(FALSE);
777 d->tbAddToList->setEnabled(TRUE); 784 d->tbAddToList->setEnabled(TRUE);
778 } 785 }
779 break; 786 break;
780 case 3: 787 case 3:
781 { 788 {
782 if( tbDeletePlaylist->isHidden()) 789 if( tbDeletePlaylist->isHidden())
783 tbDeletePlaylist->show(); 790 tbDeletePlaylist->show();
784 playLists->reread(); 791 playLists->reread();
785 } 792 }
786 break; 793 break;
787 }; 794 };
788} 795}
789 796
790void PlayListWidget::btnPlay(bool b) { 797void PlayListWidget::btnPlay(bool b) {
791 qDebug("<<<<<<<<<<<<<<<BtnPlay"); 798 qDebug("<<<<<<<<<<<<<<<BtnPlay");
792// mediaPlayerState->setPlaying(b); 799// mediaPlayerState->setPlaying(b);
793 switch ( tabWidget->currentPageIndex()) { 800 switch ( tabWidget->currentPageIndex()) {
794 case 0: 801 case 0:
795 { 802 {
796 qDebug("1"); 803 qDebug("1");
797// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 804// if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
798// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 805// if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
799// QMessageBox::message("Note","You are trying to play\na malformed url."); 806// QMessageBox::message("Note","You are trying to play\na malformed url.");
800// } else { 807// } else {
801 mediaPlayerState->setPlaying(b); 808 mediaPlayerState->setPlaying(b);
802 insanityBool=FALSE; 809 insanityBool=FALSE;
803 qDebug("insanity"); 810 qDebug("insanity");
804// } 811// }
805 } 812 }
806 break; 813 break;
807 case 1: 814 case 1:
808 { 815 {
809 qDebug("2"); 816 qDebug("2");
817// d->selectedFiles->unSelect();
810 addToSelection( audioView->currentItem() ); 818 addToSelection( audioView->currentItem() );
811 mediaPlayerState->setPlaying(b); 819 mediaPlayerState->setPlaying(true);
812 d->selectedFiles->removeSelected( ); 820 d->selectedFiles->removeSelected( );
813 tabWidget->setCurrentPage(1); 821 d->selectedFiles->unSelect();
814 d->selectedFiles->unSelect(); 822 tabWidget->setCurrentPage(1);
815 insanityBool=FALSE; 823 insanityBool=FALSE;
816 }// audioView->clearSelection(); 824 }// audioView->clearSelection();
817 break; 825 break;
818 case 2: 826 case 2:
819 { 827 {
820 qDebug("3"); 828 qDebug("3");
821 829
822 addToSelection( videoView->currentItem() ); 830 addToSelection( videoView->currentItem() );
823 mediaPlayerState->setPlaying(b); 831 mediaPlayerState->setPlaying(true);
824 qApp->processEvents(); 832// qApp->processEvents();
825 d->selectedFiles->removeSelected( ); 833 d->selectedFiles->removeSelected( );
826 tabWidget->setCurrentPage(2);
827 d->selectedFiles->unSelect(); 834 d->selectedFiles->unSelect();
835 tabWidget->setCurrentPage(2);
828 insanityBool=FALSE; 836 insanityBool=FALSE;
829 }// videoView->clearSelection(); 837 }// videoView->clearSelection();
830 break; 838 break;
831 }; 839 };
832 840
833} 841}
834 842
835void PlayListWidget::deletePlaylist() { 843void PlayListWidget::deletePlaylist() {
836 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 844 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
837 (tr("You really want to delete\nthis playlist?")), 845 (tr("You really want to delete\nthis playlist?")),
838 (tr("Yes")), (tr("No")), 0 )){ 846 (tr("Yes")), (tr("No")), 0 )){
839 case 0: // Yes clicked, 847 case 0: // Yes clicked,
840 QFile().remove(playLists->selectedDocument().file()); 848 QFile().remove(playLists->selectedDocument().file());
841 QFile().remove(playLists->selectedDocument().linkFile()); 849 QFile().remove(playLists->selectedDocument().linkFile());
842 playLists->reread(); 850 playLists->reread();
843 break; 851 break;
844 case 1: // Cancel 852 case 1: // Cancel
845 break; 853 break;
846 }; 854 };
847} 855}
848 856
849void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) 857void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int )
850{ 858{
851 switch (mouse) { 859 switch (mouse) {
852 case 1: 860 case 1:
853 break; 861 break;
854 case 2:{ 862 case 2:{
855 863
856 QPopupMenu m; 864 QPopupMenu m;
857 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 865 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
858 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 866 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
859 m.insertSeparator(); 867 m.insertSeparator();
860 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 868 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
861 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 869 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
862 870
863 m.exec( QCursor::pos() ); 871 m.exec( QCursor::pos() );
864 } 872 }
865 break; 873 break;
866 }; 874 };
867} 875}
868 876
869void PlayListWidget::playSelected() 877void PlayListWidget::playSelected()
870{ 878{
871 qDebug("playSelected"); 879 qDebug("playSelected");
872 btnPlay( true); 880 btnPlay( true);
873// d->selectedFiles->unSelect(); 881// d->selectedFiles->unSelect();
874} 882}
875 883