summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (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
@@ -70,22 +70,20 @@ void changeTextColor( QWidget * w) {
}
AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
audioSliderBeingMoved( false )
{
+ Button defaultButton;
- Button defaultButton;
- defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
- Button toggleButton;
- toggleButton.isToggle = true;
- toggleButton.isHeld = toggleButton.isDown = false;
+ Button toggleButton = defaultButton;
+ toggleButton.buttonType = ToggleButton;
buttons.reserve( 10 );
buttons.push_back( toggleButton ); // play
buttons.push_back( defaultButton ); // stop
buttons.push_back( defaultButton ); // next
buttons.push_back( defaultButton ); // previous
buttons.push_back( defaultButton ); // volume up
buttons.push_back( defaultButton ); // volume down
@@ -384,17 +382,17 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
}
} else if ( !isOnButton && buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
- if ( !buttons[i].isToggle ) {
+ if ( buttons[i].buttonType != ToggleButton ) {
setToggleButton( i, FALSE );
}
qDebug("mouseEvent %d", i);
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
@@ -30,22 +30,23 @@
#include <vector>
class MediaWidget : public QWidget
{
Q_OBJECT
public:
enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
+ enum ButtonType { NormalButton, ToggleButton };
struct Button
{
- Button() : isToggle( false ), isHeld( false ), isDown( false ) {}
+ Button() : buttonType( NormalButton ), isHeld( false ), isDown( false ) {}
- bool isToggle : 1;
+ ButtonType buttonType : 1;
bool isHeld : 1;
bool isDown : 1;
};
typedef std::vector<Button> ButtonVector;
MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
virtual ~MediaWidget();
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
@@ -66,20 +66,18 @@ const char * const skinV_mask_file_names[7] = {
}
VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
: MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
{
setCaption( tr("OpiePlayer - Video") );
Button defaultButton;
- defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
- Button toggleButton;
- toggleButton.isToggle = true;
- toggleButton.isHeld = toggleButton.isDown = false;
+ Button toggleButton = defaultButton;
+ toggleButton.buttonType = ToggleButton;
buttons.reserve( 7 );
buttons.push_back( toggleButton ); // play
buttons.push_back( defaultButton ); // stop
buttons.push_back( defaultButton ); // next
buttons.push_back( defaultButton ); // previous
buttons.push_back( defaultButton ); // volUp
buttons.push_back( defaultButton ); // volDown
@@ -293,17 +291,17 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
} else if ( !isOnButton && buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
- if ( !buttons[i].isToggle ) {
+ if ( buttons[i].buttonType != ToggleButton ) {
setToggleButton( i, FALSE );
}
switch(i) {
case VideoPlay: {
if( mediaPlayerState.isPaused() ) {
setToggleButton( i, FALSE );