mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
Ref T246, extended the DB components a bit
* change signals * distributor selection * public slots -> public * renamings
This commit is contained in:
@@ -57,6 +57,16 @@ namespace BlackGui
|
|||||||
ui->filter_Distributor->setSimulator(simulator);
|
ui->filter_Distributor->setSimulator(simulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDistributorList CDbDistributorComponent::getSelectedDistributors() const
|
||||||
|
{
|
||||||
|
return ui->tvp_Distributors->selectedObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDbDistributorComponent::hasSelectedDistributors() const
|
||||||
|
{
|
||||||
|
return ui->tvp_Distributors->hasSelection();
|
||||||
|
}
|
||||||
|
|
||||||
void CDbDistributorComponent::distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
void CDbDistributorComponent::distributorsRead(CEntityFlags::Entity entity, CEntityFlags::ReadState readState, int count)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||||
#include "blackgui/enableforviewbasedindicator.h"
|
#include "blackgui/enableforviewbasedindicator.h"
|
||||||
|
#include "blackmisc/simulation/distributorlist.h"
|
||||||
#include "blackmisc/network/entityflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -52,6 +53,12 @@ namespace BlackGui
|
|||||||
//! Filter by simulator
|
//! Filter by simulator
|
||||||
void filterBySimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void filterBySimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
//! The selected distributors
|
||||||
|
BlackMisc::Simulation::CDistributorList getSelectedDistributors() const;
|
||||||
|
|
||||||
|
//! Having selected distributors
|
||||||
|
bool hasSelectedDistributors() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbDistributorComponent> ui;
|
QScopedPointer<Ui::CDbDistributorComponent> ui;
|
||||||
|
|
||||||
|
|||||||
@@ -155,13 +155,13 @@ namespace BlackGui
|
|||||||
QString CDbOwnModelsComponent::getInfoString() const
|
QString CDbOwnModelsComponent::getInfoString() const
|
||||||
{
|
{
|
||||||
if (!m_modelLoader) { return ""; }
|
if (!m_modelLoader) { return ""; }
|
||||||
return m_modelLoader->getInfoString();
|
return m_modelLoader->getModelCacheInfoString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CDbOwnModelsComponent::getInfoStringFsFamily() const
|
QString CDbOwnModelsComponent::getInfoStringFsFamily() const
|
||||||
{
|
{
|
||||||
if (!m_modelLoader) { return ""; }
|
if (!m_modelLoader) { return ""; }
|
||||||
return m_modelLoader->getInfoStringFsFamily();
|
return m_modelLoader->getModelCacheInfoStringFsFamily();
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage CDbOwnModelsComponent::updateViewAndCache(const CAircraftModelList &models)
|
CStatusMessage CDbOwnModelsComponent::updateViewAndCache(const CAircraftModelList &models)
|
||||||
@@ -451,6 +451,9 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not check for empty models die here, as depending on mode we could still load
|
||||||
|
// will be checked in model loader
|
||||||
|
|
||||||
CLogMessage(this).info("Starting loading for '%1'") << simulator.toQString();
|
CLogMessage(this).info("Starting loading for '%1'") << simulator.toQString();
|
||||||
ui->tvp_OwnAircraftModels->showLoadIndicator();
|
ui->tvp_OwnAircraftModels->showLoadIndicator();
|
||||||
Q_ASSERT_X(sGui && sGui->getWebDataServices(), Q_FUNC_INFO, "missing web data services");
|
Q_ASSERT_X(sGui && sGui->getWebDataServices(), Q_FUNC_INFO, "missing web data services");
|
||||||
@@ -470,6 +473,8 @@ namespace BlackGui
|
|||||||
// loading ok, but no data
|
// loading ok, but no data
|
||||||
CLogMessage(this).warning("Loading completed, but no models");
|
CLogMessage(this).warning("Loading completed, but no models");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit this->successfullyLoadedModels(simulator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -477,7 +482,8 @@ namespace BlackGui
|
|||||||
CLogMessage(this).error("Loading of models failed, simulator '%1'") << simulator.toQString();
|
CLogMessage(this).error("Loading of models failed, simulator '%1'") << simulator.toQString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusMessages.hasWarningOrErrorMessages()) {
|
if (statusMessages.hasWarningOrErrorMessages())
|
||||||
|
{
|
||||||
this->showOverlayMessages(statusMessages);
|
this->showOverlayMessages(statusMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ namespace BlackGui
|
|||||||
virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Models have been successfully loaded
|
||||||
|
void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
|
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
|
||||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models, aka models on disk
|
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models, aka models on disk
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
connect(ui->comp_OwnModels, &CDbOwnModelsComponent::successfullyLoadedModels, this, &CDbOwnModelsDialog::successfullyLoadedModels);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbOwnModelsDialog::~CDbOwnModelsDialog()
|
CDbOwnModelsDialog::~CDbOwnModelsDialog()
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ namespace BlackGui
|
|||||||
//! \remark allows to use the powerful component class
|
//! \remark allows to use the powerful component class
|
||||||
const CDbOwnModelsComponent *modelsComponent() const;
|
const CDbOwnModelsComponent *modelsComponent() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! \copydoc CDbOwnModelsComponent::successfullyLoadedModels
|
||||||
|
void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbOwnModelsDialog> ui;
|
QScopedPointer<Ui::CDbOwnModelsDialog> ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -209,6 +209,11 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelSetComponent::enableButtons(bool firstSet)
|
||||||
|
{
|
||||||
|
ui->pb_FirstSet->setEnabled(firstSet);
|
||||||
|
}
|
||||||
|
|
||||||
void CDbOwnModelSetComponent::tabIndexChanged(int index)
|
void CDbOwnModelSetComponent::tabIndexChanged(int index)
|
||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ namespace BlackGui
|
|||||||
virtual BlackMisc::Simulation::CSimulatorInfo getSelectedSimulator() const override { return this->getModelSetSimulator(); }
|
virtual BlackMisc::Simulation::CSimulatorInfo getSelectedSimulator() const override { return this->getModelSetSimulator(); }
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
public slots:
|
//! Enable buttons
|
||||||
|
void enableButtons(bool firstSet);
|
||||||
|
|
||||||
//! Set the model set for a given simulator
|
//! Set the model set for a given simulator
|
||||||
void setModelSet(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void setModelSet(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
|||||||
@@ -36,5 +36,15 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
return ui->comp_OwnModelSet;
|
return ui->comp_OwnModelSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDbOwnModelSetComponent *CDbOwnModelSetDialog::modelSetComponent()
|
||||||
|
{
|
||||||
|
return ui->comp_OwnModelSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelSetDialog::enableButtons(bool firstSet)
|
||||||
|
{
|
||||||
|
ui->comp_OwnModelSet->enableButtons(firstSet);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ namespace BlackGui
|
|||||||
//! Direct access to CDbOwnModelSetComponent
|
//! Direct access to CDbOwnModelSetComponent
|
||||||
const CDbOwnModelSetComponent *modelSetComponent() const;
|
const CDbOwnModelSetComponent *modelSetComponent() const;
|
||||||
|
|
||||||
|
//! Direct access to CDbOwnModelSetComponent
|
||||||
|
CDbOwnModelSetComponent *modelSetComponent();
|
||||||
|
|
||||||
|
//! Enable buttons
|
||||||
|
void enableButtons(bool firstSet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbOwnModelSetDialog> ui;
|
QScopedPointer<Ui::CDbOwnModelSetDialog> ui;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user