summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 17:10:14 (UTC)
committer simon <simon>2002-12-02 17:10:14 (UTC)
commite2e40368d1e98cfd3814e14a56c0e503d494cf4f (patch) (unidiff)
tree2dc59b9f4e5c5a8cd971934b1dd5976939bbac37
parentd86803bacac02ae99388cba069532851a5e08ce8 (diff)
downloadopie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.zip
opie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.tar.gz
opie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.tar.bz2
- removed unused (and never initialized to something != 0)
PlayListWidgetPrivate::current
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h1
3 files changed, 1 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 55b66ab..6355bec 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1159 +1,1154 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 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 <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdatetime.h> 41#include <qdatetime.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47#include "playlistselection.h" 47#include "playlistselection.h"
48#include "playlistwidget.h" 48#include "playlistwidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "inputDialog.h" 50#include "inputDialog.h"
51#include "om3u.h" 51#include "om3u.h"
52 52
53//only needed for the random play 53//only needed for the random play
54#include <stdlib.h> 54#include <stdlib.h>
55#include <assert.h> 55#include <assert.h>
56 56
57#include "audiowidget.h" 57#include "audiowidget.h"
58#include "videowidget.h" 58#include "videowidget.h"
59 59
60extern MediaPlayerState *mediaPlayerState; 60extern MediaPlayerState *mediaPlayerState;
61// extern AudioWidget *audioUI; 61// extern AudioWidget *audioUI;
62// extern VideoWidget *videoUI; 62// extern VideoWidget *videoUI;
63 63
64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; 64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
65// no m3u's here please 65// no m3u's here please
66 66
67PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 67PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
68 : PlayListWidgetGui( parent, name, fl ) { 68 : PlayListWidgetGui( parent, name, fl ) {
69 69
70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
71 "opieplayer2/add_to_playlist", 71 "opieplayer2/add_to_playlist",
72 this , SLOT(addSelected() ) ); 72 this , SLOT(addSelected() ) );
73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
74 "opieplayer2/remove_from_playlist", 74 "opieplayer2/remove_from_playlist",
75 this , SLOT(removeSelected() ) ); 75 this , SLOT(removeSelected() ) );
76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
77 this , SLOT( btnPlay( bool) ), TRUE ); 77 this , SLOT( btnPlay( bool) ), TRUE );
78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
79 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 79 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
81 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 81 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
82 82
83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
85 this, SLOT( addAllMusicToList() ) ); 85 this, SLOT( addAllMusicToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
87 this, SLOT( addAllVideoToList() ) ); 87 this, SLOT( addAllVideoToList() ) );
88 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 88 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
89 this, SLOT( addAllToList() ) ); 89 this, SLOT( addAllToList() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
92// this, SLOT( saveList() ) ); 92// this, SLOT( saveList() ) );
93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
94 this, SLOT(writem3u() ) ); 94 this, SLOT(writem3u() ) );
95 pmPlayList->insertSeparator(-1); 95 pmPlayList->insertSeparator(-1);
96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
97 this,SLOT( openFile() ) ); 97 this,SLOT( openFile() ) );
98 pmPlayList->insertSeparator(-1); 98 pmPlayList->insertSeparator(-1);
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
100 this,SLOT( scanForAudio() ) ); 100 this,SLOT( scanForAudio() ) );
101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
102 this,SLOT( scanForVideo() ) ); 102 this,SLOT( scanForVideo() ) );
103 103
104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
105 mediaPlayerState, SLOT( toggleFullscreen() ) ); 105 mediaPlayerState, SLOT( toggleFullscreen() ) );
106 106
107 Config cfg( "OpiePlayer" ); 107 Config cfg( "OpiePlayer" );
108 bool b= cfg.readBoolEntry("FullScreen", 0); 108 bool b= cfg.readBoolEntry("FullScreen", 0);
109 mediaPlayerState->setFullscreen( b ); 109 mediaPlayerState->setFullscreen( b );
110 pmView->setItemChecked( -16, b ); 110 pmView->setItemChecked( -16, b );
111 111
112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
113 d->selectedFiles, SLOT(moveSelectedUp() ) ); 113 d->selectedFiles, SLOT(moveSelectedUp() ) );
114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
115 d->selectedFiles, SLOT(removeSelected() ) ); 115 d->selectedFiles, SLOT(removeSelected() ) );
116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
117 d->selectedFiles, SLOT(moveSelectedDown() ) ); 117 d->selectedFiles, SLOT(moveSelectedDown() ) );
118 // QVBox *stretch2 = new QVBox( vbox1 ); 118 // QVBox *stretch2 = new QVBox( vbox1 );
119 119
120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
121 SLOT( deletePlaylist() ) ); 121 SLOT( deletePlaylist() ) );
122 connect( pmView, SIGNAL( activated( int ) ), 122 connect( pmView, SIGNAL( activated( int ) ),
123 this, SLOT( pmViewActivated( int ) ) ); 123 this, SLOT( pmViewActivated( int ) ) );
124 connect( skinsMenu, SIGNAL( activated( int ) ) , 124 connect( skinsMenu, SIGNAL( activated( int ) ) ,
125 this, SLOT( skinsMenuActivated( int ) ) ); 125 this, SLOT( skinsMenuActivated( int ) ) );
126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
131 this,SLOT( playIt( QListViewItem *) ) ); 131 this,SLOT( playIt( QListViewItem *) ) );
132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
133 this, SLOT( addToSelection( QListViewItem *) ) ); 133 this, SLOT( addToSelection( QListViewItem *) ) );
134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
137 this,SLOT( playIt( QListViewItem *) ) ); 137 this,SLOT( playIt( QListViewItem *) ) );
138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
139 this, SLOT( addToSelection( QListViewItem *) ) ); 139 this, SLOT( addToSelection( QListViewItem *) ) );
140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
141 this, SLOT( loadList( const DocLnk & ) ) ); 141 this, SLOT( loadList( const DocLnk & ) ) );
142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
143 this, SLOT( tabChanged( QWidget* ) ) ); 143 this, SLOT( tabChanged( QWidget* ) ) );
144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
145 d->tbPlay, SLOT( setOn( bool ) ) ); 145 d->tbPlay, SLOT( setOn( bool ) ) );
146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
147 d->tbLoop, SLOT( setOn( bool ) ) ); 147 d->tbLoop, SLOT( setOn( bool ) ) );
148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
149 d->tbShuffle, SLOT( setOn( bool ) ) ); 149 d->tbShuffle, SLOT( setOn( bool ) ) );
150 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), 150 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ),
151 this, SLOT( setPlaylist( bool ) ) ); 151 this, SLOT( setPlaylist( bool ) ) );
152 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 152 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
153 this, SLOT( playIt( QListViewItem *) ) ); 153 this, SLOT( playIt( QListViewItem *) ) );
154 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 154 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
155 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 155 mediaPlayerState, SLOT( setVideoGamma( int ) ) );
156 156
157 // see which skins are installed 157 // see which skins are installed
158 videoScan=false; 158 videoScan=false;
159 audioScan=false; 159 audioScan=false;
160 audioPopulated=false; 160 audioPopulated=false;
161 videoPopulated=false; 161 videoPopulated=false;
162 populateSkinsMenu(); 162 populateSkinsMenu();
163 initializeStates(); 163 initializeStates();
164 164
165 cfg.setGroup("PlayList"); 165 cfg.setGroup("PlayList");
166 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 166 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
167 loadList(DocLnk( currentPlaylist ) ); 167 loadList(DocLnk( currentPlaylist ) );
168} 168}
169 169
170 170
171PlayListWidget::~PlayListWidget() { 171PlayListWidget::~PlayListWidget() {
172 if ( d->current ) {
173 delete d->current;
174 }
175 delete d; 172 delete d;
176} 173}
177 174
178 175
179void PlayListWidget::initializeStates() { 176void PlayListWidget::initializeStates() {
180 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 177 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
181 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 178 d->tbLoop->setOn( mediaPlayerState->isLooping() );
182 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 179 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
183 setPlaylist( true ); 180 setPlaylist( true );
184} 181}
185 182
186void PlayListWidget::writeDefaultPlaylist() { 183void PlayListWidget::writeDefaultPlaylist() {
187 184
188 Config config( "OpiePlayer" ); 185 Config config( "OpiePlayer" );
189 config.setGroup( "PlayList" ); 186 config.setGroup( "PlayList" );
190 QString filename=QPEApplication::documentDir() + "/default.m3u"; 187 QString filename=QPEApplication::documentDir() + "/default.m3u";
191 QString currentString = config.readEntry( "CurrentPlaylist", filename); 188 QString currentString = config.readEntry( "CurrentPlaylist", filename);
192 if( currentString == filename) { 189 if( currentString == filename) {
193 Om3u *m3uList; 190 Om3u *m3uList;
194 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 191 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
195 if( d->selectedFiles->first() ) { 192 if( d->selectedFiles->first() ) {
196 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 193 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
197 do { 194 do {
198 // qDebug(d->selectedFiles->current()->file()); 195 // qDebug(d->selectedFiles->current()->file());
199 m3uList->add( d->selectedFiles->current()->file() ); 196 m3uList->add( d->selectedFiles->current()->file() );
200 } 197 }
201 while ( d->selectedFiles->next() ); 198 while ( d->selectedFiles->next() );
202 199
203 m3uList->write(); 200 m3uList->write();
204 m3uList->close(); 201 m3uList->close();
205 if(m3uList) delete m3uList; 202 if(m3uList) delete m3uList;
206 203
207 } 204 }
208 } 205 }
209} 206}
210 207
211void PlayListWidget::addToSelection( const DocLnk& lnk ) { 208void PlayListWidget::addToSelection( const DocLnk& lnk ) {
212 d->setDocumentUsed = FALSE; 209 d->setDocumentUsed = FALSE;
213 if ( mediaPlayerState->isUsingPlaylist() ) { 210 if ( mediaPlayerState->isUsingPlaylist() ) {
214 if( QFileInfo( lnk.file() ).exists() || 211 if( QFileInfo( lnk.file() ).exists() ||
215 lnk.file().left(4) == "http" ) { 212 lnk.file().left(4) == "http" ) {
216 d->selectedFiles->addToSelection( lnk ); 213 d->selectedFiles->addToSelection( lnk );
217 } 214 }
218// writeCurrentM3u(); 215// writeCurrentM3u();
219 } 216 }
220 else 217 else
221 mediaPlayerState->setPlaying( TRUE ); 218 mediaPlayerState->setPlaying( TRUE );
222} 219}
223 220
224 221
225void PlayListWidget::clearList() { 222void PlayListWidget::clearList() {
226 while ( first() ) { 223 while ( first() ) {
227 d->selectedFiles->removeSelected(); 224 d->selectedFiles->removeSelected();
228 } 225 }
229} 226}
230 227
231void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 228void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
232 switch (mouse) { 229 switch (mouse) {
233 case 1: 230 case 1:
234 break; 231 break;
235 case 2: 232 case 2:
236 { 233 {
237 QPopupMenu m; 234 QPopupMenu m;
238 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 235 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
239 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 236 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
240 m.exec( QCursor::pos() ); 237 m.exec( QCursor::pos() );
241 } 238 }
242 break; 239 break;
243 } 240 }
244} 241}
245 242
246 243
247void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 244void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
248 switch (mouse) { 245 switch (mouse) {
249 case 1: 246 case 1:
250 break; 247 break;
251 case 2: 248 case 2:
252 { 249 {
253 QPopupMenu m; 250 QPopupMenu m;
254 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 251 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
255 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 252 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
256 m.exec( QCursor::pos() ); 253 m.exec( QCursor::pos() );
257 } 254 }
258 break; 255 break;
259 } 256 }
260} 257}
261 258
262 259
263void PlayListWidget::addAllToList() { 260void PlayListWidget::addAllToList() {
264 261
265// QTime t; 262// QTime t;
266// t.start(); 263// t.start();
267 264
268 if(!audioScan) { 265 if(!audioScan) {
269 if(audioView->childCount() < 1) 266 if(audioView->childCount() < 1)
270 populateAudioView(); 267 populateAudioView();
271 } 268 }
272 269
273 QListViewItemIterator audioIt( audioView ); 270 QListViewItemIterator audioIt( audioView );
274 DocLnk lnk; 271 DocLnk lnk;
275 QString filename; 272 QString filename;
276 // iterate through all items of the listview 273 // iterate through all items of the listview
277 for ( ; audioIt.current(); ++audioIt ) { 274 for ( ; audioIt.current(); ++audioIt ) {
278 filename = audioIt.current()->text(3); 275 filename = audioIt.current()->text(3);
279 lnk.setName( QFileInfo(filename).baseName() ); //sets name 276 lnk.setName( QFileInfo(filename).baseName() ); //sets name
280 lnk.setFile( filename ); //sets file name 277 lnk.setFile( filename ); //sets file name
281 d->selectedFiles->addToSelection( lnk); 278 d->selectedFiles->addToSelection( lnk);
282 } 279 }
283 280
284 if(!videoScan) { 281 if(!videoScan) {
285 if(videoView->childCount() < 1) 282 if(videoView->childCount() < 1)
286 populateVideoView(); 283 populateVideoView();
287 } 284 }
288 285
289 QListViewItemIterator videoIt( videoView ); 286 QListViewItemIterator videoIt( videoView );
290 for ( ; videoIt.current(); ++videoIt ) { 287 for ( ; videoIt.current(); ++videoIt ) {
291 filename = videoIt.current()->text(3); 288 filename = videoIt.current()->text(3);
292 lnk.setName( QFileInfo(filename).baseName() ); //sets name 289 lnk.setName( QFileInfo(filename).baseName() ); //sets name
293 lnk.setFile( filename ); //sets file name 290 lnk.setFile( filename ); //sets file name
294 d->selectedFiles->addToSelection( lnk); 291 d->selectedFiles->addToSelection( lnk);
295 } 292 }
296 293
297 // d->selectedFiles->addToSelection( ); 294 // d->selectedFiles->addToSelection( );
298 // if ( it.current()->isSelected() ) 295 // if ( it.current()->isSelected() )
299 // lst->append( audioIt.current() ); 296 // lst->append( audioIt.current() );
300 // } 297 // }
301 298
302 299
303// if(!audioScan) 300// if(!audioScan)
304// scanForAudio(); 301// scanForAudio();
305// if(!videoScan) 302// if(!videoScan)
306// scanForVideo(); 303// scanForVideo();
307 304
308// DocLnkSet filesAll; 305// DocLnkSet filesAll;
309// Global::findDocuments(&filesAll, "video/*;"+audioMimes); 306// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
310// QListIterator<DocLnk> Adit( filesAll.children() ); 307// QListIterator<DocLnk> Adit( filesAll.children() );
311// for ( ; Adit.current(); ++Adit ) { 308// for ( ; Adit.current(); ++Adit ) {
312// if( QFileInfo( Adit.current()->file() ).exists() ) { 309// if( QFileInfo( Adit.current()->file() ).exists() ) {
313// d->selectedFiles->addToSelection( **Adit ); 310// d->selectedFiles->addToSelection( **Adit );
314// } 311// }
315// } 312// }
316 313
317 // qDebug("elapsed time %d", t.elapsed() ); 314 // qDebug("elapsed time %d", t.elapsed() );
318 315
319 tabWidget->setCurrentPage(0); 316 tabWidget->setCurrentPage(0);
320 317
321 writeCurrentM3u(); 318 writeCurrentM3u();
322 d->selectedFiles->first(); 319 d->selectedFiles->first();
323} 320}
324 321
325 322
326void PlayListWidget::addAllMusicToList() { 323void PlayListWidget::addAllMusicToList() {
327 324
328 if(!audioScan) { 325 if(!audioScan) {
329 if(audioView->childCount() < 1) 326 if(audioView->childCount() < 1)
330 populateAudioView(); 327 populateAudioView();
331 } 328 }
332 329
333 QListViewItemIterator audioIt( audioView ); 330 QListViewItemIterator audioIt( audioView );
334 DocLnk lnk; 331 DocLnk lnk;
335 QString filename; 332 QString filename;
336 // iterate through all items of the listview 333 // iterate through all items of the listview
337 for ( ; audioIt.current(); ++audioIt ) { 334 for ( ; audioIt.current(); ++audioIt ) {
338 filename = audioIt.current()->text(3); 335 filename = audioIt.current()->text(3);
339 lnk.setName( QFileInfo(filename).baseName() ); //sets name 336 lnk.setName( QFileInfo(filename).baseName() ); //sets name
340 lnk.setFile( filename ); //sets file name 337 lnk.setFile( filename ); //sets file name
341 d->selectedFiles->addToSelection( lnk); 338 d->selectedFiles->addToSelection( lnk);
342 } 339 }
343 340
344 /* if(!audioScan) 341 /* if(!audioScan)
345 scanForAudio(); 342 scanForAudio();
346 QListIterator<DocLnk> dit( files.children() ); 343 QListIterator<DocLnk> dit( files.children() );
347 for ( ; dit.current(); ++dit ) { 344 for ( ; dit.current(); ++dit ) {
348 if( QFileInfo(dit.current()->file() ).exists() ) { 345 if( QFileInfo(dit.current()->file() ).exists() ) {
349 d->selectedFiles->addToSelection( **dit ); 346 d->selectedFiles->addToSelection( **dit );
350 } 347 }
351 } 348 }
352 */ 349 */
353 tabWidget->setCurrentPage(0); 350 tabWidget->setCurrentPage(0);
354 writeCurrentM3u(); 351 writeCurrentM3u();
355 d->selectedFiles->first(); 352 d->selectedFiles->first();
356} 353}
357 354
358 355
359void PlayListWidget::addAllVideoToList() { 356void PlayListWidget::addAllVideoToList() {
360 357
361 if(!videoScan) { 358 if(!videoScan) {
362 if(videoView->childCount() < 1) 359 if(videoView->childCount() < 1)
363 populateVideoView(); 360 populateVideoView();
364 } 361 }
365 362
366 QListViewItemIterator videoIt( videoView ); 363 QListViewItemIterator videoIt( videoView );
367 DocLnk lnk; 364 DocLnk lnk;
368 QString filename; 365 QString filename;
369 for ( ; videoIt.current(); ++videoIt ) { 366 for ( ; videoIt.current(); ++videoIt ) {
370 filename = videoIt.current()->text(3); 367 filename = videoIt.current()->text(3);
371 lnk.setName( QFileInfo(filename).baseName() ); //sets name 368 lnk.setName( QFileInfo(filename).baseName() ); //sets name
372 lnk.setFile( filename ); //sets file name 369 lnk.setFile( filename ); //sets file name
373 d->selectedFiles->addToSelection( lnk); 370 d->selectedFiles->addToSelection( lnk);
374 } 371 }
375 372
376 373
377 /* if(!videoScan) 374 /* if(!videoScan)
378 scanForVideo(); 375 scanForVideo();
379 QListIterator<DocLnk> dit( vFiles.children() ); 376 QListIterator<DocLnk> dit( vFiles.children() );
380 for ( ; dit.current(); ++dit ) { 377 for ( ; dit.current(); ++dit ) {
381 if( QFileInfo( dit.current()->file() ).exists() ) { 378 if( QFileInfo( dit.current()->file() ).exists() ) {
382 d->selectedFiles->addToSelection( **dit ); 379 d->selectedFiles->addToSelection( **dit );
383 } 380 }
384 } 381 }
385*/ 382*/
386 tabWidget->setCurrentPage(0); 383 tabWidget->setCurrentPage(0);
387 writeCurrentM3u(); 384 writeCurrentM3u();
388 d->selectedFiles->first(); 385 d->selectedFiles->first();
389} 386}
390 387
391 388
392void PlayListWidget::setDocument( const QString& fileref ) { 389void PlayListWidget::setDocument( const QString& fileref ) {
393 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 390 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
394 fromSetDocument = TRUE; 391 fromSetDocument = TRUE;
395 if ( fileref.isNull() ) { 392 if ( fileref.isNull() ) {
396 QMessageBox::warning( this, tr( "Invalid File" ), 393 QMessageBox::warning( this, tr( "Invalid File" ),
397 tr( "There was a problem in getting the file." ) ); 394 tr( "There was a problem in getting the file." ) );
398 return; 395 return;
399 } 396 }
400 397
401 clearList(); 398 clearList();
402 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 399 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
403 readm3u( fileref ); 400 readm3u( fileref );
404 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 401 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
405 readm3u( DocLnk( fileref).file() ); 402 readm3u( DocLnk( fileref).file() );
406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 403 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
407 readPls( fileref ); 404 readPls( fileref );
408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 405 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
409 readPls( DocLnk( fileref).file() ); 406 readPls( DocLnk( fileref).file() );
410 } else { 407 } else {
411 clearList(); 408 clearList();
412 addToSelection( DocLnk( fileref ) ); 409 addToSelection( DocLnk( fileref ) );
413 writeCurrentM3u(); 410 writeCurrentM3u();
414 411
415 d->setDocumentUsed = TRUE; 412 d->setDocumentUsed = TRUE;
416 mediaPlayerState->setPlaying( FALSE ); 413 mediaPlayerState->setPlaying( FALSE );
417 mediaPlayerState->setPlaying( TRUE ); 414 mediaPlayerState->setPlaying( TRUE );
418 } 415 }
419} 416}
420 417
421 418
422void PlayListWidget::useSelectedDocument() { 419void PlayListWidget::useSelectedDocument() {
423 d->setDocumentUsed = FALSE; 420 d->setDocumentUsed = FALSE;
424} 421}
425 422
426 423
427const DocLnk *PlayListWidget::current() const { // this is fugly 424const DocLnk *PlayListWidget::current() const { // this is fugly
428 assert( currentTab() == CurrentPlayList ); 425 assert( currentTab() == CurrentPlayList );
429 426
430// qDebug("playlist"); 427// qDebug("playlist");
431 if ( mediaPlayerState->isUsingPlaylist() ) { 428 if ( mediaPlayerState->isUsingPlaylist() )
432 return d->selectedFiles->current(); 429 return d->selectedFiles->current();
433 } else if ( d->setDocumentUsed && d->current )
434 return d->current;
435 430
436 assert( false ); 431 assert( false );
437} 432}
438 433
439 434
440bool PlayListWidget::prev() { 435bool PlayListWidget::prev() {
441 if ( mediaPlayerState->isUsingPlaylist() ) { 436 if ( mediaPlayerState->isUsingPlaylist() ) {
442 if ( mediaPlayerState->isShuffled() ) { 437 if ( mediaPlayerState->isShuffled() ) {
443 const DocLnk *cur = current(); 438 const DocLnk *cur = current();
444 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 439 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
445 for ( int i = 0; i < j; i++ ) { 440 for ( int i = 0; i < j; i++ ) {
446 if ( !d->selectedFiles->next() ) 441 if ( !d->selectedFiles->next() )
447 d->selectedFiles->first(); 442 d->selectedFiles->first();
448 } 443 }
449 if ( cur == current() ) 444 if ( cur == current() )
450 if ( !d->selectedFiles->next() ) { 445 if ( !d->selectedFiles->next() ) {
451 d->selectedFiles->first(); 446 d->selectedFiles->first();
452 } 447 }
453 return TRUE; 448 return TRUE;
454 } else { 449 } else {
455 if ( !d->selectedFiles->prev() ) { 450 if ( !d->selectedFiles->prev() ) {
456 if ( mediaPlayerState->isLooping() ) { 451 if ( mediaPlayerState->isLooping() ) {
457 return d->selectedFiles->last(); 452 return d->selectedFiles->last();
458 } else { 453 } else {
459 return FALSE; 454 return FALSE;
460 } 455 }
461 } 456 }
462 return TRUE; 457 return TRUE;
463 } 458 }
464 } else { 459 } else {
465 return mediaPlayerState->isLooping(); 460 return mediaPlayerState->isLooping();
466 } 461 }
467} 462}
468 463
469 464
470bool PlayListWidget::next() { 465bool PlayListWidget::next() {
471//qDebug("<<<<<<<<<<<<next()"); 466//qDebug("<<<<<<<<<<<<next()");
472 if ( mediaPlayerState->isUsingPlaylist() ) { 467 if ( mediaPlayerState->isUsingPlaylist() ) {
473 if ( mediaPlayerState->isShuffled() ) { 468 if ( mediaPlayerState->isShuffled() ) {
474 return prev(); 469 return prev();
475 } else { 470 } else {
476 if ( !d->selectedFiles->next() ) { 471 if ( !d->selectedFiles->next() ) {
477 if ( mediaPlayerState->isLooping() ) { 472 if ( mediaPlayerState->isLooping() ) {
478 return d->selectedFiles->first(); 473 return d->selectedFiles->first();
479 } else { 474 } else {
480 return FALSE; 475 return FALSE;
481 } 476 }
482 } 477 }
483 return TRUE; 478 return TRUE;
484 } 479 }
485 } else { 480 } else {
486 return mediaPlayerState->isLooping(); 481 return mediaPlayerState->isLooping();
487 } 482 }
488} 483}
489 484
490 485
491bool PlayListWidget::first() { 486bool PlayListWidget::first() {
492 if ( mediaPlayerState->isUsingPlaylist() ) 487 if ( mediaPlayerState->isUsingPlaylist() )
493 return d->selectedFiles->first(); 488 return d->selectedFiles->first();
494 else 489 else
495 return mediaPlayerState->isLooping(); 490 return mediaPlayerState->isLooping();
496} 491}
497 492
498 493
499bool PlayListWidget::last() { 494bool PlayListWidget::last() {
500 if ( mediaPlayerState->isUsingPlaylist() ) 495 if ( mediaPlayerState->isUsingPlaylist() )
501 return d->selectedFiles->last(); 496 return d->selectedFiles->last();
502 else 497 else
503 return mediaPlayerState->isLooping(); 498 return mediaPlayerState->isLooping();
504} 499}
505 500
506 501
507 void PlayListWidget::saveList() { 502 void PlayListWidget::saveList() {
508 writem3u(); 503 writem3u();
509 } 504 }
510 505
511 506
512void PlayListWidget::loadList( const DocLnk & lnk) { 507void PlayListWidget::loadList( const DocLnk & lnk) {
513 QString name = lnk.name(); 508 QString name = lnk.name();
514 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 509 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
515 510
516 if( name.length()>0) { 511 if( name.length()>0) {
517 setCaption("OpiePlayer: "+name); 512 setCaption("OpiePlayer: "+name);
518// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 513// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
519 clearList(); 514 clearList();
520 readm3u(lnk.file()); 515 readm3u(lnk.file());
521 tabWidget->setCurrentPage(0); 516 tabWidget->setCurrentPage(0);
522 } 517 }
523} 518}
524 519
525 520
526void PlayListWidget::setPlaylist( bool shown ) { 521void PlayListWidget::setPlaylist( bool shown ) {
527 if ( shown ) { 522 if ( shown ) {
528 d->playListFrame->show(); 523 d->playListFrame->show();
529 } else { 524 } else {
530 d->playListFrame->hide(); 525 d->playListFrame->hide();
531 } 526 }
532} 527}
533 528
534 529
535void PlayListWidget::addSelected() { 530void PlayListWidget::addSelected() {
536 assert( inFileListMode() ); 531 assert( inFileListMode() );
537 532
538 QListView *fileListView = currentFileListView(); 533 QListView *fileListView = currentFileListView();
539 QListViewItemIterator it( fileListView ); 534 QListViewItemIterator it( fileListView );
540 for ( ; it.current(); ++it ) 535 for ( ; it.current(); ++it )
541 if ( it.current()->isSelected() ) { 536 if ( it.current()->isSelected() ) {
542 QString filename = it.current()->text(3); 537 QString filename = it.current()->text(3);
543 538
544 DocLnk lnk; 539 DocLnk lnk;
545 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 540 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
546 lnk.setFile( filename ); //sets file name 541 lnk.setFile( filename ); //sets file name
547 542
548 d->selectedFiles->addToSelection( lnk ); 543 d->selectedFiles->addToSelection( lnk );
549 } 544 }
550 545
551 fileListView->clearSelection(); 546 fileListView->clearSelection();
552 547
553 tabWidget->setCurrentPage( 0 ); 548 tabWidget->setCurrentPage( 0 );
554 writeCurrentM3u(); 549 writeCurrentM3u();
555} 550}
556 551
557 552
558void PlayListWidget::removeSelected() { 553void PlayListWidget::removeSelected() {
559 d->selectedFiles->removeSelected( ); 554 d->selectedFiles->removeSelected( );
560 writeCurrentM3u(); 555 writeCurrentM3u();
561} 556}
562 557
563 558
564void PlayListWidget::playIt( QListViewItem *it) { 559void PlayListWidget::playIt( QListViewItem *it) {
565 if(!it) return; 560 if(!it) return;
566 mediaPlayerState->setPlaying(FALSE); 561 mediaPlayerState->setPlaying(FALSE);
567 mediaPlayerState->setPlaying(TRUE); 562 mediaPlayerState->setPlaying(TRUE);
568 d->selectedFiles->unSelect(); 563 d->selectedFiles->unSelect();
569} 564}
570 565
571 566
572void PlayListWidget::addToSelection( QListViewItem *it) { 567void PlayListWidget::addToSelection( QListViewItem *it) {
573 d->setDocumentUsed = FALSE; 568 d->setDocumentUsed = FALSE;
574 569
575 if(it) { 570 if(it) {
576 if ( currentTab() == CurrentPlayList ) 571 if ( currentTab() == CurrentPlayList )
577 return; 572 return;
578 // case 1: { 573 // case 1: {
579 DocLnk lnk; 574 DocLnk lnk;
580 QString filename; 575 QString filename;
581 576
582 filename=it->text(3); 577 filename=it->text(3);
583 lnk.setName( QFileInfo(filename).baseName() ); //sets name 578 lnk.setName( QFileInfo(filename).baseName() ); //sets name
584 lnk.setFile( filename ); //sets file name 579 lnk.setFile( filename ); //sets file name
585 d->selectedFiles->addToSelection( lnk); 580 d->selectedFiles->addToSelection( lnk);
586 581
587 writeCurrentM3u(); 582 writeCurrentM3u();
588 tabWidget->setCurrentPage(0); 583 tabWidget->setCurrentPage(0);
589 584
590 } 585 }
591} 586}
592 587
593 588
594void PlayListWidget::tabChanged(QWidget *) { 589void PlayListWidget::tabChanged(QWidget *) {
595 590
596 d->tbPlay->setEnabled( true ); 591 d->tbPlay->setEnabled( true );
597 592
598 switch ( currentTab() ) { 593 switch ( currentTab() ) {
599 case CurrentPlayList: 594 case CurrentPlayList:
600 { 595 {
601 if( !tbDeletePlaylist->isHidden() ) { 596 if( !tbDeletePlaylist->isHidden() ) {
602 tbDeletePlaylist->hide(); 597 tbDeletePlaylist->hide();
603 } 598 }
604 d->tbRemoveFromList->setEnabled(TRUE); 599 d->tbRemoveFromList->setEnabled(TRUE);
605 d->tbAddToList->setEnabled(FALSE); 600 d->tbAddToList->setEnabled(FALSE);
606 } 601 }
607 break; 602 break;
608 case AudioFiles: 603 case AudioFiles:
609 { 604 {
610 // audioView->clear(); 605 // audioView->clear();
611 if(!audioPopulated) populateAudioView(); 606 if(!audioPopulated) populateAudioView();
612 607
613 if( !tbDeletePlaylist->isHidden() ) { 608 if( !tbDeletePlaylist->isHidden() ) {
614 tbDeletePlaylist->hide(); 609 tbDeletePlaylist->hide();
615 } 610 }
616 d->tbRemoveFromList->setEnabled(FALSE); 611 d->tbRemoveFromList->setEnabled(FALSE);
617 d->tbAddToList->setEnabled(TRUE); 612 d->tbAddToList->setEnabled(TRUE);
618 } 613 }
619 break; 614 break;
620 case VideoFiles: 615 case VideoFiles:
621 { 616 {
622 // videoView->clear(); 617 // videoView->clear();
623 if(!videoPopulated) populateVideoView(); 618 if(!videoPopulated) populateVideoView();
624 if( !tbDeletePlaylist->isHidden() ) { 619 if( !tbDeletePlaylist->isHidden() ) {
625 tbDeletePlaylist->hide(); 620 tbDeletePlaylist->hide();
626 } 621 }
627 d->tbRemoveFromList->setEnabled(FALSE); 622 d->tbRemoveFromList->setEnabled(FALSE);
628 d->tbAddToList->setEnabled(TRUE); 623 d->tbAddToList->setEnabled(TRUE);
629 } 624 }
630 break; 625 break;
631 case PlayLists: 626 case PlayLists:
632 { 627 {
633 if( tbDeletePlaylist->isHidden() ) { 628 if( tbDeletePlaylist->isHidden() ) {
634 tbDeletePlaylist->show(); 629 tbDeletePlaylist->show();
635 } 630 }
636 playLists->reread(); 631 playLists->reread();
637 d->tbAddToList->setEnabled(FALSE); 632 d->tbAddToList->setEnabled(FALSE);
638 633
639 d->tbPlay->setEnabled( false ); 634 d->tbPlay->setEnabled( false );
640 } 635 }
641 break; 636 break;
642 }; 637 };
643} 638}
644 639
645 640
646void PlayListWidget::btnPlay(bool b) { 641void PlayListWidget::btnPlay(bool b) {
647// mediaPlayerState->setPlaying(false); 642// mediaPlayerState->setPlaying(false);
648 mediaPlayerState->setPlaying(b); 643 mediaPlayerState->setPlaying(b);
649 insanityBool=FALSE; 644 insanityBool=FALSE;
650} 645}
651 646
652void PlayListWidget::deletePlaylist() { 647void PlayListWidget::deletePlaylist() {
653 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 648 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
654 (tr("You really want to delete\nthis playlist?")), 649 (tr("You really want to delete\nthis playlist?")),
655 (tr("Yes")), (tr("No")), 0 )){ 650 (tr("Yes")), (tr("No")), 0 )){
656 case 0: // Yes clicked, 651 case 0: // Yes clicked,
657 QFile().remove(playLists->selectedDocument().file()); 652 QFile().remove(playLists->selectedDocument().file());
658 QFile().remove(playLists->selectedDocument().linkFile()); 653 QFile().remove(playLists->selectedDocument().linkFile());
659 playLists->reread(); 654 playLists->reread();
660 break; 655 break;
661 case 1: // Cancel 656 case 1: // Cancel
662 break; 657 break;
663 }; 658 };
664} 659}
665 660
666 661
667void PlayListWidget::playSelected() { 662void PlayListWidget::playSelected() {
668 btnPlay( TRUE); 663 btnPlay( TRUE);
669} 664}
670 665
671 666
672void PlayListWidget::scanForAudio() { 667void PlayListWidget::scanForAudio() {
673// qDebug("scan for audio"); 668// qDebug("scan for audio");
674 files.detachChildren(); 669 files.detachChildren();
675 QListIterator<DocLnk> sdit( files.children() ); 670 QListIterator<DocLnk> sdit( files.children() );
676 for ( ; sdit.current(); ++sdit ) { 671 for ( ; sdit.current(); ++sdit ) {
677 delete sdit.current(); 672 delete sdit.current();
678 } 673 }
679// Global::findDocuments( &files, "audio/*"); 674// Global::findDocuments( &files, "audio/*");
680 Global::findDocuments( &files, audioMimes); 675 Global::findDocuments( &files, audioMimes);
681 audioScan = true; 676 audioScan = true;
682 populateAudioView(); 677 populateAudioView();
683} 678}
684 679
685void PlayListWidget::scanForVideo() { 680void PlayListWidget::scanForVideo() {
686// qDebug("scan for video"); 681// qDebug("scan for video");
687 vFiles.detachChildren(); 682 vFiles.detachChildren();
688 QListIterator<DocLnk> sdit( vFiles.children() ); 683 QListIterator<DocLnk> sdit( vFiles.children() );
689 for ( ; sdit.current(); ++sdit ) { 684 for ( ; sdit.current(); ++sdit ) {
690 delete sdit.current(); 685 delete sdit.current();
691 } 686 }
692 Global::findDocuments(&vFiles, "video/*"); 687 Global::findDocuments(&vFiles, "video/*");
693 videoScan = true; 688 videoScan = true;
694 populateVideoView(); 689 populateVideoView();
695} 690}
696 691
697void PlayListWidget::populateAudioView() { 692void PlayListWidget::populateAudioView() {
698 audioView->clear(); 693 audioView->clear();
699 StorageInfo storageInfo; 694 StorageInfo storageInfo;
700 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 695 // const QList<FileSystem> &fs = storageInfo.fileSystems();
701 if(!audioScan) { 696 if(!audioScan) {
702 scanForAudio(); 697 scanForAudio();
703 } 698 }
704 699
705 QListIterator<DocLnk> dit( files.children() ); 700 QListIterator<DocLnk> dit( files.children() );
706 // QListIterator<FileSystem> it ( fs ); 701 // QListIterator<FileSystem> it ( fs );
707 audioView->clear(); 702 audioView->clear();
708 703
709 QString storage; 704 QString storage;
710 for ( ; dit.current(); ++dit ) { 705 for ( ; dit.current(); ++dit ) {
711// // for( ; it.current(); ++it ){ 706// // for( ; it.current(); ++it ){
712// const QString name = (*dit)->name(); 707// const QString name = (*dit)->name();
713// const QString path = (*dit)->path(); 708// const QString path = (*dit)->path();
714// if(dit.current()->file().find(path) != -1 ) { 709// if(dit.current()->file().find(path) != -1 ) {
715// storage = name; 710// storage = name;
716// // } 711// // }
717// } 712// }
718 713
719 QListViewItem * newItem; 714 QListViewItem * newItem;
720 if ( QFile( dit.current()->file()).exists() || 715 if ( QFile( dit.current()->file()).exists() ||
721 dit.current()->file().left(4) == "http" ) { 716 dit.current()->file().left(4) == "http" ) {
722 long size; 717 long size;
723 if( dit.current()->file().left(4) == "http" ) 718 if( dit.current()->file().left(4) == "http" )
724 size=0; 719 size=0;
725 else 720 else
726 size = QFile( dit.current()->file() ).size(); 721 size = QFile( dit.current()->file() ).size();
727 722
728 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 723 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
729 QString::number(size ), "" /*storage*/, 724 QString::number(size ), "" /*storage*/,
730 dit.current()->file() ); 725 dit.current()->file() );
731 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 726 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
732// qDebug("<<<< "+dit.current()->file()); 727// qDebug("<<<< "+dit.current()->file());
733 } 728 }
734 } 729 }
735 audioPopulated=true; 730 audioPopulated=true;
736} 731}
737 732
738 733
739void PlayListWidget::populateVideoView() { 734void PlayListWidget::populateVideoView() {
740 videoView->clear(); 735 videoView->clear();
741 StorageInfo storageInfo; 736 StorageInfo storageInfo;
742 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 737 // const QList<FileSystem> &fs = storageInfo.fileSystems();
743 738
744 if(!videoScan ) { 739 if(!videoScan ) {
745 scanForVideo(); 740 scanForVideo();
746 } 741 }
747 742
748 QListIterator<DocLnk> Vdit( vFiles.children() ); 743 QListIterator<DocLnk> Vdit( vFiles.children() );
749// QListIterator<FileSystem> it ( fs ); 744// QListIterator<FileSystem> it ( fs );
750 videoView->clear(); 745 videoView->clear();
751 QString storage, pathName; 746 QString storage, pathName;
752 for ( ; Vdit.current(); ++Vdit ) { 747 for ( ; Vdit.current(); ++Vdit ) {
753// // for( ; it.current(); ++it ) { 748// // for( ; it.current(); ++it ) {
754// const QString name = (*Vdit)->name(); 749// const QString name = (*Vdit)->name();
755// const QString path = (*Vdit)->path(); 750// const QString path = (*Vdit)->path();
756// if( Vdit.current()->file().find(path) != -1 ) { 751// if( Vdit.current()->file().find(path) != -1 ) {
757// storage=name; 752// storage=name;
758// pathName=path; 753// pathName=path;
759// // } 754// // }
760// } 755// }
761 756
762 QListViewItem * newItem; 757 QListViewItem * newItem;
763 if ( QFile( Vdit.current()->file() ).exists() ) { 758 if ( QFile( Vdit.current()->file() ).exists() ) {
764 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 759 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
765 QString::number( QFile( Vdit.current()->file() ).size() ), 760 QString::number( QFile( Vdit.current()->file() ).size() ),
766 ""/*storage*/, Vdit.current()->file()); 761 ""/*storage*/, Vdit.current()->file());
767 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 762 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
768 } 763 }
769 } 764 }
770 videoPopulated=true; 765 videoPopulated=true;
771} 766}
772 767
773QListView *PlayListWidget::currentFileListView() const 768QListView *PlayListWidget::currentFileListView() const
774{ 769{
775 switch ( currentTab() ) { 770 switch ( currentTab() ) {
776 case AudioFiles: return audioView; 771 case AudioFiles: return audioView;
777 case VideoFiles: return videoView; 772 case VideoFiles: return videoView;
778 default: assert( false ); 773 default: assert( false );
779 } 774 }
780 return 0; 775 return 0;
781} 776}
782 777
783bool PlayListWidget::inFileListMode() const 778bool PlayListWidget::inFileListMode() const
784{ 779{
785 TabType tab = currentTab(); 780 TabType tab = currentTab();
786 return tab == AudioFiles || tab == VideoFiles; 781 return tab == AudioFiles || tab == VideoFiles;
787} 782}
788 783
789void PlayListWidget::openFile() { 784void PlayListWidget::openFile() {
790 // http://66.28.164.33:2080 785 // http://66.28.164.33:2080
791 // http://somafm.com/star0242.m3u 786 // http://somafm.com/star0242.m3u
792 QString filename, name; 787 QString filename, name;
793 InputDialog *fileDlg; 788 InputDialog *fileDlg;
794 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 789 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
795 fileDlg->exec(); 790 fileDlg->exec();
796 if( fileDlg->result() == 1 ) { 791 if( fileDlg->result() == 1 ) {
797 filename = fileDlg->text(); 792 filename = fileDlg->text();
798 qDebug( "Selected filename is " + filename ); 793 qDebug( "Selected filename is " + filename );
799 // Om3u *m3uList; 794 // Om3u *m3uList;
800 DocLnk lnk; 795 DocLnk lnk;
801 Config cfg( "OpiePlayer" ); 796 Config cfg( "OpiePlayer" );
802 cfg.setGroup("PlayList"); 797 cfg.setGroup("PlayList");
803 798
804 if(filename.left(4) == "http") { 799 if(filename.left(4) == "http") {
805 QString m3uFile, m3uFilePath; 800 QString m3uFile, m3uFilePath;
806 if(filename.find(":",8,TRUE) != -1) { //found a port 801 if(filename.find(":",8,TRUE) != -1) { //found a port
807 m3uFile = filename.left( filename.find( ":",8,TRUE)); 802 m3uFile = filename.left( filename.find( ":",8,TRUE));
808 m3uFile = m3uFile.right( 7); 803 m3uFile = m3uFile.right( 7);
809 } else if(filename.left(4) == "http"){ 804 } else if(filename.left(4) == "http"){
810 m3uFile=filename; 805 m3uFile=filename;
811 m3uFile = m3uFile.right( m3uFile.length() - 7); 806 m3uFile = m3uFile.right( m3uFile.length() - 7);
812 } else{ 807 } else{
813 m3uFile=filename; 808 m3uFile=filename;
814 } 809 }
815 810
816// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 811// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
817 lnk.setName( filename ); //sets name 812 lnk.setName( filename ); //sets name
818 lnk.setFile( filename ); //sets file name 813 lnk.setFile( filename ); //sets file name
819 814
820// lnk.setIcon("opieplayer2/musicfile"); 815// lnk.setIcon("opieplayer2/musicfile");
821 816
822 d->selectedFiles->addToSelection( lnk ); 817 d->selectedFiles->addToSelection( lnk );
823 writeCurrentM3u(); 818 writeCurrentM3u();
824 d->selectedFiles->setSelectedItem( lnk.name()); 819 d->selectedFiles->setSelectedItem( lnk.name());
825 } 820 }
826 else if( filename.right( 3) == "m3u" ) { 821 else if( filename.right( 3) == "m3u" ) {
827 readm3u( filename ); 822 readm3u( filename );
828 823
829 } else if( filename.right(3) == "pls" ) { 824 } else if( filename.right(3) == "pls" ) {
830 readPls( filename ); 825 readPls( filename );
831 } else { 826 } else {
832 lnk.setName( QFileInfo(filename).baseName() ); //sets name 827 lnk.setName( QFileInfo(filename).baseName() ); //sets name
833 lnk.setFile( filename ); //sets file name 828 lnk.setFile( filename ); //sets file name
834 d->selectedFiles->addToSelection( lnk); 829 d->selectedFiles->addToSelection( lnk);
835 writeCurrentM3u(); 830 writeCurrentM3u();
836 d->selectedFiles->setSelectedItem( lnk.name()); 831 d->selectedFiles->setSelectedItem( lnk.name());
837 } 832 }
838 } 833 }
839 834
840 if( fileDlg ) { 835 if( fileDlg ) {
841 delete fileDlg; 836 delete fileDlg;
842 } 837 }
843} 838}
844 839
845/* 840/*
846reads m3u and shows files/urls to playlist widget */ 841reads m3u and shows files/urls to playlist widget */
847void PlayListWidget::readm3u( const QString &filename ) { 842void PlayListWidget::readm3u( const QString &filename ) {
848 qDebug( "read m3u filename " + filename ); 843 qDebug( "read m3u filename " + filename );
849 844
850 Om3u *m3uList; 845 Om3u *m3uList;
851 QString s, name; 846 QString s, name;
852 m3uList = new Om3u( filename, IO_ReadOnly ); 847 m3uList = new Om3u( filename, IO_ReadOnly );
853 m3uList->readM3u(); 848 m3uList->readM3u();
854 DocLnk lnk; 849 DocLnk lnk;
855 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 850 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
856 s = *it; 851 s = *it;
857// qDebug("reading "+ s); 852// qDebug("reading "+ s);
858 if(s.left(4)=="http") { 853 if(s.left(4)=="http") {
859 lnk.setName( s ); //sets file name 854 lnk.setName( s ); //sets file name
860 lnk.setIcon("opieplayer2/musicfile"); 855 lnk.setIcon("opieplayer2/musicfile");
861 lnk.setFile( s ); //sets file name 856 lnk.setFile( s ); //sets file name
862 857
863 } else { 858 } else {
864 // if( QFileInfo( s ).exists() ) { 859 // if( QFileInfo( s ).exists() ) {
865 lnk.setName( QFileInfo(s).baseName()); 860 lnk.setName( QFileInfo(s).baseName());
866 // if(s.right(4) == '.') {//if regular file 861 // if(s.right(4) == '.') {//if regular file
867 if(s.left(1) != "/") { 862 if(s.left(1) != "/") {
868 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 863 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
869 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 864 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
870// lnk.setIcon(MimeType(s).pixmap() ); 865// lnk.setIcon(MimeType(s).pixmap() );
871// lnk.setIcon("SoundPlayer"); 866// lnk.setIcon("SoundPlayer");
872 } else { 867 } else {
873 // qDebug("set link2 "+s); 868 // qDebug("set link2 "+s);
874 lnk.setFile( s); 869 lnk.setFile( s);
875// lnk.setIcon(MimeType(s).pixmap() ); 870// lnk.setIcon(MimeType(s).pixmap() );
876// lnk.setIcon("SoundPlayer"); 871// lnk.setIcon("SoundPlayer");
877 } 872 }
878 } 873 }
879 d->selectedFiles->addToSelection( lnk ); 874 d->selectedFiles->addToSelection( lnk );
880 } 875 }
881 Config config( "OpiePlayer" ); 876 Config config( "OpiePlayer" );
882 config.setGroup( "PlayList" ); 877 config.setGroup( "PlayList" );
883 878
884 config.writeEntry("CurrentPlaylist",filename); 879 config.writeEntry("CurrentPlaylist",filename);
885 config.write(); 880 config.write();
886 currentPlayList=filename; 881 currentPlayList=filename;
887 882
888// m3uList->write(); 883// m3uList->write();
889 m3uList->close(); 884 m3uList->close();
890 if(m3uList) delete m3uList; 885 if(m3uList) delete m3uList;
891 886
892 d->selectedFiles->setSelectedItem( s); 887 d->selectedFiles->setSelectedItem( s);
893 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 888 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
894 889
895} 890}
896 891
897/* 892/*
898reads pls and adds files/urls to playlist */ 893reads pls and adds files/urls to playlist */
899void PlayListWidget::readPls( const QString &filename ) { 894void PlayListWidget::readPls( const QString &filename ) {
900 895
901 qDebug( "pls filename is " + filename ); 896 qDebug( "pls filename is " + filename );
902 Om3u *m3uList; 897 Om3u *m3uList;
903 QString s, name; 898 QString s, name;
904 m3uList = new Om3u( filename, IO_ReadOnly ); 899 m3uList = new Om3u( filename, IO_ReadOnly );
905 m3uList->readPls(); 900 m3uList->readPls();
906 901
907 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 902 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
908 s = *it; 903 s = *it;
909 // s.replace( QRegExp( "%20" )," " ); 904 // s.replace( QRegExp( "%20" )," " );
910 DocLnk lnk( s ); 905 DocLnk lnk( s );
911 QFileInfo f( s ); 906 QFileInfo f( s );
912 QString name = f.baseName(); 907 QString name = f.baseName();
913 908
914 if( name.left( 4 ) == "http" ) { 909 if( name.left( 4 ) == "http" ) {
915 name = s.right( s.length() - 7); 910 name = s.right( s.length() - 7);
916 } else { 911 } else {
917 name = s; 912 name = s;
918 } 913 }
919 914
920 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 915 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
921 916
922 lnk.setName( name ); 917 lnk.setName( name );
923 if( s.at( s.length() - 4) == '.') {// if this is probably a file 918 if( s.at( s.length() - 4) == '.') {// if this is probably a file
924 lnk.setFile( s ); 919 lnk.setFile( s );
925 } else { //if its a url 920 } else { //if its a url
926// if( name.right( 1 ).find( '/' ) == -1) { 921// if( name.right( 1 ).find( '/' ) == -1) {
927// s += "/"; 922// s += "/";
928// } 923// }
929 lnk.setFile( s ); 924 lnk.setFile( s );
930 } 925 }
931 lnk.setType( "audio/x-mpegurl" ); 926 lnk.setType( "audio/x-mpegurl" );
932 927
933 lnk.writeLink(); 928 lnk.writeLink();
934 d->selectedFiles->addToSelection( lnk ); 929 d->selectedFiles->addToSelection( lnk );
935 } 930 }
936 931
937 m3uList->close(); 932 m3uList->close();
938 if(m3uList) delete m3uList; 933 if(m3uList) delete m3uList;
939} 934}
940 935
941/* 936/*
942 writes current playlist to current m3u file */ 937 writes current playlist to current m3u file */
943void PlayListWidget::writeCurrentM3u() { 938void PlayListWidget::writeCurrentM3u() {
944 qDebug("writing to current m3u"); 939 qDebug("writing to current m3u");
945 Config cfg( "OpiePlayer" ); 940 Config cfg( "OpiePlayer" );
946 cfg.setGroup("PlayList"); 941 cfg.setGroup("PlayList");
947 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 942 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
948 943
949 Om3u *m3uList; 944 Om3u *m3uList;
950 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 945 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
951 if( d->selectedFiles->first()) { 946 if( d->selectedFiles->first()) {
952 947
953 do { 948 do {
954 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 949 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
955 m3uList->add( d->selectedFiles->current()->file() ); 950 m3uList->add( d->selectedFiles->current()->file() );
956 } 951 }
957 while ( d->selectedFiles->next() ); 952 while ( d->selectedFiles->next() );
958 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 953 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
959 m3uList->write(); 954 m3uList->write();
960 m3uList->close(); 955 m3uList->close();
961 956
962 if(m3uList) delete m3uList; 957 if(m3uList) delete m3uList;
963 } 958 }
964 959
965} 960}
966 961
967 /* 962 /*
968 writes current playlist to m3u file */ 963 writes current playlist to m3u file */
969void PlayListWidget::writem3u() { 964void PlayListWidget::writem3u() {
970 InputDialog *fileDlg; 965 InputDialog *fileDlg;
971 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 966 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
972 fileDlg->exec(); 967 fileDlg->exec();
973 QString name, filename, list; 968 QString name, filename, list;
974 Om3u *m3uList; 969 Om3u *m3uList;
975 970
976 if( fileDlg->result() == 1 ) { 971 if( fileDlg->result() == 1 ) {
977 name = fileDlg->text(); 972 name = fileDlg->text();
978// qDebug( filename ); 973// qDebug( filename );
979 974
980 if( name.left( 1) != "/" ) { 975 if( name.left( 1) != "/" ) {
981 filename = QPEApplication::documentDir() + "/" + name; 976 filename = QPEApplication::documentDir() + "/" + name;
982 } 977 }
983 978
984 if( name.right( 3 ) != "m3u" ) { 979 if( name.right( 3 ) != "m3u" ) {
985 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 980 filename = QPEApplication::documentDir() + "/" +name+".m3u";
986 } 981 }
987 982
988 if( d->selectedFiles->first()) { 983 if( d->selectedFiles->first()) {
989 m3uList = new Om3u(filename, IO_ReadWrite); 984 m3uList = new Om3u(filename, IO_ReadWrite);
990 985
991 do { 986 do {
992 m3uList->add( d->selectedFiles->current()->file()); 987 m3uList->add( d->selectedFiles->current()->file());
993 } 988 }
994 while ( d->selectedFiles->next() ); 989 while ( d->selectedFiles->next() );
995 // qDebug( list ); 990 // qDebug( list );
996 m3uList->write(); 991 m3uList->write();
997 m3uList->close(); 992 m3uList->close();
998 if(m3uList) delete m3uList; 993 if(m3uList) delete m3uList;
999 994
1000 if(fileDlg) delete fileDlg; 995 if(fileDlg) delete fileDlg;
1001 996
1002 DocLnk lnk; 997 DocLnk lnk;
1003 lnk.setFile( filename); 998 lnk.setFile( filename);
1004 lnk.setIcon("opieplayer2/playlist2"); 999 lnk.setIcon("opieplayer2/playlist2");
1005 lnk.setName( name); //sets file name 1000 lnk.setName( name); //sets file name
1006 1001
1007 // qDebug(filename); 1002 // qDebug(filename);
1008 Config config( "OpiePlayer" ); 1003 Config config( "OpiePlayer" );
1009 config.setGroup( "PlayList" ); 1004 config.setGroup( "PlayList" );
1010 1005
1011 config.writeEntry("CurrentPlaylist",filename); 1006 config.writeEntry("CurrentPlaylist",filename);
1012 currentPlayList=filename; 1007 currentPlayList=filename;
1013 1008
1014 if(!lnk.writeLink()) { 1009 if(!lnk.writeLink()) {
1015 qDebug("Writing doclink did not work"); 1010 qDebug("Writing doclink did not work");
1016 } 1011 }
1017 1012
1018 setCaption(tr("OpiePlayer: ") + name); 1013 setCaption(tr("OpiePlayer: ") + name);
1019 } 1014 }
1020 } 1015 }
1021} 1016}
1022 1017
1023void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 1018void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
1024 switch ( e->key() ) { 1019 switch ( e->key() ) {
1025 ////////////////////////////// Zaurus keys 1020 ////////////////////////////// Zaurus keys
1026 case Key_F9: //activity 1021 case Key_F9: //activity
1027 // if(audioUI->isHidden()) 1022 // if(audioUI->isHidden())
1028 // audioUI->showMaximized(); 1023 // audioUI->showMaximized();
1029 break; 1024 break;
1030 case Key_F10: //contacts 1025 case Key_F10: //contacts
1031 // if( videoUI->isHidden()) 1026 // if( videoUI->isHidden())
1032 // videoUI->showMaximized(); 1027 // videoUI->showMaximized();
1033 break; 1028 break;
1034 case Key_F11: //menu 1029 case Key_F11: //menu
1035 break; 1030 break;
1036 case Key_F12: //home 1031 case Key_F12: //home
1037 // doBlank(); 1032 // doBlank();
1038 break; 1033 break;
1039 case Key_F13: //mail 1034 case Key_F13: //mail
1040 // doUnblank(); 1035 // doUnblank();
1041 break; 1036 break;
1042 case Key_Q: //add to playlist 1037 case Key_Q: //add to playlist
1043 addSelected(); 1038 addSelected();
1044 break; 1039 break;
1045 case Key_R: //remove from playlist 1040 case Key_R: //remove from playlist
1046 removeSelected(); 1041 removeSelected();
1047 break; 1042 break;
1048 // case Key_P: //play 1043 // case Key_P: //play
1049 // qDebug("Play"); 1044 // qDebug("Play");
1050 // playSelected(); 1045 // playSelected();
1051 // break; 1046 // break;
1052 case Key_Space: 1047 case Key_Space:
1053 // playSelected(); puh 1048 // playSelected(); puh
1054 break; 1049 break;
1055 case Key_1: 1050 case Key_1:
1056 tabWidget->setCurrentPage( 0 ); 1051 tabWidget->setCurrentPage( 0 );
1057 break; 1052 break;
1058 case Key_2: 1053 case Key_2:
1059 tabWidget->setCurrentPage( 1 ); 1054 tabWidget->setCurrentPage( 1 );
1060 break; 1055 break;
1061 case Key_3: 1056 case Key_3:
1062 tabWidget->setCurrentPage( 2 ); 1057 tabWidget->setCurrentPage( 2 );
1063 break; 1058 break;
1064 case Key_4: 1059 case Key_4:
1065 tabWidget->setCurrentPage( 3 ); 1060 tabWidget->setCurrentPage( 3 );
1066 break; 1061 break;
1067 case Key_Down: 1062 case Key_Down:
1068 if ( !d->selectedFiles->next() ) 1063 if ( !d->selectedFiles->next() )
1069 d->selectedFiles->first(); 1064 d->selectedFiles->first();
1070 break; 1065 break;
1071 case Key_Up: 1066 case Key_Up:
1072 if ( !d->selectedFiles->prev() ) 1067 if ( !d->selectedFiles->prev() )
1073 // d->selectedFiles->last(); 1068 // d->selectedFiles->last();
1074 break; 1069 break;
1075 } 1070 }
1076} 1071}
1077 1072
1078void PlayListWidget::pmViewActivated(int index) { 1073void PlayListWidget::pmViewActivated(int index) {
1079// qDebug("%d", index); 1074// qDebug("%d", index);
1080 switch(index) { 1075 switch(index) {
1081 case -16: 1076 case -16:
1082 { 1077 {
1083 mediaPlayerState->toggleFullscreen(); 1078 mediaPlayerState->toggleFullscreen();
1084 bool b=mediaPlayerState->isFullscreen(); 1079 bool b=mediaPlayerState->isFullscreen();
1085 pmView->setItemChecked( index, b); 1080 pmView->setItemChecked( index, b);
1086 Config cfg( "OpiePlayer" ); 1081 Config cfg( "OpiePlayer" );
1087 cfg.writeEntry( "FullScreen", b ); 1082 cfg.writeEntry( "FullScreen", b );
1088 } 1083 }
1089 break; 1084 break;
1090 }; 1085 };
1091} 1086}
1092 1087
1093void PlayListWidget::populateSkinsMenu() { 1088void PlayListWidget::populateSkinsMenu() {
1094 int item = 0; 1089 int item = 0;
1095 defaultSkinIndex = 0; 1090 defaultSkinIndex = 0;
1096 QString skinName; 1091 QString skinName;
1097 Config cfg( "OpiePlayer" ); 1092 Config cfg( "OpiePlayer" );
1098 cfg.setGroup("Options" ); 1093 cfg.setGroup("Options" );
1099 QString skin = cfg.readEntry( "Skin", "default" ); 1094 QString skin = cfg.readEntry( "Skin", "default" );
1100 1095
1101 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1096 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1102 skinsDir.setFilter( QDir::Dirs ); 1097 skinsDir.setFilter( QDir::Dirs );
1103 skinsDir.setSorting(QDir::Name ); 1098 skinsDir.setSorting(QDir::Name );
1104 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1099 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1105 QFileInfoListIterator it( *skinslist ); 1100 QFileInfoListIterator it( *skinslist );
1106 QFileInfo *fi; 1101 QFileInfo *fi;
1107 while ( ( fi = it.current() ) ) { 1102 while ( ( fi = it.current() ) ) {
1108 skinName = fi->fileName(); 1103 skinName = fi->fileName();
1109// qDebug( fi->fileName() ); 1104// qDebug( fi->fileName() );
1110 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1105 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1111 item = skinsMenu->insertItem( fi->fileName() ) ; 1106 item = skinsMenu->insertItem( fi->fileName() ) ;
1112 } 1107 }
1113 if( skinName == "default" ) { 1108 if( skinName == "default" ) {
1114 defaultSkinIndex = item; 1109 defaultSkinIndex = item;
1115 } 1110 }
1116 if( skinName == skin ) { 1111 if( skinName == skin ) {
1117 skinsMenu->setItemChecked( item, TRUE ); 1112 skinsMenu->setItemChecked( item, TRUE );
1118 } 1113 }
1119 ++it; 1114 ++it;
1120 } 1115 }
1121} 1116}
1122 1117
1123void PlayListWidget::skinsMenuActivated( int item ) { 1118void PlayListWidget::skinsMenuActivated( int item ) {
1124 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1119 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1125 skinsMenu->setItemChecked( i, FALSE ); 1120 skinsMenu->setItemChecked( i, FALSE );
1126 } 1121 }
1127 skinsMenu->setItemChecked( item, TRUE ); 1122 skinsMenu->setItemChecked( item, TRUE );
1128 1123
1129 Config cfg( "OpiePlayer" ); 1124 Config cfg( "OpiePlayer" );
1130 cfg.setGroup("Options"); 1125 cfg.setGroup("Options");
1131 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1126 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1132 QMessageBox::warning( this, tr( "OpiePlayer" ), 1127 QMessageBox::warning( this, tr( "OpiePlayer" ),
1133 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); 1128 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) );
1134} 1129}
1135 1130
1136PlayListWidget::TabType PlayListWidget::currentTab() const 1131PlayListWidget::TabType PlayListWidget::currentTab() const
1137{ 1132{
1138 static const TabType indexToTabType[ TabTypeCount ] = 1133 static const TabType indexToTabType[ TabTypeCount ] =
1139 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 1134 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1140 1135
1141 int index = tabWidget->currentPageIndex(); 1136 int index = tabWidget->currentPageIndex();
1142 assert( index < TabTypeCount && index >= 0 ); 1137 assert( index < TabTypeCount && index >= 0 );
1143 1138
1144 return indexToTabType[ index ]; 1139 return indexToTabType[ index ];
1145} 1140}
1146 1141
1147PlayListWidget::Entry PlayListWidget::currentEntry() const 1142PlayListWidget::Entry PlayListWidget::currentEntry() const
1148{ 1143{
1149 if ( currentTab() == CurrentPlayList ) { 1144 if ( currentTab() == CurrentPlayList ) {
1150 const DocLnk *lnk = current(); 1145 const DocLnk *lnk = current();
1151 return Entry( lnk->name(), lnk->file() ); 1146 return Entry( lnk->name(), lnk->file() );
1152 } 1147 }
1153 1148
1154 return Entry( currentFileListPathName() ); 1149 return Entry( currentFileListPathName() );
1155} 1150}
1156 1151
1157QString PlayListWidget::currentFileListPathName() const { 1152QString PlayListWidget::currentFileListPathName() const {
1158 return currentFileListView()->currentItem()->text( 3 ); 1153 return currentFileListView()->currentItem()->text( 3 );
1159} 1154}
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index a217c94..db7c979 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,229 +1,228 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 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 <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36#include <qpe/fileselector.h> 36#include <qpe/fileselector.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#include <qpe/storage.h> 38#include <qpe/storage.h>
39#include <qpe/mimetype.h> 39#include <qpe/mimetype.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qpe/global.h> 41#include <qpe/global.h>
42#include <qpe/resource.h> 42#include <qpe/resource.h>
43 43
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qaction.h> 45#include <qaction.h>
46#include <qcursor.h> 46#include <qcursor.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qlayout.h> 48#include <qlayout.h>
49 49
50#include "playlistselection.h" 50#include "playlistselection.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52#include "mediaplayerstate.h" 52#include "mediaplayerstate.h"
53#include "inputDialog.h" 53#include "inputDialog.h"
54 54
55//only needed for the random play 55//only needed for the random play
56#include <stdlib.h> 56#include <stdlib.h>
57 57
58#include "audiowidget.h" 58#include "audiowidget.h"
59#include "videowidget.h" 59#include "videowidget.h"
60#include "mediaplayerstate.h" 60#include "mediaplayerstate.h"
61 61
62extern MediaPlayerState *mediaPlayerState; 62extern MediaPlayerState *mediaPlayerState;
63 63
64PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) 64PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl )
65 : QMainWindow( parent, name, fl ) { 65 : QMainWindow( parent, name, fl ) {
66 66
67 d = new PlayListWidgetPrivate; 67 d = new PlayListWidgetPrivate;
68 d->setDocumentUsed = FALSE; 68 d->setDocumentUsed = FALSE;
69 d->current = NULL;
70 69
71 setBackgroundMode( PaletteButton ); 70 setBackgroundMode( PaletteButton );
72 setToolBarsMovable( FALSE ); 71 setToolBarsMovable( FALSE );
73 72
74 // Create Toolbar 73 // Create Toolbar
75 QPEToolBar *toolbar = new QPEToolBar( this ); 74 QPEToolBar *toolbar = new QPEToolBar( this );
76 toolbar->setHorizontalStretchable( TRUE ); 75 toolbar->setHorizontalStretchable( TRUE );
77 76
78 // Create Menubar 77 // Create Menubar
79 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 78 QPEMenuBar *menu = new QPEMenuBar( toolbar );
80 menu->setMargin( 0 ); 79 menu->setMargin( 0 );
81 80
82 bar = new QPEToolBar( this ); 81 bar = new QPEToolBar( this );
83 bar->setLabel( tr( "Play Operations" ) ); 82 bar->setLabel( tr( "Play Operations" ) );
84 83
85 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 84 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
86 tbDeletePlaylist->setFlat( TRUE ); 85 tbDeletePlaylist->setFlat( TRUE );
87 tbDeletePlaylist->setFixedSize( 20, 20 ); 86 tbDeletePlaylist->setFixedSize( 20, 20 );
88 87
89 tbDeletePlaylist->hide(); 88 tbDeletePlaylist->hide();
90 89
91 pmPlayList = new QPopupMenu( this ); 90 pmPlayList = new QPopupMenu( this );
92 menu->insertItem( tr( "File" ), pmPlayList ); 91 menu->insertItem( tr( "File" ), pmPlayList );
93 92
94 pmView = new QPopupMenu( this ); 93 pmView = new QPopupMenu( this );
95 menu->insertItem( tr( "View" ), pmView ); 94 menu->insertItem( tr( "View" ), pmView );
96 pmView->isCheckable(); 95 pmView->isCheckable();
97 96
98 skinsMenu = new QPopupMenu( this ); 97 skinsMenu = new QPopupMenu( this );
99 pmView->insertItem( tr( "Skins" ), skinsMenu ); 98 pmView->insertItem( tr( "Skins" ), skinsMenu );
100 skinsMenu->isCheckable(); 99 skinsMenu->isCheckable();
101 100
102 gammaMenu = new QPopupMenu( this ); 101 gammaMenu = new QPopupMenu( this );
103 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 102 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
104 103
105 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 104 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
106 gammaSlider->setRange( -40, 40 ); 105 gammaSlider->setRange( -40, 40 );
107 gammaSlider->setTickmarks( QSlider::Left ); 106 gammaSlider->setTickmarks( QSlider::Left );
108 gammaSlider->setTickInterval( 20 ); 107 gammaSlider->setTickInterval( 20 );
109 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 108 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
110 gammaSlider->setValue( 0 ); 109 gammaSlider->setValue( 0 );
111 gammaSlider->setMinimumHeight( 50 ); 110 gammaSlider->setMinimumHeight( 50 );
112 111
113 gammaLCD = new QLCDNumber( 3, gammaMenu ); 112 gammaLCD = new QLCDNumber( 3, gammaMenu );
114 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 113 gammaLCD-> setFrameShape ( QFrame::NoFrame );
115 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 114 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
116 115
117 gammaMenu->insertItem( gammaSlider ); 116 gammaMenu->insertItem( gammaSlider );
118 gammaMenu->insertItem( gammaLCD ); 117 gammaMenu->insertItem( gammaLCD );
119 118
120 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 119 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
121 120
122 vbox5 = new QVBox( this ); 121 vbox5 = new QVBox( this );
123 QVBox *vbox4 = new QVBox( vbox5 ); 122 QVBox *vbox4 = new QVBox( vbox5 );
124 QHBox *hbox6 = new QHBox( vbox4 ); 123 QHBox *hbox6 = new QHBox( vbox4 );
125 124
126 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 125 tabWidget = new QTabWidget( hbox6, "tabWidget" );
127 126
128 QWidget *pTab; 127 QWidget *pTab;
129 pTab = new QWidget( tabWidget, "pTab" ); 128 pTab = new QWidget( tabWidget, "pTab" );
130 tabWidget->insertTab( pTab, "Playlist"); 129 tabWidget->insertTab( pTab, "Playlist");
131 130
132 QGridLayout *Playout = new QGridLayout( pTab ); 131 QGridLayout *Playout = new QGridLayout( pTab );
133 Playout->setSpacing( 2); 132 Playout->setSpacing( 2);
134 Playout->setMargin( 2); 133 Playout->setMargin( 2);
135 134
136 // Add the playlist area 135 // Add the playlist area
137 QVBox *vbox3 = new QVBox( pTab ); 136 QVBox *vbox3 = new QVBox( pTab );
138 d->playListFrame = vbox3; 137 d->playListFrame = vbox3;
139 138
140 QHBox *hbox2 = new QHBox( vbox3 ); 139 QHBox *hbox2 = new QHBox( vbox3 );
141 d->selectedFiles = new PlayListSelection( hbox2 ); 140 d->selectedFiles = new PlayListSelection( hbox2 );
142 141
143 vbox1 = new QVBox( hbox2 ); 142 vbox1 = new QVBox( hbox2 );
144 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
145 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 144 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
146 145
147 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 146 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
148 147
149 QWidget *aTab; 148 QWidget *aTab;
150 aTab = new QWidget( tabWidget, "aTab" ); 149 aTab = new QWidget( tabWidget, "aTab" );
151 150
152 QGridLayout *Alayout = new QGridLayout( aTab ); 151 QGridLayout *Alayout = new QGridLayout( aTab );
153 Alayout->setSpacing( 2 ); 152 Alayout->setSpacing( 2 );
154 Alayout->setMargin( 2 ); 153 Alayout->setMargin( 2 );
155 audioView = new QListView( aTab, "Audioview" ); 154 audioView = new QListView( aTab, "Audioview" );
156 audioView->addColumn( tr( "Title" ), 140 ); 155 audioView->addColumn( tr( "Title" ), 140 );
157 audioView->addColumn( tr( "Size" ), -1 ); 156 audioView->addColumn( tr( "Size" ), -1 );
158 audioView->addColumn( tr( "Media" ), 0 ); 157 audioView->addColumn( tr( "Media" ), 0 );
159 audioView->addColumn( tr( "Path" ), -1 ); 158 audioView->addColumn( tr( "Path" ), -1 );
160 audioView->setColumnAlignment( 1, Qt::AlignRight ); 159 audioView->setColumnAlignment( 1, Qt::AlignRight );
161 audioView->setColumnAlignment( 2, Qt::AlignRight ); 160 audioView->setColumnAlignment( 2, Qt::AlignRight );
162 audioView->setAllColumnsShowFocus( TRUE ); 161 audioView->setAllColumnsShowFocus( TRUE );
163 audioView->setSorting( 3, TRUE ); 162 audioView->setSorting( 3, TRUE );
164 audioView->setMultiSelection( TRUE ); 163 audioView->setMultiSelection( TRUE );
165 audioView->setSelectionMode( QListView::Extended ); 164 audioView->setSelectionMode( QListView::Extended );
166 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 165 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
167 tabWidget->insertTab( aTab, tr( "Audio" ) ); 166 tabWidget->insertTab( aTab, tr( "Audio" ) );
168 167
169 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 168 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
170 169
171 QWidget *vTab; 170 QWidget *vTab;
172 vTab = new QWidget( tabWidget, "vTab" ); 171 vTab = new QWidget( tabWidget, "vTab" );
173 172
174 QGridLayout *Vlayout = new QGridLayout( vTab ); 173 QGridLayout *Vlayout = new QGridLayout( vTab );
175 Vlayout->setSpacing( 2 ); 174 Vlayout->setSpacing( 2 );
176 Vlayout->setMargin( 2 ); 175 Vlayout->setMargin( 2 );
177 videoView = new QListView( vTab, "Videoview" ); 176 videoView = new QListView( vTab, "Videoview" );
178 videoView->addColumn( tr( "Title" ), 140); 177 videoView->addColumn( tr( "Title" ), 140);
179 videoView->addColumn( tr( "Size" ), -1 ); 178 videoView->addColumn( tr( "Size" ), -1 );
180 videoView->addColumn(tr( "Media" ), 0 ); 179 videoView->addColumn(tr( "Media" ), 0 );
181 videoView->addColumn(tr( "Path" ), -1 ); 180 videoView->addColumn(tr( "Path" ), -1 );
182 videoView->setColumnAlignment( 1, Qt::AlignRight ); 181 videoView->setColumnAlignment( 1, Qt::AlignRight );
183 videoView->setColumnAlignment( 2, Qt::AlignRight ); 182 videoView->setColumnAlignment( 2, Qt::AlignRight );
184 videoView->setAllColumnsShowFocus( TRUE ); 183 videoView->setAllColumnsShowFocus( TRUE );
185 videoView->setSorting( 3, TRUE ); 184 videoView->setSorting( 3, TRUE );
186 videoView->setMultiSelection( TRUE ); 185 videoView->setMultiSelection( TRUE );
187 videoView->setSelectionMode( QListView::Extended ); 186 videoView->setSelectionMode( QListView::Extended );
188 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 187 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
189 188
190 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 189 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
191 190
192 tabWidget->insertTab( vTab, tr( "Video" ) ); 191 tabWidget->insertTab( vTab, tr( "Video" ) );
193 192
194 //playlists list 193 //playlists list
195 QWidget *LTab; 194 QWidget *LTab;
196 LTab = new QWidget( tabWidget, "LTab" ); 195 LTab = new QWidget( tabWidget, "LTab" );
197 QGridLayout *Llayout = new QGridLayout( LTab ); 196 QGridLayout *Llayout = new QGridLayout( LTab );
198 Llayout->setSpacing( 2 ); 197 Llayout->setSpacing( 2 );
199 Llayout->setMargin( 2 ); 198 Llayout->setMargin( 2 );
200 199
201 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 200 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
202 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 201 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
203 202
204 tabWidget->insertTab( LTab, tr( "Lists" ) ); 203 tabWidget->insertTab( LTab, tr( "Lists" ) );
205 204
206 setCentralWidget( vbox5 ); 205 setCentralWidget( vbox5 );
207} 206}
208 207
209 208
210 209
211PlayListWidgetGui::~PlayListWidgetGui() { 210PlayListWidgetGui::~PlayListWidgetGui() {
212} 211}
213 212
214void PlayListWidgetGui::setView( char view ) { 213void PlayListWidgetGui::setView( char view ) {
215 if ( view == 'l' ) 214 if ( view == 'l' )
216 showMaximized(); 215 showMaximized();
217 else 216 else
218 hide(); 217 hide();
219} 218}
220 219
221 220
222void PlayListWidgetGui::setActiveWindow() { 221void PlayListWidgetGui::setActiveWindow() {
223 // qDebug("SETTING active window"); 222 // qDebug("SETTING active window");
224 // When we get raised we need to ensure that it switches views 223 // When we get raised we need to ensure that it switches views
225 char origView = mediaPlayerState->view(); 224 char origView = mediaPlayerState->view();
226 mediaPlayerState->setView( 'l' ); // invalidate 225 mediaPlayerState->setView( 'l' ); // invalidate
227 mediaPlayerState->setView( origView ); // now switch back 226 mediaPlayerState->setView( origView ); // now switch back
228} 227}
229 228
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 6c35771..4eefb93 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,129 +1,128 @@
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 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 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#ifndef PLAY_LIST_WIDGET_GUI_H 34#ifndef PLAY_LIST_WIDGET_GUI_H
35#define PLAY_LIST_WIDGET_GUI_H 35#define PLAY_LIST_WIDGET_GUI_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpemenubar.h> 40#include <qpe/qpemenubar.h>
41 41
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qpe/fileselector.h> 43#include <qpe/fileselector.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46#include <qaction.h> 46#include <qaction.h>
47#include <qslider.h> 47#include <qslider.h>
48#include <qlcdnumber.h> 48#include <qlcdnumber.h>
49 49
50class PlayListWidgetPrivate; 50class PlayListWidgetPrivate;
51class PlayListSelection; 51class PlayListSelection;
52 52
53class Config; 53class Config;
54class QPEToolBar; 54class QPEToolBar;
55class QListViewItem; 55class QListViewItem;
56class QListView; 56class QListView;
57class QPoint; 57class QPoint;
58class QAction; 58class QAction;
59class QLabel; 59class QLabel;
60 60
61class PlayListWidgetPrivate { 61class PlayListWidgetPrivate {
62public: 62public:
63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
64 QFrame *playListFrame; 64 QFrame *playListFrame;
65 PlayListSelection *selectedFiles; 65 PlayListSelection *selectedFiles;
66 bool setDocumentUsed; 66 bool setDocumentUsed;
67 DocLnk *current;
68}; 67};
69 68
70 69
71class ToolButton : public QToolButton { 70class ToolButton : public QToolButton {
72public: 71public:
73 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 72 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
74 : QToolButton( parent, name ) { 73 : QToolButton( parent, name ) {
75 setTextLabel( name ); 74 setTextLabel( name );
76 setPixmap( Resource::loadPixmap( icon ) ); 75 setPixmap( Resource::loadPixmap( icon ) );
77 setAutoRaise( TRUE ); 76 setAutoRaise( TRUE );
78 setFocusPolicy( QWidget::NoFocus ); 77 setFocusPolicy( QWidget::NoFocus );
79 setToggleButton( t ); 78 setToggleButton( t );
80 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 79 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
81 QPEMenuToolFocusManager::manager()->addWidget( this ); 80 QPEMenuToolFocusManager::manager()->addWidget( this );
82 } 81 }
83}; 82};
84 83
85 84
86class MenuItem : public QAction { 85class MenuItem : public QAction {
87 86
88public: 87public:
89 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 88 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
90 : QAction( text, QString::null, 0, 0 ) { 89 : QAction( text, QString::null, 0, 0 ) {
91 connect( this, SIGNAL( activated() ), handler, slot ); 90 connect( this, SIGNAL( activated() ), handler, slot );
92 addTo( parent ); 91 addTo( parent );
93 } 92 }
94}; 93};
95 94
96class PlayListWidgetGui : public QMainWindow { 95class PlayListWidgetGui : public QMainWindow {
97 Q_OBJECT 96 Q_OBJECT
98public: 97public:
99 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 98 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 );
100 ~PlayListWidgetGui(); 99 ~PlayListWidgetGui();
101 100
102protected: 101protected:
103 QTabWidget * tabWidget; 102 QTabWidget * tabWidget;
104 QListView *audioView, *videoView, *playlistView; 103 QListView *audioView, *videoView, *playlistView;
105 QLabel *libString; 104 QLabel *libString;
106 QPopupMenu *pmView ; 105 QPopupMenu *pmView ;
107 QPopupMenu *gammaMenu; 106 QPopupMenu *gammaMenu;
108 QSlider *gammaSlider; 107 QSlider *gammaSlider;
109 QLCDNumber *gammaLCD; 108 QLCDNumber *gammaLCD;
110 bool fromSetDocument; 109 bool fromSetDocument;
111 bool insanityBool; 110 bool insanityBool;
112 QString setDocFileRef; 111 QString setDocFileRef;
113 // retrieve the current playlist entry (media file link) 112 // retrieve the current playlist entry (media file link)
114 QPushButton *tbDeletePlaylist; 113 QPushButton *tbDeletePlaylist;
115 int selected; 114 int selected;
116 QPopupMenu *pmPlayList; 115 QPopupMenu *pmPlayList;
117 FileSelector* playLists; 116 FileSelector* playLists;
118 QPopupMenu *skinsMenu; 117 QPopupMenu *skinsMenu;
119 PlayListWidgetPrivate *d; // Private implementation data 118 PlayListWidgetPrivate *d; // Private implementation data
120 QVBox *vbox1; 119 QVBox *vbox1;
121 QVBox *vbox5; 120 QVBox *vbox5;
122 QPEToolBar *bar; 121 QPEToolBar *bar;
123 void setActiveWindow(); // need to handle this to show the right view 122 void setActiveWindow(); // need to handle this to show the right view
124 void setView( char ); 123 void setView( char );
125 124
126}; 125};
127 126
128#endif 127#endif
129 128