mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
refs #452 mapping component where mappings can be performed
This commit is contained in:
committed by
Mathew Sutcliffe
parent
bcd821812f
commit
0a51c0a7b7
373
src/blackgui/components/dbmappingcomponent.cpp
Normal file
373
src/blackgui/components/dbmappingcomponent.cpp
Normal file
@@ -0,0 +1,373 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "dbmappingcomponent.h"
|
||||
#include "ui_dbmappingcomponent.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Editors;
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CDbMappingComponent::CDbMappingComponent(QWidget *parent) :
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CDbMappingComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->ui->tvp_AircraftModelsForVPilot->setAircraftModelMode(CAircraftModelListModel::VPilotRuleModel);
|
||||
connect(ui->editor_Model, &CModelMappingForm::requestSave, this, &CDbMappingComponent::save);
|
||||
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
|
||||
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::rowCountChanged, this, &CDbMappingComponent::ps_onOwnModelsCountChanged);
|
||||
|
||||
ui->tvp_OwnAircraftModels->setCustomMenu(new CMappingSimulatorModelMenu(this));
|
||||
ui->tvp_OwnAircraftModels->setDisplayAutomatically(true);
|
||||
|
||||
ui->editor_AircraftIcao->setMappingMode();
|
||||
ui->editor_Distributor->setMappingMode();
|
||||
ui->editor_Livery->setMappingMode();
|
||||
|
||||
initVPilotLoading();
|
||||
}
|
||||
|
||||
CDbMappingComponent::~CDbMappingComponent()
|
||||
{
|
||||
gracefulShutdown();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::initVPilotLoading()
|
||||
{
|
||||
if (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);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::rowCountChanged, this, &CDbMappingComponent::ps_onVPilotCountChanged);
|
||||
connect(&m_vPilotReader, &CVPilotRulesReader::readFinished, this, &CDbMappingComponent::ps_onLoadVPilotDataFinished);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_withVPilot = false;
|
||||
this->ui->tab_VPilot->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CDbMappingComponent::initModelLoader(const CSimulatorInfo &simInfo)
|
||||
{
|
||||
// already loaded
|
||||
if (this->m_modelLoader && this->m_modelLoader->supportsSimulator(simInfo)) { return true; }
|
||||
|
||||
// unload old
|
||||
if (this->m_modelLoader) { this->m_modelLoader->cancelLoading(); }
|
||||
|
||||
//! \todo appropriate model loader or loaders via factory?
|
||||
this->m_modelLoader.reset(IAircraftModelLoader::createModelLoader(simInfo));
|
||||
if (!this->m_modelLoader || !this->m_modelLoader->supportsSimulator(simInfo))
|
||||
{
|
||||
CLogMessage(this).error("Failed to init model loader %1") << simInfo.toQString();
|
||||
this->m_modelLoader.reset();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool c = connect(this->m_modelLoader.data(), &IAircraftModelLoader::loadingFinished, this, &CDbMappingComponent::ps_onInstalledModelLoadingFinished);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect for model loader");
|
||||
Q_UNUSED(c);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::setProvider(BlackMisc::Network::IWebDataServicesProvider *provider)
|
||||
{
|
||||
CWebDataServicesAware::setProvider(provider);
|
||||
this->ui->editor_Livery->setProvider(provider);
|
||||
this->ui->editor_Distributor->setProvider(provider);
|
||||
this->ui->editor_AircraftIcao->setProvider(provider);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::gracefulShutdown()
|
||||
{
|
||||
this->disconnect();
|
||||
CWebDataServicesAware::gracefulShutdown();
|
||||
this->m_vPilotReader.gracefulShutdown();
|
||||
if (this->m_modelLoader) { this->m_modelLoader->gracefulShutdown(); }
|
||||
}
|
||||
|
||||
CStatusMessageList CDbMappingComponent::validate(bool withNestedForms) const
|
||||
{
|
||||
CStatusMessageList msgs(this->ui->editor_Model->validate(!withNestedForms));
|
||||
if (withNestedForms)
|
||||
{
|
||||
msgs.push_back(ui->editor_AircraftIcao->validate());
|
||||
msgs.push_back(ui->editor_Livery->validate(withNestedForms));
|
||||
msgs.push_back(ui->editor_Distributor->validate());
|
||||
}
|
||||
return msgs;
|
||||
}
|
||||
|
||||
void CDbMappingComponent::save()
|
||||
{
|
||||
CStatusMessageList msgs(validate(true));
|
||||
if (msgs.hasErrorMessages())
|
||||
{
|
||||
CLogMessage::preformatted(msgs);
|
||||
this->showMessages(msgs);
|
||||
return;
|
||||
}
|
||||
|
||||
CAircraftModel model(getAircraftModel());
|
||||
msgs = this->asyncWriteModel(model);
|
||||
if (!msgs.isEmpty())
|
||||
{
|
||||
CLogMessage(this).preformatted(msgs);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::resizeForSelect()
|
||||
{
|
||||
int h = this->height();
|
||||
int h1 = h / 3 * 2;
|
||||
int h2 = h / 3;
|
||||
QList<int> sizes({h1, h2});
|
||||
this->ui->sp_MappingComponent->setSizes(sizes);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::resizeForMapping()
|
||||
{
|
||||
int h = this->height(); // total height
|
||||
int h2 = ui->qw_EditorsScrollArea->minimumHeight();
|
||||
h2 *= 1.10; // desired height of inner widget + some space for scrollarea
|
||||
int currentSize = ui->sp_MappingComponent->sizes().last(); // current size
|
||||
if (h2 <= currentSize) { return; }
|
||||
|
||||
int h1;
|
||||
if (h * 0.90 > h2)
|
||||
{
|
||||
// enough space to display as whole
|
||||
h1 = h - h2;
|
||||
}
|
||||
else
|
||||
{
|
||||
h1 = h / 3;
|
||||
h2 = h / 3 * 2;
|
||||
}
|
||||
QList<int> sizes({h1, h2});
|
||||
this->ui->sp_MappingComponent->setSizes(sizes);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_loadVPilotData()
|
||||
{
|
||||
if (this->m_vPilotReader.readASync(true))
|
||||
{
|
||||
CLogMessage(this).info("Start loading vPilot rulesets");
|
||||
this->ui->tvp_AircraftModelsForVPilot->showLoadIndicator();
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).warning("Loading vPilot rulesets already in progress");
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onLoadVPilotDataFinished(bool success)
|
||||
{
|
||||
if (!m_withVPilot) { return; }
|
||||
if (success)
|
||||
{
|
||||
CLogMessage(this).info("Loading vPilot ruleset completed");
|
||||
if (this->ui->tvp_AircraftModelsForVPilot->displayAutomatically())
|
||||
{
|
||||
this->ui->tvp_AircraftModelsForVPilot->updateContainerMaybeAsync(
|
||||
this->m_vPilotReader.getAsModels()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("Loading vPilot ruleset failed");
|
||||
}
|
||||
this->ui->tvp_OwnAircraftModels->hideLoadIndicator();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onVPilotCountChanged(int count, bool withFilter)
|
||||
{
|
||||
if (!m_withVPilot) { return; }
|
||||
Q_UNUSED(count);
|
||||
Q_UNUSED(withFilter);
|
||||
int i = this->ui->tw_ModelsToBeMapped->indexOf(this->ui->tab_VPilot);
|
||||
QString o = this->ui->tw_ModelsToBeMapped->tabText(i);
|
||||
QString f = this->ui->tvp_AircraftModelsForVPilot->derivedModel()->hasFilter() ? "F" : "";
|
||||
o = CGuiUtility::replaceTabCountValue(o, this->ui->tvp_AircraftModelsForVPilot->rowCount()) + f;
|
||||
this->ui->tw_ModelsToBeMapped->setTabText(i, o);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onOwnModelsCountChanged(int count, bool withFilter)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
Q_UNUSED(withFilter);
|
||||
int i = this->ui->tw_ModelsToBeMapped->indexOf(this->ui->tab_OwnModels);
|
||||
QString o = this->ui->tw_ModelsToBeMapped->tabText(i);
|
||||
if (this->m_modelLoader)
|
||||
{
|
||||
QString sims(this->m_modelLoader->supportedSimulatorsAsString());
|
||||
if (!sims.isEmpty()) { o = o.append(" ").append(sims); }
|
||||
}
|
||||
QString f = this->ui->tvp_OwnAircraftModels->derivedModel()->hasFilter() ? "F" : "";
|
||||
o = CGuiUtility::replaceTabCountValue(o, this->ui->tvp_AircraftModelsForVPilot->rowCount()) + f;
|
||||
this->ui->tw_ModelsToBeMapped->setTabText(i, o);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_requestSimulatorModels()
|
||||
{
|
||||
QAction *a = qobject_cast<QAction *>(QObject::sender());
|
||||
if (!a) { return; }
|
||||
int f = a->data().toInt();
|
||||
CSimulatorInfo sim(f);
|
||||
this->ps_loadInstalledModels(sim);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onModelRowSelected(const QModelIndex &index)
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
CAircraftModel model;
|
||||
if (sender == this->ui->tvp_AircraftModelsForVPilot)
|
||||
{
|
||||
model = this->ui->tvp_AircraftModelsForVPilot->at(index);
|
||||
}
|
||||
else if (sender == this->ui->tvp_OwnAircraftModels)
|
||||
{
|
||||
model = this->ui->tvp_OwnAircraftModels->at(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->ui->editor_Model->setValue(model);
|
||||
|
||||
const CLivery livery(this->smartLiverySelector(model.getLivery()));
|
||||
const CAircraftIcaoCode aircraftIcao(this->smartAircraftIcaoSelector(model.getAircraftIcaoCode()));
|
||||
const CDistributor distributor(this->smartDistributorSelector(model.getDistributor()));
|
||||
|
||||
// if found, then set in editor
|
||||
if (livery.hasValidDbKey()) { this->ui->editor_Livery->setValue(livery); }
|
||||
else { this->ui->editor_Livery->clear(); }
|
||||
if (aircraftIcao.hasValidDbKey()) { this->ui->editor_AircraftIcao->setValue(aircraftIcao); }
|
||||
else { this->ui->editor_AircraftIcao->clear(); }
|
||||
if (distributor.hasValidDbKey()) { this->ui->editor_Distributor->setValue(distributor); }
|
||||
else { this->ui->editor_Distributor->clear(); }
|
||||
|
||||
// request filtering
|
||||
emit filterByLivery(model.getLivery());
|
||||
emit filterByAircraftIcao(model.getAircraftIcaoCode());
|
||||
emit filterByDistributor(model.getDistributor());
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_loadInstalledModels(const CSimulatorInfo &simInfo)
|
||||
{
|
||||
//! \todo, load correct loader
|
||||
if (!this->initModelLoader(simInfo))
|
||||
{
|
||||
CLogMessage(this).error("Cannot load model loader for %1") << simInfo.toQString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->m_modelLoader->isLoadingFinished())
|
||||
{
|
||||
CLogMessage(this).info("Loading for %1 already in progress") << simInfo.toQString();
|
||||
return;
|
||||
}
|
||||
|
||||
CLogMessage(this).info("Starting loading for %1") << simInfo.toQString();
|
||||
this->m_modelLoader->startLoading();
|
||||
this->ui->tvp_OwnAircraftModels->showLoadIndicator();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onInstalledModelLoadingFinished(bool success)
|
||||
{
|
||||
if (success && this->m_modelLoader)
|
||||
{
|
||||
CLogMessage(this).info("Loading of models completed");
|
||||
if (this->ui->tvp_OwnAircraftModels->displayAutomatically())
|
||||
{
|
||||
this->ui->tvp_OwnAircraftModels->updateContainer(
|
||||
this->m_modelLoader->getAircraftModels()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("Loading of models failed, simulator");
|
||||
this->ui->tvp_OwnAircraftModels->hideLoadIndicator();
|
||||
}
|
||||
this->ui->tvp_OwnAircraftModels->hideLoadIndicator();
|
||||
}
|
||||
|
||||
CAircraftModel CDbMappingComponent::getAircraftModel() const
|
||||
{
|
||||
CAircraftModel model(ui->editor_Model->getValue());
|
||||
model.setDistributor(ui->editor_Distributor->getValue());
|
||||
model.setAircraftIcaoCode(ui->editor_AircraftIcao->getValue());
|
||||
model.setLivery(ui->editor_Livery->getValue());
|
||||
return model;
|
||||
}
|
||||
|
||||
void CDbMappingComponent::CMappingSimulatorModelMenu::customMenu(QMenu &menu) const
|
||||
{
|
||||
CSimulatorInfo sims = CSimulatorInfo::getLocallyInstalledSimulators();
|
||||
QMenu *load = menu.addMenu(CIcons::appModels16(), "Load installed models");
|
||||
QAction *a = nullptr;
|
||||
CDbMappingComponent *mapComp = qobject_cast<CDbMappingComponent *>(this->parent());
|
||||
Q_ASSERT_X(mapComp, Q_FUNC_INFO, "Cannot access parent");
|
||||
|
||||
if (sims.fs9())
|
||||
{
|
||||
a = load->addAction(CIcons::appModels16(), "FS9 models", mapComp, SLOT(ps_requestSimulatorModels()));
|
||||
a->setData(QVariant(static_cast<int>(CSimulatorInfo::FS9)));
|
||||
}
|
||||
if (sims.fsx())
|
||||
{
|
||||
a = load->addAction(CIcons::appModels16(), "FSX models", mapComp, SLOT(ps_requestSimulatorModels()));
|
||||
a->setData(QVariant(static_cast<int>(CSimulatorInfo::FSX)));
|
||||
}
|
||||
if (sims.p3d())
|
||||
{
|
||||
a = load->addAction(CIcons::appModels16(), "P3D models", mapComp, SLOT(ps_requestSimulatorModels()));
|
||||
a->setData(QVariant(static_cast<int>(CSimulatorInfo::P3D)));
|
||||
}
|
||||
if (sims.xplane())
|
||||
{
|
||||
a = load->addAction(CIcons::appModels16(), "XPlane models", mapComp, SLOT(ps_requestSimulatorModels()));
|
||||
a->setData(QVariant(static_cast<int>(CSimulatorInfo::XPLANE)));
|
||||
}
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::CMappingVPilotMenu::customMenu(QMenu &menu) const
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
151
src/blackgui/components/dbmappingcomponent.h
Normal file
151
src/blackgui/components/dbmappingcomponent.h
Normal file
@@ -0,0 +1,151 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_DBMAPPINGCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/menudelegate.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackmisc/simulation/aircraftmodelloader.h"
|
||||
#include "blackmisc/simulation/fscommon/vpilotrulesreader.h"
|
||||
#include "blackmisc/network/webdataservicesprovider.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CDbMappingComponent; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
/*!
|
||||
* Mapping component
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbMappingComponent :
|
||||
public BlackGui::COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public BlackMisc::Network::CWebDataServicesAware
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CDbMappingComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CDbMappingComponent();
|
||||
|
||||
//! \copydoc CWebDataReaderAware::setProvider
|
||||
virtual void setProvider(BlackMisc::Network::IWebDataServicesProvider *provider) override;
|
||||
|
||||
//! Graceful shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
signals:
|
||||
//! Request to filter by livery
|
||||
void filterByLivery(const BlackMisc::Aviation::CLivery &livery);
|
||||
|
||||
//! Request to filter by aircraft ICAO
|
||||
void filterByAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
//! Request to filter by distributor
|
||||
void filterByDistributor(const BlackMisc::Simulation::CDistributor &distributor);
|
||||
|
||||
public slots:
|
||||
//! Validate, empty list means OK
|
||||
BlackMisc::CStatusMessageList validate(bool withNestedForms) const;
|
||||
|
||||
//! Save
|
||||
void save();
|
||||
|
||||
//! Resize so that selection is easy (larger table view)
|
||||
void resizeForSelect();
|
||||
|
||||
//! Resize so that mapping is easier
|
||||
void resizeForMapping();
|
||||
|
||||
private slots:
|
||||
//! Load the vPilot rules
|
||||
void ps_loadVPilotData();
|
||||
|
||||
//! Data for vPilot have been loaded
|
||||
void ps_onLoadVPilotDataFinished(bool success);
|
||||
|
||||
//! Row count for vPilot data changed
|
||||
void ps_onVPilotCountChanged(int count, bool withFilter);
|
||||
|
||||
//! Row has been selected
|
||||
void ps_onModelRowSelected(const QModelIndex &index);
|
||||
|
||||
//! Load the models
|
||||
void ps_loadInstalledModels(const BlackMisc::Simulation::CSimulatorInfo &simInfo);
|
||||
|
||||
//! Model loading finished
|
||||
void ps_onInstalledModelLoadingFinished(bool success);
|
||||
|
||||
//! Own model count changed
|
||||
void ps_onOwnModelsCountChanged(int count, bool withFilter);
|
||||
|
||||
//! Request simulator models
|
||||
void ps_requestSimulatorModels();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbMappingComponent> ui;
|
||||
BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader;
|
||||
QScopedPointer<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader;
|
||||
bool m_withVPilot = false;
|
||||
|
||||
//! Consolidated aircraft model
|
||||
BlackMisc::Simulation::CAircraftModel getAircraftModel() const;
|
||||
|
||||
//! Init vPilot loading is suitable
|
||||
void initVPilotLoading();
|
||||
|
||||
//! Init model loader
|
||||
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simInfo);
|
||||
|
||||
// -------------------- component specifi menus --------------------------
|
||||
|
||||
//! The menu for loading and handling own models for mapping
|
||||
//! \note This is specific for that very component
|
||||
class CMappingSimulatorModelMenu : public BlackGui::IMenuDelegate
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CMappingSimulatorModelMenu(CDbMappingComponent *mappingComponent) :
|
||||
BlackGui::IMenuDelegate(mappingComponent)
|
||||
{}
|
||||
|
||||
//! \copydoc IMenuDelegate::customMenu
|
||||
virtual void customMenu(QMenu &menu) const override;
|
||||
};
|
||||
|
||||
//! The menu for loading and handling VPilot rules for mapping
|
||||
//! \note This is specific for that very component
|
||||
class CMappingVPilotMenu : public BlackGui::IMenuDelegate
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CMappingVPilotMenu(CDbMappingComponent *mappingComponent) :
|
||||
BlackGui::IMenuDelegate(mappingComponent)
|
||||
{}
|
||||
|
||||
//! \copydoc IMenuDelegate::customMenu
|
||||
virtual void customMenu(QMenu &menu) const override;
|
||||
};
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
376
src/blackgui/components/dbmappingcomponent.ui
Normal file
376
src/blackgui/components/dbmappingcomponent.ui
Normal file
@@ -0,0 +1,376 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CDbMappingComponent</class>
|
||||
<widget class="BlackGui::COverlayMessagesFrame" name="CDbMappingComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>266</width>
|
||||
<height>618</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_DbMappingComponent">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="sp_MappingComponent">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="fr_SelectModel">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_SelectModel">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tw_ModelsToBeMapped">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_OwnModels">
|
||||
<attribute name="title">
|
||||
<string>Own models</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="hl_OwnModels">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CAircraftModelView" name="tvp_OwnAircraftModels">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_VPilot">
|
||||
<attribute name="title">
|
||||
<string>vPilot rules</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="hl_VPilot">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CAircraftModelView" name="tvp_AircraftModelsForVPilot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CModelMappingForm" name="editor_Model">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frp_Editors">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_Editors">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="sa_Editors">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_EditorsScrollArea">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>375</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_EditorsScrollArea">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_EditorsLeft">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_EditorsLeft">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CDistributorForm" name="editor_Distributor">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CAircraftIcaoForm" name="editor_AircraftIcao">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vs_EditorsLeft">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>334</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_EditorsRight">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_EditorsRight">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Editors::CLiveryForm" name="editor_Livery">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vs_EditorsRight">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftModelView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftmodelview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CAircraftIcaoForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/aircrafticaoform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CLiveryForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/liveryform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CDistributorForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/distributorform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CModelMappingForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/modelmappingform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::COverlayMessagesFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/overlaymessagesframe.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user