author | simon <simon> | 2002-12-09 14:22:05 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:22:05 (UTC) |
commit | 8746877e7ed89fc4c227d5d79d63c35c69ceacd6 (patch) (unidiff) | |
tree | 3e8b175d266dcf97062278af0592118b70af533d | |
parent | 2bcd5795a30de05820edaf253dc34717de498fca (diff) | |
download | opie-8746877e7ed89fc4c227d5d79d63c35c69ceacd6.zip opie-8746877e7ed89fc4c227d5d79d63c35c69ceacd6.tar.gz opie-8746877e7ed89fc4c227d5d79d63c35c69ceacd6.tar.bz2 |
- moving some variables to the base class
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 73ce1e5..332fb4b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,117 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef AUDIO_WIDGET_H | 34 | #ifndef AUDIO_WIDGET_H |
35 | #define AUDIO_WIDGET_H | 35 | #define AUDIO_WIDGET_H |
36 | 36 | ||
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qdrawutil.h> | 38 | #include <qdrawutil.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qslider.h> | 41 | #include <qslider.h> |
42 | #include <qframe.h> | 42 | #include <qframe.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qimage.h> | 44 | #include <qimage.h> |
45 | 45 | ||
46 | #include <opie/oticker.h> | 46 | #include <opie/oticker.h> |
47 | 47 | ||
48 | #include "mediawidget.h" | 48 | #include "mediawidget.h" |
49 | 49 | ||
50 | class QPixmap; | 50 | class QPixmap; |
51 | 51 | ||
52 | class AudioWidget : public MediaWidget { | 52 | class AudioWidget : public MediaWidget { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
56 | ~AudioWidget(); | 56 | ~AudioWidget(); |
57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
58 | public slots: | 58 | public slots: |
59 | void updateSlider( long, long ); | 59 | void updateSlider( long, long ); |
60 | void sliderPressed( ); | 60 | void sliderPressed( ); |
61 | void sliderReleased( ); | 61 | void sliderReleased( ); |
62 | void setLooping( bool b) { setToggleButton( Loop, b ); } | 62 | void setLooping( bool b) { setToggleButton( Loop, b ); } |
63 | void setPosition( long ); | 63 | void setPosition( long ); |
64 | void setSeekable( bool ); | 64 | void setSeekable( bool ); |
65 | 65 | ||
66 | public: | 66 | public: |
67 | virtual void setLength( long ); | 67 | virtual void setLength( long ); |
68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
70 | 70 | ||
71 | signals: | 71 | signals: |
72 | void moreClicked(); | 72 | void moreClicked(); |
73 | void lessClicked(); | 73 | void lessClicked(); |
74 | void forwardClicked(); | 74 | void forwardClicked(); |
75 | void backClicked(); | 75 | void backClicked(); |
76 | void sliderMoved(long); | 76 | void sliderMoved(long); |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | void doBlank(); | 79 | void doBlank(); |
80 | void doUnblank(); | 80 | void doUnblank(); |
81 | void paintEvent( QPaintEvent *pe ); | 81 | void paintEvent( QPaintEvent *pe ); |
82 | void showEvent( QShowEvent *se ); | 82 | void showEvent( QShowEvent *se ); |
83 | void resizeEvent( QResizeEvent *re ); | 83 | void resizeEvent( QResizeEvent *re ); |
84 | void mouseMoveEvent( QMouseEvent *event ); | 84 | void mouseMoveEvent( QMouseEvent *event ); |
85 | void mousePressEvent( QMouseEvent *event ); | 85 | void mousePressEvent( QMouseEvent *event ); |
86 | void mouseReleaseEvent( QMouseEvent *event ); | 86 | void mouseReleaseEvent( QMouseEvent *event ); |
87 | void timerEvent( QTimerEvent *event ); | 87 | void timerEvent( QTimerEvent *event ); |
88 | void keyReleaseEvent( QKeyEvent *e); | 88 | void keyReleaseEvent( QKeyEvent *e); |
89 | private slots: | 89 | private slots: |
90 | void skipFor(); | 90 | void skipFor(); |
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | typedef std::vector<QBitmap> MaskVector; | ||
95 | typedef std::vector<QPixmap> PixmapVector; | ||
96 | |||
97 | void setToggleButton( int, bool ); | 94 | void setToggleButton( int, bool ); |
98 | virtual void paintButton( QPainter &p, int i ); | 95 | virtual void paintButton( QPainter &p, int i ); |
99 | int skipDirection; | 96 | int skipDirection; |
100 | QString skin; | 97 | QString skin; |
101 | QPixmap pixBg; | 98 | QPixmap pixBg; |
102 | QImage imgUp; | 99 | QImage imgUp; |
103 | QImage imgDn; | 100 | QImage imgDn; |
104 | MaskVector masks; | ||
105 | PixmapVector buttonPixUp; | ||
106 | PixmapVector buttonPixDown; | ||
107 | 101 | ||
108 | OTicker songInfo; | 102 | OTicker songInfo; |
109 | QSlider slider; | 103 | QSlider slider; |
110 | QLineEdit time; | 104 | QLineEdit time; |
111 | bool isStreaming : 1; | 105 | bool isStreaming : 1; |
112 | bool audioSliderBeingMoved : 1; | 106 | bool audioSliderBeingMoved : 1; |
113 | }; | 107 | }; |
114 | 108 | ||
115 | 109 | ||
116 | #endif // AUDIO_WIDGET_H | 110 | #endif // AUDIO_WIDGET_H |
117 | 111 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 9fb3499..2641df6 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,95 +1,102 @@ | |||
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 | 27 | ||
28 | #include "mediaplayerstate.h" | 28 | #include "mediaplayerstate.h" |
29 | #include "playlistwidget.h" | 29 | #include "playlistwidget.h" |
30 | 30 | ||
31 | #include <vector> | 31 | #include <vector> |
32 | 32 | ||
33 | class MediaWidget : public QWidget | 33 | class MediaWidget : public QWidget |
34 | { | 34 | { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 37 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
38 | enum ButtonType { NormalButton, ToggleButton }; | 38 | enum ButtonType { NormalButton, ToggleButton }; |
39 | 39 | ||
40 | struct Button | 40 | struct Button |
41 | { | 41 | { |
42 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} | 42 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} |
43 | 43 | ||
44 | ButtonType type : 1; | 44 | ButtonType type : 1; |
45 | bool isHeld : 1; | 45 | bool isHeld : 1; |
46 | bool isDown : 1; | 46 | bool isDown : 1; |
47 | }; | 47 | }; |
48 | typedef std::vector<Button> ButtonVector; | 48 | typedef std::vector<Button> ButtonVector; |
49 | 49 | ||
50 | struct SkinButtonInfo | 50 | struct SkinButtonInfo |
51 | { | 51 | { |
52 | Command command; | 52 | Command command; |
53 | const char *fileName; | 53 | const char *fileName; |
54 | ButtonType type; | 54 | ButtonType type; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | typedef std::vector<QBitmap> MaskVector; | ||
58 | typedef std::vector<QPixmap> PixmapVector; | ||
59 | |||
57 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 60 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
58 | virtual ~MediaWidget(); | 61 | virtual ~MediaWidget(); |
59 | 62 | ||
60 | public slots: | 63 | public slots: |
61 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 64 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
62 | virtual void setLength( long length ) = 0; | 65 | virtual void setLength( long length ) = 0; |
63 | virtual void setPlaying( bool playing ) = 0; | 66 | virtual void setPlaying( bool playing ) = 0; |
64 | 67 | ||
65 | signals: | 68 | signals: |
66 | void moreReleased(); | 69 | void moreReleased(); |
67 | void lessReleased(); | 70 | void lessReleased(); |
68 | void forwardReleased(); | 71 | void forwardReleased(); |
69 | void backReleased(); | 72 | void backReleased(); |
70 | 73 | ||
71 | protected: | 74 | protected: |
72 | virtual void closeEvent( QCloseEvent * ); | 75 | virtual void closeEvent( QCloseEvent * ); |
73 | 76 | ||
74 | void handleCommand( Command command, bool buttonDown ); | 77 | void handleCommand( Command command, bool buttonDown ); |
75 | 78 | ||
76 | bool isOverButton( const QPoint &position, int buttonId ) const; | 79 | bool isOverButton( const QPoint &position, int buttonId ) const; |
77 | 80 | ||
78 | void paintButton( int buttonId ); | 81 | void paintButton( int buttonId ); |
79 | virtual void paintButton( QPainter &p, int i ) = 0; | 82 | virtual void paintButton( QPainter &p, int i ) = 0; |
80 | 83 | ||
81 | void toggleButton( int buttonId ); | 84 | void toggleButton( int buttonId ); |
82 | 85 | ||
83 | MediaPlayerState &mediaPlayerState; | 86 | MediaPlayerState &mediaPlayerState; |
84 | PlayListWidget &playList; | 87 | PlayListWidget &playList; |
85 | 88 | ||
86 | ButtonVector buttons; | 89 | ButtonVector buttons; |
87 | 90 | ||
88 | QImage buttonMask; | 91 | QImage buttonMask; |
89 | 92 | ||
93 | MaskVector masks; | ||
94 | PixmapVector buttonPixUp; | ||
95 | PixmapVector buttonPixDown; | ||
96 | |||
90 | QPoint upperLeftOfButtonMask; | 97 | QPoint upperLeftOfButtonMask; |
91 | }; | 98 | }; |
92 | 99 | ||
93 | #endif // MEDIAWIDGET_H | 100 | #endif // MEDIAWIDGET_H |
94 | /* vim: et sw=4 ts=4 | 101 | /* vim: et sw=4 ts=4 |
95 | */ | 102 | */ |