summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 12:10:41 (UTC)
committer simon <simon>2002-12-11 12:10:41 (UTC)
commit381de1a3cfcc32dd7c0350329413f55dd9de9bb8 (patch) (side-by-side diff)
treea60ebc3af59e5d7c55c773a10652d86a709dafea
parent882ddb046c81bdee5eeca59fde7ec458ae522dc7 (diff)
downloadopie-381de1a3cfcc32dd7c0350329413f55dd9de9bb8.zip
opie-381de1a3cfcc32dd7c0350329413f55dd9de9bb8.tar.gz
opie-381de1a3cfcc32dd7c0350329413f55dd9de9bb8.tar.bz2
- more image loading functionality moved to the Skin class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/skin.h5
3 files changed, 17 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 617e0fe..2031b4d 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -96,26 +96,26 @@ void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCo
cfg.setGroup( "Options" );
QString skin = cfg.readEntry( "Skin","default" );
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 = QImage( Resource::loadImage( QString( "%1/skin%2_up" ).arg( skinPath ).arg( fileNameInfix ) ) );
- buttonDownImage = QImage( Resource::loadImage( QString( "%1/skin%2_down" ).arg( skinPath ).arg( fileNameInfix ) ) );
+ buttonUpImage = skin.buttonUpImage();
+ buttonDownImage = skin.buttonDownImage();
setupButtons( skinInfo, buttonCount,
skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
}
void MediaWidget::closeEvent( QCloseEvent * )
{
mediaPlayerState.setList();
}
void MediaWidget::paintEvent( QPaintEvent *pe )
{
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index 097b29a..352368f 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -5,14 +5,24 @@
Skin::Skin( const QString &name, const QString &fileNameInfix )
: m_name( name ), m_fileNameInfix( fileNameInfix )
{
m_skinPath = "opieplayer2/skins/" + name;
}
QImage Skin::backgroundImage() const
{
return QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) );
}
+QImage Skin::buttonUpImage() const
+{
+ return QImage( Resource::findPixmap( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) );
+}
+
+QImage Skin::buttonDownImage() const
+{
+ return QImage( Resource::findPixmap( QString( "%1/skin%2_down" ).arg( m_skinPath ).arg( m_fileNameInfix ) ) );
+}
+
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
index 3c09e43..85f9e57 100644
--- a/noncore/multimedia/opieplayer2/skin.h
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -1,22 +1,27 @@
#ifndef SKIN_H
#define SKIN_H
#include <qstring.h>
#include <qimage.h>
class Skin
{
public:
Skin( const QString &name, const QString &fileNameInfix );
QImage backgroundImage() const;
+ QImage buttonUpImage() const;
+ QImage buttonDownImage() const;
private:
QString m_name;
QString m_fileNameInfix;
QString m_skinPath;
+
+ Skin( const Skin & );
+ Skin &operator=( const Skin & );
};
#endif // SKIN_H
/* vim: et sw=4 ts=4
*/