diff --git a/src/blackgui/components/configurationwizard.h b/src/blackgui/components/configurationwizard.h
index e3c4f07fd..93b1fe671 100644
--- a/src/blackgui/components/configurationwizard.h
+++ b/src/blackgui/components/configurationwizard.h
@@ -37,6 +37,7 @@ namespace BlackGui
ConfigSimulator,
XSwiftBus,
DataLoad,
+ FirstModelSet,
ConfigHotkeys
};
diff --git a/src/blackgui/components/configurationwizard.ui b/src/blackgui/components/configurationwizard.ui
index 00c7579a4..4efd5a414 100644
--- a/src/blackgui/components/configurationwizard.ui
+++ b/src/blackgui/components/configurationwizard.ui
@@ -150,7 +150,7 @@
4
- -
+
-
QFrame::StyledPanel
@@ -160,6 +160,13 @@
+ -
+
+
+ I do not have X-Plane / I will do this later / Is already installed
+
+
+
@@ -194,6 +201,45 @@
+
+
+ First model set
+
+
+ Configure a simple model set
+
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+ -
+
+
+ I will do that later (skip)
+
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+
+
Hotkeys
@@ -281,7 +327,52 @@
blackgui/components/installxswiftbuscomponent.h
1
+
+ BlackGui::Components::CFirstModelSetComponent
+ QFrame
+ blackgui/components/firstmodelsetcomponent.h
+ 1
+
+
+ BlackGui::Components::CFirstModelSetWizardPage
+ QWizardPage
+ blackgui/components/firstmodelsetcomponent.h
+ 1
+
-
+
+
+ pb_SkipFirstModelSet
+ clicked()
+ CConfigurationWizard
+ next()
+
+
+ 749
+ 70
+
+
+ 804
+ 75
+
+
+
+
+ pb_SkipXSwiftBus
+ clicked()
+ CConfigurationWizard
+ next()
+
+
+ 713
+ 63
+
+
+ 791
+ 64
+
+
+
+
diff --git a/src/blackgui/components/dbownmodelscomponent.cpp b/src/blackgui/components/dbownmodelscomponent.cpp
index f471e4c3a..a2b33b105 100644
--- a/src/blackgui/components/dbownmodelscomponent.cpp
+++ b/src/blackgui/components/dbownmodelscomponent.cpp
@@ -142,6 +142,7 @@ namespace BlackGui
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
this->loadInstalledModels(simulator, IAircraftModelLoader::InBackgroundWithCache);
+ ui->comp_SimulatorSelector->setValue(simulator);
ui->le_Simulator->setText(simulator.toQString());
}
diff --git a/src/blackgui/components/dbownmodelsdialog.cpp b/src/blackgui/components/dbownmodelsdialog.cpp
new file mode 100644
index 000000000..c3e18da3d
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsdialog.cpp
@@ -0,0 +1,46 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "dbownmodelsdialog.h"
+#include "dbownmodelscomponent.h"
+#include "ui_dbownmodelsdialog.h"
+
+using namespace BlackMisc::Simulation;
+
+namespace BlackGui
+{
+ namespace Components
+ {
+ CDbOwnModelsDialog::CDbOwnModelsDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::CDbOwnModelsDialog)
+ {
+ ui->setupUi(this);
+ this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ }
+
+ CDbOwnModelsDialog::~CDbOwnModelsDialog()
+ { }
+
+ void CDbOwnModelsDialog::setSimulator(const CSimulatorInfo &simulator)
+ {
+ ui->comp_OwnModels->setSimulator(simulator);
+ }
+
+ bool CDbOwnModelsDialog::requestModelsInBackground(const CSimulatorInfo &simulator, bool onlyIfNotEmpty)
+ {
+ return ui->comp_OwnModels->requestModelsInBackground(simulator, onlyIfNotEmpty);
+ }
+
+ const CDbOwnModelsComponent *CDbOwnModelsDialog::modelsComponent() const
+ {
+ return ui->comp_OwnModels;
+ }
+ } // ns
+} // ns
diff --git a/src/blackgui/components/dbownmodelsdialog.h b/src/blackgui/components/dbownmodelsdialog.h
new file mode 100644
index 000000000..ad325722c
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsdialog.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_DBAIRLINEICAOSELECTORBASE_DBOWNMODELSDIALOG_H
+#define BLACKGUI_DBAIRLINEICAOSELECTORBASE_DBOWNMODELSDIALOG_H
+
+#include "blackgui/blackguiexport.h"
+#include "blackmisc/simulation/simulatorinfo.h"
+#include
+#include
+
+namespace Ui { class CDbOwnModelsDialog; }
+namespace BlackGui
+{
+ namespace Components
+ {
+ class CDbOwnModelsComponent;
+
+ //! Own models dialog
+ class BLACKGUI_EXPORT CDbOwnModelsDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ explicit CDbOwnModelsDialog(QWidget *parent = nullptr);
+
+ //! Destructor
+ virtual ~CDbOwnModelsDialog();
+
+ //! \copydoc CDbOwnModelsComponent::setSimulator
+ void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+
+ //! \copydoc CDbOwnModelsComponent::requestModelsInBackground
+ bool requestModelsInBackground(const BlackMisc::Simulation::CSimulatorInfo &simulator, bool onlyIfNotEmpty);
+
+ //! Direct access to component
+ //! \remark allows to use the powerful component class
+ const CDbOwnModelsComponent *modelsComponent() const;
+
+ private:
+ QScopedPointer ui;
+ };
+ } // ns
+} // ns
+#endif // guard
diff --git a/src/blackgui/components/dbownmodelsdialog.ui b/src/blackgui/components/dbownmodelsdialog.ui
new file mode 100644
index 000000000..4caef094c
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsdialog.ui
@@ -0,0 +1,82 @@
+
+
+ CDbOwnModelsDialog
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ Own models dialog
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Close
+
+
+
+
+
+
+
+ BlackGui::Components::CDbOwnModelsComponent
+ QFrame
+ blackgui/components/dbownmodelscomponent.h
+ 1
+
+
+
+
+
+ bb_OwnModelsDialog
+ accepted()
+ CDbOwnModelsDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ bb_OwnModelsDialog
+ rejected()
+ CDbOwnModelsDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/blackgui/components/dbownmodelsetcomponent.cpp b/src/blackgui/components/dbownmodelsetcomponent.cpp
index 413817e5d..6382207cb 100644
--- a/src/blackgui/components/dbownmodelsetcomponent.cpp
+++ b/src/blackgui/components/dbownmodelsetcomponent.cpp
@@ -72,15 +72,15 @@ namespace BlackGui
//! \fixme maybe it would be better to set those in stylesheet file
ui->pb_SaveAsSetForSimulator->setStyleSheet("padding-left: 3px; padding-right: 3px;");
- connect(ui->pb_CreateNewSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
- connect(ui->pb_LoadExistingSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
- connect(ui->pb_SaveAsSetForSimulator, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
- connect(ui->pb_ShowMatrix, &QPushButton::clicked, this, &CDbOwnModelSetComponent::ps_buttonClicked);
- connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelSetComponent::ps_onSimulatorChanged);
- connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDbOwnModelSetComponent::ps_onSimulatorChanged);
- connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelDataChanged, this, &CDbOwnModelSetComponent::ps_onRowCountChanged);
- connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelChanged, this, &CDbOwnModelSetComponent::ps_viewModelChanged);
- connect(ui->tvp_OwnModelSet, &CAircraftModelView::jsonModelsForSimulatorLoaded, this, &CDbOwnModelSetComponent::ps_onJsonDataLoaded);
+ connect(ui->pb_CreateNewSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
+ connect(ui->pb_LoadExistingSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
+ connect(ui->pb_SaveAsSetForSimulator, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
+ connect(ui->pb_ShowMatrix, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
+ connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelSetComponent::setSimulator, Qt::QueuedConnection);
+ connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDbOwnModelSetComponent::changeSimulator, Qt::QueuedConnection);
+ connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelDataChanged, this, &CDbOwnModelSetComponent::onRowCountChanged);
+ connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelChanged, this, &CDbOwnModelSetComponent::viewModelChanged);
+ connect(ui->tvp_OwnModelSet, &CAircraftModelView::jsonModelsForSimulatorLoaded, this, &CDbOwnModelSetComponent::onJsonDataLoaded);
const CSimulatorInfo simulator = m_modelSetLoader.getSimulator();
if (simulator.isSingleSimulator())
@@ -107,7 +107,7 @@ namespace BlackGui
void CDbOwnModelSetComponent::setModelSet(const CAircraftModelList &models, const CSimulatorInfo &simulator)
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
- this->setModelSetSimulator(simulator);
+ this->setSimulator(simulator);
if (models.isEmpty())
{
ui->tvp_OwnModelSet->clear();
@@ -142,12 +142,17 @@ namespace BlackGui
ui->tvp_OwnModelSet->updateContainerMaybeAsync(updatedModels);
}
- const CAircraftModelList &CDbOwnModelSetComponent::getModelSet() const
+ const CAircraftModelList &CDbOwnModelSetComponent::getModelSetFromView() const
{
return ui->tvp_OwnModelSet->container();
}
- const CSimulatorInfo CDbOwnModelSetComponent::getModelSetSimulator() const
+ int CDbOwnModelSetComponent::getModelSetCountFromView() const
+ {
+ return ui->tvp_OwnModelSet->container().size();
+ }
+
+ CSimulatorInfo CDbOwnModelSetComponent::getModelSetSimulator() const
{
return m_modelSetLoader.getSimulator();
}
@@ -164,7 +169,7 @@ namespace BlackGui
if (!this->getModelSetSimulator().isSingleSimulator())
{
// no sim yet, we set it
- this->setModelSetSimulator(simulator);
+ this->setSimulator(simulator);
}
if (simulator != this->getModelSetSimulator())
{
@@ -174,7 +179,7 @@ namespace BlackGui
}
const bool allowExcludedModels = m_modelSettings.get().getAllowExcludedModels();
- CAircraftModelList updateModels(this->getModelSet());
+ CAircraftModelList updateModels(this->getModelSetFromView());
int d = updateModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
if (d > 0)
{
@@ -194,16 +199,16 @@ namespace BlackGui
CDbMappingComponentAware::setMappingComponent(component);
if (component)
{
- connect(this->getMappingComponent(), &CDbMappingComponent::tabIndexChanged, this, &CDbOwnModelSetComponent::ps_tabIndexChanged);
+ connect(this->getMappingComponent(), &CDbMappingComponent::tabIndexChanged, this, &CDbOwnModelSetComponent::tabIndexChanged);
}
}
- void CDbOwnModelSetComponent::ps_tabIndexChanged(int index)
+ void CDbOwnModelSetComponent::tabIndexChanged(int index)
{
Q_UNUSED(index);
}
- void CDbOwnModelSetComponent::ps_buttonClicked()
+ void CDbOwnModelSetComponent::buttonClicked()
{
const QObject *sender = QObject::sender();
if (sender == ui->pb_CreateNewSet)
@@ -229,23 +234,7 @@ namespace BlackGui
}
}
- void CDbOwnModelSetComponent::ps_changeSimulator(const CSimulatorInfo &simulator)
- {
- Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
- if (this->getModelSetSimulator() == simulator) { return; } // avoid endless loops
-
- this->setModelSetSimulator(simulator);
- this->updateViewToCurrentModels();
- }
-
- void CDbOwnModelSetComponent::ps_onSimulatorChanged(const CSimulatorInfo &simulator)
- {
- Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
- if (this->getModelSetSimulator() == simulator) { return; } // avoid endless loops
- this->ps_changeSimulator(simulator);
- }
-
- void CDbOwnModelSetComponent::ps_onRowCountChanged(int count, bool withFilter)
+ void CDbOwnModelSetComponent::onRowCountChanged(int count, bool withFilter)
{
Q_UNUSED(count);
Q_UNUSED(withFilter);
@@ -263,11 +252,11 @@ namespace BlackGui
}
}
- void CDbOwnModelSetComponent::ps_onJsonDataLoaded(const CSimulatorInfo &simulator)
+ void CDbOwnModelSetComponent::onJsonDataLoaded(const CSimulatorInfo &simulator)
{
if (simulator.isSingleSimulator())
{
- this->setModelSetSimulator(simulator);
+ this->setSimulator(simulator);
}
}
@@ -281,15 +270,15 @@ namespace BlackGui
}
}
- void CDbOwnModelSetComponent::ps_viewModelChanged()
+ void CDbOwnModelSetComponent::viewModelChanged()
{
ui->pb_SaveAsSetForSimulator->setEnabled(true);
}
- void CDbOwnModelSetComponent::setSaveFileName(const CSimulatorInfo &sim)
+ void CDbOwnModelSetComponent::setSaveFileName(const CSimulatorInfo &simulator)
{
- Q_ASSERT_X(sim.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
- const QString name("modelset" + sim.toQString(true));
+ Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
+ const QString name("modelset" + simulator.toQString(true));
ui->tvp_OwnModelSet->setSaveFileName(name);
}
@@ -328,21 +317,29 @@ namespace BlackGui
}
}
+ void CDbOwnModelSetComponent::changeSimulator(const CSimulatorInfo &simulator)
+ {
+ m_modelSetLoader.setSimulator(simulator);
+ ui->tvp_OwnModelSet->setSimulatorForLoading(simulator);
+ ui->le_Simulator->setText(simulator.toQString(true));
+ ui->comp_SimulatorSelector->setValue(simulator);
+ this->updateViewToCurrentModels();
+ }
+
void CDbOwnModelSetComponent::showAirlineAircraftMatrix() const
{
- const CAircraftModelList set(this->getModelSet());
+ const CAircraftModelList set(this->getModelSetFromView());
const QString file = CAircraftModelUtilities::createIcaoAirlineAircraftHtmlMatrixFile(set, sGui->getTemporaryDirectory());
if (file.isEmpty()) { return; }
QDesktopServices::openUrl(QUrl::fromLocalFile(file));
}
- void CDbOwnModelSetComponent::setModelSetSimulator(const CSimulatorInfo &simulator)
+ void CDbOwnModelSetComponent::setSimulator(const CSimulatorInfo &simulator)
{
- if (m_modelSetLoader.getSimulator() == simulator) { return; } // avoid unnecessary signals
- m_modelSetLoader.changeSimulator(simulator);
- ui->tvp_OwnModelSet->setSimulatorForLoading(simulator);
- ui->le_Simulator->setText(simulator.toQString(true));
- ui->comp_SimulatorSelector->setValue(simulator);
+ Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
+ const CSimulatorInfo currentSimulator = m_modelSetLoader.getSimulator();
+ if (currentSimulator == simulator) { return; } // avoid unnecessary signals
+ this->changeSimulator(simulator);
}
void CDbOwnModelSetComponent::updateDistributorOrder(const CSimulatorInfo &simulator)
@@ -380,7 +377,7 @@ namespace BlackGui
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked)
{
Q_UNUSED(checked);
- ownModelSetComp->ps_changeSimulator(CSimulatorInfo(CSimulatorInfo::FSX));
+ ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::FSX));
});
m_setActions.append(a);
@@ -398,7 +395,7 @@ namespace BlackGui
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked)
{
Q_UNUSED(checked);
- ownModelSetComp->ps_changeSimulator(CSimulatorInfo(CSimulatorInfo::P3D));
+ ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::P3D));
});
m_setActions.append(a);
@@ -416,7 +413,7 @@ namespace BlackGui
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked)
{
Q_UNUSED(checked);
- ownModelSetComp->ps_changeSimulator(CSimulatorInfo(CSimulatorInfo::FS9));
+ ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::FS9));
});
m_setActions.append(a);
@@ -434,7 +431,7 @@ namespace BlackGui
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked)
{
Q_UNUSED(checked);
- ownModelSetComp->ps_changeSimulator(CSimulatorInfo(CSimulatorInfo::XPLANE));
+ ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::XPLANE));
});
m_setActions.append(a);
diff --git a/src/blackgui/components/dbownmodelsetcomponent.h b/src/blackgui/components/dbownmodelsetcomponent.h
index 8d0bb8d51..a023aea71 100644
--- a/src/blackgui/components/dbownmodelsetcomponent.h
+++ b/src/blackgui/components/dbownmodelsetcomponent.h
@@ -77,13 +77,24 @@ namespace BlackGui
BlackMisc::CStatusMessage addToModelSet(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::Simulation::CSimulatorInfo &simulator);
//! Current model set for simulator CDbOwnModelSetComponent::getModelSetSimulator
- const BlackMisc::Simulation::CAircraftModelList &getModelSet() const;
+ //! \remark this the set from the container, which can be different from cache while updating
+ const BlackMisc::Simulation::CAircraftModelList &getModelSetFromView() const;
+
+ //! Current sount of model set for simulator CDbOwnModelSetComponent::getModelSetSimulator
+ //! \remark this the set from the container, which can be different from cache while updating
+ int getModelSetCountFromView() const;
+
+ //! \copydoc BlackMisc::Simulation::CAircraftModelSetLoader::getCachedModels
+ BlackMisc::Simulation::CAircraftModelList getModelSetFromLoader() const { return m_modelSetLoader.getCachedModels(this->getModelSetSimulator()); }
//! Model set is for simulator
- const BlackMisc::Simulation::CSimulatorInfo getModelSetSimulator() const;
+ BlackMisc::Simulation::CSimulatorInfo getModelSetSimulator() const;
//! Simulator
- void setModelSetSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+ void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+
+ //! Used model set loader
+ const BlackMisc::Simulation::CAircraftModelSetLoader &modelSetLoader() const { return m_modelSetLoader; }
//! \copydoc CDbMappingComponentAware::setMappingComponent
virtual void setMappingComponent(CDbMappingComponent *component) override;
@@ -104,34 +115,27 @@ namespace BlackGui
//! Replace or add models provided for a given simulator
void replaceOrAddModelSet(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator);
- private slots:
+ private:
//! Tab has been changed
- void ps_tabIndexChanged(int index);
+ void tabIndexChanged(int index);
//! Button was clicked
- void ps_buttonClicked();
-
- //! Change current simulator
- void ps_changeSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
-
- //! Simulator has been changed (in loader)
- void ps_onSimulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+ void buttonClicked();
//! View has changed row count
- void ps_onRowCountChanged(int count, bool withFilter);
+ void onRowCountChanged(int count, bool withFilter);
//! JSON data have been loaded from disk
- void ps_onJsonDataLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+ void onJsonDataLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator);
//! Model (of view) has been changed
- void ps_viewModelChanged();
+ void viewModelChanged();
- private:
//! Preferences changed
void distributorPreferencesChanged();
//! Default file name
- void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
+ void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &simulator);
//! Update view to current models
void updateViewToCurrentModels();
@@ -139,6 +143,9 @@ namespace BlackGui
//! Create new set
void createNewSet();
+ //! Unchecked version of setSimulator
+ void changeSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+
//! Show the airline/aircraft matrix
void showAirlineAircraftMatrix() const;
diff --git a/src/blackgui/components/dbownmodelsetdialog.cpp b/src/blackgui/components/dbownmodelsetdialog.cpp
new file mode 100644
index 000000000..9098581f5
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsetdialog.cpp
@@ -0,0 +1,40 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "dbownmodelsetdialog.h"
+#include "ui_dbownmodelsetdialog.h"
+
+using namespace BlackMisc::Simulation;
+
+namespace BlackGui
+{
+ namespace Components
+ {
+ CDbOwnModelSetDialog::CDbOwnModelSetDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::CDbOwnModelSetDialog)
+ {
+ ui->setupUi(this);
+ this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ }
+
+ CDbOwnModelSetDialog::~CDbOwnModelSetDialog()
+ { }
+
+ void CDbOwnModelSetDialog::setSimulator(const CSimulatorInfo &simulator)
+ {
+ ui->comp_OwnModelSet->setSimulator(simulator);
+ }
+
+ const CDbOwnModelSetComponent *CDbOwnModelSetDialog::modelSetComponent() const
+ {
+ return ui->comp_OwnModelSet;
+ }
+ } // ns
+} // ns
diff --git a/src/blackgui/components/dbownmodelsetdialog.h b/src/blackgui/components/dbownmodelsetdialog.h
new file mode 100644
index 000000000..bbdc7ebd8
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsetdialog.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_COMPONENTS_DBOWNMODELSETDIALOG_H
+#define BLACKGUI_COMPONENTS_DBOWNMODELSETDIALOG_H
+
+#include "blackmisc/simulation/simulatorinfo.h"
+#include
+#include
+
+namespace Ui { class CDbOwnModelSetDialog; }
+namespace BlackGui
+{
+ namespace Components
+ {
+ class CDbOwnModelSetComponent;
+
+ //! Dialog version of
+ class CDbOwnModelSetDialog : public QDialog
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ explicit CDbOwnModelSetDialog(QWidget *parent = nullptr);
+
+ //! Destructor
+ virtual ~CDbOwnModelSetDialog();
+
+ //! \copydoc CDbOwnModelSetComponent::setSimulator
+ void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+
+ //! Direct access to CDbOwnModelSetComponent
+ const CDbOwnModelSetComponent *modelSetComponent() const;
+
+ private:
+ QScopedPointer ui;
+ };
+ } // ns
+} // ns
+#endif // guard
diff --git a/src/blackgui/components/dbownmodelsetdialog.ui b/src/blackgui/components/dbownmodelsetdialog.ui
new file mode 100644
index 000000000..11cb41154
--- /dev/null
+++ b/src/blackgui/components/dbownmodelsetdialog.ui
@@ -0,0 +1,82 @@
+
+
+ CDbOwnModelSetDialog
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ Own model set dialog
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Close
+
+
+
+
+
+
+
+ BlackGui::Components::CDbOwnModelSetComponent
+ QFrame
+ blackgui/components/dbownmodelsetcomponent.h
+ 1
+
+
+
+
+
+ bb_OwnModelSetDialog
+ accepted()
+ CDbOwnModelSetDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ bb_OwnModelSetDialog
+ rejected()
+ CDbOwnModelSetDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/blackgui/components/firstmodelsetcomponent.cpp b/src/blackgui/components/firstmodelsetcomponent.cpp
new file mode 100644
index 000000000..9844153d1
--- /dev/null
+++ b/src/blackgui/components/firstmodelsetcomponent.cpp
@@ -0,0 +1,121 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "firstmodelsetcomponent.h"
+#include "ui_firstmodelsetcomponent.h"
+#include "dbownmodelsdialog.h"
+#include "dbownmodelscomponent.h"
+#include "dbownmodelsetdialog.h"
+#include "dbownmodelsetcomponent.h"
+#include
+
+using namespace BlackMisc::Simulation;
+
+namespace BlackGui
+{
+ namespace Components
+ {
+ CFirstModelSetComponent::CFirstModelSetComponent(QWidget *parent) :
+ QFrame(parent),
+ ui(new Ui::CFirstModelSetComponent)
+ {
+ ui->setupUi(this);
+ ui->comp_SimulatorSelector->setMode(CSimulatorSelector::RadioButtons);
+ ui->comp_SimulatorSelector->setRememberSelection(true);
+
+ // we use the powerful component to access own models
+ m_modelsDialog.reset(new CDbOwnModelsDialog(this));
+ m_modelSetDialog.reset(new CDbOwnModelSetDialog(this));
+
+ this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue());
+
+ connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CFirstModelSetComponent::onSimulatorChanged);
+ 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);
+ }
+
+ CFirstModelSetComponent::~CFirstModelSetComponent()
+ { }
+
+ void CFirstModelSetComponent::onSimulatorChanged(const CSimulatorInfo &simulator)
+ {
+ Q_ASSERT_X(m_modelsDialog, Q_FUNC_INFO, "No models dialog");
+ m_modelsDialog->setSimulator(simulator);
+
+ Q_ASSERT_X(m_modelSetDialog, Q_FUNC_INFO, "No model set dialog");
+ m_modelSetDialog->setSimulator(simulator);
+
+ // kind of hack, but simplest solution
+ // we us the loader of the components directly,
+ // avoid to fully init a loader logic here
+ const QStringList dirs = this->simulatorSettings().getModelDirectoriesOrDefault(simulator);
+ ui->le_ModelDirectories->setText(dirs.join(", "));
+
+ static const QString modelInfo("Models already indexed: %1");
+ static const QString modelsNo("No models so far");
+ const int models = this->modelLoader()->getAircraftModelsCount();
+ ui->le_ModelsInfo->setText(models > 0 ? modelInfo.arg(models) : modelsNo);
+
+ static const QString modelSetInfo("Models in set: %1");
+ static const QString modelsSetNo("Model set is empty");
+ const int modelSet = this->modelSetLoader().getAircraftModelsCount();
+ ui->le_ModelSetInfo->setText(models > 0 ? modelSetInfo.arg(modelSet) : modelsSetNo);
+ }
+
+ const CDbOwnModelsComponent *CFirstModelSetComponent::modelsComponent() const
+ {
+ Q_ASSERT_X(m_modelsDialog, Q_FUNC_INFO, "No models dialog");
+ Q_ASSERT_X(m_modelsDialog->modelsComponent(), Q_FUNC_INFO, "No models component");
+ return m_modelsDialog->modelsComponent();
+ }
+
+ const CDbOwnModelSetComponent *CFirstModelSetComponent::modelSetComponent() const
+ {
+ Q_ASSERT_X(m_modelSetDialog, Q_FUNC_INFO, "No model set dialog");
+ Q_ASSERT_X(m_modelSetDialog->modelSetComponent(), Q_FUNC_INFO, "No model set component");
+ return m_modelSetDialog->modelSetComponent();
+ }
+
+ BlackMisc::Simulation::IAircraftModelLoader *CFirstModelSetComponent::modelLoader() const
+ {
+ Q_ASSERT_X(m_modelsDialog->modelsComponent()->modelLoader(), Q_FUNC_INFO, "No model loader");
+ return m_modelsDialog->modelsComponent()->modelLoader();
+ }
+
+ const CAircraftModelSetLoader &CFirstModelSetComponent::modelSetLoader() const
+ {
+ return this->modelSetComponent()->modelSetLoader();
+ }
+
+ const Settings::CMultiSimulatorSettings &CFirstModelSetComponent::simulatorSettings() const
+ {
+ return this->modelLoader()->multiSimulatorSettings();
+ }
+
+ void CFirstModelSetComponent::openOwnModelsDialog()
+ {
+ m_modelsDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
+ m_modelsDialog->show();
+ bool const reload = QObject::sender() == ui->pb_ModelsTriggerReload;
+ if (reload) { m_modelsDialog->requestModelsInBackground(ui->comp_SimulatorSelector->getValue(), true); }
+ }
+
+ void CFirstModelSetComponent::openOwnModelSetDialog()
+ {
+ m_modelSetDialog->setSimulator(ui->comp_SimulatorSelector->getValue());
+ m_modelSetDialog->show();
+ }
+
+ bool CFirstModelSetWizardPage::validatePage()
+ {
+ return true;
+ }
+ } // ns
+} // ns
diff --git a/src/blackgui/components/firstmodelsetcomponent.h b/src/blackgui/components/firstmodelsetcomponent.h
new file mode 100644
index 000000000..37c280ee7
--- /dev/null
+++ b/src/blackgui/components/firstmodelsetcomponent.h
@@ -0,0 +1,94 @@
+/* Copyright (C) 2018
+ * swift project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_COMPONENTS_FIRSTMODELSETCOMPONENT_H
+#define BLACKGUI_COMPONENTS_FIRSTMODELSETCOMPONENT_H
+
+#include "blackgui/blackguiexport.h"
+#include "blackcore/application/applicationsettings.h"
+#include "blackmisc/simulation/aircraftmodelsetloader.h"
+#include "blackmisc/simulation/settings/simulatorsettings.h"
+#include "blackmisc/simulation/aircraftmodelloader.h"
+#include "blackmisc/simulation/simulatorinfo.h"
+#include
+#include
+
+namespace Ui { class CFirstModelSetComponent; }
+namespace BlackGui
+{
+ namespace Components
+ {
+ class CDbOwnModelsDialog;
+ class CDbOwnModelsComponent;
+ class CDbOwnModelSetDialog;
+ class CDbOwnModelSetComponent;
+
+ //! Create a first model set
+ class CFirstModelSetComponent : public QFrame
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ explicit CFirstModelSetComponent(QWidget *parent = nullptr);
+
+ //! Destructor
+ virtual ~CFirstModelSetComponent();
+
+ private:
+ QScopedPointer ui;
+ QScopedPointer m_modelsDialog;
+ QScopedPointer m_modelSetDialog;
+
+ //! Simulator has been changed
+ void onSimulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
+
+ //! Direct access to component
+ const CDbOwnModelsComponent *modelsComponent() const;
+
+ //! Direct access to component
+ const CDbOwnModelSetComponent *modelSetComponent() const;
+
+ //! Direct access to component's loader
+ BlackMisc::Simulation::IAircraftModelLoader *modelLoader() const;
+
+ //! Model set loader
+ const BlackMisc::Simulation::CAircraftModelSetLoader &modelSetLoader() const;
+
+ //! Simulator settings
+ const BlackMisc::Simulation::Settings::CMultiSimulatorSettings &simulatorSettings() const;
+
+ //! Open own models dialog
+ void openOwnModelsDialog();
+
+ //! Own model set dialog
+ void openOwnModelSetDialog();
+ };
+
+ //! Wizard page for CFirstModelSetComponent
+ class CFirstModelSetWizardPage : public QWizardPage
+ {
+ public:
+ //! Constructors
+ using QWizardPage::QWizardPage;
+
+ //! Set config
+ void setFirstModelSet(CFirstModelSetComponent *firstModelSet) { m_firstModelSet = firstModelSet; }
+
+ //! \copydoc QWizardPage::validatePage
+ virtual bool validatePage() override;
+
+ private:
+ CFirstModelSetComponent *m_firstModelSet = nullptr;
+ };
+ } // ns
+} // ns
+#endif // guard
diff --git a/src/blackgui/components/firstmodelsetcomponent.ui b/src/blackgui/components/firstmodelsetcomponent.ui
new file mode 100644
index 000000000..43383c47d
--- /dev/null
+++ b/src/blackgui/components/firstmodelsetcomponent.ui
@@ -0,0 +1,190 @@
+
+
+ CFirstModelSetComponent
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ Configure a 1st model set
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html>
+
+
+ Qt::RichText
+
+
+ true
+
+
+
+ -
+
+
+ <html><img src=":/own/icons/own/swift3D/sw3DOrange-32.png"></html>
+
+
+
+
+
+
+ -
+
+
+
+ 200
+ 0
+
+
+
+
+ -
+
+
+
-
+
+
+ Model directories:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Models:
+
+
+
+ -
+
+
-
+
+
+ show set
+
+
+
+ -
+
+
+ show models
+
+
+
+ -
+
+
+ trigger reload
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ -
+
+
+ Distributors:
+
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+
+
+
+
+
+
+
+ BlackGui::Components::CSimulatorSelector
+ QFrame
+ blackgui/components/simulatorselector.h
+ 1
+
+
+ BlackGui::Components::CDbDistributorComponent
+ QFrame
+ blackgui/components/dbdistributorcomponent.h
+ 1
+
+
+
+
+
diff --git a/src/blackgui/share/qss/stdwidget.qss b/src/blackgui/share/qss/stdwidget.qss
index 1a0b8f753..f6607fb80 100644
--- a/src/blackgui/share/qss/stdwidget.qss
+++ b/src/blackgui/share/qss/stdwidget.qss
@@ -168,13 +168,12 @@ BlackGui--Components--CDBusServerAddressSelector::disabled {
}
BlackGui--Components--CDownloadComponent,
-BlackGui--Components--CDownloadDialog {
- background: black; /* background is background color here */
- background-image: url(:/textures/icons/textures/texture-inner.jpg);
-}
-
+BlackGui--Components--CDownloadDialog,
BlackGui--Components--CRawFsdMessagesComponent,
-BlackGui--Components--CRawFsdMessagesDialog {
+BlackGui--Components--CRawFsdMessagesDialog,
+BlackGui--Components--CDbOwnModelsDialog,
+BlackGui--Components--CDbOwnModelSetDialog
+{
background: black; /* background is background color here */
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}