mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Ref T246, renamed dialog to CDbOwnModelSetFormDialog
This commit is contained in:
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
#include "blackcore/modelsetbuilder.h"
|
#include "blackcore/modelsetbuilder.h"
|
||||||
#include "blackgui/components/dbmappingcomponent.h"
|
#include "blackgui/components/dbmappingcomponent.h"
|
||||||
#include "blackgui/components/dbownmodelsetdialog.h"
|
#include "blackgui/components/dbownmodelsetformdialog.h"
|
||||||
#include "blackgui/editors/ownmodelsetform.h"
|
#include "blackgui/editors/ownmodelsetform.h"
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include "blackmisc/simulation/distributorlist.h"
|
#include "blackmisc/simulation/distributorlist.h"
|
||||||
#include "ui_dbownmodelsetdialog.h"
|
#include "ui_dbownmodelsetformdialog.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -30,38 +30,38 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
const CLogCategoryList &CDbOwnModelSetDialog::getLogCategories()
|
const CLogCategoryList &CDbOwnModelSetFormDialog::getLogCategories()
|
||||||
{
|
{
|
||||||
static const CLogCategoryList cats({ CLogCategory("swift.ownmodelset"), CLogCategory::guiComponent()});
|
static const CLogCategoryList cats({ CLogCategory("swift.ownmodelset"), CLogCategory::guiComponent()});
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbOwnModelSetDialog::CDbOwnModelSetDialog(QWidget *parent) :
|
CDbOwnModelSetFormDialog::CDbOwnModelSetFormDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
CDbMappingComponentAware(parent),
|
CDbMappingComponentAware(parent),
|
||||||
ui(new Ui::CDbOwnModelSetDialog)
|
ui(new Ui::CDbOwnModelSetFormDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CDbOwnModelSetDialog::ps_buttonClicked);
|
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CDbOwnModelSetFormDialog::buttonClicked);
|
||||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CDbOwnModelSetDialog::ps_buttonClicked);
|
connect(ui->pb_Ok, &QPushButton::clicked, this, &CDbOwnModelSetFormDialog::buttonClicked);
|
||||||
connect(ui->form_OwnModelSet, &COwnModelSetForm::simulatorChanged, this, &CDbOwnModelSetDialog::ps_simulatorChanged);
|
connect(ui->form_OwnModelSet, &COwnModelSetForm::simulatorChanged, this, &CDbOwnModelSetFormDialog::simulatorChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbOwnModelSetDialog::~CDbOwnModelSetDialog()
|
CDbOwnModelSetFormDialog::~CDbOwnModelSetFormDialog()
|
||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetDialog::reloadData()
|
void CDbOwnModelSetFormDialog::reloadData()
|
||||||
{
|
{
|
||||||
this->m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
||||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
ui->form_OwnModelSet->setSimulator(this->m_simulatorInfo);
|
ui->form_OwnModelSet->setSimulator(m_simulatorInfo);
|
||||||
ui->form_OwnModelSet->reloadData();
|
ui->form_OwnModelSet->reloadData();
|
||||||
this->m_modelSet = this->getMappingComponent()->getOwnModelSet();
|
m_modelSet = this->getMappingComponent()->getOwnModelSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CDbOwnModelSetDialog::exec()
|
int CDbOwnModelSetFormDialog::exec()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||||
const CSimulatorInfo sim(this->getMappingComponent()->getOwnModelsSimulator());
|
const CSimulatorInfo sim(this->getMappingComponent()->getOwnModelsSimulator());
|
||||||
@@ -71,7 +71,7 @@ namespace BlackGui
|
|||||||
return QDialog::exec();
|
return QDialog::exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetDialog::ps_buttonClicked()
|
void CDbOwnModelSetFormDialog::buttonClicked()
|
||||||
{
|
{
|
||||||
const QObject *sender = QObject::sender();
|
const QObject *sender = QObject::sender();
|
||||||
if (sender == ui->pb_Cancel)
|
if (sender == ui->pb_Cancel)
|
||||||
@@ -80,12 +80,12 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else if (sender == ui->pb_Ok)
|
else if (sender == ui->pb_Ok)
|
||||||
{
|
{
|
||||||
this->m_modelSet = this->buildSet(this->m_simulatorInfo, this->m_modelSet);
|
m_modelSet = this->buildSet(m_simulatorInfo, m_modelSet);
|
||||||
this->accept();
|
this->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetDialog::ps_simulatorChanged(const CSimulatorInfo &simulator)
|
void CDbOwnModelSetFormDialog::simulatorChanged(const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||||
this->setSimulator(simulator);
|
this->setSimulator(simulator);
|
||||||
@@ -94,29 +94,29 @@ namespace BlackGui
|
|||||||
this->checkData();
|
this->checkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDbOwnModelSetDialog::checkData()
|
bool CDbOwnModelSetFormDialog::checkData()
|
||||||
{
|
{
|
||||||
// models
|
// models
|
||||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
const int c = this->getMappingComponent()->getOwnModelsCount();
|
const int c = this->getMappingComponent()->getOwnModelsCount();
|
||||||
if (c < 1)
|
if (c < 1)
|
||||||
{
|
{
|
||||||
const CStatusMessage m = CStatusMessage(this).error("No models for %1") << this->m_simulatorInfo.toQString(true);
|
const CStatusMessage m = CStatusMessage(this).error("No models for %1") << m_simulatorInfo.toQString(true);
|
||||||
ui->form_OwnModelSet->showOverlayMessage(m);
|
ui->form_OwnModelSet->showOverlayMessage(m);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetDialog::setSimulator(const CSimulatorInfo &simulator)
|
void CDbOwnModelSetFormDialog::setSimulator(const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(m_simulatorInfo.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
this->m_simulatorInfo = simulator;
|
m_simulatorInfo = simulator;
|
||||||
ui->form_OwnModelSet->setSimulator(this->m_simulatorInfo);
|
ui->form_OwnModelSet->setSimulator(m_simulatorInfo);
|
||||||
this->setWindowTitle("Create model set for " + this->m_simulatorInfo.toQString(true));
|
this->setWindowTitle("Create model set for " + m_simulatorInfo.toQString(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelList CDbOwnModelSetDialog::buildSet(const CSimulatorInfo &simulator, const CAircraftModelList ¤tSet)
|
CAircraftModelList CDbOwnModelSetFormDialog::buildSet(const CSimulatorInfo &simulator, const CAircraftModelList ¤tSet)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "missing mapping component");
|
||||||
const bool givenDistributorsOnly = !ui->form_OwnModelSet->optionUseAllDistributors();
|
const bool givenDistributorsOnly = !ui->form_OwnModelSet->optionUseAllDistributors();
|
||||||
@@ -126,7 +126,7 @@ namespace BlackGui
|
|||||||
const bool sortByDistributor = ui->form_OwnModelSet->optionSortByDistributorPreferences();
|
const bool sortByDistributor = ui->form_OwnModelSet->optionSortByDistributorPreferences();
|
||||||
const bool consolidateWithDb = ui->form_OwnModelSet->optionConsolidateModelSetWithDbData();
|
const bool consolidateWithDb = ui->form_OwnModelSet->optionConsolidateModelSetWithDbData();
|
||||||
|
|
||||||
this->m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
m_simulatorInfo = this->getMappingComponent()->getOwnModelsSimulator();
|
||||||
const CAircraftModelList models = this->getMappingComponent()->getOwnModels();
|
const CAircraftModelList models = this->getMappingComponent()->getOwnModels();
|
||||||
const CDistributorList distributors = ui->form_OwnModelSet->getDistributorsBasedOnOptions();
|
const CDistributorList distributors = ui->form_OwnModelSet->getDistributorsBasedOnOptions();
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKGUI_COMPONENTS_DBOWNMODELSETDIALOG_H
|
#ifndef BLACKGUI_COMPONENTS_DBOWNMODELSETFORMDIALOG_H
|
||||||
#define BLACKGUI_COMPONENTS_DBOWNMODELSETDIALOG_H
|
#define BLACKGUI_COMPONENTS_DBOWNMODELSETFORMDIALOG_H
|
||||||
|
|
||||||
#include "blackgui/components/dbmappingcomponentaware.h"
|
#include "blackgui/components/dbmappingcomponentaware.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
@@ -23,8 +23,7 @@
|
|||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace BlackMisc { class CLogCategoryList; }
|
namespace BlackMisc { class CLogCategoryList; }
|
||||||
namespace Ui { class CDbOwnModelSetDialog; }
|
namespace Ui { class CDbOwnModelSetFormDialog; }
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
@@ -32,7 +31,7 @@ namespace BlackGui
|
|||||||
/*!
|
/*!
|
||||||
* Dialog to create new model set
|
* Dialog to create new model set
|
||||||
*/
|
*/
|
||||||
class CDbOwnModelSetDialog :
|
class CDbOwnModelSetFormDialog :
|
||||||
public QDialog,
|
public QDialog,
|
||||||
public CDbMappingComponentAware
|
public CDbMappingComponentAware
|
||||||
{
|
{
|
||||||
@@ -43,10 +42,10 @@ namespace BlackGui
|
|||||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CDbOwnModelSetDialog(QWidget *parent = nullptr);
|
explicit CDbOwnModelSetFormDialog(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDbOwnModelSetDialog();
|
virtual ~CDbOwnModelSetFormDialog();
|
||||||
|
|
||||||
//! Last build set
|
//! Last build set
|
||||||
const BlackMisc::Simulation::CAircraftModelList &getModelSet() const { return m_modelSet; }
|
const BlackMisc::Simulation::CAircraftModelList &getModelSet() const { return m_modelSet; }
|
||||||
@@ -63,18 +62,17 @@ namespace BlackGui
|
|||||||
//! Exec and display simulator
|
//! Exec and display simulator
|
||||||
virtual int exec() override;
|
virtual int exec() override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
//! Button clicked
|
|
||||||
void ps_buttonClicked();
|
|
||||||
|
|
||||||
//! Simulator changed
|
|
||||||
void ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbOwnModelSetDialog> ui;
|
QScopedPointer<Ui::CDbOwnModelSetFormDialog> ui;
|
||||||
BlackMisc::Simulation::CAircraftModelList m_modelSet;
|
BlackMisc::Simulation::CAircraftModelList m_modelSet;
|
||||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo;
|
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo;
|
||||||
|
|
||||||
|
//! Button clicked
|
||||||
|
void buttonClicked();
|
||||||
|
|
||||||
|
//! Simulator changed
|
||||||
|
void simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! Check data
|
//! Check data
|
||||||
bool checkData();
|
bool checkData();
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CDbOwnModelSetDialog</class>
|
<class>CDbOwnModelSetFormDialog</class>
|
||||||
<widget class="QDialog" name="CDbOwnModelSetDialog">
|
<widget class="QDialog" name="CDbOwnModelSetFormDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
Reference in New Issue
Block a user