Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 47 |
1 files changed, 27 insertions, 20 deletions
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 | |||
@@ -70,50 +70,32 @@ const MediaWidget::SkinButtonInfo skinInfo[] = | |||
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 ), 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 | |||
83 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 82 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
84 | 83 | ||
85 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 84 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
86 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 85 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
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 | ||
109 | setLength( mediaPlayerState.length() ); | 91 | setLength( mediaPlayerState.length() ); |
110 | setPosition( mediaPlayerState.position() ); | 92 | setPosition( mediaPlayerState.position() ); |
111 | setFullscreen( mediaPlayerState.isFullscreen() ); | 93 | setFullscreen( mediaPlayerState.isFullscreen() ); |
112 | setPlaying( mediaPlayerState.isPlaying() ); | 94 | setPlaying( mediaPlayerState.isPlaying() ); |
113 | } | 95 | } |
114 | 96 | ||
115 | 97 | ||
116 | VideoWidget::~VideoWidget() | 98 | VideoWidget::~VideoWidget() |
117 | { | 99 | { |
118 | } | 100 | } |
119 | 101 | ||
@@ -192,24 +174,49 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
192 | { | 174 | { |
193 | if ( displayType == MediaPlayerState::Video ) { | 175 | if ( displayType == MediaPlayerState::Video ) { |
194 | makeVisible(); | 176 | makeVisible(); |
195 | return; | 177 | return; |
196 | } | 178 | } |
197 | 179 | ||
198 | // 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 |
199 | scaledWidth = 0; | 181 | scaledWidth = 0; |
200 | scaledHeight = 0; | 182 | scaledHeight = 0; |
201 | hide(); | 183 | hide(); |
202 | } | 184 | } |
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 ) { |
205 | // Will flicker too much if we don't do this | 212 | // Will flicker too much if we don't do this |
206 | if ( max == 0 ) { | 213 | if ( max == 0 ) { |
207 | return; | 214 | return; |
208 | } | 215 | } |
209 | int width = slider->width(); | 216 | int width = slider->width(); |
210 | int val = int((double)i * width / max); | 217 | int val = int((double)i * width / max); |
211 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 218 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
212 | if ( slider->value() != val ) { | 219 | if ( slider->value() != val ) { |
213 | slider->setValue( val ); | 220 | slider->setValue( val ); |
214 | } | 221 | } |
215 | if ( slider->maxValue() != width ) { | 222 | if ( slider->maxValue() != width ) { |