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