author | simon <simon> | 2002-12-09 16:45:41 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:45:41 (UTC) |
commit | dbe0046eb82c8ee61ce7fc704d3b376730abc17f (patch) (unidiff) | |
tree | d8729a7844dc889024090afe1ffac1c6f3a3ab1b /noncore/multimedia/opieplayer2/mediawidget.cpp | |
parent | 1bb6aa52f2db85f65f75278310c328218caeae65 (diff) | |
download | opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.zip opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.gz opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.bz2 |
- yay, mouseMoveEvent is no more duplicated code :)
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 7eb75e6..3533d74 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -69,6 +69,50 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaWidget::mouseMoveEvent( QMouseEvent *event ) | ||
73 | { | ||
74 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | ||
75 | Button &button = *it; | ||
76 | Command command = button.command; | ||
77 | |||
78 | if ( event->state() == QMouseEvent::LeftButton ) { | ||
79 | // The test to see if the mouse click is inside the button or not | ||
80 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command ); | ||
81 | |||
82 | if ( isOnButton && !button.isHeld ) { | ||
83 | button.isHeld = TRUE; | ||
84 | toggleButton( button ); | ||
85 | switch ( command ) { | ||
86 | case VolumeUp: | ||
87 | emit moreClicked(); | ||
88 | return; | ||
89 | case VolumeDown: | ||
90 | emit lessClicked(); | ||
91 | return; | ||
92 | case Forward: | ||
93 | emit forwardClicked(); | ||
94 | return; | ||
95 | case Back: | ||
96 | emit backClicked(); | ||
97 | return; | ||
98 | default: break; | ||
99 | } | ||
100 | } else if ( !isOnButton && button.isHeld ) { | ||
101 | button.isHeld = FALSE; | ||
102 | toggleButton( button ); | ||
103 | } | ||
104 | } else { | ||
105 | if ( button.isHeld ) { | ||
106 | button.isHeld = FALSE; | ||
107 | if ( button.type != ToggleButton ) { | ||
108 | setToggleButton( button, FALSE ); | ||
109 | } | ||
110 | handleCommand( command, button.isDown ); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
72 | void MediaWidget::makeVisible() | 116 | void MediaWidget::makeVisible() |
73 | { | 117 | { |
74 | } | 118 | } |