mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-11 18:28:55 -04:00
Fix some frequency display and l10n issues
Frequency display in the band combo box line edit was suffering floating point precision issues. Input of frequencies was not honoring current locale rules. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5881 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
@@ -22,14 +22,32 @@ namespace Radio
|
||||
}
|
||||
|
||||
|
||||
Frequency frequency (QVariant const& v, int scale)
|
||||
Frequency frequency (QVariant const& v, int scale, QLocale const& locale)
|
||||
{
|
||||
return std::llround (v.toDouble () * std::pow (10., scale));
|
||||
double value {0};
|
||||
if (QVariant::String == v.type ())
|
||||
{
|
||||
value = locale.toDouble (v.value<QString> ());
|
||||
}
|
||||
else
|
||||
{
|
||||
value = v.toDouble ();
|
||||
}
|
||||
return std::llround (value * std::pow (10., scale));
|
||||
}
|
||||
|
||||
FrequencyDelta frequency_delta (QVariant const& v, int scale)
|
||||
FrequencyDelta frequency_delta (QVariant const& v, int scale, QLocale const& locale)
|
||||
{
|
||||
return std::llround (v.toDouble () * std::pow (10., scale));
|
||||
double value {0};
|
||||
if (QVariant::String == v.type ())
|
||||
{
|
||||
value = locale.toDouble (v.value<QString> ());
|
||||
}
|
||||
else
|
||||
{
|
||||
value = v.toDouble ();
|
||||
}
|
||||
return std::llround (value * std::pow (10., scale));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user