summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-08-22 01:35:24 (UTC)
committer llornkcor <llornkcor>2002-08-22 01:35:24 (UTC)
commitee90b966cfc262770ef5a45c2bad0af6766245a2 (patch) (unidiff)
tree3b80601759e3a2418b1b805229e4ea074fd7708f
parentdbf4e3458811379488842f5d83650c7e4c6831aa (diff)
downloadopie-ee90b966cfc262770ef5a45c2bad0af6766245a2.zip
opie-ee90b966cfc262770ef5a45c2bad0af6766245a2.tar.gz
opie-ee90b966cfc262770ef5a45c2bad0af6766245a2.tar.bz2
should scan for file at startup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
2 files changed, 8 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 603d426..bf2acc8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,302 +1,303 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6 6
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qwidgetstack.h> 9#include <qwidgetstack.h>
10#include <qfile.h> 10#include <qfile.h>
11 11
12#include "mediaplayer.h" 12#include "mediaplayer.h"
13#include "playlistwidget.h" 13#include "playlistwidget.h"
14#include "audiowidget.h" 14#include "audiowidget.h"
15#include "videowidget.h" 15#include "videowidget.h"
16#include "volumecontrol.h" 16#include "volumecontrol.h"
17 17
18#include "mediaplayerstate.h" 18#include "mediaplayerstate.h"
19 19
20// for setBacklight() 20// for setBacklight()
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <sys/file.h> 22#include <sys/file.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24 24
25 25
26extern AudioWidget *audioUI; 26extern AudioWidget *audioUI;
27extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
28extern PlayListWidget *playList; 28extern PlayListWidget *playList;
29extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
30 30
31 31
32#define FBIOBLANK 0x4611 32#define FBIOBLANK 0x4611
33 33
34MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 34MediaPlayer::MediaPlayer( QObject *parent, const char *name )
35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
36 36
37 playList->setCaption(tr("OpiePlayer: Initializating")); 37 playList->setCaption(tr("OpiePlayer: Initializating"));
38 38
39 qApp->processEvents(); 39 qApp->processEvents();
40 // QPEApplication::grabKeyboard(); // EVIL 40 // QPEApplication::grabKeyboard(); // EVIL
41 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 41 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
42 42
43 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 43 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
44 44
45 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
46 46
47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
49 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 49 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
50 50
51 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 51 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
52 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 52 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
53 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 53 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
54 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 54 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
55 55
56 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 56 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
57 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 57 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
58 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 58 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
59 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 59 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
60 60
61 volControl = new VolumeControl; 61 volControl = new VolumeControl;
62 xineControl = new XineControl(); 62 xineControl = new XineControl();
63 playList->setCaption(tr("OpiePlayer")); 63 playList->setCaption(tr("OpiePlayer"));
64} 64}
65 65
66MediaPlayer::~MediaPlayer() { 66MediaPlayer::~MediaPlayer() {
67 delete xineControl; 67 delete xineControl;
68 delete volControl; 68 delete volControl;
69} 69}
70 70
71void MediaPlayer::pauseCheck( bool b ) { 71void MediaPlayer::pauseCheck( bool b ) {
72 if ( b && !mediaPlayerState->playing() ) { 72 if ( b && !mediaPlayerState->playing() ) {
73 mediaPlayerState->setPaused( FALSE ); 73 mediaPlayerState->setPaused( FALSE );
74 } 74 }
75} 75}
76 76
77void MediaPlayer::play() { 77void MediaPlayer::play() {
78 mediaPlayerState->setPlaying( FALSE ); 78 mediaPlayerState->setPlaying( FALSE );
79 mediaPlayerState->setPlaying( TRUE ); 79 mediaPlayerState->setPlaying( TRUE );
80} 80}
81 81
82void MediaPlayer::setPlaying( bool play ) { 82void MediaPlayer::setPlaying( bool play ) {
83 if ( !play ) { 83 if ( !play ) {
84 return; 84 return;
85 } 85 }
86 86
87 if ( mediaPlayerState->paused() ) { 87 if ( mediaPlayerState->paused() ) {
88 mediaPlayerState->setPaused( FALSE ); 88 mediaPlayerState->setPaused( FALSE );
89 return; 89 return;
90 } 90 }
91 91
92 const DocLnk *playListCurrent = playList->current(); 92 const DocLnk *playListCurrent = playList->current();
93 if ( playListCurrent != NULL ) { 93 if ( playListCurrent != NULL ) {
94 currentFile = playListCurrent; 94 currentFile = playListCurrent;
95 } 95 }
96 96
97 xineControl->play( currentFile->file() ); 97 xineControl->play( currentFile->file() );
98 98
99 long seconds = mediaPlayerState->length();// 99 long seconds = mediaPlayerState->length();//
100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
101 qDebug(time); 101 qDebug(time);
102 102
103 QString tickerText; 103 QString tickerText;
104 if( currentFile->file().left(4) == "http" ) 104 if( currentFile->file().left(4) == "http" )
105 tickerText= tr( " File: " ) + currentFile->name(); 105 tickerText= tr( " File: " ) + currentFile->name();
106 else 106 else
107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
108 108
109 audioUI->setTickerText( currentFile->file( ) ); 109 audioUI->setTickerText( currentFile->file( ) );
110 110
111} 111}
112 112
113 113
114void MediaPlayer::prev() { 114void MediaPlayer::prev() {
115 if ( playList->prev() ) { 115 if ( playList->prev() ) {
116 play(); 116 play();
117 } else if ( mediaPlayerState->looping() ) { 117 } else if ( mediaPlayerState->looping() ) {
118 if ( playList->last() ) { 118 if ( playList->last() ) {
119 play(); 119 play();
120 } 120 }
121 } else { 121 } else {
122 mediaPlayerState->setList(); 122 mediaPlayerState->setList();
123 } 123 }
124} 124}
125 125
126 126
127void MediaPlayer::next() { 127void MediaPlayer::next() {
128 if ( playList->next() ) { 128 if ( playList->next() ) {
129 play(); 129 play();
130 } else if ( mediaPlayerState->looping() ) { 130 } else if ( mediaPlayerState->looping() ) {
131 if ( playList->first() ) { 131 if ( playList->first() ) {
132 play(); 132 play();
133 } 133 }
134 } else { 134 } else {
135 mediaPlayerState->setList(); 135 mediaPlayerState->setList();
136 } 136 }
137} 137}
138 138
139 139
140void MediaPlayer::startDecreasingVolume() { 140void MediaPlayer::startDecreasingVolume() {
141 volumeDirection = -1; 141 volumeDirection = -1;
142 startTimer( 100 ); 142 startTimer( 100 );
143 volControl->decVol(2); 143 volControl->decVol(2);
144} 144}
145 145
146 146
147void MediaPlayer::startIncreasingVolume() { 147void MediaPlayer::startIncreasingVolume() {
148 volumeDirection = +1; 148 volumeDirection = +1;
149 startTimer( 100 ); 149 startTimer( 100 );
150 volControl->incVol(2); 150 volControl->incVol(2);
151} 151}
152 152
153 153
154bool drawnOnScreenDisplay = FALSE; 154bool drawnOnScreenDisplay = FALSE;
155unsigned int onScreenDisplayVolume = 0; 155unsigned int onScreenDisplayVolume = 0;
156const int yoff = 110; 156const int yoff = 110;
157 157
158void MediaPlayer::stopChangingVolume() { 158void MediaPlayer::stopChangingVolume() {
159 killTimers(); 159 killTimers();
160 // Get rid of the on-screen display stuff 160 // Get rid of the on-screen display stuff
161 drawnOnScreenDisplay = FALSE; 161 drawnOnScreenDisplay = FALSE;
162 onScreenDisplayVolume = 0; 162 onScreenDisplayVolume = 0;
163 int w=0; 163 int w=0;
164 int h=0; 164 int h=0;
165 if( !xineControl->hasVideo()) { 165 if( !xineControl->hasVideo()) {
166 w = audioUI->width(); 166 w = audioUI->width();
167 h = audioUI->height(); 167 h = audioUI->height();
168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 168 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
169 } else { 169 } else {
170 w = videoUI->width(); 170 w = videoUI->width();
171 h = videoUI->height(); 171 h = videoUI->height();
172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 172 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
173 } 173 }
174} 174}
175 175
176 176
177void MediaPlayer::timerEvent( QTimerEvent * ) { 177void MediaPlayer::timerEvent( QTimerEvent * ) {
178 if ( volumeDirection == +1 ) { 178 if ( volumeDirection == +1 ) {
179 volControl->incVol(2); 179 volControl->incVol(2);
180 } else if ( volumeDirection == -1 ) { 180 } else if ( volumeDirection == -1 ) {
181 volControl->decVol(2); 181 volControl->decVol(2);
182 } 182 }
183 183
184 184
185 // TODO FIXME 185 // TODO FIXME
186 // huh??
186 unsigned int v= 0; 187 unsigned int v= 0;
187 v = volControl->volume(); 188 v = volControl->volume();
188 v = v / 10; 189 v = v / 10;
189 190
190 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 191 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
191 return; 192 return;
192 } 193 }
193 194
194 int w=0; int h=0; 195 int w=0; int h=0;
195 if( !xineControl->hasVideo()) { 196 if( !xineControl->hasVideo()) {
196 w = audioUI->width(); 197 w = audioUI->width();
197 h = audioUI->height(); 198 h = audioUI->height();
198 199
199 if ( drawnOnScreenDisplay ) { 200 if ( drawnOnScreenDisplay ) {
200 if ( onScreenDisplayVolume > v ) { 201 if ( onScreenDisplayVolume > v ) {
201 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 202 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
202 } 203 }
203 } 204 }
204 drawnOnScreenDisplay = TRUE; 205 drawnOnScreenDisplay = TRUE;
205 onScreenDisplayVolume = v; 206 onScreenDisplayVolume = v;
206 QPainter p( audioUI ); 207 QPainter p( audioUI );
207 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 208 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
208 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 209 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
209 210
210 QFont f; 211 QFont f;
211 f.setPixelSize( 20 ); 212 f.setPixelSize( 20 );
212 f.setBold( TRUE ); 213 f.setBold( TRUE );
213 p.setFont( f ); 214 p.setFont( f );
214 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 215 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
215 216
216 for ( unsigned int i = 0; i < 10; i++ ) { 217 for ( unsigned int i = 0; i < 10; i++ ) {
217 if ( v > i ) { 218 if ( v > i ) {
218 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 219 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
219 } else { 220 } else {
220 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 221 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
221 } 222 }
222 } 223 }
223 } else { 224 } else {
224 w = videoUI->width(); 225 w = videoUI->width();
225 h = videoUI->height(); 226 h = videoUI->height();
226 227
227 if ( drawnOnScreenDisplay ) { 228 if ( drawnOnScreenDisplay ) {
228 if ( onScreenDisplayVolume > v ) { 229 if ( onScreenDisplayVolume > v ) {
229 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 230 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
230 } 231 }
231 } 232 }
232 drawnOnScreenDisplay = TRUE; 233 drawnOnScreenDisplay = TRUE;
233 onScreenDisplayVolume = v; 234 onScreenDisplayVolume = v;
234 QPainter p( videoUI ); 235 QPainter p( videoUI );
235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 236 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
236 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 237 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
237 238
238 QFont f; 239 QFont f;
239 f.setPixelSize( 20 ); 240 f.setPixelSize( 20 );
240 f.setBold( TRUE ); 241 f.setBold( TRUE );
241 p.setFont( f ); 242 p.setFont( f );
242 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 243 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
243 244
244 for ( unsigned int i = 0; i < 10; i++ ) { 245 for ( unsigned int i = 0; i < 10; i++ ) {
245 if ( v > i ) { 246 if ( v > i ) {
246 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 247 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
247 } else { 248 } else {
248 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 249 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
249 } 250 }
250 } 251 }
251 } 252 }
252} 253}
253 254
254 255
255void MediaPlayer::blank( bool b ) { 256void MediaPlayer::blank( bool b ) {
256 fd=open("/dev/fb0",O_RDWR); 257 fd=open("/dev/fb0",O_RDWR);
257 if (fd != -1) { 258 if (fd != -1) {
258 if ( b ) { 259 if ( b ) {
259 qDebug("do blanking"); 260 qDebug("do blanking");
260 ioctl( fd, FBIOBLANK, 3 ); 261 ioctl( fd, FBIOBLANK, 3 );
261 isBlanked = TRUE; 262 isBlanked = TRUE;
262 } else { 263 } else {
263 qDebug("do unblanking"); 264 qDebug("do unblanking");
264 ioctl( fd, FBIOBLANK, 0); 265 ioctl( fd, FBIOBLANK, 0);
265 isBlanked = FALSE; 266 isBlanked = FALSE;
266 } 267 }
267 close( fd ); 268 close( fd );
268 } else { 269 } else {
269 qDebug("<< /dev/fb0 could not be opened >>"); 270 qDebug("<< /dev/fb0 could not be opened >>");
270 } 271 }
271} 272}
272 273
273void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 274void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
274 switch ( e->key() ) { 275 switch ( e->key() ) {
275////////////////////////////// Zaurus keys 276////////////////////////////// Zaurus keys
276 case Key_Home: 277 case Key_Home:
277 break; 278 break;
278 case Key_F9: //activity 279 case Key_F9: //activity
279 break; 280 break;
280 case Key_F10: //contacts 281 case Key_F10: //contacts
281 break; 282 break;
282 case Key_F11: //menu 283 case Key_F11: //menu
283 break; 284 break;
284 case Key_F12: //home 285 case Key_F12: //home
285 qDebug("Blank here"); 286 qDebug("Blank here");
286// mediaPlayerState->toggleBlank(); 287// mediaPlayerState->toggleBlank();
287 break; 288 break;
288 case Key_F13: //mail 289 case Key_F13: //mail
289 qDebug("Blank here"); 290 qDebug("Blank here");
290 // mediaPlayerState->toggleBlank(); 291 // mediaPlayerState->toggleBlank();
291 break; 292 break;
292 } 293 }
293} 294}
294 295
295void MediaPlayer::cleanUp() {// this happens on closing 296void MediaPlayer::cleanUp() {// this happens on closing
296 Config cfg( "OpiePlayer" ); 297 Config cfg( "OpiePlayer" );
297 mediaPlayerState->writeConfig( cfg ); 298 mediaPlayerState->writeConfig( cfg );
298 playList->writeConfig( cfg ); 299 playList->writeConfig( cfg );
299 300
300// QPEApplication::grabKeyboard(); 301// QPEApplication::grabKeyboard();
301// QPEApplication::ungrabKeyboard(); 302// QPEApplication::ungrabKeyboard();
302} 303}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6c7f6ba..603a7a3 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1057 +1,1060 @@
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..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library 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  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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 <qdir.h> 41#include <qdir.h>
42#include <qmessagebox.h> 42#include <qmessagebox.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qtextstream.h> 44#include <qtextstream.h>
45 45
46#include "playlistselection.h" 46#include "playlistselection.h"
47#include "playlistwidget.h" 47#include "playlistwidget.h"
48#include "mediaplayerstate.h" 48#include "mediaplayerstate.h"
49#include "inputDialog.h" 49#include "inputDialog.h"
50 50
51//only needed for the random play 51//only needed for the random play
52#include <stdlib.h> 52#include <stdlib.h>
53 53
54#include "audiowidget.h" 54#include "audiowidget.h"
55#include "videowidget.h" 55#include "videowidget.h"
56 56
57extern MediaPlayerState *mediaPlayerState; 57extern MediaPlayerState *mediaPlayerState;
58 58
59 59
60PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 60PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
61 : PlayListWidgetGui( parent, name, fl ) { 61 : PlayListWidgetGui( parent, name, fl ) {
62 62
63 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", 63 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist",
64 this , SLOT(addSelected() ) ); 64 this , SLOT(addSelected() ) );
65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", 65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist",
66 this , SLOT(removeSelected() ) ); 66 this , SLOT(removeSelected() ) );
67 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 67 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
68 this , SLOT( btnPlay( bool) ), TRUE ); 68 this , SLOT( btnPlay( bool) ), TRUE );
69 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 69 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
70 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 70 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
71 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 71 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
72 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 72 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
73 73
74 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 74 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
75 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 75 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
76 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 76 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
78 pmPlayList->insertSeparator(-1); 78 pmPlayList->insertSeparator(-1);
79 (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 79 (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); 80 (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
81 pmPlayList->insertSeparator(-1); 81 pmPlayList->insertSeparator(-1);
82 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 82 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
83 pmPlayList->insertSeparator(-1); 83 pmPlayList->insertSeparator(-1);
84 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 84 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
86 86
87 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); 87 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
88 88
89 Config cfg( "OpiePlayer" ); 89 Config cfg( "OpiePlayer" );
90 bool b= cfg.readBoolEntry("FullScreen", 0); 90 bool b= cfg.readBoolEntry("FullScreen", 0);
91 mediaPlayerState->setFullscreen( b ); 91 mediaPlayerState->setFullscreen( b );
92 pmView->setItemChecked( -16, b ); 92 pmView->setItemChecked( -16, b );
93 93
94 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); 94 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) );
95 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); 95 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) );
96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); 96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) );
97 QVBox *stretch2 = new QVBox( vbox1 ); 97 QVBox *stretch2 = new QVBox( vbox1 );
98 98
99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); 99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) );
100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); 100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) );
101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); 101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) );
102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
107 this,SLOT( playIt( QListViewItem *) ) ); 107 this,SLOT( playIt( QListViewItem *) ) );
108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
112 this,SLOT( playIt( QListViewItem *) ) ); 112 this,SLOT( playIt( QListViewItem *) ) );
113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); 115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) );
116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
121 121
122 readConfig( cfg ); 122 readConfig( cfg );
123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); 123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
124 loadList(DocLnk( currentPlaylist ) ); 124 loadList(DocLnk( currentPlaylist ) );
125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); 125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
126 126
127 // see which skins are installed 127 // see which skins are installed
128 videoScan=FALSE;
129 audioScan=FALSE;
128 populateSkinsMenu(); 130 populateSkinsMenu();
129 initializeStates(); 131 initializeStates();
130} 132}
131 133
132 134
133PlayListWidget::~PlayListWidget() { 135PlayListWidget::~PlayListWidget() {
134/* fixing symptoms and not sources is entirely stupid - zecke */ 136 // WTF?!@?!
135// Config cfg( "OpiePlayer" ); 137
136// writeConfig( cfg );
137 if ( d->current ) { 138 if ( d->current ) {
138 delete d->current; 139 delete d->current;
139 } 140 }
140 delete d; 141 delete d;
141} 142}
142 143
143 144
144void PlayListWidget::initializeStates() { 145void PlayListWidget::initializeStates() {
145 d->tbPlay->setOn( mediaPlayerState->playing() ); 146 d->tbPlay->setOn( mediaPlayerState->playing() );
146 d->tbLoop->setOn( mediaPlayerState->looping() ); 147 d->tbLoop->setOn( mediaPlayerState->looping() );
147 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 148 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
148 setPlaylist( true ); 149 setPlaylist( true );
149} 150}
150 151
151 152
152void PlayListWidget::readConfig( Config& cfg ) { 153void PlayListWidget::readConfig( Config& cfg ) {
153 cfg.setGroup( "PlayList" ); 154 cfg.setGroup( "PlayList" );
154 QString currentString = cfg.readEntry( "current", "" ); 155 QString currentString = cfg.readEntry( "current", "" );
155 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); 156 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
156 for ( int i = 0; i < noOfFiles; i++ ) { 157 for ( int i = 0; i < noOfFiles; i++ ) {
157 QString entryName; 158 QString entryName;
158 entryName.sprintf( "File%i", i + 1 ); 159 entryName.sprintf( "File%i", i + 1 );
159 QString linkFile = cfg.readEntry( entryName ); 160 QString linkFile = cfg.readEntry( entryName );
160 if( QFileInfo( linkFile ).exists() ) { 161 if( QFileInfo( linkFile ).exists() ) {
161 DocLnk lnk( linkFile ); 162 DocLnk lnk( linkFile );
162 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) { 163 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) {
163 d->selectedFiles->addToSelection( lnk ); 164 d->selectedFiles->addToSelection( lnk );
164 } 165 }
165 } 166 }
166 } 167 }
167 d->selectedFiles->setSelectedItem( currentString ); 168 d->selectedFiles->setSelectedItem( currentString );
168} 169}
169 170
170 171
171void PlayListWidget::writeConfig( Config& cfg ) const { 172void PlayListWidget::writeConfig( Config& cfg ) const {
172 d->selectedFiles->writeCurrent( cfg ); 173 d->selectedFiles->writeCurrent( cfg );
173 cfg.setGroup( "PlayList" ); 174 cfg.setGroup( "PlayList" );
174 int noOfFiles = 0; 175 int noOfFiles = 0;
175 d->selectedFiles->first(); 176 d->selectedFiles->first();
176 do { 177 do {
177 const DocLnk *lnk = d->selectedFiles->current(); 178 const DocLnk *lnk = d->selectedFiles->current();
178 if ( lnk ) { 179 if ( lnk ) {
179 QString entryName; 180 QString entryName;
180 entryName.sprintf( "File%i", noOfFiles + 1 ); 181 entryName.sprintf( "File%i", noOfFiles + 1 );
181 cfg.writeEntry( entryName, lnk->linkFile() ); 182 cfg.writeEntry( entryName, lnk->linkFile() );
182 // if this link does exist, add it so we have the file 183 // if this link does exist, add it so we have the file
183 // next time... 184 // next time...
184 if ( !QFile::exists( lnk->linkFile() ) ) { 185 if ( !QFile::exists( lnk->linkFile() ) ) {
185 // the way writing lnks doesn't really check for out 186 // the way writing lnks doesn't really check for out
186 // of disk space, but check it anyway. 187 // of disk space, but check it anyway.
187 if ( !lnk->writeLink() ) { 188 if ( !lnk->writeLink() ) {
188 QMessageBox::critical( 0, tr("Out of space"), 189 QMessageBox::critical( 0, tr("Out of space"),
189 tr( "There was a problem saving " 190 tr( "There was a problem saving "
190 "the playlist.\n" 191 "the playlist.\n"
191 "Your playlist " 192 "Your playlist "
192 "may be missing some entries\n" 193 "may be missing some entries\n"
193 "the next time you start it." ) 194 "the next time you start it." )
194 ); 195 );
195 } 196 }
196 } 197 }
197 noOfFiles++; 198 noOfFiles++;
198 } 199 }
199 } 200 }
200 while ( d->selectedFiles->next() ); 201 while ( d->selectedFiles->next() );
201 cfg.writeEntry("NumberOfFiles", noOfFiles ); 202 cfg.writeEntry("NumberOfFiles", noOfFiles );
202} 203}
203 204
204 205
205void PlayListWidget::addToSelection( const DocLnk& lnk ) { 206void PlayListWidget::addToSelection( const DocLnk& lnk ) {
206 d->setDocumentUsed = FALSE; 207 d->setDocumentUsed = FALSE;
207 if ( mediaPlayerState->playlist() ) { 208 if ( mediaPlayerState->playlist() ) {
208 if( QFileInfo( lnk.file() ).exists() || lnk.file().left(4) == "http" ) 209 if( QFileInfo( lnk.file() ).exists() || lnk.file().left(4) == "http" )
209 d->selectedFiles->addToSelection( lnk ); 210 d->selectedFiles->addToSelection( lnk );
210 } 211 }
211 else 212 else
212 mediaPlayerState->setPlaying( TRUE ); 213 mediaPlayerState->setPlaying( TRUE );
213} 214}
214 215
215 216
216void PlayListWidget::clearList() { 217void PlayListWidget::clearList() {
217 while ( first() ) { 218 while ( first() ) {
218 d->selectedFiles->removeSelected(); 219 d->selectedFiles->removeSelected();
219 } 220 }
220} 221}
221 222
222 223
223void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 224void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
224 switch (mouse) { 225 switch (mouse) {
225 case 1: 226 case 1:
226 break; 227 break;
227 case 2: 228 case 2:
228 { 229 {
229 QPopupMenu m; 230 QPopupMenu m;
230 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 231 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
231 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 232 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
232 m.exec( QCursor::pos() ); 233 m.exec( QCursor::pos() );
233 } 234 }
234 break; 235 break;
235 } 236 }
236} 237}
237 238
238 239
239void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 240void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
240 switch (mouse) { 241 switch (mouse) {
241 case 1: 242 case 1:
242 break; 243 break;
243 case 2: 244 case 2:
244 { 245 {
245 QPopupMenu m; 246 QPopupMenu m;
246 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 247 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
247 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 248 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
248 m.exec( QCursor::pos() ); 249 m.exec( QCursor::pos() );
249 } 250 }
250 break; 251 break;
251 } 252 }
252} 253}
253 254
254 255
255void PlayListWidget::addAllToList() { 256void PlayListWidget::addAllToList() {
256 DocLnkSet filesAll; 257 DocLnkSet filesAll;
257 Global::findDocuments(&filesAll, "video/*;audio/*"); 258 Global::findDocuments(&filesAll, "video/*;audio/*");
258 QListIterator<DocLnk> Adit( filesAll.children() ); 259 QListIterator<DocLnk> Adit( filesAll.children() );
259 for ( ; Adit.current(); ++Adit ) { 260 for ( ; Adit.current(); ++Adit ) {
260 if( QFileInfo( Adit.current()->file() ).exists() ) { 261 if( QFileInfo( Adit.current()->file() ).exists() ) {
261 d->selectedFiles->addToSelection( **Adit ); 262 d->selectedFiles->addToSelection( **Adit );
262 } 263 }
263 } 264 }
264} 265}
265 266
266 267
267void PlayListWidget::addAllMusicToList() { 268void PlayListWidget::addAllMusicToList() {
268 QListIterator<DocLnk> dit( files.children() ); 269 QListIterator<DocLnk> dit( files.children() );
269 for ( ; dit.current(); ++dit ) { 270 for ( ; dit.current(); ++dit ) {
270 if( QFileInfo(dit.current()->file() ).exists() ) { 271 if( QFileInfo(dit.current()->file() ).exists() ) {
271 d->selectedFiles->addToSelection( **dit ); 272 d->selectedFiles->addToSelection( **dit );
272 } 273 }
273 } 274 }
274} 275}
275 276
276 277
277void PlayListWidget::addAllVideoToList() { 278void PlayListWidget::addAllVideoToList() {
278 QListIterator<DocLnk> dit( vFiles.children() ); 279 QListIterator<DocLnk> dit( vFiles.children() );
279 for ( ; dit.current(); ++dit ) { 280 for ( ; dit.current(); ++dit ) {
280 if( QFileInfo( dit.current()->file() ).exists() ) { 281 if( QFileInfo( dit.current()->file() ).exists() ) {
281 d->selectedFiles->addToSelection( **dit ); 282 d->selectedFiles->addToSelection( **dit );
282 } 283 }
283 } 284 }
284} 285}
285 286
286 287
287void PlayListWidget::setDocument( const QString& fileref ) { 288void PlayListWidget::setDocument( const QString& fileref ) {
288 //qDebug( fileref ); 289 //qDebug( fileref );
289 fromSetDocument = TRUE; 290 fromSetDocument = TRUE;
290 if ( fileref.isNull() ) { 291 if ( fileref.isNull() ) {
291 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 292 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
292 return; 293 return;
293 } 294 }
294 295
295 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 296 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
296 readm3u( fileref ); 297 readm3u( fileref );
297 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 298 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
298 readPls( fileref ); 299 readPls( fileref );
299 } else if( fileref.find( "playlist", 0, TRUE) != -1 ) {//is playlist 300 } else if( fileref.find( "playlist", 0, TRUE) != -1 ) {//is playlist
300 clearList(); 301 clearList();
301 loadList( DocLnk( fileref ) ); 302 loadList( DocLnk( fileref ) );
302 d->selectedFiles->first(); 303 d->selectedFiles->first();
303 } else { 304 } else {
304 clearList(); 305 clearList();
305 addToSelection( DocLnk( fileref ) ); 306 addToSelection( DocLnk( fileref ) );
306 d->setDocumentUsed = TRUE; 307 d->setDocumentUsed = TRUE;
307 mediaPlayerState->setPlaying( FALSE ); 308 mediaPlayerState->setPlaying( FALSE );
308 qApp->processEvents(); 309 qApp->processEvents();
309 mediaPlayerState->setPlaying( TRUE ); 310 mediaPlayerState->setPlaying( TRUE );
310 qApp->processEvents(); 311 qApp->processEvents();
311 setCaption( tr("OpiePlayer") ); 312 setCaption( tr("OpiePlayer") );
312 } 313 }
313} 314}
314 315
315 316
316void PlayListWidget::useSelectedDocument() { 317void PlayListWidget::useSelectedDocument() {
317 d->setDocumentUsed = FALSE; 318 d->setDocumentUsed = FALSE;
318} 319}
319 320
320 321
321const DocLnk *PlayListWidget::current() { // this is fugly 322const DocLnk *PlayListWidget::current() { // this is fugly
322 switch ( tabWidget->currentPageIndex() ) { 323 switch ( tabWidget->currentPageIndex() ) {
323 case 0: //playlist 324 case 0: //playlist
324 { 325 {
325// qDebug("playlist"); 326// qDebug("playlist");
326 if ( mediaPlayerState->playlist() ) { 327 if ( mediaPlayerState->playlist() ) {
327 return d->selectedFiles->current(); 328 return d->selectedFiles->current();
328 } else if ( d->setDocumentUsed && d->current ) { 329 } else if ( d->setDocumentUsed && d->current ) {
329 return d->current; 330 return d->current;
330 } else { 331 } else {
331 return d->files->selected(); 332 return d->files->selected();
332 } 333 }
333 } 334 }
334 break; 335 break;
335 case 1://audio 336 case 1://audio
336 { 337 {
337// qDebug("audioView"); 338// qDebug("audioView");
338 QListIterator<DocLnk> dit( files.children() ); 339 QListIterator<DocLnk> dit( files.children() );
339 for ( ; dit.current(); ++dit ) { 340 for ( ; dit.current(); ++dit ) {
340 if( dit.current()->name() == audioView->currentItem()->text( 0 ) && !insanityBool ) { 341 if( dit.current()->name() == audioView->currentItem()->text( 0 ) && !insanityBool ) {
341 insanityBool = TRUE; 342 insanityBool = TRUE;
342 return dit; 343 return dit;
343 } 344 }
344 } 345 }
345 } 346 }
346 break; 347 break;
347 case 2: // video 348 case 2: // video
348 { 349 {
349// qDebug("videoView"); 350// qDebug("videoView");
350 QListIterator<DocLnk> Vdit( vFiles.children() ); 351 QListIterator<DocLnk> Vdit( vFiles.children() );
351 for ( ; Vdit.current(); ++Vdit ) { 352 for ( ; Vdit.current(); ++Vdit ) {
352 if( Vdit.current()->name() == videoView->currentItem()->text( 0 ) && !insanityBool) { 353 if( Vdit.current()->name() == videoView->currentItem()->text( 0 ) && !insanityBool) {
353 insanityBool = TRUE; 354 insanityBool = TRUE;
354 return Vdit; 355 return Vdit;
355 } 356 }
356 } 357 }
357 } 358 }
358 break; 359 break;
359 }; 360 };
360 return 0; 361 return 0;
361} 362}
362 363
363 364
364bool PlayListWidget::prev() { 365bool PlayListWidget::prev() {
365 if ( mediaPlayerState->playlist() ) { 366 if ( mediaPlayerState->playlist() ) {
366 if ( mediaPlayerState->shuffled() ) { 367 if ( mediaPlayerState->shuffled() ) {
367 const DocLnk *cur = current(); 368 const DocLnk *cur = current();
368 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 369 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
369 for ( int i = 0; i < j; i++ ) { 370 for ( int i = 0; i < j; i++ ) {
370 if ( !d->selectedFiles->next() ) 371 if ( !d->selectedFiles->next() )
371 d->selectedFiles->first(); 372 d->selectedFiles->first();
372 } 373 }
373 if ( cur == current() ) 374 if ( cur == current() )
374 if ( !d->selectedFiles->next() ) { 375 if ( !d->selectedFiles->next() ) {
375 d->selectedFiles->first(); 376 d->selectedFiles->first();
376 } 377 }
377 return TRUE; 378 return TRUE;
378 } else { 379 } else {
379 if ( !d->selectedFiles->prev() ) { 380 if ( !d->selectedFiles->prev() ) {
380 if ( mediaPlayerState->looping() ) { 381 if ( mediaPlayerState->looping() ) {
381 return d->selectedFiles->last(); 382 return d->selectedFiles->last();
382 } else { 383 } else {
383 return FALSE; 384 return FALSE;
384 } 385 }
385 } 386 }
386 return TRUE; 387 return TRUE;
387 } 388 }
388 } else { 389 } else {
389 return mediaPlayerState->looping(); 390 return mediaPlayerState->looping();
390 } 391 }
391} 392}
392 393
393 394
394bool PlayListWidget::next() { 395bool PlayListWidget::next() {
395 if ( mediaPlayerState->playlist() ) { 396 if ( mediaPlayerState->playlist() ) {
396 if ( mediaPlayerState->shuffled() ) { 397 if ( mediaPlayerState->shuffled() ) {
397 return prev(); 398 return prev();
398 } else { 399 } else {
399 if ( !d->selectedFiles->next() ) { 400 if ( !d->selectedFiles->next() ) {
400 if ( mediaPlayerState->looping() ) { 401 if ( mediaPlayerState->looping() ) {
401 return d->selectedFiles->first(); 402 return d->selectedFiles->first();
402 } else { 403 } else {
403 return FALSE; 404 return FALSE;
404 } 405 }
405 } 406 }
406 return TRUE; 407 return TRUE;
407 } 408 }
408 } else { 409 } else {
409 return mediaPlayerState->looping(); 410 return mediaPlayerState->looping();
410 } 411 }
411} 412}
412 413
413 414
414bool PlayListWidget::first() { 415bool PlayListWidget::first() {
415 if ( mediaPlayerState->playlist() ) 416 if ( mediaPlayerState->playlist() )
416 return d->selectedFiles->first(); 417 return d->selectedFiles->first();
417 else 418 else
418 return mediaPlayerState->looping(); 419 return mediaPlayerState->looping();
419} 420}
420 421
421 422
422bool PlayListWidget::last() { 423bool PlayListWidget::last() {
423 if ( mediaPlayerState->playlist() ) 424 if ( mediaPlayerState->playlist() )
424 return d->selectedFiles->last(); 425 return d->selectedFiles->last();
425 else 426 else
426 return mediaPlayerState->looping(); 427 return mediaPlayerState->looping();
427} 428}
428 429
429 430
430void PlayListWidget::saveList() { 431void PlayListWidget::saveList() {
431 432
432 QString filename; 433 QString filename;
433 InputDialog *fileDlg = 0l; 434 InputDialog *fileDlg = 0l;
434 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); 435 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
435 fileDlg->exec(); 436 fileDlg->exec();
436 if( fileDlg->result() == 1 ) { 437 if( fileDlg->result() == 1 ) {
437 if ( d->current ) 438 if ( d->current )
438 delete d->current; 439 delete d->current;
439 filename = fileDlg->text();//+".playlist"; 440 filename = fileDlg->text();//+".playlist";
440 // qDebug("saving playlist "+filename+".playlist"); 441 // qDebug("saving playlist "+filename+".playlist");
441 Config cfg( filename +".playlist"); 442 Config cfg( filename +".playlist");
442 writeConfig( cfg ); 443 writeConfig( cfg );
443 444
444 DocLnk lnk; 445 DocLnk lnk;
445 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 446 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
446 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D 447 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
447 lnk.setIcon("opieplayer2/playlist2"); 448 lnk.setIcon("opieplayer2/playlist2");
448 lnk.setName( filename); //sets file name 449 lnk.setName( filename); //sets file name
449 // qDebug(filename); 450 // qDebug(filename);
450 if(!lnk.writeLink()) { 451 if(!lnk.writeLink()) {
451 qDebug("Writing doclink did not work"); 452 qDebug("Writing doclink did not work");
452 } 453 }
453 } 454 }
454 Config config( "OpiePlayer" ); 455 Config config( "OpiePlayer" );
455 config.writeEntry("CurrentPlaylist",filename); 456 config.writeEntry("CurrentPlaylist",filename);
456 setCaption(tr("OpiePlayer: ")+filename); 457 setCaption(tr("OpiePlayer: ")+filename);
457 d->selectedFiles->first(); 458 d->selectedFiles->first();
458 if(fileDlg) { 459 if(fileDlg) {
459 delete fileDlg; 460 delete fileDlg;
460 } 461 }
461} 462}
462 463
463void PlayListWidget::loadList( const DocLnk & lnk) { 464void PlayListWidget::loadList( const DocLnk & lnk) {
464 QString name= lnk.name(); 465 QString name= lnk.name();
465 // qDebug("currentList is "+name); 466 // qDebug("currentList is "+name);
466 if( name.length()>1) { 467 if( name.length()>1) {
467 setCaption("OpiePlayer: "+name); 468 setCaption("OpiePlayer: "+name);
468 // qDebug("load list "+ name+".playlist"); 469 // qDebug("load list "+ name+".playlist");
469 clearList(); 470 clearList();
470 Config cfg( name+".playlist"); 471 Config cfg( name+".playlist");
471 readConfig(cfg); 472 readConfig(cfg);
472 473
473 tabWidget->setCurrentPage(0); 474 tabWidget->setCurrentPage(0);
474 475
475 Config config( "OpiePlayer" ); 476 Config config( "OpiePlayer" );
476 config.writeEntry("CurrentPlaylist", name); 477 config.writeEntry("CurrentPlaylist", name);
477 // d->selectedFiles->first(); 478 // d->selectedFiles->first();
478 } 479 }
479} 480}
480 481
481 482
482void PlayListWidget::setPlaylist( bool shown ) { 483void PlayListWidget::setPlaylist( bool shown ) {
483 if ( shown ) { 484 if ( shown ) {
484 d->playListFrame->show(); 485 d->playListFrame->show();
485 } else { 486 } else {
486 d->playListFrame->hide(); 487 d->playListFrame->hide();
487 } 488 }
488} 489}
489 490
490 491
491void PlayListWidget::addSelected() { 492void PlayListWidget::addSelected() {
492 493
493 Config cfg( "OpiePlayer" ); 494 Config cfg( "OpiePlayer" );
494 cfg.setGroup("PlayList"); 495 cfg.setGroup("PlayList");
495 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 496 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
496 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 497 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
497 498
498 switch (tabWidget->currentPageIndex()) { 499 switch (tabWidget->currentPageIndex()) {
499 case 0: //playlist 500 case 0: //playlist
500 break; 501 break;
501 case 1: { //audio 502 case 1: { //audio
502 QListViewItemIterator it( audioView ); 503 QListViewItemIterator it( audioView );
503 // iterate through all items of the listview 504 // iterate through all items of the listview
504 for ( ; it.current(); ++it ) { 505 for ( ; it.current(); ++it ) {
505 if ( it.current()->isSelected() ) { 506 if ( it.current()->isSelected() ) {
506 QListIterator<DocLnk> dit( files.children() ); 507 QListIterator<DocLnk> dit( files.children() );
507 for ( ; dit.current(); ++dit ) { 508 for ( ; dit.current(); ++dit ) {
508 if( dit.current()->name() == it.current()->text(0) ) { 509 if( dit.current()->name() == it.current()->text(0) ) {
509 if(QFileInfo( dit.current()->file()).exists()) 510 if(QFileInfo( dit.current()->file()).exists())
510 d->selectedFiles->addToSelection( **dit ); 511 d->selectedFiles->addToSelection( **dit );
511 } 512 }
512 } 513 }
513 audioView->setSelected( it.current(),FALSE); 514 audioView->setSelected( it.current(),FALSE);
514 } 515 }
515 } 516 }
516 tabWidget->setCurrentPage(0); 517 tabWidget->setCurrentPage(0);
517 } 518 }
518 break; 519 break;
519 case 2: { // video 520 case 2: { // video
520 QListViewItemIterator it( videoView ); 521 QListViewItemIterator it( videoView );
521 // iterate through all items of the listview 522 // iterate through all items of the listview
522 for ( ; it.current(); ++it ) { 523 for ( ; it.current(); ++it ) {
523 if ( it.current()->isSelected() ) { 524 if ( it.current()->isSelected() ) {
524 QListIterator<DocLnk> dit( vFiles.children() ); 525 QListIterator<DocLnk> dit( vFiles.children() );
525 for ( ; dit.current(); ++dit ) { 526 for ( ; dit.current(); ++dit ) {
526 if( dit.current()->name() == it.current()->text(0) ) { 527 if( dit.current()->name() == it.current()->text(0) ) {
527 if(QFileInfo( dit.current()->file()).exists()) 528 if(QFileInfo( dit.current()->file()).exists())
528 d->selectedFiles->addToSelection( **dit ); 529 d->selectedFiles->addToSelection( **dit );
529 } 530 }
530 } 531 }
531 videoView->setSelected( it.current(),FALSE); 532 videoView->setSelected( it.current(),FALSE);
532 } 533 }
533 } 534 }
534 tabWidget->setCurrentPage(0); 535 tabWidget->setCurrentPage(0);
535 } 536 }
536 break; 537 break;
537 }; 538 };
538} 539}
539 540
540 541
541void PlayListWidget::removeSelected() { 542void PlayListWidget::removeSelected() {
542 d->selectedFiles->removeSelected( ); 543 d->selectedFiles->removeSelected( );
543} 544}
544 545
545 546
546void PlayListWidget::playIt( QListViewItem *it) { 547void PlayListWidget::playIt( QListViewItem *it) {
547 if(!it) return; 548 if(!it) return;
548 mediaPlayerState->setPlaying(FALSE); 549 mediaPlayerState->setPlaying(FALSE);
549 mediaPlayerState->setPlaying(TRUE); 550 mediaPlayerState->setPlaying(TRUE);
550 d->selectedFiles->unSelect(); 551 d->selectedFiles->unSelect();
551} 552}
552 553
553 554
554void PlayListWidget::addToSelection( QListViewItem *it) { 555void PlayListWidget::addToSelection( QListViewItem *it) {
555 d->setDocumentUsed = FALSE; 556 d->setDocumentUsed = FALSE;
556 557
557 if(it) { 558 if(it) {
558 switch (tabWidget->currentPageIndex()) { 559 switch (tabWidget->currentPageIndex()) {
559 case 1: { 560 case 1: {
560 QListIterator<DocLnk> dit( files.children() ); 561 QListIterator<DocLnk> dit( files.children() );
561 for ( ; dit.current(); ++dit ) { 562 for ( ; dit.current(); ++dit ) {
562 if( dit.current()->name() == it->text(0)) { 563 if( dit.current()->name() == it->text(0)) {
563 if(QFileInfo( dit.current()->file()).exists()) 564 if(QFileInfo( dit.current()->file()).exists())
564 d->selectedFiles->addToSelection( **dit ); 565 d->selectedFiles->addToSelection( **dit );
565 } 566 }
566 } 567 }
567 } 568 }
568 break; 569 break;
569 case 2: { 570 case 2: {
570 QListIterator<DocLnk> dit( vFiles.children() ); 571 QListIterator<DocLnk> dit( vFiles.children() );
571 for ( ; dit.current(); ++dit ) { 572 for ( ; dit.current(); ++dit ) {
572 if( dit.current()->name() == it->text(0)) { 573 if( dit.current()->name() == it->text(0)) {
573 if(QFileInfo( dit.current()->file()).exists()) 574 if(QFileInfo( dit.current()->file()).exists())
574 d->selectedFiles->addToSelection( **dit ); 575 d->selectedFiles->addToSelection( **dit );
575 } 576 }
576 } 577 }
577 } 578 }
578 break; 579 break;
579 case 0: 580 case 0:
580 break; 581 break;
581 }; 582 };
582 tabWidget->setCurrentPage(0); 583 tabWidget->setCurrentPage(0);
583 } 584 }
584} 585}
585 586
586 587
587void PlayListWidget::tabChanged(QWidget *) { 588void PlayListWidget::tabChanged(QWidget *) {
588 589
589 switch ( tabWidget->currentPageIndex()) { 590 switch ( tabWidget->currentPageIndex()) {
590 case 0: 591 case 0:
591 { 592 {
592 if( !tbDeletePlaylist->isHidden() ) { 593 if( !tbDeletePlaylist->isHidden() ) {
593 tbDeletePlaylist->hide(); 594 tbDeletePlaylist->hide();
594 } 595 }
595 d->tbRemoveFromList->setEnabled(TRUE); 596 d->tbRemoveFromList->setEnabled(TRUE);
596 d->tbAddToList->setEnabled(FALSE); 597 d->tbAddToList->setEnabled(FALSE);
597 } 598 }
598 break; 599 break;
599 case 1: 600 case 1:
600 { 601 {
601 audioView->clear(); 602 audioView->clear();
602 populateAudioView(); 603 populateAudioView();
603 604
604 if( !tbDeletePlaylist->isHidden() ) { 605 if( !tbDeletePlaylist->isHidden() ) {
605 tbDeletePlaylist->hide(); 606 tbDeletePlaylist->hide();
606 } 607 }
607 d->tbRemoveFromList->setEnabled(FALSE); 608 d->tbRemoveFromList->setEnabled(FALSE);
608 d->tbAddToList->setEnabled(TRUE); 609 d->tbAddToList->setEnabled(TRUE);
609 } 610 }
610 break; 611 break;
611 case 2: 612 case 2:
612 { 613 {
613 videoView->clear(); 614 videoView->clear();
614 populateVideoView(); 615 populateVideoView();
615 if( !tbDeletePlaylist->isHidden() ) { 616 if( !tbDeletePlaylist->isHidden() ) {
616 tbDeletePlaylist->hide(); 617 tbDeletePlaylist->hide();
617 } 618 }
618 d->tbRemoveFromList->setEnabled(FALSE); 619 d->tbRemoveFromList->setEnabled(FALSE);
619 d->tbAddToList->setEnabled(TRUE); 620 d->tbAddToList->setEnabled(TRUE);
620 } 621 }
621 break; 622 break;
622 case 3: 623 case 3:
623 { 624 {
624 if( tbDeletePlaylist->isHidden() ) { 625 if( tbDeletePlaylist->isHidden() ) {
625 tbDeletePlaylist->show(); 626 tbDeletePlaylist->show();
626 } 627 }
627 playLists->reread(); 628 playLists->reread();
628 } 629 }
629 break; 630 break;
630 }; 631 };
631} 632}
632 633
633 634
634void PlayListWidget::btnPlay(bool b) { 635void PlayListWidget::btnPlay(bool b) {
635 // mediaPlayerState->setPlaying(b); 636 // mediaPlayerState->setPlaying(b);
636 switch ( tabWidget->currentPageIndex()) { 637 switch ( tabWidget->currentPageIndex()) {
637 case 0: 638 case 0:
638 { 639 {
639 mediaPlayerState->setPlaying(b); 640 mediaPlayerState->setPlaying(b);
640 } 641 }
641 break; 642 break;
642 case 1: 643 case 1:
643 { 644 {
644 addToSelection( audioView->currentItem() ); 645 addToSelection( audioView->currentItem() );
645 mediaPlayerState->setPlaying(b); 646 mediaPlayerState->setPlaying(b);
646 d->selectedFiles->removeSelected( ); 647 d->selectedFiles->removeSelected( );
647 tabWidget->setCurrentPage(1); 648 tabWidget->setCurrentPage(1);
648 d->selectedFiles->unSelect(); 649 d->selectedFiles->unSelect();
649 insanityBool=FALSE; 650 insanityBool=FALSE;
650 }// audioView->clearSelection(); 651 }// audioView->clearSelection();
651 break; 652 break;
652 case 2: 653 case 2:
653 { 654 {
654 addToSelection( videoView->currentItem() ); 655 addToSelection( videoView->currentItem() );
655 mediaPlayerState->setPlaying(b); 656 mediaPlayerState->setPlaying(b);
656 qApp->processEvents(); 657 qApp->processEvents();
657 d->selectedFiles->removeSelected( ); 658 d->selectedFiles->removeSelected( );
658 tabWidget->setCurrentPage(2); 659 tabWidget->setCurrentPage(2);
659 d->selectedFiles->unSelect(); 660 d->selectedFiles->unSelect();
660 insanityBool=FALSE; 661 insanityBool=FALSE;
661 }// videoView->clearSelection(); 662 }// videoView->clearSelection();
662 break; 663 break;
663 }; 664 };
664 665
665} 666}
666 667
667void PlayListWidget::deletePlaylist() { 668void PlayListWidget::deletePlaylist() {
668 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 669 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
669 (tr("You really want to delete\nthis playlist?")), 670 (tr("You really want to delete\nthis playlist?")),
670 (tr("Yes")), (tr("No")), 0 )){ 671 (tr("Yes")), (tr("No")), 0 )){
671 case 0: // Yes clicked, 672 case 0: // Yes clicked,
672 QFile().remove(playLists->selected()->file()); 673 QFile().remove(playLists->selected()->file());
673 QFile().remove(playLists->selected()->linkFile()); 674 QFile().remove(playLists->selected()->linkFile());
674 playLists->reread(); 675 playLists->reread();
675 break; 676 break;
676 case 1: // Cancel 677 case 1: // Cancel
677 break; 678 break;
678 }; 679 };
679} 680}
680 681
681 682
682void PlayListWidget::playSelected() { 683void PlayListWidget::playSelected() {
683 btnPlay( TRUE); 684 btnPlay( TRUE);
684} 685}
685 686
686 687
687void PlayListWidget::scanForAudio() { 688void PlayListWidget::scanForAudio() {
688// qDebug("scan for audio"); 689// qDebug("scan for audio");
689 files.detachChildren(); 690 files.detachChildren();
690 QListIterator<DocLnk> sdit( files.children() ); 691 QListIterator<DocLnk> sdit( files.children() );
691 for ( ; sdit.current(); ++sdit ) { 692 for ( ; sdit.current(); ++sdit ) {
692 delete sdit.current(); 693 delete sdit.current();
693 } 694 }
694 Global::findDocuments(&files, "audio/*"); 695 Global::findDocuments(&files, "audio/*");
695 audioScan = TRUE; 696 audioScan = TRUE;
696} 697}
697 698
698void PlayListWidget::scanForVideo() { 699void PlayListWidget::scanForVideo() {
699// qDebug("scan for video"); 700// qDebug("scan for video");
700 vFiles.detachChildren(); 701 vFiles.detachChildren();
701 QListIterator<DocLnk> sdit( vFiles.children() ); 702 QListIterator<DocLnk> sdit( vFiles.children() );
702 for ( ; sdit.current(); ++sdit ) { 703 for ( ; sdit.current(); ++sdit ) {
703 delete sdit.current(); 704 delete sdit.current();
704 } 705 }
705 Global::findDocuments(&vFiles, "video/*"); 706 Global::findDocuments(&vFiles, "video/*");
706 videoScan = TRUE; 707 videoScan = TRUE;
707} 708}
708 709
709void PlayListWidget::populateAudioView() { 710void PlayListWidget::populateAudioView() {
710 audioView->clear(); 711 audioView->clear();
711 StorageInfo storageInfo; 712 StorageInfo storageInfo;
712 const QList<FileSystem> &fs = storageInfo.fileSystems(); 713 const QList<FileSystem> &fs = storageInfo.fileSystems();
713 if(!audioScan) { 714 if(!audioScan) {
714 scanForAudio(); 715 scanForAudio();
715 } 716 }
716 717
717 QListIterator<DocLnk> dit( files.children() ); 718 QListIterator<DocLnk> dit( files.children() );
718 QListIterator<FileSystem> it ( fs ); 719 QListIterator<FileSystem> it ( fs );
719 720
720 QString storage; 721 QString storage;
721 for ( ; dit.current(); ++dit ) { 722 for ( ; dit.current(); ++dit ) {
722 for( ; it.current(); ++it ){ 723 for( ; it.current(); ++it ){
723 const QString name = (*it)->name(); 724 const QString name = (*it)->name();
724 const QString path = (*it)->path(); 725 const QString path = (*it)->path();
725 if(dit.current()->file().find(path) != -1 ) { 726 if(dit.current()->file().find(path) != -1 ) {
726 storage = name; 727 storage = name;
727 } 728 }
728 } 729 }
729 730
730 QListViewItem * newItem; 731 QListViewItem * newItem;
731 if ( QFile( dit.current()->file()).exists() ) { 732 if ( QFile( dit.current()->file()).exists() ) {
732 // qDebug(dit.current()->name()); 733 // qDebug(dit.current()->name());
733 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 734 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
734 QString::number( QFile( dit.current()->file()).size() ), storage); 735 QString::number( QFile( dit.current()->file()).size() ), storage);
735 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 736 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
736 } 737 }
737 } 738 }
738} 739}
739 740
740 741
741void PlayListWidget::populateVideoView() { 742void PlayListWidget::populateVideoView() {
742 videoView->clear(); 743 videoView->clear();
743 StorageInfo storageInfo; 744 StorageInfo storageInfo;
744 const QList<FileSystem> &fs = storageInfo.fileSystems(); 745 const QList<FileSystem> &fs = storageInfo.fileSystems();
745 746
746 if(!videoScan ) { 747 if(!videoScan ) {
747 scanForVideo(); 748 scanForVideo();
748 } 749 }
749 750
750 QListIterator<DocLnk> Vdit( vFiles.children() ); 751 QListIterator<DocLnk> Vdit( vFiles.children() );
751 QListIterator<FileSystem> it ( fs ); 752 QListIterator<FileSystem> it ( fs );
752 videoView->clear(); 753 videoView->clear();
753 QString storage; 754 QString storage;
754 for ( ; Vdit.current(); ++Vdit ) { 755 for ( ; Vdit.current(); ++Vdit ) {
755 for( ; it.current(); ++it ) { 756 for( ; it.current(); ++it ) {
756 const QString name = (*it)->name(); 757 const QString name = (*it)->name();
757 const QString path = (*it)->path(); 758 const QString path = (*it)->path();
758 if( Vdit.current()->file().find(path) != -1 ) { 759 if( Vdit.current()->file().find(path) != -1 ) {
759 storage=name; 760 storage=name;
760 } 761 }
761 } 762 }
762 763
763 QListViewItem * newItem; 764 QListViewItem * newItem;
764 if ( QFile( Vdit.current()->file() ).exists() ) { 765 if ( QFile( Vdit.current()->file() ).exists() ) {
765 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 766 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
766 QString::number( QFile( Vdit.current()->file() ).size() ), storage ); 767 QString::number( QFile( Vdit.current()->file() ).size() ), storage );
767 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 768 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
768 } 769 }
769 } 770 }
770} 771}
771 772
772 773
773void PlayListWidget::openFile() { 774void PlayListWidget::openFile() {
774 QString filename, name; 775 QString filename, name;
775 InputDialog *fileDlg; 776 InputDialog *fileDlg;
776 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 777 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
777 fileDlg->exec(); 778 fileDlg->exec();
778 if( fileDlg->result() == 1 ) { 779 if( fileDlg->result() == 1 ) {
779 filename = fileDlg->text(); 780 filename = fileDlg->text();
780 781
781 qDebug( "Selected filename is " + filename ); 782 qDebug( "Selected filename is " + filename );
782 if( filename.right( 3 ) == "m3u" ) { 783 if( filename.right( 3 ) == "m3u" ) {
783 readm3u( filename ); 784 readm3u( filename );
784 } else if( filename.right(3) == "pls" ) { 785 } else if( filename.right(3) == "pls" ) {
785 readPls( filename ); 786 readPls( filename );
786 } else { 787 } else {
787 /* FIXME ....... AUDIO/X-MPEGURL is bad*/ 788 // this doesnt need fixing
788 DocLnk lnk; 789 DocLnk lnk;
789 lnk.setName( filename ); //sets file name 790 lnk.setName( filename ); //sets file name
790 lnk.setFile( filename ); //sets File property 791 lnk.setFile( filename ); //sets File property
791 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); 792 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
792 lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); 793 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
793 lnk.setExec( "opieplayer" ); 794 lnk.setExec( "opieplayer" );
794 lnk.setIcon( "opieplayer2/MPEGPlayer" ); 795 lnk.setIcon( "opieplayer2/MPEGPlayer" );
795 796
796 if( !lnk.writeLink() ) { 797 if( !lnk.writeLink() ) {
797 qDebug( "Writing doclink did not work" ); 798 qDebug( "Writing doclink did not work" );
798 } 799 }
799 d->selectedFiles->addToSelection( lnk ); 800 d->selectedFiles->addToSelection( lnk );
800 } 801 }
801 } 802 }
802 if( fileDlg ) { 803 if( fileDlg ) {
803 delete fileDlg; 804 delete fileDlg;
804 } 805 }
805} 806}
806 807
807void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 808void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
808 switch ( e->key() ) { 809 switch ( e->key() ) {
809 ////////////////////////////// Zaurus keys 810 ////////////////////////////// Zaurus keys
810 case Key_F9: //activity 811 case Key_F9: //activity
811 // if(audioUI->isHidden()) 812 // if(audioUI->isHidden())
812 // audioUI->showMaximized(); 813 // audioUI->showMaximized();
813 break; 814 break;
814 case Key_F10: //contacts 815 case Key_F10: //contacts
815 // if( videoUI->isHidden()) 816 // if( videoUI->isHidden())
816 // videoUI->showMaximized(); 817 // videoUI->showMaximized();
817 break; 818 break;
818 case Key_F11: //menu 819 case Key_F11: //menu
819 break; 820 break;
820 case Key_F12: //home 821 case Key_F12: //home
821 // doBlank(); 822 // doBlank();
822 break; 823 break;
823 case Key_F13: //mail 824 case Key_F13: //mail
824 // doUnblank(); 825 // doUnblank();
825 break; 826 break;
826 case Key_Q: //add to playlist 827 case Key_Q: //add to playlist
827 addSelected(); 828 addSelected();
828 break; 829 break;
829 case Key_R: //remove from playlist 830 case Key_R: //remove from playlist
830 removeSelected(); 831 removeSelected();
831 break; 832 break;
832 // case Key_P: //play 833 // case Key_P: //play
833 // qDebug("Play"); 834 // qDebug("Play");
834 // playSelected(); 835 // playSelected();
835 // break; 836 // break;
836 case Key_Space: 837 case Key_Space:
837 // playSelected(); puh 838 // playSelected(); puh
838 break; 839 break;
839 case Key_1: 840 case Key_1:
840 tabWidget->setCurrentPage( 0 ); 841 tabWidget->setCurrentPage( 0 );
841 break; 842 break;
842 case Key_2: 843 case Key_2:
843 tabWidget->setCurrentPage( 1 ); 844 tabWidget->setCurrentPage( 1 );
844 break; 845 break;
845 case Key_3: 846 case Key_3:
846 tabWidget->setCurrentPage( 2 ); 847 tabWidget->setCurrentPage( 2 );
847 break; 848 break;
848 case Key_4: 849 case Key_4:
849 tabWidget->setCurrentPage( 3 ); 850 tabWidget->setCurrentPage( 3 );
850 break; 851 break;
851 case Key_Down: 852 case Key_Down:
852 if ( !d->selectedFiles->next() ) 853 if ( !d->selectedFiles->next() )
853 d->selectedFiles->first(); 854 d->selectedFiles->first();
854 855
855 break; 856 break;
856 case Key_Up: 857 case Key_Up:
857 if ( !d->selectedFiles->prev() ) 858 if ( !d->selectedFiles->prev() )
858 // d->selectedFiles->last(); 859 // d->selectedFiles->last();
859 860
860 break; 861 break;
861 862
862 } 863 }
863} 864}
864 865
865void PlayListWidget::readm3u( const QString &filename ) { 866void PlayListWidget::readm3u( const QString &filename ) {
866 qDebug( "m3u filename is " + filename ); 867 qDebug( "m3u filename is " + filename );
867 QFile f( filename ); 868 QFile f( filename );
868 869
869 if( f.open( IO_ReadOnly ) ) { 870 if( f.open( IO_ReadOnly ) ) {
870 QTextStream t(&f); 871 QTextStream t(&f);
871 QString s;//, first, second; 872 QString s;//, first, second;
872 int i=0; 873 int i=0;
873 while ( !t.atEnd() ) { 874 while ( !t.atEnd() ) {
874 s=t.readLine(); 875 s=t.readLine();
875 876
876 if( s.find( "#", 0, TRUE) == -1 ) { 877 if( s.find( "#", 0, TRUE) == -1 ) {
877 if( s.find( " ", 0, TRUE) == -1 ) { // not sure if this is neede since cf uses vfat 878 if( s.find( " ", 0, TRUE) == -1 ) { // not sure if this is neede since cf uses vfat
878 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 879 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
879 s = s.right( s.length() -2 ); 880 s = s.right( s.length() -2 );
880 DocLnk lnk( s ); 881 DocLnk lnk( s );
881 QFileInfo f( s ); 882 QFileInfo f( s );
882 QString name = f.baseName(); 883 QString name = f.baseName();
883 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 884 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
884 lnk.setName( name ); 885 lnk.setName( name );
885 s=s.replace( QRegExp( "\\" ), "/" ); 886 s=s.replace( QRegExp( "\\" ), "/" );
886 lnk.setFile( s ); 887 lnk.setFile( s );
887 lnk.writeLink(); 888 lnk.writeLink();
888 qDebug( "add " + name); 889 qDebug( "add " + name);
889 d->selectedFiles->addToSelection( lnk ); 890 d->selectedFiles->addToSelection( lnk );
890 } else { // is url 891 } else { // is url
891 s.replace( QRegExp( "%20" )," " ); 892 s.replace( QRegExp( "%20" )," " );
892 DocLnk lnk( s ); 893 DocLnk lnk( s );
893 QString name; 894 QString name;
894 if( name.left( 4 ) == "http" ) { 895 if( name.left( 4 ) == "http" ) {
895 name = s.right( s.length() - 7 ); 896 name = s.right( s.length() - 7 );
896 } else { 897 } else {
897 name = s; 898 name = s;
898 } 899 }
899 lnk.setName( name ); 900 lnk.setName( name );
900 if( s.at( s.length() - 4) == '.' ) { 901 if( s.at( s.length() - 4) == '.' ) {
901 lnk.setFile( s ); 902 lnk.setFile( s );
902 } else { 903 } else {
903 lnk.setFile( s + "/" ); 904 lnk.setFile( s + "/" );
904 } 905 }
905 lnk.setType( "audio/x-mpegurl" ); 906 lnk.setType( "audio/x-mpegurl" );
906 lnk.writeLink(); 907 lnk.writeLink();
907 d->selectedFiles->addToSelection( lnk ); 908 d->selectedFiles->addToSelection( lnk );
908 } 909 }
909 i++; 910 i++;
910 } 911 }
911 } 912 }
912 } 913 }
913 } 914 }
914 f.close(); 915 f.close();
915} 916}
916 917
917void PlayListWidget::writem3u() { 918void PlayListWidget::writem3u() {
918 InputDialog *fileDlg; 919 InputDialog *fileDlg;
919 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 920 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
920 fileDlg->exec(); 921 fileDlg->exec();
921 QString filename, list; 922 QString filename, list;
922 if( fileDlg->result() == 1 ) { 923 if( fileDlg->result() == 1 ) {
923 filename = fileDlg->text(); 924 filename = fileDlg->text();
924 qDebug( filename ); 925 qDebug( filename );
925 int noOfFiles = 0; 926 int noOfFiles = 0;
926 d->selectedFiles->first(); 927 d->selectedFiles->first();
927 do { 928 do {
928 // we dont check for existance because of url's 929 // we dont check for existance because of url's
929 // qDebug(d->selectedFiles->current()->file()); 930 // qDebug(d->selectedFiles->current()->file());
930 931
931 // so maybe we should do some net checking to ,-) 932 // so maybe we should do some net checking to ,-)
933 // no, cause it takes to long...
934
932 list += d->selectedFiles->current()->file() + "\n"; 935 list += d->selectedFiles->current()->file() + "\n";
933 noOfFiles++; 936 noOfFiles++;
934 } 937 }
935 while ( d->selectedFiles->next() ); 938 while ( d->selectedFiles->next() );
936 qDebug( list ); 939 qDebug( list );
937 if( filename.left( 1) != "/" ) { 940 if( filename.left( 1) != "/" ) {
938 filename=QPEApplication::documentDir() + "/" + filename; 941 filename=QPEApplication::documentDir() + "/" + filename;
939 } 942 }
940 if( filename.right( 3 ) != "m3u" ) { 943 if( filename.right( 3 ) != "m3u" ) {
941 filename=filename+".m3u"; 944 filename=filename+".m3u";
942 } 945 }
943 QFile f( filename ); 946 QFile f( filename );
944 f.open( IO_WriteOnly ); 947 f.open( IO_WriteOnly );
945 f.writeBlock( list, list.length() ); 948 f.writeBlock( list, list.length() );
946 f.close(); 949 f.close();
947 } 950 }
948 if( fileDlg ) { 951 if( fileDlg ) {
949 delete fileDlg; 952 delete fileDlg;
950 } 953 }
951} 954}
952 955
953void PlayListWidget::readPls( const QString &filename ) { 956void PlayListWidget::readPls( const QString &filename ) {
954 957
955 qDebug( "pls filename is " + filename ); 958 qDebug( "pls filename is " + filename );
956 QFile f( filename ); 959 QFile f( filename );
957 960
958 if( f.open( IO_ReadOnly ) ) { 961 if( f.open( IO_ReadOnly ) ) {
959 QTextStream t( &f ); 962 QTextStream t( &f );
960 QString s;//, first, second; 963 QString s;//, first, second;
961 int i = 0; 964 int i = 0;
962 while ( !t.atEnd() ) { 965 while ( !t.atEnd() ) {
963 s = t.readLine(); 966 s = t.readLine();
964 if( s.left(4) == "File" ) { 967 if( s.left(4) == "File" ) {
965 s = s.right( s.length() - 6 ); 968 s = s.right( s.length() - 6 );
966 s.replace( QRegExp( "%20" )," "); 969 s.replace( QRegExp( "%20" )," ");
967 qDebug( "adding " + s + " to playlist" ); 970 qDebug( "adding " + s + " to playlist" );
968 // numberofentries=2 971 // numberofentries=2
969 // File1=http 972 // File1=http
970 // Title 973 // Title
971 // Length 974 // Length
972 // Version 975 // Version
973 // File2=http 976 // File2=http
974 s = s.replace( QRegExp( "\\" ), "/" ); 977 s = s.replace( QRegExp( "\\" ), "/" );
975 DocLnk lnk( s ); 978 DocLnk lnk( s );
976 QFileInfo f( s ); 979 QFileInfo f( s );
977 QString name = f.baseName(); 980 QString name = f.baseName();
978 if( name.left( 4 ) == "http" ) { 981 if( name.left( 4 ) == "http" ) {
979 name = s.right( s.length() - 7); 982 name = s.right( s.length() - 7);
980 } else { 983 } else {
981 name = s; 984 name = s;
982 } 985 }
983 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 986 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
984 lnk.setName( name ); 987 lnk.setName( name );
985 if( s.at( s.length() - 4) == '.') // if this is probably a file 988 if( s.at( s.length() - 4) == '.') // if this is probably a file
986 lnk.setFile( s ); 989 lnk.setFile( s );
987 else { //if its a url 990 else { //if its a url
988 if( name.right( 1 ).find( '/' ) == -1) { 991 if( name.right( 1 ).find( '/' ) == -1) {
989 s += "/"; 992 s += "/";
990 } 993 }
991 lnk.setFile( s ); 994 lnk.setFile( s );
992 } 995 }
993 lnk.setType( "audio/x-mpegurl" ); 996 lnk.setType( "audio/x-mpegurl" );
994 997
995 //qDebug("DocLnk add "+name); 998 //qDebug("DocLnk add "+name);
996 d->selectedFiles->addToSelection( lnk ); 999 d->selectedFiles->addToSelection( lnk );
997 } 1000 }
998 } 1001 }
999 i++; 1002 i++;
1000 } 1003 }
1001} 1004}
1002 1005
1003void PlayListWidget::pmViewActivated(int index) { 1006void PlayListWidget::pmViewActivated(int index) {
1004// qDebug("%d", index); 1007// qDebug("%d", index);
1005 switch(index) { 1008 switch(index) {
1006 case -16: 1009 case -16:
1007 { 1010 {
1008 mediaPlayerState->toggleFullscreen(); 1011 mediaPlayerState->toggleFullscreen();
1009 bool b=mediaPlayerState->fullscreen(); 1012 bool b=mediaPlayerState->fullscreen();
1010 pmView->setItemChecked( index, b); 1013 pmView->setItemChecked( index, b);
1011 Config cfg( "OpiePlayer" ); 1014 Config cfg( "OpiePlayer" );
1012 cfg.writeEntry( "FullScreen", b ); 1015 cfg.writeEntry( "FullScreen", b );
1013 } 1016 }
1014 break; 1017 break;
1015 }; 1018 };
1016} 1019}
1017 1020
1018void PlayListWidget::populateSkinsMenu() { 1021void PlayListWidget::populateSkinsMenu() {
1019 int item = 0; 1022 int item = 0;
1020 defaultSkinIndex = 0; 1023 defaultSkinIndex = 0;
1021 QString skinName; 1024 QString skinName;
1022 Config cfg( "OpiePlayer" ); 1025 Config cfg( "OpiePlayer" );
1023 cfg.setGroup("Options" ); 1026 cfg.setGroup("Options" );
1024 QString skin = cfg.readEntry( "Skin", "default" ); 1027 QString skin = cfg.readEntry( "Skin", "default" );
1025 1028
1026 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1029 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1027 skinsDir.setFilter( QDir::Dirs ); 1030 skinsDir.setFilter( QDir::Dirs );
1028 skinsDir.setSorting(QDir::Name ); 1031 skinsDir.setSorting(QDir::Name );
1029 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1032 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1030 QFileInfoListIterator it( *skinslist ); 1033 QFileInfoListIterator it( *skinslist );
1031 QFileInfo *fi; 1034 QFileInfo *fi;
1032 while ( ( fi = it.current() ) ) { 1035 while ( ( fi = it.current() ) ) {
1033 skinName = fi->fileName(); 1036 skinName = fi->fileName();
1034 qDebug( fi->fileName() ); 1037 qDebug( fi->fileName() );
1035 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1038 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1036 item = skinsMenu->insertItem( fi->fileName() ) ; 1039 item = skinsMenu->insertItem( fi->fileName() ) ;
1037 } 1040 }
1038 if( skinName == "default" ) { 1041 if( skinName == "default" ) {
1039 defaultSkinIndex = item; 1042 defaultSkinIndex = item;
1040 } 1043 }
1041 if( skinName == skin ) { 1044 if( skinName == skin ) {
1042 skinsMenu->setItemChecked( item, TRUE ); 1045 skinsMenu->setItemChecked( item, TRUE );
1043 } 1046 }
1044 ++it; 1047 ++it;
1045 } 1048 }
1046} 1049}
1047 1050
1048void PlayListWidget::skinsMenuActivated( int item ) { 1051void PlayListWidget::skinsMenuActivated( int item ) {
1049 for( uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1052 for( uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1050 skinsMenu->setItemChecked( i, FALSE ); 1053 skinsMenu->setItemChecked( i, FALSE );
1051 } 1054 }
1052 skinsMenu->setItemChecked( item, TRUE ); 1055 skinsMenu->setItemChecked( item, TRUE );
1053 1056
1054 Config cfg( "OpiePlayer" ); 1057 Config cfg( "OpiePlayer" );
1055 cfg.setGroup("Options"); 1058 cfg.setGroup("Options");
1056 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1059 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1057} 1060}