author | llornkcor <llornkcor> | 2002-08-14 13:03:41 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-14 13:03:41 (UTC) |
commit | 8951b45cfd2c0063e66d947346535f1af319d2a9 (patch) (side-by-side diff) | |
tree | c93708c43e5dfd5b5412680ee518777cf8c903b6 | |
parent | a726335cc9e777525ceca3930ca33738283ebab4 (diff) | |
download | opie-8951b45cfd2c0063e66d947346535f1af319d2a9.zip opie-8951b45cfd2c0063e66d947346535f1af319d2a9.tar.gz opie-8951b45cfd2c0063e66d947346535f1af319d2a9.tar.bz2 |
added skins menu
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 50 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 2 |
4 files changed, 55 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 2ee9383..a3d34f4 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -129,13 +129,13 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { setCaption( tr("OpiePlayer") ); 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; pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 2521906..c210ffb 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -170,12 +170,19 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) bool b= cfg.readBoolEntry("FullScreen", 0); mediaPlayerState->setFullscreen( b ); pmView->setItemChecked( -16, b ); pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); + pmView->insertSeparator(-1); + + skinsMenu = new QPopupMenu( this ); + pmView->insertItem( tr( "Skins" ), skinsMenu ); + skinsMenu->isCheckable(); + populateSkinsMenu(); + QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); tabWidget = new QTabWidget( hbox6, "tabWidget" ); @@ -247,13 +254,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy playLists->setMinimumSize(233,260); tabWidget->insertTab(LTab,tr("Lists")); connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); -connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); + connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); + + connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), @@ -1232,6 +1241,45 @@ switch(index) { cfg.writeEntry("FullScreen", b); } break; }; } + +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/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index dd49892..67a85a8 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -53,12 +53,14 @@ public slots: protected: /* void contentsMousePressEvent( QMouseEvent * e ); */ /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ void keyReleaseEvent( QKeyEvent *e); void keyPressEvent( QKeyEvent *e); private: + int defaultSkinIndex; + QPopupMenu *skinsMenu; bool audioScan, videoScan; void doBlank(); void doUnblank(); void readm3u(const QString &); void readPls(const QString &); @@ -66,12 +68,14 @@ private: void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; PlayListWidgetPrivate *d; // Private implementation data void populateAudioView(); void populateVideoView(); private slots: + void populateSkinsMenu(); + void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void scanForAudio(); void scanForVideo(); void openFile(); void setDocument( const QString& fileref ); diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index b4e69b5..fb375f0 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -84,13 +84,13 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setCaption( tr("OpiePlayer - Video") ); videoFrame = new XineVideoWidget ( this, "Video frame" ); connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); Config cfg("OpiePlayer"); - cfg.setGroup("VideoWidget"); + cfg.setGroup("Options"); skin = cfg.readEntry("Skin","default"); QString skinPath = "opieplayer2/skins/" + skin; pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |