author | simon <simon> | 2002-12-02 19:46:48 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 19:46:48 (UTC) |
commit | e77f4914311d8a623c084d01a287798440abf01f (patch) (unidiff) | |
tree | 673375b737c4b1435929cdc804641b08d20e62c8 | |
parent | 1706751f05c1d4312beb1ca939a156b090c7b5f6 (diff) | |
download | opie-e77f4914311d8a623c084d01a287798440abf01f.zip opie-e77f4914311d8a623c084d01a287798440abf01f.tar.gz opie-e77f4914311d8a623c084d01a287798440abf01f.tar.bz2 |
- inherit from MediaWidget
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 6 |
4 files changed, 12 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 1600320..0b7d470 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -81,27 +81,27 @@ const char * const skin_mask_file_names[10] = { | |||
81 | 81 | ||
82 | 82 | ||
83 | static void changeTextColor( QWidget *w ) { | 83 | static void changeTextColor( QWidget *w ) { |
84 | QPalette p = w->palette(); | 84 | QPalette p = w->palette(); |
85 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 85 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
86 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 86 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
87 | w->setPalette( p ); | 87 | w->setPalette( p ); |
88 | } | 88 | } |
89 | 89 | ||
90 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 90 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
91 | 91 | ||
92 | 92 | ||
93 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 93 | AudioWidget::AudioWidget(QWidget* parent, const char* name) : |
94 | 94 | ||
95 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 95 | MediaWidget( parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
96 | 96 | ||
97 | setCaption( tr("OpiePlayer") ); | 97 | setCaption( tr("OpiePlayer") ); |
98 | 98 | ||
99 | Config cfg("OpiePlayer"); | 99 | Config cfg("OpiePlayer"); |
100 | cfg.setGroup("Options"); | 100 | cfg.setGroup("Options"); |
101 | skin = cfg.readEntry("Skin","default"); | 101 | skin = cfg.readEntry("Skin","default"); |
102 | //skin = "scaleTest"; | 102 | //skin = "scaleTest"; |
103 | // color of background, frame, degree of transparency | 103 | // color of background, frame, degree of transparency |
104 | 104 | ||
105 | QString skinPath = "opieplayer2/skins/" + skin; | 105 | QString skinPath = "opieplayer2/skins/" + skin; |
106 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 106 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
107 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 107 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
@@ -151,25 +151,24 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
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) ) ); | 162 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
163 | connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); | ||
164 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 163 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
165 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 164 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
166 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 165 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
167 | 166 | ||
168 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 167 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
169 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 168 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
170 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 169 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
171 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 170 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
172 | 171 | ||
173 | // Intialise state | 172 | // Intialise state |
174 | setLength( mediaPlayerState->length() ); | 173 | setLength( mediaPlayerState->length() ); |
175 | setPosition( mediaPlayerState->position() ); | 174 | setPosition( mediaPlayerState->position() ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 91fcbc5..74c5b0e 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -25,71 +25,72 @@ | |||
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef AUDIO_WIDGET_H | 34 | #ifndef AUDIO_WIDGET_H |
35 | #define AUDIO_WIDGET_H | 35 | #define AUDIO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | ||
38 | #include <qpainter.h> | 37 | #include <qpainter.h> |
39 | #include <qdrawutil.h> | 38 | #include <qdrawutil.h> |
40 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
41 | #include <qstring.h> | 40 | #include <qstring.h> |
42 | #include <qslider.h> | 41 | #include <qslider.h> |
43 | #include <qframe.h> | 42 | #include <qframe.h> |
44 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
45 | #include <qimage.h> | 44 | #include <qimage.h> |
46 | 45 | ||
47 | #include <opie/oticker.h> | 46 | #include <opie/oticker.h> |
48 | 47 | ||
49 | #include "mediaplayerstate.h" | 48 | #include "mediawidget.h" |
50 | 49 | ||
51 | class QPixmap; | 50 | class QPixmap; |
52 | 51 | ||
53 | namespace { | 52 | namespace { |
54 | 53 | ||
55 | enum AudioButtons { | 54 | enum AudioButtons { |
56 | AudioPlay=0, | 55 | AudioPlay=0, |
57 | AudioStop, | 56 | AudioStop, |
58 | AudioNext, | 57 | AudioNext, |
59 | AudioPrevious, | 58 | AudioPrevious, |
60 | AudioVolumeUp, | 59 | AudioVolumeUp, |
61 | AudioVolumeDown, | 60 | AudioVolumeDown, |
62 | AudioLoop, | 61 | AudioLoop, |
63 | AudioPlayList, | 62 | AudioPlayList, |
64 | AudioForward, | 63 | AudioForward, |
65 | AudioBack | 64 | AudioBack |
66 | }; | 65 | }; |
67 | }; | 66 | }; |
68 | 67 | ||
69 | class AudioWidget : public QWidget { | 68 | class AudioWidget : public MediaWidget { |
70 | Q_OBJECT | 69 | Q_OBJECT |
71 | public: | 70 | public: |
72 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 71 | AudioWidget( QWidget* parent=0, const char* name=0 ); |
73 | ~AudioWidget(); | 72 | ~AudioWidget(); |
74 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 73 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
75 | public slots: | 74 | public slots: |
76 | void updateSlider( long, long ); | 75 | void updateSlider( long, long ); |
77 | void sliderPressed( ); | 76 | void sliderPressed( ); |
78 | void sliderReleased( ); | 77 | void sliderReleased( ); |
79 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 78 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
80 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 79 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
81 | void setPosition( long ); | 80 | void setPosition( long ); |
82 | void setLength( long ); | 81 | void setLength( long ); |
83 | void setSeekable( bool ); | 82 | void setSeekable( bool ); |
83 | |||
84 | public: | ||
84 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | 85 | void setDisplayType( MediaPlayerState::DisplayType displayType ); |
85 | 86 | ||
86 | signals: | 87 | signals: |
87 | void moreClicked(); | 88 | void moreClicked(); |
88 | void lessClicked(); | 89 | void lessClicked(); |
89 | void moreReleased(); | 90 | void moreReleased(); |
90 | void lessReleased(); | 91 | void lessReleased(); |
91 | void forwardClicked(); | 92 | void forwardClicked(); |
92 | void backClicked(); | 93 | void backClicked(); |
93 | void forwardReleased(); | 94 | void forwardReleased(); |
94 | void backReleased(); | 95 | void backReleased(); |
95 | void sliderMoved(long); | 96 | void sliderMoved(long); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 9ce2b57..8a0016e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -74,26 +74,26 @@ MediaButton videoButtons[] = { | |||
74 | { FALSE, FALSE, FALSE }, // volUp | 74 | { FALSE, FALSE, FALSE }, // volUp |
75 | { FALSE, FALSE, FALSE }, // volDown | 75 | { FALSE, FALSE, FALSE }, // volDown |
76 | { TRUE, FALSE, FALSE } // fullscreen | 76 | { TRUE, FALSE, FALSE } // fullscreen |
77 | }; | 77 | }; |
78 | 78 | ||
79 | const char *skinV_mask_file_names[7] = { | 79 | const char *skinV_mask_file_names[7] = { |
80 | "stop","play","back","fwd","up","down","full" | 80 | "stop","play","back","fwd","up","down","full" |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
84 | 84 | ||
85 | 85 | ||
86 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 86 | VideoWidget::VideoWidget(QWidget* parent, const char* name) : |
87 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 87 | MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { |
88 | 88 | ||
89 | 89 | ||
90 | setCaption( tr("OpiePlayer - Video") ); | 90 | setCaption( tr("OpiePlayer - Video") ); |
91 | 91 | ||
92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
93 | 93 | ||
94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
96 | 96 | ||
97 | Config cfg("OpiePlayer"); | 97 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 98 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 99 | skin = cfg.readEntry("Skin","default"); |
@@ -130,25 +130,24 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
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) ) ); | 141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
142 | connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); | ||
143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 142 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
144 | 143 | ||
145 | setLength( mediaPlayerState->length() ); | 144 | setLength( mediaPlayerState->length() ); |
146 | setPosition( mediaPlayerState->position() ); | 145 | setPosition( mediaPlayerState->position() ); |
147 | setFullscreen( mediaPlayerState->isFullscreen() ); | 146 | setFullscreen( mediaPlayerState->isFullscreen() ); |
148 | setPlaying( mediaPlayerState->isPlaying() ); | 147 | setPlaying( mediaPlayerState->isPlaying() ); |
149 | } | 148 | } |
150 | 149 | ||
151 | 150 | ||
152 | VideoWidget::~VideoWidget() { | 151 | VideoWidget::~VideoWidget() { |
153 | 152 | ||
154 | for ( int i = 0; i < 7; i++ ) { | 153 | for ( int i = 0; i < 7; i++ ) { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 89af646..8e9dd7e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -28,44 +28,44 @@ | |||
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include "xinevideowidget.h" | 38 | #include "xinevideowidget.h" |
39 | 39 | ||
40 | #include "mediaplayerstate.h" | 40 | #include "mediawidget.h" |
41 | 41 | ||
42 | class QPixmap; | 42 | class QPixmap; |
43 | class QSlider; | 43 | class QSlider; |
44 | 44 | ||
45 | enum VideoButtons { | 45 | enum VideoButtons { |
46 | VideoStop = 0, | 46 | VideoStop = 0, |
47 | VideoPlay, | 47 | VideoPlay, |
48 | // VideoPause, | 48 | // VideoPause, |
49 | VideoPrevious, | 49 | VideoPrevious, |
50 | VideoNext, | 50 | VideoNext, |
51 | VideoVolUp, | 51 | VideoVolUp, |
52 | VideoVolDown, | 52 | VideoVolDown, |
53 | VideoFullscreen | 53 | VideoFullscreen |
54 | }; | 54 | }; |
55 | 55 | ||
56 | class VideoWidget : public QWidget { | 56 | class VideoWidget : public MediaWidget { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=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); | 68 | void setPlaying( bool b); |
69 | void setFullscreen( bool b ); | 69 | void setFullscreen( bool b ); |
70 | void makeVisible(); | 70 | void makeVisible(); |
71 | void backToNormal(); | 71 | void backToNormal(); |