From 514bcdd05583f15195e939f67fa90fb6ec2dfc1f Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 23 Oct 2016 03:08:43 +0200 Subject: [PATCH] refs #786, follow up / corresponding adjustments based on context changes * removed reload models menu item * changed to renamed functions --- src/blackcore/aircraftmatcher.h | 1 + src/blackcore/airspacemonitor.h | 2 +- src/blackcore/simulator.h | 6 ++---- src/blackcore/simulatorcommon.cpp | 5 ----- src/blackcore/simulatorcommon.h | 1 - .../components/aircraftmodelstringcompleter.cpp | 4 ++-- .../components/infobarstatuscomponent.cpp | 2 +- src/blackgui/components/mappingcomponent.cpp | 15 +++------------ src/blackgui/components/mappingcomponent.h | 3 --- 9 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/blackcore/aircraftmatcher.h b/src/blackcore/aircraftmatcher.h index b5362f355..a40fdbfbe 100644 --- a/src/blackcore/aircraftmatcher.h +++ b/src/blackcore/aircraftmatcher.h @@ -103,6 +103,7 @@ namespace BlackCore BlackMisc::Simulation::CAircraftModelList getModelSet() const { return m_modelSet; } //! Set the models we want to use + //! \note use a set from "somewhere else" so it can also be used with arbitrary sets for testing int setModelSet(const BlackMisc::Simulation::CAircraftModelList &models); //! Default model diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index 73275d963..3c3fb1d65 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -220,7 +220,7 @@ namespace BlackCore CPartsPerCallsign m_partsByCallsign; //!< parts, for performance reasons per callsign, thread safe access required BlackMisc::Aviation::CCallsignSet m_aircraftSupportingParts; //!< aircraft supporting parts, thread safe access required - QMap m_flightPlanCache; //!< flight plan information retrieved any cached + QMap m_flightPlanCache; //!< flight plan information retrieved any cached INetwork *m_network = nullptr; //!< corresponding network interface CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer diff --git a/src/blackcore/simulator.h b/src/blackcore/simulator.h index 6a3d3548c..93c628ab2 100644 --- a/src/blackcore/simulator.h +++ b/src/blackcore/simulator.h @@ -53,7 +53,6 @@ namespace BlackCore public: //! ISimulator status - //! \todo Qt5.5: Make use of QFlags enum SimulatorStatusFlag { Disconnected = 0, @@ -114,9 +113,6 @@ namespace BlackCore //! Display a text message virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const = 0; - //! Reload the installed models from disk - virtual void reloadInstalledModels() = 0; - //! Airports in range from simulator virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const = 0; @@ -178,10 +174,12 @@ namespace BlackCore static QString statusToString(int status); //! Status to enum + //! \fixme remove with Qt 5.5 when SimulatorStatus can be transferred via DBus static SimulatorStatus statusToEnum(int status); signals: //! Simulator combined status + //! \fixme with Qt 5.5 make use of QFlags void simulatorStatusChanged(int status); //! Emitted when own aircraft model has changed diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index 68a9806a5..82984ecd4 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -241,11 +241,6 @@ namespace BlackCore this->m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider } - void CSimulatorCommon::reloadInstalledModels() - { - // currently we do nothing here - } - CLength CSimulatorCommon::getRenderedDistanceBoundary() const { return CLength(20.0, CLengthUnit::NM()); diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index 54d262a9d..772a10364 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -82,7 +82,6 @@ namespace BlackCore virtual const BlackMisc::Simulation::CSimulatorPluginInfo &getSimulatorPluginInfo() const override; virtual const BlackMisc::Simulation::CSimulatorSetup &getSimulatorSetup() const override; virtual void unload() override; - virtual void reloadInstalledModels() override; virtual void deleteAllRenderingRestrictions() override; virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override; //! @} diff --git a/src/blackgui/components/aircraftmodelstringcompleter.cpp b/src/blackgui/components/aircraftmodelstringcompleter.cpp index ea592ca06..d819a9ab9 100644 --- a/src/blackgui/components/aircraftmodelstringcompleter.cpp +++ b/src/blackgui/components/aircraftmodelstringcompleter.cpp @@ -103,7 +103,7 @@ namespace BlackGui { if (!this->m_completerOwnModels) { - const QStringList modelStrings = sGui->getIContextSimulator()->getInstalledModels().getModelStringList(); + const QStringList modelStrings = sGui->getIContextSimulator()->getModelSet().getModelStringList(); this->m_completerModelSet = new QCompleter(modelStrings, this); setCompleterParameters(this->m_completerModelSet); } @@ -113,7 +113,7 @@ namespace BlackGui { if (!this->m_completerOwnModels) { - const QStringList modelStrings = sGui->getIContextSimulator()->getInstalledModels().getModelStringList(); + const QStringList modelStrings = sGui->getIContextSimulator()->getModelSet().getModelStringList(); this->m_completerOwnModels = new QCompleter(modelStrings, this); setCompleterParameters(this->m_completerOwnModels); } diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index 19cf5a293..a4c10dd68 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -201,7 +201,7 @@ namespace BlackGui return; } - int models = sGui->getIContextSimulator()->getInstalledModelsCount(); + int models = sGui->getIContextSimulator()->getModelSetCount(); bool on = (models > 0); ui->led_MapperReady->setOn(on); if (on) diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 3d44efce5..0263d279d 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -66,6 +66,7 @@ namespace BlackGui ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnSimulatorModel); ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff); ui->tvp_AircraftModels->addFilterDialog(); + ui->tvp_AircraftModels->menuRemoveItems(CViewBaseNonTemplate::MenuBackend); ui->tvp_SimulatedAircraft->setAircraftMode(CSimulatedAircraftListModel::ModelMode); ui->tvp_SimulatedAircraft->setResizeMode(CAircraftModelView::ResizingOnce); @@ -73,7 +74,6 @@ namespace BlackGui connect(ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested); connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged); connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView); - connect(ui->tvp_AircraftModels, &CAircraftModelView::requestNewBackendData, this, &CMappingComponent::ps_onMenuRequestModelReload); connect(ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged); connect(ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView); @@ -267,7 +267,7 @@ namespace BlackGui bool changed = false; if (aircraftFromBackend.getModelString() != modelString) { - CAircraftModelList models = sGui->getIContextSimulator()->getInstalledModelsStartingWith(modelString); + CAircraftModelList models = sGui->getIContextSimulator()->getModelSetModelsStartingWith(modelString); if (models.isEmpty()) { CLogMessage(this).validationError("No model for title: %1") << modelString; @@ -320,7 +320,7 @@ namespace BlackGui void CMappingComponent::ps_onModelsUpdateRequested() { - const CAircraftModelList ml(sGui->getIContextSimulator()->getInstalledModels()); + const CAircraftModelList ml(sGui->getIContextSimulator()->getModelSet()); ui->tvp_AircraftModels->updateContainer(ml); } @@ -381,15 +381,6 @@ namespace BlackGui } } - void CMappingComponent::ps_onMenuRequestModelReload() - { - if (sGui->getIContextSimulator()) - { - sGui->getIContextSimulator()->reloadInstalledModels(); - CLogMessage(this).info("Requested to reload simulator aircraft models"); - } - } - CIdentifier CMappingComponent::mappingIdentifier() { if (m_identifier.getName().isEmpty()) diff --git a/src/blackgui/components/mappingcomponent.h b/src/blackgui/components/mappingcomponent.h index 547ec532a..6c4934dd8 100644 --- a/src/blackgui/components/mappingcomponent.h +++ b/src/blackgui/components/mappingcomponent.h @@ -130,9 +130,6 @@ namespace BlackGui //! Enable / disable aircraft void ps_onMenuEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); - //! Reload models - void ps_onMenuRequestModelReload(); - //! Highlight in simulator void ps_onMenuHighlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);