summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-26 23:55:00 (UTC)
committer llornkcor <llornkcor>2002-04-26 23:55:00 (UTC)
commit8ca9c8dad17ccaee9b0b8132324176c2a8e40526 (patch) (side-by-side diff)
tree2a6b7cf8a2d5a45d32065cde00ed8399b5ef91d8
parent75b32567bfeb67ed71877c4fa9e918c836a8a68b (diff)
downloadopie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.zip
opie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.tar.gz
opie-8ca9c8dad17ccaee9b0b8132324176c2a8e40526.tar.bz2
fixed playing from audio/video list. added images from config file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp26
-rw-r--r--core/multimedia/opieplayer/audiowidget.h3
-rw-r--r--core/multimedia/opieplayer/inputDialog.cpp29
-rw-r--r--core/multimedia/opieplayer/inputDialog.h7
-rw-r--r--core/multimedia/opieplayer/opieplayer.pro2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp71
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h6
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp21
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
@@ -14,16 +14,17 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
+#include <qpe/config.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qbutton.h>
#include <qpainter.h>
#include <qframe.h>
#include <qlayout.h>
@@ -60,38 +61,45 @@ MediaButton audioButtons[] = {
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 );
connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
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
@@ -117,25 +117,26 @@ public slots:
signals:
void moreClicked();
void lessClicked();
void moreReleased();
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 );
QPixmap *pixmaps[4];
Ticker *songInfo;
QSlider *slider;
};
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
@@ -3,43 +3,50 @@
**
** Created: Sat Mar 2 07:55:03 2002
** by: The User Interface Compiler (uic)
**
** 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
*/
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
@@ -6,26 +6,25 @@
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef INPUTDIALOG_H
#define INPUTDIALOG_H
#include <qvariant.h>
#include <qdialog.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+
class QLineEdit;
class InputDialog : public QDialog
{
Q_OBJECT
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
@@ -5,17 +5,17 @@ DESTDIR = $(OPIEDIR)/bin
HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \
videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h inputDialog.h
SOURCES = main.cpp \
loopcontrol.cpp playlistselection.cpp mediaplayerstate.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
# TMAKE_CXXFLAGS += -DQPIM_STANDALONE
# LIBS += libmpeg3/libmpeg3.a -lpthread
# LIBS += $(OPIEDIR)/plugins/codecs/liblibmadplugin.so
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
@@ -622,25 +622,16 @@ void PlayListWidget::saveList() {
if( fileDlg->result() == 1 ) {
if ( d->current )
delete d->current;
filename = fileDlg->LineEdit1->text();//+".playlist";
// 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
lnk.setIcon("opieplayer/playlist2");
lnk.setName( filename); //sets file name
// qDebug(filename);
if(!lnk.writeLink())
@@ -842,27 +833,29 @@ void PlayListWidget::btnPlay(bool b) {
break;
case 1:
{
addToSelection( audioView->selectedItem() );
mediaPlayerState->setPlaying(b);
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
d->selectedFiles->unSelect();
+ insanityBool=FALSE;
// audioView->clearSelection();
}
break;
case 2:
{
addToSelection( videoView->selectedItem() );
mediaPlayerState->setPlaying(b);
qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
d->selectedFiles->unSelect();
+ insanityBool=FALSE;
// videoView->clearSelection();
}
break;
};
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
@@ -894,17 +887,17 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
}
break;
};
}
void PlayListWidget::playSelected()
{
btnPlay( TRUE);
- d->selectedFiles->unSelect();
+// d->selectedFiles->unSelect();
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
@@ -1019,48 +1012,42 @@ void PlayListWidget::populateVideoView() {
void PlayListWidget::openFile() {
QString filename, name;
InputDialog *fileDlg;
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;
}
void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
{
switch ( e->key() ) {
////////////////////////////// Zaurus keys
@@ -1100,8 +1087,20 @@ void PlayListWidget::doUnblank() {
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::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
@@ -67,17 +67,21 @@ public slots:
/* void setScaled(); */
protected:
/* void contentsMousePressEvent( QMouseEvent * e ); */
/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
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
void populateAudioView();
void populateVideoView();
private slots:
void openFile();
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
@@ -14,16 +14,18 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/resource.h>
#include <qpe/mediaplayerplugininterface.h>
+#include <qpe/config.h>
+
#include <qwidget.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qslider.h>
#include <qdrawutil.h>
#include "videowidget.h"
#include "mediaplayerstate.h"
@@ -62,26 +64,35 @@ MediaButton videoButtons[] = {
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() ) );
connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );