mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Ref T534, fixed/improved settings component
* allow to set counts as info (see if something is filtered) * used Qt::QueuedConnection to not override changes in same step from toggled signal * set radio button correctly
This commit is contained in:
committed by
Mat Sutcliffe
parent
6fafaabbab
commit
74727469f0
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QStringBuilder>
|
||||||
|
|
||||||
using namespace BlackGui::Settings;
|
using namespace BlackGui::Settings;
|
||||||
|
|
||||||
@@ -24,9 +25,9 @@ namespace BlackGui
|
|||||||
ui(new Ui::CSettingsAtcStationsInlineComponent)
|
ui(new Ui::CSettingsAtcStationsInlineComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->rb_InRange, &QRadioButton::toggled, this, &CSettingsAtcStationsInlineComponent::changeSettings);
|
connect(ui->rb_InRange, &QRadioButton::toggled, this, &CSettingsAtcStationsInlineComponent::changeSettings, Qt::QueuedConnection);
|
||||||
connect(ui->cb_Frequency, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings);
|
connect(ui->cb_Frequency, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings, Qt::QueuedConnection);
|
||||||
connect(ui->cb_VoiceRoom, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings);
|
connect(ui->cb_VoiceRoom, &QRadioButton::released, this, &CSettingsAtcStationsInlineComponent::changeSettings, Qt::QueuedConnection);
|
||||||
|
|
||||||
QPointer<CSettingsAtcStationsInlineComponent> myself(this);
|
QPointer<CSettingsAtcStationsInlineComponent> myself(this);
|
||||||
QTimer::singleShot(2000, this, [ = ]
|
QTimer::singleShot(2000, this, [ = ]
|
||||||
@@ -39,10 +40,27 @@ namespace BlackGui
|
|||||||
CSettingsAtcStationsInlineComponent::~CSettingsAtcStationsInlineComponent()
|
CSettingsAtcStationsInlineComponent::~CSettingsAtcStationsInlineComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void CSettingsAtcStationsInlineComponent::setCounts(int all, int inRange)
|
||||||
|
{
|
||||||
|
static const QString sAll = ui->rb_All->text();
|
||||||
|
static const QString sInRange = ui->rb_InRange->text();
|
||||||
|
|
||||||
|
ui->rb_All->setText(all < 0 ? sAll : sAll % QStringLiteral(" (%1)").arg(all));
|
||||||
|
ui->rb_InRange->setText(inRange < 0 ? sInRange : sInRange % QStringLiteral(" (%1)").arg(inRange));
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingsAtcStationsInlineComponent::onSettingsChanged()
|
void CSettingsAtcStationsInlineComponent::onSettingsChanged()
|
||||||
{
|
{
|
||||||
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
|
const CAtcStationsSettings s = m_atcSettings.getThreadLocal();
|
||||||
ui->rb_InRange->setChecked(s.showOnlyInRange());
|
if (s.showOnlyInRange())
|
||||||
|
{
|
||||||
|
ui->rb_InRange->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->rb_All->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
ui->cb_Frequency->setChecked(s.showOnlyWithValidFrequency());
|
ui->cb_Frequency->setChecked(s.showOnlyWithValidFrequency());
|
||||||
ui->cb_VoiceRoom->setChecked(s.showOnlyWithValidVoiceRoom());
|
ui->cb_VoiceRoom->setChecked(s.showOnlyWithValidVoiceRoom());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace BlackGui
|
|||||||
//! Get the settings
|
//! Get the settings
|
||||||
Settings::CAtcStationsSettings getSettings() const { return m_atcSettings.get(); }
|
Settings::CAtcStationsSettings getSettings() const { return m_atcSettings.get(); }
|
||||||
|
|
||||||
|
//! Set count information
|
||||||
|
void setCounts(int all, int inRange);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Changed value
|
//! Changed value
|
||||||
void changed();
|
void changed();
|
||||||
|
|||||||
Reference in New Issue
Block a user