diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp
index 9e14d7d48..80dd007ff 100644
--- a/src/blackgui/components/atcstationcomponent.cpp
+++ b/src/blackgui/components/atcstationcomponent.cpp
@@ -192,9 +192,9 @@ namespace BlackGui
if (m_timestampOnlineStationsChanged > m_timestampLastReadOnlineStations)
{
const CAtcStationsSettings settings = ui->comp_AtcStationsSettings->getSettings();
- CAtcStationList onlineStations =
- sGui->getIContextNetwork()->getAtcStationsOnline(true).stationsWithValidFrequency(); // alternatively: stationsWithValidVoiceRoom()
-
+ CAtcStationList onlineStations = sGui->getIContextNetwork()->getAtcStationsOnline(true);
+ if (settings.showOnlyWithValidFrequency()) { onlineStations = onlineStations.stationsWithValidFrequency(); }
+ if (settings.showOnlyWithValidVoiceRoom()) { onlineStations = onlineStations.stationsWithValidVoiceRoom(); }
if (settings.showOnlyInRange())
{
onlineStations.removeIfOutsideRange();
diff --git a/src/blackgui/components/atcstationcomponent.ui b/src/blackgui/components/atcstationcomponent.ui
index 71c6b7203..a716015cb 100644
--- a/src/blackgui/components/atcstationcomponent.ui
+++ b/src/blackgui/components/atcstationcomponent.ui
@@ -20,7 +20,7 @@
Online
-
+
3
@@ -61,23 +61,11 @@
- -
+
-
-
-
- 0
- 0
-
-
-
- 0
-
- 0
-
-
- 0
+ 2
0
@@ -95,19 +83,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
@@ -118,29 +93,6 @@
- -
-
-
- Load METAR
-
-
- METAR
-
-
-
- -
-
-
-
- 100
- 0
-
-
-
- Qt::StrongFocus
-
-
-
-
@@ -161,9 +113,32 @@
+ -
+
+
+ Load METAR
+
+
+ METAR
+
+
+
+ -
+
+
+
+ 100
+ 0
+
+
+
+ Qt::StrongFocus
+
+
+
-
diff --git a/src/blackgui/components/settingsatcstationsinlinecomponent.cpp b/src/blackgui/components/settingsatcstationsinlinecomponent.cpp
index cdb781aeb..1d43e3017 100644
--- a/src/blackgui/components/settingsatcstationsinlinecomponent.cpp
+++ b/src/blackgui/components/settingsatcstationsinlinecomponent.cpp
@@ -10,6 +10,9 @@
#include "settingsatcstationsinlinecomponent.h"
#include "ui_settingsatcstationsinlinecomponent.h"
+#include
+#include
+
using namespace BlackGui::Settings;
namespace BlackGui
@@ -22,6 +25,15 @@ namespace BlackGui
{
ui->setupUi(this);
connect(ui->rb_InRange, &QRadioButton::toggled, this, &CSettingsAtcStationsInlineComponent::changeSettings);
+ connect(ui->cb_Frequency, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings);
+ connect(ui->cb_VoiceRoom, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings);
+
+ QPointer myself(this);
+ QTimer::singleShot(2000, this, [ = ]
+ {
+ if (!myself) { return; }
+ this->onSettingsChanged();
+ });
}
CSettingsAtcStationsInlineComponent::~CSettingsAtcStationsInlineComponent()
@@ -31,16 +43,22 @@ namespace BlackGui
{
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
ui->rb_InRange->setChecked(s.showOnlyInRange());
+ ui->cb_Frequency->setChecked(s.showOnlyWithValidFrequency());
+ ui->cb_VoiceRoom->setChecked(s.showOnlyWithValidVoiceRoom());
}
void CSettingsAtcStationsInlineComponent::changeSettings()
{
const bool onlyInRange = ui->rb_InRange->isChecked();
+ const bool freq = ui->cb_Frequency->isChecked();
+ const bool voice = ui->cb_VoiceRoom->isChecked();
CAtcStationsSettings s = m_atcSettings.getThreadLocal();
- if (s.showOnlyInRange() && onlyInRange) { return; }
+ const CAtcStationsSettings oldSettings = s;
s.setShowOnlyInRange(onlyInRange);
+ s.setShowOnlyWithValidFrequency(freq);
+ s.setShowOnlyWithValidVoiceRoom(voice);
+ if (oldSettings == s) { return; }
m_atcSettings.setAndSave(s);
-
emit this->changed();
}
} // ns
diff --git a/src/blackgui/components/settingsatcstationsinlinecomponent.ui b/src/blackgui/components/settingsatcstationsinlinecomponent.ui
index d39beb82a..c9bad339b 100644
--- a/src/blackgui/components/settingsatcstationsinlinecomponent.ui
+++ b/src/blackgui/components/settingsatcstationsinlinecomponent.ui
@@ -6,38 +6,33 @@
0
0
- 159
- 26
+ 256
+ 31
Frame
-
-
- 3
-
-
- 3
-
-
- 3
-
-
- 3
-
+
-
-
-
- Qt::Horizontal
+
+
+ valid frequencies only
-
-
- 40
- 20
-
+
+ freq. only
-
+
+
+ -
+
+
+ valid voice rooms only
+
+
+ voice room only
+
+
-
diff --git a/src/blackgui/settings/atcstationssettings.cpp b/src/blackgui/settings/atcstationssettings.cpp
index cb92ad7db..c9618c74b 100644
--- a/src/blackgui/settings/atcstationssettings.cpp
+++ b/src/blackgui/settings/atcstationssettings.cpp
@@ -21,8 +21,8 @@ namespace BlackGui
QString CAtcStationsSettings::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
- static const QString s("In range only: %1");
- return s.arg(boolToOnOff(this->showOnlyInRange()));
+ static const QString s("In range only: %1 valid freq: %2 valid voice room: %3");
+ return s.arg(boolToOnOff(this->showOnlyInRange()), boolToOnOff(this->showOnlyWithValidFrequency()), boolToOnOff(this->showOnlyWithValidVoiceRoom()));
}
CVariant CAtcStationsSettings::propertyByIndex(const CPropertyIndex &index) const
@@ -32,6 +32,8 @@ namespace BlackGui
switch (i)
{
case IndexInRangeOnly: return CVariant::fromValue(m_showOnlyInRange);
+ case IndexValidFrequencyOnly: return CVariant::fromValue(m_onlyWithValidFrequency);
+ case IndexValidVoiceRoomOnly: return CVariant::fromValue(m_onlyWithValidVoiceRoom);
default: return CValueObject::propertyByIndex(index);
}
}
@@ -42,12 +44,10 @@ namespace BlackGui
const ColumnIndex i = index.frontCasted();
switch (i)
{
- case IndexInRangeOnly:
- this->setShowOnlyInRange(variant.toBool());
- break;
- default:
- CValueObject::setPropertyByIndex(index, variant);
- break;
+ case IndexInRangeOnly: this->setShowOnlyInRange(variant.toBool()); break;
+ case IndexValidFrequencyOnly: this->setShowOnlyWithValidFrequency(variant.toBool()); break;
+ case IndexValidVoiceRoomOnly: this->setShowOnlyWithValidVoiceRoom(variant.toBool()); break;
+ default: CValueObject::setPropertyByIndex(index, variant); break;
}
}
} // ns
diff --git a/src/blackgui/settings/atcstationssettings.h b/src/blackgui/settings/atcstationssettings.h
index f808f3fdd..3e301e1dd 100644
--- a/src/blackgui/settings/atcstationssettings.h
+++ b/src/blackgui/settings/atcstationssettings.h
@@ -28,17 +28,31 @@ namespace BlackGui
enum ColumnIndex
{
IndexInRangeOnly = BlackMisc::CPropertyIndex::GlobalIndexCAtcStationsSettings,
+ IndexValidFrequencyOnly,
+ IndexValidVoiceRoomOnly
};
//! Default constructor
CAtcStationsSettings();
- //! Show in range ATC stations only
+ //! Show in range ATC stations only?
bool showOnlyInRange() const { return m_showOnlyInRange; }
- //! Show in range ATC stations only?
+ //! Show in range ATC stations only
void setShowOnlyInRange(bool onlyInRange) { m_showOnlyInRange = onlyInRange; }
+ //! Show only with valid frequency?
+ bool showOnlyWithValidFrequency() const { return m_onlyWithValidFrequency; }
+
+ //! Show only with valid frequency
+ void setShowOnlyWithValidFrequency(bool onlyValidFrequency) { m_onlyWithValidFrequency = onlyValidFrequency; }
+
+ //! Show only with valid voice room?
+ bool showOnlyWithValidVoiceRoom() const { return m_onlyWithValidVoiceRoom; }
+
+ //! Show only with valid voice room
+ void setShowOnlyWithValidVoiceRoom(bool onlyValidVoiceRoom) { m_onlyWithValidVoiceRoom = onlyValidVoiceRoom; }
+
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;
@@ -50,10 +64,14 @@ namespace BlackGui
private:
bool m_showOnlyInRange = true;
+ bool m_onlyWithValidFrequency = true;
+ bool m_onlyWithValidVoiceRoom = false;
BLACK_METACLASS(
CAtcStationsSettings,
- BLACK_METAMEMBER(showOnlyInRange)
+ BLACK_METAMEMBER(showOnlyInRange),
+ BLACK_METAMEMBER(onlyWithValidFrequency),
+ BLACK_METAMEMBER(onlyWithValidVoiceRoom)
);
};