Add preliminary support to improve kcontrol keyboard repeat speed setting.

This partially resolves bug report 1349.
pull/2/head
Darrell Anderson 11 years ago
parent 48e7fc5a76
commit 8f1fb61e82

@ -61,17 +61,15 @@ KeyboardConfig::KeyboardConfig (TQWidget * parent, const char *)
ui->click->setRange(0, 100, 10);
ui->delay->setRange(100, 5000, 50, false);
ui->rate->setRange(0.2, 50, 5, false);
ui->rate->setRange(5, 50, 5, false);
sliderMax = (int)floor (0.5
+ 2*(log(5000)-log(100)) / (log(5000)-log(4999)));
ui->delaySlider->setRange(0, sliderMax);
ui->delaySlider->setSteps(sliderMax/100, sliderMax/10);
ui->delaySlider->setTickInterval(sliderMax/10);
ui->delaySlider->setRange(1000, 50000);
ui->delaySlider->setSteps(50, 500);
ui->delaySlider->setTickInterval(2500);
ui->rateSlider->setRange(20, 5000);
ui->rateSlider->setSteps(30, 500);
ui->rateSlider->setTickInterval(498);
ui->rateSlider->setRange(500, 5000);
ui->rateSlider->setSteps(50, 500);
ui->rateSlider->setTickInterval(500);
connect(ui->repeatBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed()));
connect(ui->delay, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(delaySpinboxChanged(int)));
@ -85,11 +83,6 @@ KeyboardConfig::KeyboardConfig (TQWidget * parent, const char *)
#if !defined(HAVE_XTEST) && !defined(HAVE_XKB)
ui->numlockGroup->setDisabled( true );
#endif
#if !defined(HAVE_XKB) && !defined(HAVE_XF86MISC)
// delay->setDisabled( true );
// rate->setDisabled( true );
#endif
// lay->addStretch();
load();
}
@ -138,8 +131,8 @@ void KeyboardConfig::load()
config.setGroup("Keyboard");
bool key = config.readBoolEntry("KeyboardRepeating", true);
keyboardRepeat = (key ? AutoRepeatModeOn : AutoRepeatModeOff);
ui->delay->setValue(config.readNumEntry( "RepeatDelay", 660 ));
ui->rate->setValue(config.readDoubleNumEntry( "RepeatRate", 25 ));
ui->delay->setValue(config.readNumEntry( "RepeatDelay", 500 ));
ui->rate->setValue(config.readDoubleNumEntry( "RepeatRate", 30 ));
clickVolume = config.readNumEntry("ClickVolume", kbd.key_click_percent);
numlockState = config.readNumEntry( "NumLock", 2 );
@ -179,7 +172,7 @@ void KeyboardConfig::save()
void KeyboardConfig::defaults()
{
setClick(50);
setRepeat(true, 660, 25);
setRepeat(true, 500, 30);
setNumLockState( 2 );
}
@ -196,25 +189,19 @@ TQString KeyboardConfig::quickHelp() const
}
void KeyboardConfig::delaySliderChanged (int value) {
double alpha = sliderMax / (log(5000) - log(100));
double linearValue = exp (value/alpha + log(100));
ui->delay->setValue((int)floor(0.5 + linearValue));
ui->delay->setValue(value/10);
emit TDECModule::changed(true);
}
void KeyboardConfig::delaySpinboxChanged (int value) {
double alpha = sliderMax / (log(5000) - log(100));
double logVal = alpha * (log(value)-log(100));
ui->delaySlider->setValue ((int)floor (0.5 + logVal));
ui->delaySlider->setValue ((int)(value*10));
emit TDECModule::changed(true);
}
void KeyboardConfig::rateSliderChanged (int value) {
ui->rate->setValue(value/100.0);
ui->rate->setValue(value/100);
emit TDECModule::changed(true);
}
@ -557,7 +544,7 @@ void KeyboardConfig::init_keyboard()
&kbdc);
if( key ) {
int delay_ = config->readNumEntry("RepeatDelay", 250);
int delay_ = config->readNumEntry("RepeatDelay", 500);
double rate_ = config->readDoubleNumEntry("RepeatRate", 30);
set_repeatrate(delay_, rate_);
}
@ -571,4 +558,3 @@ void KeyboardConfig::init_keyboard()
}
#include "kcmmisc.moc"

@ -85,7 +85,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="1" column="0">
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>lblDelay</cstring>
</property>
@ -104,7 +104,7 @@
<cstring>delay</cstring>
</property>
</widget>
<widget class="TQSlider" row="1" column="1">
<widget class="TQSlider" row="2" column="1">
<property name="name">
<cstring>delaySlider</cstring>
</property>
@ -136,7 +136,7 @@
<string>If supported, this option allows you to set the delay after which a pressed key will start generating keycodes. The 'Repeat rate' option controls the frequency of these keycodes.</string>
</property>
</widget>
<widget class="KIntNumInput" row="1" column="2" rowspan="1" colspan="1">
<widget class="KIntNumInput" row="2" column="2" rowspan="1" colspan="1">
<property name="name">
<cstring>delay</cstring>
</property>
@ -156,7 +156,7 @@
<string>If supported, this option allows you to set the delay after which a pressed key will start generating keycodes. The 'Repeat rate' option controls the frequency of these keycodes.</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>lblRate</cstring>
</property>
@ -175,7 +175,7 @@
<cstring>rate</cstring>
</property>
</widget>
<widget class="TQSlider" row="2" column="1" rowspan="1" colspan="1">
<widget class="TQSlider" row="3" column="1" rowspan="1" colspan="1">
<property name="name">
<cstring>rateSlider</cstring>
</property>
@ -207,7 +207,7 @@
<string>If supported, this option allows you to set the rate at which keycodes are generated while a key is pressed.</string>
</property>
</widget>
<widget class="KDoubleNumInput" row="2" column="2" rowspan="1" colspan="1">
<widget class="KDoubleNumInput" row="3" column="2" rowspan="1" colspan="1">
<property name="name">
<cstring>rate</cstring>
</property>
@ -244,6 +244,20 @@
<string>If you check this option, pressing and holding down a key emits the same character over and over again. For example, pressing and holding down the Tab key will have the same effect as that of pressing that key several times in succession: Tab characters continue to be emitted until you release the key.</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>repeatBoxBIOS</cstring>
</property>
<property name="text">
<string>Use &amp;BIOS settings</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="whatsThis" stdset="0">
<string>If you check this option, pressing and holding down a key emits the same character over and over again as set in the BIOS. For example, pressing and holding down the Tab key will have the same effect as that of pressing that key several times in succession: Tab characters continue to be emitted until you release the key.</string>
</property>
</widget>
</grid>
</widget>
<widget class="KIntNumInput" row="2" column="1">
@ -297,6 +311,12 @@
<receiver>delaySlider</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>repeatBox</sender>
<signal>toggled(bool)</signal>
<receiver>repeatBoxBIOS</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>repeatBox</sender>
<signal>toggled(bool)</signal>
@ -330,6 +350,7 @@
</connections>
<tabstops>
<tabstop>repeatBox</tabstop>
<tabstop>repeatBoxBIOS</tabstop>
<tabstop>click</tabstop>
<tabstop>RadioButton1</tabstop>
<tabstop>RadioButton1_2</tabstop>

Loading…
Cancel
Save