summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp18
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp48
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h5
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
@@ -39,71 +39,71 @@ extern MediaPlayerState *mediaPlayerState;
static const int xo = -2; // movable x offset
static const int yo = 22; // movable y offset
struct MediaButton {
bool isToggle, isHeld, isDown;
};
//Layout information for the audioButtons (and if it is a toggle button or not)
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
{ FALSE, FALSE, FALSE }, // volume down
{ TRUE, FALSE, FALSE }, // repeat/loop
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
{ 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 ) );
p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
w->setPalette( p );
}
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") );
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) ) );
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 );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp->width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
@@ -152,33 +152,33 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
delete pixBg;
delete imgUp;
delete imgDn;
delete imgButtonMask;
- for ( int i = 0; i < 11; i++ ) {
+ for ( int i = 0; i < 10; i++ ) {
delete masks[i];
}
}
QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
QPainter p( &pix );
p.drawTiledPixmap( pix.rect(), bg, offset );
p.drawImage( 0, 0, img );
return new QPixmap( pix );
}
@@ -201,25 +201,25 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
slider.setFixedWidth( w - 110 );
slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
slider.setBackgroundOrigin( QWidget::ParentOrigin );
time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
xoff = ( w - imgUp->width() ) / 2;
yoff = (( h - imgUp->height() ) / 2) - 10;
QPoint p( xoff, yoff );
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];
buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
}
}
delete pixUp;
delete pixDn;
}
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
@@ -184,24 +184,32 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
QPopupMenu *pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
fullScreenButton->addTo(pmView);
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 );
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
tabWidget = new QTabWidget( hbox6, "tabWidget" );
tabWidget->setTabShape(QTabWidget::Triangular);
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
// playlistView = new QListView( pTab, "playlistview" );
// playlistView->setMinimumSize(236,260);
@@ -1341,12 +1349,52 @@ void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
qDebug("do unblanking");
if (fd != -1) {
ioctl(fd,FBIOBLANK,0);
close(fd);
}
QCopEnvelope h("QPE/System", "setBacklight(int)");
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
@@ -28,24 +28,25 @@
#include "om3u.h"
/* #include <qtimer.h> */
class PlayListWidgetPrivate;
class Config;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
+class QPopupMenu;
class PlayListWidget : public QMainWindow {
Q_OBJECT
public:
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidget();
QTabWidget * tabWidget;
QAction *fullScreenButton, *scaleButton;
DocLnkSet files;
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
@@ -58,44 +59,48 @@ public:
/* QTimer * menuTimer; */
FileSelector* playLists;
QPushButton *tbDeletePlaylist;
int fd, selected;
public slots:
bool first();
bool last();
bool next();
bool prev();
/* 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();
void readm3u(const QString &);
void readPls(const QString &);
void initializeStates();
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 writem3u();
void writeCurrentM3u();
void scanForAudio();
void scanForVideo();
void openFile();
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void setActiveWindow(); // need to handle this to show the right view
void setPlaylist( bool ); // Show/Hide the playlist
void setView( char );
void clearList();