mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Ref T385, allow to filter "by voiceroom"/"by frequency" so co-pilot (OBS login) can be shown
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<attribute name="title">
|
||||
<string>Online</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsOnline" stretch="4,0,1">
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsOnline" stretch="4,0,0,1">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
@@ -61,23 +61,11 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QFrame" name="fr_AtcStationsOnlineBottom">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
@@ -95,19 +83,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<spacer name="hs_buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="tb_AtcStationsAtisReload">
|
||||
<property name="toolTip">
|
||||
@@ -118,29 +93,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="tb_AtcStationsLoadMetar">
|
||||
<property name="toolTip">
|
||||
<string>Load METAR</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>METAR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="BlackGui::Components::CSettingsAtcStationsInlineComponent" name="comp_AtcStationsSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="tb_Audio">
|
||||
<property name="toolTip">
|
||||
@@ -161,9 +113,32 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="tb_AtcStationsLoadMetar">
|
||||
<property name="toolTip">
|
||||
<string>Load METAR</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>METAR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="BlackGui::Components::CSettingsAtcStationsInlineComponent" name="comp_AtcStationsSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "settingsatcstationsinlinecomponent.h"
|
||||
#include "ui_settingsatcstationsinlinecomponent.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QPointer>
|
||||
|
||||
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<CSettingsAtcStationsInlineComponent> 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
|
||||
|
||||
@@ -6,38 +6,33 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>159</width>
|
||||
<height>26</height>
|
||||
<width>256</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_AtcStationsSettins">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_AtcStationsInlineComponent">
|
||||
<item>
|
||||
<spacer name="hs_AtcStationsInline">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QCheckBox" name="cb_Frequency">
|
||||
<property name="toolTip">
|
||||
<string>valid frequencies only</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>freq. only</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_VoiceRoom">
|
||||
<property name="toolTip">
|
||||
<string>valid voice rooms only</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>voice room only</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_All">
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user