mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #873, changed signal for selector in internal component
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2a0d0e1d84
commit
7e70662a29
@@ -86,6 +86,8 @@ namespace BlackGui
|
||||
connect(ui->pb_LatestPartsLog, &QPushButton::pressed, this, &CInternalsComponent::ps_showLogFiles);
|
||||
connect(ui->pb_RequestFromNetwork, &QPushButton::pressed, this, &CInternalsComponent::ps_requestPartsFromNetwork);
|
||||
|
||||
connect(ui->comp_RemoteAircraftSelector, &CRemoteAircraftSelector::changedCallsign, this, &CInternalsComponent::ps_selectorChanged);
|
||||
|
||||
contextFlagsToGui();
|
||||
}
|
||||
|
||||
@@ -312,6 +314,11 @@ namespace BlackGui
|
||||
});
|
||||
}
|
||||
|
||||
void CInternalsComponent::ps_selectorChanged()
|
||||
{
|
||||
this->ps_setCurrentParts();
|
||||
}
|
||||
|
||||
CAircraftParts CInternalsComponent::guiToAircraftParts() const
|
||||
{
|
||||
const CAircraftLights lights(
|
||||
|
||||
@@ -75,6 +75,9 @@ namespace BlackGui
|
||||
//! Request parts (aka aircraft config) from network
|
||||
void ps_requestPartsFromNetwork();
|
||||
|
||||
//! Selector has been changed
|
||||
void ps_selectorChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CInternalsComponent> ui;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace BlackGui
|
||||
Q_ASSERT(s);
|
||||
s = connect(sGui->getIContextNetwork(), &IContextNetwork::addedAircraft, this, &CRemoteAircraftSelector::ps_onAddedAircraft);
|
||||
Q_ASSERT(s);
|
||||
s = connect(ui->cb_RemoteAircraftSelector, &QComboBox::currentTextChanged, this, &CRemoteAircraftSelector::ps_comboBoxChanged);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
@@ -83,6 +84,13 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CRemoteAircraftSelector::ps_comboBoxChanged(const QString &text)
|
||||
{
|
||||
if (this->m_currentText == text) { return; }
|
||||
this->m_currentText = text;
|
||||
emit this->changedCallsign();
|
||||
}
|
||||
|
||||
void CRemoteAircraftSelector::fillComboBox()
|
||||
{
|
||||
if (!this->isVisible()) { return; } // for performance reasons
|
||||
@@ -127,6 +135,5 @@ namespace BlackGui
|
||||
ui->cb_RemoteAircraftSelector->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -47,6 +47,10 @@ namespace BlackGui
|
||||
//! Indicate if aircraft parts enabled aircraft
|
||||
void indicatePartsEnabled(bool indicate);
|
||||
|
||||
signals:
|
||||
//! Callsign changed
|
||||
void changedCallsign();
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::showEvent
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
@@ -58,15 +62,19 @@ namespace BlackGui
|
||||
//! IContextNetwork::removedAircraft
|
||||
void ps_onRemovedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Combo box has been changed
|
||||
void ps_comboBoxChanged(const QString &text);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CRemoteAircraftSelector> ui;
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
|
||||
|
||||
QString m_currentText;
|
||||
bool m_showPartsEnabled = false;
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_aircraft;
|
||||
|
||||
//! Set combobox items
|
||||
void fillComboBox();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user