summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorsimon <simon>2002-12-02 15:51:48 (UTC)
committer simon <simon>2002-12-02 15:51:48 (UTC)
commita0cfa5b76aac8de36304faef4bb2b14237c04c9a (patch) (unidiff)
tree0b427d07d918671065e6aed1682b108cda166ce7 /noncore/multimedia/opieplayer2
parent9f770813346acbe7817b20c5fe0fea03827fc41a (diff)
downloadopie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.zip
opie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.tar.gz
opie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.tar.bz2
- simplified MediaPlayer::setPlaying, moving more switch() like code into
playlistwidget
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h15
4 files changed, 34 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 6a38adc..74ab2e3 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -35,3 +35,3 @@ extern MediaPlayerState *mediaPlayerState;
35MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 35MediaPlayer::MediaPlayer( QObject *parent, const char *name )
36 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 36 : QObject( parent, name ), volumeDirection( 0 ) {
37 37
@@ -97,14 +97,3 @@ void MediaPlayer::setPlaying( bool play ) {
97 QString tickerText, time, fileName; 97 QString tickerText, time, fileName;
98 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //check for filelist 98 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) {
99 const DocLnk *playListCurrent = playList->current();
100 if ( playListCurrent != NULL ) {
101 currentFile = playListCurrent;
102 }
103 xineControl->play( currentFile->file() );
104 fileName = currentFile->name();
105 long seconds = mediaPlayerState->length();//
106 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
107 //qDebug(time);
108
109 } else {
110 //if playing in file list.. play in a different way 99 //if playing in file list.. play in a different way
@@ -119,15 +108,13 @@ void MediaPlayer::setPlaying( bool play ) {
119 mediaPlayerState->setShuffled( false ); 108 mediaPlayerState->setShuffled( false );
109 }
120 110
121 fileName = playList->currentFileListPathName(); 111 PlayListWidget::Entry playListEntry = playList->currentEntry();
122 xineControl->play( fileName ); 112 fileName = playListEntry.name;
123 long seconds = mediaPlayerState->length(); 113 xineControl->play( playListEntry.file );
124 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
125 //qDebug(time);
126 if( fileName.left(4) != "http" ) {
127 fileName = QFileInfo( fileName ).baseName();
128 }
129 114
130 } 115 long seconds = mediaPlayerState->length();
116 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
131 117
132 if( fileName.left(4) == "http" ) { 118 if( fileName.left(4) == "http" ) {
119 fileName = QFileInfo( fileName ).baseName();
133 if ( xineControl->getMetaInfo().isEmpty() ) { 120 if ( xineControl->getMetaInfo().isEmpty() ) {
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 002311a..1e34c88 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -70,3 +70,2 @@ private:
70 int volumeDirection; 70 int volumeDirection;
71 const DocLnk *currentFile;
72 XineControl *xineControl; 71 XineControl *xineControl;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index fd256b7..ce73252 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -426,3 +426,3 @@ void PlayListWidget::useSelectedDocument() {
426 426
427const DocLnk *PlayListWidget::current() { // this is fugly 427const DocLnk *PlayListWidget::current() const { // this is fugly
428 assert( currentTab() == CurrentPlayList ); 428 assert( currentTab() == CurrentPlayList );
@@ -1143,2 +1143,12 @@ PlayListWidget::TabType PlayListWidget::currentTab() const
1143 1143
1144PlayListWidget::Entry PlayListWidget::currentEntry() const
1145{
1146 if ( currentTab() == CurrentPlayList ) {
1147 const DocLnk *lnk = current();
1148 return Entry( lnk->name(), lnk->file() );
1149 }
1150
1151 return Entry( currentFileListPathName() );
1152}
1153
1144QString PlayListWidget::currentFileListPathName() const { 1154QString PlayListWidget::currentFileListPathName() const {
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 2e2ff89..511a192 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -60,2 +60,13 @@ public:
60 60
61 struct Entry
62 {
63 Entry( const QString &_name, const QString &_fileName )
64 : name( _name ), file( _fileName ) {}
65 Entry( const QString &_fileName )
66 : name( _fileName ), file( _fileName ) {}
67
68 QString name;
69 QString file;
70 };
71
61 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 72 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
@@ -68,3 +79,3 @@ public:
68 // retrieve the current playlist entry (media file link) 79 // retrieve the current playlist entry (media file link)
69 const DocLnk *current(); 80 const DocLnk *current() const;
70 void useSelectedDocument(); 81 void useSelectedDocument();
@@ -73,2 +84,4 @@ public:
73 84
85 Entry currentEntry() const;
86
74public slots: 87public slots: