From 313c5f5638b695ae24ec7ec7aa596fb38b98fae0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 1 Apr 2015 14:41:40 +0200 Subject: [PATCH] refs #361, own reader to fix unbalanced " issue * some functions renamed * move some code from .h to .cpp * adjusted samples --- samples/blackmiscsim/main.cpp | 2 +- samples/blackmiscsim/samplesfscommon.cpp | 2 +- samples/blackmiscsim/samplesmodelmapping.cpp | 2 +- src/blackgui/components/mappingcomponent.cpp | 7 ++++--- src/blackgui/components/mappingcomponent.h | 2 +- src/blackgui/components/mappingcomponent.ui | 18 ++++++++++++++++++ 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/samples/blackmiscsim/main.cpp b/samples/blackmiscsim/main.cpp index 6ec5ffa52..00f6e0de9 100644 --- a/samples/blackmiscsim/main.cpp +++ b/samples/blackmiscsim/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) BlackMisc::registerMetadata(); streamOut << "Run samples:" << endl; - streamOut << "1 .. FS common / Simulation" << endl; + streamOut << "1 .. FS common / Simulation (with cfg files reading)" << endl; streamOut << "2 .. FSX" << endl; streamOut << "3 .. Mappings" << endl; streamOut << "x .. exit" << endl; diff --git a/samples/blackmiscsim/samplesfscommon.cpp b/samples/blackmiscsim/samplesfscommon.cpp index 546943269..16e197ac9 100644 --- a/samples/blackmiscsim/samplesfscommon.cpp +++ b/samples/blackmiscsim/samplesfscommon.cpp @@ -37,7 +37,7 @@ namespace BlackSimTest return 0; } - streamOut << "start reading" << endl; + streamOut << "start reading, press RETURN" << endl; QString input = streamIn.readLine(); Q_UNUSED(input); diff --git a/samples/blackmiscsim/samplesmodelmapping.cpp b/samples/blackmiscsim/samplesmodelmapping.cpp index 1ba2dbb10..46a83700d 100644 --- a/samples/blackmiscsim/samplesmodelmapping.cpp +++ b/samples/blackmiscsim/samplesmodelmapping.cpp @@ -35,7 +35,7 @@ namespace BlackSimTest std::unique_ptr cvm(new CVPilotModelMappings(true)); bool s = cvm->read(); streamOut << "directory: " << CVPilotModelMappings::standardMappingsDirectory() << endl; - streamOut << "loaded: " << (s ? "yes" : "no") << " size: " << cvm->size() << endl; + streamOut << "loaded: " << BlackMisc::boolToYesNo(s) << " size: " << cvm->size() << endl; // mapper with rule set, handing over ownership CAircraftMapper mapper(std::move(cvm)); diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 5efde405c..2ffa5fbfc 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -95,7 +95,7 @@ namespace BlackGui Q_ASSERT(getIContextNetwork()); connect(getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CMappingComponent::ps_onAircraftModelsLoaded); connect(getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_onModelMatchingCompleted); - connect(getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::ps_onRenderedAircraftModelChanged); + connect(getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::ps_onRemoteAircraftModelChanged); connect(getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::ps_onChangedAircraftEnabled); connect(getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::ps_onFastPositionUpdatesEnabled); connect(getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::ps_onConnectionStatusChanged); @@ -177,7 +177,8 @@ namespace BlackGui const int MaxHeight = 125; this->ui->lbl_AircraftIconDisplayed->setText(""); this->ui->lbl_AircraftIconDisplayed->setToolTip(model.getDescription()); - CPixmap pm = this->getIContextSimulator()->iconForModel(model.getModelString()); + QString modelString(model.getModelString()); + CPixmap pm = this->getIContextSimulator()->iconForModel(modelString); if (pm.isNull()) { this->ui->lbl_AircraftIconDisplayed->setPixmap(CIcons::crossWhite16()); @@ -301,7 +302,7 @@ namespace BlackGui this->ui->le_AircraftModel->setCompleter(this->m_modelCompleter); } - void CMappingComponent::ps_onRenderedAircraftModelChanged(const CSimulatedAircraft &aircraft, const QString &originator) + void CMappingComponent::ps_onRemoteAircraftModelChanged(const CSimulatedAircraft &aircraft, const QString &originator) { this->updateSimulatedAircraftView(); Q_UNUSED(originator); diff --git a/src/blackgui/components/mappingcomponent.h b/src/blackgui/components/mappingcomponent.h index 38c4cdd9e..450539b93 100644 --- a/src/blackgui/components/mappingcomponent.h +++ b/src/blackgui/components/mappingcomponent.h @@ -92,7 +92,7 @@ namespace BlackGui void ps_onModelsUpdateRequested(); //! Rendered aircraft changed in backend - void ps_onRenderedAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator); + void ps_onRemoteAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator); //! Aircraft enabled, disabled in backend void ps_onChangedAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator); diff --git a/src/blackgui/components/mappingcomponent.ui b/src/blackgui/components/mappingcomponent.ui index 10f64163f..0fbccefa0 100644 --- a/src/blackgui/components/mappingcomponent.ui +++ b/src/blackgui/components/mappingcomponent.ui @@ -64,6 +64,12 @@ + + + 0 + 0 + + 0 @@ -86,6 +92,12 @@ + + + 0 + 0 + + QAbstractItemView::SingleSelection @@ -118,6 +130,12 @@ + + + 0 + 0 + + QAbstractItemView::SingleSelection