Ref T385, allow to filter "by voiceroom"/"by frequency" so co-pilot (OBS login) can be shown

This commit is contained in:
Klaus Basan
2018-10-07 15:05:40 +02:00
parent f0297297c0
commit e6ae28b17d
6 changed files with 97 additions and 91 deletions

View File

@@ -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();

View File

@@ -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">

View File

@@ -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

View File

@@ -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">