summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -1,121 +1,129 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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>
#include "audiowidget.h"
#include "mediaplayerstate.h"
extern MediaPlayerState *mediaPlayerState;
static const int xo = -2; // movable x offset
static const int yo = 22; // movable y offset
struct MediaButton {
int xPos, yPos;
int color;
bool isToggle, isBig, isHeld, isDown;
};
// Layout information for the audioButtons (and if it is a toggle button or not)
MediaButton audioButtons[] = {
{ 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play
{ 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop
{ 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause
{ 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next
{ 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous
{ 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up
{ 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down
{ 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop
{ 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist
};
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) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
mediaPlayerState->isStreaming = FALSE;
for ( int i = 0; i < 4; i++ )
delete pixmaps[i];
}
static bool audioSliderBeingMoved = FALSE;
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
@@ -93,53 +93,54 @@ protected:
private:
QString scrollText;
int pos, pixelLen;
};
class AudioWidget : public QWidget {
Q_OBJECT
public:
AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
~AudioWidget();
void setTickerText( const QString &text ) { songInfo->setText( text ); }
bool isStreaming;
public slots:
void updateSlider( long, long );
void sliderPressed( );
void sliderReleased( );
void setPaused( bool b) { setToggleButton( AudioPause, b ); }
void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
void setPosition( long );
void setLength( long );
void setView( char );
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;
};
#endif // AUDIO_WIDGET_H
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
@@ -1,45 +1,52 @@
/****************************************************************************
** Form implementation generated from reading ui file 'inputDialog.ui'
**
** 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
@@ -1,31 +1,30 @@
/****************************************************************************
** Form interface generated from reading ui file 'inputDialog.ui'
**
** Created: Sat Mar 2 07:54:46 2002
** by: The User Interface Compiler (uic)
**
** 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
@@ -1,24 +1,24 @@
TEMPLATE = app
CONFIG = qt warn_on release
#release
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
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(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
@@ -598,73 +598,64 @@ bool PlayListWidget::next() {
bool PlayListWidget::first() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->first();
else
return mediaPlayerState->looping();
}
bool PlayListWidget::last() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->last();
else
return mediaPlayerState->looping();
}
void PlayListWidget::saveList() {
QString filename;
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
fileDlg->exec();
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())
qDebug("Writing doclink did not work");
}
Config config( "OpiePlayer" );
config.writeEntry("CurrentPlaylist",filename);
setCaption(tr("OpiePlayer: ")+filename);
d->selectedFiles->first();
if(fileDlg)
delete fileDlg;
}
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name= lnk.name();
// qDebug("currentList is "+name);
if( name.length()>1) {
setCaption("OpiePlayer: "+name);
// qDebug("load list "+ name+".playlist");
clearList();
Config cfg( name+".playlist");
readConfig(cfg);
tabWidget->setCurrentPage(0);
Config config( "OpiePlayer" );
config.writeEntry("CurrentPlaylist", name);
@@ -818,117 +809,119 @@ void PlayListWidget::tabChanged(QWidget *widg) {
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 3:
{
if( tbDeletePlaylist->isHidden())
tbDeletePlaylist->show();
playLists->reread();
}
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
mediaPlayerState->setPlaying(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?")),
(tr("You really want to delete\nthis playlist?")),
(tr("Yes")), (tr("No")), 0 )){
case 0: // Yes clicked,
QFile().remove(playLists->selected()->file());
QFile().remove(playLists->selected()->linkFile());
playLists->reread();
break;
case 1: // Cancel
break;
};
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.insertSeparator();
m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
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;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
// m.insertSeparator();
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::listDelete() {
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
QString file;
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch ( tabWidget->currentPageIndex()) {
case 0:
break;
case 1:
{
file = audioView->selectedItem()->text(0);
@@ -995,113 +988,119 @@ void PlayListWidget::populateAudioView() {
void PlayListWidget::populateVideoView() {
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
Global::findDocuments(&vFiles, "video/*");
QListIterator<DocLnk> Vdit( vFiles.children() );
QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage;
for ( ; Vdit.current(); ++Vdit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if( Vdit.current()->file().find(path) != -1 ) storage=name;
}
QListViewItem * newItem;
if ( QFile( Vdit.current()->file()).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" ));
}
}
}
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
case Key_F9: //activity
// if(audioUI->isHidden())
// audioUI->showMaximized();
break;
case Key_F10: //contacts
// if( videoUI->isHidden())
// videoUI->showMaximized();
break;
case Key_F11: //menu
break;
case Key_F12: //home
// doBlank();
break;
case Key_F13: //mail
// doUnblank();
break;
}
}
void PlayListWidget::doBlank() {
qDebug("do blanking");
fd=open("/dev/fb0",O_RDWR);
if (fd != -1) {
ioctl(fd,FBIOBLANK,1);
// close(fd);
}
}
void PlayListWidget::doUnblank() {
// this crashes opieplayer with a segfault
// int fd;
// fd=open("/dev/fb0",O_RDWR);
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
@@ -43,65 +43,69 @@ public:
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidget();
QTabWidget * tabWidget;
QAction *fullScreenButton, *scaleButton;
DocLnkSet files;
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
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;
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);
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();
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();
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
@@ -1,111 +1,122 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** 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"
#ifdef Q_WS_QWS
# define USE_DIRECT_PAINTER
# include <qdirectpainter_qws.h>
# include <qgfxraster_qws.h>
#endif
extern MediaPlayerState *mediaPlayerState;
static const int xo = 2; // movable x offset
static const int yo = 0; // movable y offset
struct MediaButton {
int xPos, yPos;
bool isToggle, isHeld, isDown;
int controlType;
};
// Layout information for the videoButtons (and if it is a toggle button or not)
MediaButton videoButtons[] = {
{ 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous
{ 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop
{ 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play
{ 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause
{ 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next
{ 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist
{ 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen
};
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) ) );
connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setFullscreen( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
VideoWidget::~VideoWidget() {
for ( int i = 0; i < 3; i++ )
delete pixmaps[i];
delete currentFrame;
}
static bool videoSliderBeingMoved = FALSE;