summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-12-11 23:35:31 (UTC)
committer harlekin <harlekin>2002-12-11 23:35:31 (UTC)
commita1ff0243520fca8406d90b0875ef141b7555d748 (patch) (side-by-side diff)
tree739fb7fbd60e1e19eb017e28afea3b8c6efd918b
parentd4a0626f01fae21ed19d0eea88d8eca1935c6bc8 (diff)
downloadopie-a1ff0243520fca8406d90b0875ef141b7555d748.zip
opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.gz
opie-a1ff0243520fca8406d90b0875ef141b7555d748.tar.bz2
buttons centered again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index c35e03d..a65495e 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -47,25 +47,25 @@
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "om3u.h"
#include "playlistfileview.h"
//only needed for the random play
#include <stdlib.h>
#include <assert.h>
PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
- : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
+ : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
{
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
"opieplayer2/add_to_playlist",
this , SLOT(addSelected() ) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
"opieplayer2/remove_from_playlist",
this , SLOT(removeSelected() ) );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
this , SLOT( btnPlay( bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
&mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
@@ -92,31 +92,31 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
audioView, SLOT( scanFiles() ) );
(void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
videoView, SLOT( scanFiles() ) );
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 );
- (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
+ (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
d->selectedFiles, SLOT(moveSelectedUp() ) );
- (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
+ (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
d->selectedFiles, SLOT(removeSelected() ) );
(void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
d->selectedFiles, SLOT(moveSelectedDown() ) );
- // QVBox *stretch2 = new QVBox( vbox1 );
+ QVBox *stretch2 = new QVBox( vbox1 );
connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
SLOT( deletePlaylist() ) );
connect( pmView, SIGNAL( activated( int ) ),
this, SLOT( pmViewActivated( int ) ) );
connect( skinsMenu, SIGNAL( activated( int ) ) ,
this, SLOT( skinsMenuActivated( int ) ) );
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 *) ),
@@ -179,36 +179,36 @@ void PlayListWidget::writeDefaultPlaylist() {
// qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
if( d->selectedFiles->first() ) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
do {
// qDebug(d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
m3uList->write();
m3uList->close();
delete m3uList;
-
+
}
}
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = FALSE;
if( QFileInfo( lnk.file() ).exists() ||
lnk.file().left(4) == "http" ) {
d->selectedFiles->addToSelection( lnk );
}
-// writeCurrentM3u();
+// writeCurrentM3u();
}
void PlayListWidget::clearList() {
while ( first() ) {
d->selectedFiles->removeSelected();
}
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
cfg.writeEntry("CurrentPlaylist","default");
setCaption("OpiePlayer");
}
@@ -252,79 +252,79 @@ void PlayListWidget::addAllToList() {
audioView->populateView();
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
- }
+ }
videoView->populateView();
QListViewItemIterator videoIt( videoView );
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
- }
+ }
// d->selectedFiles->addToSelection( );
// if ( it.current()->isSelected() )
// lst->append( audioIt.current() );
// }
-
+
// if(!audioScan)
// scanForAudio();
-// if(!videoScan)
+// if(!videoScan)
// scanForVideo();
// DocLnkSet filesAll;
// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
// QListIterator<DocLnk> Adit( filesAll.children() );
// for ( ; Adit.current(); ++Adit ) {
// if( QFileInfo( Adit.current()->file() ).exists() ) {
// d->selectedFiles->addToSelection( **Adit );
// }
// }
// qDebug("elapsed time %d", t.elapsed() );
tabWidget->setCurrentPage(0);
-
+
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllMusicToList() {
audioView->populateView();
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
- }
+ }
/* if(!audioScan)
scanForAudio();
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( QFileInfo(dit.current()->file() ).exists() ) {
d->selectedFiles->addToSelection( **dit );
}
}
*/
tabWidget->setCurrentPage(0);
writeCurrentM3u();
@@ -335,38 +335,38 @@ void PlayListWidget::addAllMusicToList() {
void PlayListWidget::addAllVideoToList() {
videoView->populateView();
QListViewItemIterator videoIt( videoView );
DocLnk lnk;
QString filename;
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
- }
+ }
/* if(!videoScan)
scanForVideo();
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
if( QFileInfo( dit.current()->file() ).exists() ) {
d->selectedFiles->addToSelection( **dit );
}
}
-*/
+*/
tabWidget->setCurrentPage(0);
- writeCurrentM3u();
+ writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::setDocument( const QString& fileref ) {
// qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
fromSetDocument = TRUE;
if ( fileref.isNull() ) {
QMessageBox::warning( this, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
}
@@ -374,26 +374,26 @@ void PlayListWidget::setDocument( const QString& fileref ) {
clearList();
if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
readm3u( fileref );
} else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
readm3u( DocLnk( fileref).file() );
} else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
readPls( fileref );
} else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
readPls( DocLnk( fileref).file() );
} else {
clearList();
addToSelection( DocLnk( fileref ) );
- writeCurrentM3u();
-
+ writeCurrentM3u();
+
d->setDocumentUsed = TRUE;
mediaPlayerState.setPlaying( FALSE );
mediaPlayerState.setPlaying( TRUE );
}
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
@@ -496,25 +496,25 @@ void PlayListWidget::addSelected() {
d->selectedFiles->addToSelection( lnk );
}
currentFileListView->clearSelection();
// tabWidget->setCurrentPage( 0 );
writeCurrentM3u();
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
- writeCurrentM3u();
+ writeCurrentM3u();
}
void PlayListWidget::playIt( QListViewItem *it) {
if(!it) return;
mediaPlayerState.setPlaying(FALSE);
mediaPlayerState.setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
@@ -522,28 +522,28 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
if(it) {
if ( currentTab() == CurrentPlayList )
return;
// case 1: {
DocLnk lnk;
QString filename;
filename=it->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
-
- writeCurrentM3u();
+
+ writeCurrentM3u();
// tabWidget->setCurrentPage(0);
-
+
}
}
void PlayListWidget::tabChanged(QWidget *) {
d->tbPlay->setEnabled( true );
disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
d->tbPlay, SLOT( setEnabled( bool ) ) );
disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
d->tbPlay, SLOT( setEnabled( bool ) ) );
@@ -684,51 +684,51 @@ void PlayListWidget::openFile() {
readm3u( filename );
} else if( filename.right(3) == "pls" ) {
readPls( filename );
} else {
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
writeCurrentM3u();
d->selectedFiles->setSelectedItem( lnk.name());
}
}
-
+
delete fileDlg;
}
/*
reads m3u and shows files/urls to playlist widget */
-void PlayListWidget::readm3u( const QString &filename ) {
+void PlayListWidget::readm3u( const QString &filename ) {
qDebug( "read m3u filename " + filename );
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readM3u();
DocLnk lnk;
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
// qDebug("reading "+ s);
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
lnk.setFile( s ); //sets file name
-
+
} else {
// if( QFileInfo( s ).exists() ) {
lnk.setName( QFileInfo(s).baseName());
// if(s.right(4) == '.') {//if regular file
- if(s.left(1) != "/") {
+ if(s.left(1) != "/") {
// qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
// lnk.setIcon(MimeType(s).pixmap() );
// lnk.setIcon("SoundPlayer");
} else {
// qDebug("set link2 "+s);
lnk.setFile( s);
// lnk.setIcon(MimeType(s).pixmap() );
// lnk.setIcon("SoundPlayer");
}
}
d->selectedFiles->addToSelection( lnk );
@@ -737,25 +737,25 @@ void PlayListWidget::readm3u( const QString &filename ) {
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
config.write();
currentPlayList=filename;
// m3uList->write();
m3uList->close();
delete m3uList;
d->selectedFiles->setSelectedItem( s);
setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
-
+
}
/*
reads pls and adds files/urls to playlist */
void PlayListWidget::readPls( const QString &filename ) {
qDebug( "pls filename is " + filename );
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
m3uList->readPls();
@@ -806,25 +806,25 @@ void PlayListWidget::writeCurrentM3u() {
if( d->selectedFiles->first()) {
do {
// qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
// qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
m3uList->write();
m3uList->close();
}
delete m3uList;
-
+
}
/*
writes current playlist to m3u file */
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
fileDlg->exec();
QString name, filename, list;
Om3u *m3uList;
if( fileDlg->result() == 1 ) {
@@ -841,36 +841,36 @@ void PlayListWidget::writem3u() {
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite);
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );
// qDebug( list );
m3uList->write();
m3uList->close();
delete m3uList;
-
+
delete fileDlg;
DocLnk lnk;
lnk.setFile( filename);
lnk.setIcon("opieplayer2/playlist2");
lnk.setName( name); //sets file name
// qDebug(filename);
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
-
+
config.writeEntry("CurrentPlaylist",filename);
currentPlayList=filename;
if(!lnk.writeLink()) {
qDebug("Writing doclink did not work");
}
setCaption(tr("OpiePlayer: ") + name);
}
}
}