diff --git a/src/blackgui/components/configurationwizard.ui b/src/blackgui/components/configurationwizard.ui
index 7af068c4c..97f2b4ab7 100644
--- a/src/blackgui/components/configurationwizard.ui
+++ b/src/blackgui/components/configurationwizard.ui
@@ -146,7 +146,7 @@
-
- I do this later / do not need this
+ I do this later / do not need this
@@ -274,6 +274,12 @@
+
+ BlackGui::Components::CFirstModelSetComponent
+ QFrame
+ blackgui/components/firstmodelsetcomponent.h
+ 1
+
BlackGui::Components::CConfigSimulatorComponent
QFrame
@@ -322,12 +328,6 @@
blackgui/components/installxswiftbuscomponent.h
1
-
- BlackGui::Components::CFirstModelSetComponent
- QFrame
- blackgui/components/firstmodelsetcomponent.h
- 1
-
BlackGui::Components::CFirstModelSetWizardPage
QWizardPage
diff --git a/src/blackgui/components/firstmodelsetcomponent.cpp b/src/blackgui/components/firstmodelsetcomponent.cpp
index 27c7946e7..8e589e07a 100644
--- a/src/blackgui/components/firstmodelsetcomponent.cpp
+++ b/src/blackgui/components/firstmodelsetcomponent.cpp
@@ -9,12 +9,16 @@
#include "firstmodelsetcomponent.h"
#include "ui_firstmodelsetcomponent.h"
+#include "blackmisc/directoryutils.h"
#include "dbownmodelsdialog.h"
#include "dbownmodelscomponent.h"
#include "dbownmodelsetdialog.h"
#include "dbownmodelsetcomponent.h"
-#include
+#include
+#include
+
+using namespace BlackMisc;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Simulation::Settings;
@@ -40,6 +44,8 @@ namespace BlackGui
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
connect(ui->pb_Models, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
connect(ui->pb_ModelsTriggerReload, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
+ connect(ui->pb_ChangeModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
+ connect(this->modelLoader(), &IAircraftModelLoader::simulatorSettingsChanged, this, &CFirstModelSetComponent::onSimulatorChanged, Qt::QueuedConnection);
}
CFirstModelSetComponent::~CFirstModelSetComponent()
@@ -99,6 +105,13 @@ namespace BlackGui
const CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings() const
{
+ Q_ASSERT(this->modelLoader());
+ return this->modelLoader()->multiSimulatorSettings();
+ }
+
+ CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings()
+ {
+ Q_ASSERT(this->modelLoader());
return this->modelLoader()->multiSimulatorSettings();
}
@@ -106,7 +119,7 @@ namespace BlackGui
{
m_modelsDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
m_modelsDialog->show();
- bool const reload = QObject::sender() == ui->pb_ModelsTriggerReload;
+ bool const reload = (QObject::sender() == ui->pb_ModelsTriggerReload);
if (reload) { m_modelsDialog->requestModelsInBackground(ui->comp_SimulatorSelector->getValue(), true); }
}
@@ -116,6 +129,19 @@ namespace BlackGui
m_modelSetDialog->show();
}
+ void CFirstModelSetComponent::changeModelDirectory()
+ {
+ const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
+ const QString dirOld = this->simulatorSettings().getFirstModelDirectoryOrDefault(simulator);
+ const QString newDir = QFileDialog::getExistingDirectory(this->parentWidget(), tr("Open model directory"), dirOld, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ if (newDir.isEmpty() || CDirectoryUtils::isSameExistingDirectory(dirOld, newDir)) { return; }
+ CStatusMessage msg = this->simulatorSettings().addModelDirectory(newDir, simulator);
+ if (msg.isSuccess())
+ {
+ msg = this->simulatorSettings().saveSettings(simulator);
+ }
+ }
+
bool CFirstModelSetWizardPage::validatePage()
{
return true;
diff --git a/src/blackgui/components/firstmodelsetcomponent.h b/src/blackgui/components/firstmodelsetcomponent.h
index 37c280ee7..b7796a72a 100644
--- a/src/blackgui/components/firstmodelsetcomponent.h
+++ b/src/blackgui/components/firstmodelsetcomponent.h
@@ -45,7 +45,7 @@ namespace BlackGui
private:
QScopedPointer ui;
- QScopedPointer m_modelsDialog;
+ QScopedPointer m_modelsDialog;
QScopedPointer m_modelSetDialog;
//! Simulator has been changed
@@ -66,11 +66,17 @@ namespace BlackGui
//! Simulator settings
const BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings() const;
+ //! Simulator settings
+ BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings();
+
//! Open own models dialog
void openOwnModelsDialog();
//! Own model set dialog
void openOwnModelSetDialog();
+
+ //! Change model directory
+ void changeModelDirectory();
};
//! Wizard page for CFirstModelSetComponent
diff --git a/src/blackgui/components/firstmodelsetcomponent.ui b/src/blackgui/components/firstmodelsetcomponent.ui
index 24ff8bb36..6455e140a 100644
--- a/src/blackgui/components/firstmodelsetcomponent.ui
+++ b/src/blackgui/components/firstmodelsetcomponent.ui
@@ -7,7 +7,7 @@
0
0
640
- 480
+ 400
@@ -40,113 +40,99 @@
- -
-
-
-
- 200
- 0
-
-
-
-
-
-
-
-
-
-
-
- Model dir.:
+
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
+ 5
+
+
+ 10
+
+
-
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 200
+
- -
+
-
+
+
+ reload
+
+
+
+ -
+
+
+ true
+
+
+ model set info
+
+
+
+ -
+
+
+ Model set
+
+
+
+ -
true
+
+ model directory from settings
+
- -
+
-
+
+
+ true
+
+
+ model info
+
+
+
+ -
Models:
- -
-
-
-
-
-
- set
-
-
-
- -
-
-
- models
-
-
-
- -
-
-
- reload
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- true
-
-
-
-
-
- -
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
- -
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
+
-
+
+
+ Model dir.:
+
-
@@ -156,19 +142,37 @@
- -
-
+
-
+
+
+ Simulator:
+
+
+
+ -
+
+
+ display
+
+
+
+ -
+
- 0
- 125
+ 100
+ 0
-
- QFrame::StyledPanel
+
+ display
-
- QFrame::Raised
+
+
+ -
+
+
+ change
@@ -191,6 +195,15 @@
1
+
+ le_ModelDirectories
+ pb_ChangeModelDir
+ le_ModelsInfo
+ pb_Models
+ pb_ModelsTriggerReload
+ le_ModelSetInfo
+ pb_ModelSet
+