-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 8c781e9..3b3a263 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,130 +1,129 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
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 library 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 Library 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 library 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 | Library 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 Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. 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 | 33 | ||
34 | class MediaWidget : public QWidget | 34 | class MediaWidget : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; | 38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; |
39 | enum ButtonType { NormalButton, ToggleButton }; | 39 | enum ButtonType { NormalButton, ToggleButton }; |
40 | 40 | ||
41 | struct Button | 41 | struct Button |
42 | { | 42 | { |
43 | Button() : command( Undefined ), type( NormalButton ), isHeld( false ), isDown( false ) {} | 43 | Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} |
44 | 44 | ||
45 | Command command; | 45 | Command command; |
46 | 46 | ||
47 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( | 47 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( |
48 | bool isHeld : 1; | ||
49 | bool isDown : 1; | 48 | bool isDown : 1; |
50 | 49 | ||
51 | QBitmap mask; | 50 | QBitmap mask; |
52 | QPixmap pixUp; | 51 | QPixmap pixUp; |
53 | QPixmap pixDown; | 52 | QPixmap pixDown; |
54 | }; | 53 | }; |
55 | typedef std::vector<Button> ButtonVector; | 54 | typedef std::vector<Button> ButtonVector; |
56 | 55 | ||
57 | struct SkinButtonInfo | 56 | struct SkinButtonInfo |
58 | { | 57 | { |
59 | Command command; | 58 | Command command; |
60 | const char *fileName; | 59 | const char *fileName; |
61 | ButtonType type; | 60 | ButtonType type; |
62 | }; | 61 | }; |
63 | 62 | ||
64 | typedef std::vector<QBitmap> MaskVector; | 63 | typedef std::vector<QBitmap> MaskVector; |
65 | typedef std::vector<QPixmap> PixmapVector; | 64 | typedef std::vector<QPixmap> PixmapVector; |
66 | 65 | ||
67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 66 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
68 | virtual ~MediaWidget(); | 67 | virtual ~MediaWidget(); |
69 | 68 | ||
70 | public slots: | 69 | public slots: |
71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 70 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
72 | virtual void setLength( long length ) = 0; | 71 | virtual void setLength( long length ) = 0; |
73 | virtual void setPlaying( bool playing ) = 0; | 72 | virtual void setPlaying( bool playing ) = 0; |
74 | 73 | ||
75 | virtual void loadSkin() = 0; | 74 | virtual void loadSkin() = 0; |
76 | 75 | ||
77 | signals: | 76 | signals: |
78 | void moreReleased(); | 77 | void moreReleased(); |
79 | void lessReleased(); | 78 | void lessReleased(); |
80 | void forwardReleased(); | 79 | void forwardReleased(); |
81 | void backReleased(); | 80 | void backReleased(); |
82 | void forwardClicked(); | 81 | void forwardClicked(); |
83 | void backClicked(); | 82 | void backClicked(); |
84 | void moreClicked(); | 83 | void moreClicked(); |
85 | void lessClicked(); | 84 | void lessClicked(); |
86 | 85 | ||
87 | protected: | 86 | protected: |
88 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 87 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
89 | const QString &imagePrefix, const QSize &buttonAreaSize ); | 88 | const QString &imagePrefix, const QSize &buttonAreaSize ); |
90 | Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); | 89 | Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); |
91 | QBitmap setupButtonMask( const Command &command, const QString &fileName ); | 90 | QBitmap setupButtonMask( const Command &command, const QString &fileName ); |
92 | 91 | ||
93 | virtual void closeEvent( QCloseEvent * ); | 92 | virtual void closeEvent( QCloseEvent * ); |
94 | 93 | ||
95 | virtual void paintEvent( QPaintEvent *pe ); | 94 | virtual void paintEvent( QPaintEvent *pe ); |
96 | 95 | ||
97 | Button *buttonAt( const QPoint &position ); | 96 | Button *buttonAt( const QPoint &position ); |
98 | 97 | ||
99 | virtual void mousePressEvent( QMouseEvent *event ); | 98 | virtual void mousePressEvent( QMouseEvent *event ); |
100 | virtual void mouseReleaseEvent( QMouseEvent *event ); | 99 | virtual void mouseReleaseEvent( QMouseEvent *event ); |
101 | 100 | ||
102 | virtual void makeVisible(); | 101 | virtual void makeVisible(); |
103 | 102 | ||
104 | void handleCommand( Command command, bool buttonDown ); | 103 | void handleCommand( Command command, bool buttonDown ); |
105 | 104 | ||
106 | bool isOverButton( const QPoint &position, int buttonId ) const; | 105 | bool isOverButton( const QPoint &position, int buttonId ) const; |
107 | 106 | ||
108 | void paintAllButtons( QPainter &p ); | 107 | void paintAllButtons( QPainter &p ); |
109 | void paintButton( const Button &button ); | 108 | void paintButton( const Button &button ); |
110 | void paintButton( QPainter &p, const Button &button ); | 109 | void paintButton( QPainter &p, const Button &button ); |
111 | 110 | ||
112 | void setToggleButton( Button &button, bool down ); | 111 | void setToggleButton( Button &button, bool down ); |
113 | void setToggleButton( Command command, bool down ); | 112 | void setToggleButton( Command command, bool down ); |
114 | void toggleButton( Button &button ); | 113 | void toggleButton( Button &button ); |
115 | 114 | ||
116 | MediaPlayerState &mediaPlayerState; | 115 | MediaPlayerState &mediaPlayerState; |
117 | PlayListWidget &playList; | 116 | PlayListWidget &playList; |
118 | 117 | ||
119 | ButtonVector buttons; | 118 | ButtonVector buttons; |
120 | 119 | ||
121 | QImage buttonMask; | 120 | QImage buttonMask; |
122 | 121 | ||
123 | QPoint upperLeftOfButtonMask; | 122 | QPoint upperLeftOfButtonMask; |
124 | 123 | ||
125 | QPixmap backgroundPixmap; | 124 | QPixmap backgroundPixmap; |
126 | }; | 125 | }; |
127 | 126 | ||
128 | #endif // MEDIAWIDGET_H | 127 | #endif // MEDIAWIDGET_H |
129 | /* vim: et sw=4 ts=4 | 128 | /* vim: et sw=4 ts=4 |
130 | */ | 129 | */ |