-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 26 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.cpp | 29 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.h | 7 | ||||
-rw-r--r-- | core/multimedia/opieplayer/opieplayer.pro | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 71 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 6 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 21 |
8 files changed, 97 insertions, 68 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 94b979f..aa48961 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp @@ -19,6 +19,7 @@ **********************************************************************/ #include <qpe/qpeapplication.h> #include <qpe/resource.h> +#include <qpe/config.h> #include <qwidget.h> #include <qpixmap.h> @@ -65,20 +66,27 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ) { setCaption( tr("OpiePlayer") ); - + Config cfg("OpiePlayer"); + cfg.setGroup("AudioWidget"); // QGridLayout *layout = new QGridLayout( this ); // layout->setSpacing( 2); // layout->setMargin( 2); - - setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); - pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); - pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); - pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); - pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); + QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix; + backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish"); + buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll"); + buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig"); + controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls"); + animatedPix=cfg.readEntry( "animatedPix", "opieplayer/animatedButton"); + + setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); + pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) ); + pixmaps[1] = new QPixmap( Resource::loadPixmap( buttonsBigPix ) ); + pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix ) ); + pixmaps[3] = new QPixmap( Resource::loadPixmap( animatedPix) ); songInfo = new Ticker( this ); songInfo->setFocusPolicy( QWidget::NoFocus ); - songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); + songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); // layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); slider = new QSlider( Qt::Horizontal, this ); @@ -86,7 +94,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : slider->setFixedHeight( 20 ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); - slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); + slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setGeometry( QRect( 7, 262, 220, 20 ) ); // layout->addMultiCellWidget( slider, 4, 4, 0, 2 ); diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 41ae4b6..b3d39bf 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h @@ -122,6 +122,8 @@ signals: void sliderMoved(long); protected: + void doBlank(); + void doUnblank(); void paintEvent( QPaintEvent *pe ); void showEvent( QShowEvent *se ); void mouseMoveEvent( QMouseEvent *event ); @@ -130,7 +132,6 @@ protected: void timerEvent( QTimerEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); - void showMe(); private: void toggleButton( int ); void setToggleButton( int, bool ); diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp index b443747..b80d129 100644 --- a/core/multimedia/opieplayer/inputDialog.cpp +++ b/core/multimedia/opieplayer/inputDialog.cpp @@ -8,30 +8,31 @@ ****************************************************************************/ #include "inputDialog.h" +#include <qpe/resource.h> + +#include <opie/ofiledialog.h> + #include <qlineedit.h> #include <qlayout.h> #include <qvariant.h> -#include <qtooltip.h> +#include <qpushbutton.h> #include <qwhatsthis.h> -/* - * Constructs a InputDialog which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "InputDialog" ); - resize( 234, 50 ); - setMaximumSize( QSize( 240, 50 ) ); + resize( 234, 115); + setMaximumSize( QSize( 240, 40)); setCaption( tr(name ) ); + QPushButton *browserButton; + browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); + browserButton->setGeometry( QRect( 205, 10, 22, 22)); + connect( browserButton, SIGNAL(released()),this,SLOT(browse())); LineEdit1 = new QLineEdit( this, "LineEdit1" ); - LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); + LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); } /* @@ -43,3 +44,9 @@ InputDialog::~InputDialog() } +void InputDialog::browse() { + + QString str = OFileDialog::getOpenFileName( 1,"/","", "playlist/plain", 0 ); + LineEdit1->setText(str); +} + diff --git a/core/multimedia/opieplayer/inputDialog.h b/core/multimedia/opieplayer/inputDialog.h index 26d5cd0..3e3e36f 100644 --- a/core/multimedia/opieplayer/inputDialog.h +++ b/core/multimedia/opieplayer/inputDialog.h @@ -11,9 +11,7 @@ #include <qvariant.h> #include <qdialog.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; + class QLineEdit; class InputDialog : public QDialog @@ -25,7 +23,8 @@ public: ~InputDialog(); QString inputText; QLineEdit* LineEdit1; - +protected slots: + void browse(); }; #endif // INPUTDIALOG_H diff --git a/core/multimedia/opieplayer/opieplayer.pro b/core/multimedia/opieplayer/opieplayer.pro index 4cef319..6409bab 100644 --- a/core/multimedia/opieplayer/opieplayer.pro +++ b/core/multimedia/opieplayer/opieplayer.pro @@ -10,7 +10,7 @@ SOURCES = main.cpp \ TARGET = opieplayer INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lpthread +LIBS += -lqpe -lpthread -lopie # INTERFACES = # INCLUDEPATH += $(OPIEDIR)/include diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 70b7cef..2118051 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -627,15 +627,6 @@ void PlayListWidget::saveList() { Config cfg( filename +".playlist"); writeConfig( cfg ); -// qDebug("same name so delete lnk??"); -// if( playLists->selected()->name() == filename) { - -// qDebug("same name so delete lnk"); -// QFile().remove(playLists->selected()->file()); -// QFile().remove(playLists->selected()->linkFile()); -// playLists->reread(); -// } -// qDebug("new doclnk"); DocLnk lnk; // lnk.setComment( ""); lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property @@ -847,6 +838,7 @@ void PlayListWidget::btnPlay(bool b) { d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(1); d->selectedFiles->unSelect(); + insanityBool=FALSE; // audioView->clearSelection(); } break; @@ -858,6 +850,7 @@ void PlayListWidget::btnPlay(bool b) { d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(2); d->selectedFiles->unSelect(); + insanityBool=FALSE; // videoView->clearSelection(); } break; @@ -899,7 +892,7 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& void PlayListWidget::playSelected() { btnPlay( TRUE); - d->selectedFiles->unSelect(); +// d->selectedFiles->unSelect(); } void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) @@ -1024,38 +1017,32 @@ void PlayListWidget::openFile() { fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->LineEdit1->text(); - -// InputDialog *fileDlg2; -// fileDlg2 = new InputDialog(this,tr("Name"),TRUE, 0); -// fileDlg2->exec(); -// if( fileDlg2->result() == 1 ) { -// name = fileDlg2->LineEdit1->text(); -// } //http://205.188.234.129:8030 // http://66.28.68.70:8000 qDebug(filename); - DocLnk lnk; -// if(filename.left(7) == "http://") -// name= filename.right(filename.length()-filename.find("http://")-7); -// else name = filename; -// qDebug("name is "+name); -// lnk.setComment(filename); - lnk.setName(filename); //sets file name - if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") - filename += "/"; - lnk.setFile(filename); //sets File property - - lnk.setType("audio/x-mpegurl"); - lnk.setExec("opieplayer"); - lnk.setIcon("opieplayer/MPEGPlayer"); - - if(!lnk.writeLink()) - qDebug("Writing doclink did not work"); - d->selectedFiles->addToSelection( lnk); + if(filename.right(3) == "m3u") + readm3u( filename); + else if(filename.right(3) == "pls") + readPls( filename); + else { + DocLnk lnk; + + lnk.setName(filename); //sets file name + if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") + filename += "/"; + lnk.setFile(filename); //sets File property + + lnk.setType("audio/x-mpegurl"); + lnk.setExec("opieplayer"); + lnk.setIcon("opieplayer/MPEGPlayer"); + + if(!lnk.writeLink()) + qDebug("Writing doclink did not work"); + d->selectedFiles->addToSelection( lnk); // if(fileDlg2) // delete fileDlg2; + } } - if(fileDlg) delete fileDlg; } @@ -1105,3 +1092,15 @@ void PlayListWidget::doUnblank() { QCopEnvelope h("QPE/System", "setBacklight(int)"); h <<-3;// v[1]; // -3 Force on } + +void PlayListWidget::readm3u(const QString &filename) { + +} + +void PlayListWidget::writem3u(const QString &filename) { + +} + +void PlayListWidget::readPls(const QString &filename) { + +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index f22770f..c07d4f8 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -72,7 +72,11 @@ void keyReleaseEvent( QKeyEvent *e); private: void doBlank(); void doUnblank(); - + void readm3u(const QString &); + void writem3u(const QString &); + void readPls(const QString &); + + void initializeStates(); void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 3bce996..97997f9 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp @@ -19,6 +19,8 @@ **********************************************************************/ #include <qpe/resource.h> #include <qpe/mediaplayerplugininterface.h> +#include <qpe/config.h> + #include <qwidget.h> #include <qpainter.h> #include <qpixmap.h> @@ -67,16 +69,25 @@ static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { setCaption( tr("OpiePlayer") ); - setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); - pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButton0a" ) ); - pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButton0b" ) ); - pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls0" ) ); + Config cfg("OpiePlayer"); + cfg.setGroup("VideoWidget"); + + QString backgroundPix, Button0aPix, Button0bPix, controlsPix; + backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); + Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); + Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); + controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); + + setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); + pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); + pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); + pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); - slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); + slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |