summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 12:53:29 (UTC)
committer simon <simon>2002-12-11 12:53:29 (UTC)
commit9b8e5d7c225ac2dd399e392d57e3d19348412e1a (patch) (side-by-side diff)
tree463674357359136235c75703edafe109e6515d16
parentdd6a6d5345e191ffa6da3e015c4e024bd8ca67b7 (diff)
downloadopie-9b8e5d7c225ac2dd399e392d57e3d19348412e1a.zip
opie-9b8e5d7c225ac2dd399e392d57e3d19348412e1a.tar.gz
opie-9b8e5d7c225ac2dd399e392d57e3d19348412e1a.tar.bz2
- slight simplification in the API
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
this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
this, SLOT( setLength( long ) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
this, SLOT( setPlaying( bool ) ) );
}
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 );
buttons.push_back( button );
}
}
MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
{
@@ -76,25 +76,25 @@ void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCo
loadSkin( skinInfo, buttonCount, skin, fileNameInfix );
}
void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix )
{
Skin skin( name, fileNameInfix );
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();
}
void MediaWidget::paintEvent( QPaintEvent *pe )
{
QPainter p( this );
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:
signals:
void moreReleased();
void lessReleased();
void forwardReleased();
void backReleased();
void forwardClicked();
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 * );
virtual void paintEvent( QPaintEvent *pe );
Button *buttonAt( const QPoint &position );
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 @@
#include "skin.h"
#include <qpe/resource.h>
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 ) ) );
return m_backgroundImage;
}
QImage Skin::buttonUpImage() const
{
if ( m_buttonUpImage.isNull() )
m_buttonUpImage = QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) );
return m_buttonUpImage;
}
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 ) );
return m_buttonMask;
}
void Skin::addButtonToMask( int tag, const QImage &maskImage ) const
{
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 @@
#include <qstring.h>
#include <qimage.h>
#include <qmap.h>
#include "mediawidget.h"
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;
QString m_name;
QString m_fileNameInfix;
QString m_skinPath;
typedef QMap<QString, QImage> ButtonMaskImageMap;