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
@@ -102,32 +102,27 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
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
@@ -165,25 +160,25 @@ void 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 );
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
@@ -47,26 +47,25 @@
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 ); }
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
@@ -55,28 +55,28 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount
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 * )
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
@@ -71,24 +71,36 @@ public:
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();
@@ -96,25 +108,25 @@ signals:
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 );
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
@@ -90,32 +90,27 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
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 );
@@ -158,25 +153,25 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
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}
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
@@ -41,26 +41,25 @@
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: