mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 16:01:14 -05:00
Set az/el l/b column precision based on rotator precision
This commit is contained in:
parent
65013b47ff
commit
aba0e30a4f
@ -2596,9 +2596,13 @@ void RadioAstronomyGUI::updateRotatorList(const QList<RadioAstronomySettings::Av
|
|||||||
// if the chosen rotator appears
|
// if the chosen rotator appears
|
||||||
int rotatorIndex = ui->rotator->findText(m_settings.m_rotator);
|
int rotatorIndex = ui->rotator->findText(m_settings.m_rotator);
|
||||||
|
|
||||||
if (rotatorIndex >= 0) {
|
if (rotatorIndex >= 0)
|
||||||
|
{
|
||||||
ui->rotator->setCurrentIndex(rotatorIndex);
|
ui->rotator->setCurrentIndex(rotatorIndex);
|
||||||
} else {
|
setColumnPrecisionFromRotator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->rotator->setCurrentIndex(0); // return to None
|
ui->rotator->setCurrentIndex(0); // return to None
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2709,6 +2713,36 @@ void RadioAstronomyGUI::on_rotator_currentTextChanged(const QString& text)
|
|||||||
{
|
{
|
||||||
m_settings.m_rotator = text;
|
m_settings.m_rotator = text;
|
||||||
applySettings();
|
applySettings();
|
||||||
|
setColumnPrecisionFromRotator();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioAstronomyGUI::setColumnPrecisionFromRotator()
|
||||||
|
{
|
||||||
|
// Match rotator precision
|
||||||
|
const QRegExp re("F([0-9]+):([0-9]+)");
|
||||||
|
if (re.indexIn(m_settings.m_rotator) >= 0)
|
||||||
|
{
|
||||||
|
int featureSetIndex = re.capturedTexts()[1].toInt();
|
||||||
|
int featureIndex = re.capturedTexts()[2].toInt();
|
||||||
|
|
||||||
|
int precision = 0;
|
||||||
|
if (ChannelWebAPIUtils::getFeatureSetting(featureSetIndex, featureIndex, "precision", precision))
|
||||||
|
{
|
||||||
|
int old = ((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_GAL_LAT))->getPrecision();
|
||||||
|
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_GAL_LAT))->setPrecision(precision);
|
||||||
|
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_GAL_LON))->setPrecision(precision);
|
||||||
|
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_AZ))->setPrecision(precision);
|
||||||
|
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_EL))->setPrecision(precision);
|
||||||
|
if (precision > old)
|
||||||
|
{
|
||||||
|
ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LAT);
|
||||||
|
ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LON);
|
||||||
|
ui->powerTable->resizeColumnToContents(POWER_COL_AZ);
|
||||||
|
ui->powerTable->resizeColumnToContents(POWER_COL_EL);
|
||||||
|
}
|
||||||
|
ui->powerTable->viewport()->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioAstronomyGUI::on_showSensors_clicked()
|
void RadioAstronomyGUI::on_showSensors_clicked()
|
||||||
|
@ -449,6 +449,7 @@ private:
|
|||||||
void calcPowerChartTickCount(int width);
|
void calcPowerChartTickCount(int width);
|
||||||
void calcSpectrumChartTickCount(QValueAxis *axis, int width);
|
void calcSpectrumChartTickCount(QValueAxis *axis, int width);
|
||||||
int powerYUnitsToIndex(RadioAstronomySettings::PowerYUnits units);
|
int powerYUnitsToIndex(RadioAstronomySettings::PowerYUnits units);
|
||||||
|
void setColumnPrecisionFromRotator();
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
void enterEvent(EnterEventType*);
|
void enterEvent(EnterEventType*);
|
||||||
|
@ -29,6 +29,8 @@ public:
|
|||||||
DecimalDelegate(int precision = 2);
|
DecimalDelegate(int precision = 2);
|
||||||
|
|
||||||
virtual QString displayText(const QVariant &value, const QLocale &locale) const override;
|
virtual QString displayText(const QVariant &value, const QLocale &locale) const override;
|
||||||
|
int getPrecision() const { return m_precision; }
|
||||||
|
void setPrecision(int precision) { m_precision = precision; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_precision;
|
int m_precision;
|
||||||
|
Loading…
Reference in New Issue
Block a user