diff options
author | Michele Calgaro <[email protected]> | 2013-11-21 01:24:32 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-11-21 01:24:32 +0100 |
commit | c4083c1d476f6dfd575599ffce4434e534251fd2 (patch) | |
tree | d4b1d6a3fc854da48e24e11d3dc69c0b0e971a60 /kcontrol | |
parent | 7d6186b592682b2a14c39b40a071f77d29fc8c7a (diff) | |
download | tdebase-c4083c1d476f6dfd575599ffce4434e534251fd2.tar.gz tdebase-c4083c1d476f6dfd575599ffce4434e534251fd2.zip |
Add GUI control to test kcontrol mouse double-click setting
This resolves Bug 1324
Diffstat (limited to 'kcontrol')
-rw-r--r-- | kcontrol/input/mouse.cpp | 29 | ||||
-rw-r--r-- | kcontrol/input/mouse.h | 8 |
2 files changed, 35 insertions, 2 deletions
diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp index 8957c6f87..4ec79c24c 100644 --- a/kcontrol/input/mouse.cpp +++ b/kcontrol/input/mouse.cpp @@ -256,6 +256,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) " The goal is to select a comfortable interval that you find" " is not too fast or slow."); TQWhatsThis::add( doubleClickLabel, wtstr ); + doubleClickStatus = false; // First image will be displayed doubleClickButton = new TQPushButton( tab2 ); doubleClickButton->setAcceptDrops( false ); // The images are 32x32. @@ -266,6 +267,9 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name) lay->addWidget(doubleClickButton); // Use the same What's This help for the pushbutton. TQWhatsThis::add( doubleClickButton, wtstr ); + connect(doubleClickButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotDoubleClickButtonPressed())); + doubleClickTimer=new TQTimer(); + connect(doubleClickTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotDoubleClickTimerDone()) ); lay->addSpacing(10); @@ -641,6 +645,31 @@ void MouseConfig::slotClick() } +void MouseConfig::slotDoubleClickButtonPressed() +{ + if (!doubleClickTimer->isActive()) + { + // First click or click after the timer has expired -> start the timer + doubleClickTimer->start(doubleClickInterval->value(), true); + } + else + { + // Double click event: stop the timer and change the picture + doubleClickTimer->stop(); + if (!doubleClickStatus) + doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_2.png")); + else + doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_1.png")); + doubleClickStatus= !doubleClickStatus; + } +} + +void MouseConfig::slotDoubleClickTimerDone() +{ + // Stop the timer, even though not strictly needed since it is a single shot timer + doubleClickTimer->stop(); +} + /** No descriptions */ void MouseConfig::slotHandedChanged(int val){ if(val==RIGHT_HANDED) diff --git a/kcontrol/input/mouse.h b/kcontrol/input/mouse.h index 833ef3bdc..487ceb2db 100644 --- a/kcontrol/input/mouse.h +++ b/kcontrol/input/mouse.h @@ -37,6 +37,7 @@ #include <tqlcdnumber.h> #include <tqpushbutton.h> #include <tqradiobutton.h> +#include <tqtimer.h> #include <tdeapplication.h> @@ -104,6 +105,8 @@ public: private slots: void slotClick(); + void slotDoubleClickButtonPressed(); + void slotDoubleClickTimerDone(); /** No descriptions */ void slotHandedChanged(int val); void slotScrollPolarityChanged(); @@ -149,9 +152,10 @@ private: KIntNumInput *mk_delay, *mk_interval, *mk_time_to_max, *mk_max_speed, *mk_curve; - TQLabel *doubleClickLabel; + TQLabel *doubleClickLabel; TQPushButton *doubleClickButton; - + TQTimer *doubleClickTimer; + bool doubleClickStatus; }; #endif |