summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp8
3 files changed, 10 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 8659971..56b75f2 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -74,14 +74,12 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
74 74
75 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 75 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
76 audioSliderBeingMoved( false ) 76 audioSliderBeingMoved( false )
77{ 77{
78 Button defaultButton;
78 79
79 Button defaultButton; 80 Button toggleButton = defaultButton;
80 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 81 toggleButton.buttonType = ToggleButton;
81 Button toggleButton;
82 toggleButton.isToggle = true;
83 toggleButton.isHeld = toggleButton.isDown = false;
84 82
85 buttons.reserve( 10 ); 83 buttons.reserve( 10 );
86 buttons.push_back( toggleButton ); // play 84 buttons.push_back( toggleButton ); // play
87 buttons.push_back( defaultButton ); // stop 85 buttons.push_back( defaultButton ); // stop
@@ -388,9 +386,9 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
388 } 386 }
389 } else { 387 } else {
390 if ( buttons[i].isHeld ) { 388 if ( buttons[i].isHeld ) {
391 buttons[i].isHeld = FALSE; 389 buttons[i].isHeld = FALSE;
392 if ( !buttons[i].isToggle ) { 390 if ( buttons[i].buttonType != ToggleButton ) {
393 setToggleButton( i, FALSE ); 391 setToggleButton( i, FALSE );
394 } 392 }
395 qDebug("mouseEvent %d", i); 393 qDebug("mouseEvent %d", i);
396 handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); 394 handleCommand( static_cast<Command>( i ), buttons[ i ].isDown );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 46c304d..aa8891f 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -34,14 +34,15 @@ class MediaWidget : public QWidget
34{ 34{
35 Q_OBJECT 35 Q_OBJECT
36public: 36public:
37 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; 37 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
38 enum ButtonType { NormalButton, ToggleButton };
38 39
39 struct Button 40 struct Button
40 { 41 {
41 Button() : isToggle( false ), isHeld( false ), isDown( false ) {} 42 Button() : buttonType( NormalButton ), isHeld( false ), isDown( false ) {}
42 43
43 bool isToggle : 1; 44 ButtonType buttonType : 1;
44 bool isHeld : 1; 45 bool isHeld : 1;
45 bool isDown : 1; 46 bool isDown : 1;
46 }; 47 };
47 typedef std::vector<Button> ButtonVector; 48 typedef std::vector<Button> ButtonVector;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 2f51c82..23acfa3 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -70,12 +70,10 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
70{ 70{
71 setCaption( tr("OpiePlayer - Video") ); 71 setCaption( tr("OpiePlayer - Video") );
72 72
73 Button defaultButton; 73 Button defaultButton;
74 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 74 Button toggleButton = defaultButton;
75 Button toggleButton; 75 toggleButton.buttonType = ToggleButton;
76 toggleButton.isToggle = true;
77 toggleButton.isHeld = toggleButton.isDown = false;
78 76
79 buttons.reserve( 7 ); 77 buttons.reserve( 7 );
80 buttons.push_back( toggleButton ); // play 78 buttons.push_back( toggleButton ); // play
81 buttons.push_back( defaultButton ); // stop 79 buttons.push_back( defaultButton ); // stop
@@ -297,9 +295,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
297 } else { 295 } else {
298 296
299 if ( buttons[i].isHeld ) { 297 if ( buttons[i].isHeld ) {
300 buttons[i].isHeld = FALSE; 298 buttons[i].isHeld = FALSE;
301 if ( !buttons[i].isToggle ) { 299 if ( buttons[i].buttonType != ToggleButton ) {
302 setToggleButton( i, FALSE ); 300 setToggleButton( i, FALSE );
303 } 301 }
304 302
305 switch(i) { 303 switch(i) {