summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index df03b22..a9dddf8 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -23,48 +23,59 @@
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
36{
37 struct simpleAndStupidAllocator
38 {
39 static void *allocate( size_t amount )
40 { return ::operator new( amount ); }
41 static void deallocate( void *p, size_t )
42 { ::operator delete( p ); }
43 };
44}
45
35class MediaWidget : public QWidget 46class MediaWidget : public QWidget
36{ 47{
37 Q_OBJECT 48 Q_OBJECT
38public: 49public:
39 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; 50 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
40 enum ButtonType { NormalButton, ToggleButton }; 51 enum ButtonType { NormalButton, ToggleButton };
41 52
42 struct Button 53 struct Button
43 { 54 {
44 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} 55 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {}
45 56
46 Command command; 57 Command command;
47 58
48 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( 59 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
49 bool isDown : 1; 60 bool isDown : 1;
50 61
51 QBitmap mask; 62 QBitmap mask;
52 QPixmap pixUp; 63 QPixmap pixUp;
53 QPixmap pixDown; 64 QPixmap pixDown;
54 }; 65 };
55#if defined( _CC_GNU_ ) 66#if defined( _CC_GNU_ )
56 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because 67 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because
57 // in the BAD_ALLOC macro it uses std::cerr and friends :-( 68 // in the BAD_ALLOC macro it uses std::cerr and friends :-(
58 typedef std::vector<Button, std::__allocator<Button, std::__new_alloc> > ButtonVector; 69 typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector;
59#else 70#else
60 typedef std::vector<Button> ButtonVector; 71 typedef std::vector<Button> ButtonVector;
61#endif 72#endif
62 73
63 struct SkinButtonInfo 74 struct SkinButtonInfo
64 { 75 {
65 Command command; 76 Command command;
66 const char *fileName; 77 const char *fileName;
67 ButtonType type; 78 ButtonType type;
68 }; 79 };
69 80
70 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 81 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );