summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro6
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp18
-rw-r--r--noncore/multimedia/opieplayer2/skin.h22
4 files changed, 48 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 70ef8d9..617e0fe 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -2,48 +2,49 @@
Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
(C) 2002 Max Reiss <harlekin@handhelds.org>
(C) 2002 L. Potter <ljp@llornkcor.com>
(C) 2002 Holger Freyther <zecke@handhelds.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "mediawidget.h"
#include "playlistwidget.h"
+#include "skin.h"
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
: QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
{
connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
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 QString &imagePrefix, const QSize &buttonAreaSize )
{
buttonMask = QImage( buttonAreaSize, 8, 255 );
buttonMask.fill( 0 );
@@ -79,50 +80,52 @@ QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fil
uchar **dest = buttonMask.jumpTable();
for ( int y = 0; y < buttonMask.height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < buttonMask.width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = command + 1;
}
// ### grmbl qt2. use constructor when switching to qt3.
QBitmap bm; bm = imgMask;
return bm;
}
void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix )
{
Config cfg( "OpiePlayer" );
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 = QPixmap( Resource::loadPixmap( QString( "%1/background" ).arg( skinPath ) ) );
+ 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 ) ) );
setupButtons( skinInfo, buttonCount,
skinPath + QString::fromLatin1( "/skin%1_mask_" ).arg( fileNameInfix ), buttonUpImage.size() );
}
void MediaWidget::closeEvent( QCloseEvent * )
{
mediaPlayerState.setList();
}
void MediaWidget::paintEvent( QPaintEvent *pe )
{
QPainter p( this );
if ( mediaPlayerState.isFullscreen() ) {
// Clear the background
p.setBrush( QBrush( Qt::black ) );
return;
}
if ( !pe->erased() ) {
// Combine with background and double buffer
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 8d549b6..e1bb879 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,25 +1,27 @@
TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt warn_on debug
DESTDIR = $(OPIEDIR)/bin
HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \
videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \
frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\
- alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h
+ alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \
+ skin.h
SOURCES = main.cpp \
playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \
videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \
frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \
playlistwidgetgui.cpp\
alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S \
- threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp
+ threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \
+ skin.cpp
TARGET = opieplayer2
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lpthread -lopie -lxine
MOC_DIR = qpeobj
OBJECTS_DIR = qpeobj
#INCLUDEPATH += $(OPIEDIR)/include
#DEPENDPATH += $(OPIEDIR)/include
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
new file mode 100644
index 0000000..097b29a
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -0,0 +1,18 @@
+
+#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;
+}
+
+QImage Skin::backgroundImage() const
+{
+ return QImage( Resource::findPixmap( QString( "%1/background" ).arg( m_skinPath ) ) );
+}
+
+/* vim: et sw=4 ts=4
+ */
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
new file mode 100644
index 0000000..3c09e43
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -0,0 +1,22 @@
+#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;
+
+private:
+ QString m_name;
+ QString m_fileNameInfix;
+ QString m_skinPath;
+};
+
+#endif // SKIN_H
+/* vim: et sw=4 ts=4
+ */