-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.cpp | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/skin.h | 4 |
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 @@ -41,15 +41,15 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla MediaWidget::~MediaWidget() { } void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, - const Skin &skin, const QSize &buttonAreaSize ) + const Skin &skin ) { - buttonMask = skin.buttonMask( skinInfo, buttonCount, buttonAreaSize ); + buttonMask = skin.buttonMask( skinInfo, buttonCount ); buttons.clear(); buttons.reserve( buttonCount ); for ( uint i = 0; i < buttonCount; ++i ) { Button button = setupButton( skinInfo[ i ], skin ); @@ -82,13 +82,13 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co QString skinPath = "opieplayer2/skins/" + name; backgroundPixmap = skin.backgroundImage(); buttonUpImage = skin.buttonUpImage(); buttonDownImage = skin.buttonDownImage(); - setupButtons( skinInfo, buttonCount, skin, buttonUpImage.size() ); + setupButtons( skinInfo, buttonCount, skin ); } void MediaWidget::closeEvent( QCloseEvent * ) { mediaPlayerState.setList(); } 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 @@ -99,13 +99,13 @@ signals: void backClicked(); void moreClicked(); void lessClicked(); protected: void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, - const Skin &skin, const QSize &buttonAreaSize ); + const Skin &skin ); Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ); virtual void closeEvent( QCloseEvent * ); 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 @@ -6,18 +6,18 @@ Skin::Skin( const QString &name, const QString &fileNameInfix ) : m_name( name ), m_fileNameInfix( fileNameInfix ) { m_skinPath = "opieplayer2/skins/" + name; } -void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) +void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) { backgroundImage(); buttonUpImage(); buttonDownImage(); - ( void )buttonMask( skinButtonInfo, buttonCount, buttonAreaSize ); + ( void )buttonMask( skinButtonInfo, buttonCount ); } QImage Skin::backgroundImage() const { if ( m_backgroundImage.isNull() ) m_backgroundImage = QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) ); @@ -35,20 +35,19 @@ QImage Skin::buttonDownImage() const { if ( m_buttonDownImage.isNull() ) m_buttonDownImage = QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) ); return m_buttonDownImage; } -QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) const +QImage Skin::buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const { - if ( buttonAreaSize != m_buttonMask.size() ) - m_buttonMask = QImage(); - if ( !m_buttonMask.isNull() ) return m_buttonMask; + QSize buttonAreaSize = buttonUpImage().size(); + m_buttonMask = QImage( buttonAreaSize, 8, 255 ); m_buttonMask.fill( 0 ); for ( uint i = 0; i < buttonCount; ++i ) addButtonToMask( skinButtonInfo[ i ].command + 1, buttonMaskImage( skinButtonInfo[ i ].fileName ) ); 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 @@ -9,19 +9,19 @@ class Skin { public: Skin( const QString &name, const QString &fileNameInfix ); - void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ); + void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); QImage backgroundImage() const; QImage buttonUpImage() const; QImage buttonDownImage() const; - QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount, const QSize &buttonAreaSize ) const; + QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; QImage buttonMaskImage( const QString &fileName ) const; private: void addButtonToMask( int tag, const QImage &maskImage ) const; |