mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
kdeplasma-addons: adjust to Plasma::SpinBox changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
b9161e7987
commit
d6f1e450e8
2 changed files with 16 additions and 16 deletions
|
@ -117,14 +117,14 @@ void UnitConverter::sltUnitChanged(int index)
|
|||
}
|
||||
}
|
||||
|
||||
void UnitConverter::sltValueChanged(const int iNewValue)
|
||||
void UnitConverter::sltValueChanged(const double iNewValue)
|
||||
{
|
||||
Q_UNUSED(iNewValue);
|
||||
m_bCalculateReverse = false; // store calculation direction
|
||||
calculate();
|
||||
}
|
||||
|
||||
void UnitConverter::sltValueChangedReverse(const int iNewValue)
|
||||
void UnitConverter::sltValueChangedReverse(const double iNewValue)
|
||||
{
|
||||
Q_UNUSED(iNewValue);
|
||||
m_bCalculateReverse = true; // store calculation direction
|
||||
|
@ -139,22 +139,22 @@ void UnitConverter::calculate()
|
|||
switch (m_pCmbCategory->nativeWidget()->currentIndex()) {
|
||||
case 0: {
|
||||
KTemperature temp(m_pSpnValue1->value(), static_cast<KTemperature::KTempUnit>(fromindex));
|
||||
m_pSpnValue2->setValue(qRound(temp.convertTo(static_cast<KTemperature::KTempUnit>(toindex))));
|
||||
m_pSpnValue2->setValue(temp.convertTo(static_cast<KTemperature::KTempUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
KVelocity velo(m_pSpnValue1->value(), static_cast<KVelocity::KVeloUnit>(fromindex));
|
||||
m_pSpnValue2->setValue(qRound(velo.convertTo(static_cast<KVelocity::KVeloUnit>(toindex))));
|
||||
m_pSpnValue2->setValue(velo.convertTo(static_cast<KVelocity::KVeloUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
KPressure pres(m_pSpnValue1->value(), static_cast<KPressure::KPresUnit>(fromindex));
|
||||
m_pSpnValue2->setValue(qRound(pres.convertTo(static_cast<KPressure::KPresUnit>(toindex))));
|
||||
m_pSpnValue2->setValue(pres.convertTo(static_cast<KPressure::KPresUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
KLength leng(m_pSpnValue1->value(), static_cast<KLength::KLengUnit>(fromindex));
|
||||
m_pSpnValue2->setValue(qRound(leng.convertTo(static_cast<KLength::KLengUnit>(toindex))));
|
||||
m_pSpnValue2->setValue(leng.convertTo(static_cast<KLength::KLengUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -168,22 +168,22 @@ void UnitConverter::calculateReverse()
|
|||
switch (m_pCmbCategory->nativeWidget()->currentIndex()) {
|
||||
case 0: {
|
||||
KTemperature temp(m_pSpnValue2->value(), static_cast<KTemperature::KTempUnit>(fromindex));
|
||||
m_pSpnValue1->setValue(qRound(temp.convertTo(static_cast<KTemperature::KTempUnit>(toindex))));
|
||||
m_pSpnValue1->setValue(temp.convertTo(static_cast<KTemperature::KTempUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
KVelocity velo(m_pSpnValue2->value(), static_cast<KVelocity::KVeloUnit>(fromindex));
|
||||
m_pSpnValue1->setValue(qRound(velo.convertTo(static_cast<KVelocity::KVeloUnit>(toindex))));
|
||||
m_pSpnValue1->setValue(velo.convertTo(static_cast<KVelocity::KVeloUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
KPressure pres(m_pSpnValue2->value(), static_cast<KPressure::KPresUnit>(fromindex));
|
||||
m_pSpnValue1->setValue(qRound(pres.convertTo(static_cast<KPressure::KPresUnit>(toindex))));
|
||||
m_pSpnValue1->setValue(pres.convertTo(static_cast<KPressure::KPresUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
KLength leng(m_pSpnValue2->value(), static_cast<KLength::KLengUnit>(fromindex));
|
||||
m_pSpnValue1->setValue(qRound(leng.convertTo(static_cast<KLength::KLengUnit>(toindex))));
|
||||
m_pSpnValue1->setValue(leng.convertTo(static_cast<KLength::KLengUnit>(toindex)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -230,10 +230,10 @@ QGraphicsWidget *UnitConverter::graphicsWidget()
|
|||
m_pCmbCategory->nativeWidget()->addItem(KPressure::description(), QVariant::fromValue(2));
|
||||
m_pCmbCategory->nativeWidget()->addItem(KLength::description(), QVariant::fromValue(3));
|
||||
|
||||
connect(m_pSpnValue1, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(sltValueChanged(int)));
|
||||
connect(m_pSpnValue2, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(sltValueChangedReverse(int)));
|
||||
connect(m_pSpnValue1, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(sltValueChanged(double)));
|
||||
connect(m_pSpnValue2, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(sltValueChangedReverse(double)));
|
||||
connect(m_pCmbCategory->nativeWidget(), SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(sltCategoryChanged(int)));
|
||||
connect(m_pCmbUnit1->nativeWidget(), SIGNAL(currentIndexChanged(int)),
|
||||
|
|
|
@ -53,8 +53,8 @@ class UnitConverter : public Plasma::PopupApplet
|
|||
void configChanged();
|
||||
|
||||
private slots:
|
||||
void sltValueChanged(const int iNewValue);
|
||||
void sltValueChangedReverse(const int iNewValue);
|
||||
void sltValueChanged(const double iNewValue);
|
||||
void sltValueChangedReverse(const double iNewValue);
|
||||
void sltUnitChanged(int index);
|
||||
void sltCategoryChanged(int index);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue