-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 17 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 2 |
2 files changed, 1 insertions, 18 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 | |||
@@ -1,168 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <simon@lst.de> | 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 program 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 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 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 | ||
99 | public slots: | 82 | public slots: |
100 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 83 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
101 | virtual void setLength( long length ) = 0; | 84 | virtual void setLength( long length ) = 0; |
102 | virtual void setPlaying( bool playing ) = 0; | 85 | virtual void setPlaying( bool playing ) = 0; |
103 | 86 | ||
104 | virtual void loadSkin() = 0; | 87 | virtual void loadSkin() = 0; |
105 | 88 | ||
106 | signals: | 89 | signals: |
107 | void moreReleased(); | 90 | void moreReleased(); |
108 | void lessReleased(); | 91 | void lessReleased(); |
109 | void forwardReleased(); | 92 | void forwardReleased(); |
110 | void backReleased(); | 93 | void backReleased(); |
111 | void forwardClicked(); | 94 | void forwardClicked(); |
112 | void backClicked(); | 95 | void backClicked(); |
113 | void moreClicked(); | 96 | void moreClicked(); |
114 | void lessClicked(); | 97 | void lessClicked(); |
115 | 98 | ||
116 | protected: | 99 | protected: |
117 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 100 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
118 | const Skin &skin ); | 101 | const Skin &skin ); |
119 | Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); | 102 | Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); |
120 | 103 | ||
121 | void loadDefaultSkin( const GUIInfo &guiInfo ); | 104 | void loadDefaultSkin( const GUIInfo &guiInfo ); |
122 | void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ); | 105 | void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ); |
123 | 106 | ||
124 | virtual void closeEvent( QCloseEvent * ); | 107 | virtual void closeEvent( QCloseEvent * ); |
125 | 108 | ||
126 | virtual void paintEvent( QPaintEvent *pe ); | 109 | virtual void paintEvent( QPaintEvent *pe ); |
127 | 110 | ||
128 | virtual void resizeEvent( QResizeEvent *e ); | 111 | virtual void resizeEvent( QResizeEvent *e ); |
129 | 112 | ||
130 | Button *buttonAt( const QPoint &position ); | 113 | Button *buttonAt( const QPoint &position ); |
131 | 114 | ||
132 | virtual void mousePressEvent( QMouseEvent *event ); | 115 | virtual void mousePressEvent( QMouseEvent *event ); |
133 | virtual void mouseReleaseEvent( QMouseEvent *event ); | 116 | virtual void mouseReleaseEvent( QMouseEvent *event ); |
134 | 117 | ||
135 | virtual void makeVisible(); | 118 | virtual void makeVisible(); |
136 | 119 | ||
137 | void handleCommand( Command command, bool buttonDown ); | 120 | void handleCommand( Command command, bool buttonDown ); |
138 | 121 | ||
139 | bool isOverButton( const QPoint &position, int buttonId ) const; | 122 | bool isOverButton( const QPoint &position, int buttonId ) const; |
140 | 123 | ||
141 | void paintAllButtons( QPainter &p ); | 124 | void paintAllButtons( QPainter &p ); |
142 | void paintButton( const Button &button ); | 125 | void paintButton( const Button &button ); |
143 | void paintButton( QPainter &p, const Button &button ); | 126 | void paintButton( QPainter &p, const Button &button ); |
144 | 127 | ||
145 | void setToggleButton( Button &button, bool down ); | 128 | void setToggleButton( Button &button, bool down ); |
146 | void setToggleButton( Command command, bool down ); | 129 | void setToggleButton( Command command, bool down ); |
147 | void toggleButton( Button &button ); | 130 | void toggleButton( Button &button ); |
148 | 131 | ||
149 | MediaPlayerState &mediaPlayerState; | 132 | MediaPlayerState &mediaPlayerState; |
150 | PlayListWidget &playList; | 133 | PlayListWidget &playList; |
151 | 134 | ||
152 | ButtonVector buttons; | 135 | ButtonVector buttons; |
153 | 136 | ||
154 | QImage buttonMask; | 137 | QImage buttonMask; |
155 | 138 | ||
156 | QPoint upperLeftOfButtonMask; | 139 | QPoint upperLeftOfButtonMask; |
157 | 140 | ||
158 | QPixmap backgroundPixmap; | 141 | QPixmap backgroundPixmap; |
159 | QImage buttonUpImage; | 142 | QImage buttonUpImage; |
160 | QImage buttonDownImage; | 143 | QImage buttonDownImage; |
161 | 144 | ||
162 | static QPixmap combineImageWithBackground( const QImage &background, const QPixmap &pixmap, const QPoint &offset ); | 145 | static QPixmap combineImageWithBackground( const QImage &background, const QPixmap &pixmap, const QPoint &offset ); |
163 | static QPixmap addMaskToPixmap( const QPixmap &pix, const QBitmap &mask ); | 146 | static QPixmap addMaskToPixmap( const QPixmap &pix, const QBitmap &mask ); |
164 | }; | 147 | }; |
165 | 148 | ||
166 | #endif // MEDIAWIDGET_H | 149 | #endif // MEDIAWIDGET_H |
167 | /* vim: et sw=4 ts=4 | 150 | /* vim: et sw=4 ts=4 |
168 | */ | 151 | */ |
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 44af25f..a739692 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,47 +1,47 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ | 4 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ |
5 | videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \ | 5 | videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \ |
6 | frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ | 6 | frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ |
7 | alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \ | 7 | alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \ |
8 | skin.h | 8 | skin.h |
9 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ | 10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ |
11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \ |
12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ | 12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ |
13 | playlistwidgetgui.cpp\ | 13 | playlistwidgetgui.cpp\ |
14 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S \ | 14 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S \ |
15 | threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \ | 15 | threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \ |
16 | skin.cpp | 16 | skin.cpp |
17 | TARGET = opieplayer2 | 17 | TARGET = opieplayer2 |
18 | INCLUDEPATH += $(OPIEDIR)/include | 18 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH += $(OPIEDIR)/include | 19 | DEPENDPATH += $(OPIEDIR)/include |
20 | LIBS += -lqpe -lpthread -lopie -lxine | 20 | LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ |
21 | MOC_DIR = qpeobj | 21 | MOC_DIR = qpeobj |
22 | OBJECTS_DIR = qpeobj | 22 | OBJECTS_DIR = qpeobj |
23 | 23 | ||
24 | #INCLUDEPATH += $(OPIEDIR)/include | 24 | #INCLUDEPATH += $(OPIEDIR)/include |
25 | #DEPENDPATH += $(OPIEDIR)/include | 25 | #DEPENDPATH += $(OPIEDIR)/include |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ | 29 | TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ |
30 | ../../../i18n/da/opieplayer2.ts \ | 30 | ../../../i18n/da/opieplayer2.ts \ |
31 | ../../../i18n/xx/opieplayer2.ts \ | 31 | ../../../i18n/xx/opieplayer2.ts \ |
32 | ../../../i18n/en/opieplayer2.ts \ | 32 | ../../../i18n/en/opieplayer2.ts \ |
33 | ../../../i18n/es/opieplayer2.ts \ | 33 | ../../../i18n/es/opieplayer2.ts \ |
34 | ../../../i18n/fr/opieplayer2.ts \ | 34 | ../../../i18n/fr/opieplayer2.ts \ |
35 | ../../../i18n/hu/opieplayer2.ts \ | 35 | ../../../i18n/hu/opieplayer2.ts \ |
36 | ../../../i18n/ja/opieplayer2.ts \ | 36 | ../../../i18n/ja/opieplayer2.ts \ |
37 | ../../../i18n/ko/opieplayer2.ts \ | 37 | ../../../i18n/ko/opieplayer2.ts \ |
38 | ../../../i18n/no/opieplayer2.ts \ | 38 | ../../../i18n/no/opieplayer2.ts \ |
39 | ../../../i18n/pl/opieplayer2.ts \ | 39 | ../../../i18n/pl/opieplayer2.ts \ |
40 | ../../../i18n/pt/opieplayer2.ts \ | 40 | ../../../i18n/pt/opieplayer2.ts \ |
41 | ../../../i18n/pt_BR/opieplayer2.ts \ | 41 | ../../../i18n/pt_BR/opieplayer2.ts \ |
42 | ../../../i18n/sl/opieplayer2.ts \ | 42 | ../../../i18n/sl/opieplayer2.ts \ |
43 | ../../../i18n/zh_CN/opieplayer2.ts \ | 43 | ../../../i18n/zh_CN/opieplayer2.ts \ |
44 | ../../../i18n/zh_TW/opieplayer2.ts | 44 | ../../../i18n/zh_TW/opieplayer2.ts |
45 | 45 | ||
46 | 46 | ||
47 | include ( $(OPIEDIR)/include.pro ) | 47 | include ( $(OPIEDIR)/include.pro ) |