summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 17:38:55 (UTC)
committer simon <simon>2002-12-11 17:38:55 (UTC)
commit719acab56c57f283168b955582ab5b30b9809b02 (patch) (unidiff)
tree370c9f8bae6741b0ee2303b6c04f9329757a8a3e
parentaaac5c934e7053fa4323b03f7ea31c32c6388883 (diff)
downloadopie-719acab56c57f283168b955582ab5b30b9809b02.zip
opie-719acab56c57f283168b955582ab5b30b9809b02.tar.gz
opie-719acab56c57f283168b955582ab5b30b9809b02.tar.bz2
- copyright notice fixlet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h14
-rw-r--r--noncore/multimedia/opieplayer2/singleton.h19
-rw-r--r--noncore/multimedia/opieplayer2/skin.cpp21
-rw-r--r--noncore/multimedia/opieplayer2/skin.h22
5 files changed, 76 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index c0106d4..702e6d7 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,71 +1,70 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23
24#include "mediawidget.h" 23#include "mediawidget.h"
25#include "playlistwidget.h" 24#include "playlistwidget.h"
26#include "skin.h" 25#include "skin.h"
27 26
28MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 27MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
29 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 28 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
30{ 29{
31 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 30 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
32 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 31 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
33 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 32 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
34 this, SLOT( setLength( long ) ) ); 33 this, SLOT( setLength( long ) ) );
35 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 34 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
36 this, SLOT( setPlaying( bool ) ) ); 35 this, SLOT( setPlaying( bool ) ) );
37} 36}
38 37
39MediaWidget::~MediaWidget() 38MediaWidget::~MediaWidget()
40{ 39{
41} 40}
42 41
43void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 42void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
44 const Skin &skin ) 43 const Skin &skin )
45{ 44{
46 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 45 buttonMask = skin.buttonMask( skinInfo, buttonCount );
47 46
48 buttons.clear(); 47 buttons.clear();
49 buttons.reserve( buttonCount ); 48 buttons.reserve( buttonCount );
50 49
51 for ( uint i = 0; i < buttonCount; ++i ) { 50 for ( uint i = 0; i < buttonCount; ++i ) {
52 Button button = setupButton( skinInfo[ i ], skin ); 51 Button button = setupButton( skinInfo[ i ], skin );
53 buttons.push_back( button ); 52 buttons.push_back( button );
54 } 53 }
55} 54}
56 55
57MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 56MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
58{ 57{
59 Button button; 58 Button button;
60 button.command = buttonInfo.command; 59 button.command = buttonInfo.command;
61 button.type = buttonInfo.type; 60 button.type = buttonInfo.type;
62 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 61 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
63 62
64 return button; 63 return button;
65} 64}
66 65
67void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 66void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
68{ 67{
69 Skin skin( guiInfo.fileNameInfix ); 68 Skin skin( guiInfo.fileNameInfix );
70 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 69 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
71} 70}
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 64483d8..40eb0af 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,66 +1,66 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#ifndef MEDIAWIDGET_H 23#ifndef MEDIAWIDGET_H
24#define MEDIAWIDGET_H 24#define MEDIAWIDGET_H
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qmap.h> 27#include <qmap.h>
28 28
29#include "mediaplayerstate.h" 29#include "mediaplayerstate.h"
30#include "playlistwidget.h" 30#include "playlistwidget.h"
31 31
32#include <vector> 32#include <vector>
33#include <memory> 33#include <memory>
34 34
35namespace 35namespace
36{ 36{
37 struct simpleAndStupidAllocator 37 struct simpleAndStupidAllocator
38 { 38 {
39 static void *allocate( size_t amount ) 39 static void *allocate( size_t amount )
40 { return ::operator new( amount ); } 40 { return ::operator new( amount ); }
41 static void deallocate( void *p, size_t ) 41 static void deallocate( void *p, size_t )
42 { ::operator delete( p ); } 42 { ::operator delete( p ); }
43 }; 43 };
44} 44}
45 45
46class Skin; 46class Skin;
47 47
48class MediaWidget : public QWidget 48class MediaWidget : public QWidget
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51public: 51public:
52 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; 52 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
53 enum ButtonType { NormalButton, ToggleButton }; 53 enum ButtonType { NormalButton, ToggleButton };
54 54
55 struct Button 55 struct Button
56 { 56 {
57 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} 57 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {}
58 58
59 Command command; 59 Command command;
60 60
61 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( 61 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
62 bool isDown : 1; 62 bool isDown : 1;
63 63
64 QBitmap mask; 64 QBitmap mask;
65 QPixmap pixUp; 65 QPixmap pixUp;
66 QPixmap pixDown; 66 QPixmap pixDown;
diff --git a/noncore/multimedia/opieplayer2/singleton.h b/noncore/multimedia/opieplayer2/singleton.h
index 35b3dff..83e228f 100644
--- a/noncore/multimedia/opieplayer2/singleton.h
+++ b/noncore/multimedia/opieplayer2/singleton.h
@@ -1,48 +1,67 @@
1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18*/
19
1#ifndef SINGLETON_H 20#ifndef SINGLETON_H
2#define SINGLETON_H 21#define SINGLETON_H
3 22
4template <class Product> 23template <class Product>
5struct DefaultSingletonCreator 24struct DefaultSingletonCreator
6{ 25{
7 static Product *create() { return new Product; } 26 static Product *create() { return new Product; }
8}; 27};
9 28
10template <class Product> 29template <class Product>
11struct NullSingletonCreator 30struct NullSingletonCreator
12{ 31{
13 static Product *create() { return 0; } 32 static Product *create() { return 0; }
14}; 33};
15 34
16template 35template
17< 36<
18 class T, 37 class T,
19 template <class> class Creator = DefaultSingletonCreator 38 template <class> class Creator = DefaultSingletonCreator
20> 39>
21class Singleton 40class Singleton
22{ 41{
23public: 42public:
24 static T &self() 43 static T &self()
25 { 44 {
26 if ( !s_self ) 45 if ( !s_self )
27 s_self = Creator<T>::create(); 46 s_self = Creator<T>::create();
28 return *s_self; 47 return *s_self;
29 } 48 }
30 49
31protected: 50protected:
32 Singleton() 51 Singleton()
33 { s_self = static_cast<T *>( this ); } 52 { s_self = static_cast<T *>( this ); }
34 ~Singleton() 53 ~Singleton()
35 { s_self = 0; } 54 { s_self = 0; }
36 55
37private: 56private:
38 Singleton( const Singleton<T, Creator> &rhs ); 57 Singleton( const Singleton<T, Creator> &rhs );
39 Singleton<T, Creator> &operator=( const Singleton<T, Creator> &rhs ); 58 Singleton<T, Creator> &operator=( const Singleton<T, Creator> &rhs );
40 59
41 static T *s_self; 60 static T *s_self;
42}; 61};
43 62
44template <class T, template <class> class Creator> 63template <class T, template <class> class Creator>
45T *Singleton<T, Creator>::s_self = 0; 64T *Singleton<T, Creator>::s_self = 0;
46 65
47#endif // SINGLETON_H 66#endif // SINGLETON_H
48/* vim: et sw=4 ts=4 67/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/skin.cpp b/noncore/multimedia/opieplayer2/skin.cpp
index 0de3023..cef3259 100644
--- a/noncore/multimedia/opieplayer2/skin.cpp
+++ b/noncore/multimedia/opieplayer2/skin.cpp
@@ -1,48 +1,69 @@
1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
21*/
1 22
2#include "skin.h" 23#include "skin.h"
3 24
4#include <qpe/resource.h> 25#include <qpe/resource.h>
5#include <qpe/config.h> 26#include <qpe/config.h>
6 27
7#include <assert.h> 28#include <assert.h>
8 29
9Skin::Skin( const QString &name, const QString &fileNameInfix ) 30Skin::Skin( const QString &name, const QString &fileNameInfix )
10 : m_fileNameInfix( fileNameInfix ) 31 : m_fileNameInfix( fileNameInfix )
11{ 32{
12 init( name ); 33 init( name );
13} 34}
14 35
15Skin::Skin( const QString &fileNameInfix ) 36Skin::Skin( const QString &fileNameInfix )
16 : m_fileNameInfix( fileNameInfix ) 37 : m_fileNameInfix( fileNameInfix )
17{ 38{
18 init( defaultSkinName() ); 39 init( defaultSkinName() );
19} 40}
20 41
21void Skin::init( const QString &name ) 42void Skin::init( const QString &name )
22{ 43{
23 m_skinPath = "opieplayer2/skins/" + name; 44 m_skinPath = "opieplayer2/skins/" + name;
24} 45}
25 46
26void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) 47void Skin::preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount )
27{ 48{
28 backgroundImage(); 49 backgroundImage();
29 buttonUpImage(); 50 buttonUpImage();
30 buttonDownImage(); 51 buttonDownImage();
31 ( void )buttonMask( skinButtonInfo, buttonCount ); 52 ( void )buttonMask( skinButtonInfo, buttonCount );
32} 53}
33 54
34QImage Skin::backgroundImage() const 55QImage Skin::backgroundImage() const
35{ 56{
36 if ( m_backgroundImage.isNull() ) 57 if ( m_backgroundImage.isNull() )
37 m_backgroundImage = SkinCache::self().loadImage( QString( "%1/background" ).arg( m_skinPath ) ); 58 m_backgroundImage = SkinCache::self().loadImage( QString( "%1/background" ).arg( m_skinPath ) );
38 return m_backgroundImage; 59 return m_backgroundImage;
39} 60}
40 61
41QImage Skin::buttonUpImage() const 62QImage Skin::buttonUpImage() const
42{ 63{
43 if ( m_buttonUpImage.isNull() ) 64 if ( m_buttonUpImage.isNull() )
44 m_buttonUpImage = SkinCache::self().loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) ); 65 m_buttonUpImage = SkinCache::self().loadImage( QString( "%1/skin%2_up" ).arg( m_skinPath ).arg( m_fileNameInfix ) );
45 return m_buttonUpImage; 66 return m_buttonUpImage;
46} 67}
47 68
48QImage Skin::buttonDownImage() const 69QImage Skin::buttonDownImage() const
diff --git a/noncore/multimedia/opieplayer2/skin.h b/noncore/multimedia/opieplayer2/skin.h
index c15d9dc..9f7326e 100644
--- a/noncore/multimedia/opieplayer2/skin.h
+++ b/noncore/multimedia/opieplayer2/skin.h
@@ -1,48 +1,70 @@
1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
21*/
22
1#ifndef SKIN_H 23#ifndef SKIN_H
2#define SKIN_H 24#define SKIN_H
3 25
4#include <qstring.h> 26#include <qstring.h>
5#include <qimage.h> 27#include <qimage.h>
6#include <qmap.h> 28#include <qmap.h>
7#include <qdict.h> 29#include <qdict.h>
8 30
9#include "mediawidget.h" 31#include "mediawidget.h"
10#include "threadutil.h" 32#include "threadutil.h"
11#include "singleton.h" 33#include "singleton.h"
12 34
13class Skin 35class Skin
14{ 36{
15public: 37public:
16 Skin( const QString &name, const QString &fileNameInfix ); 38 Skin( const QString &name, const QString &fileNameInfix );
17 Skin( const QString &fileNameInfix ); 39 Skin( const QString &fileNameInfix );
18 40
19 void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ); 41 void preload( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount );
20 42
21 QImage backgroundImage() const; 43 QImage backgroundImage() const;
22 QImage buttonUpImage() const; 44 QImage buttonUpImage() const;
23 QImage buttonDownImage() const; 45 QImage buttonDownImage() const;
24 46
25 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const; 47 QImage buttonMask( const MediaWidget::SkinButtonInfo *skinButtonInfo, uint buttonCount ) const;
26 48
27 QImage buttonMaskImage( const QString &fileName ) const; 49 QImage buttonMaskImage( const QString &fileName ) const;
28 50
29 static QString defaultSkinName(); 51 static QString defaultSkinName();
30 52
31private: 53private:
32 void init( const QString &name ); 54 void init( const QString &name );
33 55
34 void addButtonToMask( int tag, const QImage &maskImage ) const; 56 void addButtonToMask( int tag, const QImage &maskImage ) const;
35 57
36 QString m_fileNameInfix; 58 QString m_fileNameInfix;
37 QString m_skinPath; 59 QString m_skinPath;
38 60
39 typedef QMap<QString, QImage> ButtonMaskImageMap; 61 typedef QMap<QString, QImage> ButtonMaskImageMap;
40 62
41 mutable QImage m_backgroundImage; 63 mutable QImage m_backgroundImage;
42 mutable QImage m_buttonUpImage; 64 mutable QImage m_buttonUpImage;
43 mutable QImage m_buttonDownImage; 65 mutable QImage m_buttonDownImage;
44 mutable QImage m_buttonMask; 66 mutable QImage m_buttonMask;
45 mutable ButtonMaskImageMap m_buttonMasks; 67 mutable ButtonMaskImageMap m_buttonMasks;
46 68
47 Skin( const Skin & ); 69 Skin( const Skin & );
48 Skin &operator=( const Skin & ); 70 Skin &operator=( const Skin & );