mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 09:15:34 +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)
|
if (m_timestampOnlineStationsChanged > m_timestampLastReadOnlineStations)
|
||||||
{
|
{
|
||||||
const CAtcStationsSettings settings = ui->comp_AtcStationsSettings->getSettings();
|
const CAtcStationsSettings settings = ui->comp_AtcStationsSettings->getSettings();
|
||||||
CAtcStationList onlineStations =
|
CAtcStationList onlineStations = sGui->getIContextNetwork()->getAtcStationsOnline(true);
|
||||||
sGui->getIContextNetwork()->getAtcStationsOnline(true).stationsWithValidFrequency(); // alternatively: stationsWithValidVoiceRoom()
|
if (settings.showOnlyWithValidFrequency()) { onlineStations = onlineStations.stationsWithValidFrequency(); }
|
||||||
|
if (settings.showOnlyWithValidVoiceRoom()) { onlineStations = onlineStations.stationsWithValidVoiceRoom(); }
|
||||||
if (settings.showOnlyInRange())
|
if (settings.showOnlyInRange())
|
||||||
{
|
{
|
||||||
onlineStations.removeIfOutsideRange();
|
onlineStations.removeIfOutsideRange();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Online</string>
|
<string>Online</string>
|
||||||
</attribute>
|
</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">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -61,23 +61,11 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item alignment="Qt::AlignLeft">
|
||||||
<widget class="QFrame" name="fr_AtcStationsOnlineBottom">
|
<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">
|
<layout class="QGridLayout" name="gl_Buttons">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -95,19 +83,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="0" column="3">
|
||||||
<widget class="QToolButton" name="tb_AtcStationsAtisReload">
|
<widget class="QToolButton" name="tb_AtcStationsAtisReload">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -118,29 +93,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="0" column="4">
|
||||||
<widget class="QToolButton" name="tb_Audio">
|
<widget class="QToolButton" name="tb_Audio">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -161,9 +113,32 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
#include "settingsatcstationsinlinecomponent.h"
|
#include "settingsatcstationsinlinecomponent.h"
|
||||||
#include "ui_settingsatcstationsinlinecomponent.h"
|
#include "ui_settingsatcstationsinlinecomponent.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
using namespace BlackGui::Settings;
|
using namespace BlackGui::Settings;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -22,6 +25,15 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->rb_InRange, &QRadioButton::toggled, this, &CSettingsAtcStationsInlineComponent::changeSettings);
|
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()
|
CSettingsAtcStationsInlineComponent::~CSettingsAtcStationsInlineComponent()
|
||||||
@@ -31,16 +43,22 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
|
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
|
||||||
ui->rb_InRange->setChecked(s.showOnlyInRange());
|
ui->rb_InRange->setChecked(s.showOnlyInRange());
|
||||||
|
ui->cb_Frequency->setChecked(s.showOnlyWithValidFrequency());
|
||||||
|
ui->cb_VoiceRoom->setChecked(s.showOnlyWithValidVoiceRoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsAtcStationsInlineComponent::changeSettings()
|
void CSettingsAtcStationsInlineComponent::changeSettings()
|
||||||
{
|
{
|
||||||
const bool onlyInRange = ui->rb_InRange->isChecked();
|
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();
|
CAtcStationsSettings s = m_atcSettings.getThreadLocal();
|
||||||
if (s.showOnlyInRange() && onlyInRange) { return; }
|
const CAtcStationsSettings oldSettings = s;
|
||||||
s.setShowOnlyInRange(onlyInRange);
|
s.setShowOnlyInRange(onlyInRange);
|
||||||
|
s.setShowOnlyWithValidFrequency(freq);
|
||||||
|
s.setShowOnlyWithValidVoiceRoom(voice);
|
||||||
|
if (oldSettings == s) { return; }
|
||||||
m_atcSettings.setAndSave(s);
|
m_atcSettings.setAndSave(s);
|
||||||
|
|
||||||
emit this->changed();
|
emit this->changed();
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -6,38 +6,33 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>159</width>
|
<width>256</width>
|
||||||
<height>26</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Frame</string>
|
<string>Frame</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hl_AtcStationsSettins">
|
<layout class="QHBoxLayout" name="hl_AtcStationsInlineComponent">
|
||||||
<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>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hs_AtcStationsInline">
|
<widget class="QCheckBox" name="cb_Frequency">
|
||||||
<property name="orientation">
|
<property name="toolTip">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>valid frequencies only</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="text">
|
||||||
<size>
|
<string>freq. only</string>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</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>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rb_All">
|
<widget class="QRadioButton" name="rb_All">
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace BlackGui
|
|||||||
QString CAtcStationsSettings::convertToQString(bool i18n) const
|
QString CAtcStationsSettings::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
static const QString s("In range only: %1");
|
static const QString s("In range only: %1 valid freq: %2 valid voice room: %3");
|
||||||
return s.arg(boolToOnOff(this->showOnlyInRange()));
|
return s.arg(boolToOnOff(this->showOnlyInRange()), boolToOnOff(this->showOnlyWithValidFrequency()), boolToOnOff(this->showOnlyWithValidVoiceRoom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CAtcStationsSettings::propertyByIndex(const CPropertyIndex &index) const
|
CVariant CAtcStationsSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||||
@@ -32,6 +32,8 @@ namespace BlackGui
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexInRangeOnly: return CVariant::fromValue(m_showOnlyInRange);
|
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);
|
default: return CValueObject::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,12 +44,10 @@ namespace BlackGui
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexInRangeOnly:
|
case IndexInRangeOnly: this->setShowOnlyInRange(variant.toBool()); break;
|
||||||
this->setShowOnlyInRange(variant.toBool());
|
case IndexValidFrequencyOnly: this->setShowOnlyWithValidFrequency(variant.toBool()); break;
|
||||||
break;
|
case IndexValidVoiceRoomOnly: this->setShowOnlyWithValidVoiceRoom(variant.toBool()); break;
|
||||||
default:
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -28,17 +28,31 @@ namespace BlackGui
|
|||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexInRangeOnly = BlackMisc::CPropertyIndex::GlobalIndexCAtcStationsSettings,
|
IndexInRangeOnly = BlackMisc::CPropertyIndex::GlobalIndexCAtcStationsSettings,
|
||||||
|
IndexValidFrequencyOnly,
|
||||||
|
IndexValidVoiceRoomOnly
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
CAtcStationsSettings();
|
CAtcStationsSettings();
|
||||||
|
|
||||||
//! Show in range ATC stations only
|
//! Show in range ATC stations only?
|
||||||
bool showOnlyInRange() const { return m_showOnlyInRange; }
|
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; }
|
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
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
@@ -50,10 +64,14 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_showOnlyInRange = true;
|
bool m_showOnlyInRange = true;
|
||||||
|
bool m_onlyWithValidFrequency = true;
|
||||||
|
bool m_onlyWithValidVoiceRoom = false;
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CAtcStationsSettings,
|
CAtcStationsSettings,
|
||||||
BLACK_METAMEMBER(showOnlyInRange)
|
BLACK_METAMEMBER(showOnlyInRange),
|
||||||
|
BLACK_METAMEMBER(onlyWithValidFrequency),
|
||||||
|
BLACK_METAMEMBER(onlyWithValidVoiceRoom)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user