summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp11
4 files changed, 28 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 0b7cc45..bb686f1 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -179,44 +179,33 @@ void AudioWidget::setLength( long max ) {
179} 179}
180 180
181 181
182void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 182void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
183 if ( mediaType == MediaPlayerState::Audio ) { 183 if ( mediaType == MediaPlayerState::Audio ) {
184 // startTimer( 150 ); 184 // startTimer( 150 );
185 showMaximized(); 185 showMaximized();
186 return; 186 return;
187 } 187 }
188 188
189 killTimers(); 189 killTimers();
190 hide(); 190 hide();
191} 191}
192 192
193void AudioWidget::loadSkin() 193void AudioWidget::loadSkin()
194{ 194{
195 Config cfg("OpiePlayer"); 195 loadDefaultSkin( skinInfo, buttonCount );
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 buttonUpImage = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
204 buttonDownImage = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
205
206 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", buttonUpImage.size() );
207 196
208 setBackgroundPixmap( backgroundPixmap ); 197 setBackgroundPixmap( backgroundPixmap );
209 198
210 songInfo.setFocusPolicy( QWidget::NoFocus ); 199 songInfo.setFocusPolicy( QWidget::NoFocus );
211// changeTextColor( &songInfo ); 200// changeTextColor( &songInfo );
212// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 201// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
213// songInfo.setFrameStyle( QFrame::NoFrame); 202// songInfo.setFrameStyle( QFrame::NoFrame);
214 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 203 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
215// songInfo.setForegroundColor(Qt::white); 204// songInfo.setForegroundColor(Qt::white);
216 205
217 slider.setFixedHeight( 20 ); 206 slider.setFixedHeight( 20 );
218 slider.setMinValue( 0 ); 207 slider.setMinValue( 0 );
219 slider.setMaxValue( 1 ); 208 slider.setMaxValue( 1 );
220 slider.setFocusPolicy( QWidget::NoFocus ); 209 slider.setFocusPolicy( QWidget::NoFocus );
221 slider.setBackgroundPixmap( backgroundPixmap ); 210 slider.setBackgroundPixmap( backgroundPixmap );
222 211
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index d60dc0d..c9d7db8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -11,32 +11,35 @@
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23 23
24#include "mediawidget.h" 24#include "mediawidget.h"
25#include "playlistwidget.h" 25#include "playlistwidget.h"
26 26
27#include <qpe/config.h>
28#include <qpe/qpeapplication.h>
29
27MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 30MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
28 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 31 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
29{ 32{
30 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 33 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
31 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 34 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
32 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 35 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
33 this, SLOT( setLength( long ) ) ); 36 this, SLOT( setLength( long ) ) );
34 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 37 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
35 this, SLOT( setPlaying( bool ) ) ); 38 this, SLOT( setPlaying( bool ) ) );
36} 39}
37 40
38MediaWidget::~MediaWidget() 41MediaWidget::~MediaWidget()
39{ 42{
40} 43}
41 44
42void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 45void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
@@ -72,32 +75,52 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil
72 QBitmap mask( fileName ); 75 QBitmap mask( fileName );
73 if ( mask.isNull() ) 76 if ( mask.isNull() )
74 return mask; 77 return mask;
75 78
76 QImage imgMask = mask.convertToImage(); 79 QImage imgMask = mask.convertToImage();
77 uchar **dest = buttonMask.jumpTable(); 80 uchar **dest = buttonMask.jumpTable();
78 for ( int y = 0; y < buttonMask.height(); y++ ) { 81 for ( int y = 0; y < buttonMask.height(); y++ ) {
79 uchar *line = dest[y]; 82 uchar *line = dest[y];
80 for ( int x = 0; x < buttonMask.width(); x++ ) 83 for ( int x = 0; x < buttonMask.width(); x++ )
81 if ( !qRed( imgMask.pixel( x, y ) ) ) 84 if ( !qRed( imgMask.pixel( x, y ) ) )
82 line[x] = command + 1; 85 line[x] = command + 1;
83 } 86 }
84 87
85 return mask; 88 return mask;
86} 89}
87 90
91void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix )
92{
93 Config cfg( "OpiePlayer" );
94 cfg.setGroup( "Options" );
95 QString skin = cfg.readEntry( "Skin","default" );
96
97 loadSkin( skinInfo, buttonCount, skin, fileNameInfix );
98}
99
100void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix )
101{
102 QString skinPath = "opieplayer2/skins/" + name;
103 backgroundPixmap = QPixmap( Resource::loadPixmap( QString( "%1/background" ).arg( skinPath ) ) );
104 buttonUpImage = QImage( Resource::loadImage( QString( "%1/skin%2_up" ).arg( skinPath ).arg( fileNameInfix ) ) );
105 buttonDownImage = QImage( Resource::loadImage( QString( "%1/skin%2_down" ).arg( skinPath ).arg( fileNameInfix ) ) );
106
107 setupButtons( skinInfo, buttonCount,
108 QPEApplication::qpeDir() + "/pics/" + skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
109}
110
88void MediaWidget::closeEvent( QCloseEvent * ) 111void MediaWidget::closeEvent( QCloseEvent * )
89{ 112{
90 mediaPlayerState.setList(); 113 mediaPlayerState.setList();
91} 114}
92 115
93void MediaWidget::paintEvent( QPaintEvent *pe ) 116void MediaWidget::paintEvent( QPaintEvent *pe )
94{ 117{
95 QPainter p( this ); 118 QPainter p( this );
96 119
97 if ( mediaPlayerState.isFullscreen() ) { 120 if ( mediaPlayerState.isFullscreen() ) {
98 // Clear the background 121 // Clear the background
99 p.setBrush( QBrush( Qt::black ) ); 122 p.setBrush( QBrush( Qt::black ) );
100 return; 123 return;
101 } 124 }
102 125
103 if ( !pe->erased() ) { 126 if ( !pe->erased() ) {
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 754228e..52b9fcb 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -91,32 +91,35 @@ public slots:
91signals: 91signals:
92 void moreReleased(); 92 void moreReleased();
93 void lessReleased(); 93 void lessReleased();
94 void forwardReleased(); 94 void forwardReleased();
95 void backReleased(); 95 void backReleased();
96 void forwardClicked(); 96 void forwardClicked();
97 void backClicked(); 97 void backClicked();
98 void moreClicked(); 98 void moreClicked();
99 void lessClicked(); 99 void lessClicked();
100 100
101protected: 101protected:
102 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 102 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
103 const QString &imagePrefix, const QSize &buttonAreaSize ); 103 const QString &imagePrefix, const QSize &buttonAreaSize );
104 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); 104 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix );
105 QBitmap setupButtonMask( const Command &command, const QString &fileName ); 105 QBitmap setupButtonMask( const Command &command, const QString &fileName );
106 106
107 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null );
108 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix );
109
107 virtual void closeEvent( QCloseEvent * ); 110 virtual void closeEvent( QCloseEvent * );
108 111
109 virtual void paintEvent( QPaintEvent *pe ); 112 virtual void paintEvent( QPaintEvent *pe );
110 113
111 Button *buttonAt( const QPoint &position ); 114 Button *buttonAt( const QPoint &position );
112 115
113 virtual void mousePressEvent( QMouseEvent *event ); 116 virtual void mousePressEvent( QMouseEvent *event );
114 virtual void mouseReleaseEvent( QMouseEvent *event ); 117 virtual void mouseReleaseEvent( QMouseEvent *event );
115 118
116 virtual void makeVisible(); 119 virtual void makeVisible();
117 120
118 void handleCommand( Command command, bool buttonDown ); 121 void handleCommand( Command command, bool buttonDown );
119 122
120 bool isOverButton( const QPoint &position, int buttonId ) const; 123 bool isOverButton( const QPoint &position, int buttonId ) const;
121 124
122 void paintAllButtons( QPainter &p ); 125 void paintAllButtons( QPainter &p );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 0047ac0..bc47717 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -172,42 +172,33 @@ void VideoWidget::setLength( long max ) {
172 172
173void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 173void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
174{ 174{
175 if ( displayType == MediaPlayerState::Video ) { 175 if ( displayType == MediaPlayerState::Video ) {
176 makeVisible(); 176 makeVisible();
177 return; 177 return;
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
186void VideoWidget::loadSkin() 186void VideoWidget::loadSkin()
187{ 187{
188 Config cfg("OpiePlayer"); 188 loadDefaultSkin( skinInfo, buttonCount, "V" );
189 cfg.setGroup("Options");
190 QString skin = cfg.readEntry("Skin","default");
191
192 QString skinPath = "opieplayer2/skins/" + skin;
193 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
194 buttonUpImage = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
195 buttonDownImage = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
196
197 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", buttonUpImage.size() );
198 189
199 setBackgroundPixmap( backgroundPixmap ); 190 setBackgroundPixmap( backgroundPixmap );
200 191
201 delete slider; 192 delete slider;
202 slider = new QSlider( Qt::Horizontal, this ); 193 slider = new QSlider( Qt::Horizontal, this );
203 slider->setMinValue( 0 ); 194 slider->setMinValue( 0 );
204 slider->setMaxValue( 1 ); 195 slider->setMaxValue( 1 );
205 slider->setBackgroundPixmap( backgroundPixmap ); 196 slider->setBackgroundPixmap( backgroundPixmap );
206 //slider->setFocusPolicy( QWidget::NoFocus ); 197 //slider->setFocusPolicy( QWidget::NoFocus );
207 198
208 resizeEvent( 0 ); 199 resizeEvent( 0 );
209} 200}
210 201
211void VideoWidget::updateSlider( long i, long max ) { 202void VideoWidget::updateSlider( long i, long max ) {
212 // Will flicker too much if we don't do this 203 // Will flicker too much if we don't do this
213 if ( max == 0 ) { 204 if ( max == 0 ) {