author | llornkcor <llornkcor> | 2002-11-03 23:41:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-03 23:41:56 (UTC) |
commit | 829eeff0374389891aa88b12fcafffb55f480797 (patch) (unidiff) | |
tree | bdef672d653e386535647ef82e291d95b520ef78 | |
parent | bf62b8f48d08f5a5e92681e1487a5f43d5c7a231 (diff) | |
download | opie-829eeff0374389891aa88b12fcafffb55f480797.zip opie-829eeff0374389891aa88b12fcafffb55f480797.tar.gz opie-829eeff0374389891aa88b12fcafffb55f480797.tar.bz2 |
finish audio skin
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 18 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 48 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 5 |
3 files changed, 62 insertions, 9 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 | |||
@@ -48,7 +48,6 @@ struct MediaButton { | |||
48 | MediaButton audioButtons[] = { | 48 | MediaButton 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 |
@@ -59,12 +58,11 @@ MediaButton audioButtons[] = { | |||
59 | { FALSE, FALSE, FALSE } // back | 58 | { FALSE, FALSE, FALSE } // back |
60 | }; | 59 | }; |
61 | 60 | ||
62 | const char *skin_mask_file_names[11] = { | 61 | const 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 | |||
68 | static void changeTextColor( QWidget *w ) { | 66 | static 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 ) ); |
@@ -81,12 +79,14 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
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) ) ); |
@@ -94,7 +94,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
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 | ||
@@ -161,7 +161,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
161 | 161 | ||
162 | AudioWidget::~AudioWidget() { | 162 | AudioWidget::~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 | } |
@@ -169,7 +169,7 @@ AudioWidget::~AudioWidget() { | |||
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 | } |
@@ -210,7 +210,7 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
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]; |
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 | |||
@@ -193,6 +193,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
@@ -1350,3 +1358,43 @@ void PlayListWidget::doUnblank() { | |||
1350 | h <<-3;// v[1]; // -3 Force on | 1358 | h <<-3;// v[1]; // -3 Force on |
1351 | } | 1359 | } |
1352 | 1360 | ||
1361 | void 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 | |||
1391 | void 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 | |||
@@ -37,6 +37,7 @@ class QListView; | |||
37 | class QPoint; | 37 | class QPoint; |
38 | class QAction; | 38 | class QAction; |
39 | class QLabel; | 39 | class QLabel; |
40 | class QPopupMenu; | ||
40 | 41 | ||
41 | class PlayListWidget : public QMainWindow { | 42 | class PlayListWidget : public QMainWindow { |
42 | Q_OBJECT | 43 | Q_OBJECT |
@@ -67,11 +68,13 @@ public slots: | |||
67 | /* void setFullScreen(); */ | 68 | /* void setFullScreen(); */ |
68 | /* void setScaled(); */ | 69 | /* void setScaled(); */ |
69 | protected: | 70 | protected: |
71 | QPopupMenu *skinsMenu; | ||
70 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 72 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
71 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 73 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
72 | void keyReleaseEvent( QKeyEvent *e); | 74 | void keyReleaseEvent( QKeyEvent *e); |
73 | void keyPressEvent( QKeyEvent *e); | 75 | void keyPressEvent( QKeyEvent *e); |
74 | private: | 76 | private: |
77 | int defaultSkinIndex; | ||
75 | bool audioScan, videoScan; | 78 | bool audioScan, videoScan; |
76 | void doBlank(); | 79 | void doBlank(); |
77 | void doUnblank(); | 80 | void doUnblank(); |
@@ -87,6 +90,8 @@ private: | |||
87 | void populateVideoView(); | 90 | void populateVideoView(); |
88 | private slots: | 91 | private 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(); |