Commit 80b8fd88 authored by Boudhayan Gupta's avatar Boudhayan Gupta

Add strings for no delay and singular for seconds

BUG: 359978
FIXED-IN: 16.08
parent 2f5e7b82
......@@ -69,9 +69,10 @@ KSWidget::KSWidget(QWidget *parent) :
mDelayMsec->setSingleStep(1.0);
mDelayMsec->setMinimum(0.0);
mDelayMsec->setMaximum(999.9);
mDelayMsec->setSuffix(i18n(" seconds"));
mDelayMsec->setSpecialValueText(i18n("No Delay"));
mDelayMsec->setMinimumWidth(160);
connect(mDelayMsec, static_cast<void (SmartSpinBox::*)(qreal)>(&SmartSpinBox::valueChanged), configManager, &SpectacleConfig::setCaptureDelay);
connect(mDelayMsec, static_cast<void (SmartSpinBox::*)(qreal)>(&SmartSpinBox::valueChanged),
configManager, &SpectacleConfig::setCaptureDelay);
mCaptureOnClick = new QCheckBox(this);
mCaptureOnClick->setText(i18n("On Click"));
......
......@@ -18,11 +18,16 @@
*/
#include <QtMath>
#include <KLocalizedString>
#include "SmartSpinBox.h"
SmartSpinBox::SmartSpinBox(QWidget *parent) :
QDoubleSpinBox(parent)
{}
{
connect(this, static_cast<void (SmartSpinBox::*)(qreal)>(&SmartSpinBox::valueChanged),
this, &SmartSpinBox::suffixChangeHandler);
}
QString SmartSpinBox::textFromValue(double val) const
{
......@@ -31,3 +36,12 @@ QString SmartSpinBox::textFromValue(double val) const
}
return QWidget::locale().toString(val, 'f', decimals());
}
void SmartSpinBox::suffixChangeHandler(double val)
{
if (val <= 1.0) {
setSuffix(i18n(" second"));
} else {
setSuffix(i18n(" seconds"));
}
}
......@@ -30,6 +30,10 @@ class SmartSpinBox : public QDoubleSpinBox
explicit SmartSpinBox(QWidget *parent = 0);
QString textFromValue(double val) const Q_DECL_OVERRIDE;
private slots:
void suffixChangeHandler(double val);
};
#endif // SMARTSPINBOX_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment