summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-03 23:41:56 (UTC)
committer llornkcor <llornkcor>2002-11-03 23:41:56 (UTC)
commit829eeff0374389891aa88b12fcafffb55f480797 (patch) (side-by-side diff)
treebdef672d653e386535647ef82e291d95b520ef78
parentbf62b8f48d08f5a5e92681e1487a5f43d5c7a231 (diff)
downloadopie-829eeff0374389891aa88b12fcafffb55f480797.zip
opie-829eeff0374389891aa88b12fcafffb55f480797.tar.gz
opie-829eeff0374389891aa88b12fcafffb55f480797.tar.bz2
finish audio skin
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
@@ -48,7 +48,6 @@ struct MediaButton {
MediaButton audioButtons[] = {
{ TRUE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // stop
- { TRUE, FALSE, FALSE }, // pause
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // volume up
@@ -56,15 +55,14 @@ MediaButton audioButtons[] = {
{ TRUE, FALSE, FALSE }, // repeat/loop
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
- { FALSE, FALSE, FALSE } // back
+ { FALSE, FALSE, FALSE } // back
};
-const char *skin_mask_file_names[11] = {
- "play", "stop", "pause", "next", "prev", "up",
+const char *skin_mask_file_names[10] = {
+ "play", "stop", "next", "prev", "up",
"down", "loop", "playlist", "forward", "back"
};
-
static void changeTextColor( QWidget *w ) {
QPalette p = w->palette();
p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
@@ -81,12 +79,14 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
qDebug("<<<<<audioWidget");
Config cfg("OpiePlayer");
- cfg.setGroup("AudioWidget");
+ cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
QString skinPath = "opieplayer2/skins/" + skin;
+ qDebug("skin path "+skinPath);
+
pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
@@ -94,7 +94,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
imgButtonMask->fill( 0 );
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
masks[i] = new QBitmap( filename );
@@ -161,7 +161,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
AudioWidget::~AudioWidget() {
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
@@ -169,7 +169,7 @@ AudioWidget::~AudioWidget() {
delete imgUp;
delete imgDn;
delete imgButtonMask;
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
delete masks[i];
}
}
@@ -210,7 +210,7 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
if ( !masks[i]->isNull() ) {
delete buttonPixUp[i];
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 )
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
scaleButton->addTo(pmView);
+
+ skinsMenu = new QPopupMenu( this );
+ menu->insertItem( tr( "Skins" ), skinsMenu );
+ skinsMenu->isCheckable();
+ connect( skinsMenu, SIGNAL( activated( int ) ) ,
+ this, SLOT( skinsMenuActivated( int ) ) );
+ populateSkinsMenu();
+
QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
@@ -1350,3 +1358,43 @@ void PlayListWidget::doUnblank() {
h <<-3;// v[1]; // -3 Force on
}
+void PlayListWidget::populateSkinsMenu() {
+ int item = 0;
+ defaultSkinIndex = 0;
+ QString skinName;
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup("Options" );
+ QString skin = cfg.readEntry( "Skin", "default" );
+
+ QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
+ skinsDir.setFilter( QDir::Dirs );
+ skinsDir.setSorting(QDir::Name );
+ const QFileInfoList *skinslist = skinsDir.entryInfoList();
+ QFileInfoListIterator it( *skinslist );
+ QFileInfo *fi;
+ while ( ( fi = it.current() ) ) {
+ skinName = fi->fileName();
+// qDebug( fi->fileName() );
+ if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
+ item = skinsMenu->insertItem( fi->fileName() ) ;
+ }
+ if( skinName == "default" ) {
+ defaultSkinIndex = item;
+ }
+ if( skinName == skin ) {
+ skinsMenu->setItemChecked( item, TRUE );
+ }
+ ++it;
+ }
+}
+
+void PlayListWidget::skinsMenuActivated( int item ) {
+ for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
+ skinsMenu->setItemChecked( i, FALSE );
+ }
+ skinsMenu->setItemChecked( item, TRUE );
+
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup("Options");
+ cfg.writeEntry("Skin", skinsMenu->text( item ) );
+}
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;
class QPoint;
class QAction;
class QLabel;
+class QPopupMenu;
class PlayListWidget : public QMainWindow {
Q_OBJECT
@@ -67,11 +68,13 @@ public slots:
/* void setFullScreen(); */
/* void setScaled(); */
protected:
+ QPopupMenu *skinsMenu;
/* void contentsMousePressEvent( QMouseEvent * e ); */
/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
void keyReleaseEvent( QKeyEvent *e);
void keyPressEvent( QKeyEvent *e);
private:
+ int defaultSkinIndex;
bool audioScan, videoScan;
void doBlank();
void doUnblank();
@@ -87,6 +90,8 @@ private:
void populateVideoView();
private slots:
+ void populateSkinsMenu();
+ void skinsMenuActivated(int);
void writem3u();
void writeCurrentM3u();
void scanForAudio();