diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 3805b2570..3616a785a 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -96,6 +96,7 @@ namespace BlackGui connect(ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::onSaveAircraft); connect(ui->pb_ResetAircraft, &QPushButton::clicked, this, &CMappingComponent::onResetAircraft); connect(ui->pb_LoadModels, &QPushButton::clicked, this, &CMappingComponent::onModelsUpdateRequested); + connect(ui->pb_DoMatchingAgain, &QPushButton::clicked, this, &CMappingComponent::doMatchingsAgain); m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this); ui->tvp_RenderedAircraft->setItemDelegateForColumn(0, m_currentMappingsViewDelegate); @@ -294,6 +295,13 @@ namespace BlackGui ui->comp_SimulatorSelector->setToConnectedSimulator(50); } + void CMappingComponent::doMatchingsAgain() + { + if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; } + const int reMatchedNo = sGui->getIContextSimulator()->doMatchingsAgain(); + CLogMessage(this).info("Triggered re-apping of %1 aircraft") << reMatchedNo; + } + void CMappingComponent::onSaveAircraft() { if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; } diff --git a/src/blackgui/components/mappingcomponent.h b/src/blackgui/components/mappingcomponent.h index c483d7fc6..731c54ac8 100644 --- a/src/blackgui/components/mappingcomponent.h +++ b/src/blackgui/components/mappingcomponent.h @@ -31,7 +31,6 @@ #include #include -class QCompleter; class QModelIndex; namespace BlackMisc @@ -168,13 +167,16 @@ namespace BlackGui //! Plugin info has been changed void onSimulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &pluginInfo); + //! Do re-matching + void doMatchingsAgain(); + static constexpr int OverlayMessageMs = 5000; QScopedPointer ui; bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update QTimer m_updateTimer; BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1}; - Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view BlackMisc::CSettingReadOnly m_settings { this, &CMappingComponent::settingsChanged }; //!< settings changed + Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view }; } // namespace } // namespace diff --git a/src/blackgui/components/mappingcomponent.ui b/src/blackgui/components/mappingcomponent.ui index 69e9b2ad9..f9d872df9 100644 --- a/src/blackgui/components/mappingcomponent.ui +++ b/src/blackgui/components/mappingcomponent.ui @@ -6,8 +6,8 @@ 0 0 - 319 - 303 + 376 + 293 @@ -170,27 +170,20 @@ 3 - - - - - 0 - 20 - + + + + save selected model - - - - - Aircraft + save - enabled / disable + aircraft enabled/disable @@ -210,13 +203,13 @@ - - + + - save selected model + aircraft enabled - save + Enbl. @@ -227,13 +220,13 @@ - - + + - reset model by callsign + load model set - reset + load set @@ -256,17 +249,27 @@ - - - - load model set - - - load set + + + + + 0 + 20 + - + + + + do all matchings again + + + re-match + + + + QFrame::StyledPanel @@ -276,6 +279,20 @@ + + + + reset model by callsign + + + reset + + + + :/pastel/icons/pastel/16/arrow-refresh.png:/pastel/icons/pastel/16/arrow-refresh.png + + + @@ -318,6 +335,20 @@ 1 - + + tw_SpecializedViews + tvp_RenderedAircraft + cb_AircraftIconDisplayed + pb_LoadModels + cb_AircraftEnabled + le_Callsign + pb_ResetAircraft + pb_DoMatchingAgain + pb_SaveAircraft + tvp_AircraftModels + + + + diff --git a/src/blackgui/components/settingsmatchingcomponent.cpp b/src/blackgui/components/settingsmatchingcomponent.cpp index 17d7b6ec7..7f78cee63 100644 --- a/src/blackgui/components/settingsmatchingcomponent.cpp +++ b/src/blackgui/components/settingsmatchingcomponent.cpp @@ -12,8 +12,10 @@ #include "blackgui/guiapplication.h" #include "blackcore/context/contextsimulator.h" #include "blackmisc/simulation/aircraftmatchersetup.h" +#include "blackmisc/logmessage.h" #include +using namespace BlackMisc; using namespace BlackMisc::Simulation; using namespace BlackCore::Context; @@ -28,6 +30,7 @@ namespace BlackGui ui->setupUi(this); connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed); connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed); + connect(ui->pb_MatchingAgain, &QPushButton::released, this, &CSettingsMatchingComponent::onMatchingsAgainPressed); IContextSimulator *simContext = simulatorContext(); if (simContext) @@ -53,6 +56,13 @@ namespace BlackGui this->deferredReload(0); } + void CSettingsMatchingComponent::onMatchingsAgainPressed() + { + if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; } + const int reMatchedNo = sGui->getIContextSimulator()->doMatchingsAgain(); + CLogMessage(this).info("Triggered re-apping of %1 aircraft") << reMatchedNo; + } + void CSettingsMatchingComponent::onSetupChanged() { const IContextSimulator *simContext = simulatorContext(); diff --git a/src/blackgui/components/settingsmatchingcomponent.h b/src/blackgui/components/settingsmatchingcomponent.h index b3c08d7e8..852b50173 100644 --- a/src/blackgui/components/settingsmatchingcomponent.h +++ b/src/blackgui/components/settingsmatchingcomponent.h @@ -42,6 +42,9 @@ namespace BlackGui //! Reload pressed void onReloadPressed(); + //! Do re-matching + void onMatchingsAgainPressed(); + //! Setup has been changed void onSetupChanged(); diff --git a/src/blackgui/components/settingsmatchingcomponent.ui b/src/blackgui/components/settingsmatchingcomponent.ui index 74f4fd0d9..39764988e 100644 --- a/src/blackgui/components/settingsmatchingcomponent.ui +++ b/src/blackgui/components/settingsmatchingcomponent.ui @@ -6,8 +6,8 @@ 0 0 - 230 - 197 + 315 + 309 @@ -36,7 +36,7 @@ 0 0 - 211 + 296 375 @@ -83,6 +83,16 @@ + + + + do matching for all models again + + + re-matching + + +