author | simon <simon> | 2002-12-09 21:43:32 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 21:43:32 (UTC) |
commit | 40ff6884f079a55fcf219b2d032c7be4da385bc1 (patch) (unidiff) | |
tree | fd13c702652ee0f22201eb6145b10e67f9580aeb | |
parent | a9015ff25ddec67983f78f2a75346f21b7d062c5 (diff) | |
download | opie-40ff6884f079a55fcf219b2d032c7be4da385bc1.zip opie-40ff6884f079a55fcf219b2d032c7be4da385bc1.tar.gz opie-40ff6884f079a55fcf219b2d032c7be4da385bc1.tar.bz2 |
- hah, the improved design pays off :) switching skins at run-time now
only reloads the pixmaps and no more requires a restart or re-creation
of the audio/video widgets and the xine control (which involved slow
xine initialization)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 83 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 47 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
9 files changed, 87 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index fd18dbb..0516089 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -90,41 +90,3 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
90 | 90 | ||
91 | Config cfg("OpiePlayer"); | 91 | loadSkin(); |
92 | cfg.setGroup("Options"); | ||
93 | skin = cfg.readEntry("Skin","default"); | ||
94 | //skin = "scaleTest"; | ||
95 | // color of background, frame, degree of transparency | ||
96 | |||
97 | QString skinPath = "opieplayer2/skins/" + skin; | ||
98 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
99 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | ||
100 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | ||
101 | |||
102 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); | ||
103 | |||
104 | setBackgroundPixmap( backgroundPixmap ); | ||
105 | |||
106 | songInfo.setFocusPolicy( QWidget::NoFocus ); | ||
107 | // changeTextColor( &songInfo ); | ||
108 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
109 | // songInfo.setFrameStyle( QFrame::NoFrame); | ||
110 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
111 | // songInfo.setForegroundColor(Qt::white); | ||
112 | |||
113 | slider.setFixedHeight( 20 ); | ||
114 | slider.setMinValue( 0 ); | ||
115 | slider.setMaxValue( 1 ); | ||
116 | slider.setFocusPolicy( QWidget::NoFocus ); | ||
117 | slider.setBackgroundPixmap( backgroundPixmap ); | ||
118 | |||
119 | // Config cofg("qpe"); | ||
120 | // cofg.setGroup("Appearance"); | ||
121 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | ||
122 | |||
123 | time.setFocusPolicy( QWidget::NoFocus ); | ||
124 | time.setAlignment( Qt::AlignCenter ); | ||
125 | |||
126 | // time.setFrame(FALSE); | ||
127 | // changeTextColor( &time ); | ||
128 | |||
129 | resizeEvent( NULL ); | ||
130 | 92 | ||
@@ -144,3 +106,2 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
144 | setPlaying( mediaPlayerState.isPlaying() ); | 106 | setPlaying( mediaPlayerState.isPlaying() ); |
145 | |||
146 | } | 107 | } |
@@ -231,2 +192,44 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | |||
231 | 192 | ||
193 | void AudioWidget::loadSkin() | ||
194 | { | ||
195 | Config cfg("OpiePlayer"); | ||
196 | cfg.setGroup("Options"); | ||
197 | skin = cfg.readEntry("Skin","default"); | ||
198 | //skin = "scaleTest"; | ||
199 | // color of background, frame, degree of transparency | ||
200 | |||
201 | QString skinPath = "opieplayer2/skins/" + skin; | ||
202 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
203 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | ||
204 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | ||
205 | |||
206 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); | ||
207 | |||
208 | setBackgroundPixmap( backgroundPixmap ); | ||
209 | |||
210 | songInfo.setFocusPolicy( QWidget::NoFocus ); | ||
211 | // changeTextColor( &songInfo ); | ||
212 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
213 | // songInfo.setFrameStyle( QFrame::NoFrame); | ||
214 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
215 | // songInfo.setForegroundColor(Qt::white); | ||
216 | |||
217 | slider.setFixedHeight( 20 ); | ||
218 | slider.setMinValue( 0 ); | ||
219 | slider.setMaxValue( 1 ); | ||
220 | slider.setFocusPolicy( QWidget::NoFocus ); | ||
221 | slider.setBackgroundPixmap( backgroundPixmap ); | ||
222 | |||
223 | // Config cofg("qpe"); | ||
224 | // cofg.setGroup("Appearance"); | ||
225 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | ||
226 | |||
227 | time.setFocusPolicy( QWidget::NoFocus ); | ||
228 | time.setAlignment( Qt::AlignCenter ); | ||
229 | |||
230 | // time.setFrame(FALSE); | ||
231 | // changeTextColor( &time ); | ||
232 | |||
233 | resizeEvent( 0 ); | ||
234 | } | ||
232 | 235 | ||
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 53982a1..61556c6 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -70,2 +70,4 @@ public: | |||
70 | 70 | ||
71 | virtual void loadSkin(); | ||
72 | |||
71 | signals: | 73 | signals: |
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index ffc7cb6..f87cee8 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp | |||
@@ -14,3 +14,3 @@ int main(int argc, char **argv) { | |||
14 | QObject::connect( &pl, SIGNAL( skinSelected() ), | 14 | QObject::connect( &pl, SIGNAL( skinSelected() ), |
15 | &mp, SLOT( recreateAudioAndVideoWidgets() ) ); | 15 | &mp, SLOT( reloadSkins() ) ); |
16 | 16 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e1bfc2d..8a3d3e0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -369 +369,7 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
369 | 369 | ||
370 | void MediaPlayer::reloadSkins() | ||
371 | { | ||
372 | audioUI->loadSkin(); | ||
373 | videoUI->loadSkin(); | ||
374 | } | ||
375 | |||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index dc306c4..6b316f6 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -57,2 +57,3 @@ public slots: | |||
57 | void recreateAudioAndVideoWidgets(); | 57 | void recreateAudioAndVideoWidgets(); |
58 | void reloadSkins(); | ||
58 | 59 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index db16b44..d60dc0d 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -47,2 +47,5 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount | |||
47 | 47 | ||
48 | buttons.clear(); | ||
49 | buttons.reserve( buttonCount ); | ||
50 | |||
48 | for ( uint i = 0; i < buttonCount; ++i ) { | 51 | for ( uint i = 0; i < buttonCount; ++i ) { |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 148948a..8c781e9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -74,2 +74,4 @@ public slots: | |||
74 | 74 | ||
75 | virtual void loadSkin() = 0; | ||
76 | |||
75 | signals: | 77 | signals: |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index d1efaad..a03d43e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -81,3 +81,2 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
81 | 81 | ||
82 | |||
83 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 82 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
@@ -87,22 +86,5 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
87 | 86 | ||
88 | Config cfg("OpiePlayer"); | 87 | slider = 0; |
89 | cfg.setGroup("Options"); | ||
90 | skin = cfg.readEntry("Skin","default"); | ||
91 | 88 | ||
92 | QString skinPath = "opieplayer2/skins/" + skin; | 89 | loadSkin(); |
93 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
94 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | ||
95 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | ||
96 | |||
97 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); | ||
98 | |||
99 | setBackgroundPixmap( backgroundPixmap ); | ||
100 | |||
101 | slider = new QSlider( Qt::Horizontal, this ); | ||
102 | slider->setMinValue( 0 ); | ||
103 | slider->setMaxValue( 1 ); | ||
104 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | ||
105 | //slider->setFocusPolicy( QWidget::NoFocus ); | ||
106 | |||
107 | resizeEvent( NULL ); | ||
108 | 90 | ||
@@ -203,2 +185,27 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
203 | 185 | ||
186 | void VideoWidget::loadSkin() | ||
187 | { | ||
188 | Config cfg("OpiePlayer"); | ||
189 | cfg.setGroup("Options"); | ||
190 | skin = cfg.readEntry("Skin","default"); | ||
191 | |||
192 | QString skinPath = "opieplayer2/skins/" + skin; | ||
193 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
194 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | ||
195 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | ||
196 | |||
197 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); | ||
198 | |||
199 | setBackgroundPixmap( backgroundPixmap ); | ||
200 | |||
201 | delete slider; | ||
202 | slider = new QSlider( Qt::Horizontal, this ); | ||
203 | slider->setMinValue( 0 ); | ||
204 | slider->setMaxValue( 1 ); | ||
205 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | ||
206 | //slider->setFocusPolicy( QWidget::NoFocus ); | ||
207 | |||
208 | resizeEvent( 0 ); | ||
209 | } | ||
210 | |||
204 | void VideoWidget::updateSlider( long i, long max ) { | 211 | void VideoWidget::updateSlider( long i, long max ) { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 21a4e9e..87be371 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -68,2 +68,4 @@ public: | |||
68 | 68 | ||
69 | virtual void loadSkin(); | ||
70 | |||
69 | signals: | 71 | signals: |