summaryrefslogtreecommitdiff
authorzecke <zecke>2004-06-29 20:04:17 (UTC)
committer zecke <zecke>2004-06-29 20:04:17 (UTC)
commitc4405f8d22769e9881484d3f7640e4ba87ed75ee (patch) (unidiff)
treeaf997b01742c9b7762babca007edf1310c455289
parent8bd9d5e9416166a1bb9a3f455ebf73a14628c628 (diff)
downloadopie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.zip
opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.gz
opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.bz2
As pointed out by bradc OpiePlayer2 is not able to open desktop files.
Now we check if it is a valid desktop file and then ask for the DocLnk::file() and then use that for open.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6a15134..36f77be 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1046 +1,1052 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "playlistselection.h" 34#include "playlistselection.h"
35#include "playlistwidget.h" 35#include "playlistwidget.h"
36#include "mediaplayer.h" 36#include "mediaplayer.h"
37#include "inputDialog.h" 37#include "inputDialog.h"
38#include "om3u.h" 38#include "om3u.h"
39#include "playlistfileview.h" 39#include "playlistfileview.h"
40 40
41/* OPIE */ 41/* OPIE */
42#include <opie2/odebug.h> 42#include <opie2/odebug.h>
43#include <opie2/ofiledialog.h> 43#include <opie2/ofiledialog.h>
44using namespace Opie::Core; 44using namespace Opie::Core;
45using namespace Opie::Ui; 45using namespace Opie::Ui;
46 46
47/* QT */ 47/* QT */
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qtoolbar.h> 49#include <qtoolbar.h>
50 50
51/* STD */ 51/* STD */
52#include <assert.h> 52#include <assert.h>
53 53
54PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) 54PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
56{ 56{
57 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 57 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
58 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 58 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
59 59
60 60
61 61
62 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 62 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
63 "opieplayer2/add_to_playlist", 63 "opieplayer2/add_to_playlist",
64 this , SLOT(addSelected() ) ); 64 this , SLOT(addSelected() ) );
65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
66 "opieplayer2/remove_from_playlist", 66 "opieplayer2/remove_from_playlist",
67 this , SLOT(removeSelected() ) ); 67 this , SLOT(removeSelected() ) );
68 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 68 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
69 this , SLOT( btnPlay(bool) ), TRUE ); 69 this , SLOT( btnPlay(bool) ), TRUE );
70 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 70 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
71 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); 71 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE );
72 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 72 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
73 mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); 73 mediaPlayerState, SLOT( setLooping(bool) ), TRUE );
74 74
75 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 75 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
76 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 76 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
77 this, SLOT( addAllMusicToList() ) ); 77 this, SLOT( addAllMusicToList() ) );
78 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 78 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
79 this, SLOT( addAllVideoToList() ) ); 79 this, SLOT( addAllVideoToList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 80 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
81 this, SLOT( addAllToList() ) ); 81 this, SLOT( addAllToList() ) );
82 pmPlayList->insertSeparator(-1); 82 pmPlayList->insertSeparator(-1);
83 (void)new MenuItem( pmPlayList, tr( "Add File" ), 83 (void)new MenuItem( pmPlayList, tr( "Add File" ),
84 this,SLOT( openFile() ) ); 84 this,SLOT( openFile() ) );
85 (void)new MenuItem( pmPlayList, tr("Add URL"), 85 (void)new MenuItem( pmPlayList, tr("Add URL"),
86 this,SLOT( openURL() ) ); 86 this,SLOT( openURL() ) );
87 pmPlayList->insertSeparator(-1); 87 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 88 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
89 this, SLOT(writem3u() ) ); 89 this, SLOT(writem3u() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 91 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
92 audioView, SLOT( scanFiles() ) ); 92 audioView, SLOT( scanFiles() ) );
93 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 93 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
94 videoView, SLOT( scanFiles() ) ); 94 videoView, SLOT( scanFiles() ) );
95 95
96 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 96 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
97 mediaPlayerState, SLOT( toggleFullscreen() ) ); 97 mediaPlayerState, SLOT( toggleFullscreen() ) );
98 98
99 Config cfg( "OpiePlayer" ); 99 Config cfg( "OpiePlayer" );
100 bool b= cfg.readBoolEntry("FullScreen", 0); 100 bool b= cfg.readBoolEntry("FullScreen", 0);
101 mediaPlayerState->setFullscreen( b ); 101 mediaPlayerState->setFullscreen( b );
102 pmView->setItemChecked( -16, b ); 102 pmView->setItemChecked( -16, b );
103 103
104 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 104 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
105 d->selectedFiles, SLOT(moveSelectedUp() ) ); 105 d->selectedFiles, SLOT(moveSelectedUp() ) );
106 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 106 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
107 d->selectedFiles, SLOT(removeSelected() ) ); 107 d->selectedFiles, SLOT(removeSelected() ) );
108 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 108 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
109 d->selectedFiles, SLOT(moveSelectedDown() ) ); 109 d->selectedFiles, SLOT(moveSelectedDown() ) );
110 QVBox *stretch2 = new QVBox( vbox1 ); 110 QVBox *stretch2 = new QVBox( vbox1 );
111 111
112 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 112 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
113 SLOT( deletePlaylist() ) ); 113 SLOT( deletePlaylist() ) );
114 connect( pmView, SIGNAL( activated(int) ), 114 connect( pmView, SIGNAL( activated(int) ),
115 this, SLOT( pmViewActivated(int) ) ); 115 this, SLOT( pmViewActivated(int) ) );
116 connect( skinsMenu, SIGNAL( activated(int) ) , 116 connect( skinsMenu, SIGNAL( activated(int) ) ,
117 this, SLOT( skinsMenuActivated(int) ) ); 117 this, SLOT( skinsMenuActivated(int) ) );
118 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 118 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
119 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); 119 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) );
120 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 120 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
121 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 121 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
122 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), 122 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ),
123 this,SLOT( playIt(QListViewItem*) ) ); 123 this,SLOT( playIt(QListViewItem*) ) );
124 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), 124 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ),
125 this, SLOT( addToSelection(QListViewItem*) ) ); 125 this, SLOT( addToSelection(QListViewItem*) ) );
126 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 126 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
127 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 127 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
128 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), 128 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ),
129 this,SLOT( playIt(QListViewItem*) ) ); 129 this,SLOT( playIt(QListViewItem*) ) );
130 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), 130 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ),
131 this, SLOT( addToSelection(QListViewItem*) ) ); 131 this, SLOT( addToSelection(QListViewItem*) ) );
132 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), 132 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ),
133 this, SLOT( loadList(const DocLnk&) ) ); 133 this, SLOT( loadList(const DocLnk&) ) );
134 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 134 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
135 this, SLOT( tabChanged(QWidget*) ) ); 135 this, SLOT( tabChanged(QWidget*) ) );
136 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), 136 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ),
137 d->tbPlay, SLOT( setOn(bool) ) ); 137 d->tbPlay, SLOT( setOn(bool) ) );
138 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), 138 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ),
139 d->tbLoop, SLOT( setOn(bool) ) ); 139 d->tbLoop, SLOT( setOn(bool) ) );
140 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), 140 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ),
141 d->tbShuffle, SLOT( setOn(bool) ) ); 141 d->tbShuffle, SLOT( setOn(bool) ) );
142 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), 142 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ),
143 this, SLOT( playIt(QListViewItem*) ) ); 143 this, SLOT( playIt(QListViewItem*) ) );
144 connect ( gammaSlider, SIGNAL( valueChanged(int) ), 144 connect ( gammaSlider, SIGNAL( valueChanged(int) ),
145 mediaPlayerState, SLOT( setVideoGamma(int) ) ); 145 mediaPlayerState, SLOT( setVideoGamma(int) ) );
146 146
147 connect( this, SIGNAL(skinSelected() ), 147 connect( this, SIGNAL(skinSelected() ),
148 m_mp, SLOT( reloadSkins() ) ); 148 m_mp, SLOT( reloadSkins() ) );
149 149
150 // see which skins are installed 150 // see which skins are installed
151 populateSkinsMenu(); 151 populateSkinsMenu();
152 initializeStates(); 152 initializeStates();
153 153
154 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 154 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
155 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 155 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
156 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); 156 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
157 157
158 158
159 cfg.setGroup("PlayList"); 159 cfg.setGroup("PlayList");
160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
161 loadList(DocLnk( currentPlaylist ) ); 161 loadList(DocLnk( currentPlaylist ) );
162 162
163 tabWidget->showPage( playListTab ); 163 tabWidget->showPage( playListTab );
164} 164}
165 165
166 166
167PlayListWidget::~PlayListWidget() { 167PlayListWidget::~PlayListWidget() {
168 delete d; 168 delete d;
169 delete m_mp; 169 delete m_mp;
170} 170}
171 171
172 172
173void PlayListWidget::initializeStates() { 173void PlayListWidget::initializeStates() {
174 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 174 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
175 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 175 d->tbLoop->setOn( mediaPlayerState->isLooping() );
176 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 176 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
177 d->playListFrame->show(); 177 d->playListFrame->show();
178} 178}
179 179
180void PlayListWidget::writeDefaultPlaylist() { 180void PlayListWidget::writeDefaultPlaylist() {
181 181
182 Config config( "OpiePlayer" ); 182 Config config( "OpiePlayer" );
183 config.setGroup( "PlayList" ); 183 config.setGroup( "PlayList" );
184 QString filename=QPEApplication::documentDir() + "/default.m3u"; 184 QString filename=QPEApplication::documentDir() + "/default.m3u";
185 QString currentString = config.readEntry( "CurrentPlaylist", filename); 185 QString currentString = config.readEntry( "CurrentPlaylist", filename);
186 if( currentString == filename) { 186 if( currentString == filename) {
187 Om3u *m3uList; 187 Om3u *m3uList;
188 // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl; 188 // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
189 if( d->selectedFiles->first() ) { 189 if( d->selectedFiles->first() ) {
190 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 190 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
191 do { 191 do {
192 // odebug << d->selectedFiles->current()->file() << oendl; 192 // odebug << d->selectedFiles->current()->file() << oendl;
193 m3uList->add( d->selectedFiles->current()->file() ); 193 m3uList->add( d->selectedFiles->current()->file() );
194 } 194 }
195 while ( d->selectedFiles->next() ); 195 while ( d->selectedFiles->next() );
196 196
197 m3uList->write(); 197 m3uList->write();
198 m3uList->close(); 198 m3uList->close();
199 delete m3uList; 199 delete m3uList;
200 200
201 } 201 }
202 } 202 }
203} 203}
204 204
205void PlayListWidget::addToSelection( const DocLnk& lnk ) { 205void PlayListWidget::addToSelection( const DocLnk& lnk ) {
206 d->setDocumentUsed = FALSE; 206 d->setDocumentUsed = FALSE;
207 if( QFileInfo( lnk.file() ).exists() || 207 if( QFileInfo( lnk.file() ).exists() ||
208 lnk.file().left(4) == "http" ) { 208 lnk.file().left(4) == "http" ) {
209 d->selectedFiles->addToSelection( lnk ); 209 d->selectedFiles->addToSelection( lnk );
210 } 210 }
211// writeCurrentM3u(); 211// writeCurrentM3u();
212} 212}
213 213
214 214
215void PlayListWidget::clearList() { 215void PlayListWidget::clearList() {
216 while ( first() ) { 216 while ( first() ) {
217 d->selectedFiles->removeSelected(); 217 d->selectedFiles->removeSelected();
218 } 218 }
219 Config cfg( "OpiePlayer" ); 219 Config cfg( "OpiePlayer" );
220 cfg.setGroup("PlayList"); 220 cfg.setGroup("PlayList");
221 cfg.writeEntry("CurrentPlaylist","default"); 221 cfg.writeEntry("CurrentPlaylist","default");
222 setCaption("OpiePlayer"); 222 setCaption("OpiePlayer");
223} 223}
224 224
225void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 225void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
226 switch (mouse) { 226 switch (mouse) {
227 case LeftButton: 227 case LeftButton:
228 break; 228 break;
229 case RightButton: 229 case RightButton:
230 { 230 {
231 QPopupMenu m; 231 QPopupMenu m;
232 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 232 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
233 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 233 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
234 m.exec( QCursor::pos() ); 234 m.exec( QCursor::pos() );
235 } 235 }
236 break; 236 break;
237 } 237 }
238} 238}
239 239
240 240
241void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 241void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
242 switch (mouse) { 242 switch (mouse) {
243 case LeftButton: 243 case LeftButton:
244 break; 244 break;
245 case RightButton: 245 case RightButton:
246 { 246 {
247 QPopupMenu m; 247 QPopupMenu m;
248 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 248 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
249 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 249 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
250 m.exec( QCursor::pos() ); 250 m.exec( QCursor::pos() );
251 } 251 }
252 break; 252 break;
253 } 253 }
254} 254}
255 255
256 256
257void PlayListWidget::addAllToList() { 257void PlayListWidget::addAllToList() {
258 258
259 259
260 audioView->populateView(); 260 audioView->populateView();
261 261
262 QListViewItemIterator audioIt( audioView ); 262 QListViewItemIterator audioIt( audioView );
263 DocLnk lnk; 263 DocLnk lnk;
264 QString filename; 264 QString filename;
265 // iterate through all items of the listview 265 // iterate through all items of the listview
266 for ( ; audioIt.current(); ++audioIt ) { 266 for ( ; audioIt.current(); ++audioIt ) {
267 filename = audioIt.current()->text(3); 267 filename = audioIt.current()->text(3);
268 lnk.setName( QFileInfo(filename).baseName() ); //sets name 268 lnk.setName( QFileInfo(filename).baseName() ); //sets name
269 lnk.setFile( filename ); //sets file name 269 lnk.setFile( filename ); //sets file name
270 d->selectedFiles->addToSelection( lnk); 270 d->selectedFiles->addToSelection( lnk);
271 } 271 }
272 272
273 videoView->populateView(); 273 videoView->populateView();
274 274
275 QListViewItemIterator videoIt( videoView ); 275 QListViewItemIterator videoIt( videoView );
276 for ( ; videoIt.current(); ++videoIt ) { 276 for ( ; videoIt.current(); ++videoIt ) {
277 filename = videoIt.current()->text(3); 277 filename = videoIt.current()->text(3);
278 lnk.setName( QFileInfo(filename).baseName() ); //sets name 278 lnk.setName( QFileInfo(filename).baseName() ); //sets name
279 lnk.setFile( filename ); //sets file name 279 lnk.setFile( filename ); //sets file name
280 d->selectedFiles->addToSelection( lnk); 280 d->selectedFiles->addToSelection( lnk);
281 } 281 }
282 282
283 tabWidget->setCurrentPage(0); 283 tabWidget->setCurrentPage(0);
284 284
285 writeCurrentM3u(); 285 writeCurrentM3u();
286 d->selectedFiles->first(); 286 d->selectedFiles->first();
287} 287}
288 288
289 289
290void PlayListWidget::addAllMusicToList() { 290void PlayListWidget::addAllMusicToList() {
291 291
292 audioView->populateView(); 292 audioView->populateView();
293 293
294 QListViewItemIterator audioIt( audioView ); 294 QListViewItemIterator audioIt( audioView );
295 DocLnk lnk; 295 DocLnk lnk;
296 QString filename; 296 QString filename;
297 // iterate through all items of the listview 297 // iterate through all items of the listview
298 for ( ; audioIt.current(); ++audioIt ) { 298 for ( ; audioIt.current(); ++audioIt ) {
299 filename = audioIt.current()->text(3); 299 filename = audioIt.current()->text(3);
300 lnk.setName( QFileInfo(filename).baseName() ); //sets name 300 lnk.setName( QFileInfo(filename).baseName() ); //sets name
301 lnk.setFile( filename ); //sets file name 301 lnk.setFile( filename ); //sets file name
302 d->selectedFiles->addToSelection( lnk); 302 d->selectedFiles->addToSelection( lnk);
303 } 303 }
304 304
305 tabWidget->setCurrentPage(0); 305 tabWidget->setCurrentPage(0);
306 writeCurrentM3u(); 306 writeCurrentM3u();
307 d->selectedFiles->first(); 307 d->selectedFiles->first();
308} 308}
309 309
310 310
311void PlayListWidget::addAllVideoToList() { 311void PlayListWidget::addAllVideoToList() {
312 312
313 videoView->populateView(); 313 videoView->populateView();
314 314
315 QListViewItemIterator videoIt( videoView ); 315 QListViewItemIterator videoIt( videoView );
316 DocLnk lnk; 316 DocLnk lnk;
317 QString filename; 317 QString filename;
318 for ( ; videoIt.current(); ++videoIt ) { 318 for ( ; videoIt.current(); ++videoIt ) {
319 filename = videoIt.current()->text(3); 319 filename = videoIt.current()->text(3);
320 lnk.setName( QFileInfo(filename).baseName() ); //sets name 320 lnk.setName( QFileInfo(filename).baseName() ); //sets name
321 lnk.setFile( filename ); //sets file name 321 lnk.setFile( filename ); //sets file name
322 d->selectedFiles->addToSelection( lnk); 322 d->selectedFiles->addToSelection( lnk);
323 } 323 }
324 tabWidget->setCurrentPage(0); 324 tabWidget->setCurrentPage(0);
325 writeCurrentM3u(); 325 writeCurrentM3u();
326 d->selectedFiles->first(); 326 d->selectedFiles->first();
327} 327}
328 328
329 329
330void PlayListWidget::setDocument( const QString& fileref ) { 330void PlayListWidget::setDocument( const QString& _fileref ) {
331 // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; 331 // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
332 QString fileref = _fileref;
332 fromSetDocument = TRUE; 333 fromSetDocument = TRUE;
334
335 DocLnk lnk(_fileref);
336 if(lnk.isValid())
337 fileref = lnk.file();
338
333 QFileInfo fileInfo(fileref); 339 QFileInfo fileInfo(fileref);
334 340
335 if ( !fileInfo.exists() ) { 341 if ( !fileInfo.exists() ) {
336 QMessageBox::warning( this, tr( "Invalid File" ), 342 QMessageBox::warning( this, tr( "Invalid File" ),
337 tr( "There was a problem in getting the file." ) ); 343 tr( "There was a problem in getting the file." ) );
338 return; 344 return;
339 } 345 }
340 346
341 clearList(); 347 clearList();
342 QString extension = fileInfo.extension(false); 348 QString extension = fileInfo.extension(false);
343 349
344 if( extension.find( "m3u", 0, false) != -1 350 if( extension.find( "m3u", 0, false) != -1
345 || extension.find( "pls", 0, false) != -1 ) { 351 || extension.find( "pls", 0, false) != -1 ) {
346 readListFromFile( fileref ); 352 readListFromFile( fileref );
347 } else { 353 } else {
348 clearList(); 354 clearList();
349 DocLnk lnk; 355 DocLnk lnk;
350 lnk.setName( fileInfo.baseName() ); //sets name 356 lnk.setName( fileInfo.baseName() ); //sets name
351 lnk.setFile( fileref ); //sets file name 357 lnk.setFile( fileref ); //sets file name
352 addToSelection( lnk ); 358 addToSelection( lnk );
353 writeCurrentM3u(); 359 writeCurrentM3u();
354 360
355 d->setDocumentUsed = TRUE; 361 d->setDocumentUsed = TRUE;
356 mediaPlayerState->setPlaying( FALSE ); 362 mediaPlayerState->setPlaying( FALSE );
357 mediaPlayerState->setPlaying( TRUE ); 363 mediaPlayerState->setPlaying( TRUE );
358 } 364 }
359} 365}
360 366
361 367
362void PlayListWidget::useSelectedDocument() { 368void PlayListWidget::useSelectedDocument() {
363 d->setDocumentUsed = FALSE; 369 d->setDocumentUsed = FALSE;
364} 370}
365 371
366 372
367const DocLnk *PlayListWidget::current() const { // this is fugly 373const DocLnk *PlayListWidget::current() const { // this is fugly
368 assert( currentTab() == CurrentPlayList ); 374 assert( currentTab() == CurrentPlayList );
369 375
370 const DocLnk *lnk = d->selectedFiles->current(); 376 const DocLnk *lnk = d->selectedFiles->current();
371 if ( !lnk ) { 377 if ( !lnk ) {
372 d->selectedFiles->first(); 378 d->selectedFiles->first();
373 lnk = d->selectedFiles->current(); 379 lnk = d->selectedFiles->current();
374 } 380 }
375 assert( lnk ); 381 assert( lnk );
376 return lnk; 382 return lnk;
377} 383}
378 384
379 385
380bool PlayListWidget::prev() { 386bool PlayListWidget::prev() {
381 if ( mediaPlayerState->isShuffled() ) { 387 if ( mediaPlayerState->isShuffled() ) {
382 const DocLnk *cur = current(); 388 const DocLnk *cur = current();
383 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 389 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
384 for ( int i = 0; i < j; i++ ) { 390 for ( int i = 0; i < j; i++ ) {
385 if ( !d->selectedFiles->next() ) 391 if ( !d->selectedFiles->next() )
386 d->selectedFiles->first(); 392 d->selectedFiles->first();
387 } 393 }
388 if ( cur == current() ) 394 if ( cur == current() )
389 if ( !d->selectedFiles->next() ) { 395 if ( !d->selectedFiles->next() ) {
390 d->selectedFiles->first(); 396 d->selectedFiles->first();
391 } 397 }
392 return TRUE; 398 return TRUE;
393 } else { 399 } else {
394 if ( !d->selectedFiles->prev() ) { 400 if ( !d->selectedFiles->prev() ) {
395 if ( mediaPlayerState->isLooping() ) { 401 if ( mediaPlayerState->isLooping() ) {
396 return d->selectedFiles->last(); 402 return d->selectedFiles->last();
397 } else { 403 } else {
398 return FALSE; 404 return FALSE;
399 } 405 }
400 } 406 }
401 return TRUE; 407 return TRUE;
402 } 408 }
403} 409}
404 410
405 411
406bool PlayListWidget::next() { 412bool PlayListWidget::next() {
407//odebug << "<<<<<<<<<<<<next()" << oendl; 413//odebug << "<<<<<<<<<<<<next()" << oendl;
408 if ( mediaPlayerState->isShuffled() ) { 414 if ( mediaPlayerState->isShuffled() ) {
409 return prev(); 415 return prev();
410 } else { 416 } else {
411 if ( !d->selectedFiles->next() ) { 417 if ( !d->selectedFiles->next() ) {
412 if ( mediaPlayerState->isLooping() ) { 418 if ( mediaPlayerState->isLooping() ) {
413 return d->selectedFiles->first(); 419 return d->selectedFiles->first();
414 } else { 420 } else {
415 return FALSE; 421 return FALSE;
416 } 422 }
417 } 423 }
418 return TRUE; 424 return TRUE;
419 } 425 }
420} 426}
421 427
422 428
423bool PlayListWidget::first() { 429bool PlayListWidget::first() {
424 return d->selectedFiles->first(); 430 return d->selectedFiles->first();
425} 431}
426 432
427 433
428bool PlayListWidget::last() { 434bool PlayListWidget::last() {
429 return d->selectedFiles->last(); 435 return d->selectedFiles->last();
430} 436}
431 437
432 438
433 void PlayListWidget::saveList() { 439 void PlayListWidget::saveList() {
434 writem3u(); 440 writem3u();
435 } 441 }
436 442
437 443
438void PlayListWidget::loadList( const DocLnk & lnk) { 444void PlayListWidget::loadList( const DocLnk & lnk) {
439 QString name = lnk.name(); 445 QString name = lnk.name();
440 446
441 if( name.length()>0) { 447 if( name.length()>0) {
442 setCaption("OpiePlayer: "+name); 448 setCaption("OpiePlayer: "+name);
443 clearList(); 449 clearList();
444 readListFromFile(lnk.file()); 450 readListFromFile(lnk.file());
445 tabWidget->setCurrentPage(0); 451 tabWidget->setCurrentPage(0);
446 } 452 }
447} 453}
448 454
449void PlayListWidget::addSelected() { 455void PlayListWidget::addSelected() {
450 assert( inFileListMode() ); 456 assert( inFileListMode() );
451 457
452 QListViewItemIterator it( currentFileListView ); 458 QListViewItemIterator it( currentFileListView );
453 for ( ; it.current(); ++it ) 459 for ( ; it.current(); ++it )
454 if ( it.current()->isSelected() ) { 460 if ( it.current()->isSelected() ) {
455 QString filename = it.current()->text(3); 461 QString filename = it.current()->text(3);
456 462
457 DocLnk lnk; 463 DocLnk lnk;
458 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 464 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
459 lnk.setFile( filename ); //sets file name 465 lnk.setFile( filename ); //sets file name
460 466
461 d->selectedFiles->addToSelection( lnk ); 467 d->selectedFiles->addToSelection( lnk );
462 } 468 }
463 469
464 currentFileListView->clearSelection(); 470 currentFileListView->clearSelection();
465 471
466 writeCurrentM3u(); 472 writeCurrentM3u();
467} 473}
468 474
469 475
470void PlayListWidget::removeSelected() { 476void PlayListWidget::removeSelected() {
471 d->selectedFiles->removeSelected( ); 477 d->selectedFiles->removeSelected( );
472 writeCurrentM3u(); 478 writeCurrentM3u();
473} 479}
474 480
475 481
476void PlayListWidget::playIt( QListViewItem *it) { 482void PlayListWidget::playIt( QListViewItem *it) {
477 if(!it) return; 483 if(!it) return;
478 mediaPlayerState->setPlaying(FALSE); 484 mediaPlayerState->setPlaying(FALSE);
479 mediaPlayerState->setPlaying(TRUE); 485 mediaPlayerState->setPlaying(TRUE);
480 d->selectedFiles->unSelect(); 486 d->selectedFiles->unSelect();
481} 487}
482 488
483 489
484void PlayListWidget::addToSelection( QListViewItem *it) { 490void PlayListWidget::addToSelection( QListViewItem *it) {
485 d->setDocumentUsed = FALSE; 491 d->setDocumentUsed = FALSE;
486 492
487 if(it) { 493 if(it) {
488 if ( currentTab() == CurrentPlayList ) 494 if ( currentTab() == CurrentPlayList )
489 return; 495 return;
490 DocLnk lnk; 496 DocLnk lnk;
491 QString filename; 497 QString filename;
492 498
493 filename=it->text(3); 499 filename=it->text(3);
494 lnk.setName( QFileInfo(filename).baseName() ); //sets name 500 lnk.setName( QFileInfo(filename).baseName() ); //sets name
495 lnk.setFile( filename ); //sets file name 501 lnk.setFile( filename ); //sets file name
496 d->selectedFiles->addToSelection( lnk); 502 d->selectedFiles->addToSelection( lnk);
497 503
498 writeCurrentM3u(); 504 writeCurrentM3u();
499// tabWidget->setCurrentPage(0); 505// tabWidget->setCurrentPage(0);
500 506
501 } 507 }
502} 508}
503 509
504 510
505void PlayListWidget::tabChanged(QWidget *) { 511void PlayListWidget::tabChanged(QWidget *) {
506 512
507 d->tbPlay->setEnabled( true ); 513 d->tbPlay->setEnabled( true );
508 514
509 disconnect( audioView, SIGNAL( itemsSelected(bool) ), 515 disconnect( audioView, SIGNAL( itemsSelected(bool) ),
510 d->tbPlay, SLOT( setEnabled(bool) ) ); 516 d->tbPlay, SLOT( setEnabled(bool) ) );
511 disconnect( videoView, SIGNAL( itemsSelected(bool) ), 517 disconnect( videoView, SIGNAL( itemsSelected(bool) ),
512 d->tbPlay, SLOT( setEnabled(bool) ) ); 518 d->tbPlay, SLOT( setEnabled(bool) ) );
513 519
514 currentFileListView = 0; 520 currentFileListView = 0;
515 521
516 switch ( currentTab() ) { 522 switch ( currentTab() ) {
517 case CurrentPlayList: 523 case CurrentPlayList:
518 { 524 {
519 if( !tbDeletePlaylist->isHidden() ) { 525 if( !tbDeletePlaylist->isHidden() ) {
520 tbDeletePlaylist->hide(); 526 tbDeletePlaylist->hide();
521 } 527 }
522 d->tbRemoveFromList->setEnabled(TRUE); 528 d->tbRemoveFromList->setEnabled(TRUE);
523 d->tbAddToList->setEnabled(FALSE); 529 d->tbAddToList->setEnabled(FALSE);
524 530
525 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 531 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
526 } 532 }
527 break; 533 break;
528 case AudioFiles: 534 case AudioFiles:
529 { 535 {
530 audioView->populateView(); 536 audioView->populateView();
531 537
532 if( !tbDeletePlaylist->isHidden() ) { 538 if( !tbDeletePlaylist->isHidden() ) {
533 tbDeletePlaylist->hide(); 539 tbDeletePlaylist->hide();
534 } 540 }
535 d->tbRemoveFromList->setEnabled(FALSE); 541 d->tbRemoveFromList->setEnabled(FALSE);
536 d->tbAddToList->setEnabled(TRUE); 542 d->tbAddToList->setEnabled(TRUE);
537 543
538 connect( audioView, SIGNAL( itemsSelected(bool) ), 544 connect( audioView, SIGNAL( itemsSelected(bool) ),
539 d->tbPlay, SLOT( setEnabled(bool) ) ); 545 d->tbPlay, SLOT( setEnabled(bool) ) );
540 546
541 d->tbPlay->setEnabled( audioView->hasSelection() ); 547 d->tbPlay->setEnabled( audioView->hasSelection() );
542 548
543 currentFileListView = audioView; 549 currentFileListView = audioView;
544 } 550 }
545 break; 551 break;
546 case VideoFiles: 552 case VideoFiles:
547 { 553 {
548 videoView->populateView(); 554 videoView->populateView();
549 if( !tbDeletePlaylist->isHidden() ) { 555 if( !tbDeletePlaylist->isHidden() ) {
550 tbDeletePlaylist->hide(); 556 tbDeletePlaylist->hide();
551 } 557 }
552 d->tbRemoveFromList->setEnabled(FALSE); 558 d->tbRemoveFromList->setEnabled(FALSE);
553 d->tbAddToList->setEnabled(TRUE); 559 d->tbAddToList->setEnabled(TRUE);
554 560
555 connect( videoView, SIGNAL( itemsSelected(bool) ), 561 connect( videoView, SIGNAL( itemsSelected(bool) ),
556 d->tbPlay, SLOT( setEnabled(bool) ) ); 562 d->tbPlay, SLOT( setEnabled(bool) ) );
557 563
558 d->tbPlay->setEnabled( videoView->hasSelection() ); 564 d->tbPlay->setEnabled( videoView->hasSelection() );
559 565
560 currentFileListView = videoView; 566 currentFileListView = videoView;
561 } 567 }
562 break; 568 break;
563 case PlayLists: 569 case PlayLists:
564 { 570 {
565 if( tbDeletePlaylist->isHidden() ) { 571 if( tbDeletePlaylist->isHidden() ) {
566 tbDeletePlaylist->show(); 572 tbDeletePlaylist->show();
567 } 573 }
568 playLists->reread(); 574 playLists->reread();
569 d->tbAddToList->setEnabled(FALSE); 575 d->tbAddToList->setEnabled(FALSE);
570 576
571 d->tbPlay->setEnabled( false ); 577 d->tbPlay->setEnabled( false );
572 } 578 }
573 break; 579 break;
574 }; 580 };
575} 581}
576 582
577 583
578void PlayListWidget::btnPlay(bool b) { 584void PlayListWidget::btnPlay(bool b) {
579// mediaPlayerState->setPlaying(false); 585// mediaPlayerState->setPlaying(false);
580 mediaPlayerState->setPlaying(b); 586 mediaPlayerState->setPlaying(b);
581 insanityBool=FALSE; 587 insanityBool=FALSE;
582} 588}
583 589
584void PlayListWidget::deletePlaylist() { 590void PlayListWidget::deletePlaylist() {
585 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 591 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
586 (tr("You really want to delete\nthis playlist?")), 592 (tr("You really want to delete\nthis playlist?")),
587 (tr("Yes")), (tr("No")), 0 )){ 593 (tr("Yes")), (tr("No")), 0 )){
588 case 0: // Yes clicked, 594 case 0: // Yes clicked,
589 QFile().remove(playLists->selectedDocument().file()); 595 QFile().remove(playLists->selectedDocument().file());
590 QFile().remove(playLists->selectedDocument().linkFile()); 596 QFile().remove(playLists->selectedDocument().linkFile());
591 playLists->reread(); 597 playLists->reread();
592 break; 598 break;
593 case 1: // Cancel 599 case 1: // Cancel
594 break; 600 break;
595 }; 601 };
596} 602}
597 603
598 604
599void PlayListWidget::playSelected() { 605void PlayListWidget::playSelected() {
600 btnPlay( TRUE); 606 btnPlay( TRUE);
601} 607}
602 608
603bool PlayListWidget::inFileListMode() const 609bool PlayListWidget::inFileListMode() const
604{ 610{
605 TabType tab = currentTab(); 611 TabType tab = currentTab();
606 return tab == AudioFiles || tab == VideoFiles; 612 return tab == AudioFiles || tab == VideoFiles;
607} 613}
608 614
609void PlayListWidget::openURL() { 615void PlayListWidget::openURL() {
610 // http://66.28.164.33:2080 616 // http://66.28.164.33:2080
611 // http://somafm.com/star0242.m3u 617 // http://somafm.com/star0242.m3u
612 QString filename, name; 618 QString filename, name;
613 InputDialog *fileDlg; 619 InputDialog *fileDlg;
614 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 620 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
615 fileDlg->exec(); 621 fileDlg->exec();
616 if( fileDlg->result() == 1 ) { 622 if( fileDlg->result() == 1 ) {
617 filename = fileDlg->text(); 623 filename = fileDlg->text();
618 odebug << "Selected filename is " + filename << oendl; 624 odebug << "Selected filename is " + filename << oendl;
619 // Om3u *m3uList; 625 // Om3u *m3uList;
620 DocLnk lnk; 626 DocLnk lnk;
621 Config cfg( "OpiePlayer" ); 627 Config cfg( "OpiePlayer" );
622 cfg.setGroup("PlayList"); 628 cfg.setGroup("PlayList");
623 629
624 if(filename.left(4) == "http") { 630 if(filename.left(4) == "http") {
625 QString m3uFile, m3uFilePath; 631 QString m3uFile, m3uFilePath;
626 if(filename.find(":",8,TRUE) != -1) { //found a port 632 if(filename.find(":",8,TRUE) != -1) { //found a port
627 m3uFile = filename.left( filename.find( ":",8,TRUE)); 633 m3uFile = filename.left( filename.find( ":",8,TRUE));
628 m3uFile = m3uFile.right( 7); 634 m3uFile = m3uFile.right( 7);
629 } else if(filename.left(4) == "http"){ 635 } else if(filename.left(4) == "http"){
630 m3uFile=filename; 636 m3uFile=filename;
631 m3uFile = m3uFile.right( m3uFile.length() - 7); 637 m3uFile = m3uFile.right( m3uFile.length() - 7);
632 } else{ 638 } else{
633 m3uFile=filename; 639 m3uFile=filename;
634 } 640 }
635 641
636 lnk.setName( filename ); //sets name 642 lnk.setName( filename ); //sets name
637 lnk.setFile( filename ); //sets file name 643 lnk.setFile( filename ); //sets file name
638 644
639// lnk.setIcon("opieplayer2/musicfile"); 645// lnk.setIcon("opieplayer2/musicfile");
640 646
641 d->selectedFiles->addToSelection( lnk ); 647 d->selectedFiles->addToSelection( lnk );
642 writeCurrentM3u(); 648 writeCurrentM3u();
643 d->selectedFiles->setSelectedItem( lnk.name()); 649 d->selectedFiles->setSelectedItem( lnk.name());
644 } 650 }
645 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 651 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
646 readListFromFile( filename ); 652 readListFromFile( filename );
647 } else { 653 } else {
648 lnk.setName( QFileInfo(filename).baseName() ); //sets name 654 lnk.setName( QFileInfo(filename).baseName() ); //sets name
649 lnk.setFile( filename ); //sets file name 655 lnk.setFile( filename ); //sets file name
650 d->selectedFiles->addToSelection( lnk); 656 d->selectedFiles->addToSelection( lnk);
651 writeCurrentM3u(); 657 writeCurrentM3u();
652 d->selectedFiles->setSelectedItem( lnk.name()); 658 d->selectedFiles->setSelectedItem( lnk.name());
653 } 659 }
654 } 660 }
655 661
656 662
657 delete fileDlg; 663 delete fileDlg;
658} 664}
659 665
660 666
661void PlayListWidget::openFile() { 667void PlayListWidget::openFile() {
662 668
663 QString filename, name; 669 QString filename, name;
664 670
665 Config cfg( "OpiePlayer" ); 671 Config cfg( "OpiePlayer" );
666 cfg.setGroup("Dialog"); 672 cfg.setGroup("Dialog");
667 MimeTypes types; 673 MimeTypes types;
668 QStringList audio, video, all; 674 QStringList audio, video, all;
669 audio << "audio/*"; 675 audio << "audio/*";
670 audio << "playlist/plain"; 676 audio << "playlist/plain";
671 audio << "audio/x-ogg"; 677 audio << "audio/x-ogg";
672 audio << "audio/x-mpegurl"; 678 audio << "audio/x-mpegurl";
673 679
674 video << "video/*"; 680 video << "video/*";
675 video << "playlist/plain"; 681 video << "playlist/plain";
676 682
677 all += audio; 683 all += audio;
678 all += video; 684 all += video;
679 types.insert("All Media Files", all ); 685 types.insert("All Media Files", all );
680 types.insert("Audio", audio ); 686 types.insert("Audio", audio );
681 types.insert("Video", video ); 687 types.insert("Video", video );
682 688
683 QString str = OFileDialog::getOpenFileName( 1, 689 QString str = OFileDialog::getOpenFileName( 1,
684 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 690 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
685 types, 0 ); 691 types, 0 );
686 692
687 if(str.left(2) == "//") { 693 if(str.left(2) == "//") {
688 str=str.right(str.length()-1); 694 str=str.right(str.length()-1);
689 } 695 }
690 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); 696 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
691 697
692 if( !str.isEmpty() ) { 698 if( !str.isEmpty() ) {
693 699
694 odebug << "Selected filename is " + str << oendl; 700 odebug << "Selected filename is " + str << oendl;
695 filename = str; 701 filename = str;
696 DocLnk lnk; 702 DocLnk lnk;
697 703
698 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 704 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
699 readListFromFile( filename ); 705 readListFromFile( filename );
700 } else { 706 } else {
701 lnk.setName( QFileInfo(filename).baseName() ); //sets name 707 lnk.setName( QFileInfo(filename).baseName() ); //sets name
702 lnk.setFile( filename ); //sets file name 708 lnk.setFile( filename ); //sets file name
703 d->selectedFiles->addToSelection( lnk ); 709 d->selectedFiles->addToSelection( lnk );
704 writeCurrentM3u(); 710 writeCurrentM3u();
705 d->selectedFiles->setSelectedItem( lnk.name() ); 711 d->selectedFiles->setSelectedItem( lnk.name() );
706 } 712 }
707 } 713 }
708} 714}
709 715
710 716
711void PlayListWidget::readListFromFile( const QString &filename ) { 717void PlayListWidget::readListFromFile( const QString &filename ) {
712 odebug << "read list filename " + filename << oendl; 718 odebug << "read list filename " + filename << oendl;
713 QFileInfo fi(filename); 719 QFileInfo fi(filename);
714 Om3u *m3uList; 720 Om3u *m3uList;
715 QString s, name; 721 QString s, name;
716 m3uList = new Om3u( filename, IO_ReadOnly ); 722 m3uList = new Om3u( filename, IO_ReadOnly );
717 if(fi.extension(false).find("m3u",0,false) != -1 ) 723 if(fi.extension(false).find("m3u",0,false) != -1 )
718 m3uList->readM3u(); 724 m3uList->readM3u();
719 else if(fi.extension(false).find("pls",0,false) != -1 ) 725 else if(fi.extension(false).find("pls",0,false) != -1 )
720 m3uList->readPls(); 726 m3uList->readPls();
721 727
722 DocLnk lnk; 728 DocLnk lnk;
723 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 729 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
724 s = *it; 730 s = *it;
725 // odebug << s << oendl; 731 // odebug << s << oendl;
726 if(s.left(4)=="http") { 732 if(s.left(4)=="http") {
727 lnk.setName( s ); //sets file name 733 lnk.setName( s ); //sets file name
728 lnk.setIcon("opieplayer2/musicfile"); 734 lnk.setIcon("opieplayer2/musicfile");
729 lnk.setFile( s ); //sets file name 735 lnk.setFile( s ); //sets file name
730 736
731 } else { //is file 737 } else { //is file
732 lnk.setName( QFileInfo(s).baseName()); 738 lnk.setName( QFileInfo(s).baseName());
733 if(s.left(1) != "/") { 739 if(s.left(1) != "/") {
734 740
735 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 741 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
736 } else { 742 } else {
737 lnk.setFile( s); 743 lnk.setFile( s);
738 } 744 }
739 } 745 }
740 d->selectedFiles->addToSelection( lnk ); 746 d->selectedFiles->addToSelection( lnk );
741 } 747 }
742 Config config( "OpiePlayer" ); 748 Config config( "OpiePlayer" );
743 config.setGroup( "PlayList" ); 749 config.setGroup( "PlayList" );
744 750
745 config.writeEntry("CurrentPlaylist",filename); 751 config.writeEntry("CurrentPlaylist",filename);
746 config.write(); 752 config.write();
747 currentPlayList=filename; 753 currentPlayList=filename;
748 754
749 m3uList->close(); 755 m3uList->close();
750 delete m3uList; 756 delete m3uList;
751 757
752 d->selectedFiles->setSelectedItem( s); 758 d->selectedFiles->setSelectedItem( s);
753 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 759 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
754 760
755} 761}
756 762
757// writes current playlist to current m3u file */ 763// writes current playlist to current m3u file */
758 void PlayListWidget::writeCurrentM3u() { 764 void PlayListWidget::writeCurrentM3u() {
759 odebug << "writing to current m3u" << oendl; 765 odebug << "writing to current m3u" << oendl;
760 Config cfg( "OpiePlayer" ); 766 Config cfg( "OpiePlayer" );
761 cfg.setGroup("PlayList"); 767 cfg.setGroup("PlayList");
762 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 768 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
763 769
764 Om3u *m3uList; 770 Om3u *m3uList;
765 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 771 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
766 if( d->selectedFiles->first()) { 772 if( d->selectedFiles->first()) {
767 773
768 do { 774 do {
769 // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; 775 // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
770 m3uList->add( d->selectedFiles->current()->file() ); 776 m3uList->add( d->selectedFiles->current()->file() );
771 } 777 }
772 while ( d->selectedFiles->next() ); 778 while ( d->selectedFiles->next() );
773 // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; 779 // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
774 m3uList->write(); 780 m3uList->write();
775 m3uList->close(); 781 m3uList->close();
776 } 782 }
777 delete m3uList; 783 delete m3uList;
778 784
779 } 785 }
780 786
781 /* 787 /*
782 writes current playlist to m3u file */ 788 writes current playlist to m3u file */
783void PlayListWidget::writem3u() { 789void PlayListWidget::writem3u() {
784 //InputDilog *fileDlg; 790 //InputDilog *fileDlg;
785 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 791 //fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
786 //fileDlg->exec(); 792 //fileDlg->exec();
787 793
788 Config cfg( "OpiePlayer" ); 794 Config cfg( "OpiePlayer" );
789 cfg.setGroup("Dialog"); 795 cfg.setGroup("Dialog");
790 MimeTypes types; 796 MimeTypes types;
791 QStringList audio, video, all; 797 QStringList audio, video, all;
792 audio << "audio/*"; 798 audio << "audio/*";
793 audio << "playlist/plain"; 799 audio << "playlist/plain";
794 audio << "audio/x-mpegurl"; 800 audio << "audio/x-mpegurl";
795 801
796 video << "video/*"; 802 video << "video/*";
797 video << "playlist/plain"; 803 video << "playlist/plain";
798 804
799 all += audio; 805 all += audio;
800 all += video; 806 all += video;
801 types.insert("All Media Files", all ); 807 types.insert("All Media Files", all );
802 types.insert("Audio", audio ); 808 types.insert("Audio", audio );
803 types.insert("Video", video ); 809 types.insert("Video", video );
804 810
805 QString str = OFileDialog::getOpenFileName( 1, 811 QString str = OFileDialog::getOpenFileName( 1,
806 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 812 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
807 types, 0 ); 813 types, 0 );
808 if(str.left(2) == "//") str=str.right(str.length()-1); 814 if(str.left(2) == "//") str=str.right(str.length()-1);
809 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); 815 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
810 816
811 817
812 QString name, filename, list; 818 QString name, filename, list;
813 Om3u *m3uList; 819 Om3u *m3uList;
814 820
815 if( !str.isEmpty() ) { 821 if( !str.isEmpty() ) {
816 name = str; 822 name = str;
817 // name = fileDlg->text(); 823 // name = fileDlg->text();
818// odebug << filename << oendl; 824// odebug << filename << oendl;
819 if( name.find("/",0,true) != -1) {// assume they specify a file path 825 if( name.find("/",0,true) != -1) {// assume they specify a file path
820 filename = name; 826 filename = name;
821 name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); 827 name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
822 } 828 }
823 else //otherwise dump it somewhere noticable 829 else //otherwise dump it somewhere noticable
824 filename = QPEApplication::documentDir() + "/" + name; 830 filename = QPEApplication::documentDir() + "/" + name;
825 831
826 if( filename.right( 3 ) != "m3u" ) //needs filename extension 832 if( filename.right( 3 ) != "m3u" ) //needs filename extension
827 filename += ".m3u"; 833 filename += ".m3u";
828 834
829 if( d->selectedFiles->first()) { //ramble through playlist view 835 if( d->selectedFiles->first()) { //ramble through playlist view
830 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); 836 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
831 837
832 do { 838 do {
833 m3uList->add( d->selectedFiles->current()->file()); 839 m3uList->add( d->selectedFiles->current()->file());
834 } 840 }
835 while ( d->selectedFiles->next() ); 841 while ( d->selectedFiles->next() );
836 // odebug << list << oendl; 842 // odebug << list << oendl;
837 m3uList->write(); 843 m3uList->write();
838 m3uList->close(); 844 m3uList->close();
839 delete m3uList; 845 delete m3uList;
840 846
841 //delete fileDlg; 847 //delete fileDlg;
842 848
843 DocLnk lnk; 849 DocLnk lnk;
844 lnk.setFile( filename); 850 lnk.setFile( filename);
845 lnk.setIcon("opieplayer2/playlist2"); 851 lnk.setIcon("opieplayer2/playlist2");
846 lnk.setName( name); //sets file name 852 lnk.setName( name); //sets file name
847 853
848 // odebug << filename << oendl; 854 // odebug << filename << oendl;
849 Config config( "OpiePlayer" ); 855 Config config( "OpiePlayer" );
850 config.setGroup( "PlayList" ); 856 config.setGroup( "PlayList" );
851 857
852 config.writeEntry("CurrentPlaylist",filename); 858 config.writeEntry("CurrentPlaylist",filename);
853 currentPlayList=filename; 859 currentPlayList=filename;
854 860
855 if(!lnk.writeLink()) { 861 if(!lnk.writeLink()) {
856 odebug << "Writing doclink did not work" << oendl; 862 odebug << "Writing doclink did not work" << oendl;
857 } 863 }
858 864
859 setCaption(tr("OpiePlayer: ") + name); 865 setCaption(tr("OpiePlayer: ") + name);
860 } 866 }
861 } 867 }
862} 868}
863 869
864void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 870void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
865 switch ( e->key() ) { 871 switch ( e->key() ) {
866 ////////////////////////////// Zaurus keys 872 ////////////////////////////// Zaurus keys
867 case Key_F9: //activity 873 case Key_F9: //activity
868 // if(audioUI->isHidden()) 874 // if(audioUI->isHidden())
869 // audioUI->showMaximized(); 875 // audioUI->showMaximized();
870 break; 876 break;
871 case Key_F10: //contacts 877 case Key_F10: //contacts
872 // if( videoUI->isHidden()) 878 // if( videoUI->isHidden())
873 // videoUI->showMaximized(); 879 // videoUI->showMaximized();
874 break; 880 break;
875 case Key_F11: //menu 881 case Key_F11: //menu
876 break; 882 break;
877 case Key_F12: //home 883 case Key_F12: //home
878 // doBlank(); 884 // doBlank();
879 break; 885 break;
880 case Key_F13: //mail 886 case Key_F13: //mail
881 // doUnblank(); 887 // doUnblank();
882 break; 888 break;
883 case Key_Q: //add to playlist 889 case Key_Q: //add to playlist
884 addSelected(); 890 addSelected();
885 break; 891 break;
886 case Key_R: //remove from playlist 892 case Key_R: //remove from playlist
887 removeSelected(); 893 removeSelected();
888 break; 894 break;
889 // case Key_P: //play 895 // case Key_P: //play
890 // odebug << "Play" << oendl; 896 // odebug << "Play" << oendl;
891 // playSelected(); 897 // playSelected();
892 // break; 898 // break;
893 case Key_Space: 899 case Key_Space:
894 // playSelected(); puh 900 // playSelected(); puh
895 break; 901 break;
896 case Key_1: 902 case Key_1:
897 tabWidget->setCurrentPage( 0 ); 903 tabWidget->setCurrentPage( 0 );
898 break; 904 break;
899 case Key_2: 905 case Key_2:
900 tabWidget->setCurrentPage( 1 ); 906 tabWidget->setCurrentPage( 1 );
901 break; 907 break;
902 case Key_3: 908 case Key_3:
903 tabWidget->setCurrentPage( 2 ); 909 tabWidget->setCurrentPage( 2 );
904 break; 910 break;
905 case Key_4: 911 case Key_4:
906 tabWidget->setCurrentPage( 3 ); 912 tabWidget->setCurrentPage( 3 );
907 break; 913 break;
908 case Key_Down: 914 case Key_Down:
909 if ( !d->selectedFiles->next() ) 915 if ( !d->selectedFiles->next() )
910 d->selectedFiles->first(); 916 d->selectedFiles->first();
911 break; 917 break;
912 case Key_Up: 918 case Key_Up:
913 if ( !d->selectedFiles->prev() ) 919 if ( !d->selectedFiles->prev() )
914 // d->selectedFiles->last(); 920 // d->selectedFiles->last();
915 break; 921 break;
916 } 922 }
917} 923}
918 924
919void PlayListWidget::pmViewActivated(int index) { 925void PlayListWidget::pmViewActivated(int index) {
920// odebug << "" << index << "" << oendl; 926// odebug << "" << index << "" << oendl;
921 switch(index) { 927 switch(index) {
922 case -16: 928 case -16:
923 { 929 {
924 mediaPlayerState->toggleFullscreen(); 930 mediaPlayerState->toggleFullscreen();
925 bool b=mediaPlayerState->isFullscreen(); 931 bool b=mediaPlayerState->isFullscreen();
926 pmView->setItemChecked( index, b); 932 pmView->setItemChecked( index, b);
927 Config cfg( "OpiePlayer" ); 933 Config cfg( "OpiePlayer" );
928 cfg.writeEntry( "FullScreen", b ); 934 cfg.writeEntry( "FullScreen", b );
929 } 935 }
930 break; 936 break;
931 }; 937 };
932} 938}
933 939
934void PlayListWidget::populateSkinsMenu() { 940void PlayListWidget::populateSkinsMenu() {
935 int item = 0; 941 int item = 0;
936 defaultSkinIndex = 0; 942 defaultSkinIndex = 0;
937 QString skinName; 943 QString skinName;
938 Config cfg( "OpiePlayer" ); 944 Config cfg( "OpiePlayer" );
939 cfg.setGroup("Options" ); 945 cfg.setGroup("Options" );
940 QString skin = cfg.readEntry( "Skin", "default" ); 946 QString skin = cfg.readEntry( "Skin", "default" );
941 947
942 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 948 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
943 skinsDir.setFilter( QDir::Dirs ); 949 skinsDir.setFilter( QDir::Dirs );
944 skinsDir.setSorting(QDir::Name ); 950 skinsDir.setSorting(QDir::Name );
945 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 951 const QFileInfoList *skinslist = skinsDir.entryInfoList();
946 QFileInfoListIterator it( *skinslist ); 952 QFileInfoListIterator it( *skinslist );
947 QFileInfo *fi; 953 QFileInfo *fi;
948 while ( ( fi = it.current() ) ) { 954 while ( ( fi = it.current() ) ) {
949 skinName = fi->fileName(); 955 skinName = fi->fileName();
950// odebug << fi->fileName() << oendl; 956// odebug << fi->fileName() << oendl;
951 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 957 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
952 item = skinsMenu->insertItem( fi->fileName() ) ; 958 item = skinsMenu->insertItem( fi->fileName() ) ;
953 } 959 }
954 if( skinName == "default" ) { 960 if( skinName == "default" ) {
955 defaultSkinIndex = item; 961 defaultSkinIndex = item;
956 } 962 }
957 if( skinName == skin ) { 963 if( skinName == skin ) {
958 skinsMenu->setItemChecked( item, TRUE ); 964 skinsMenu->setItemChecked( item, TRUE );
959 } 965 }
960 ++it; 966 ++it;
961 } 967 }
962} 968}
963 969
964void PlayListWidget::skinsMenuActivated( int item ) { 970void PlayListWidget::skinsMenuActivated( int item ) {
965 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 971 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
966 skinsMenu->setItemChecked( i, FALSE ); 972 skinsMenu->setItemChecked( i, FALSE );
967 } 973 }
968 skinsMenu->setItemChecked( item, TRUE ); 974 skinsMenu->setItemChecked( item, TRUE );
969 975
970 { 976 {
971 Config cfg( "OpiePlayer" ); 977 Config cfg( "OpiePlayer" );
972 cfg.setGroup("Options"); 978 cfg.setGroup("Options");
973 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 979 cfg.writeEntry("Skin", skinsMenu->text( item ) );
974 } 980 }
975 981
976 emit skinSelected(); 982 emit skinSelected();
977} 983}
978 984
979PlayListWidget::TabType PlayListWidget::currentTab() const 985PlayListWidget::TabType PlayListWidget::currentTab() const
980{ 986{
981 static const TabType indexToTabType[ TabTypeCount ] = 987 static const TabType indexToTabType[ TabTypeCount ] =
982 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 988 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
983 989
984 int index = tabWidget->currentPageIndex(); 990 int index = tabWidget->currentPageIndex();
985 assert( index < TabTypeCount && index >= 0 ); 991 assert( index < TabTypeCount && index >= 0 );
986 992
987 return indexToTabType[ index ]; 993 return indexToTabType[ index ];
988} 994}
989 995
990PlayListWidget::Entry PlayListWidget::currentEntry() const 996PlayListWidget::Entry PlayListWidget::currentEntry() const
991{ 997{
992 if ( currentTab() == CurrentPlayList ) { 998 if ( currentTab() == CurrentPlayList ) {
993 const DocLnk *lnk = current(); 999 const DocLnk *lnk = current();
994 return Entry( lnk->name(), lnk->file() ); 1000 return Entry( lnk->name(), lnk->file() );
995 } 1001 }
996 1002
997 return Entry( currentFileListPathName() ); 1003 return Entry( currentFileListPathName() );
998} 1004}
999 1005
1000QString PlayListWidget::currentFileListPathName() const { 1006QString PlayListWidget::currentFileListPathName() const {
1001 return currentFileListView->currentItem()->text( 3 ); 1007 return currentFileListView->currentItem()->text( 3 );
1002} 1008}
1003 1009
1004 1010
1005void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1011void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
1006 odebug << "qcop message "+msg << oendl; 1012 odebug << "qcop message "+msg << oendl;
1007 QDataStream stream ( data, IO_ReadOnly ); 1013 QDataStream stream ( data, IO_ReadOnly );
1008 if ( msg == "play()" ) { //plays current selection 1014 if ( msg == "play()" ) { //plays current selection
1009 btnPlay( true); 1015 btnPlay( true);
1010 } else if ( msg == "stop()" ) { 1016 } else if ( msg == "stop()" ) {
1011 mediaPlayerState->setPlaying( false); 1017 mediaPlayerState->setPlaying( false);
1012 } else if ( msg == "togglePause()" ) { 1018 } else if ( msg == "togglePause()" ) {
1013 mediaPlayerState->togglePaused(); 1019 mediaPlayerState->togglePaused();
1014 } else if ( msg == "next()" ) { //select next in list 1020 } else if ( msg == "next()" ) { //select next in list
1015 mediaPlayerState->setNext(); 1021 mediaPlayerState->setNext();
1016 } else if ( msg == "prev()" ) { //select previous in list 1022 } else if ( msg == "prev()" ) { //select previous in list
1017 mediaPlayerState->setPrev(); 1023 mediaPlayerState->setPrev();
1018 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1024 } else if ( msg == "toggleLooping()" ) { //loop or not loop
1019 mediaPlayerState->toggleLooping(); 1025 mediaPlayerState->toggleLooping();
1020 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled 1026 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
1021 mediaPlayerState->toggleShuffled(); 1027 mediaPlayerState->toggleShuffled();
1022 } else if ( msg == "volUp()" ) { //volume more 1028 } else if ( msg == "volUp()" ) { //volume more
1023// emit moreClicked(); 1029// emit moreClicked();
1024// emit moreReleased(); 1030// emit moreReleased();
1025 } else if ( msg == "volDown()" ) { //volume less 1031 } else if ( msg == "volDown()" ) { //volume less
1026// emit lessClicked(); 1032// emit lessClicked();
1027// emit lessReleased(); 1033// emit lessReleased();
1028 } else if ( msg == "play(QString)" ) { //play this now 1034 } else if ( msg == "play(QString)" ) { //play this now
1029 QString file; 1035 QString file;
1030 stream >> file; 1036 stream >> file;
1031 setDocument( (const QString &) file); 1037 setDocument( (const QString &) file);
1032 } else if ( msg == "add(QString)" ) { //add to playlist 1038 } else if ( msg == "add(QString)" ) { //add to playlist
1033 QString file; 1039 QString file;
1034 stream >> file; 1040 stream >> file;
1035 QFileInfo fileInfo(file); 1041 QFileInfo fileInfo(file);
1036 DocLnk lnk; 1042 DocLnk lnk;
1037 lnk.setName( fileInfo.baseName() ); //sets name 1043 lnk.setName( fileInfo.baseName() ); //sets name
1038 lnk.setFile( file ); //sets file name 1044 lnk.setFile( file ); //sets file name
1039 addToSelection( lnk ); 1045 addToSelection( lnk );
1040 } else if ( msg == "rem(QString)" ) { //remove from playlist 1046 } else if ( msg == "rem(QString)" ) { //remove from playlist
1041 QString file; 1047 QString file;
1042 stream >> file; 1048 stream >> file;
1043 1049
1044 } 1050 }
1045 1051
1046} 1052}