Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 45c46ea..8c3a467 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -11,88 +11,71 @@ | |||
11 | 11 | ||
12 | This program 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 | 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 General Public License | 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 | 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 | ||
35 | namespace | ||
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 | |||
46 | class Skin; | 35 | class Skin; |
47 | 36 | ||
48 | class MediaWidget : public QWidget | 37 | class MediaWidget : public QWidget |
49 | { | 38 | { |
50 | Q_OBJECT | 39 | Q_OBJECT |
51 | public: | 40 | public: |
52 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; | 41 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; |
53 | enum ButtonType { NormalButton, ToggleButton }; | 42 | enum ButtonType { NormalButton, ToggleButton }; |
54 | 43 | ||
55 | struct Button | 44 | struct Button |
56 | { | 45 | { |
57 | Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} | 46 | Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} |
58 | 47 | ||
59 | Command command; | 48 | Command command; |
60 | 49 | ||
61 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( | 50 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( |
62 | bool isDown : 1; | 51 | bool isDown : 1; |
63 | 52 | ||
64 | QBitmap mask; | 53 | QBitmap mask; |
65 | QPixmap pixUp; | 54 | QPixmap pixUp; |
66 | QPixmap pixDown; | 55 | QPixmap pixDown; |
67 | }; | 56 | }; |
68 | #if defined( _CC_GNU_ ) | ||
69 | // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because | ||
70 | // in the BAD_ALLOC macro it uses std::cerr and friends :-( | ||
71 | typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector; | ||
72 | #else | ||
73 | typedef std::vector<Button> ButtonVector; | 57 | typedef std::vector<Button> ButtonVector; |
74 | #endif | ||
75 | 58 | ||
76 | struct SkinButtonInfo | 59 | struct SkinButtonInfo |
77 | { | 60 | { |
78 | Command command; | 61 | Command command; |
79 | const char *fileName; | 62 | const char *fileName; |
80 | ButtonType type; | 63 | ButtonType type; |
81 | }; | 64 | }; |
82 | 65 | ||
83 | struct GUIInfo | 66 | struct GUIInfo |
84 | { | 67 | { |
85 | GUIInfo() : buttonInfo( 0 ), buttonCount( 0 ) {} | 68 | GUIInfo() : buttonInfo( 0 ), buttonCount( 0 ) {} |
86 | GUIInfo( const QString &_fileNameInfix, const SkinButtonInfo *_buttonInfo, const uint _buttonCount ) | 69 | GUIInfo( const QString &_fileNameInfix, const SkinButtonInfo *_buttonInfo, const uint _buttonCount ) |
87 | : fileNameInfix( _fileNameInfix ), buttonInfo( _buttonInfo ), buttonCount( _buttonCount ) | 70 | : fileNameInfix( _fileNameInfix ), buttonInfo( _buttonInfo ), buttonCount( _buttonCount ) |
88 | {} | 71 | {} |
89 | 72 | ||
90 | QString fileNameInfix; | 73 | QString fileNameInfix; |
91 | const SkinButtonInfo *buttonInfo; | 74 | const SkinButtonInfo *buttonInfo; |
92 | const uint buttonCount; | 75 | const uint buttonCount; |
93 | }; | 76 | }; |
94 | typedef QValueList<GUIInfo> GUIInfoList; | 77 | typedef QValueList<GUIInfo> GUIInfoList; |
95 | 78 | ||
96 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 79 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
97 | virtual ~MediaWidget(); | 80 | virtual ~MediaWidget(); |
98 | 81 | ||