Callsign completer signal for entered callsign

* digest signals
* validChangedCallsignEntered
This commit is contained in:
Klaus Basan
2019-05-12 22:35:23 +02:00
parent 2e6d415c14
commit 9f9b4c3526
6 changed files with 17 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ namespace BlackGui
m_timerUpdateHistory.setInterval(2 * 1000); m_timerUpdateHistory.setInterval(2 * 1000);
this->initGui(); this->initGui();
m_text.setDefaultStyleSheet(CStatusMessageList::htmlStyleSheet()); m_text.setDefaultStyleSheet(CStatusMessageList::htmlStyleSheet());
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEntered, this, &CAircraftPartsHistory::callsignEntered); connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validChangedCallsignEntered, this, &CAircraftPartsHistory::callsignEntered);
connect(ui->cb_PartsHistoryEnabled, &QCheckBox::toggled, this, &CAircraftPartsHistory::toggleHistoryEnabled); connect(ui->cb_PartsHistoryEnabled, &QCheckBox::toggled, this, &CAircraftPartsHistory::toggleHistoryEnabled);
if (this->hasContexts()) if (this->hasContexts())

View File

@@ -91,12 +91,13 @@ namespace BlackGui
void CCallsignCompleter::onEditingFinished() void CCallsignCompleter::onEditingFinished()
{ {
const CCallsign cs = this->getCallsign(); const CCallsign cs = this->getCallsign();
if (cs.asString() == m_lastValue) { return; } // avoid unnecessary signals const bool changed = (cs.asString() == m_lastValue);
m_lastValue = cs.asString(); m_lastValue = cs.asString();
emit this->editingFinished(); m_dsEditingFinished.inputSignal();
if (cs.isValid()) if (cs.isValid())
{ {
emit this->validCallsignEntered(); m_dsValidCallsignEntered.inputSignal();
if (changed) { emit this->validChangedCallsignEntered(); }
} }
} }

View File

@@ -38,7 +38,7 @@ namespace BlackGui
explicit CCallsignCompleter(QWidget *parent = nullptr); explicit CCallsignCompleter(QWidget *parent = nullptr);
//! Dtor //! Dtor
virtual ~CCallsignCompleter(); virtual ~CCallsignCompleter() override;
//! Get the entered callsign //! Get the entered callsign
BlackMisc::Aviation::CCallsign getCallsign(bool onlyKnownCallsign = true) const; BlackMisc::Aviation::CCallsign getCallsign(bool onlyKnownCallsign = true) const;
@@ -56,11 +56,14 @@ namespace BlackGui
void setReadOnly(bool readOnly); void setReadOnly(bool readOnly);
signals: signals:
//! Callsign entered //! Changed callsign entered
void validCallsignEntered(); void validChangedCallsignEntered();
//! Changed callsign entered
void validCallsignEnteredDigest();
//! Editing finished //! Editing finished
void editingFinished(); void editingFinishedDigest();
private: private:
void updateCallsignsFromContext(); void updateCallsignsFromContext();
@@ -74,6 +77,8 @@ namespace BlackGui
QScopedPointer <Ui::CCallsignCompleter> ui; QScopedPointer <Ui::CCallsignCompleter> ui;
BlackMisc::CDigestSignal m_dsAircraftsInRangeChanged { this, &CCallsignCompleter::onChangedAircraftInRange, 5000, 5 }; BlackMisc::CDigestSignal m_dsAircraftsInRangeChanged { this, &CCallsignCompleter::onChangedAircraftInRange, 5000, 5 };
BlackMisc::CDigestSignal m_dsEditingFinished { this, &CCallsignCompleter::editingFinishedDigest, 500, 3 };
BlackMisc::CDigestSignal m_dsValidCallsignEntered { this, &CCallsignCompleter::validCallsignEnteredDigest, 500, 3 };
QString m_lastValue; QString m_lastValue;
}; };
} // ns } // ns

View File

@@ -29,7 +29,7 @@ namespace BlackGui
ui->tw_InterpolationSetup->setCurrentIndex(0); ui->tw_InterpolationSetup->setCurrentIndex(0);
connect(ui->comp_InterpolationSetup, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget, this, &CInterpolationComponent::requestRenderingRestrictionsWidget); connect(ui->comp_InterpolationSetup, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget, this, &CInterpolationComponent::requestRenderingRestrictionsWidget);
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEntered, this, &CInterpolationComponent::displayInterpolationMessages); connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validChangedCallsignEntered, this, &CInterpolationComponent::displayInterpolationMessages);
connect(ui->pb_ReloadInterpolationMessages, &QPushButton::released, this, &CInterpolationComponent::displayInterpolationMessages); connect(ui->pb_ReloadInterpolationMessages, &QPushButton::released, this, &CInterpolationComponent::displayInterpolationMessages);
} }

View File

@@ -55,7 +55,7 @@ namespace BlackGui
ui->tvp_InboundAircraftSituations->setWithMenuRequestElevation(true); ui->tvp_InboundAircraftSituations->setWithMenuRequestElevation(true);
connect(&m_updateTimer, &QTimer::timeout, this, &CInterpolationLogDisplay::updateLog); connect(&m_updateTimer, &QTimer::timeout, this, &CInterpolationLogDisplay::updateLog);
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::editingFinished, this, &CInterpolationLogDisplay::onCallsignEntered); connect(ui->comp_CallsignCompleter, &CCallsignCompleter::editingFinishedDigest, this, &CInterpolationLogDisplay::onCallsignEntered);
connect(ui->hs_UpdateTime, &QSlider::valueChanged, this, &CInterpolationLogDisplay::onSliderChanged); connect(ui->hs_UpdateTime, &QSlider::valueChanged, this, &CInterpolationLogDisplay::onSliderChanged);
connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop); connect(ui->pb_StartStop, &QPushButton::released, this, &CInterpolationLogDisplay::toggleStartStop);
connect(ui->pb_ResetLastSent, &QPushButton::released, this, &CInterpolationLogDisplay::resetLastSentValues); connect(ui->pb_ResetLastSent, &QPushButton::released, this, &CInterpolationLogDisplay::resetLastSentValues);

View File

@@ -34,7 +34,7 @@ namespace BlackGui
{ {
ui->setupUi(this); ui->setupUi(this);
m_text.setDefaultStyleSheet(CStatusMessageList::htmlStyleSheet()); m_text.setDefaultStyleSheet(CStatusMessageList::htmlStyleSheet());
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEntered, this, &CModelMatcherLogComponent::callsignEntered); connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEnteredDigest, this, &CModelMatcherLogComponent::callsignEntered);
} }
CModelMatcherLogComponent::~CModelMatcherLogComponent() CModelMatcherLogComponent::~CModelMatcherLogComponent()