author | simon <simon> | 2002-12-11 00:51:29 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 00:51:29 (UTC) |
commit | ccef9ec4aff9822b0f2468e590d05c9484bc027e (patch) (unidiff) | |
tree | f6a0b4ee201c24f2200ab79851d41fb640550962 | |
parent | 8605e11e5965521291e70f47159487ea9f1e5b49 (diff) | |
download | opie-ccef9ec4aff9822b0f2468e590d05c9484bc027e.zip opie-ccef9ec4aff9822b0f2468e590d05c9484bc027e.tar.gz opie-ccef9ec4aff9822b0f2468e590d05c9484bc027e.tar.bz2 |
- moved the shared button up/down image variables into the base class
- removed some unused variables
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 6 |
5 files changed, 16 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 0516089..0b7cc45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -131,30 +131,30 @@ QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { | |||
131 | }; | 131 | }; |
132 | 132 | ||
133 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 133 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
134 | int h = height(); | 134 | int h = height(); |
135 | int w = width(); | 135 | int w = width(); |
136 | 136 | ||
137 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 137 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
138 | slider.setFixedWidth( w - 110 ); | 138 | slider.setFixedWidth( w - 110 ); |
139 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 139 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
140 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 140 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
141 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 141 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
142 | 142 | ||
143 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 143 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; |
144 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 144 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; |
145 | QPoint p = upperLeftOfButtonMask; | 145 | QPoint p = upperLeftOfButtonMask; |
146 | 146 | ||
147 | QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); | 147 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, p ); |
148 | QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); | 148 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, p ); |
149 | 149 | ||
150 | for ( uint i = 0; i < buttons.size(); i++ ) { | 150 | for ( uint i = 0; i < buttons.size(); i++ ) { |
151 | if ( !buttons[i].mask.isNull() ) { | 151 | if ( !buttons[i].mask.isNull() ) { |
152 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); | 152 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); |
153 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); | 153 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | void AudioWidget::sliderPressed() { | 158 | void AudioWidget::sliderPressed() { |
159 | audioSliderBeingMoved = TRUE; | 159 | audioSliderBeingMoved = TRUE; |
160 | } | 160 | } |
@@ -191,28 +191,28 @@ void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | |||
191 | } | 191 | } |
192 | 192 | ||
193 | void AudioWidget::loadSkin() | 193 | void AudioWidget::loadSkin() |
194 | { | 194 | { |
195 | Config cfg("OpiePlayer"); | 195 | Config cfg("OpiePlayer"); |
196 | cfg.setGroup("Options"); | 196 | cfg.setGroup("Options"); |
197 | skin = cfg.readEntry("Skin","default"); | 197 | skin = cfg.readEntry("Skin","default"); |
198 | //skin = "scaleTest"; | 198 | //skin = "scaleTest"; |
199 | // color of background, frame, degree of transparency | 199 | // color of background, frame, degree of transparency |
200 | 200 | ||
201 | QString skinPath = "opieplayer2/skins/" + skin; | 201 | QString skinPath = "opieplayer2/skins/" + skin; |
202 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 202 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
203 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 203 | buttonUpImage = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
204 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 204 | buttonDownImage = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
205 | 205 | ||
206 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); | 206 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", buttonUpImage.size() ); |
207 | 207 | ||
208 | setBackgroundPixmap( backgroundPixmap ); | 208 | setBackgroundPixmap( backgroundPixmap ); |
209 | 209 | ||
210 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 210 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
211 | // changeTextColor( &songInfo ); | 211 | // changeTextColor( &songInfo ); |
212 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 212 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
213 | // songInfo.setFrameStyle( QFrame::NoFrame); | 213 | // songInfo.setFrameStyle( QFrame::NoFrame); |
214 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 214 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
215 | // songInfo.setForegroundColor(Qt::white); | 215 | // songInfo.setForegroundColor(Qt::white); |
216 | 216 | ||
217 | slider.setFixedHeight( 20 ); | 217 | slider.setFixedHeight( 20 ); |
218 | slider.setMinValue( 0 ); | 218 | slider.setMinValue( 0 ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 61556c6..670fb45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -77,25 +77,23 @@ protected: | |||
77 | void doBlank(); | 77 | void doBlank(); |
78 | void doUnblank(); | 78 | void doUnblank(); |
79 | void resizeEvent( QResizeEvent *re ); | 79 | void resizeEvent( QResizeEvent *re ); |
80 | void timerEvent( QTimerEvent *event ); | 80 | void timerEvent( QTimerEvent *event ); |
81 | void keyReleaseEvent( QKeyEvent *e); | 81 | void keyReleaseEvent( QKeyEvent *e); |
82 | private slots: | 82 | private slots: |
83 | void skipFor(); | 83 | void skipFor(); |
84 | void skipBack(); | 84 | void skipBack(); |
85 | void stopSkip(); | 85 | void stopSkip(); |
86 | private: | 86 | private: |
87 | int skipDirection; | 87 | int skipDirection; |
88 | QString skin; | 88 | QString skin; |
89 | QImage imgUp; | ||
90 | QImage imgDn; | ||
91 | 89 | ||
92 | OTicker songInfo; | 90 | OTicker songInfo; |
93 | QSlider slider; | 91 | QSlider slider; |
94 | QLineEdit time; | 92 | QLineEdit time; |
95 | bool isStreaming : 1; | 93 | bool isStreaming : 1; |
96 | bool audioSliderBeingMoved : 1; | 94 | bool audioSliderBeingMoved : 1; |
97 | }; | 95 | }; |
98 | 96 | ||
99 | 97 | ||
100 | #endif // AUDIO_WIDGET_H | 98 | #endif // AUDIO_WIDGET_H |
101 | 99 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index a9dddf8..754228e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -128,17 +128,19 @@ protected: | |||
128 | void toggleButton( Button &button ); | 128 | void toggleButton( Button &button ); |
129 | 129 | ||
130 | MediaPlayerState &mediaPlayerState; | 130 | MediaPlayerState &mediaPlayerState; |
131 | PlayListWidget &playList; | 131 | PlayListWidget &playList; |
132 | 132 | ||
133 | ButtonVector buttons; | 133 | ButtonVector buttons; |
134 | 134 | ||
135 | QImage buttonMask; | 135 | QImage buttonMask; |
136 | 136 | ||
137 | QPoint upperLeftOfButtonMask; | 137 | QPoint upperLeftOfButtonMask; |
138 | 138 | ||
139 | QPixmap backgroundPixmap; | 139 | QPixmap backgroundPixmap; |
140 | QImage buttonUpImage; | ||
141 | QImage buttonDownImage; | ||
140 | }; | 142 | }; |
141 | 143 | ||
142 | #endif // MEDIAWIDGET_H | 144 | #endif // MEDIAWIDGET_H |
143 | /* vim: et sw=4 ts=4 | 145 | /* vim: et sw=4 ts=4 |
144 | */ | 146 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a03d43e..0047ac0 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -123,26 +123,26 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
123 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 123 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
124 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 124 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
125 | slider->setFocusPolicy( QWidget::NoFocus ); | 125 | slider->setFocusPolicy( QWidget::NoFocus ); |
126 | slider->setBackgroundPixmap( backgroundPixmap ); | 126 | slider->setBackgroundPixmap( backgroundPixmap ); |
127 | 127 | ||
128 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; | 128 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; |
129 | if(w>h) | 129 | if(w>h) |
130 | upperLeftOfButtonMask.ry() = 0; | 130 | upperLeftOfButtonMask.ry() = 0; |
131 | else | 131 | else |
132 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 132 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
133 | QPoint p = upperLeftOfButtonMask; | 133 | QPoint p = upperLeftOfButtonMask; |
134 | 134 | ||
135 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); | 135 | QPixmap *pixUp = combineVImageWithBackground( buttonUpImage, backgroundPixmap, p ); |
136 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); | 136 | QPixmap *pixDn = combineVImageWithBackground( buttonDownImage, backgroundPixmap, p ); |
137 | 137 | ||
138 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 138 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
139 | Button &button = *it; | 139 | Button &button = *it; |
140 | 140 | ||
141 | if ( !button.mask.isNull() ) { | 141 | if ( !button.mask.isNull() ) { |
142 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); | 142 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
143 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); | 143 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | delete pixUp; | 147 | delete pixUp; |
148 | delete pixDn; | 148 | delete pixDn; |
@@ -178,40 +178,40 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | // Effectively blank the view next time we show it so it looks nicer | 180 | // Effectively blank the view next time we show it so it looks nicer |
181 | scaledWidth = 0; | 181 | scaledWidth = 0; |
182 | scaledHeight = 0; | 182 | scaledHeight = 0; |
183 | hide(); | 183 | hide(); |
184 | } | 184 | } |
185 | 185 | ||
186 | void VideoWidget::loadSkin() | 186 | void VideoWidget::loadSkin() |
187 | { | 187 | { |
188 | Config cfg("OpiePlayer"); | 188 | Config cfg("OpiePlayer"); |
189 | cfg.setGroup("Options"); | 189 | cfg.setGroup("Options"); |
190 | skin = cfg.readEntry("Skin","default"); | 190 | QString skin = cfg.readEntry("Skin","default"); |
191 | 191 | ||
192 | QString skinPath = "opieplayer2/skins/" + skin; | 192 | QString skinPath = "opieplayer2/skins/" + skin; |
193 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 193 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
194 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 194 | buttonUpImage = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
195 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 195 | buttonDownImage = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
196 | 196 | ||
197 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); | 197 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", buttonUpImage.size() ); |
198 | 198 | ||
199 | setBackgroundPixmap( backgroundPixmap ); | 199 | setBackgroundPixmap( backgroundPixmap ); |
200 | 200 | ||
201 | delete slider; | 201 | delete slider; |
202 | slider = new QSlider( Qt::Horizontal, this ); | 202 | slider = new QSlider( Qt::Horizontal, this ); |
203 | slider->setMinValue( 0 ); | 203 | slider->setMinValue( 0 ); |
204 | slider->setMaxValue( 1 ); | 204 | slider->setMaxValue( 1 ); |
205 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 205 | slider->setBackgroundPixmap( backgroundPixmap ); |
206 | //slider->setFocusPolicy( QWidget::NoFocus ); | 206 | //slider->setFocusPolicy( QWidget::NoFocus ); |
207 | 207 | ||
208 | resizeEvent( 0 ); | 208 | resizeEvent( 0 ); |
209 | } | 209 | } |
210 | 210 | ||
211 | void VideoWidget::updateSlider( long i, long max ) { | 211 | void VideoWidget::updateSlider( long i, long max ) { |
212 | // Will flicker too much if we don't do this | 212 | // Will flicker too much if we don't do this |
213 | if ( max == 0 ) { | 213 | if ( max == 0 ) { |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | int width = slider->width(); | 216 | int width = slider->width(); |
217 | int val = int((double)i * width / max); | 217 | int val = int((double)i * width / max); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 87be371..f434945 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -73,31 +73,25 @@ signals: | |||
73 | void lessClicked(); | 73 | void lessClicked(); |
74 | void sliderMoved( long ); | 74 | void sliderMoved( long ); |
75 | void videoResized ( const QSize &s ); | 75 | void videoResized ( const QSize &s ); |
76 | 76 | ||
77 | protected: | 77 | protected: |
78 | 78 | ||
79 | void resizeEvent( QResizeEvent * ); | 79 | void resizeEvent( QResizeEvent * ); |
80 | void mouseReleaseEvent( QMouseEvent *event ); | 80 | void mouseReleaseEvent( QMouseEvent *event ); |
81 | void keyReleaseEvent( QKeyEvent *e); | 81 | void keyReleaseEvent( QKeyEvent *e); |
82 | 82 | ||
83 | private: | 83 | private: |
84 | // Ticker songInfo; | 84 | // Ticker songInfo; |
85 | QImage imgUp; | ||
86 | QImage imgDn; | ||
87 | QString skin; | ||
88 | 85 | ||
89 | |||
90 | |||
91 | QString backgroundPix; | ||
92 | QSlider *slider; | 86 | QSlider *slider; |
93 | QImage *currentFrame; | 87 | QImage *currentFrame; |
94 | int scaledWidth; | 88 | int scaledWidth; |
95 | int scaledHeight; | 89 | int scaledHeight; |
96 | XineVideoWidget* videoFrame; | 90 | XineVideoWidget* videoFrame; |
97 | 91 | ||
98 | bool videoSliderBeingMoved; | 92 | bool videoSliderBeingMoved; |
99 | }; | 93 | }; |
100 | 94 | ||
101 | #endif // VIDEO_WIDGET_H | 95 | #endif // VIDEO_WIDGET_H |
102 | 96 | ||
103 | 97 | ||