author | harlekin <harlekin> | 2002-07-03 14:44:22 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-03 14:44:22 (UTC) |
commit | e1e4956ec7ffa9a07f98b03e831f0f9627556a6c (patch) (unidiff) | |
tree | c0545c6a22732f05804bda7704227132f64b7239 | |
parent | 61770de77f2abe8012d44cce49d04489e4187644 (diff) | |
download | opie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.zip opie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.tar.gz opie-e1e4956ec7ffa9a07f98b03e831f0f9627556a6c.tar.bz2 |
much more code cleanup, make if look more like c++ code
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 43 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 44 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.h | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 68 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 5 |
7 files changed, 65 insertions, 125 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8d3963a..1b0de5d 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -10,42 +10,80 @@ | |||
10 | #include <qframe.h> | 10 | #include <qframe.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | 12 | ||
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "mediaplayerstate.h" | 14 | #include "mediaplayerstate.h" |
15 | 15 | ||
16 | extern MediaPlayerState *mediaPlayerState; | 16 | extern MediaPlayerState *mediaPlayerState; |
17 | 17 | ||
18 | |||
19 | static const int xo = -2; // movable x offset | 18 | static const int xo = -2; // movable x offset |
20 | static const int yo = 22; // movable y offset | 19 | static const int yo = 22; // movable y offset |
21 | 20 | ||
22 | 21 | ||
22 | Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { | ||
23 | setFrameStyle( WinPanel | Sunken ); | ||
24 | setText( "No Song" ); | ||
25 | } | ||
26 | |||
27 | Ticker::~Ticker() { | ||
28 | } | ||
29 | |||
30 | void Ticker::setText( const QString& text ) { | ||
31 | pos = 0; // reset it everytime the text is changed | ||
32 | scrollText = text; | ||
33 | pixelLen = fontMetrics().width( scrollText ); | ||
34 | killTimers(); | ||
35 | if ( pixelLen > width() ) { | ||
36 | startTimer( 50 ); | ||
37 | } | ||
38 | update(); | ||
39 | } | ||
40 | |||
41 | |||
42 | void Ticker::timerEvent( QTimerEvent * ) { | ||
43 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | ||
44 | repaint( FALSE ); | ||
45 | } | ||
46 | |||
47 | void Ticker::drawContents( QPainter *p ) { | ||
48 | QPixmap pm( width(), height() ); | ||
49 | pm.fill( colorGroup().base() ); | ||
50 | QPainter pmp( &pm ); | ||
51 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | ||
52 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
53 | } | ||
54 | p->drawPixmap( 0, 0, pm ); | ||
55 | } | ||
56 | |||
57 | |||
58 | |||
59 | |||
23 | struct MediaButton { | 60 | struct MediaButton { |
24 | int xPos, yPos; | 61 | int xPos, yPos; |
25 | int color; | 62 | int color; |
26 | bool isToggle, isBig, isHeld, isDown; | 63 | bool isToggle, isBig, isHeld, isDown; |
27 | }; | 64 | }; |
28 | 65 | ||
29 | 66 | ||
67 | |||
68 | |||
30 | // Layout information for the audioButtons (and if it is a toggle button or not) | 69 | // Layout information for the audioButtons (and if it is a toggle button or not) |
31 | MediaButton audioButtons[] = { | 70 | MediaButton audioButtons[] = { |
32 | { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play | 71 | { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play |
33 | { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop | 72 | { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop |
34 | { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause | 73 | { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause |
35 | { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next | 74 | { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next |
36 | { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous | 75 | { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous |
37 | { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up | 76 | { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up |
38 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down | 77 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down |
39 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop | 78 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop |
40 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist | 79 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist |
41 | }; | 80 | }; |
42 | 81 | ||
43 | |||
44 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 82 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
45 | 83 | ||
46 | 84 | ||
47 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 85 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
48 | QWidget( parent, name, f ) | 86 | QWidget( parent, name, f ) |
49 | { | 87 | { |
50 | setCaption( tr("OpiePlayer - Audio") ); | 88 | setCaption( tr("OpiePlayer - Audio") ); |
51 | Config cfg("OpiePlayer"); | 89 | Config cfg("OpiePlayer"); |
@@ -140,17 +178,16 @@ void AudioWidget::setView( char view ) { | |||
140 | // does not stop stream when it reaches the end | 178 | // does not stop stream when it reaches the end |
141 | slider->show(); | 179 | slider->show(); |
142 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 180 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
143 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 181 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
144 | } | 182 | } |
145 | 183 | ||
146 | if ( view == 'a' ) { | 184 | if ( view == 'a' ) { |
147 | startTimer( 150 ); | 185 | startTimer( 150 ); |
148 | // show(); | ||
149 | showMaximized(); | 186 | showMaximized(); |
150 | } else { | 187 | } else { |
151 | killTimers(); | 188 | killTimers(); |
152 | hide(); | 189 | hide(); |
153 | } | 190 | } |
154 | } | 191 | } |
155 | 192 | ||
156 | 193 | ||
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index eab5df4..441eb6e 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -25,55 +25,25 @@ enum AudioButtons { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | 27 | ||
28 | #define USE_DBLBUF | 28 | #define USE_DBLBUF |
29 | 29 | ||
30 | 30 | ||
31 | class Ticker : public QFrame { | 31 | class Ticker : public QFrame { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | |||
33 | public: | 34 | public: |
34 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { | 35 | Ticker( QWidget* parent=0 ); |
35 | setFrameStyle( WinPanel | Sunken ); | 36 | ~Ticker(); |
36 | setText( "No Song" ); | 37 | void setText( const QString& text ) ; |
37 | } | 38 | |
38 | ~Ticker() { } | ||
39 | void setText( const QString& text ) { | ||
40 | pos = 0; // reset it everytime the text is changed | ||
41 | scrollText = text; | ||
42 | pixelLen = fontMetrics().width( scrollText ); | ||
43 | killTimers(); | ||
44 | if ( pixelLen > width() ) | ||
45 | startTimer( 50 ); | ||
46 | update(); | ||
47 | } | ||
48 | protected: | 39 | protected: |
49 | void timerEvent( QTimerEvent * ) { | 40 | void timerEvent( QTimerEvent * ); |
50 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 41 | void drawContents( QPainter *p ); |
51 | #ifndef USE_DBLBUF | ||
52 | scroll( -1, 0, contentsRect() ); | ||
53 | #else | ||
54 | repaint( FALSE ); | ||
55 | #endif | ||
56 | } | ||
57 | void drawContents( QPainter *p ) { | ||
58 | #ifndef USE_DBLBUF | ||
59 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
60 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
61 | #else | ||
62 | // Double buffering code. | ||
63 | // Looks like qvfb makes it look like it flickers but I don't think it really is | ||
64 | QPixmap pm( width(), height() ); | ||
65 | pm.fill( colorGroup().base() ); | ||
66 | QPainter pmp( &pm ); | ||
67 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
68 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
69 | p->drawPixmap( 0, 0, pm ); | ||
70 | #endif | ||
71 | } | ||
72 | private: | 42 | private: |
73 | QString scrollText; | 43 | QString scrollText; |
74 | int pos, pixelLen; | 44 | int pos, pixelLen; |
75 | }; | 45 | }; |
76 | 46 | ||
77 | 47 | ||
78 | class AudioWidget : public QWidget { | 48 | class AudioWidget : public QWidget { |
79 | Q_OBJECT | 49 | Q_OBJECT |
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index da8e276..687aff6 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp | |||
@@ -1,16 +1,8 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:55:03 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
10 | 2 | ||
11 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
12 | 4 | ||
13 | #include <opie/ofiledialog.h> | 5 | #include <opie/ofiledialog.h> |
14 | 6 | ||
15 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
16 | #include <qlayout.h> | 8 | #include <qlayout.h> |
diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h index 3e3e36f..d4f5e12 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.h +++ b/noncore/multimedia/opieplayer2/inputDialog.h | |||
@@ -1,26 +1,18 @@ | |||
1 | /**************************************************************************** | 1 | |
2 | ** Form interface generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:54:46 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef INPUTDIALOG_H | 2 | #ifndef INPUTDIALOG_H |
10 | #define INPUTDIALOG_H | 3 | #define INPUTDIALOG_H |
11 | 4 | ||
12 | #include <qvariant.h> | 5 | #include <qvariant.h> |
13 | #include <qdialog.h> | 6 | #include <qdialog.h> |
14 | 7 | ||
15 | class QLineEdit; | 8 | class QLineEdit; |
16 | 9 | ||
17 | class InputDialog : public QDialog | 10 | class InputDialog : public QDialog { |
18 | { | ||
19 | Q_OBJECT | 11 | Q_OBJECT |
20 | 12 | ||
21 | public: | 13 | public: |
22 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
23 | ~InputDialog(); | 15 | ~InputDialog(); |
24 | QString inputText; | 16 | QString inputText; |
25 | QLineEdit* LineEdit1; | 17 | QLineEdit* LineEdit1; |
26 | protected slots: | 18 | protected slots: |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e6d0525..87184ba 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -49,79 +49,39 @@ void MediaPlayer::pauseCheck( bool b ) { | |||
49 | 49 | ||
50 | void MediaPlayer::play() { | 50 | void MediaPlayer::play() { |
51 | mediaPlayerState->setPlaying( FALSE ); | 51 | mediaPlayerState->setPlaying( FALSE ); |
52 | mediaPlayerState->setPlaying( TRUE ); | 52 | mediaPlayerState->setPlaying( TRUE ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void MediaPlayer::setPlaying( bool play ) { | 55 | void MediaPlayer::setPlaying( bool play ) { |
56 | if ( !play ) { | 56 | if ( !play ) { |
57 | mediaPlayerState->setPaused( FALSE ); | 57 | mediaPlayerState->setPaused( FALSE ); |
58 | // loopControl->stop( FALSE ); | 58 | return; |
59 | return; | ||
60 | } | 59 | } |
61 | 60 | ||
62 | if ( mediaPlayerState->paused() ) { | 61 | if ( mediaPlayerState->paused() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 62 | mediaPlayerState->setPaused( FALSE ); |
64 | return; | 63 | return; |
65 | } | 64 | } |
66 | 65 | ||
67 | const DocLnk *playListCurrent = playList->current(); | 66 | const DocLnk *playListCurrent = playList->current(); |
68 | if ( playListCurrent != NULL ) { | 67 | if ( playListCurrent != NULL ) { |
69 | // loopControl->stop( TRUE ); | 68 | currentFile = playListCurrent; |
70 | currentFile = playListCurrent; | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | |||
75 | if ( currentFile == NULL ) { | ||
76 | QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); | ||
77 | mediaPlayerState->setPlaying( FALSE ); | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { | ||
82 | QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); | ||
83 | mediaPlayerState->setPlaying( FALSE ); | ||
84 | return; | ||
85 | } | ||
86 | |||
87 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { | ||
88 | QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); | ||
89 | mediaPlayerState->setPlaying( FALSE ); | ||
90 | return; | ||
91 | } | 69 | } |
92 | 70 | ||
93 | // if ( !loopControl->init( currentFile->file() ) ) { | 71 | audioUI->setTickerText( currentFile->file() ); |
94 | // QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); | ||
95 | // mediaPlayerState->setPlaying( FALSE ); | ||
96 | // return; | ||
97 | // } | ||
98 | // long seconds = loopControl->totalPlaytime(); | ||
99 | long seconds = 120; | ||
100 | QString time; | ||
101 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
102 | QString tickerText; | ||
103 | if( currentFile->file().left(4) == "http" ) | ||
104 | tickerText= tr( " File: " ) + currentFile->name(); | ||
105 | else | ||
106 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | ||
107 | 72 | ||
108 | QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | ||
109 | if ( !fileInfo.isEmpty() ) | ||
110 | tickerText += ", " + fileInfo; | ||
111 | audioUI->setTickerText( tickerText + "." ); | ||
112 | 73 | ||
74 | // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben | ||
113 | 75 | ||
114 | */ // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben | 76 | // Ob auch video 'v' : 'a' |
77 | // mediaPlayerState->setView( 'v' ); | ||
115 | 78 | ||
116 | 79 | // abspielen starten. | |
117 | // loopControl->play(); | ||
118 | |||
119 | // mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' ); | ||
120 | } | 80 | } |
121 | 81 | ||
122 | 82 | ||
123 | void MediaPlayer::prev() { | 83 | void MediaPlayer::prev() { |
124 | if ( playList->prev() ) | 84 | if ( playList->prev() ) |
125 | play(); | 85 | play(); |
126 | else if ( mediaPlayerState->looping() ) { | 86 | else if ( mediaPlayerState->looping() ) { |
127 | if ( playList->last() ) | 87 | if ( playList->last() ) |
@@ -140,17 +100,17 @@ void MediaPlayer::next() { | |||
140 | } else | 100 | } else |
141 | mediaPlayerState->setList(); | 101 | mediaPlayerState->setList(); |
142 | } | 102 | } |
143 | 103 | ||
144 | 104 | ||
145 | void MediaPlayer::startDecreasingVolume() { | 105 | void MediaPlayer::startDecreasingVolume() { |
146 | volumeDirection = -1; | 106 | volumeDirection = -1; |
147 | startTimer( 100 ); | 107 | startTimer( 100 ); |
148 | // sollte volumeapplet machen | 108 | // da kommt demnächst osound denk ich mal |
149 | // AudioDevice::decreaseVolume(); | 109 | // AudioDevice::decreaseVolume(); |
150 | } | 110 | } |
151 | 111 | ||
152 | 112 | ||
153 | void MediaPlayer::startIncreasingVolume() { | 113 | void MediaPlayer::startIncreasingVolume() { |
154 | volumeDirection = +1; | 114 | volumeDirection = +1; |
155 | startTimer( 100 ); | 115 | startTimer( 100 ); |
156 | // AudioDevice::increaseVolume(); | 116 | // AudioDevice::increaseVolume(); |
@@ -158,19 +118,19 @@ void MediaPlayer::startIncreasingVolume() { | |||
158 | 118 | ||
159 | 119 | ||
160 | void MediaPlayer::stopChangingVolume() { | 120 | void MediaPlayer::stopChangingVolume() { |
161 | killTimers(); | 121 | killTimers(); |
162 | } | 122 | } |
163 | 123 | ||
164 | 124 | ||
165 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 125 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
166 | // if ( volumeDirection == +1 ) | 126 | // if ( volumeDirection == +1 ) |
167 | // AudioDevice::increaseVolume(); | 127 | // AudioDevice::increaseVolume(); |
168 | // else if ( volumeDirection == -1 ) | 128 | // else if ( volumeDirection == -1 ) |
169 | // AudioDevice::decreaseVolume(); | 129 | // AudioDevice::decreaseVolume(); |
170 | } | 130 | } |
171 | 131 | ||
172 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 132 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
173 | switch ( e->key() ) { | 133 | switch ( e->key() ) { |
174 | ////////////////////////////// Zaurus keys | 134 | ////////////////////////////// Zaurus keys |
175 | case Key_Home: | 135 | case Key_Home: |
176 | break; | 136 | break; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 9b5f70e..d1d30e4 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -7,30 +7,22 @@ | |||
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | #include <qobject.h> | 8 | #include <qobject.h> |
9 | #include <qdir.h> | 9 | #include <qdir.h> |
10 | #include <qpe/mediaplayerplugininterface.h> | 10 | #include <qpe/mediaplayerplugininterface.h> |
11 | #include "mediaplayerstate.h" | 11 | #include "mediaplayerstate.h" |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | #ifdef QT_NO_COMPONENT | ||
16 | // Plugins which are compiled in when no plugin architecture available | ||
17 | #include "libmad/libmadpluginimpl.h" | ||
18 | #include "libmpeg3/libmpeg3pluginimpl.h" | ||
19 | #include "wavplugin/wavpluginimpl.h" | ||
20 | #endif | ||
21 | |||
22 | |||
23 | //#define MediaPlayerDebug(x) qDebug x | 15 | //#define MediaPlayerDebug(x) qDebug x |
24 | #define MediaPlayerDebug(x) | 16 | #define MediaPlayerDebug(x) |
25 | 17 | ||
26 | 18 | ||
27 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 19 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
28 | : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { | 20 | : QObject( parent, name ), decoder( NULL ) { |
29 | Config cfg( "OpiePlayer" ); | 21 | Config cfg( "OpiePlayer" ); |
30 | readConfig( cfg ); | 22 | readConfig( cfg ); |
31 | } | 23 | } |
32 | 24 | ||
33 | 25 | ||
34 | MediaPlayerState::~MediaPlayerState() { | 26 | MediaPlayerState::~MediaPlayerState() { |
35 | Config cfg( "OpiePlayer" ); | 27 | Config cfg( "OpiePlayer" ); |
36 | writeConfig( cfg ); | 28 | writeConfig( cfg ); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 374e780..8a64939 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -25,18 +25,17 @@ public: | |||
25 | bool paused() { return isPaused; } | 25 | bool paused() { return isPaused; } |
26 | bool playing() { return isPlaying; } | 26 | bool playing() { return isPlaying; } |
27 | long position() { return curPosition; } | 27 | long position() { return curPosition; } |
28 | long length() { return curLength; } | 28 | long length() { return curLength; } |
29 | char view() { return curView; } | 29 | char view() { return curView; } |
30 | 30 | ||
31 | MediaPlayerDecoder *newDecoder( const QString& file ); | 31 | MediaPlayerDecoder *newDecoder( const QString& file ); |
32 | MediaPlayerDecoder *curDecoder(); | 32 | MediaPlayerDecoder *curDecoder(); |
33 | MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the | 33 | |
34 | // number of audio samples if we are using the libmad plugin | ||
35 | public slots: | 34 | public slots: |
36 | void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); } | 35 | void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); } |
37 | void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); } | 36 | void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); } |
38 | void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } | 37 | void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } |
39 | void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } | 38 | void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } |
40 | void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } | 39 | void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } |
41 | void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } | 40 | void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } |
42 | void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } | 41 | void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } |
@@ -83,18 +82,16 @@ private: | |||
83 | bool usePlaylist; | 82 | bool usePlaylist; |
84 | bool isPaused; | 83 | bool isPaused; |
85 | bool isPlaying; | 84 | bool isPlaying; |
86 | long curPosition; | 85 | long curPosition; |
87 | long curLength; | 86 | long curLength; |
88 | char curView; | 87 | char curView; |
89 | 88 | ||
90 | MediaPlayerDecoder *decoder; | 89 | MediaPlayerDecoder *decoder; |
91 | MediaPlayerDecoder *libmpeg3decoder; | ||
92 | // MediaPlayerDecoder *libwavdecoder; | ||
93 | 90 | ||
94 | void readConfig( Config& cfg ); | 91 | void readConfig( Config& cfg ); |
95 | void writeConfig( Config& cfg ) const; | 92 | void writeConfig( Config& cfg ) const; |
96 | }; | 93 | }; |
97 | 94 | ||
98 | 95 | ||
99 | #endif // MEDIA_PLAYER_STATE_H | 96 | #endif // MEDIA_PLAYER_STATE_H |
100 | 97 | ||