author | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-13 23:42:50 (UTC) |
commit | 6baf582094b418ec1defa2415210a7d7583628ff (patch) (unidiff) | |
tree | e7ee4a196eeb23a1b9276ab09f01aaf39ced83e3 | |
parent | 8abcf5a17d4ec31ad01557b69b8b0e7d97dc0c8f (diff) | |
download | opie-6baf582094b418ec1defa2415210a7d7583628ff.zip opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.gz opie-6baf582094b418ec1defa2415210a7d7583628ff.tar.bz2 |
fix video button actions.. still needs work
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 21 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 99 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 11 |
6 files changed, 105 insertions, 50 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8d8e4e5..a3238f0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,201 +1,202 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qwidgetstack.h> | 8 | #include <qwidgetstack.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | 10 | ||
11 | #include "mediaplayer.h" | 11 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 12 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "volumecontrol.h" | 14 | #include "volumecontrol.h" |
15 | 15 | ||
16 | #include "mediaplayerstate.h" | 16 | #include "mediaplayerstate.h" |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | extern AudioWidget *audioUI; | 20 | extern AudioWidget *audioUI; |
21 | extern PlayListWidget *playList; | 21 | extern PlayListWidget *playList; |
22 | extern MediaPlayerState *mediaPlayerState; | 22 | extern MediaPlayerState *mediaPlayerState; |
23 | 23 | ||
24 | 24 | ||
25 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 25 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
26 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 26 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
27 | 27 | ||
28 | 28 | ||
29 | xineControl = new XineControl(); | 29 | xineControl = new XineControl(); |
30 | // QPEApplication::grabKeyboard(); // EVIL | 30 | // QPEApplication::grabKeyboard(); // EVIL |
31 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 31 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
32 | 32 | ||
33 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 33 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
34 | |||
34 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 35 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
36 | |||
35 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 37 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
36 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 38 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
37 | 39 | ||
38 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 40 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
39 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 41 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
40 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 42 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
41 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 43 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
42 | 44 | ||
43 | volControl = new VolumeControl; | 45 | volControl = new VolumeControl; |
44 | 46 | ||
45 | } | 47 | } |
46 | 48 | ||
47 | MediaPlayer::~MediaPlayer() { | 49 | MediaPlayer::~MediaPlayer() { |
48 | delete xineControl; | 50 | delete xineControl; |
49 | delete volControl; | 51 | delete volControl; |
50 | } | 52 | } |
51 | 53 | ||
52 | void MediaPlayer::pauseCheck( bool b ) { | 54 | void MediaPlayer::pauseCheck( bool b ) { |
53 | // Only pause if playing | 55 | if ( b && !mediaPlayerState->playing() ) { |
54 | if ( b && !mediaPlayerState->playing() ) { | 56 | mediaPlayerState->setPaused( FALSE ); |
55 | mediaPlayerState->setPaused( FALSE ); | 57 | } |
56 | } | ||
57 | } | 58 | } |
58 | 59 | ||
59 | void MediaPlayer::play() { | 60 | void MediaPlayer::play() { |
60 | mediaPlayerState->setPlaying( FALSE ); | 61 | mediaPlayerState->setPlaying( FALSE ); |
61 | mediaPlayerState->setPlaying( TRUE ); | 62 | mediaPlayerState->setPlaying( TRUE ); |
62 | } | 63 | } |
63 | 64 | ||
64 | void MediaPlayer::setPlaying( bool play ) { | 65 | void MediaPlayer::setPlaying( bool play ) { |
65 | if ( !play ) { | 66 | if ( !play ) { |
66 | mediaPlayerState->setPaused( FALSE ); | 67 | mediaPlayerState->setPaused( FALSE ); |
67 | return; | 68 | return; |
68 | } | 69 | } |
69 | 70 | ||
70 | if ( mediaPlayerState->paused() ) { | 71 | if ( mediaPlayerState->paused() ) { |
71 | mediaPlayerState->setPaused( FALSE ); | 72 | mediaPlayerState->setPaused( FALSE ); |
72 | return; | 73 | return; |
73 | } | 74 | } |
74 | 75 | ||
75 | const DocLnk *playListCurrent = playList->current(); | 76 | const DocLnk *playListCurrent = playList->current(); |
76 | if ( playListCurrent != NULL ) { | 77 | if ( playListCurrent != NULL ) { |
77 | currentFile = playListCurrent; | 78 | currentFile = playListCurrent; |
78 | } | 79 | } |
79 | 80 | ||
80 | xineControl->play( currentFile->file() ); | 81 | xineControl->play( currentFile->file() ); |
81 | 82 | ||
82 | xineControl->length(); | 83 | xineControl->length(); |
83 | long seconds = mediaPlayerState->length();// | 84 | long seconds = mediaPlayerState->length();// |
84 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 85 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
85 | qDebug(time); | 86 | qDebug(time); |
86 | 87 | ||
87 | QString tickerText; | 88 | QString tickerText; |
88 | if( currentFile->file().left(4) == "http" ) | 89 | if( currentFile->file().left(4) == "http" ) |
89 | tickerText= tr( " File: " ) + currentFile->name(); | 90 | tickerText= tr( " File: " ) + currentFile->name(); |
90 | else | 91 | else |
91 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 92 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
92 | 93 | ||
93 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | 94 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); |
94 | 95 | ||
95 | // if ( !fileInfo.isEmpty() ) | 96 | // if ( !fileInfo.isEmpty() ) |
96 | // tickerText += ", " + fileInfo; | 97 | // tickerText += ", " + fileInfo; |
97 | // audioUI->setTickerText( tickerText + "." ); | 98 | // audioUI->setTickerText( tickerText + "." ); |
98 | 99 | ||
99 | audioUI->setTickerText( currentFile->file( ) ); | 100 | audioUI->setTickerText( currentFile->file( ) ); |
100 | 101 | ||
101 | } | 102 | } |
102 | 103 | ||
103 | 104 | ||
104 | void MediaPlayer::prev() { | 105 | void MediaPlayer::prev() { |
105 | if ( playList->prev() ) { | 106 | if ( playList->prev() ) { |
106 | play(); | 107 | play(); |
107 | } else if ( mediaPlayerState->looping() ) { | 108 | } else if ( mediaPlayerState->looping() ) { |
108 | if ( playList->last() ) { | 109 | if ( playList->last() ) { |
109 | play(); | 110 | play(); |
110 | } | 111 | } |
111 | } else { | 112 | } else { |
112 | mediaPlayerState->setList(); | 113 | mediaPlayerState->setList(); |
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
116 | 117 | ||
117 | void MediaPlayer::next() { | 118 | void MediaPlayer::next() { |
118 | if ( playList->next() ) { | 119 | if ( playList->next() ) { |
119 | play(); | 120 | play(); |
120 | } else if ( mediaPlayerState->looping() ) { | 121 | } else if ( mediaPlayerState->looping() ) { |
121 | if ( playList->first() ) { | 122 | if ( playList->first() ) { |
122 | play(); | 123 | play(); |
123 | } | 124 | } |
124 | } else { | 125 | } else { |
125 | mediaPlayerState->setList(); | 126 | mediaPlayerState->setList(); |
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
129 | 130 | ||
130 | void MediaPlayer::startDecreasingVolume() { | 131 | void MediaPlayer::startDecreasingVolume() { |
131 | volumeDirection = -1; | 132 | volumeDirection = -1; |
132 | startTimer( 100 ); | 133 | startTimer( 100 ); |
133 | volControl->decVol(2); | 134 | volControl->decVol(2); |
134 | } | 135 | } |
135 | 136 | ||
136 | 137 | ||
137 | void MediaPlayer::startIncreasingVolume() { | 138 | void MediaPlayer::startIncreasingVolume() { |
138 | volumeDirection = +1; | 139 | volumeDirection = +1; |
139 | startTimer( 100 ); | 140 | startTimer( 100 ); |
140 | volControl->incVol(2); | 141 | volControl->incVol(2); |
141 | } | 142 | } |
142 | 143 | ||
143 | 144 | ||
144 | bool drawnOnScreenDisplay = FALSE; | 145 | bool drawnOnScreenDisplay = FALSE; |
145 | unsigned int onScreenDisplayVolume = 0; | 146 | unsigned int onScreenDisplayVolume = 0; |
146 | const int yoff = 110; | 147 | const int yoff = 110; |
147 | 148 | ||
148 | void MediaPlayer::stopChangingVolume() { | 149 | void MediaPlayer::stopChangingVolume() { |
149 | killTimers(); | 150 | killTimers(); |
150 | // Get rid of the on-screen display stuff | 151 | // Get rid of the on-screen display stuff |
151 | drawnOnScreenDisplay = FALSE; | 152 | drawnOnScreenDisplay = FALSE; |
152 | onScreenDisplayVolume = 0; | 153 | onScreenDisplayVolume = 0; |
153 | int w = audioUI->width(); | 154 | int w = audioUI->width(); |
154 | int h = audioUI->height(); | 155 | int h = audioUI->height(); |
155 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 156 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
156 | } | 157 | } |
157 | 158 | ||
158 | 159 | ||
159 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 160 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
160 | if ( volumeDirection == +1 ) { | 161 | if ( volumeDirection == +1 ) { |
161 | volControl->incVol(2); | 162 | volControl->incVol(2); |
162 | } else if ( volumeDirection == -1 ) { | 163 | } else if ( volumeDirection == -1 ) { |
163 | volControl->decVol(2); | 164 | volControl->decVol(2); |
164 | } | 165 | } |
165 | 166 | ||
166 | 167 | ||
167 | // TODO FIXME | 168 | // TODO FIXME |
168 | int v; | 169 | int v; |
169 | v = volControl->getVolume(); | 170 | v = volControl->getVolume(); |
170 | v = v / 10; | 171 | v = v / 10; |
171 | 172 | ||
172 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 173 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
173 | return; | 174 | return; |
174 | } | 175 | } |
175 | 176 | ||
176 | int w = audioUI->width(); | 177 | int w = audioUI->width(); |
177 | int h = audioUI->height(); | 178 | int h = audioUI->height(); |
178 | 179 | ||
179 | if ( drawnOnScreenDisplay ) { | 180 | if ( drawnOnScreenDisplay ) { |
180 | if ( onScreenDisplayVolume > v ) { | 181 | if ( onScreenDisplayVolume > v ) { |
181 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 182 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
182 | } | 183 | } |
183 | } | 184 | } |
184 | 185 | ||
185 | drawnOnScreenDisplay = TRUE; | 186 | drawnOnScreenDisplay = TRUE; |
186 | onScreenDisplayVolume = v; | 187 | onScreenDisplayVolume = v; |
187 | 188 | ||
188 | QPainter p( audioUI ); | 189 | QPainter p( audioUI ); |
189 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 190 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
190 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 191 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
191 | 192 | ||
192 | QFont f; | 193 | QFont f; |
193 | f.setPixelSize( 20 ); | 194 | f.setPixelSize( 20 ); |
194 | f.setBold( TRUE ); | 195 | f.setBold( TRUE ); |
195 | p.setFont( f ); | 196 | p.setFont( f ); |
196 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 197 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
197 | 198 | ||
198 | for ( unsigned int i = 0; i < 10; i++ ) { | 199 | for ( unsigned int i = 0; i < 10; i++ ) { |
199 | if ( v > i ) { | 200 | if ( v > i ) { |
200 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 201 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
201 | } else { | 202 | } else { |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 57b1c81..bb8d905 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,272 +1,269 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qvaluelist.h> | 4 | #include <qvaluelist.h> |
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include "mediaplayerstate.h" | 7 | #include "mediaplayerstate.h" |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | //#define MediaPlayerDebug(x) qDebug x | 11 | //#define MediaPlayerDebug(x) qDebug x |
12 | #define MediaPlayerDebug(x) | 12 | #define MediaPlayerDebug(x) |
13 | 13 | ||
14 | 14 | ||
15 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 15 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
16 | : QObject( parent, name ) { | 16 | : QObject( parent, name ) { |
17 | Config cfg( "OpiePlayer" ); | 17 | Config cfg( "OpiePlayer" ); |
18 | readConfig( cfg ); | 18 | readConfig( cfg ); |
19 | 19 | ||
20 | } | 20 | } |
21 | 21 | ||
22 | 22 | ||
23 | MediaPlayerState::~MediaPlayerState() { | 23 | MediaPlayerState::~MediaPlayerState() { |
24 | Config cfg( "OpiePlayer" ); | 24 | Config cfg( "OpiePlayer" ); |
25 | writeConfig( cfg ); | 25 | writeConfig( cfg ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | void MediaPlayerState::readConfig( Config& cfg ) { | 30 | void MediaPlayerState::readConfig( Config& cfg ) { |
31 | cfg.setGroup("Options"); | 31 | cfg.setGroup("Options"); |
32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
33 | isScaled = cfg.readBoolEntry( "Scaling" ); | 33 | isScaled = cfg.readBoolEntry( "Scaling" ); |
34 | isLooping = cfg.readBoolEntry( "Looping" ); | 34 | isLooping = cfg.readBoolEntry( "Looping" ); |
35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
37 | usePlaylist = TRUE; | 37 | usePlaylist = TRUE; |
38 | isPlaying = FALSE; | 38 | isPlaying = FALSE; |
39 | isPaused = FALSE; | 39 | isPaused = FALSE; |
40 | curPosition = 0; | 40 | curPosition = 0; |
41 | curLength = 0; | 41 | curLength = 0; |
42 | curView = 'l'; | 42 | curView = 'l'; |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 46 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
47 | cfg.setGroup("Options"); | 47 | cfg.setGroup("Options"); |
48 | cfg.writeEntry("FullScreen", isFullscreen ); | 48 | cfg.writeEntry("FullScreen", isFullscreen ); |
49 | cfg.writeEntry("Scaling", isScaled ); | 49 | cfg.writeEntry("Scaling", isScaled ); |
50 | cfg.writeEntry("Looping", isLooping ); | 50 | cfg.writeEntry("Looping", isLooping ); |
51 | cfg.writeEntry("Shuffle", isShuffled ); | 51 | cfg.writeEntry("Shuffle", isShuffled ); |
52 | cfg.writeEntry("UsePlayList", usePlaylist ); | 52 | cfg.writeEntry("UsePlayList", usePlaylist ); |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | |||
57 | |||
58 | // public stuff | 56 | // public stuff |
59 | 57 | ||
60 | 58 | ||
61 | bool MediaPlayerState::streaming() { | 59 | bool MediaPlayerState::streaming() { |
62 | return isStreaming; | 60 | return isStreaming; |
63 | } | 61 | } |
64 | 62 | ||
65 | bool MediaPlayerState::fullscreen() { | 63 | bool MediaPlayerState::fullscreen() { |
66 | return isFullscreen; | 64 | return isFullscreen; |
67 | } | 65 | } |
68 | 66 | ||
69 | bool MediaPlayerState::scaled() { | 67 | bool MediaPlayerState::scaled() { |
70 | return isScaled; | 68 | return isScaled; |
71 | } | 69 | } |
72 | 70 | ||
73 | bool MediaPlayerState::looping() { | 71 | bool MediaPlayerState::looping() { |
74 | return isLooping; | 72 | return isLooping; |
75 | } | 73 | } |
76 | 74 | ||
77 | bool MediaPlayerState::shuffled() { | 75 | bool MediaPlayerState::shuffled() { |
78 | return isShuffled; | 76 | return isShuffled; |
79 | } | 77 | } |
80 | 78 | ||
81 | 79 | ||
82 | bool MediaPlayerState:: playlist() { | 80 | bool MediaPlayerState:: playlist() { |
83 | return usePlaylist; | 81 | return usePlaylist; |
84 | } | 82 | } |
85 | 83 | ||
86 | bool MediaPlayerState::paused() { | 84 | bool MediaPlayerState::paused() { |
87 | return isPaused; | 85 | return isPaused; |
88 | } | 86 | } |
89 | 87 | ||
90 | bool MediaPlayerState::playing() { | 88 | bool MediaPlayerState::playing() { |
91 | return isPlaying; | 89 | return isPlaying; |
92 | } | 90 | } |
93 | 91 | ||
94 | bool MediaPlayerState::stop() { | 92 | bool MediaPlayerState::stop() { |
95 | return isStoped; | 93 | return isStoped; |
96 | } | 94 | } |
97 | 95 | ||
98 | long MediaPlayerState::position() { | 96 | long MediaPlayerState::position() { |
99 | return curPosition; | 97 | return curPosition; |
100 | } | 98 | } |
101 | 99 | ||
102 | long MediaPlayerState::length() { | 100 | long MediaPlayerState::length() { |
103 | return curLength; | 101 | return curLength; |
104 | } | 102 | } |
105 | 103 | ||
106 | char MediaPlayerState::view() { | 104 | char MediaPlayerState::view() { |
107 | return curView; | 105 | return curView; |
108 | } | 106 | } |
109 | 107 | ||
110 | // slots | 108 | // slots |
111 | void MediaPlayerState::setIsStreaming( bool b ) { | 109 | void MediaPlayerState::setIsStreaming( bool b ) { |
112 | 110 | ||
113 | if ( isStreaming == b ) { | 111 | if ( isStreaming == b ) { |
114 | return; | 112 | return; |
115 | } | 113 | } |
116 | isStreaming = b; | 114 | isStreaming = b; |
117 | } | 115 | } |
118 | 116 | ||
119 | 117 | ||
120 | void MediaPlayerState::setFullscreen( bool b ) { | 118 | void MediaPlayerState::setFullscreen( bool b ) { |
121 | if ( isFullscreen == b ) { | 119 | if ( isFullscreen == b ) { |
122 | return; | 120 | return; |
123 | } | 121 | } |
124 | isFullscreen = b; | 122 | isFullscreen = b; |
125 | emit fullscreenToggled(b); | 123 | emit fullscreenToggled(b); |
126 | } | 124 | } |
127 | 125 | ||
128 | 126 | ||
129 | void MediaPlayerState::setScaled( bool b ) { | 127 | void MediaPlayerState::setScaled( bool b ) { |
130 | if ( isScaled == b ) { | 128 | if ( isScaled == b ) { |
131 | return; | 129 | return; |
132 | } | 130 | } |
133 | isScaled = b; | 131 | isScaled = b; |
134 | emit scaledToggled(b); | 132 | emit scaledToggled(b); |
135 | } | 133 | } |
136 | 134 | ||
137 | void MediaPlayerState::setLooping( bool b ) { | 135 | void MediaPlayerState::setLooping( bool b ) { |
138 | if ( isLooping == b ) { | 136 | if ( isLooping == b ) { |
139 | return; | 137 | return; |
140 | } | 138 | } |
141 | isLooping = b; | 139 | isLooping = b; |
142 | emit loopingToggled(b); | 140 | emit loopingToggled(b); |
143 | } | 141 | } |
144 | 142 | ||
145 | void MediaPlayerState::setShuffled( bool b ) { | 143 | void MediaPlayerState::setShuffled( bool b ) { |
146 | if ( isShuffled == b ) { | 144 | if ( isShuffled == b ) { |
147 | return; | 145 | return; |
148 | } | 146 | } |
149 | isShuffled = b; | 147 | isShuffled = b; |
150 | emit shuffledToggled(b); | 148 | emit shuffledToggled(b); |
151 | } | 149 | } |
152 | 150 | ||
153 | void MediaPlayerState::setPlaylist( bool b ) { | 151 | void MediaPlayerState::setPlaylist( bool b ) { |
154 | if ( usePlaylist == b ) { | 152 | if ( usePlaylist == b ) { |
155 | return; | 153 | return; |
156 | } | 154 | } |
157 | usePlaylist = b; | 155 | usePlaylist = b; |
158 | emit playlistToggled(b); | 156 | emit playlistToggled(b); |
159 | } | 157 | } |
160 | 158 | ||
161 | void MediaPlayerState::setPaused( bool b ) { | 159 | void MediaPlayerState::setPaused( bool b ) { |
162 | if(b) qDebug("setPaused true"); | 160 | if ( isPaused == b ) { |
163 | else qDebug("setPaused false"); | 161 | isPaused = FALSE; |
164 | 162 | emit pausedToggled(FALSE); | |
165 | if ( isPaused == b ) { | 163 | return; |
166 | return; | 164 | } |
167 | } | 165 | isPaused = b; |
168 | isPaused = b; | 166 | emit pausedToggled(b); |
169 | emit pausedToggled(b); | ||
170 | } | 167 | } |
171 | 168 | ||
172 | void MediaPlayerState::setPlaying( bool b ) { | 169 | void MediaPlayerState::setPlaying( bool b ) { |
173 | if ( isPlaying == b ) { | 170 | if ( isPlaying == b ) { |
174 | return; | 171 | return; |
175 | } | 172 | } |
176 | isPlaying = b; | 173 | isPlaying = b; |
177 | isStoped = !b; | 174 | isStoped = !b; |
178 | emit playingToggled(b); | 175 | emit playingToggled(b); |
179 | } | 176 | } |
180 | 177 | ||
181 | void MediaPlayerState::setStop( bool b ) { | 178 | void MediaPlayerState::setStop( bool b ) { |
182 | if ( isStoped == b ) { | 179 | if ( isStoped == b ) { |
183 | return; | 180 | return; |
184 | } | 181 | } |
185 | isStoped = b; | 182 | isStoped = b; |
186 | emit stopToggled(b); | 183 | emit stopToggled(b); |
187 | } | 184 | } |
188 | 185 | ||
189 | void MediaPlayerState::setPosition( long p ) { | 186 | void MediaPlayerState::setPosition( long p ) { |
190 | if ( curPosition == p ) { | 187 | if ( curPosition == p ) { |
191 | return; | 188 | return; |
192 | } | 189 | } |
193 | curPosition = p; | 190 | curPosition = p; |
194 | emit positionChanged(p); | 191 | emit positionChanged(p); |
195 | } | 192 | } |
196 | 193 | ||
197 | void MediaPlayerState::updatePosition( long p ){ | 194 | void MediaPlayerState::updatePosition( long p ){ |
198 | if ( curPosition == p ) { | 195 | if ( curPosition == p ) { |
199 | return; | 196 | return; |
200 | } | 197 | } |
201 | curPosition = p; | 198 | curPosition = p; |
202 | emit positionUpdated(p); | 199 | emit positionUpdated(p); |
203 | } | 200 | } |
204 | 201 | ||
205 | void MediaPlayerState::setLength( long l ) { | 202 | void MediaPlayerState::setLength( long l ) { |
206 | if ( curLength == l ) { | 203 | if ( curLength == l ) { |
207 | return; | 204 | return; |
208 | } | 205 | } |
209 | curLength = l; | 206 | curLength = l; |
210 | emit lengthChanged(l); | 207 | emit lengthChanged(l); |
211 | } | 208 | } |
212 | 209 | ||
213 | void MediaPlayerState::setView( char v ) { | 210 | void MediaPlayerState::setView( char v ) { |
214 | if ( curView == v ) { | 211 | if ( curView == v ) { |
215 | return; | 212 | return; |
216 | } | 213 | } |
217 | curView = v; | 214 | curView = v; |
218 | emit viewChanged(v); | 215 | emit viewChanged(v); |
219 | } | 216 | } |
220 | 217 | ||
221 | void MediaPlayerState::setPrev(){ | 218 | void MediaPlayerState::setPrev(){ |
222 | emit prev(); | 219 | emit prev(); |
223 | } | 220 | } |
224 | 221 | ||
225 | void MediaPlayerState::setNext() { | 222 | void MediaPlayerState::setNext() { |
226 | emit next(); | 223 | emit next(); |
227 | } | 224 | } |
228 | 225 | ||
229 | void MediaPlayerState::setList() { | 226 | void MediaPlayerState::setList() { |
230 | setPlaying( FALSE ); | 227 | setPlaying( FALSE ); |
231 | setView('l'); | 228 | setView('l'); |
232 | } | 229 | } |
233 | 230 | ||
234 | void MediaPlayerState::setVideo() { | 231 | void MediaPlayerState::setVideo() { |
235 | setView('v'); | 232 | setView('v'); |
236 | } | 233 | } |
237 | 234 | ||
238 | void MediaPlayerState::setAudio() { | 235 | void MediaPlayerState::setAudio() { |
239 | setView('a'); | 236 | setView('a'); |
240 | } | 237 | } |
241 | 238 | ||
242 | void MediaPlayerState::toggleFullscreen() { | 239 | void MediaPlayerState::toggleFullscreen() { |
243 | setFullscreen( !isFullscreen ); | 240 | setFullscreen( !isFullscreen ); |
244 | } | 241 | } |
245 | 242 | ||
246 | void MediaPlayerState::toggleScaled() { | 243 | void MediaPlayerState::toggleScaled() { |
247 | setScaled( !isScaled); | 244 | setScaled( !isScaled); |
248 | } | 245 | } |
249 | 246 | ||
250 | void MediaPlayerState::toggleLooping() { | 247 | void MediaPlayerState::toggleLooping() { |
251 | setLooping( !isLooping); | 248 | setLooping( !isLooping); |
252 | } | 249 | } |
253 | 250 | ||
254 | void MediaPlayerState::toggleShuffled() { | 251 | void MediaPlayerState::toggleShuffled() { |
255 | setShuffled( !isShuffled); | 252 | setShuffled( !isShuffled); |
256 | } | 253 | } |
257 | 254 | ||
258 | void MediaPlayerState::togglePlaylist() { | 255 | void MediaPlayerState::togglePlaylist() { |
259 | setPlaylist( !usePlaylist); | 256 | setPlaylist( !usePlaylist); |
260 | } | 257 | } |
261 | 258 | ||
262 | void MediaPlayerState::togglePaused() { | 259 | void MediaPlayerState::togglePaused() { |
263 | setPaused( !isPaused); | 260 | setPaused( !isPaused); |
264 | } | 261 | } |
265 | 262 | ||
266 | void MediaPlayerState::togglePlaying() { | 263 | void MediaPlayerState::togglePlaying() { |
267 | setPlaying( !isPlaying); | 264 | setPlaying( !isPlaying); |
268 | } | 265 | } |
269 | 266 | ||
270 | 267 | ||
271 | 268 | ||
272 | 269 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 65458e7..27db464 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -39,264 +39,264 @@ | |||
39 | #include "playlistwidget.h" | 39 | #include "playlistwidget.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | 41 | ||
42 | #include "inputDialog.h" | 42 | #include "inputDialog.h" |
43 | 43 | ||
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include "audiowidget.h" | 45 | #include "audiowidget.h" |
46 | #include "videowidget.h" | 46 | #include "videowidget.h" |
47 | 47 | ||
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | #include <sys/file.h> | 49 | #include <sys/file.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/soundcard.h> | 51 | #include <sys/soundcard.h> |
52 | 52 | ||
53 | // for setBacklight() | 53 | // for setBacklight() |
54 | #include <linux/fb.h> | 54 | #include <linux/fb.h> |
55 | #include <sys/types.h> | 55 | #include <sys/types.h> |
56 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | 58 | ||
59 | #define BUTTONS_ON_TOOLBAR | 59 | #define BUTTONS_ON_TOOLBAR |
60 | #define SIDE_BUTTONS | 60 | #define SIDE_BUTTONS |
61 | #define CAN_SAVE_LOAD_PLAYLISTS | 61 | #define CAN_SAVE_LOAD_PLAYLISTS |
62 | 62 | ||
63 | extern MediaPlayerState *mediaPlayerState; | 63 | extern MediaPlayerState *mediaPlayerState; |
64 | 64 | ||
65 | 65 | ||
66 | class PlayListWidgetPrivate { | 66 | class PlayListWidgetPrivate { |
67 | public: | 67 | public: |
68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
69 | QFrame *playListFrame; | 69 | QFrame *playListFrame; |
70 | FileSelector *files; | 70 | FileSelector *files; |
71 | PlayListSelection *selectedFiles; | 71 | PlayListSelection *selectedFiles; |
72 | bool setDocumentUsed; | 72 | bool setDocumentUsed; |
73 | DocLnk *current; | 73 | DocLnk *current; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | class ToolButton : public QToolButton { | 77 | class ToolButton : public QToolButton { |
78 | public: | 78 | public: |
79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
80 | : QToolButton( parent, name ) { | 80 | : QToolButton( parent, name ) { |
81 | setTextLabel( name ); | 81 | setTextLabel( name ); |
82 | setPixmap( Resource::loadPixmap( icon ) ); | 82 | setPixmap( Resource::loadPixmap( icon ) ); |
83 | setAutoRaise( TRUE ); | 83 | setAutoRaise( TRUE ); |
84 | setFocusPolicy( QWidget::NoFocus ); | 84 | setFocusPolicy( QWidget::NoFocus ); |
85 | setToggleButton( t ); | 85 | setToggleButton( t ); |
86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
87 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 87 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
88 | } | 88 | } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
92 | class MenuItem : public QAction { | 92 | class MenuItem : public QAction { |
93 | public: | 93 | public: |
94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
95 | : QAction( text, QString::null, 0, 0 ) { | 95 | : QAction( text, QString::null, 0, 0 ) { |
96 | connect( this, SIGNAL( activated() ), handler, slot ); | 96 | connect( this, SIGNAL( activated() ), handler, slot ); |
97 | addTo( parent ); | 97 | addTo( parent ); |
98 | } | 98 | } |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
103 | : QMainWindow( parent, name, fl ) { | 103 | : QMainWindow( parent, name, fl ) { |
104 | 104 | ||
105 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 107 | d->current = NULL; |
108 | fromSetDocument = FALSE; | 108 | fromSetDocument = FALSE; |
109 | insanityBool=FALSE; | 109 | insanityBool=FALSE; |
110 | audioScan = FALSE; | 110 | audioScan = FALSE; |
111 | videoScan = FALSE; | 111 | videoScan = FALSE; |
112 | 112 | ||
113 | setBackgroundMode( PaletteButton ); | 113 | setBackgroundMode( PaletteButton ); |
114 | 114 | ||
115 | setCaption( tr("OpiePlayer") ); | 115 | setCaption( tr("OpiePlayer") ); |
116 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 116 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
117 | 117 | ||
118 | setToolBarsMovable( FALSE ); | 118 | setToolBarsMovable( FALSE ); |
119 | 119 | ||
120 | // Create Toolbar | 120 | // Create Toolbar |
121 | QPEToolBar *toolbar = new QPEToolBar( this ); | 121 | QPEToolBar *toolbar = new QPEToolBar( this ); |
122 | toolbar->setHorizontalStretchable( TRUE ); | 122 | toolbar->setHorizontalStretchable( TRUE ); |
123 | 123 | ||
124 | // Create Menubar | 124 | // Create Menubar |
125 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 125 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
126 | menu->setMargin( 0 ); | 126 | menu->setMargin( 0 ); |
127 | 127 | ||
128 | QPEToolBar *bar = new QPEToolBar( this ); | 128 | QPEToolBar *bar = new QPEToolBar( this ); |
129 | bar->setLabel( tr( "Play Operations" ) ); | 129 | bar->setLabel( tr( "Play Operations" ) ); |
130 | 130 | ||
131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
132 | tbDeletePlaylist->setFlat(TRUE); | 132 | tbDeletePlaylist->setFlat(TRUE); |
133 | tbDeletePlaylist->setFixedSize(20,20); | 133 | tbDeletePlaylist->setFixedSize(20,20); |
134 | 134 | ||
135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
136 | this , SLOT(addSelected()) ); | 136 | this , SLOT(addSelected()) ); |
137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
138 | this , SLOT(removeSelected()) ); | 138 | this , SLOT(removeSelected()) ); |
139 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 139 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
140 | this , SLOT( btnPlay(bool) ), TRUE ); | 140 | this , SLOT( btnPlay(bool) ), TRUE ); |
141 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 141 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
142 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 142 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
143 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 143 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
144 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 144 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
145 | tbDeletePlaylist->hide(); | 145 | tbDeletePlaylist->hide(); |
146 | 146 | ||
147 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 147 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
148 | menu->insertItem( tr( "File" ), pmPlayList ); | 148 | menu->insertItem( tr( "File" ), pmPlayList ); |
149 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 149 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
153 | pmPlayList->insertSeparator(-1); | 153 | pmPlayList->insertSeparator(-1); |
154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
155 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | 155 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); |
156 | pmPlayList->insertSeparator(-1); | 156 | pmPlayList->insertSeparator(-1); |
157 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 157 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
158 | pmPlayList->insertSeparator(-1); | 158 | pmPlayList->insertSeparator(-1); |
159 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 159 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
160 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 160 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
161 | 161 | ||
162 | 162 | ||
163 | pmView = new QPopupMenu( this ); | 163 | pmView = new QPopupMenu( this ); |
164 | menu->insertItem( tr( "View" ), pmView ); | 164 | menu->insertItem( tr( "View" ), pmView ); |
165 | pmView->isCheckable(); | 165 | pmView->isCheckable(); |
166 | 166 | ||
167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) ); | 167 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); |
168 | 168 | ||
169 | Config cfg( "OpiePlayer" ); | 169 | Config cfg( "OpiePlayer" ); |
170 | bool b= cfg.readBoolEntry("FullScreen", 0); | 170 | bool b= cfg.readBoolEntry("FullScreen", 0); |
171 | mediaPlayerState->setFullscreen( b ); | 171 | mediaPlayerState->setFullscreen( b ); |
172 | pmView->setItemChecked( -16, b ); | 172 | pmView->setItemChecked( -16, b ); |
173 | 173 | ||
174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) ); | 174 | pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); |
175 | 175 | ||
176 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 176 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
177 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 177 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
178 | 178 | ||
179 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 179 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
180 | 180 | ||
181 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 181 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
182 | // tabWidget->setTabShape(QTabWidget::Triangular); | 182 | // tabWidget->setTabShape(QTabWidget::Triangular); |
183 | 183 | ||
184 | QWidget *pTab; | 184 | QWidget *pTab; |
185 | pTab = new QWidget( tabWidget, "pTab" ); | 185 | pTab = new QWidget( tabWidget, "pTab" ); |
186 | tabWidget->insertTab( pTab,"Playlist"); | 186 | tabWidget->insertTab( pTab,"Playlist"); |
187 | 187 | ||
188 | 188 | ||
189 | // Add the playlist area | 189 | // Add the playlist area |
190 | 190 | ||
191 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 191 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
192 | d->playListFrame = vbox3; | 192 | d->playListFrame = vbox3; |
193 | d->playListFrame ->setMinimumSize(235,260); | 193 | d->playListFrame ->setMinimumSize(235,260); |
194 | 194 | ||
195 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 195 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
196 | 196 | ||
197 | d->selectedFiles = new PlayListSelection( hbox2); | 197 | d->selectedFiles = new PlayListSelection( hbox2); |
198 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 198 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
199 | 199 | ||
200 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 200 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
201 | 201 | ||
202 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 202 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
203 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 203 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
204 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 204 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
205 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 205 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
206 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 206 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
207 | 207 | ||
208 | QWidget *aTab; | 208 | QWidget *aTab; |
209 | aTab = new QWidget( tabWidget, "aTab" ); | 209 | aTab = new QWidget( tabWidget, "aTab" ); |
210 | audioView = new QListView( aTab, "Audioview" ); | 210 | audioView = new QListView( aTab, "Audioview" ); |
211 | audioView->setMinimumSize(233,260); | 211 | audioView->setMinimumSize(233,260); |
212 | audioView->addColumn( tr("Title"),140); | 212 | audioView->addColumn( tr("Title"),140); |
213 | audioView->addColumn(tr("Size"), -1); | 213 | audioView->addColumn(tr("Size"), -1); |
214 | audioView->addColumn(tr("Media"),-1); | 214 | audioView->addColumn(tr("Media"),-1); |
215 | audioView->setColumnAlignment(1, Qt::AlignRight); | 215 | audioView->setColumnAlignment(1, Qt::AlignRight); |
216 | audioView->setColumnAlignment(2, Qt::AlignRight); | 216 | audioView->setColumnAlignment(2, Qt::AlignRight); |
217 | audioView->setAllColumnsShowFocus(TRUE); | 217 | audioView->setAllColumnsShowFocus(TRUE); |
218 | 218 | ||
219 | audioView->setMultiSelection( TRUE ); | 219 | audioView->setMultiSelection( TRUE ); |
220 | audioView->setSelectionMode( QListView::Extended); | 220 | audioView->setSelectionMode( QListView::Extended); |
221 | 221 | ||
222 | tabWidget->insertTab(aTab,tr("Audio")); | 222 | tabWidget->insertTab(aTab,tr("Audio")); |
223 | 223 | ||
224 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 224 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
225 | 225 | ||
226 | QWidget *vTab; | 226 | QWidget *vTab; |
227 | vTab = new QWidget( tabWidget, "vTab" ); | 227 | vTab = new QWidget( tabWidget, "vTab" ); |
228 | videoView = new QListView( vTab, "Videoview" ); | 228 | videoView = new QListView( vTab, "Videoview" ); |
229 | videoView->setMinimumSize(233,260); | 229 | videoView->setMinimumSize(233,260); |
230 | 230 | ||
231 | videoView->addColumn(tr("Title"),140); | 231 | videoView->addColumn(tr("Title"),140); |
232 | videoView->addColumn(tr("Size"),-1); | 232 | videoView->addColumn(tr("Size"),-1); |
233 | videoView->addColumn(tr("Media"),-1); | 233 | videoView->addColumn(tr("Media"),-1); |
234 | videoView->setColumnAlignment(1, Qt::AlignRight); | 234 | videoView->setColumnAlignment(1, Qt::AlignRight); |
235 | videoView->setColumnAlignment(2, Qt::AlignRight); | 235 | videoView->setColumnAlignment(2, Qt::AlignRight); |
236 | videoView->setAllColumnsShowFocus(TRUE); | 236 | videoView->setAllColumnsShowFocus(TRUE); |
237 | videoView->setMultiSelection( TRUE ); | 237 | videoView->setMultiSelection( TRUE ); |
238 | videoView->setSelectionMode( QListView::Extended); | 238 | videoView->setSelectionMode( QListView::Extended); |
239 | 239 | ||
240 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 240 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
241 | 241 | ||
242 | tabWidget->insertTab( vTab,tr("Video")); | 242 | tabWidget->insertTab( vTab,tr("Video")); |
243 | 243 | ||
244 | //playlists list | 244 | //playlists list |
245 | QWidget *LTab; | 245 | QWidget *LTab; |
246 | LTab = new QWidget( tabWidget, "LTab" ); | 246 | LTab = new QWidget( tabWidget, "LTab" ); |
247 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 247 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
248 | playLists->setMinimumSize(233,260); | 248 | playLists->setMinimumSize(233,260); |
249 | tabWidget->insertTab(LTab,tr("Lists")); | 249 | tabWidget->insertTab(LTab,tr("Lists")); |
250 | 250 | ||
251 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 251 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
252 | 252 | ||
253 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); | 253 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); |
254 | 254 | ||
255 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); | 255 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); |
256 | 256 | ||
257 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 257 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
258 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 258 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
259 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 259 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
260 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 260 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
261 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 261 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
262 | this,SLOT( playIt( QListViewItem *)) ); | 262 | this,SLOT( playIt( QListViewItem *)) ); |
263 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 263 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
264 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 264 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
265 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 265 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
266 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 266 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
267 | this,SLOT( playIt( QListViewItem *)) ); | 267 | this,SLOT( playIt( QListViewItem *)) ); |
268 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 268 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
269 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 269 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
270 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 270 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
271 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 271 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
272 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 272 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
273 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 273 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
274 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 274 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
275 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 275 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
276 | 276 | ||
277 | setCentralWidget( vbox5 ); | 277 | setCentralWidget( vbox5 ); |
278 | 278 | ||
279 | readConfig( cfg ); | 279 | readConfig( cfg ); |
280 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 280 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
281 | loadList(DocLnk( currentPlaylist)); | 281 | loadList(DocLnk( currentPlaylist)); |
282 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 282 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
283 | 283 | ||
284 | initializeStates(); | 284 | initializeStates(); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | PlayListWidget::~PlayListWidget() { | 288 | PlayListWidget::~PlayListWidget() { |
289 | Config cfg( "OpiePlayer" ); | 289 | Config cfg( "OpiePlayer" ); |
290 | writeConfig( cfg ); | 290 | writeConfig( cfg ); |
291 | 291 | ||
292 | if ( d->current ) { | 292 | if ( d->current ) { |
293 | delete d->current; | 293 | delete d->current; |
294 | } | 294 | } |
295 | delete d; | 295 | delete d; |
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
299 | void PlayListWidget::initializeStates() { | 299 | void PlayListWidget::initializeStates() { |
300 | 300 | ||
301 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 301 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
302 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 302 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index fdfa666..dd49892 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,111 +1,110 @@ | |||
1 | 1 | ||
2 | #ifndef PLAY_LIST_WIDGET_H | 2 | #ifndef PLAY_LIST_WIDGET_H |
3 | #define PLAY_LIST_WIDGET_H | 3 | #define PLAY_LIST_WIDGET_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | #include <qpe/applnk.h> | 6 | #include <qpe/applnk.h> |
7 | #include <qtabwidget.h> | 7 | #include <qtabwidget.h> |
8 | #include <qpe/fileselector.h> | 8 | #include <qpe/fileselector.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qpopupmenu.h> | 10 | #include <qpopupmenu.h> |
11 | 11 | ||
12 | /* #include <qtimer.h> */ | 12 | /* #include <qtimer.h> */ |
13 | 13 | ||
14 | 14 | ||
15 | class PlayListWidgetPrivate; | 15 | class PlayListWidgetPrivate; |
16 | class Config; | 16 | class Config; |
17 | class QListViewItem; | 17 | class QListViewItem; |
18 | class QListView; | 18 | class QListView; |
19 | class QPoint; | 19 | class QPoint; |
20 | class QAction; | 20 | class QAction; |
21 | class QLabel; | 21 | class QLabel; |
22 | 22 | ||
23 | class PlayListWidget : public QMainWindow { | 23 | class PlayListWidget : public QMainWindow { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
27 | ~PlayListWidget(); | 27 | ~PlayListWidget(); |
28 | QTabWidget * tabWidget; | 28 | QTabWidget * tabWidget; |
29 | // MenuItem *fullScreenButton, *scaleButton; | 29 | // MenuItem *fullScreenButton, *scaleButton; |
30 | // QAction *fullScreenButton, *scaleButton; | 30 | // QAction *fullScreenButton, *scaleButton; |
31 | DocLnkSet files; | 31 | DocLnkSet files; |
32 | DocLnkSet vFiles; | 32 | DocLnkSet vFiles; |
33 | QListView *audioView, *videoView, *playlistView; | 33 | QListView *audioView, *videoView, *playlistView; |
34 | QLabel *libString; | 34 | QLabel *libString; |
35 | QPopupMenu *pmView ; | 35 | QPopupMenu *pmView ; |
36 | bool fromSetDocument; | 36 | bool fromSetDocument; |
37 | bool insanityBool; | 37 | bool insanityBool; |
38 | QString setDocFileRef; | 38 | QString setDocFileRef; |
39 | // retrieve the current playlist entry (media file link) | 39 | // retrieve the current playlist entry (media file link) |
40 | const DocLnk *current(); | 40 | const DocLnk *current(); |
41 | void useSelectedDocument(); | 41 | void useSelectedDocument(); |
42 | /* QTimer * menuTimer; */ | 42 | /* QTimer * menuTimer; */ |
43 | FileSelector* playLists; | 43 | FileSelector* playLists; |
44 | QPushButton *tbDeletePlaylist; | 44 | QPushButton *tbDeletePlaylist; |
45 | int fd, selected; | 45 | int fd, selected; |
46 | public slots: | 46 | public slots: |
47 | bool first(); | 47 | bool first(); |
48 | bool last(); | 48 | bool last(); |
49 | bool next(); | 49 | bool next(); |
50 | bool prev(); | 50 | bool prev(); |
51 | /* void setFullScreen(); */ | 51 | /* void setFullScreen(); */ |
52 | /* void setScaled(); */ | 52 | /* void setScaled(); */ |
53 | protected: | 53 | protected: |
54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
56 | void keyReleaseEvent( QKeyEvent *e); | 56 | void keyReleaseEvent( QKeyEvent *e); |
57 | void keyPressEvent( QKeyEvent *e); | 57 | void keyPressEvent( QKeyEvent *e); |
58 | private: | 58 | private: |
59 | bool audioScan, videoScan; | 59 | bool audioScan, videoScan; |
60 | void doBlank(); | 60 | void doBlank(); |
61 | void doUnblank(); | 61 | void doUnblank(); |
62 | void readm3u(const QString &); | 62 | void readm3u(const QString &); |
63 | void readPls(const QString &); | 63 | void readPls(const QString &); |
64 | 64 | ||
65 | |||
66 | void initializeStates(); | 65 | void initializeStates(); |
67 | void readConfig( Config& cfg ); | 66 | void readConfig( Config& cfg ); |
68 | void writeConfig( Config& cfg ) const; | 67 | void writeConfig( Config& cfg ) const; |
69 | PlayListWidgetPrivate *d; // Private implementation data | 68 | PlayListWidgetPrivate *d; // Private implementation data |
70 | void populateAudioView(); | 69 | void populateAudioView(); |
71 | void populateVideoView(); | 70 | void populateVideoView(); |
72 | private slots: | 71 | private slots: |
73 | void pmViewActivated(int); | 72 | void pmViewActivated(int); |
74 | void writem3u(); | 73 | void writem3u(); |
75 | void scanForAudio(); | 74 | void scanForAudio(); |
76 | void scanForVideo(); | 75 | void scanForVideo(); |
77 | void openFile(); | 76 | void openFile(); |
78 | void setDocument( const QString& fileref ); | 77 | void setDocument( const QString& fileref ); |
79 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 78 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
80 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 79 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
81 | void setActiveWindow(); // need to handle this to show the right view | 80 | void setActiveWindow(); // need to handle this to show the right view |
82 | void setPlaylist( bool ); // Show/Hide the playlist | 81 | void setPlaylist( bool ); // Show/Hide the playlist |
83 | void setView( char ); | 82 | void setView( char ); |
84 | void clearList(); | 83 | void clearList(); |
85 | void addAllToList(); | 84 | void addAllToList(); |
86 | void addAllMusicToList(); | 85 | void addAllMusicToList(); |
87 | void addAllVideoToList(); | 86 | void addAllVideoToList(); |
88 | void saveList(); // Save the playlist | 87 | void saveList(); // Save the playlist |
89 | void loadList( const DocLnk &); // Load a playlist | 88 | void loadList( const DocLnk &); // Load a playlist |
90 | void playIt( QListViewItem *); | 89 | void playIt( QListViewItem *); |
91 | 90 | ||
92 | void btnPlay(bool); | 91 | void btnPlay(bool); |
93 | void deletePlaylist(); | 92 | void deletePlaylist(); |
94 | void addSelected(); | 93 | void addSelected(); |
95 | void removeSelected(); | 94 | void removeSelected(); |
96 | void tabChanged(QWidget*); | 95 | void tabChanged(QWidget*); |
97 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 96 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
98 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 97 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
99 | void playSelected(); | 98 | void playSelected(); |
100 | void listDelete(); | 99 | void listDelete(); |
101 | 100 | ||
102 | protected slots: | 101 | protected slots: |
103 | /* void cancelMenuTimer(); */ | 102 | /* void cancelMenuTimer(); */ |
104 | /* void showFileMenu(); */ | 103 | /* void showFileMenu(); */ |
105 | 104 | ||
106 | 105 | ||
107 | }; | 106 | }; |
108 | 107 | ||
109 | 108 | ||
110 | #endif // PLAY_LIST_WIDGET_H | 109 | #endif // PLAY_LIST_WIDGET_H |
111 | 110 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 9b88299..33153d4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -1,466 +1,523 @@ | |||
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 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/mediaplayerplugininterface.h> | 35 | #include <qpe/mediaplayerplugininterface.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qpainter.h> | 39 | #include <qpainter.h> |
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qslider.h> | 41 | #include <qslider.h> |
42 | #include <qdrawutil.h> | 42 | #include <qdrawutil.h> |
43 | #include "videowidget.h" | 43 | #include "videowidget.h" |
44 | #include "mediaplayerstate.h" | 44 | #include "mediaplayerstate.h" |
45 | 45 | ||
46 | 46 | ||
47 | #ifdef Q_WS_QWS | 47 | #ifdef Q_WS_QWS |
48 | # define USE_DIRECT_PAINTER | 48 | # define USE_DIRECT_PAINTER |
49 | # include <qdirectpainter_qws.h> | 49 | # include <qdirectpainter_qws.h> |
50 | # include <qgfxraster_qws.h> | 50 | # include <qgfxraster_qws.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | 53 | ||
54 | extern MediaPlayerState *mediaPlayerState; | 54 | extern MediaPlayerState *mediaPlayerState; |
55 | 55 | ||
56 | 56 | ||
57 | static const int xo = 2; // movable x offset | 57 | static const int xo = 2; // movable x offset |
58 | static const int yo = 0; // movable y offset | 58 | static const int yo = 0; // movable y offset |
59 | 59 | ||
60 | 60 | ||
61 | struct MediaButton { | 61 | struct MediaButton { |
62 | bool isToggle, isHeld, isDown; | 62 | bool isToggle, isHeld, isDown; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | MediaButton videoButtons[] = { | 65 | MediaButton videoButtons[] = { |
66 | { FALSE, FALSE, FALSE }, // previous | ||
67 | { FALSE, FALSE, FALSE }, // stop | 66 | { FALSE, FALSE, FALSE }, // stop |
68 | { TRUE, FALSE, FALSE }, // play | 67 | { TRUE, FALSE, FALSE }, // play |
69 | { TRUE, FALSE, FALSE }, // pause | 68 | { FALSE, FALSE, FALSE }, // previous |
70 | { FALSE, FALSE, FALSE }, // next | 69 | { FALSE, FALSE, FALSE }, // next |
71 | { FALSE, FALSE, FALSE }, // playlist | 70 | { FALSE, FALSE, FALSE }, // volUp |
71 | { FALSE, FALSE, FALSE }, // volDown | ||
72 | { TRUE, FALSE, FALSE } // fullscreen | 72 | { TRUE, FALSE, FALSE } // fullscreen |
73 | }; | 73 | }; |
74 | 74 | ||
75 | const char *skinV_mask_file_names[7] = { | 75 | const char *skinV_mask_file_names[7] = { |
76 | "stop","play","back","fwd","up","down","full" | 76 | "stop","play","back","fwd","up","down","full" |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 79 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
80 | 80 | ||
81 | 81 | ||
82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
84 | setCaption( tr("OpiePlayer - Video") ); | 84 | setCaption( tr("OpiePlayer - Video") ); |
85 | 85 | ||
86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | 88 | ||
89 | Config cfg("OpiePlayer"); | 89 | Config cfg("OpiePlayer"); |
90 | cfg.setGroup("VideoWidget"); | 90 | cfg.setGroup("VideoWidget"); |
91 | skin = cfg.readEntry("Skin","default"); | 91 | skin = cfg.readEntry("Skin","default"); |
92 | 92 | ||
93 | QString skinPath = "opieplayer2/skins/" + skin; | 93 | QString skinPath = "opieplayer2/skins/" + skin; |
94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
97 | 97 | ||
98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
99 | imgButtonMask->fill( 0 ); | 99 | imgButtonMask->fill( 0 ); |
100 | 100 | ||
101 | for ( int i = 0; i < 7; i++ ) { | 101 | for ( int i = 0; i < 7; i++ ) { |
102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; | 102 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; |
103 | masks[i] = new QBitmap( filename ); | 103 | masks[i] = new QBitmap( filename ); |
104 | qDebug(filename); | 104 | qDebug(filename); |
105 | if ( !masks[i]->isNull() ) { | 105 | if ( !masks[i]->isNull() ) { |
106 | QImage imgMask = masks[i]->convertToImage(); | 106 | QImage imgMask = masks[i]->convertToImage(); |
107 | uchar **dest = imgButtonMask->jumpTable(); | 107 | uchar **dest = imgButtonMask->jumpTable(); |
108 | for ( int y = 0; y < imgUp->height(); y++ ) { | 108 | for ( int y = 0; y < imgUp->height(); y++ ) { |
109 | uchar *line = dest[y]; | 109 | uchar *line = dest[y]; |
110 | for ( int x = 0; x < imgUp->width(); x++ ) { | 110 | for ( int x = 0; x < imgUp->width(); x++ ) { |
111 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 111 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
112 | line[x] = i + 1; | 112 | line[x] = i + 1; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | for ( int i = 0; i < 7; i++ ) { | 119 | for ( int i = 0; i < 7; i++ ) { |
120 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
121 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
122 | } | 122 | } |
123 | 123 | ||
124 | setBackgroundPixmap( *pixBg ); | 124 | setBackgroundPixmap( *pixBg ); |
125 | 125 | ||
126 | slider = new QSlider( Qt::Horizontal, this ); | 126 | slider = new QSlider( Qt::Horizontal, this ); |
127 | slider->setMinValue( 0 ); | 127 | slider->setMinValue( 0 ); |
128 | slider->setMaxValue( 1 ); | 128 | slider->setMaxValue( 1 ); |
129 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 129 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
130 | slider->setFocusPolicy( QWidget::NoFocus ); | 130 | slider->setFocusPolicy( QWidget::NoFocus ); |
131 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 131 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
132 | 132 | ||
133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 133 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 134 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
135 | 135 | ||
136 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 136 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
137 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 137 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
138 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 138 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 139 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
140 | |||
140 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 141 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
141 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 142 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
142 | 143 | ||
143 | setLength( mediaPlayerState->length() ); | 144 | setLength( mediaPlayerState->length() ); |
144 | setPosition( mediaPlayerState->position() ); | 145 | setPosition( mediaPlayerState->position() ); |
145 | 146 | ||
146 | ////////////////////////// FIXME | 147 | ////////////////////////// FIXME |
147 | // setFullscreen( mediaPlayerState->fullscreen() ); | 148 | // setFullscreen( mediaPlayerState->fullscreen() ); |
148 | setPaused( mediaPlayerState->paused() ); | 149 | setPaused( mediaPlayerState->paused() ); |
149 | setPlaying( mediaPlayerState->playing() ); | 150 | setPlaying( mediaPlayerState->playing() ); |
150 | qDebug("finished videowidget"); | 151 | qDebug("finished videowidget"); |
151 | } | 152 | } |
152 | 153 | ||
153 | 154 | ||
154 | VideoWidget::~VideoWidget() { | 155 | VideoWidget::~VideoWidget() { |
156 | mediaPlayerState->setPlaying( FALSE ); | ||
155 | for ( int i = 0; i < 7; i++ ) { | 157 | for ( int i = 0; i < 7; i++ ) { |
156 | delete buttonPixUp[i]; | 158 | delete buttonPixUp[i]; |
157 | delete buttonPixDown[i]; | 159 | delete buttonPixDown[i]; |
158 | } | 160 | } |
159 | 161 | ||
160 | delete pixBg; | 162 | delete pixBg; |
161 | delete imgUp; | 163 | delete imgUp; |
162 | delete imgDn; | 164 | delete imgDn; |
163 | delete imgButtonMask; | 165 | delete imgButtonMask; |
164 | for ( int i = 0; i < 7; i++ ) { | 166 | for ( int i = 0; i < 7; i++ ) { |
165 | delete masks[i]; | 167 | delete masks[i]; |
166 | } | 168 | } |
169 | |||
167 | } | 170 | } |
168 | 171 | ||
169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 172 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
170 | QPixmap pix( img.width(), img.height() ); | 173 | QPixmap pix( img.width(), img.height() ); |
171 | QPainter p( &pix ); | 174 | QPainter p( &pix ); |
172 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 175 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
173 | p.drawImage( 0, 0, img ); | 176 | p.drawImage( 0, 0, img ); |
174 | return new QPixmap( pix ); | 177 | return new QPixmap( pix ); |
175 | } | 178 | } |
176 | 179 | ||
177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 180 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
178 | QPixmap *pixmap = new QPixmap( pix ); | 181 | QPixmap *pixmap = new QPixmap( pix ); |
179 | pixmap->setMask( mask ); | 182 | pixmap->setMask( mask ); |
180 | return pixmap; | 183 | return pixmap; |
181 | } | 184 | } |
182 | 185 | ||
183 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 186 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
184 | int h = height(); | 187 | int h = height(); |
185 | int w = width(); | 188 | int w = width(); |
186 | int Vh = 160; | 189 | int Vh = 160; |
187 | //videoFrame->height(); | 190 | //videoFrame->height(); |
188 | int Vw = 220; | 191 | int Vw = 220; |
189 | //videoFrame->width(); | 192 | //videoFrame->width(); |
190 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | 193 | // songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); |
191 | 194 | ||
192 | slider->setFixedWidth( w - 110 ); | 195 | slider->setFixedWidth( w - 110 ); |
193 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 196 | slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
194 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 197 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
195 | slider->setFocusPolicy( QWidget::NoFocus ); | 198 | slider->setFocusPolicy( QWidget::NoFocus ); |
196 | slider->setBackgroundPixmap( *pixBg ); | 199 | slider->setBackgroundPixmap( *pixBg ); |
197 | 200 | ||
198 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 201 | // time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
199 | xoff = 0;// ( imgUp->width() ) / 2; | 202 | xoff = 0;// ( imgUp->width() ) / 2; |
200 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; | 203 | yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10; |
201 | QPoint p( xoff, yoff ); | 204 | QPoint p( xoff, yoff ); |
202 | 205 | ||
203 | 206 | ||
204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 207 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 208 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
206 | 209 | ||
207 | for ( int i = 0; i < 7; i++ ) { | 210 | for ( int i = 0; i < 7; i++ ) { |
208 | if ( !masks[i]->isNull() ) { | 211 | if ( !masks[i]->isNull() ) { |
209 | delete buttonPixUp[i]; | 212 | delete buttonPixUp[i]; |
210 | delete buttonPixDown[i]; | 213 | delete buttonPixDown[i]; |
211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 214 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 215 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
213 | } | 216 | } |
214 | } | 217 | } |
215 | 218 | ||
216 | delete pixUp; | 219 | delete pixUp; |
217 | delete pixDn; | 220 | delete pixDn; |
218 | } | 221 | } |
219 | 222 | ||
220 | static bool videoSliderBeingMoved = FALSE; | 223 | static bool videoSliderBeingMoved = FALSE; |
221 | 224 | ||
222 | void VideoWidget::sliderPressed() { | 225 | void VideoWidget::sliderPressed() { |
223 | videoSliderBeingMoved = TRUE; | 226 | videoSliderBeingMoved = TRUE; |
224 | } | 227 | } |
225 | 228 | ||
226 | void VideoWidget::sliderReleased() { | 229 | void VideoWidget::sliderReleased() { |
227 | videoSliderBeingMoved = FALSE; | 230 | videoSliderBeingMoved = FALSE; |
228 | if ( slider->width() == 0 ) { | 231 | if ( slider->width() == 0 ) { |
229 | return; | 232 | return; |
230 | } | 233 | } |
231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 234 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
232 | mediaPlayerState->setPosition( val ); | 235 | mediaPlayerState->setPosition( val ); |
233 | } | 236 | } |
234 | 237 | ||
235 | void VideoWidget::setPosition( long i ) { | 238 | void VideoWidget::setPosition( long i ) { |
236 | updateSlider( i, mediaPlayerState->length() ); | 239 | updateSlider( i, mediaPlayerState->length() ); |
237 | } | 240 | } |
238 | 241 | ||
239 | 242 | ||
240 | void VideoWidget::setLength( long max ) { | 243 | void VideoWidget::setLength( long max ) { |
241 | updateSlider( mediaPlayerState->position(), max ); | 244 | updateSlider( mediaPlayerState->position(), max ); |
242 | } | 245 | } |
243 | 246 | ||
244 | void VideoWidget::setView( char view ) { | 247 | void VideoWidget::setView( char view ) { |
245 | if ( view == 'v' ) { | 248 | if ( view == 'v' ) { |
246 | makeVisible(); | 249 | makeVisible(); |
247 | } else { | 250 | } else { |
248 | // Effectively blank the view next time we show it so it looks nicer | 251 | // Effectively blank the view next time we show it so it looks nicer |
249 | scaledWidth = 0; | 252 | scaledWidth = 0; |
250 | scaledHeight = 0; | 253 | scaledHeight = 0; |
251 | hide(); | 254 | hide(); |
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | void VideoWidget::updateSlider( long i, long max ) { | 258 | void VideoWidget::updateSlider( long i, long max ) { |
256 | // Will flicker too much if we don't do this | 259 | // Will flicker too much if we don't do this |
257 | if ( max == 0 ) { | 260 | if ( max == 0 ) { |
258 | return; | 261 | return; |
259 | } | 262 | } |
260 | int width = slider->width(); | 263 | int width = slider->width(); |
261 | int val = int((double)i * width / max); | 264 | int val = int((double)i * width / max); |
262 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 265 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
263 | if ( slider->value() != val ) { | 266 | if ( slider->value() != val ) { |
264 | slider->setValue( val ); | 267 | slider->setValue( val ); |
265 | } | 268 | } |
266 | if ( slider->maxValue() != width ) { | 269 | if ( slider->maxValue() != width ) { |
267 | slider->setMaxValue( width ); | 270 | slider->setMaxValue( width ); |
268 | } | 271 | } |
269 | } | 272 | } |
270 | } | 273 | } |
271 | 274 | ||
272 | void VideoWidget::setToggleButton( int i, bool down ) { | 275 | void VideoWidget::setToggleButton( int i, bool down ) { |
273 | if ( down != videoButtons[i].isDown ) { | 276 | if ( down != videoButtons[i].isDown ) { |
274 | toggleButton( i ); | 277 | toggleButton( i ); |
275 | } | 278 | } |
276 | } | 279 | } |
277 | 280 | ||
278 | void VideoWidget::toggleButton( int i ) { | 281 | void VideoWidget::toggleButton( int i ) { |
279 | videoButtons[i].isDown = !videoButtons[i].isDown; | 282 | videoButtons[i].isDown = !videoButtons[i].isDown; |
280 | QPainter p(this); | 283 | QPainter p(this); |
281 | paintButton ( &p, i ); | 284 | paintButton ( &p, i ); |
282 | } | 285 | } |
283 | 286 | ||
284 | void VideoWidget::paintButton( QPainter *p, int i ) { | 287 | void VideoWidget::paintButton( QPainter *p, int i ) { |
285 | 288 | ||
286 | if ( videoButtons[i].isDown ) | 289 | if ( videoButtons[i].isDown ) |
287 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 290 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
288 | else | 291 | else |
289 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 292 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
290 | } | 293 | } |
291 | 294 | ||
292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 295 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
293 | for ( int i = 0; i < numButtons; i++ ) { | 296 | for ( int i = 0; i < numVButtons; i++ ) { |
294 | if ( event->state() == QMouseEvent::LeftButton ) { | 297 | if ( event->state() == QMouseEvent::LeftButton ) { |
295 | // The test to see if the mouse click is inside the button or not | 298 | // The test to see if the mouse click is inside the button or not |
296 | int x = event->pos().x() - xoff; | 299 | int x = event->pos().x() - xoff; |
297 | int y = event->pos().y() - yoff; | 300 | int y = event->pos().y() - yoff; |
298 | 301 | ||
299 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 302 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
300 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 303 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
301 | if ( isOnButton != videoButtons[i].isHeld ) { | 304 | if ( isOnButton != videoButtons[i].isHeld ) { |
302 | videoButtons[i].isHeld = isOnButton; | 305 | videoButtons[i].isHeld = isOnButton; |
303 | toggleButton(i); | 306 | toggleButton(i); |
304 | } | 307 | } |
308 | |||
309 | // qDebug("mouseMove event switch1 %d", i); | ||
310 | if( isOnButton) | ||
311 | switch (i) { | ||
312 | case VideoStop:{ | ||
313 | setToggleButton( i, FALSE ); | ||
314 | mediaPlayerState->setStop(TRUE); | ||
315 | mediaPlayerState->setPlaying(FALSE); | ||
316 | return; | ||
317 | } | ||
318 | case VideoPlay: { | ||
319 | |||
320 | if( mediaPlayerState->isPaused) { | ||
321 | setToggleButton( i, FALSE ); | ||
322 | mediaPlayerState->setPaused( FALSE); | ||
323 | return; | ||
324 | } | ||
325 | else if( mediaPlayerState->isPlaying) { | ||
326 | setToggleButton( i, TRUE ); | ||
327 | mediaPlayerState->setPaused( TRUE); | ||
328 | return; | ||
329 | } | ||
330 | else { | ||
331 | setToggleButton( i, FALSE ); | ||
332 | mediaPlayerState->setPlaying( videoButtons[i].isDown ); | ||
333 | return; | ||
334 | } | ||
335 | } | ||
336 | case VideoNext: qDebug("next"); mediaPlayerState->setNext(); return; | ||
337 | case VideoPrevious: qDebug("previous"); mediaPlayerState->setPrev(); return; | ||
338 | case VideoVolUp: return; | ||
339 | case VideoVolDown: return; | ||
340 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
341 | |||
342 | }; | ||
343 | |||
305 | } else { | 344 | } else { |
306 | if ( videoButtons[i].isHeld ) { | 345 | if ( videoButtons[i].isHeld ) { |
307 | videoButtons[i].isHeld = FALSE; | 346 | videoButtons[i].isHeld = FALSE; |
308 | if ( !videoButtons[i].isToggle ) | 347 | if ( !videoButtons[i].isToggle ) { |
309 | setToggleButton( i, FALSE ); | 348 | setToggleButton( i, FALSE ); |
349 | } | ||
350 | // qDebug("mouseMove event switch2 %d %d", i, VideoPlay); | ||
351 | switch (i) { | ||
352 | case VideoPlay: { | ||
353 | if( mediaPlayerState->isPaused) { | ||
354 | mediaPlayerState->setPaused( FALSE); return; } | ||
355 | else if( mediaPlayerState->isPlaying) { | ||
356 | mediaPlayerState->setPaused( TRUE); return; } | ||
357 | else | ||
358 | mediaPlayerState->setPlaying( TRUE /*videoButtons[i].isDown*/ ); return; | ||
359 | } | ||
360 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
361 | // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
362 | case VideoNext: mediaPlayerState->setNext(); return; | ||
363 | case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
364 | case VideoVolUp: return; | ||
365 | case VideoVolDown: return; | ||
366 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
367 | } | ||
310 | } | 368 | } |
311 | } | 369 | } |
312 | switch (i) { | ||
313 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | ||
314 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
315 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
316 | case VideoNext: mediaPlayerState->setNext(); return; | ||
317 | case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
318 | case VideoPlayList: mediaPlayerState->setList(); return; | ||
319 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
320 | } | ||
321 | |||
322 | } | 370 | } |
323 | } | 371 | } |
324 | 372 | ||
325 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 373 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
326 | mouseMoveEvent( event ); | 374 | mouseMoveEvent( event ); |
327 | } | 375 | } |
328 | 376 | ||
329 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 377 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
330 | if ( mediaPlayerState->fullscreen() ) { | 378 | if ( mediaPlayerState->fullscreen() ) { |
331 | mediaPlayerState->setFullscreen( FALSE ); | 379 | mediaPlayerState->setFullscreen( FALSE ); |
332 | makeVisible(); | 380 | makeVisible(); |
333 | 381 | ||
334 | mouseMoveEvent( event ); | 382 | mouseMoveEvent( event ); |
335 | } | 383 | } |
336 | } | 384 | } |
337 | 385 | ||
338 | 386 | ||
339 | void VideoWidget::makeVisible() { | 387 | void VideoWidget::makeVisible() { |
340 | if ( mediaPlayerState->fullscreen() ) { | 388 | if ( mediaPlayerState->fullscreen() ) { |
341 | setBackgroundMode( QWidget::NoBackground ); | 389 | setBackgroundMode( QWidget::NoBackground ); |
342 | showFullScreen(); | 390 | showFullScreen(); |
343 | resize( qApp->desktop()->size() ); | 391 | resize( qApp->desktop()->size() ); |
344 | slider->hide(); | 392 | slider->hide(); |
345 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 393 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
346 | } else { | 394 | } else { |
347 | showNormal(); | 395 | showNormal(); |
348 | showMaximized(); | 396 | showMaximized(); |
349 | slider->show(); | 397 | slider->show(); |
350 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | 398 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); |
351 | } | 399 | } |
352 | } | 400 | } |
353 | 401 | ||
354 | 402 | ||
355 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 403 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
356 | QPainter p( this ); | 404 | QPainter p( this ); |
357 | 405 | ||
358 | if ( mediaPlayerState->fullscreen() ) { | 406 | if ( mediaPlayerState->fullscreen() ) { |
359 | // Clear the background | 407 | // Clear the background |
360 | p.setBrush( QBrush( Qt::black ) ); | 408 | p.setBrush( QBrush( Qt::black ) ); |
361 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); | 409 | // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); |
362 | 410 | ||
363 | } else { | 411 | } else { |
364 | 412 | ||
365 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); | 413 | // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); |
366 | // draw the buttons | 414 | // draw the buttons |
367 | 415 | ||
368 | if ( !pe->erased() ) { | 416 | if ( !pe->erased() ) { |
369 | // Combine with background and double buffer | 417 | // Combine with background and double buffer |
370 | QPixmap pix( pe->rect().size() ); | 418 | QPixmap pix( pe->rect().size() ); |
371 | QPainter p( &pix ); | 419 | QPainter p( &pix ); |
372 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 420 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
373 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 421 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
374 | for ( int i = 0; i < numButtons; i++ ) | 422 | for ( int i = 0; i < numVButtons; i++ ) |
375 | paintButton( &p, i ); | 423 | paintButton( &p, i ); |
376 | QPainter p2( this ); | 424 | QPainter p2( this ); |
377 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 425 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
378 | } else { | 426 | } else { |
379 | QPainter p( this ); | 427 | QPainter p( this ); |
380 | for ( int i = 0; i < numButtons; i++ ) | 428 | for ( int i = 0; i < numVButtons; i++ ) |
381 | paintButton( &p, i ); | 429 | paintButton( &p, i ); |
382 | } | 430 | } |
383 | // for ( int i = 0; i < numButtons; i++ ) { | 431 | // for ( int i = 0; i < numButtons; i++ ) { |
384 | // paintButton( &p, i ); | 432 | // paintButton( &p, i ); |
385 | // } | 433 | // } |
386 | // // draw the slider | 434 | // draw the slider |
387 | // slider->repaint( TRUE ); | 435 | slider->repaint( TRUE ); |
388 | } | 436 | } |
389 | } | 437 | } |
390 | 438 | ||
391 | 439 | ||
392 | void VideoWidget::closeEvent( QCloseEvent* ) { | 440 | void VideoWidget::closeEvent( QCloseEvent* ) { |
393 | mediaPlayerState->setList(); | 441 | mediaPlayerState->setList(); |
394 | } | 442 | } |
395 | 443 | ||
396 | 444 | ||
397 | bool VideoWidget::playVideo() { | 445 | bool VideoWidget::playVideo() { |
398 | bool result = FALSE; | 446 | bool result = FALSE; |
399 | 447 | ||
400 | int stream = 0; | 448 | int stream = 0; |
401 | 449 | ||
402 | int sw = 240; | 450 | int sw = 240; |
403 | int sh = 320; | 451 | int sh = 320; |
404 | int dd = QPixmap::defaultDepth(); | 452 | int dd = QPixmap::defaultDepth(); |
405 | int w = height(); | 453 | int w = height(); |
406 | int h = width(); | 454 | int h = width(); |
407 | 455 | ||
408 | return true; | 456 | return true; |
409 | } | 457 | } |
410 | 458 | ||
411 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 459 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
412 | switch ( e->key() ) { | 460 | switch ( e->key() ) { |
413 | ////////////////////////////// Zaurus keys | 461 | ////////////////////////////// Zaurus keys |
414 | case Key_Home: | 462 | case Key_Home: |
415 | break; | 463 | break; |
416 | case Key_F9: //activity | 464 | case Key_F9: //activity |
417 | break; | 465 | break; |
418 | case Key_F10: //contacts | 466 | case Key_F10: //contacts |
419 | // hide(); | 467 | // hide(); |
420 | break; | 468 | break; |
421 | case Key_F11: //menu | 469 | case Key_F11: //menu |
422 | break; | 470 | break; |
423 | case Key_F12: //home | 471 | case Key_F12: //home |
424 | break; | 472 | break; |
425 | case Key_F13: //mail | 473 | case Key_F13: //mail |
426 | break; | 474 | break; |
427 | case Key_Space: { | 475 | case Key_Space: { |
428 | if(mediaPlayerState->playing()) { | 476 | if(mediaPlayerState->playing()) { |
429 | mediaPlayerState->setPlaying(FALSE); | 477 | mediaPlayerState->setPlaying(FALSE); |
430 | } else { | 478 | } else { |
431 | mediaPlayerState->setPlaying(TRUE); | 479 | mediaPlayerState->setPlaying(TRUE); |
432 | } | 480 | } |
433 | } | 481 | } |
434 | break; | 482 | break; |
435 | case Key_Down: | 483 | case Key_Down: |
436 | // toggleButton(6); | 484 | // toggleButton(6); |
437 | // emit lessClicked(); | 485 | // emit lessClicked(); |
438 | // emit lessReleased(); | 486 | // emit lessReleased(); |
439 | // toggleButton(6); | 487 | // toggleButton(6); |
440 | break; | 488 | break; |
441 | case Key_Up: | 489 | case Key_Up: |
442 | // toggleButton(5); | 490 | // toggleButton(5); |
443 | // emit moreClicked(); | 491 | // emit moreClicked(); |
444 | // emit moreReleased(); | 492 | // emit moreReleased(); |
445 | // toggleButton(5); | 493 | // toggleButton(5); |
446 | break; | 494 | break; |
447 | case Key_Right: | 495 | case Key_Right: |
448 | mediaPlayerState->setNext(); | 496 | mediaPlayerState->setNext(); |
449 | break; | 497 | break; |
450 | case Key_Left: | 498 | case Key_Left: |
451 | mediaPlayerState->setPrev(); | 499 | mediaPlayerState->setPrev(); |
452 | break; | 500 | break; |
453 | case Key_Escape: | 501 | case Key_Escape: |
454 | break; | 502 | break; |
455 | 503 | ||
456 | }; | 504 | }; |
457 | } | 505 | } |
458 | 506 | ||
459 | XineVideoWidget* VideoWidget::vidWidget() { | 507 | XineVideoWidget* VideoWidget::vidWidget() { |
460 | return videoFrame; | 508 | return videoFrame; |
461 | } | 509 | } |
462 | 510 | ||
463 | 511 | ||
464 | void VideoWidget::setFullscreen ( bool b ) { | 512 | void VideoWidget::setFullscreen ( bool b ) { |
465 | setToggleButton( VideoFullscreen, b ); | 513 | setToggleButton( VideoFullscreen, b ); |
466 | } | 514 | } |
515 | |||
516 | void VideoWidget::setPaused( bool b) { | ||
517 | // setToggleButton( VideoPause, b ); | ||
518 | } | ||
519 | |||
520 | void VideoWidget::setPlaying( bool b) { | ||
521 | setToggleButton( VideoPlay, b ); | ||
522 | } | ||
523 | |||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 830696e..92193a4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -1,116 +1,117 @@ | |||
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 VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include "xinevideowidget.h" | 38 | #include "xinevideowidget.h" |
39 | 39 | ||
40 | class QPixmap; | 40 | class QPixmap; |
41 | class QSlider; | 41 | class QSlider; |
42 | 42 | ||
43 | enum VideoButtons { | 43 | enum VideoButtons { |
44 | VideoPrevious, | ||
45 | VideoStop, | 44 | VideoStop, |
46 | VideoPlay, | 45 | VideoPlay, |
47 | VideoPause, | 46 | // VideoPause, |
47 | VideoPrevious, | ||
48 | VideoNext, | 48 | VideoNext, |
49 | VideoPlayList, | 49 | VideoVolUp, |
50 | VideoVolDown, | ||
50 | VideoFullscreen | 51 | VideoFullscreen |
51 | }; | 52 | }; |
52 | 53 | ||
53 | class VideoWidget : public QWidget { | 54 | class VideoWidget : public QWidget { |
54 | Q_OBJECT | 55 | Q_OBJECT |
55 | public: | 56 | public: |
56 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
57 | ~VideoWidget(); | 58 | ~VideoWidget(); |
58 | 59 | ||
59 | bool playVideo(); | 60 | bool playVideo(); |
60 | XineVideoWidget* vidWidget(); | 61 | XineVideoWidget* vidWidget(); |
61 | public slots: | 62 | public slots: |
62 | void updateSlider( long, long ); | 63 | void updateSlider( long, long ); |
63 | void sliderPressed( ); | 64 | void sliderPressed( ); |
64 | void sliderReleased( ); | 65 | void sliderReleased( ); |
65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 66 | void setPaused( bool b); |
66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 67 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 68 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 69 | void makeVisible(); |
69 | void setPosition( long ); | 70 | void setPosition( long ); |
70 | void setLength( long ); | 71 | void setLength( long ); |
71 | void setView( char ); | 72 | void setView( char ); |
72 | 73 | ||
73 | signals: | 74 | signals: |
74 | void sliderMoved( long ); | 75 | void sliderMoved( long ); |
75 | void videoResized ( const QSize &s ); | 76 | void videoResized ( const QSize &s ); |
76 | 77 | ||
77 | protected: | 78 | protected: |
78 | QString skin; | 79 | QString skin; |
79 | void resizeEvent( QResizeEvent * ); | 80 | void resizeEvent( QResizeEvent * ); |
80 | void paintEvent( QPaintEvent *pe ); | 81 | void paintEvent( QPaintEvent *pe ); |
81 | void mouseMoveEvent( QMouseEvent *event ); | 82 | void mouseMoveEvent( QMouseEvent *event ); |
82 | void mousePressEvent( QMouseEvent *event ); | 83 | void mousePressEvent( QMouseEvent *event ); |
83 | void mouseReleaseEvent( QMouseEvent *event ); | 84 | void mouseReleaseEvent( QMouseEvent *event ); |
84 | void closeEvent( QCloseEvent *event ); | 85 | void closeEvent( QCloseEvent *event ); |
85 | void keyReleaseEvent( QKeyEvent *e); | 86 | void keyReleaseEvent( QKeyEvent *e); |
86 | 87 | ||
87 | private: | 88 | private: |
88 | // Ticker songInfo; | 89 | // Ticker songInfo; |
89 | QPixmap *pixBg; | 90 | QPixmap *pixBg; |
90 | QImage *imgUp; | 91 | QImage *imgUp; |
91 | QImage *imgDn; | 92 | QImage *imgDn; |
92 | QImage *imgButtonMask; | 93 | QImage *imgButtonMask; |
93 | QBitmap *masks[7]; | 94 | QBitmap *masks[7]; |
94 | QPixmap *buttonPixUp[7]; | 95 | QPixmap *buttonPixUp[7]; |
95 | QPixmap *buttonPixDown[7]; | 96 | QPixmap *buttonPixDown[7]; |
96 | // QPixmap *pixmaps[4]; | 97 | // QPixmap *pixmaps[4]; |
97 | int xoff, yoff; | 98 | int xoff, yoff; |
98 | 99 | ||
99 | 100 | ||
100 | void paintButton( QPainter *p, int i ); | 101 | void paintButton( QPainter *p, int i ); |
101 | void toggleButton( int ); | 102 | void toggleButton( int ); |
102 | void setToggleButton( int, bool ); | 103 | void setToggleButton( int, bool ); |
103 | 104 | ||
104 | QString backgroundPix; | 105 | QString backgroundPix; |
105 | QSlider *slider; | 106 | QSlider *slider; |
106 | QPixmap *pixmaps[3]; | 107 | QPixmap *pixmaps[3]; |
107 | QImage *currentFrame; | 108 | QImage *currentFrame; |
108 | int scaledWidth; | 109 | int scaledWidth; |
109 | int scaledHeight; | 110 | int scaledHeight; |
110 | XineVideoWidget* videoFrame; | 111 | XineVideoWidget* videoFrame; |
111 | }; | 112 | }; |
112 | 113 | ||
113 | #endif // VIDEO_WIDGET_H | 114 | #endif // VIDEO_WIDGET_H |
114 | 115 | ||
115 | 116 | ||
116 | 117 | ||