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
@@ -90,56 +90,51 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
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() {
@@ -153,49 +148,49 @@ void AudioWidget::sliderReleased() {
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);
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
@@ -35,50 +35,49 @@
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 );
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
@@ -43,52 +43,52 @@ MediaWidget::~MediaWidget()
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;
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
@@ -59,74 +59,86 @@ public:
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 );
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
@@ -78,56 +78,51 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
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() {
@@ -146,49 +141,49 @@ void VideoWidget::sliderReleased() {
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 }
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
@@ -29,50 +29,49 @@
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