mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #661, improved model set dialog
* allow to change simulator * consider distributor preferences for new model set * error messages in dialog, therefor use CForm as base class
This commit is contained in:
@@ -785,11 +785,22 @@ namespace BlackGui
|
||||
return this->ui->comp_OwnAircraftModels->getOwnModelsSimulator();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::setOwnModelsSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->ui->comp_OwnAircraftModels->setSimulator(simulator);
|
||||
}
|
||||
|
||||
int CDbMappingComponent::getOwnModelsCount() const
|
||||
{
|
||||
return this->ui->comp_OwnAircraftModels->getOwnModelsCount();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::setOwnModelSetSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
this->ui->comp_OwnModelSet->setModelSetSimulator(simulator);
|
||||
}
|
||||
|
||||
CStatusMessage CDbMappingComponent::stashModel(const CAircraftModel &model, bool replace)
|
||||
{
|
||||
return this->ui->comp_StashAircraft->stashModel(model, replace);
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
namespace Ui { class CDbMappingComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Menus { class CMenuActions; }
|
||||
@@ -93,7 +92,7 @@ namespace BlackGui
|
||||
//! Graceful shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
//! With vPilot rules
|
||||
//! With vPilot rules?
|
||||
bool withVPilot() const { return m_vPilotEnabled; }
|
||||
|
||||
//! Any models which can be stashed?
|
||||
@@ -115,6 +114,8 @@ namespace BlackGui
|
||||
//! \note not guaranteed to be valid, just a snapshot of its current editor state
|
||||
BlackMisc::Simulation::CAircraftModel getEditorAircraftModel() const;
|
||||
|
||||
// ---------------- stash -----------------
|
||||
|
||||
//! \name Models from BlackGui::Components::CDbStashComponent
|
||||
//! @{
|
||||
//! Stashed models
|
||||
@@ -124,6 +125,8 @@ namespace BlackGui
|
||||
QStringList getStashedModelStrings() const;
|
||||
//! @}
|
||||
|
||||
// ---------------- own models -----------------
|
||||
|
||||
//! \name Own models from BlackGui::Components::CDbOwnModelsComponent
|
||||
//! @{
|
||||
//! Own models
|
||||
@@ -138,10 +141,18 @@ namespace BlackGui
|
||||
//! Own models for simulator
|
||||
const BlackMisc::Simulation::CSimulatorInfo getOwnModelsSimulator() const;
|
||||
|
||||
//! Set simulator for own models
|
||||
void setOwnModelsSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Number of own models
|
||||
int getOwnModelsCount() const;
|
||||
//! @}
|
||||
|
||||
// ---------------- own models -----------------
|
||||
|
||||
//! Set simulator for own models
|
||||
void setOwnModelSetSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
public slots:
|
||||
//! \copydoc CDbStashComponent::stashModel
|
||||
BlackMisc::CStatusMessage stashModel(const BlackMisc::Simulation::CAircraftModel &model, bool replace = false);
|
||||
@@ -376,7 +387,7 @@ namespace BlackGui
|
||||
//! Mapping component
|
||||
CDbMappingComponent *mappingComponent() const;
|
||||
|
||||
QList<QAction *> m_menuActions;
|
||||
QList<QAction *> m_menuActions; //!< actions, kept when once initialized
|
||||
};
|
||||
|
||||
//! Merge with vPilot data
|
||||
@@ -393,7 +404,7 @@ namespace BlackGui
|
||||
CDbMappingComponent *mappingComponent() const;
|
||||
|
||||
private:
|
||||
QList<QAction *> m_menuActions;
|
||||
QList<QAction *> m_menuActions; //!< actions, kept when once initialized
|
||||
};
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -105,6 +105,12 @@ namespace BlackGui
|
||||
return this->m_modelLoader->getSimulator();
|
||||
}
|
||||
|
||||
void CDbOwnModelsComponent::setSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
this->ps_loadInstalledModels(simulator, IAircraftModelLoader::InBackgroundWithCache);
|
||||
}
|
||||
|
||||
int CDbOwnModelsComponent::getOwnModelsCount() const
|
||||
{
|
||||
if (!this->m_modelLoader) { return 0; }
|
||||
|
||||
@@ -67,6 +67,9 @@ namespace BlackGui
|
||||
//! Own models for simulator
|
||||
const BlackMisc::Simulation::CSimulatorInfo getOwnModelsSimulator() const;
|
||||
|
||||
//! Change current simulator for own models
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Number of own models
|
||||
int getOwnModelsCount() const;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace BlackGui
|
||||
void CDbOwnModelSetComponent::setModelSet(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
this->setSimulator(simulator);
|
||||
this->setModelSetSimulator(simulator);
|
||||
if (models.isEmpty())
|
||||
{
|
||||
this->ui->tvp_OwnModelSet->clear();
|
||||
@@ -153,7 +153,7 @@ namespace BlackGui
|
||||
if (!this->getModelSetSimulator().isSingleSimulator())
|
||||
{
|
||||
// no sim yet, we set it
|
||||
this->setSimulator(simulator);
|
||||
this->setModelSetSimulator(simulator);
|
||||
}
|
||||
if (simulator != this->getModelSetSimulator())
|
||||
{
|
||||
@@ -235,7 +235,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
if (this->getModelSetSimulator() == simulator) { return; } // avoid endless loops
|
||||
|
||||
this->setSimulator(simulator);
|
||||
this->setModelSetSimulator(simulator);
|
||||
const CAircraftModelList models(this->m_modelSetLoader.getAircraftModels());
|
||||
ui->tvp_OwnModelSet->updateContainerMaybeAsync(models);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ namespace BlackGui
|
||||
{
|
||||
if (simulator.isSingleSimulator())
|
||||
{
|
||||
this->setSimulator(simulator);
|
||||
this->setModelSetSimulator(simulator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace BlackGui
|
||||
this->ui->tvp_OwnModelSet->setSaveFileName(name);
|
||||
}
|
||||
|
||||
void CDbOwnModelSetComponent::setSimulator(const CSimulatorInfo &simulator)
|
||||
void CDbOwnModelSetComponent::setModelSetSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
if (this->m_modelSetLoader.getSimulator() == simulator) { return; } // avoid unnecessary signals
|
||||
this->m_modelSetLoader.changeSimulator(simulator);
|
||||
|
||||
@@ -82,6 +82,9 @@ namespace BlackGui
|
||||
//! Model set is for simulator
|
||||
const BlackMisc::Simulation::CSimulatorInfo getModelSetSimulator() const;
|
||||
|
||||
//! Simulator
|
||||
void setModelSetSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! \copydoc CDbMappingComponentAware::setMappingComponent
|
||||
virtual void setMappingComponent(CDbMappingComponent *component) override;
|
||||
|
||||
@@ -94,10 +97,10 @@ namespace BlackGui
|
||||
//! @}
|
||||
|
||||
public slots:
|
||||
//! Set the model set
|
||||
//! Set the model set for a given simulator
|
||||
void setModelSet(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Replace or add models provided
|
||||
//! Replace or add models provided for a given simulator
|
||||
void replaceOrAddModelSet(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
private slots:
|
||||
@@ -129,9 +132,6 @@ namespace BlackGui
|
||||
//! Default file name
|
||||
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||
|
||||
//! Simulator
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Update distributor order
|
||||
void updateDistributorOrder(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui::Editors;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -43,6 +44,7 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CDbOwnModelSetDialog::ps_buttonClicked);
|
||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CDbOwnModelSetDialog::ps_buttonClicked);
|
||||
connect(ui->form_OwnModelSet, &COwnModelSetForm::simulatorChanged, this, &CDbOwnModelSetDialog::ps_simulatorChanged);
|
||||
}
|
||||
|
||||
CDbOwnModelSetDialog::~CDbOwnModelSetDialog()
|
||||
@@ -52,14 +54,17 @@ namespace BlackGui
|
||||
|
||||
void CDbOwnModelSetDialog::reloadData()
|
||||
{
|
||||
this->m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
ui->form_OwnModelSet->setSimulator(this->m_simulatorInfo);
|
||||
this->ui->form_OwnModelSet->reloadData();
|
||||
}
|
||||
|
||||
int CDbOwnModelSetDialog::exec()
|
||||
{
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||
this->m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
||||
this->setWindowTitle("Create model set for " + this->m_simulatorInfo.toQString(true));
|
||||
this->setSimulator(this->getMappingComponent()->getOwnModelsSimulator());
|
||||
this->checkData();
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
@@ -77,6 +82,37 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbOwnModelSetDialog::ps_simulatorChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||
this->setSimulator(simulator);
|
||||
this->getMappingComponent()->setOwnModelsSimulator(simulator);
|
||||
this->getMappingComponent()->setOwnModelSetSimulator(simulator);
|
||||
this->checkData();
|
||||
}
|
||||
|
||||
bool CDbOwnModelSetDialog::checkData()
|
||||
{
|
||||
// models
|
||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
const int c = this->getMappingComponent()->getOwnModelsCount();
|
||||
if (c < 1)
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).error("No models for %1") << this->m_simulatorInfo.toQString(true);
|
||||
ui->form_OwnModelSet->showOverlayMessage(m);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDbOwnModelSetDialog::setSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
this->m_simulatorInfo = simulator;
|
||||
ui->form_OwnModelSet->setSimulator(this->m_simulatorInfo);
|
||||
this->setWindowTitle("Create model set for " + this->m_simulatorInfo.toQString(true));
|
||||
}
|
||||
|
||||
CAircraftModelList CDbOwnModelSetDialog::buildSet(const CSimulatorInfo &simulator, const CAircraftModelList ¤tSet)
|
||||
{
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||
|
||||
@@ -64,11 +64,20 @@ namespace BlackGui
|
||||
//! Button clicked
|
||||
void ps_buttonClicked();
|
||||
|
||||
//! Simulator changed
|
||||
void ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbOwnModelSetDialog> ui;
|
||||
BlackMisc::Simulation::CAircraftModelList m_modelSet;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo;
|
||||
|
||||
//! Check data
|
||||
bool checkData();
|
||||
|
||||
//! Set current simulator
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Build the set
|
||||
BlackMisc::Simulation::CAircraftModelList buildSet(const BlackMisc::Simulation::CSimulatorInfo &simulator, const BlackMisc::Simulation::CAircraftModelList ¤tSet = {});
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BlackGui
|
||||
void ps_deferredInit();
|
||||
|
||||
private:
|
||||
BlackGui::COverlayMessagesFrame *m_overlayMessageFrame = nullptr;
|
||||
BlackGui::COverlayMessagesFrame *m_overlayMessageFrame = nullptr;
|
||||
QScopedPointer<Ui::CDistributorPreferencesComponent> ui;
|
||||
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { BlackMisc::Simulation::CSimulatorInfo(BlackMisc::Simulation::CSimulatorInfo::FSX), this };
|
||||
BlackMisc::CSetting<BlackCore::Settings::Simulation::DistributorListPreferences> m_distributorPreferences { this, &CDistributorPreferencesComponent::ps_preferencesChanged };
|
||||
|
||||
@@ -145,6 +145,17 @@ namespace BlackGui
|
||||
return c;
|
||||
}
|
||||
|
||||
void CSimulatorSelector::setLeftMargin(int margin)
|
||||
{
|
||||
QMargins m = ui->hl_RadioButtons->contentsMargins();
|
||||
m.setLeft(margin);
|
||||
ui->hl_RadioButtons->setContentsMargins(m);
|
||||
|
||||
m = ui->hl_CheckBoxes->contentsMargins();
|
||||
m.setLeft(margin);
|
||||
ui->hl_CheckBoxes->setContentsMargins(m);
|
||||
}
|
||||
|
||||
void CSimulatorSelector::ps_RadioButtonChanged(bool checked)
|
||||
{
|
||||
if (this->m_mode != RadioButtons) { return; }
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
/*!
|
||||
* Select simulator
|
||||
* Select simulator (as radio buttons or checkboxes)
|
||||
*/
|
||||
class BLACKGUI_EXPORT CSimulatorSelector : public QFrame
|
||||
{
|
||||
@@ -67,6 +67,9 @@ namespace BlackGui
|
||||
//! All selected
|
||||
bool areAllSelected() const;
|
||||
|
||||
//! Set left margin
|
||||
void setLeftMargin(int margin);
|
||||
|
||||
signals:
|
||||
//! Value has been changed
|
||||
void changed(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
CForm::CForm(QWidget *parent) :
|
||||
QFrame(parent)
|
||||
CForm::CForm(QWidget *parent) : COverlayMessagesFrame(parent)
|
||||
{ }
|
||||
|
||||
CForm::~CForm() { }
|
||||
@@ -31,6 +30,5 @@ namespace BlackGui
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
#ifndef BLACKGUI_EDITORS_FORM_H
|
||||
#define BLACKGUI_EDITORS_FORM_H
|
||||
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -30,7 +31,7 @@ namespace BlackGui
|
||||
/*!
|
||||
* Form base class
|
||||
*/
|
||||
class BLACKGUI_EXPORT CForm : public QFrame
|
||||
class BLACKGUI_EXPORT CForm : public COverlayMessagesFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -51,7 +52,7 @@ namespace BlackGui
|
||||
//! Is read only?
|
||||
bool isReadOnly() const { return m_readOnly; }
|
||||
|
||||
//! Authenticated user
|
||||
//! Authenticated DB user
|
||||
const BlackMisc::Network::CAuthenticatedUser &getSwiftDbUser() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackgui/editors/ownmodelsetform.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/models/distributorlistmodel.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/views/distributorview.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "ui_ownmodelsetform.h"
|
||||
@@ -20,17 +21,23 @@
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackGui::Components;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
{
|
||||
COwnModelSetForm::COwnModelSetForm(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
CForm(parent),
|
||||
ui(new Ui::COwnModelSetForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_Distributors->setDistributorMode(CDistributorListModel::Minimal);
|
||||
ui->tvp_Distributors->setDistributorMode(CDistributorListModel::Minimal);
|
||||
ui->comp_SimulatorSelector->setMode(CSimulatorSelector::RadioButtons);
|
||||
ui->comp_SimulatorSelector->setLeftMargin(0);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Preferences, true);
|
||||
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &COwnModelSetForm::ps_simulatorChanged);
|
||||
}
|
||||
|
||||
COwnModelSetForm::~COwnModelSetForm()
|
||||
@@ -40,8 +47,10 @@ namespace BlackGui
|
||||
|
||||
void COwnModelSetForm::reloadData()
|
||||
{
|
||||
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
const CDistributorList distributors(sGui->getWebDataServices()->getDistributors());
|
||||
const CDistributorList distributors(this->getDistributors());
|
||||
const bool hasPreferences = this->hasDIstributorPreferences();
|
||||
ui->cb_Preferences->setChecked(hasPreferences);
|
||||
ui->comp_SimulatorSelector->setValue(this->m_simulator);
|
||||
if (!distributors.isEmpty())
|
||||
{
|
||||
this->ui->tvp_Distributors->updateContainerMaybeAsync(distributors);
|
||||
@@ -63,6 +72,29 @@ namespace BlackGui
|
||||
return ui->rb_Incremental->isChecked();
|
||||
}
|
||||
|
||||
void COwnModelSetForm::ps_preferencesChanged()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
void COwnModelSetForm::ps_simulatorChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->setSimulator(simulator);
|
||||
this->reloadData();
|
||||
emit simulatorChanged(simulator);
|
||||
}
|
||||
|
||||
CDistributorList COwnModelSetForm::getDistributors() const
|
||||
{
|
||||
Q_ASSERT_X(sGui && sGui->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.getCopy());
|
||||
const CDistributorList distributors(prefs.getDistributors(this->m_simulator));
|
||||
if (!distributors.isEmpty()) { return distributors; }
|
||||
|
||||
// no preferences
|
||||
return sGui->getWebDataServices()->getDistributors().matchesSimulator(this->m_simulator);
|
||||
}
|
||||
|
||||
bool COwnModelSetForm::dbIcaoCodesOnly() const
|
||||
{
|
||||
return this->ui->rb_DbIcaoCodesOnly->isChecked();
|
||||
@@ -72,6 +104,18 @@ namespace BlackGui
|
||||
{
|
||||
return ui->tvp_Distributors->selectedObjects();
|
||||
}
|
||||
|
||||
void COwnModelSetForm::setSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
m_simulator = simulator;
|
||||
}
|
||||
|
||||
bool COwnModelSetForm::hasDIstributorPreferences() const
|
||||
{
|
||||
const CDistributorListPreferences prefs(this->m_distributorPreferences.getCopy());
|
||||
return !prefs.getDistributors(this->m_simulator).isEmpty();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -12,16 +12,14 @@
|
||||
#ifndef BLACKGUI_EDITORS_OWNMODELSETFORM_H
|
||||
#define BLACKGUI_EDITORS_OWNMODELSETFORM_H
|
||||
|
||||
#include "form.h"
|
||||
#include "blackcore/settings/distributorpreferences.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Ui { class COwnModelSetForm; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Editors
|
||||
@@ -29,7 +27,7 @@ namespace BlackGui
|
||||
/*!
|
||||
* Selection for own model set
|
||||
*/
|
||||
class COwnModelSetForm : public QFrame
|
||||
class COwnModelSetForm : public CForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -49,6 +47,9 @@ namespace BlackGui
|
||||
//! Get selected providers
|
||||
BlackMisc::Simulation::CDistributorList getSelectedDistributors() const;
|
||||
|
||||
//! Current simulator
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Only DB data
|
||||
bool dbDataOnly() const;
|
||||
|
||||
@@ -58,8 +59,33 @@ namespace BlackGui
|
||||
//! Request incremental build
|
||||
bool incrementalBuild() const;
|
||||
|
||||
//! Distributors
|
||||
BlackMisc::Simulation::CDistributorList getDistributors() const;
|
||||
|
||||
//! Preferences for given simulator
|
||||
bool hasDIstributorPreferences() const;
|
||||
|
||||
//! \name Form functions, here not used
|
||||
//! \@{
|
||||
virtual void setReadOnly(bool readOnly) override { Q_UNUSED(readOnly); }
|
||||
virtual void setSelectOnly() override {}
|
||||
//! \@}
|
||||
|
||||
signals:
|
||||
//! Simulator changed
|
||||
void simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
private slots:
|
||||
//! Changed preferences
|
||||
void ps_preferencesChanged();
|
||||
|
||||
//! Simulator changed
|
||||
void ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::COwnModelSetForm> ui;
|
||||
QScopedPointer<Ui::COwnModelSetForm> ui;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator;
|
||||
BlackMisc::CSetting<BlackCore::Settings::Simulation::DistributorListPreferences> m_distributorPreferences { this, &COwnModelSetForm::ps_preferencesChanged };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="rb_DbDataOnly">
|
||||
<property name="toolTip">
|
||||
<string>Own models for which DB data are available</string>
|
||||
@@ -50,14 +50,27 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SelectSourceSet">
|
||||
<property name="text">
|
||||
<string>Source set:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<item row="3" column="2">
|
||||
<widget class="QRadioButton" name="rb_DefaultDistributors">
|
||||
<property name="text">
|
||||
<string>default</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Distributors</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QRadioButton" name="rb_WithIcaoData">
|
||||
<property name="toolTip">
|
||||
<string>Model has ICAO code</string>
|
||||
@@ -73,7 +86,14 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_Providers">
|
||||
<property name="text">
|
||||
<string>Distributors:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="rb_SelectedDistributors">
|
||||
<property name="text">
|
||||
<string>selected</string>
|
||||
@@ -83,27 +103,37 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="rb_DefaultDistributors">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Mode">
|
||||
<property name="text">
|
||||
<string>default</string>
|
||||
<string>Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_Full">
|
||||
<property name="text">
|
||||
<string>full</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Distributors</string>
|
||||
<string notr="true">bg_Mode</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_Providers">
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rb_Incremental">
|
||||
<property name="text">
|
||||
<string>Distributors:</string>
|
||||
<string>incremental</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Mode</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="rb_DbIcaoCodesOnly">
|
||||
<property name="toolTip">
|
||||
<string>Model has ICAO code known in DB</string>
|
||||
@@ -119,36 +149,30 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QCheckBox" name="cb_Preferences">
|
||||
<property name="text">
|
||||
<string>preferences</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_Mode">
|
||||
<widget class="QLabel" name="lbl_Simulator">
|
||||
<property name="text">
|
||||
<string>Mode:</string>
|
||||
<string>Simulator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_Full">
|
||||
<property name="text">
|
||||
<string>full</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Mode</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_Incremental">
|
||||
<property name="text">
|
||||
<string>incremental</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_Mode</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -172,12 +196,18 @@
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/distributorview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSimulatorSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/simulatorselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="bg_Distributors"/>
|
||||
<buttongroup name="bg_SourceSet"/>
|
||||
<buttongroup name="bg_Mode"/>
|
||||
<buttongroup name="bg_Distributors"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user