summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/skin.h4
4 files changed, 11 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index da0706e..6b304ec 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -35,27 +35,27 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla
35 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 35 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
36 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 36 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
37 this, SLOT( setLength( long ) ) ); 37 this, SLOT( setLength( long ) ) );
38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
39 this, SLOT( setPlaying( bool ) ) ); 39 this, SLOT( setPlaying( bool ) ) );
40} 40}
41 41
42MediaWidget::~MediaWidget() 42MediaWidget::~MediaWidget()
43{ 43{
44} 44}
45 45
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin, const QSize &buttonAreaSize ) 47 const Skin &skin )
48{ 48{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount, buttonAreaSize ); 49 buttonMask = skin.buttonMask( skinInfo, buttonCount );
50 50
51 buttons.clear(); 51 buttons.clear();
52 buttons.reserve( buttonCount ); 52 buttons.reserve( buttonCount );
53 53
54 for ( uint i = 0; i < buttonCount; ++i ) { 54 for ( uint i = 0; i < buttonCount; ++i ) {
55 Button button = setupButton( skinInfo[ i ], skin ); 55 Button button = setupButton( skinInfo[ i ], skin );
56 buttons.push_back( button ); 56 buttons.push_back( button );
57 } 57 }
58} 58}
59 59
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
61{ 61{
@@ -76,25 +76,25 @@ void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCo
76 loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); 76 loadSkin( skinInfo, buttonCount, skin, fileNameInfix );
77} 77}
78 78
79void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) 79void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix )
80{ 80{
81 Skin skin( name, fileNameInfix ); 81 Skin skin( name, fileNameInfix );
82 82
83 QString skinPath = "opieplayer2/skins/" + name; 83 QString skinPath = "opieplayer2/skins/" + name;
84 backgroundPixmap = skin.backgroundImage(); 84 backgroundPixmap = skin.backgroundImage();
85 buttonUpImage = skin.buttonUpImage(); 85 buttonUpImage = skin.buttonUpImage();
86 buttonDownImage = skin.buttonDownImage(); 86 buttonDownImage = skin.buttonDownImage();
87 87
88 setupButtons( skinInfo, buttonCount, skin, buttonUpImage.size() ); 88 setupButtons( skinInfo, buttonCount, skin );
89} 89}
90 90
91void MediaWidget::closeEvent( QCloseEvent * ) 91void MediaWidget::closeEvent( QCloseEvent * )
92{ 92{
93 mediaPlayerState.setList(); 93 mediaPlayerState.setList();
94} 94}
95 95
96void MediaWidget::paintEvent( QPaintEvent *pe ) 96void MediaWidget::paintEvent( QPaintEvent *pe )
97{ 97{
98 QPainter p( this ); 98 QPainter p( this );
99 99
100 if ( mediaPlayerState.isFullscreen() ) { 100 if ( mediaPlayerState.isFullscreen() ) {
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 4bd8760..0fe4772 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -93,25 +93,25 @@ public slots:
93signals: 93signals:
94 void moreReleased(); 94 void moreReleased();
95 void lessReleased(); 95 void lessReleased();
96 void forwardReleased(); 96 void forwardReleased();
97 void backReleased(); 97 void backReleased();
98 void forwardClicked(); 98 void forwardClicked();
99 void backClicked(); 99 void backClicked();
100 void moreClicked(); 100 void moreClicked();
101 void lessClicked(); 101 void lessClicked();
102 102
103protected: 103protected:
104 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 104 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
105 const Skin &skin, const QSize &buttonAreaSize ); 105 const Skin &skin );
106 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); 106 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin );
107 107
108 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); 108 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null );
109 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ); 109 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix );
110 110
111 virtual void closeEvent( QCloseEvent * ); 111 virtual void closeEvent( QCloseEvent * );
112 112
113 virtual void paintEvent( QPaintEvent *pe ); 113 virtual void paintEvent( QPaintEvent *pe );
114 114
115 Button *buttonAt( const QPoint &position ); 115 Button *buttonAt( const QPoint &position );
116 116
117 virtual void mousePressEvent( QMouseEvent *event ); 117 virtual void mousePressEvent( QMouseEvent *event );
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index ef70957..d3918d1 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -1,60 +1,59 @@
1 1
2#include "skin.h" 2#include "skin.h"
3 3
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6Skin::Skin( const QString &name, const QString &fileNameInfix ) 6Skin::Skin( const QString &name, const QString &fileNameInfix )
7 : m_name( name ), m_fileNameInfix( fileNameInfix ) 7 : m_name( name ), m_fileNameInfix( fileNameInfix )
8{ 8{
9 m_skinPath = "opieplayer2/skins/" + name; 9 m_skinPath = "opieplayer2/skins/" + name;
10} 10}
11 11
12void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) 12void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount )
13{ 13{
14 backgroundImage(); 14 backgroundImage();
15 buttonUpImage(); 15 buttonUpImage();
16 buttonDownImage(); 16 buttonDownImage();
17 ( void )buttonMask( skinButtonInfo, buttonCount, buttonAreaSize ); 17 ( void )buttonMask( skinButtonInfo, buttonCount );
18} 18}
19 19
20QImage Skin::backgroundImage() const 20QImage Skin::backgroundImage() const
21{ 21{
22 if ( m_backgroundImage.isNull() ) 22 if ( m_backgroundImage.isNull() )
23 m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); 23 m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) );
24 return m_backgroundImage; 24 return m_backgroundImage;
25} 25}
26 26
27QImage Skin::buttonUpImage() const 27QImage Skin::buttonUpImage() const
28{ 28{
29 if ( m_buttonUpImage.isNull() ) 29 if ( m_buttonUpImage.isNull() )
30 m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); 30 m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) );
31 return m_buttonUpImage; 31 return m_buttonUpImage;
32} 32}
33 33
34QImage Skin::buttonDownImage() const 34QImage Skin::buttonDownImage() const
35{ 35{
36 if ( m_buttonDownImage.isNull() ) 36 if ( m_buttonDownImage.isNull() )
37 m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); 37 m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) );
38 return m_buttonDownImage; 38 return m_buttonDownImage;
39} 39}
40 40
41QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) const 41QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const
42{ 42{
43 if ( buttonAreaSize != m_buttonMask.size() )
44 m_buttonMask = QImage();
45
46 if ( !m_buttonMask.isNull() ) 43 if ( !m_buttonMask.isNull() )
47 return m_buttonMask; 44 return m_buttonMask;
48 45
46 QSize buttonAreaSize = buttonUpImage().size();
47
49 m_buttonMask = QImage( buttonAreaSize, 8, 255 ); 48 m_buttonMask = QImage( buttonAreaSize, 8, 255 );
50 m_buttonMask.fill( 0 ); 49 m_buttonMask.fill( 0 );
51 50
52 for ( uint i = 0; i < buttonCount; ++i ) 51 for ( uint i = 0; i < buttonCount; ++i )
53 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); 52 addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) );
54 53
55 return m_buttonMask; 54 return m_buttonMask;
56} 55}
57 56
58void Skin::addButtonToMask( int tag, const QImage &maskImage ) const 57void Skin::addButtonToMask( int tag, const QImage &maskImage ) const
59{ 58{
60 if ( maskImage.isNull() ) 59 if ( maskImage.isNull() )
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
index 14873e7..ee19f4b 100644
--- a/noncore/multimedia/opieplayer2/skin.h
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -3,31 +3,31 @@
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qimage.h> 5#include <qimage.h>
6#include <qmap.h> 6#include <qmap.h>
7 7
8#include "mediawidget.h" 8#include "mediawidget.h"
9 9
10class Skin 10class Skin
11{ 11{
12public: 12public:
13 Skin( const QString &name, const QString &fileNameInfix ); 13 Skin( const QString &name, const QString &fileNameInfix );
14 14
15 void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ); 15 void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount );
16 16
17 QImage backgroundImage() const; 17 QImage backgroundImage() const;
18 QImage buttonUpImage() const; 18 QImage buttonUpImage() const;
19 QImage buttonDownImage() const; 19 QImage buttonDownImage() const;
20 20
21 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) const; 21 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const;
22 22
23 QImage buttonMaskImage( const QString &fileName ) const; 23 QImage buttonMaskImage( const QString &fileName ) const;
24 24
25private: 25private:
26 void addButtonToMask( int tag, const QImage &maskImage ) const; 26 void addButtonToMask( int tag, const QImage &maskImage ) const;
27 27
28 QString m_name; 28 QString m_name;
29 QString m_fileNameInfix; 29 QString m_fileNameInfix;
30 QString m_skinPath; 30 QString m_skinPath;
31 31
32 typedef QMap<QString, QImage> ButtonMaskImageMap; 32 typedef QMap<QString, QImage> ButtonMaskImageMap;
33 33