-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 41844e1..26777e6 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -54,49 +54,49 @@ | |||
54 | 54 | ||
55 | 55 | ||
56 | namespace | 56 | namespace |
57 | { | 57 | { |
58 | 58 | ||
59 | const int xo = 2; // movable x offset | 59 | const int xo = 2; // movable x offset |
60 | const int yo = 0; // movable y offset | 60 | const int yo = 0; // movable y offset |
61 | 61 | ||
62 | const MediaWidget::SkinButtonInfo skinInfo[] = | 62 | const 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 | ||
73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 77 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
78 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 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 | 82 | ||
83 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 83 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
84 | 84 | ||
85 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 85 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
86 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 86 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
87 | 87 | ||
88 | Config cfg("OpiePlayer"); | 88 | Config cfg("OpiePlayer"); |
89 | cfg.setGroup("Options"); | 89 | cfg.setGroup("Options"); |
90 | skin = cfg.readEntry("Skin","default"); | 90 | skin = cfg.readEntry("Skin","default"); |
91 | 91 | ||
92 | QString skinPath = "opieplayer2/skins/" + skin; | 92 | QString skinPath = "opieplayer2/skins/" + skin; |
93 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 93 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
94 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 94 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
95 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 95 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
96 | 96 | ||
97 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 97 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
98 | buttonMask.fill( 0 ); | 98 | buttonMask.fill( 0 ); |
99 | 99 | ||
100 | for ( uint i = 0; i < buttonCount; i++ ) { | 100 | for ( uint i = 0; i < buttonCount; i++ ) { |
101 | Button button; | 101 | Button button; |
102 | button.command = skinInfo[ i ].command; | 102 | button.command = skinInfo[ i ].command; |
@@ -168,50 +168,48 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
168 | 168 | ||
169 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; | 169 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; |
170 | if(w>h) | 170 | if(w>h) |
171 | upperLeftOfButtonMask.ry() = 0; | 171 | upperLeftOfButtonMask.ry() = 0; |
172 | else | 172 | else |
173 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 173 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
174 | QPoint p = upperLeftOfButtonMask; | 174 | QPoint p = upperLeftOfButtonMask; |
175 | 175 | ||
176 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); | 176 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); |
177 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); | 177 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); |
178 | 178 | ||
179 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 179 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
180 | Button &button = *it; | 180 | Button &button = *it; |
181 | 181 | ||
182 | if ( !button.mask.isNull() ) { | 182 | if ( !button.mask.isNull() ) { |
183 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); | 183 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
184 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); | 184 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | delete pixUp; | 188 | delete pixUp; |
189 | delete pixDn; | 189 | delete pixDn; |
190 | } | 190 | } |
191 | 191 | ||
192 | static bool videoSliderBeingMoved = FALSE; | ||
193 | |||
194 | void VideoWidget::sliderPressed() { | 192 | void VideoWidget::sliderPressed() { |
195 | videoSliderBeingMoved = TRUE; | 193 | videoSliderBeingMoved = TRUE; |
196 | } | 194 | } |
197 | 195 | ||
198 | void VideoWidget::sliderReleased() { | 196 | void VideoWidget::sliderReleased() { |
199 | videoSliderBeingMoved = FALSE; | 197 | videoSliderBeingMoved = FALSE; |
200 | if ( slider->width() == 0 ) { | 198 | if ( slider->width() == 0 ) { |
201 | return; | 199 | return; |
202 | } | 200 | } |
203 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); | 201 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
204 | mediaPlayerState.setPosition( val ); | 202 | mediaPlayerState.setPosition( val ); |
205 | } | 203 | } |
206 | 204 | ||
207 | void VideoWidget::setPosition( long i ) { | 205 | void VideoWidget::setPosition( long i ) { |
208 | updateSlider( i, mediaPlayerState.length() ); | 206 | updateSlider( i, mediaPlayerState.length() ); |
209 | } | 207 | } |
210 | 208 | ||
211 | 209 | ||
212 | void VideoWidget::setLength( long max ) { | 210 | void VideoWidget::setLength( long max ) { |
213 | updateSlider( mediaPlayerState.position(), max ); | 211 | updateSlider( mediaPlayerState.position(), max ); |
214 | } | 212 | } |
215 | 213 | ||
216 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 214 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
217 | { | 215 | { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 7d50ea0..bed2116 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -73,30 +73,32 @@ signals: | |||
73 | void videoResized ( const QSize &s ); | 73 | void videoResized ( const QSize &s ); |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | 76 | ||
77 | void resizeEvent( QResizeEvent * ); | 77 | void resizeEvent( QResizeEvent * ); |
78 | void showEvent( QShowEvent *se ); | 78 | void showEvent( QShowEvent *se ); |
79 | void mousePressEvent( QMouseEvent *event ); | 79 | void mousePressEvent( QMouseEvent *event ); |
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; | 85 | QImage imgUp; |
86 | QImage imgDn; | 86 | QImage imgDn; |
87 | QString skin; | 87 | QString skin; |
88 | 88 | ||
89 | 89 | ||
90 | 90 | ||
91 | QString backgroundPix; | 91 | QString backgroundPix; |
92 | QSlider *slider; | 92 | QSlider *slider; |
93 | QImage *currentFrame; | 93 | QImage *currentFrame; |
94 | int scaledWidth; | 94 | int scaledWidth; |
95 | int scaledHeight; | 95 | int scaledHeight; |
96 | XineVideoWidget* videoFrame; | 96 | XineVideoWidget* videoFrame; |
97 | |||
98 | bool videoSliderBeingMoved; | ||
97 | }; | 99 | }; |
98 | 100 | ||
99 | #endif // VIDEO_WIDGET_H | 101 | #endif // VIDEO_WIDGET_H |
100 | 102 | ||
101 | 103 | ||
102 | 104 | ||