summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp50
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp2
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
@@ -103,65 +103,65 @@ MediaButton audioButtons[] = {
{ FALSE, 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",
"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") );
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) ) );
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++ ) {
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;
}
}
}
for ( int i = 0; i < 11; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
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
@@ -144,64 +144,71 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
mediaPlayerState, SLOT(setLooping(bool)), TRUE );
tbDeletePlaylist->hide();
QPopupMenu *pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
pmPlayList->insertSeparator(-1);
new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
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() ) );
pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
pmView->isCheckable();
pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
Config cfg( "OpiePlayer" );
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" );
// tabWidget->setTabShape(QTabWidget::Triangular);
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
tabWidget->insertTab( pTab,"Playlist");
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
d->playListFrame ->setMinimumSize(235,260);
QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
@@ -221,65 +228,67 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
tabWidget->insertTab(aTab,tr("Audio"));
QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
QWidget *vTab;
vTab = new QWidget( tabWidget, "vTab" );
videoView = new QListView( vTab, "Videoview" );
videoView->setMinimumSize(233,260);
videoView->addColumn(tr("Title"),140);
videoView->addColumn(tr("Size"),-1);
videoView->addColumn(tr("Media"),-1);
videoView->setColumnAlignment(1, Qt::AlignRight);
videoView->setColumnAlignment(2, Qt::AlignRight);
videoView->setAllColumnsShowFocus(TRUE);
videoView->setMultiSelection( TRUE );
videoView->setSelectionMode( QListView::Extended);
QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
tabWidget->insertTab( vTab,tr("Video"));
//playlists list
QWidget *LTab;
LTab = new QWidget( tabWidget, "LTab" );
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)),
this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
this,SLOT( playIt( QListViewItem *)) );
connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
this,SLOT( playIt( QListViewItem *)) );
connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
setCentralWidget( vbox5 );
readConfig( cfg );
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
loadList(DocLnk( currentPlaylist));
setCaption(tr("OpiePlayer: ")+ currentPlaylist );
initializeStates();
}
@@ -1206,32 +1215,71 @@ void PlayListWidget::readPls(const QString &filename) {
lnk.setFile( s);
else { //if its a url
if( name.right(1).find('/') == -1)
s+="/";
lnk.setFile( s);
}
lnk.setType("audio/x-mpegurl");
qDebug("DocLnk add "+name);
d->selectedFiles->addToSelection( lnk);
}
}
i++;
}
}
void PlayListWidget::pmViewActivated(int index) {
qDebug("%d", index);
switch(index) {
case -16:
{
mediaPlayerState->toggleFullscreen();
bool b=mediaPlayerState->fullscreen();
pmView->setItemChecked( index,b);
Config cfg( "OpiePlayer" );
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
@@ -27,77 +27,81 @@ public:
~PlayListWidget();
QTabWidget * tabWidget;
// MenuItem *fullScreenButton, *scaleButton;
// QAction *fullScreenButton, *scaleButton;
DocLnkSet files;
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
QPopupMenu *pmView ;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
/* QTimer * menuTimer; */
FileSelector* playLists;
QPushButton *tbDeletePlaylist;
int fd, selected;
public slots:
bool first();
bool last();
bool next();
bool prev();
/* void setFullScreen(); */
/* void setScaled(); */
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 &);
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 pmViewActivated(int);
void writem3u();
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();
void addAllToList();
void addAllMusicToList();
void addAllVideoToList();
void saveList(); // Save the playlist
void loadList( const DocLnk &); // Load a playlist
void playIt( QListViewItem *);
void btnPlay(bool);
void deletePlaylist();
void addSelected();
void removeSelected();
void tabChanged(QWidget*);
void viewPressed( int, QListViewItem *, const QPoint&, int);
void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
void playSelected();
void listDelete();
protected slots:
/* void cancelMenuTimer(); */
/* void showFileMenu(); */
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
@@ -58,65 +58,65 @@ static const int xo = 2; // movable x offset
static const int yo = 0; // movable y offset
struct MediaButton {
bool isToggle, isHeld, isDown;
};
MediaButton videoButtons[] = {
{ FALSE, FALSE, FALSE }, // stop
{ TRUE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // volUp
{ FALSE, FALSE, FALSE }, // volDown
{ TRUE, FALSE, FALSE } // fullscreen
};
const char *skinV_mask_file_names[7] = {
"stop","play","back","fwd","up","down","full"
};
static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
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) ) );
imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
imgButtonMask->fill( 0 );
for ( int i = 0; i < 7; i++ ) {
QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png";
masks[i] = new QBitmap( filename );
qDebug(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;
}
}
}
}
for ( int i = 0; i < 7; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}