summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 17:34:19 (UTC)
committer simon <simon>2002-12-11 17:34:19 (UTC)
commitaaac5c934e7053fa4323b03f7ea31c32c6388883 (patch) (unidiff)
treead9eb3da0efebbb862cbd8063978186c5b9d8190
parent75f0ed4978579eb4b27cdece64c597741ed24b79 (diff)
downloadopie-aaac5c934e7053fa4323b03f7ea31c32c6388883.zip
opie-aaac5c934e7053fa4323b03f7ea31c32c6388883.tar.gz
opie-aaac5c934e7053fa4323b03f7ea31c32c6388883.tar.bz2
- collect arguments passed to the skin loading into a structure
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h14
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h3
6 files changed, 24 insertions, 24 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 4db444a..cd5bea4 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -66,160 +66,155 @@ const MediaWidget::SkinButtonInfo skinInfo[] =
66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
70 { MediaWidget::Back, "back", MediaWidget::NormalButton } 70 { MediaWidget::Back, "back", MediaWidget::NormalButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75void changeTextColor( QWidget * w) { 75void changeTextColor( QWidget * w) {
76 QPalette p = w->palette(); 76 QPalette p = w->palette();
77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
79 w->setPalette( p ); 79 w->setPalette( p );
80} 80}
81 81
82} 82}
83 83
84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
85 85
86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
87 audioSliderBeingMoved( false ) 87 audioSliderBeingMoved( false )
88{ 88{
89 setCaption( tr("OpiePlayer") ); 89 setCaption( tr("OpiePlayer") );
90 90
91 loadSkin(); 91 loadSkin();
92 92
93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
95 95
96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
100 100
101 // Intialise state 101 // Intialise state
102 setLength( mediaPlayerState.length() ); 102 setLength( mediaPlayerState.length() );
103 setPosition( mediaPlayerState.position() ); 103 setPosition( mediaPlayerState.position() );
104 setLooping( mediaPlayerState.isFullscreen() ); 104 setLooping( mediaPlayerState.isFullscreen() );
105 // setPaused( mediaPlayerState->paused() ); 105 // setPaused( mediaPlayerState->paused() );
106 setPlaying( mediaPlayerState.isPlaying() ); 106 setPlaying( mediaPlayerState.isPlaying() );
107} 107}
108 108
109AudioWidget::~AudioWidget() { 109AudioWidget::~AudioWidget() {
110 110
111// mediaPlayerState->setPlaying(false); 111// mediaPlayerState->setPlaying(false);
112} 112}
113 113
114const MediaWidget::SkinButtonInfo *AudioWidget::skinInfo() 114MediaWidget::GUIInfo AudioWidget::guiInfo()
115{ 115{
116 return ::skinInfo; 116 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount );
117}
118
119const uint AudioWidget::buttonCount()
120{
121 return ::buttonCount;
122} 117}
123 118
124void AudioWidget::resizeEvent( QResizeEvent *e ) { 119void AudioWidget::resizeEvent( QResizeEvent *e ) {
125 int h = height(); 120 int h = height();
126 int w = width(); 121 int w = width();
127 122
128 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 123 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
129 slider.setFixedWidth( w - 110 ); 124 slider.setFixedWidth( w - 110 );
130 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 125 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
131 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 126 slider.setBackgroundOrigin( QWidget::ParentOrigin );
132 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 127 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
133 128
134 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 129 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
135 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 130 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
136 131
137 MediaWidget::resizeEvent( e ); 132 MediaWidget::resizeEvent( e );
138} 133}
139 134
140void AudioWidget::sliderPressed() { 135void AudioWidget::sliderPressed() {
141 audioSliderBeingMoved = TRUE; 136 audioSliderBeingMoved = TRUE;
142} 137}
143 138
144 139
145void AudioWidget::sliderReleased() { 140void AudioWidget::sliderReleased() {
146 audioSliderBeingMoved = FALSE; 141 audioSliderBeingMoved = FALSE;
147 if ( slider.width() == 0 ) 142 if ( slider.width() == 0 )
148 return; 143 return;
149 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 144 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
150 mediaPlayerState.setPosition( val ); 145 mediaPlayerState.setPosition( val );
151} 146}
152 147
153void AudioWidget::setPosition( long i ) { 148void AudioWidget::setPosition( long i ) {
154 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 149 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
155 updateSlider( i, mediaPlayerState.length() ); 150 updateSlider( i, mediaPlayerState.length() );
156} 151}
157 152
158 153
159void AudioWidget::setLength( long max ) { 154void AudioWidget::setLength( long max ) {
160 updateSlider( mediaPlayerState.position(), max ); 155 updateSlider( mediaPlayerState.position(), max );
161} 156}
162 157
163 158
164void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 159void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
165 if ( mediaType == MediaPlayerState::Audio ) { 160 if ( mediaType == MediaPlayerState::Audio ) {
166 // startTimer( 150 ); 161 // startTimer( 150 );
167 showMaximized(); 162 showMaximized();
168 return; 163 return;
169 } 164 }
170 165
171 killTimers(); 166 killTimers();
172 hide(); 167 hide();
173} 168}
174 169
175void AudioWidget::loadSkin() 170void AudioWidget::loadSkin()
176{ 171{
177 loadDefaultSkin( ::skinInfo, ::buttonCount ); 172 loadDefaultSkin( guiInfo() );
178 173
179 setBackgroundPixmap( backgroundPixmap ); 174 setBackgroundPixmap( backgroundPixmap );
180 175
181 songInfo.setFocusPolicy( QWidget::NoFocus ); 176 songInfo.setFocusPolicy( QWidget::NoFocus );
182// changeTextColor( &songInfo ); 177// changeTextColor( &songInfo );
183// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 178// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
184// songInfo.setFrameStyle( QFrame::NoFrame); 179// songInfo.setFrameStyle( QFrame::NoFrame);
185 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 180 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
186// songInfo.setForegroundColor(Qt::white); 181// songInfo.setForegroundColor(Qt::white);
187 182
188 slider.setFixedHeight( 20 ); 183 slider.setFixedHeight( 20 );
189 slider.setMinValue( 0 ); 184 slider.setMinValue( 0 );
190 slider.setMaxValue( 1 ); 185 slider.setMaxValue( 1 );
191 slider.setFocusPolicy( QWidget::NoFocus ); 186 slider.setFocusPolicy( QWidget::NoFocus );
192 slider.setBackgroundPixmap( backgroundPixmap ); 187 slider.setBackgroundPixmap( backgroundPixmap );
193 188
194// Config cofg("qpe"); 189// Config cofg("qpe");
195// cofg.setGroup("Appearance"); 190// cofg.setGroup("Appearance");
196// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 191// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
197 192
198 time.setFocusPolicy( QWidget::NoFocus ); 193 time.setFocusPolicy( QWidget::NoFocus );
199 time.setAlignment( Qt::AlignCenter ); 194 time.setAlignment( Qt::AlignCenter );
200 195
201// time.setFrame(FALSE); 196// time.setFrame(FALSE);
202// changeTextColor( &time ); 197// changeTextColor( &time );
203 198
204 resizeEvent( 0 ); 199 resizeEvent( 0 );
205} 200}
206 201
207void AudioWidget::setSeekable( bool isSeekable ) { 202void AudioWidget::setSeekable( bool isSeekable ) {
208 203
209 if ( !isSeekable ) { 204 if ( !isSeekable ) {
210 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 205 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
211 if( !slider.isHidden()) { 206 if( !slider.isHidden()) {
212 slider.hide(); 207 slider.hide();
213 } 208 }
214 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 209 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
215 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 210 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
216 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 211 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
217 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 212 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
218 } else { 213 } else {
219 // this stops the slider from being moved, thus 214 // this stops the slider from being moved, thus
220 // does not stop stream when it reaches the end 215 // does not stop stream when it reaches the end
221 slider.show(); 216 slider.show();
222 qDebug( " CONNECT SET POSTION " ); 217 qDebug( " CONNECT SET POSTION " );
223 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 218 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
224 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 219 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
225 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 220 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 75d4857..53dbb88 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -11,93 +11,92 @@
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
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 <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 56 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 57 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58 58
59 static const MediaWidget::SkinButtonInfo *skinInfo(); 59 static MediaWidget::GUIInfo guiInfo();
60 static const uint buttonCount();
61 60
62public slots: 61public slots:
63 void updateSlider( long, long ); 62 void updateSlider( long, long );
64 void sliderPressed( ); 63 void sliderPressed( );
65 void sliderReleased( ); 64 void sliderReleased( );
66 void setLooping( bool b) { setToggleButton( Loop, b ); } 65 void setLooping( bool b) { setToggleButton( Loop, b ); }
67 void setPosition( long ); 66 void setPosition( long );
68 void setSeekable( bool ); 67 void setSeekable( bool );
69 68
70public: 69public:
71 virtual void setLength( long ); 70 virtual void setLength( long );
72 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 71 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
73 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 72 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
74 73
75 virtual void loadSkin(); 74 virtual void loadSkin();
76 75
77signals: 76signals:
78 void sliderMoved(long); 77 void sliderMoved(long);
79 78
80protected: 79protected:
81 void doBlank(); 80 void doBlank();
82 void doUnblank(); 81 void doUnblank();
83 void resizeEvent( QResizeEvent *re ); 82 void resizeEvent( QResizeEvent *re );
84 void timerEvent( QTimerEvent *event ); 83 void timerEvent( QTimerEvent *event );
85 void keyReleaseEvent( QKeyEvent *e); 84 void keyReleaseEvent( QKeyEvent *e);
86private slots: 85private slots:
87 void skipFor(); 86 void skipFor();
88 void skipBack(); 87 void skipBack();
89 void stopSkip(); 88 void stopSkip();
90private: 89private:
91 int skipDirection; 90 int skipDirection;
92 QString skin; 91 QString skin;
93 92
94 OTicker songInfo; 93 OTicker songInfo;
95 QSlider slider; 94 QSlider slider;
96 QLineEdit time; 95 QLineEdit time;
97 bool isStreaming : 1; 96 bool isStreaming : 1;
98 bool audioSliderBeingMoved : 1; 97 bool audioSliderBeingMoved : 1;
99}; 98};
100 99
101 100
102#endif // AUDIO_WIDGET_H 101#endif // AUDIO_WIDGET_H
103 102
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index ab2ec50..c0106d4 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -19,100 +19,100 @@
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23 23
24#include "mediawidget.h" 24#include "mediawidget.h"
25#include "playlistwidget.h" 25#include "playlistwidget.h"
26#include "skin.h" 26#include "skin.h"
27 27
28MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 28MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
29 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 29 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
30{ 30{
31 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 31 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
32 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 32 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
33 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 33 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
34 this, SLOT( setLength( long ) ) ); 34 this, SLOT( setLength( long ) ) );
35 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 35 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
36 this, SLOT( setPlaying( bool ) ) ); 36 this, SLOT( setPlaying( bool ) ) );
37} 37}
38 38
39MediaWidget::~MediaWidget() 39MediaWidget::~MediaWidget()
40{ 40{
41} 41}
42 42
43void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 43void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
44 const Skin &skin ) 44 const Skin &skin )
45{ 45{
46 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 46 buttonMask = skin.buttonMask( skinInfo, buttonCount );
47 47
48 buttons.clear(); 48 buttons.clear();
49 buttons.reserve( buttonCount ); 49 buttons.reserve( buttonCount );
50 50
51 for ( uint i = 0; i < buttonCount; ++i ) { 51 for ( uint i = 0; i < buttonCount; ++i ) {
52 Button button = setupButton( skinInfo[ i ], skin ); 52 Button button = setupButton( skinInfo[ i ], skin );
53 buttons.push_back( button ); 53 buttons.push_back( button );
54 } 54 }
55} 55}
56 56
57MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 57MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
58{ 58{
59 Button button; 59 Button button;
60 button.command = buttonInfo.command; 60 button.command = buttonInfo.command;
61 button.type = buttonInfo.type; 61 button.type = buttonInfo.type;
62 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 62 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
63 63
64 return button; 64 return button;
65} 65}
66 66
67void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) 67void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
68{ 68{
69 Skin skin( fileNameInfix ); 69 Skin skin( guiInfo.fileNameInfix );
70 loadSkin( skinInfo, buttonCount, skin ); 70 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
71} 71}
72 72
73void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 73void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
74{ 74{
75 backgroundPixmap = skin.backgroundImage(); 75 backgroundPixmap = skin.backgroundImage();
76 buttonUpImage = skin.buttonUpImage(); 76 buttonUpImage = skin.buttonUpImage();
77 buttonDownImage = skin.buttonDownImage(); 77 buttonDownImage = skin.buttonDownImage();
78 78
79 setupButtons( skinInfo, buttonCount, skin ); 79 setupButtons( skinInfo, buttonCount, skin );
80} 80}
81 81
82void MediaWidget::closeEvent( QCloseEvent * ) 82void MediaWidget::closeEvent( QCloseEvent * )
83{ 83{
84 mediaPlayerState.setList(); 84 mediaPlayerState.setList();
85} 85}
86 86
87void MediaWidget::paintEvent( QPaintEvent *pe ) 87void MediaWidget::paintEvent( QPaintEvent *pe )
88{ 88{
89 QPainter p( this ); 89 QPainter p( this );
90 90
91 if ( mediaPlayerState.isFullscreen() ) { 91 if ( mediaPlayerState.isFullscreen() ) {
92 // Clear the background 92 // Clear the background
93 p.setBrush( QBrush( Qt::black ) ); 93 p.setBrush( QBrush( Qt::black ) );
94 return; 94 return;
95 } 95 }
96 96
97 if ( !pe->erased() ) { 97 if ( !pe->erased() ) {
98 // Combine with background and double buffer 98 // Combine with background and double buffer
99 QPixmap pix( pe->rect().size() ); 99 QPixmap pix( pe->rect().size() );
100 QPainter p( &pix ); 100 QPainter p( &pix );
101 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 101 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
102 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); 102 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() );
103 paintAllButtons( p ); 103 paintAllButtons( p );
104 QPainter p2( this ); 104 QPainter p2( this );
105 p2.drawPixmap( pe->rect().topLeft(), pix ); 105 p2.drawPixmap( pe->rect().topLeft(), pix );
106 } else { 106 } else {
107 QPainter p( this ); 107 QPainter p( this );
108 paintAllButtons( p ); 108 paintAllButtons( p );
109 } 109 }
110} 110}
111 111
112void MediaWidget::resizeEvent( QResizeEvent *e ) 112void MediaWidget::resizeEvent( QResizeEvent *e )
113{ 113{
114 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); 114 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask );
115 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); 115 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask );
116 116
117 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 117 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
118 Button &button = *it; 118 Button &button = *it;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 4599637..64483d8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -35,121 +35,133 @@
35namespace 35namespace
36{ 36{
37 struct simpleAndStupidAllocator 37 struct simpleAndStupidAllocator
38 { 38 {
39 static void *allocate( size_t amount ) 39 static void *allocate( size_t amount )
40 { return ::operator new( amount ); } 40 { return ::operator new( amount ); }
41 static void deallocate( void *p, size_t ) 41 static void deallocate( void *p, size_t )
42 { ::operator delete( p ); } 42 { ::operator delete( p ); }
43 }; 43 };
44} 44}
45 45
46class Skin; 46class Skin;
47 47
48class MediaWidget : public QWidget 48class MediaWidget : public QWidget
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51public: 51public:
52 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; 52 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
53 enum ButtonType { NormalButton, ToggleButton }; 53 enum ButtonType { NormalButton, ToggleButton };
54 54
55 struct Button 55 struct Button
56 { 56 {
57 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} 57 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {}
58 58
59 Command command; 59 Command command;
60 60
61 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( 61 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
62 bool isDown : 1; 62 bool isDown : 1;
63 63
64 QBitmap mask; 64 QBitmap mask;
65 QPixmap pixUp; 65 QPixmap pixUp;
66 QPixmap pixDown; 66 QPixmap pixDown;
67 }; 67 };
68#if defined( _CC_GNU_ ) 68#if defined( _CC_GNU_ )
69 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because 69 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because
70 // in the BAD_ALLOC macro it uses std::cerr and friends :-( 70 // in the BAD_ALLOC macro it uses std::cerr and friends :-(
71 typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector; 71 typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector;
72#else 72#else
73 typedef std::vector<Button> ButtonVector; 73 typedef std::vector<Button> ButtonVector;
74#endif 74#endif
75 75
76 struct SkinButtonInfo 76 struct SkinButtonInfo
77 { 77 {
78 Command command; 78 Command command;
79 const char *fileName; 79 const char *fileName;
80 ButtonType type; 80 ButtonType type;
81 }; 81 };
82 82
83 struct GUIInfo
84 {
85 GUIInfo() : buttonInfo( 0 ), buttonCount( 0 ) {}
86 GUIInfo( const QString &_fileNameInfix, const SkinButtonInfo *_buttonInfo, const uint _buttonCount )
87 : fileNameInfix( _fileNameInfix ), buttonInfo( _buttonInfo ), buttonCount( _buttonCount )
88 {}
89
90 QString fileNameInfix;
91 const SkinButtonInfo *buttonInfo;
92 const uint buttonCount;
93 };
94
83 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 95 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
84 virtual ~MediaWidget(); 96 virtual ~MediaWidget();
85 97
86public slots: 98public slots:
87 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 99 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
88 virtual void setLength( long length ) = 0; 100 virtual void setLength( long length ) = 0;
89 virtual void setPlaying( bool playing ) = 0; 101 virtual void setPlaying( bool playing ) = 0;
90 102
91 virtual void loadSkin() = 0; 103 virtual void loadSkin() = 0;
92 104
93signals: 105signals:
94 void moreReleased(); 106 void moreReleased();
95 void lessReleased(); 107 void lessReleased();
96 void forwardReleased(); 108 void forwardReleased();
97 void backReleased(); 109 void backReleased();
98 void forwardClicked(); 110 void forwardClicked();
99 void backClicked(); 111 void backClicked();
100 void moreClicked(); 112 void moreClicked();
101 void lessClicked(); 113 void lessClicked();
102 114
103protected: 115protected:
104 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 116 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
105 const Skin &skin ); 117 const Skin &skin );
106 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); 118 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin );
107 119
108 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); 120 void loadDefaultSkin( const GUIInfo &guiInfo );
109 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ); 121 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin );
110 122
111 virtual void closeEvent( QCloseEvent * ); 123 virtual void closeEvent( QCloseEvent * );
112 124
113 virtual void paintEvent( QPaintEvent *pe ); 125 virtual void paintEvent( QPaintEvent *pe );
114 126
115 virtual void resizeEvent( QResizeEvent *e ); 127 virtual void resizeEvent( QResizeEvent *e );
116 128
117 Button *buttonAt( const QPoint &position ); 129 Button *buttonAt( const QPoint &position );
118 130
119 virtual void mousePressEvent( QMouseEvent *event ); 131 virtual void mousePressEvent( QMouseEvent *event );
120 virtual void mouseReleaseEvent( QMouseEvent *event ); 132 virtual void mouseReleaseEvent( QMouseEvent *event );
121 133
122 virtual void makeVisible(); 134 virtual void makeVisible();
123 135
124 void handleCommand( Command command, bool buttonDown ); 136 void handleCommand( Command command, bool buttonDown );
125 137
126 bool isOverButton( const QPoint &position, int buttonId ) const; 138 bool isOverButton( const QPoint &position, int buttonId ) const;
127 139
128 void paintAllButtons( QPainter &p ); 140 void paintAllButtons( QPainter &p );
129 void paintButton( const Button &button ); 141 void paintButton( const Button &button );
130 void paintButton( QPainter &p, const Button &button ); 142 void paintButton( QPainter &p, const Button &button );
131 143
132 void setToggleButton( Button &button, bool down ); 144 void setToggleButton( Button &button, bool down );
133 void setToggleButton( Command command, bool down ); 145 void setToggleButton( Command command, bool down );
134 void toggleButton( Button &button ); 146 void toggleButton( Button &button );
135 147
136 MediaPlayerState &mediaPlayerState; 148 MediaPlayerState &mediaPlayerState;
137 PlayListWidget &playList; 149 PlayListWidget &playList;
138 150
139 ButtonVector buttons; 151 ButtonVector buttons;
140 152
141 QImage buttonMask; 153 QImage buttonMask;
142 154
143 QPoint upperLeftOfButtonMask; 155 QPoint upperLeftOfButtonMask;
144 156
145 QPixmap backgroundPixmap; 157 QPixmap backgroundPixmap;
146 QImage buttonUpImage; 158 QImage buttonUpImage;
147 QImage buttonDownImage; 159 QImage buttonDownImage;
148 160
149 static QPixmap combineImageWithBackground( const QImage &background, const QPixmap &pixmap, const QPoint &offset ); 161 static QPixmap combineImageWithBackground( const QImage &background, const QPixmap &pixmap, const QPoint &offset );
150 static QPixmap addMaskToPixmap( const QPixmap &pix, const QBitmap &mask ); 162 static QPixmap addMaskToPixmap( const QPixmap &pix, const QBitmap &mask );
151}; 163};
152 164
153#endif // MEDIAWIDGET_H 165#endif // MEDIAWIDGET_H
154/* vim: et sw=4 ts=4 166/* vim: et sw=4 ts=4
155 */ 167 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 058730f..2a345e3 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -54,165 +54,160 @@
54 54
55 55
56namespace 56namespace
57{ 57{
58 58
59const int xo = 2; // movable x offset 59const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 60const int yo = 0; // movable y offset
61 61
62const MediaWidget::SkinButtonInfo skinInfo[] = 62const MediaWidget::SkinButtonInfo skinInfo[] =
63{ 63{
64 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 64 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
67 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 67 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75} 75}
76 76
77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
79{ 79{
80 setCaption( tr("OpiePlayer - Video") ); 80 setCaption( tr("OpiePlayer - Video") );
81 81
82 videoFrame = new XineVideoWidget ( this, "Video frame" ); 82 videoFrame = new XineVideoWidget ( this, "Video frame" );
83 83
84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
86 86
87 slider = 0; 87 slider = 0;
88 88
89 loadSkin(); 89 loadSkin();
90 90
91 setLength( mediaPlayerState.length() ); 91 setLength( mediaPlayerState.length() );
92 setPosition( mediaPlayerState.position() ); 92 setPosition( mediaPlayerState.position() );
93 setFullscreen( mediaPlayerState.isFullscreen() ); 93 setFullscreen( mediaPlayerState.isFullscreen() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97 97
98VideoWidget::~VideoWidget() 98VideoWidget::~VideoWidget()
99{ 99{
100} 100}
101 101
102const MediaWidget::SkinButtonInfo *VideoWidget::skinInfo() 102MediaWidget::GUIInfo VideoWidget::guiInfo()
103{ 103{
104 return ::skinInfo; 104 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount );
105}
106
107const uint VideoWidget::buttonCount()
108{
109 return ::buttonCount;
110} 105}
111 106
112void VideoWidget::resizeEvent( QResizeEvent *e ) { 107void VideoWidget::resizeEvent( QResizeEvent *e ) {
113 int h = height(); 108 int h = height();
114 int w = width(); 109 int w = width();
115 //int Vh = 160; 110 //int Vh = 160;
116 //int Vw = 220; 111 //int Vw = 220;
117 112
118 slider->setFixedWidth( w - 20 ); 113 slider->setFixedWidth( w - 20 );
119 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 114 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
120 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 115 slider->setBackgroundOrigin( QWidget::ParentOrigin );
121 slider->setFocusPolicy( QWidget::NoFocus ); 116 slider->setFocusPolicy( QWidget::NoFocus );
122 slider->setBackgroundPixmap( backgroundPixmap ); 117 slider->setBackgroundPixmap( backgroundPixmap );
123 118
124 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 119 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
125 if(w>h) 120 if(w>h)
126 upperLeftOfButtonMask.ry() = 0; 121 upperLeftOfButtonMask.ry() = 0;
127 else 122 else
128 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 123 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
129 124
130 MediaWidget::resizeEvent( e ); 125 MediaWidget::resizeEvent( e );
131} 126}
132 127
133void VideoWidget::sliderPressed() { 128void VideoWidget::sliderPressed() {
134 videoSliderBeingMoved = TRUE; 129 videoSliderBeingMoved = TRUE;
135} 130}
136 131
137void VideoWidget::sliderReleased() { 132void VideoWidget::sliderReleased() {
138 videoSliderBeingMoved = FALSE; 133 videoSliderBeingMoved = FALSE;
139 if ( slider->width() == 0 ) { 134 if ( slider->width() == 0 ) {
140 return; 135 return;
141 } 136 }
142 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 137 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
143 mediaPlayerState.setPosition( val ); 138 mediaPlayerState.setPosition( val );
144} 139}
145 140
146void VideoWidget::setPosition( long i ) { 141void VideoWidget::setPosition( long i ) {
147 updateSlider( i, mediaPlayerState.length() ); 142 updateSlider( i, mediaPlayerState.length() );
148} 143}
149 144
150 145
151void VideoWidget::setLength( long max ) { 146void VideoWidget::setLength( long max ) {
152 updateSlider( mediaPlayerState.position(), max ); 147 updateSlider( mediaPlayerState.position(), max );
153} 148}
154 149
155void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 150void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
156{ 151{
157 if ( displayType == MediaPlayerState::Video ) { 152 if ( displayType == MediaPlayerState::Video ) {
158 makeVisible(); 153 makeVisible();
159 return; 154 return;
160 } 155 }
161 156
162 // Effectively blank the view next time we show it so it looks nicer 157 // Effectively blank the view next time we show it so it looks nicer
163 scaledWidth = 0; 158 scaledWidth = 0;
164 scaledHeight = 0; 159 scaledHeight = 0;
165 hide(); 160 hide();
166} 161}
167 162
168void VideoWidget::loadSkin() 163void VideoWidget::loadSkin()
169{ 164{
170 loadDefaultSkin( ::skinInfo, ::buttonCount, "V" ); 165 loadDefaultSkin( guiInfo() );
171 166
172 setBackgroundPixmap( backgroundPixmap ); 167 setBackgroundPixmap( backgroundPixmap );
173 168
174 delete slider; 169 delete slider;
175 slider = new QSlider( Qt::Horizontal, this ); 170 slider = new QSlider( Qt::Horizontal, this );
176 slider->setMinValue( 0 ); 171 slider->setMinValue( 0 );
177 slider->setMaxValue( 1 ); 172 slider->setMaxValue( 1 );
178 slider->setBackgroundPixmap( backgroundPixmap ); 173 slider->setBackgroundPixmap( backgroundPixmap );
179 //slider->setFocusPolicy( QWidget::NoFocus ); 174 //slider->setFocusPolicy( QWidget::NoFocus );
180 175
181 resizeEvent( 0 ); 176 resizeEvent( 0 );
182} 177}
183 178
184void VideoWidget::updateSlider( long i, long max ) { 179void VideoWidget::updateSlider( long i, long max ) {
185 // Will flicker too much if we don't do this 180 // Will flicker too much if we don't do this
186 if ( max == 0 ) { 181 if ( max == 0 ) {
187 return; 182 return;
188 } 183 }
189 int width = slider->width(); 184 int width = slider->width();
190 int val = int((double)i * width / max); 185 int val = int((double)i * width / max);
191 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 186 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
192 if ( slider->value() != val ) { 187 if ( slider->value() != val ) {
193 slider->setValue( val ); 188 slider->setValue( val );
194 } 189 }
195 if ( slider->maxValue() != width ) { 190 if ( slider->maxValue() != width ) {
196 slider->setMaxValue( width ); 191 slider->setMaxValue( width );
197 } 192 }
198 } 193 }
199} 194}
200 195
201void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 196void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
202 if ( mediaPlayerState.isFullscreen() ) { 197 if ( mediaPlayerState.isFullscreen() ) {
203 mediaPlayerState.setFullscreen( FALSE ); 198 mediaPlayerState.setFullscreen( FALSE );
204 makeVisible(); 199 makeVisible();
205 } 200 }
206 MediaWidget::mouseReleaseEvent( event ); 201 MediaWidget::mouseReleaseEvent( event );
207} 202}
208 203
209void VideoWidget::backToNormal() { 204void VideoWidget::backToNormal() {
210 mediaPlayerState.setFullscreen( FALSE ); 205 mediaPlayerState.setFullscreen( FALSE );
211 makeVisible(); 206 makeVisible();
212} 207}
213 208
214void VideoWidget::makeVisible() { 209void VideoWidget::makeVisible() {
215 if ( mediaPlayerState.isFullscreen() ) { 210 if ( mediaPlayerState.isFullscreen() ) {
216 setBackgroundMode( QWidget::NoBackground ); 211 setBackgroundMode( QWidget::NoBackground );
217 showFullScreen(); 212 showFullScreen();
218 resize( qApp->desktop()->size() ); 213 resize( qApp->desktop()->size() );
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 80e9356..84bc964 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -5,96 +5,95 @@
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
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 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 <qimage.h> 38#include <qimage.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include "xinevideowidget.h" 40#include "xinevideowidget.h"
41 41
42#include "mediawidget.h" 42#include "mediawidget.h"
43 43
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47class VideoWidget : public MediaWidget { 47class VideoWidget : public MediaWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
51 ~VideoWidget(); 51 ~VideoWidget();
52 52
53 static const MediaWidget::SkinButtonInfo *skinInfo(); 53 static MediaWidget::GUIInfo guiInfo();
54 static const uint buttonCount();
55 54
56 XineVideoWidget* vidWidget(); 55 XineVideoWidget* vidWidget();
57public slots: 56public slots:
58 void updateSlider( long, long ); 57 void updateSlider( long, long );
59 void sliderPressed( ); 58 void sliderPressed( );
60 void sliderReleased( ); 59 void sliderReleased( );
61 void setFullscreen( bool b ); 60 void setFullscreen( bool b );
62 virtual void makeVisible(); 61 virtual void makeVisible();
63 void backToNormal(); 62 void backToNormal();
64 void setPosition( long ); 63 void setPosition( long );
65 64
66public: 65public:
67 virtual void setPlaying( bool b); 66 virtual void setPlaying( bool b);
68 virtual void setLength( long ); 67 virtual void setLength( long );
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 68 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 69
71 virtual void loadSkin(); 70 virtual void loadSkin();
72 71
73signals: 72signals:
74 void moreClicked(); 73 void moreClicked();
75 void lessClicked(); 74 void lessClicked();
76 void sliderMoved( long ); 75 void sliderMoved( long );
77 void videoResized ( const QSize &s ); 76 void videoResized ( const QSize &s );
78 77
79protected: 78protected:
80 79
81 void resizeEvent( QResizeEvent * ); 80 void resizeEvent( QResizeEvent * );
82 void mouseReleaseEvent( QMouseEvent *event ); 81 void mouseReleaseEvent( QMouseEvent *event );
83 void keyReleaseEvent( QKeyEvent *e); 82 void keyReleaseEvent( QKeyEvent *e);
84 83
85private: 84private:
86// Ticker songInfo; 85// Ticker songInfo;
87 86
88 QSlider *slider; 87 QSlider *slider;
89 QImage *currentFrame; 88 QImage *currentFrame;
90 int scaledWidth; 89 int scaledWidth;
91 int scaledHeight; 90 int scaledHeight;
92 XineVideoWidget* videoFrame; 91 XineVideoWidget* videoFrame;
93 92
94 bool videoSliderBeingMoved; 93 bool videoSliderBeingMoved;
95}; 94};
96 95
97#endif // VIDEO_WIDGET_H 96#endif // VIDEO_WIDGET_H
98 97
99 98
100 99