summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp20
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp48
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h5
3 files changed, 63 insertions, 10 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 896da91..d20d560 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -27,95 +27,95 @@
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlayout.h> 29#include <qlayout.h>
30 30
31#include "audiowidget.h" 31#include "audiowidget.h"
32#include "mediaplayerstate.h" 32#include "mediaplayerstate.h"
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <stdio.h> 35#include <stdio.h>
36 36
37extern MediaPlayerState *mediaPlayerState; 37extern MediaPlayerState *mediaPlayerState;
38 38
39 39
40static const int xo = -2; // movable x offset 40static const int xo = -2; // movable x offset
41static const int yo = 22; // movable y offset 41static const int yo = 22; // movable y offset
42 42
43struct MediaButton { 43struct MediaButton {
44 bool isToggle, isHeld, isDown; 44 bool isToggle, isHeld, isDown;
45}; 45};
46 46
47//Layout information for the audioButtons (and if it is a toggle button or not) 47//Layout information for the audioButtons (and if it is a toggle button or not)
48MediaButton audioButtons[] = { 48MediaButton audioButtons[] = {
49 { TRUE, FALSE, FALSE }, // play 49 { TRUE, FALSE, FALSE }, // play
50 { FALSE, FALSE, FALSE }, // stop 50 { FALSE, FALSE, FALSE }, // stop
51 { TRUE, FALSE, FALSE }, // pause
52 { FALSE, FALSE, FALSE }, // next 51 { FALSE, FALSE, FALSE }, // next
53 { FALSE, FALSE, FALSE }, // previous 52 { FALSE, FALSE, FALSE }, // previous
54 { FALSE, FALSE, FALSE }, // volume up 53 { FALSE, FALSE, FALSE }, // volume up
55 { FALSE, FALSE, FALSE }, // volume down 54 { FALSE, FALSE, FALSE }, // volume down
56 { TRUE, FALSE, FALSE }, // repeat/loop 55 { TRUE, FALSE, FALSE }, // repeat/loop
57 { FALSE, FALSE, FALSE }, // playlist 56 { FALSE, FALSE, FALSE }, // playlist
58 { FALSE, FALSE, FALSE }, // forward 57 { FALSE, FALSE, FALSE }, // forward
59 { FALSE, FALSE, FALSE } // back 58 { FALSE, FALSE, FALSE } // back
60}; 59};
61 60
62const char *skin_mask_file_names[11] = { 61const char *skin_mask_file_names[10] = {
63 "play", "stop", "pause", "next", "prev", "up", 62 "play", "stop", "next", "prev", "up",
64 "down", "loop", "playlist", "forward", "back" 63 "down", "loop", "playlist", "forward", "back"
65}; 64};
66 65
67
68static void changeTextColor( QWidget *w ) { 66static void changeTextColor( QWidget *w ) {
69 QPalette p = w->palette(); 67 QPalette p = w->palette();
70 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 68 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
71 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 69 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
72 w->setPalette( p ); 70 w->setPalette( p );
73} 71}
74 72
75static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
76 74
77AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
78 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) 76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
79{ 77{
80 setCaption( tr("OpiePlayer") ); 78 setCaption( tr("OpiePlayer") );
81 qDebug("<<<<<audioWidget"); 79 qDebug("<<<<<audioWidget");
82 80
83 Config cfg("OpiePlayer"); 81 Config cfg("OpiePlayer");
84 cfg.setGroup("AudioWidget"); 82 cfg.setGroup("Options");
85 skin = cfg.readEntry("Skin","default"); 83 skin = cfg.readEntry("Skin","default");
86 //skin = "scaleTest"; 84 //skin = "scaleTest";
87// color of background, frame, degree of transparency 85// color of background, frame, degree of transparency
88 86
89 QString skinPath = "opieplayer2/skins/" + skin; 87 QString skinPath = "opieplayer2/skins/" + skin;
88 qDebug("skin path "+skinPath);
89
90 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 90 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
91 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 91 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
92 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 92 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
93 93
94 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 94 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
95 imgButtonMask->fill( 0 ); 95 imgButtonMask->fill( 0 );
96 96
97 for ( int i = 0; i < 11; i++ ) { 97 for ( int i = 0; i < 10; i++ ) {
98 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 98 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
99 masks[i] = new QBitmap( filename ); 99 masks[i] = new QBitmap( filename );
100 100
101 if ( !masks[i]->isNull() ) { 101 if ( !masks[i]->isNull() ) {
102 QImage imgMask = masks[i]->convertToImage(); 102 QImage imgMask = masks[i]->convertToImage();
103 uchar **dest = imgButtonMask->jumpTable(); 103 uchar **dest = imgButtonMask->jumpTable();
104 for ( int y = 0; y < imgUp->height(); y++ ) { 104 for ( int y = 0; y < imgUp->height(); y++ ) {
105 uchar *line = dest[y]; 105 uchar *line = dest[y];
106 for ( int x = 0; x < imgUp->width(); x++ ) 106 for ( int x = 0; x < imgUp->width(); x++ )
107 if ( !qRed( imgMask.pixel( x, y ) ) ) 107 if ( !qRed( imgMask.pixel( x, y ) ) )
108 line[x] = i + 1; 108 line[x] = i + 1;
109 } 109 }
110 } 110 }
111 111
112 } 112 }
113 113
114 for ( int i = 0; i < 11; i++ ) { 114 for ( int i = 0; i < 11; i++ ) {
115 buttonPixUp[i] = NULL; 115 buttonPixUp[i] = NULL;
116 buttonPixDown[i] = NULL; 116 buttonPixDown[i] = NULL;
117 } 117 }
118 118
119 setBackgroundPixmap( *pixBg ); 119 setBackgroundPixmap( *pixBg );
120 120
121 songInfo.setFocusPolicy( QWidget::NoFocus ); 121 songInfo.setFocusPolicy( QWidget::NoFocus );
@@ -140,98 +140,98 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
140 140
141 resizeEvent( NULL ); 141 resizeEvent( NULL );
142 142
143 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 143 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
144 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 144 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
145 145
146 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 146 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
147 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 147 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
148 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 148 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
149 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 149 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
150 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 150 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
151 151
152 // Intialise state 152 // Intialise state
153 setLength( mediaPlayerState->length() ); 153 setLength( mediaPlayerState->length() );
154 setPosition( mediaPlayerState->position() ); 154 setPosition( mediaPlayerState->position() );
155 setLooping( mediaPlayerState->fullscreen() ); 155 setLooping( mediaPlayerState->fullscreen() );
156 setPaused( mediaPlayerState->paused() ); 156 setPaused( mediaPlayerState->paused() );
157 setPlaying( mediaPlayerState->playing() ); 157 setPlaying( mediaPlayerState->playing() );
158 158
159} 159}
160 160
161 161
162AudioWidget::~AudioWidget() { 162AudioWidget::~AudioWidget() {
163 163
164 for ( int i = 0; i < 11; i++ ) { 164 for ( int i = 0; i < 10; i++ ) {
165 delete buttonPixUp[i]; 165 delete buttonPixUp[i];
166 delete buttonPixDown[i]; 166 delete buttonPixDown[i];
167 } 167 }
168 delete pixBg; 168 delete pixBg;
169 delete imgUp; 169 delete imgUp;
170 delete imgDn; 170 delete imgDn;
171 delete imgButtonMask; 171 delete imgButtonMask;
172 for ( int i = 0; i < 11; i++ ) { 172 for ( int i = 0; i < 10; i++ ) {
173 delete masks[i]; 173 delete masks[i];
174 } 174 }
175} 175}
176 176
177 177
178QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 178QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
179 QPixmap pix( img.width(), img.height() ); 179 QPixmap pix( img.width(), img.height() );
180 QPainter p( &pix ); 180 QPainter p( &pix );
181 p.drawTiledPixmap( pix.rect(), bg, offset ); 181 p.drawTiledPixmap( pix.rect(), bg, offset );
182 p.drawImage( 0, 0, img ); 182 p.drawImage( 0, 0, img );
183 return new QPixmap( pix ); 183 return new QPixmap( pix );
184} 184}
185 185
186 186
187QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) 187QPixmap *maskPixToMask( QPixmap pix, QBitmap mask )
188{ 188{
189 QPixmap *pixmap = new QPixmap( pix ); 189 QPixmap *pixmap = new QPixmap( pix );
190 pixmap->setMask( mask ); 190 pixmap->setMask( mask );
191 return pixmap; 191 return pixmap;
192} 192}
193 193
194 194
195 195
196void AudioWidget::resizeEvent( QResizeEvent * ) { 196void AudioWidget::resizeEvent( QResizeEvent * ) {
197 int h = height(); 197 int h = height();
198 int w = width(); 198 int w = width();
199 199
200 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 200 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
201 slider.setFixedWidth( w - 110 ); 201 slider.setFixedWidth( w - 110 );
202 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 202 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
203 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 203 slider.setBackgroundOrigin( QWidget::ParentOrigin );
204 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 204 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
205 205
206 xoff = ( w - imgUp->width() ) / 2; 206 xoff = ( w - imgUp->width() ) / 2;
207 yoff = (( h - imgUp->height() ) / 2) - 10; 207 yoff = (( h - imgUp->height() ) / 2) - 10;
208 QPoint p( xoff, yoff ); 208 QPoint p( xoff, yoff );
209 209
210 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 210 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
211 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 211 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
212 212
213 for ( int i = 0; i < 11; i++ ) { 213 for ( int i = 0; i < 10; i++ ) {
214 if ( !masks[i]->isNull() ) { 214 if ( !masks[i]->isNull() ) {
215 delete buttonPixUp[i]; 215 delete buttonPixUp[i];
216 delete buttonPixDown[i]; 216 delete buttonPixDown[i];
217 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 217 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
218 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 218 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
219 } 219 }
220 } 220 }
221 221
222 delete pixUp; 222 delete pixUp;
223 delete pixDn; 223 delete pixDn;
224} 224}
225 225
226 226
227static bool audioSliderBeingMoved = FALSE; 227static bool audioSliderBeingMoved = FALSE;
228 228
229void AudioWidget::sliderPressed() { 229void AudioWidget::sliderPressed() {
230 audioSliderBeingMoved = TRUE; 230 audioSliderBeingMoved = TRUE;
231} 231}
232 232
233 233
234void AudioWidget::sliderReleased() { 234void AudioWidget::sliderReleased() {
235 audioSliderBeingMoved = FALSE; 235 audioSliderBeingMoved = FALSE;
236 if ( slider.width() == 0 ) 236 if ( slider.width() == 0 )
237 return; 237 return;
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 6580a88..a937d7c 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -172,48 +172,56 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
172 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 172 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
173 tbDeletePlaylist->hide(); 173 tbDeletePlaylist->hide();
174 174
175 QPopupMenu *pmPlayList = new QPopupMenu( this ); 175 QPopupMenu *pmPlayList = new QPopupMenu( this );
176 menu->insertItem( tr( "File" ), pmPlayList ); 176 menu->insertItem( tr( "File" ), pmPlayList );
177 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 177 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
178 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 178 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
179 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 179 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
180 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 180 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
181 pmPlayList->insertSeparator(-1); 181 pmPlayList->insertSeparator(-1);
182 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 182 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
183 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 183 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
184 pmPlayList->insertSeparator(-1); 184 pmPlayList->insertSeparator(-1);
185 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 185 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
186 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 186 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
187 187
188 QPopupMenu *pmView = new QPopupMenu( this ); 188 QPopupMenu *pmView = new QPopupMenu( this );
189 menu->insertItem( tr( "View" ), pmView ); 189 menu->insertItem( tr( "View" ), pmView );
190 190
191 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 191 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
192 fullScreenButton->addTo(pmView); 192 fullScreenButton->addTo(pmView);
193 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 193 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
194 scaleButton->addTo(pmView); 194 scaleButton->addTo(pmView);
195 195
196
197 skinsMenu = new QPopupMenu( this );
198 menu->insertItem( tr( "Skins" ), skinsMenu );
199 skinsMenu->isCheckable();
200 connect( skinsMenu, SIGNAL( activated( int ) ) ,
201 this, SLOT( skinsMenuActivated( int ) ) );
202 populateSkinsMenu();
203
196 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 204 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
197 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 205 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
198 206
199 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 207 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
200 208
201 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 209 tabWidget = new QTabWidget( hbox6, "tabWidget" );
202 tabWidget->setTabShape(QTabWidget::Triangular); 210 tabWidget->setTabShape(QTabWidget::Triangular);
203 211
204 QWidget *pTab; 212 QWidget *pTab;
205 pTab = new QWidget( tabWidget, "pTab" ); 213 pTab = new QWidget( tabWidget, "pTab" );
206// playlistView = new QListView( pTab, "playlistview" ); 214// playlistView = new QListView( pTab, "playlistview" );
207// playlistView->setMinimumSize(236,260); 215// playlistView->setMinimumSize(236,260);
208 tabWidget->insertTab( pTab,"Playlist"); 216 tabWidget->insertTab( pTab,"Playlist");
209 217
210 218
211 // Add the playlist area 219 // Add the playlist area
212 220
213 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 221 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
214 d->playListFrame = vbox3; 222 d->playListFrame = vbox3;
215 d->playListFrame ->setMinimumSize(235,260); 223 d->playListFrame ->setMinimumSize(235,260);
216 224
217 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 225 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
218 226
219 d->selectedFiles = new PlayListSelection( hbox2); 227 d->selectedFiles = new PlayListSelection( hbox2);
@@ -1329,24 +1337,64 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
1329} 1337}
1330 1338
1331void PlayListWidget::doBlank() { 1339void PlayListWidget::doBlank() {
1332 qDebug("do blanking"); 1340 qDebug("do blanking");
1333 fd=open("/dev/fb0",O_RDWR); 1341 fd=open("/dev/fb0",O_RDWR);
1334 if (fd != -1) { 1342 if (fd != -1) {
1335 ioctl(fd,FBIOBLANK,1); 1343 ioctl(fd,FBIOBLANK,1);
1336// close(fd); 1344// close(fd);
1337 } 1345 }
1338} 1346}
1339 1347
1340void PlayListWidget::doUnblank() { 1348void PlayListWidget::doUnblank() {
1341 // this crashes opieplayer with a segfault 1349 // this crashes opieplayer with a segfault
1342// int fd; 1350// int fd;
1343// fd=open("/dev/fb0",O_RDWR); 1351// fd=open("/dev/fb0",O_RDWR);
1344 qDebug("do unblanking"); 1352 qDebug("do unblanking");
1345 if (fd != -1) { 1353 if (fd != -1) {
1346 ioctl(fd,FBIOBLANK,0); 1354 ioctl(fd,FBIOBLANK,0);
1347 close(fd); 1355 close(fd);
1348 } 1356 }
1349 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1357 QCopEnvelope h("QPE/System", "setBacklight(int)");
1350 h <<-3;// v[1]; // -3 Force on 1358 h <<-3;// v[1]; // -3 Force on
1351} 1359}
1352 1360
1361void PlayListWidget::populateSkinsMenu() {
1362 int item = 0;
1363 defaultSkinIndex = 0;
1364 QString skinName;
1365 Config cfg( "OpiePlayer" );
1366 cfg.setGroup("Options" );
1367 QString skin = cfg.readEntry( "Skin", "default" );
1368
1369 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1370 skinsDir.setFilter( QDir::Dirs );
1371 skinsDir.setSorting(QDir::Name );
1372 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1373 QFileInfoListIterator it( *skinslist );
1374 QFileInfo *fi;
1375 while ( ( fi = it.current() ) ) {
1376 skinName = fi->fileName();
1377// qDebug( fi->fileName() );
1378 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1379 item = skinsMenu->insertItem( fi->fileName() ) ;
1380 }
1381 if( skinName == "default" ) {
1382 defaultSkinIndex = item;
1383 }
1384 if( skinName == skin ) {
1385 skinsMenu->setItemChecked( item, TRUE );
1386 }
1387 ++it;
1388 }
1389}
1390
1391void PlayListWidget::skinsMenuActivated( int item ) {
1392 for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1393 skinsMenu->setItemChecked( i, FALSE );
1394 }
1395 skinsMenu->setItemChecked( item, TRUE );
1396
1397 Config cfg( "OpiePlayer" );
1398 cfg.setGroup("Options");
1399 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1400}
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 1be5a15..1118b76 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -16,98 +16,103 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef PLAY_LIST_WIDGET_H 20#ifndef PLAY_LIST_WIDGET_H
21#define PLAY_LIST_WIDGET_H 21#define PLAY_LIST_WIDGET_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qtabwidget.h> 25#include <qtabwidget.h>
26#include <qpe/fileselector.h> 26#include <qpe/fileselector.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28 28
29#include "om3u.h" 29#include "om3u.h"
30/* #include <qtimer.h> */ 30/* #include <qtimer.h> */
31 31
32 32
33class PlayListWidgetPrivate; 33class PlayListWidgetPrivate;
34class Config; 34class Config;
35class QListViewItem; 35class QListViewItem;
36class QListView; 36class QListView;
37class QPoint; 37class QPoint;
38class QAction; 38class QAction;
39class QLabel; 39class QLabel;
40class QPopupMenu;
40 41
41class PlayListWidget : public QMainWindow { 42class PlayListWidget : public QMainWindow {
42 Q_OBJECT 43 Q_OBJECT
43public: 44public:
44 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 45 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
45 ~PlayListWidget(); 46 ~PlayListWidget();
46 QTabWidget * tabWidget; 47 QTabWidget * tabWidget;
47 QAction *fullScreenButton, *scaleButton; 48 QAction *fullScreenButton, *scaleButton;
48 DocLnkSet files; 49 DocLnkSet files;
49 DocLnkSet vFiles; 50 DocLnkSet vFiles;
50 QListView *audioView, *videoView, *playlistView; 51 QListView *audioView, *videoView, *playlistView;
51 QLabel *libString; 52 QLabel *libString;
52 bool fromSetDocument; 53 bool fromSetDocument;
53 bool insanityBool; 54 bool insanityBool;
54 QString setDocFileRef, currentPlayList; 55 QString setDocFileRef, currentPlayList;
55 // retrieve the current playlist entry (media file link) 56 // retrieve the current playlist entry (media file link)
56 const DocLnk *current(); 57 const DocLnk *current();
57 void useSelectedDocument(); 58 void useSelectedDocument();
58/* QTimer * menuTimer; */ 59/* QTimer * menuTimer; */
59 FileSelector* playLists; 60 FileSelector* playLists;
60 QPushButton *tbDeletePlaylist; 61 QPushButton *tbDeletePlaylist;
61 int fd, selected; 62 int fd, selected;
62public slots: 63public slots:
63 bool first(); 64 bool first();
64 bool last(); 65 bool last();
65 bool next(); 66 bool next();
66 bool prev(); 67 bool prev();
67/* void setFullScreen(); */ 68/* void setFullScreen(); */
68/* void setScaled(); */ 69/* void setScaled(); */
69protected: 70protected:
71 QPopupMenu *skinsMenu;
70/* void contentsMousePressEvent( QMouseEvent * e ); */ 72/* void contentsMousePressEvent( QMouseEvent * e ); */
71/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ 73/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
72void keyReleaseEvent( QKeyEvent *e); 74void keyReleaseEvent( QKeyEvent *e);
73void keyPressEvent( QKeyEvent *e); 75void keyPressEvent( QKeyEvent *e);
74private: 76private:
77 int defaultSkinIndex;
75 bool audioScan, videoScan; 78 bool audioScan, videoScan;
76 void doBlank(); 79 void doBlank();
77 void doUnblank(); 80 void doUnblank();
78 void readm3u(const QString &); 81 void readm3u(const QString &);
79 void readPls(const QString &); 82 void readPls(const QString &);
80 83
81 84
82 void initializeStates(); 85 void initializeStates();
83 void readConfig( Config& cfg ); 86 void readConfig( Config& cfg );
84 void writeConfig( Config& cfg ) const; 87 void writeConfig( Config& cfg ) const;
85 PlayListWidgetPrivate *d; // Private implementation data 88 PlayListWidgetPrivate *d; // Private implementation data
86 void populateAudioView(); 89 void populateAudioView();
87 void populateVideoView(); 90 void populateVideoView();
88private slots: 91private slots:
89 92
93 void populateSkinsMenu();
94 void skinsMenuActivated(int);
90 void writem3u(); 95 void writem3u();
91 void writeCurrentM3u(); 96 void writeCurrentM3u();
92 void scanForAudio(); 97 void scanForAudio();
93 void scanForVideo(); 98 void scanForVideo();
94 void openFile(); 99 void openFile();
95 void setDocument( const QString& fileref ); 100 void setDocument( const QString& fileref );
96 void addToSelection( const DocLnk& ); // Add a media file to the playlist 101 void addToSelection( const DocLnk& ); // Add a media file to the playlist
97 void addToSelection( QListViewItem* ); // Add a media file to the playlist 102 void addToSelection( QListViewItem* ); // Add a media file to the playlist
98 void setActiveWindow(); // need to handle this to show the right view 103 void setActiveWindow(); // need to handle this to show the right view
99 void setPlaylist( bool ); // Show/Hide the playlist 104 void setPlaylist( bool ); // Show/Hide the playlist
100 void setView( char ); 105 void setView( char );
101 void clearList(); 106 void clearList();
102 void addAllToList(); 107 void addAllToList();
103 void addAllMusicToList(); 108 void addAllMusicToList();
104 void addAllVideoToList(); 109 void addAllVideoToList();
105 void saveList(); // Save the playlist 110 void saveList(); // Save the playlist
106 void loadList( const DocLnk &); // Load a playlist 111 void loadList( const DocLnk &); // Load a playlist
107 void playIt( QListViewItem *); 112 void playIt( QListViewItem *);
108 113
109 void btnPlay(bool); 114 void btnPlay(bool);
110 void deletePlaylist(); 115 void deletePlaylist();
111 void addSelected(); 116 void addSelected();
112 void removeSelected(); 117 void removeSelected();
113 void tabChanged(QWidget*); 118 void tabChanged(QWidget*);