diff --git a/src/blackgui/components/settingssimulatorcomponent.cpp b/src/blackgui/components/settingssimulatorcomponent.cpp index 450da1d9b..d6b90b1ad 100644 --- a/src/blackgui/components/settingssimulatorcomponent.cpp +++ b/src/blackgui/components/settingssimulatorcomponent.cpp @@ -61,7 +61,7 @@ namespace BlackGui m_plugins->collectPlugins(); ui->setupUi(this); - CLedWidget::LedShape shape = CLedWidget::Circle; + const CLedWidget::LedShape shape = CLedWidget::Circle; ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14); ui->led_RenderingEnabled->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Rendering enabled", "No aircraft will be rendered", 14); @@ -78,6 +78,7 @@ namespace BlackGui connect(ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance); connect(ui->pb_ClearRestrictedRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::clearRestricedRendering); connect(ui->pb_DisableRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyDisableRendering); + connect(ui->pb_Check, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::checkSimulatorPlugins); connect(ui->le_MaxAircraft, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft); connect(ui->le_MaxDistance, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance); connect(ui->le_MaxAircraft, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft); @@ -119,6 +120,7 @@ namespace BlackGui ui->pb_ApplyMaxDistance->setEnabled(m_pluginLoaded); ui->pb_ClearRestrictedRendering->setEnabled((m_pluginLoaded)); ui->pb_DisableRendering->setEnabled(m_pluginLoaded); + ui->pb_Check->setEnabled(!m_pluginLoaded); if (m_pluginLoaded) { @@ -285,7 +287,7 @@ namespace BlackGui void CSettingsSimulatorComponent::showPluginDetails(const QString &identifier) { - const CSimulatorPluginInfoList simDrivers(getAvailablePlugins()); + const CSimulatorPluginInfoList simDrivers(this->getAvailablePlugins()); const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier); QWidget *aw = qApp->activeWindow(); @@ -325,11 +327,17 @@ namespace BlackGui { // list all available simulators const auto enabledSimulators = m_enabledSimulators.getThreadLocal(); - for (const auto &p : getAvailablePlugins()) + for (const auto &p : this->getAvailablePlugins()) { ui->pluginSelector_EnabledSimulators->setEnabled(p.getIdentifier(), enabledSimulators.contains(p.getIdentifier())); } } - } + void CSettingsSimulatorComponent::checkSimulatorPlugins() + { + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; } + if (sGui->getIContextSimulator()->isSimulatorAvailable()) { return; } // already available + sGui->getIContextSimulator()->checkListeners(); + } + } } // namespace diff --git a/src/blackgui/components/settingssimulatorcomponent.h b/src/blackgui/components/settingssimulatorcomponent.h index 7fbf397ba..42c33f9c8 100644 --- a/src/blackgui/components/settingssimulatorcomponent.h +++ b/src/blackgui/components/settingssimulatorcomponent.h @@ -22,8 +22,6 @@ #include #include -class QWidget; - namespace BlackCore { class CPluginManagerSimulator; } namespace BlackMisc { namespace Simulation { class CSimulatorPluginInfo; } } namespace Ui { class CSettingsSimulatorComponent; } @@ -56,7 +54,7 @@ namespace BlackGui //! Apply disable rendering void onApplyDisableRendering(); - //! Apply time sync + //! Apply time synchronization void onApplyTimeSync(); //! Clear restricted rendering @@ -74,6 +72,9 @@ namespace BlackGui //! Select/deselect enabled/disabled plugins void reloadPluginConfig(); + //! Check plugins again + void checkSimulatorPlugins(); + //! Set the GUI values void setGuiValues(); diff --git a/src/blackgui/components/settingssimulatorcomponent.ui b/src/blackgui/components/settingssimulatorcomponent.ui index b920b868a..502498a6e 100644 --- a/src/blackgui/components/settingssimulatorcomponent.ui +++ b/src/blackgui/components/settingssimulatorcomponent.ui @@ -7,7 +7,7 @@ 0 0 220 - 255 + 260 @@ -35,243 +35,32 @@ 2 - - - - Simulator info will go here + + + + + 0 + 0 + - - true - - - - - - - Current rendering restrictions (if any) - - - Restrictions - - - - - - - 4 - - - - - - - - restriction info - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - clear - - - - - - - - - Loaded - - - - - - 0 - 50 + 60 + 0 - - - - - - Time synchronization + + + 60 + 16777215 + - Time synch. - - - - - - - Rendering enabled - - - Rendering en. + apply - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - disable - - - - - - - - - 4 - - - - - no restrictions - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - apply - - - - - - - - - Check - - - - - - - Max.dist.(NM) - - - - - - - 4 - - - - - no restrictions - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - apply - - - - - - @@ -324,49 +113,226 @@ - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - apply - - - + + + + + 10 + 0 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + apply + + + + + + Current rendering restrictions (if any) + + + Restrictions + + + + + + + Time synchronization + + + Time synch. + + + + + + + 4 + + + + + + + + restriction info + + + + + + + + + Loaded + + + + + + + Rendering enabled + + + Rendering en. + + + + + + + Max.dist.(NM) + + + + + + + 4 + + + + + no restrictions + + + + + + + + + 4 + + + + + no restrictions + + + + + + Max.aircraft - - + + + + + 0 + 0 + + + + + 60 + 0 + + + + + 60 + 16777215 + + - check + apply - + + + + + 0 + 0 + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + clear + + + + + + + + 0 + 50 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + disable + + + + Qt::Vertical @@ -382,6 +348,23 @@ + + + + check again + + + + + + + Simulator info will go here + + + true + + + @@ -399,16 +382,10 @@ - pb_Check cb_TimeSync le_TimeSyncOffset - pb_ApplyTimeSync - pb_DisableRendering - pb_ClearRestrictedRendering le_MaxAircraft - pb_ApplyMaxAircraft le_MaxDistance - pb_ApplyMaxDistance