refs #475, added a utility class so the load indicator of a view can be triggered from the framing component

This commit is contained in:
Klaus Basan
2015-10-02 14:50:19 +02:00
committed by Mathew Sutcliffe
parent 2507ce6715
commit 6fda875e8f
16 changed files with 137 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ namespace BlackGui
ui(new Ui::CDbAircraftIcaoComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_AircraftIcao);
this->ui->tvp_AircraftIcao->setResizeMode(CViewBaseNonTemplate::ResizingOff);
connect(this->ui->tvp_AircraftIcao, &CAircraftIcaoCodeView::requestNewBackendData, this, &CDbAircraftIcaoComponent::ps_reload);

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_DBAIRCRAFTICAOCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbAircraftIcaoComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -22,10 +22,10 @@ namespace BlackGui
{
CDbAirlineIcaoComponent::CDbAirlineIcaoComponent(QWidget *parent) :
QFrame(parent),
CWebDataServicesAware(nullptr),
ui(new Ui::CDbAirlineIcaoComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_AirlineIcao);
this->ui->tvp_AirlineIcao->setResizeMode(CViewBaseNonTemplate::ResizingOff);
this->ui->tvp_AirlineIcao->setResizeMode(CViewBaseNonTemplate::ResizingOff);
this->ui->tvp_AirlineIcao->allowDragDropValueObjects(true, false);

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_DBAIRLINEICAOCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbAirlineIcaoComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -22,10 +22,10 @@ namespace BlackGui
{
CDbCountryComponent::CDbCountryComponent(QWidget *parent) :
QFrame(parent),
CWebDataServicesAware(nullptr),
ui(new Ui::CDbCountryComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_Countries);
this->ui->tvp_Countries->setResizeMode(CViewBaseNonTemplate::ResizingOnce);
connect(this->ui->tvp_Countries, &CCountryView::requestNewBackendData, this, &CDbCountryComponent::ps_reload);

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_DBCOUNTRYCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbCountryComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -21,10 +21,10 @@ namespace BlackGui
{
CDbDistributorComponent::CDbDistributorComponent(QWidget *parent) :
QFrame(parent),
CWebDataServicesAware(nullptr),
ui(new Ui::CDbDistributorComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_Distributors);
this->ui->tvp_Distributors->setResizeMode(CViewBaseNonTemplate::ResizingAuto);
this->ui->tvp_Distributors->allowDragDropValueObjects(true, false);
connect(this->ui->tvp_Distributors, &CDistributorView::requestNewBackendData, this, &CDbDistributorComponent::ps_reload);

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_DBDISTRIBUTORCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbDistributorComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -26,6 +26,7 @@ namespace BlackGui
ui(new Ui::CDbLiveryComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_Liveries);
connect(this->ui->tvp_Liveries, &CLiveryView::requestNewBackendData, this, &CDbLiveryComponent::ps_reload);
// filter and drag and drop

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_COMPONENTS_DBLIVERYCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbLiveryComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -13,6 +13,7 @@
#include "blackmisc/logmessage.h"
#include "blackmisc/project.h"
#include "blackgui/guiutility.h"
#include "blackgui/roles.h"
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
@@ -54,10 +55,11 @@ namespace BlackGui
void CDbMappingComponent::initVPilotLoading()
{
if (CProject::isRunningOnWindowsNtPlatform() && CProject::isCompiledWithMsFlightSimulatorSupport())
if (CRoles::roles().isAdmin() &&
CProject::isRunningOnWindowsNtPlatform() &&
CProject::isCompiledWithMsFlightSimulatorSupport())
{
this->m_withVPilot = true;
this->ui->tab_VPilot->setEnabled(true);
this->ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CMappingVPilotMenu(this));
this->ui->tvp_AircraftModelsForVPilot->setDisplayAutomatically(true);
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
@@ -67,8 +69,10 @@ namespace BlackGui
else
{
this->m_withVPilot = false;
this->ui->tab_VPilot->setEnabled(false);
}
this->ui->tab_VPilot->setEnabled(m_withVPilot);
this->ui->tab_VPilot->setVisible(m_withVPilot);
this->ui->tw_ModelsToBeMapped->removeTab(1);
}
bool CDbMappingComponent::initModelLoader(const CSimulatorInfo &simInfo)
@@ -365,8 +369,11 @@ namespace BlackGui
CDbMappingComponent *mapComp = qobject_cast<CDbMappingComponent *>(this->parent());
Q_ASSERT_X(mapComp, Q_FUNC_INFO, "Cannot access parent");
menu.addAction(CIcons::appMappings16(), "Load vPilot Rules", mapComp, SLOT(ps_loadVPilotData()));
menu.addSeparator();
if (CRoles::roles().isAdmin())
{
menu.addAction(CIcons::appMappings16(), "Load vPilot Rules", mapComp, SLOT(ps_loadVPilotData()));
menu.addSeparator();
}
}
} // ns

View File

@@ -15,6 +15,7 @@
#include "blackgui/blackguiexport.h"
#include "blackgui/overlaymessagesframe.h"
#include "blackgui/menudelegate.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/simulation/aircraftmodelloader.h"
#include "blackmisc/simulation/fscommon/vpilotrulesreader.h"
@@ -35,6 +36,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbMappingComponent :
public BlackGui::COverlayMessagesFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT

View File

@@ -23,10 +23,10 @@ namespace BlackGui
{
CDbModelComponent::CDbModelComponent(QWidget *parent) :
QFrame(parent),
CWebDataServicesAware(nullptr), // provider not yet available
ui(new Ui::CDbModelComponent)
{
ui->setupUi(this);
this->setViewWithIndicator(this->ui->tvp_AircraftModel);
this->ui->tvp_AircraftModel->setAircraftModelMode(CAircraftModelListModel::Database);
connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::ps_reload);
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged);

View File

@@ -13,6 +13,7 @@
#define BLACKUI_COMPONENTS_DBMODELCOMPONENT_H
#include "blackgui/blackguiexport.h"
#include "blackgui/enableforviewbasedindicator.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackmisc/network/webdataservicesprovider.h"
#include <QFrame>
@@ -30,6 +31,7 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbModelComponent :
public QFrame,
public CEnableForDockWidgetInfoArea,
public BlackGui::CEnableForViewBasedIndicator,
public BlackMisc::Network::CWebDataServicesAware
{
Q_OBJECT