author | llornkcor <llornkcor> | 2002-04-26 23:55:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-26 23:55:00 (UTC) |
commit | 8ca9c8dad17ccaee9b0b8132324176c2a8e40526 (patch) (side-by-side diff) | |
tree | 2a6b7cf8a2d5a45d32065cde00ed8399b5ef91d8 | |
parent | 75b32567bfeb67ed71877c4fa9e918c836a8a68b (diff) | |
download | opie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.zip opie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.tar.gz opie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.tar.bz2 |
fixed playing from audio/video list. added images from config file
-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 @@ -18,8 +18,9 @@ ** **********************************************************************/ #include <qpe/qpeapplication.h> #include <qpe/resource.h> +#include <qpe/config.h> #include <qwidget.h> #include <qpixmap.h> #include <qbutton.h> @@ -64,30 +65,37 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 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 ); slider->setFixedWidth( 220 ); 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 @@ -121,17 +121,18 @@ signals: void lessReleased(); void sliderMoved(long); protected: + void doBlank(); + void doUnblank(); void paintEvent( QPaintEvent *pe ); void showEvent( QShowEvent *se ); void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void timerEvent( QTimerEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); - void showMe(); private: void toggleButton( int ); void setToggleButton( int, bool ); void paintButton( QPainter *p, int i ); 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 @@ -7,32 +7,33 @@ ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #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 ) ); } /* * Destroys the object and frees any allocated resources @@ -42,4 +43,10 @@ InputDialog::~InputDialog() inputText= LineEdit1->text(); } +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 @@ -10,11 +10,9 @@ #define INPUTDIALOG_H #include <qvariant.h> #include <qdialog.h> -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; + class QLineEdit; class InputDialog : public QDialog { @@ -24,8 +22,9 @@ public: InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~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 @@ -9,9 +9,9 @@ SOURCES = main.cpp \ videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp inputDialog.cpp TARGET = opieplayer INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lpthread +LIBS += -lqpe -lpthread -lopie # INTERFACES = # INCLUDEPATH += $(OPIEDIR)/include # CONFIG+=static 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 @@ -626,17 +626,8 @@ void PlayListWidget::saveList() { // qDebug("saving playlist "+filename+".playlist"); 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 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D @@ -846,8 +837,9 @@ void PlayListWidget::btnPlay(bool b) { mediaPlayerState->setPlaying(b); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(1); d->selectedFiles->unSelect(); + insanityBool=FALSE; // audioView->clearSelection(); } break; case 2: @@ -857,8 +849,9 @@ void PlayListWidget::btnPlay(bool b) { qApp->processEvents(); d->selectedFiles->removeSelected( ); tabWidget->setCurrentPage(2); d->selectedFiles->unSelect(); + insanityBool=FALSE; // videoView->clearSelection(); } break; }; @@ -898,9 +891,9 @@ 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) { @@ -1023,40 +1016,34 @@ void PlayListWidget::openFile() { fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 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; } @@ -1104,4 +1091,16 @@ 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 @@ -71,9 +71,13 @@ protected: 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; PlayListWidgetPrivate *d; // Private implementation data 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 @@ -18,8 +18,10 @@ ** **********************************************************************/ #include <qpe/resource.h> #include <qpe/mediaplayerplugininterface.h> +#include <qpe/config.h> + #include <qwidget.h> #include <qpainter.h> #include <qpixmap.h> #include <qslider.h> @@ -66,18 +68,27 @@ 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 ) ); connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |