author | simon <simon> | 2002-12-02 19:52:45 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 19:52:45 (UTC) |
commit | 262f335a055e189130a3c0dd7028388ab103504e (patch) (unidiff) | |
tree | 9115845fae96d06ca3235ae1b8153b9739cf3be5 /noncore/multimedia/opieplayer2 | |
parent | e77f4914311d8a623c084d01a287798440abf01f (diff) | |
download | opie-262f335a055e189130a3c0dd7028388ab103504e.zip opie-262f335a055e189130a3c0dd7028388ab103504e.tar.gz opie-262f335a055e189130a3c0dd7028388ab103504e.tar.bz2 |
- less code duplication
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 8 |
6 files changed, 14 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 0b7d470..f4edb79 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -150,27 +150,25 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) : | |||
150 | // Config cofg("qpe"); | 150 | // Config cofg("qpe"); |
151 | // cofg.setGroup("Appearance"); | 151 | // cofg.setGroup("Appearance"); |
152 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 152 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
153 | 153 | ||
154 | time.setFocusPolicy( QWidget::NoFocus ); | 154 | time.setFocusPolicy( QWidget::NoFocus ); |
155 | time.setAlignment( Qt::AlignCenter ); | 155 | time.setAlignment( Qt::AlignCenter ); |
156 | 156 | ||
157 | // time.setFrame(FALSE); | 157 | // time.setFrame(FALSE); |
158 | // changeTextColor( &time ); | 158 | // changeTextColor( &time ); |
159 | 159 | ||
160 | resizeEvent( NULL ); | 160 | resizeEvent( NULL ); |
161 | 161 | ||
162 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | ||
163 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 162 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
164 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | ||
165 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 163 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
166 | 164 | ||
167 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 165 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
168 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 166 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
169 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 167 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
170 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 168 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
171 | 169 | ||
172 | // Intialise state | 170 | // Intialise state |
173 | setLength( mediaPlayerState->length() ); | 171 | setLength( mediaPlayerState->length() ); |
174 | setPosition( mediaPlayerState->position() ); | 172 | setPosition( mediaPlayerState->position() ); |
175 | setLooping( mediaPlayerState->isFullscreen() ); | 173 | setLooping( mediaPlayerState->isFullscreen() ); |
176 | // setPaused( mediaPlayerState->paused() ); | 174 | // setPaused( mediaPlayerState->paused() ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 74c5b0e..83927f1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -67,31 +67,31 @@ enum AudioButtons { | |||
67 | 67 | ||
68 | class AudioWidget : public MediaWidget { | 68 | class AudioWidget : public MediaWidget { |
69 | Q_OBJECT | 69 | Q_OBJECT |
70 | public: | 70 | public: |
71 | AudioWidget( QWidget* parent=0, const char* name=0 ); | 71 | AudioWidget( QWidget* parent=0, const char* name=0 ); |
72 | ~AudioWidget(); | 72 | ~AudioWidget(); |
73 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 73 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
74 | public slots: | 74 | public slots: |
75 | void updateSlider( long, long ); | 75 | void updateSlider( long, long ); |
76 | void sliderPressed( ); | 76 | void sliderPressed( ); |
77 | void sliderReleased( ); | 77 | void sliderReleased( ); |
78 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 78 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
79 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | ||
80 | void setPosition( long ); | 79 | void setPosition( long ); |
81 | void setLength( long ); | ||
82 | void setSeekable( bool ); | 80 | void setSeekable( bool ); |
83 | 81 | ||
84 | public: | 82 | public: |
85 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | 83 | virtual void setLength( long ); |
84 | virtual void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | ||
85 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | ||
86 | 86 | ||
87 | signals: | 87 | signals: |
88 | void moreClicked(); | 88 | void moreClicked(); |
89 | void lessClicked(); | 89 | void lessClicked(); |
90 | void moreReleased(); | 90 | void moreReleased(); |
91 | void lessReleased(); | 91 | void lessReleased(); |
92 | void forwardClicked(); | 92 | void forwardClicked(); |
93 | void backClicked(); | 93 | void backClicked(); |
94 | void forwardReleased(); | 94 | void forwardReleased(); |
95 | void backReleased(); | 95 | void backReleased(); |
96 | void sliderMoved(long); | 96 | void sliderMoved(long); |
97 | 97 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 9d1d7fc..83456a0 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -18,20 +18,24 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | 20 | ||
21 | #include "mediawidget.h" | 21 | #include "mediawidget.h" |
22 | 22 | ||
23 | extern MediaPlayerState *mediaPlayerState; | 23 | extern MediaPlayerState *mediaPlayerState; |
24 | 24 | ||
25 | MediaWidget::MediaWidget( QWidget *parent, const char *name ) | 25 | MediaWidget::MediaWidget( QWidget *parent, const char *name ) |
26 | : QWidget( parent, name ) | 26 | : QWidget( parent, name ) |
27 | { | 27 | { |
28 | connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 28 | connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
29 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 29 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
30 | connect( mediaPlayerState, SIGNAL( lengthChanged( long ) ), | ||
31 | this, SLOT( setLength( long ) ) ); | ||
32 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | ||
33 | this, SLOT( setPlaying( bool ) ) ); | ||
30 | } | 34 | } |
31 | 35 | ||
32 | MediaWidget::~MediaWidget() | 36 | MediaWidget::~MediaWidget() |
33 | { | 37 | { |
34 | } | 38 | } |
35 | 39 | ||
36 | /* vim: et sw=4 ts=4 | 40 | /* vim: et sw=4 ts=4 |
37 | */ | 41 | */ |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index cbd08e2..fc5198e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -24,17 +24,19 @@ | |||
24 | 24 | ||
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | 26 | ||
27 | class MediaWidget : public QWidget | 27 | class MediaWidget : public QWidget |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MediaWidget( QWidget *parent = 0, const char *name = 0 ); | 31 | MediaWidget( QWidget *parent = 0, const char *name = 0 ); |
32 | virtual ~MediaWidget(); | 32 | virtual ~MediaWidget(); |
33 | 33 | ||
34 | public slots: | 34 | public slots: |
35 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 35 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
36 | virtual void setLength( long length ) = 0; | ||
37 | virtual void setPlaying( bool playing ) = 0; | ||
36 | }; | 38 | }; |
37 | 39 | ||
38 | #endif // MEDIAWIDGET_H | 40 | #endif // MEDIAWIDGET_H |
39 | /* vim: et sw=4 ts=4 | 41 | /* vim: et sw=4 ts=4 |
40 | */ | 42 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 8a0016e..888fcf4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -129,27 +129,24 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
129 | } | 129 | } |
130 | 130 | ||
131 | setBackgroundPixmap( *pixBg ); | 131 | setBackgroundPixmap( *pixBg ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | //slider->setFocusPolicy( QWidget::NoFocus ); | 137 | //slider->setFocusPolicy( QWidget::NoFocus ); |
138 | 138 | ||
139 | resizeEvent( NULL ); | 139 | resizeEvent( NULL ); |
140 | 140 | ||
141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | ||
142 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | ||
143 | |||
144 | setLength( mediaPlayerState->length() ); | 141 | setLength( mediaPlayerState->length() ); |
145 | setPosition( mediaPlayerState->position() ); | 142 | setPosition( mediaPlayerState->position() ); |
146 | setFullscreen( mediaPlayerState->isFullscreen() ); | 143 | setFullscreen( mediaPlayerState->isFullscreen() ); |
147 | setPlaying( mediaPlayerState->isPlaying() ); | 144 | setPlaying( mediaPlayerState->isPlaying() ); |
148 | } | 145 | } |
149 | 146 | ||
150 | 147 | ||
151 | VideoWidget::~VideoWidget() { | 148 | VideoWidget::~VideoWidget() { |
152 | 149 | ||
153 | for ( int i = 0; i < 7; i++ ) { | 150 | for ( int i = 0; i < 7; i++ ) { |
154 | delete buttonPixUp[i]; | 151 | delete buttonPixUp[i]; |
155 | delete buttonPixDown[i]; | 152 | delete buttonPixDown[i]; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 8e9dd7e..816ce2e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -56,31 +56,33 @@ enum VideoButtons { | |||
56 | class VideoWidget : public MediaWidget { | 56 | class VideoWidget : public MediaWidget { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | VideoWidget( QWidget* parent=0, const char* name=0 ); | 59 | VideoWidget( QWidget* parent=0, const char* name=0 ); |
60 | ~VideoWidget(); | 60 | ~VideoWidget(); |
61 | 61 | ||
62 | 62 | ||
63 | XineVideoWidget* vidWidget(); | 63 | XineVideoWidget* vidWidget(); |
64 | public slots: | 64 | public slots: |
65 | void updateSlider( long, long ); | 65 | void updateSlider( long, long ); |
66 | void sliderPressed( ); | 66 | void sliderPressed( ); |
67 | void sliderReleased( ); | 67 | void sliderReleased( ); |
68 | void setPlaying( bool b); | ||
69 | void setFullscreen( bool b ); | 68 | void setFullscreen( bool b ); |
70 | void makeVisible(); | 69 | void makeVisible(); |
71 | void backToNormal(); | 70 | void backToNormal(); |
72 | void setPosition( long ); | 71 | void setPosition( long ); |
73 | void setLength( long ); | 72 | |
74 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | 73 | public: |
74 | virtual void setPlaying( bool b); | ||
75 | virtual void setLength( long ); | ||
76 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | ||
75 | 77 | ||
76 | signals: | 78 | signals: |
77 | void moreClicked(); | 79 | void moreClicked(); |
78 | void lessClicked(); | 80 | void lessClicked(); |
79 | void moreReleased(); | 81 | void moreReleased(); |
80 | void lessReleased(); | 82 | void lessReleased(); |
81 | void sliderMoved( long ); | 83 | void sliderMoved( long ); |
82 | void videoResized ( const QSize &s ); | 84 | void videoResized ( const QSize &s ); |
83 | 85 | ||
84 | protected: | 86 | protected: |
85 | 87 | ||
86 | void resizeEvent( QResizeEvent * ); | 88 | void resizeEvent( QResizeEvent * ); |