mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-12 12:45:40 +08:00
Improved rounding for COM frequencies to 25KHz in GUI
This commit is contained in:
@@ -176,6 +176,13 @@ private:
|
||||
*/
|
||||
bool isCockpitUpdatePending() const;
|
||||
|
||||
/*!
|
||||
* \brief Round the com frequency display
|
||||
* \param com1
|
||||
* \param com2
|
||||
*/
|
||||
void roundComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||
|
||||
/*!
|
||||
* \brief Add new text message tab
|
||||
* \param tabName
|
||||
|
||||
@@ -388,7 +388,7 @@ QSizeGrip {
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pg_StatusPage">
|
||||
<property name="sizePolicy">
|
||||
@@ -894,7 +894,7 @@ QSizeGrip {
|
||||
<double>136.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.250000000000000</double>
|
||||
<double>0.025000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>118.000000000000000</double>
|
||||
@@ -946,7 +946,7 @@ QSizeGrip {
|
||||
<double>136.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.250000000000000</double>
|
||||
<double>0.025000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>119.000000000000000</double>
|
||||
@@ -980,7 +980,7 @@ QSizeGrip {
|
||||
<double>136.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.250000000000000</double>
|
||||
<double>0.025000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>118.250000000000000</double>
|
||||
@@ -1011,7 +1011,7 @@ QSizeGrip {
|
||||
<double>136.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.250000000000000</double>
|
||||
<double>0.025000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>119.250000000000000</double>
|
||||
|
||||
@@ -54,6 +54,7 @@ void MainWindow::cockpitValuesChanged()
|
||||
}
|
||||
|
||||
// this will call send cockpit updates with all changes made
|
||||
// send cockpit updates
|
||||
this->m_timerCollectedCockpitUpdates->stop();
|
||||
this->m_timerCollectedCockpitUpdates->start(1000); // start
|
||||
this->m_timerCollectedCockpitUpdates->setSingleShot(true);
|
||||
@@ -78,22 +79,7 @@ void MainWindow::updateCockpitFromContext()
|
||||
const CComSystem com2 = this->m_ownAircraft.getCom2System();
|
||||
const CTransponder transponder = this->m_ownAircraft.getTransponder();
|
||||
|
||||
double freq = com1.getFrequencyActive().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom1Active->value())
|
||||
this->ui->ds_CockpitCom1Active->setValue(freq);
|
||||
|
||||
freq = com2.getFrequencyActive().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom2Active->value())
|
||||
this->ui->ds_CockpitCom2Active->setValue(freq);
|
||||
|
||||
freq = com1.getFrequencyStandby().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom1Standby->value())
|
||||
this->ui->ds_CockpitCom1Standby->setValue(freq);
|
||||
|
||||
freq = com2.getFrequencyStandby().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom2Standby->value())
|
||||
this->ui->ds_CockpitCom2Standby->setValue(freq);
|
||||
|
||||
this->roundComFrequencyDisplays(com1, com2);
|
||||
qint32 tc = transponder.getTransponderCode();
|
||||
if (tc != static_cast<qint32>(this->ui->ds_CockpitTransponder->value()))
|
||||
this->ui->ds_CockpitTransponder->setValue(tc);
|
||||
@@ -146,6 +132,30 @@ void MainWindow::updateCockpitFromContext()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Round the com frequency displays
|
||||
*/
|
||||
void MainWindow::roundComFrequencyDisplays(const CComSystem &com1, const CComSystem &com2)
|
||||
{
|
||||
// do not just set! Leads to unwanted signals fired
|
||||
double freq = com1.getFrequencyActive().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom1Active->value())
|
||||
this->ui->ds_CockpitCom1Active->setValue(freq);
|
||||
|
||||
freq = com2.getFrequencyActive().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom2Active->value())
|
||||
this->ui->ds_CockpitCom2Active->setValue(freq);
|
||||
|
||||
freq = com1.getFrequencyStandby().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom1Standby->value())
|
||||
|
||||
this->ui->ds_CockpitCom1Standby->setValue(freq);
|
||||
|
||||
freq = com2.getFrequencyStandby().valueRounded(3);
|
||||
if (freq != this->ui->ds_CockpitCom2Standby->value())
|
||||
this->ui->ds_CockpitCom2Standby->setValue(freq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset transponder mode to Standby / Charly
|
||||
*/
|
||||
@@ -210,6 +220,7 @@ void MainWindow::sendCockpitUpdates()
|
||||
com1.setFrequencyStandbyMHz(this->ui->ds_CockpitCom1Standby->value());
|
||||
com2.setFrequencyActiveMHz(this->ui->ds_CockpitCom2Active->value());
|
||||
com2.setFrequencyStandbyMHz(this->ui->ds_CockpitCom2Standby->value());
|
||||
this->roundComFrequencyDisplays(com1, com2);
|
||||
|
||||
//
|
||||
// Send to context
|
||||
|
||||
Reference in New Issue
Block a user