mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T285, applied new style (private instead private slots) and Qt::QueuedConnection in mapping component
This commit is contained in:
@@ -97,31 +97,31 @@ namespace BlackGui
|
||||
ui->comp_StashAircraft->view()->setCustomMenu(new CStashToolsMenu(this, false));
|
||||
|
||||
// connects
|
||||
connect(ui->editor_ModelMapping, &CModelMappingForm::requestStash, this, &CDbMappingComponent::ps_stashCurrentModel);
|
||||
connect(ui->editor_ModelMapping, &CModelMappingForm::requestStash, this, &CDbMappingComponent::stashCurrentModel);
|
||||
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onOwnModelsChanged);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::onOwnModelsChanged);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::ps_onStashedModelsChanged);
|
||||
connect(ui->comp_OwnAircraftModels->view(), &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChanged);
|
||||
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onStashedModelsDataChanged);
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::requestHandlingOfStashDrop, this, &CDbMappingComponent::ps_handleStashDropRequest);
|
||||
connect(ui->comp_StashAircraft, &CDbStashComponent::stashedModelsChanged, this, &CDbMappingComponent::ps_onStashedModelsChanged);
|
||||
connect(ui->comp_StashAircraft, &CDbStashComponent::modelsSuccessfullyPublished, this, &CDbMappingComponent::ps_onModelsSuccessfullyPublished);
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::onStashedModelsDataChanged);
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||
connect(ui->comp_StashAircraft->view(), &CAircraftModelView::requestHandlingOfStashDrop, this, &CDbMappingComponent::handleStashDropRequest);
|
||||
connect(ui->comp_StashAircraft, &CDbStashComponent::stashedModelsChanged, this, &CDbMappingComponent::onStashedModelsChanged);
|
||||
connect(ui->comp_StashAircraft, &CDbStashComponent::modelsSuccessfullyPublished, this, &CDbMappingComponent::onModelsSuccessfullyPublished, Qt::QueuedConnection);
|
||||
|
||||
connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onModelSetChanged);
|
||||
connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::onModelSetChanged);
|
||||
connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
||||
|
||||
connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, this, &CDbMappingComponent::ps_tabIndexChanged);
|
||||
connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, ui->comp_ModelMatcher , &CModelMatcherComponent::tabIndexChanged);
|
||||
connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, this, &CDbMappingComponent::onTabIndexChanged);
|
||||
connect(ui->tw_ModelsToBeMapped, &QTabWidget::currentChanged, ui->comp_ModelMatcher, &CModelMatcherComponent::tabIndexChanged);
|
||||
|
||||
connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
|
||||
connect(ui->comp_OwnModelSet->view(), &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||
|
||||
// initial values
|
||||
this->ps_onModelSetChanged(ui->comp_OwnModelSet->view()->rowCount(), ui->comp_OwnModelSet->view()->hasFilter());
|
||||
this->ps_onStashedModelsDataChanged(ui->comp_StashAircraft->view()->rowCount(), ui->comp_StashAircraft->view()->hasFilter());
|
||||
this->ps_onOwnModelsChanged(ui->comp_OwnAircraftModels->view()->rowCount(), ui->comp_OwnAircraftModels->view()->hasFilter());
|
||||
this->onModelSetChanged(ui->comp_OwnModelSet->view()->rowCount(), ui->comp_OwnModelSet->view()->hasFilter());
|
||||
this->onStashedModelsDataChanged(ui->comp_StashAircraft->view()->rowCount(), ui->comp_StashAircraft->view()->hasFilter());
|
||||
this->onOwnModelsChanged(ui->comp_OwnAircraftModels->view()->rowCount(), ui->comp_OwnAircraftModels->view()->hasFilter());
|
||||
|
||||
// how to display forms
|
||||
ui->editor_AircraftModel->setSelectOnly();
|
||||
@@ -132,7 +132,7 @@ namespace BlackGui
|
||||
|
||||
// custom menu and shortcut
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &CDbMappingComponent::customContextMenuRequested, this, &CDbMappingComponent::ps_onCustomContextMenu);
|
||||
connect(this, &CDbMappingComponent::customContextMenuRequested, this, &CDbMappingComponent::onCustomContextMenu);
|
||||
new QShortcut(CShortcut::keyAddToModelSet(), this, SLOT(ps_addToOwnModelSet()));
|
||||
|
||||
// vPilot
|
||||
@@ -152,11 +152,11 @@ namespace BlackGui
|
||||
if (m_vPilot1stInit && vPilotSupport)
|
||||
{
|
||||
m_vPilot1stInit = false;
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::onModelRowSelected);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onVPilotDataChanged);
|
||||
connect(&m_vPilotReader, &CVPilotRulesReader::readFinished, this, &CDbMappingComponent::ps_onLoadVPilotDataFinished);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::requestStash, this, &CDbMappingComponent::stashSelectedModels);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::ps_onStashedModelsChanged);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChanged);
|
||||
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::requestUpdate, this, &CDbMappingComponent::ps_requestVPilotDataUpdate);
|
||||
|
||||
ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CMappingVPilotMenu(this, true));
|
||||
@@ -359,14 +359,14 @@ namespace BlackGui
|
||||
return msgs;
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_handleStashDropRequest(const CAirlineIcaoCode &code) const
|
||||
void CDbMappingComponent::handleStashDropRequest(const CAirlineIcaoCode &code) const
|
||||
{
|
||||
const CLivery stdLivery(sGui->getWebDataServices()->getStdLiveryForAirlineCode(code));
|
||||
if (!stdLivery.hasValidDbKey()) { return; }
|
||||
ui->comp_StashAircraft->applyToSelected(stdLivery);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_stashCurrentModel()
|
||||
void CDbMappingComponent::stashCurrentModel()
|
||||
{
|
||||
const bool nested = this->isStashTab(); // on stash tab, full validation, otherwise not
|
||||
CStatusMessageList msgs(this->validateCurrentModel(nested));
|
||||
@@ -386,17 +386,17 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_displayAutoStashingDialog()
|
||||
void CDbMappingComponent::displayAutoStashingDialog()
|
||||
{
|
||||
m_autoStashDialog->exec();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_displayAutoSimulatorStashingDialog()
|
||||
void CDbMappingComponent::displayAutoSimulatorStashingDialog()
|
||||
{
|
||||
m_autoSimulatorDialog->exec();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_removeDbModelsFromView()
|
||||
void CDbMappingComponent::removeDbModelsFromView()
|
||||
{
|
||||
const QStringList modelStrings(sGui->getWebDataServices()->getModelStrings());
|
||||
if (modelStrings.isEmpty()) { return; }
|
||||
@@ -413,19 +413,19 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_showChangedAttributes()
|
||||
void CDbMappingComponent::showChangedAttributes()
|
||||
{
|
||||
if (!this->hasStashedModels()) { return; }
|
||||
if (this->currentTabIndex() != TabStash) { return; }
|
||||
ui->comp_StashAircraft->showChangedAttributes();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_toggleAutoFiltering()
|
||||
void CDbMappingComponent::toggleAutoFiltering()
|
||||
{
|
||||
m_autoFilterInDbViews = !m_autoFilterInDbViews;
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_applyFormLiveryData()
|
||||
void CDbMappingComponent::applyFormLiveryData()
|
||||
{
|
||||
if (ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||
const CStatusMessageList msgs = ui->editor_AircraftModel->validateLivery(true);
|
||||
@@ -439,7 +439,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_applyFormAircraftIcaoData()
|
||||
void CDbMappingComponent::applyFormAircraftIcaoData()
|
||||
{
|
||||
if (ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||
const CStatusMessageList msgs = ui->editor_AircraftModel->validateAircraftIcao(true);
|
||||
@@ -453,7 +453,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_applyFormDistributorData()
|
||||
void CDbMappingComponent::applyFormDistributorData()
|
||||
{
|
||||
if (ui->comp_StashAircraft->view()->selectedRowCount() < 1) { return; }
|
||||
const CStatusMessageList msgs = ui->editor_AircraftModel->validateDistributor(true);
|
||||
@@ -567,12 +567,12 @@ namespace BlackGui
|
||||
this->ps_onVPilotCacheChanged();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onStashedModelsChanged()
|
||||
void CDbMappingComponent::onStashedModelsChanged()
|
||||
{
|
||||
emit this->ps_digestStashedModelsChanged();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onStashedModelsChangedDigest()
|
||||
void CDbMappingComponent::onStashedModelsChangedDigest()
|
||||
{
|
||||
const bool highlightVPilot = ui->tvp_AircraftModelsForVPilot->derivedModel()->highlightModelStrings();
|
||||
const bool highlightOwnModels = ui->comp_OwnAircraftModels->view()->derivedModel()->highlightModelStrings();
|
||||
@@ -594,7 +594,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_tabIndexChanged(int index)
|
||||
void CDbMappingComponent::onTabIndexChanged(int index)
|
||||
{
|
||||
const CDbMappingComponent::TabIndex ti = static_cast<CDbMappingComponent::TabIndex>(index);
|
||||
switch (ti)
|
||||
@@ -628,7 +628,7 @@ namespace BlackGui
|
||||
emit this->tabIndexChanged(index);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onModelsSuccessfullyPublished(const CAircraftModelList &models, bool directWrite)
|
||||
void CDbMappingComponent::onModelsSuccessfullyPublished(const CAircraftModelList &models, bool directWrite)
|
||||
{
|
||||
if (models.isEmpty()) { return; }
|
||||
if (!directWrite) { return; } // no models wwritten, but CRs
|
||||
@@ -646,7 +646,7 @@ namespace BlackGui
|
||||
ui->tw_ModelsToBeMapped->setTabText(i, o);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onOwnModelsChanged(int count, bool withFilter)
|
||||
void CDbMappingComponent::onOwnModelsChanged(int count, bool withFilter)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
Q_UNUSED(withFilter);
|
||||
@@ -699,7 +699,7 @@ namespace BlackGui
|
||||
ui->comp_OwnAircraftModels->updateViewAndCache(allModels);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onCustomContextMenu(const QPoint &point)
|
||||
void CDbMappingComponent::onCustomContextMenu(const QPoint &point)
|
||||
{
|
||||
QPoint globalPos = this->mapToGlobal(point);
|
||||
QScopedPointer<QMenu> contextMenu(new QMenu(this));
|
||||
@@ -710,7 +710,7 @@ namespace BlackGui
|
||||
Q_UNUSED(selectedItem);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onStashedModelsDataChanged(int count, bool withFilter)
|
||||
void CDbMappingComponent::onStashedModelsDataChanged(int count, bool withFilter)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
Q_UNUSED(withFilter);
|
||||
@@ -724,7 +724,7 @@ namespace BlackGui
|
||||
this->updateEditorsWhenApplicable();
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onModelSetChanged(int count, bool withFilter)
|
||||
void CDbMappingComponent::onModelSetChanged(int count, bool withFilter)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
Q_UNUSED(withFilter);
|
||||
@@ -735,7 +735,7 @@ namespace BlackGui
|
||||
ui->tw_ModelsToBeMapped->setTabText(i, o);
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_userChanged()
|
||||
void CDbMappingComponent::onUserChanged()
|
||||
{
|
||||
this->initVPilotLoading();
|
||||
}
|
||||
@@ -753,7 +753,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::ps_onModelRowSelected(const QModelIndex &index)
|
||||
void CDbMappingComponent::onModelRowSelected(const QModelIndex &index)
|
||||
{
|
||||
CAircraftModel model(this->getModelFromView(index)); // data from view
|
||||
if (!model.hasModelString()) { return; }
|
||||
@@ -923,12 +923,12 @@ namespace BlackGui
|
||||
menuActions.addMenuStash();
|
||||
|
||||
// auto filter in DB views
|
||||
m_stashFiltering = menuActions.addAction(m_stashFiltering, CIcons::filter16(), "Auto filtering in DB views (on/off)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_toggleAutoFiltering });
|
||||
m_stashFiltering = menuActions.addAction(m_stashFiltering, CIcons::filter16(), "Auto filtering in DB views (on/off)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::toggleAutoFiltering });
|
||||
m_stashFiltering->setCheckable(true);
|
||||
m_stashFiltering->setChecked(mapComp->m_autoFilterInDbViews);
|
||||
|
||||
m_autoStashing = menuActions.addAction(m_autoStashing, CIcons::appDbStash16(), "Auto stashing", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoStashingDialog });
|
||||
m_autoSimulatorStashing = menuActions.addAction(m_autoSimulatorStashing, CIcons::appDbStash16(), "Cross simulator updating (FSX-P3D-FS9)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoSimulatorStashingDialog });
|
||||
m_autoStashing = menuActions.addAction(m_autoStashing, CIcons::appDbStash16(), "Auto stashing", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::displayAutoStashingDialog });
|
||||
m_autoSimulatorStashing = menuActions.addAction(m_autoSimulatorStashing, CIcons::appDbStash16(), "Cross simulator updating (FSX-P3D-FS9)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::displayAutoSimulatorStashingDialog });
|
||||
if (mapComp->m_autoStashDialog && mapComp->m_autoStashDialog->isCompleted())
|
||||
{
|
||||
menuActions.addAction(CIcons::appDbStash16(), "Last auto stash run", CMenuAction::pathStash(), nullptr, { mapComp->m_autoStashDialog.data(), &CDbAutoStashingComponent::showLastResults });
|
||||
@@ -953,10 +953,10 @@ namespace BlackGui
|
||||
|
||||
// we have keys and data by which we could delete them from view
|
||||
const QString msgDelete("Delete " + QString::number(dbModels) + " DB model(s) from '" + mapComp->currentTabText() + "'");
|
||||
menuActions.addAction(CIcons::delete16(), msgDelete, CMenuAction::pathStash(), nullptr, { mapComp, &CDbMappingComponent::ps_removeDbModelsFromView});
|
||||
menuActions.addAction(CIcons::delete16(), msgDelete, CMenuAction::pathStash(), nullptr, { mapComp, &CDbMappingComponent::removeDbModelsFromView});
|
||||
|
||||
// attribute info
|
||||
menuActions.addAction(CIcons::info16(), "Show changed attributes", CMenuAction::pathStash(), nullptr, { mapComp, &CDbMappingComponent::ps_showChangedAttributes});
|
||||
menuActions.addAction(CIcons::info16(), "Show changed attributes", CMenuAction::pathStash(), nullptr, { mapComp, &CDbMappingComponent::showChangedAttributes});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -997,9 +997,9 @@ namespace BlackGui
|
||||
// stash view and selection
|
||||
menuActions.addMenuStashEditor();
|
||||
|
||||
m_menuActions[0] = menuActions.addAction(m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormAircraftIcaoData });
|
||||
m_menuActions[1] = menuActions.addAction(m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormDistributorData });
|
||||
m_menuActions[2] = menuActions.addAction(m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormLiveryData });
|
||||
m_menuActions[0] = menuActions.addAction(m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::applyFormAircraftIcaoData });
|
||||
m_menuActions[1] = menuActions.addAction(m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::applyFormDistributorData });
|
||||
m_menuActions[2] = menuActions.addAction(m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::applyFormLiveryData });
|
||||
m_menuActions[3] = menuActions.addAction(m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::modifyModelDialog });
|
||||
}
|
||||
this->nestedCustomMenu(menuActions);
|
||||
|
||||
@@ -225,9 +225,6 @@ namespace BlackGui
|
||||
void ps_digestStashedModelsChanged();
|
||||
|
||||
private slots:
|
||||
//! Tab index changed
|
||||
void ps_tabIndexChanged(int index);
|
||||
|
||||
//! Load the vPilot rules
|
||||
void ps_loadVPilotData();
|
||||
|
||||
@@ -243,71 +240,75 @@ namespace BlackGui
|
||||
//! Request update of vPilot data
|
||||
void ps_requestVPilotDataUpdate();
|
||||
|
||||
//! Stashed models changed
|
||||
void ps_onStashedModelsChanged();
|
||||
|
||||
//! Stashed models changed
|
||||
void ps_onStashedModelsChangedDigest();
|
||||
|
||||
//! Stash has been changed
|
||||
void ps_onStashedModelsDataChanged(int count, bool withFilter);
|
||||
|
||||
//! Models have been published successfully
|
||||
void ps_onModelsSuccessfullyPublished(const BlackMisc::Simulation::CAircraftModelList &models, bool directWrite);
|
||||
|
||||
//! Stash drop request
|
||||
void ps_handleStashDropRequest(const BlackMisc::Aviation::CAirlineIcaoCode &code) const;
|
||||
|
||||
//! Model set has been changed
|
||||
void ps_onModelSetChanged(int count, bool withFilter);
|
||||
|
||||
//! Own models have been changed
|
||||
void ps_onOwnModelsChanged(int count, bool withFilter);
|
||||
|
||||
//! Row has been selected
|
||||
void ps_onModelRowSelected(const QModelIndex &index);
|
||||
|
||||
//! User object changed
|
||||
void ps_userChanged();
|
||||
|
||||
//! Stash current model
|
||||
void ps_stashCurrentModel();
|
||||
|
||||
//! Display auto stashing dialog
|
||||
void ps_displayAutoStashingDialog();
|
||||
|
||||
//! Display auto simulator stashing dialog
|
||||
void ps_displayAutoSimulatorStashingDialog();
|
||||
|
||||
//! Remove DB models from current view
|
||||
void ps_removeDbModelsFromView();
|
||||
|
||||
//! Show changed attributes of stashed
|
||||
void ps_showChangedAttributes();
|
||||
|
||||
//! Toggle auto filtering
|
||||
void ps_toggleAutoFiltering();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void ps_applyFormLiveryData();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void ps_applyFormAircraftIcaoData();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void ps_applyFormDistributorData();
|
||||
|
||||
//! Add to own model set
|
||||
void ps_addToOwnModelSet();
|
||||
|
||||
//! Merge with vPilot models
|
||||
void ps_mergeWithVPilotModels();
|
||||
|
||||
//! Merge selected with vPilot models
|
||||
void ps_mergeSelectedWithVPilotModels();
|
||||
|
||||
//! Add to own model set
|
||||
void ps_addToOwnModelSet();
|
||||
|
||||
private:
|
||||
//! Tab index changed
|
||||
void onTabIndexChanged(int index);
|
||||
|
||||
//! Stashed models changed
|
||||
void onStashedModelsChanged();
|
||||
|
||||
//! Stashed models changed
|
||||
void onStashedModelsChangedDigest();
|
||||
|
||||
//! Stash has been changed
|
||||
void onStashedModelsDataChanged(int count, bool withFilter);
|
||||
|
||||
//! Models have been published successfully
|
||||
void onModelsSuccessfullyPublished(const BlackMisc::Simulation::CAircraftModelList &models, bool directWrite);
|
||||
|
||||
//! Stash drop request
|
||||
void handleStashDropRequest(const BlackMisc::Aviation::CAirlineIcaoCode &code) const;
|
||||
|
||||
//! Model set has been changed
|
||||
void onModelSetChanged(int count, bool withFilter);
|
||||
|
||||
//! Own models have been changed
|
||||
void onOwnModelsChanged(int count, bool withFilter);
|
||||
|
||||
//! Row has been selected
|
||||
void onModelRowSelected(const QModelIndex &index);
|
||||
|
||||
//! User object changed
|
||||
void onUserChanged();
|
||||
|
||||
//! Stash current model
|
||||
void stashCurrentModel();
|
||||
|
||||
//! Display auto stashing dialog
|
||||
void displayAutoStashingDialog();
|
||||
|
||||
//! Display auto simulator stashing dialog
|
||||
void displayAutoSimulatorStashingDialog();
|
||||
|
||||
//! Remove DB models from current view
|
||||
void removeDbModelsFromView();
|
||||
|
||||
//! Show changed attributes of stashed
|
||||
void showChangedAttributes();
|
||||
|
||||
//! Toggle auto filtering
|
||||
void toggleAutoFiltering();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void applyFormLiveryData();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void applyFormAircraftIcaoData();
|
||||
|
||||
//! Apply current DB data from form
|
||||
void applyFormDistributorData();
|
||||
|
||||
//! Custom menu
|
||||
void ps_onCustomContextMenu(const QPoint &point);
|
||||
void onCustomContextMenu(const QPoint &point);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbMappingComponent> ui;
|
||||
@@ -315,8 +316,8 @@ namespace BlackGui
|
||||
QScopedPointer<CDbAutoSimulatorStashingComponent> m_autoSimulatorDialog; //!< dialog auto simulator update
|
||||
QScopedPointer<CDbModelMappingModifyComponent> m_modelModifyDialog; //!< dialog when modifying models
|
||||
BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader; //!< read vPilot rules
|
||||
BlackMisc::CDigestSignal m_dsStashedModelsChanged { this, &CDbMappingComponent::ps_digestStashedModelsChanged, &CDbMappingComponent::ps_onStashedModelsChangedDigest, 750, 25 };
|
||||
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this, &CDbMappingComponent::ps_userChanged };
|
||||
BlackMisc::CDigestSignal m_dsStashedModelsChanged { this, &CDbMappingComponent::ps_digestStashedModelsChanged, &CDbMappingComponent::onStashedModelsChangedDigest, 750, 25 };
|
||||
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this, &CDbMappingComponent::onUserChanged };
|
||||
const bool vPilotSupport = true; //!< vPilot support (will be removed in future)
|
||||
bool m_vPilot1stInit = true; //!< vPilot extensions initalized?
|
||||
bool m_vPilotEnabled = false; //!< use vPilot extensions
|
||||
|
||||
@@ -45,18 +45,18 @@ namespace BlackGui
|
||||
ui->editor_AircraftModel->allowDrop(false);
|
||||
ui->editor_AircraftModel->setReadOnly(true);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this, &CDbQuickMappingWizard::ps_webDataRead);
|
||||
connect(sGui->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbQuickMappingWizard::ps_publishedModels);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this, &CDbQuickMappingWizard::onWebDataRead, Qt::QueuedConnection);
|
||||
connect(sGui->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbQuickMappingWizard::onPublishedModels, Qt::QueuedConnection);
|
||||
|
||||
connect(this, &CDbQuickMappingWizard::currentIdChanged, this, &CDbQuickMappingWizard::ps_currentWizardPageChanged);
|
||||
connect(ui->selector_AircraftIcaoCode, &CDbAircraftIcaoSelectorComponent::changedAircraftIcao, this, &CDbQuickMappingWizard::ps_aircraftSelected);
|
||||
connect(ui->selector_AirlineIcaoCode, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::ps_airlineSelected);
|
||||
connect(ui->selector_AirlineName, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::ps_airlineSelected);
|
||||
connect(this, &CDbQuickMappingWizard::currentIdChanged, this, &CDbQuickMappingWizard::currentWizardPageChanged);
|
||||
connect(ui->selector_AircraftIcaoCode, &CDbAircraftIcaoSelectorComponent::changedAircraftIcao, this, &CDbQuickMappingWizard::onAircraftSelected);
|
||||
connect(ui->selector_AirlineIcaoCode, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::onAirlineSelected);
|
||||
connect(ui->selector_AirlineName, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::onAirlineSelected);
|
||||
|
||||
ui->comp_Log->showFilterDialog(); // filter for log normally not needed, so dialog (not bar)
|
||||
|
||||
// init if data already available
|
||||
this->ps_webDataRead();
|
||||
this->onWebDataRead();
|
||||
|
||||
// \fixme setting per stylesheet does NOT work, this hardcoded stuff should be removed
|
||||
const QString style("background-image: url(:/textures/icons/textures/texture-inner.jpg)");
|
||||
@@ -176,12 +176,12 @@ namespace BlackGui
|
||||
return ui->comp_Distributor->view()->firstSelectedOrDefaultObject();
|
||||
}
|
||||
|
||||
void CDbQuickMappingWizard::ps_webDataRead()
|
||||
void CDbQuickMappingWizard::onWebDataRead()
|
||||
{
|
||||
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
||||
}
|
||||
|
||||
void CDbQuickMappingWizard::ps_publishedModels(const CAircraftModelList &modelsPublished, const CAircraftModelList &modelsSkipped, const CStatusMessageList &messages, bool requestSuccessful, bool directWrite)
|
||||
void CDbQuickMappingWizard::onPublishedModels(const CAircraftModelList &modelsPublished, const CAircraftModelList &modelsSkipped, const CStatusMessageList &messages, bool requestSuccessful, bool directWrite)
|
||||
{
|
||||
Q_UNUSED(modelsPublished);
|
||||
Q_UNUSED(modelsSkipped);
|
||||
@@ -199,7 +199,7 @@ namespace BlackGui
|
||||
ui->comp_Log->appendStatusMessagesToList(msgs);
|
||||
}
|
||||
|
||||
void CDbQuickMappingWizard::ps_currentWizardPageChanged(int id)
|
||||
void CDbQuickMappingWizard::currentWizardPageChanged(int id)
|
||||
{
|
||||
const bool forward = id > this->m_lastId;
|
||||
const bool colorMode = ui->rb_ColorLivery->isChecked();
|
||||
@@ -315,7 +315,7 @@ namespace BlackGui
|
||||
ui->comp_Log->appendStatusMessagesToList(msgs);
|
||||
}
|
||||
|
||||
void CDbQuickMappingWizard::ps_airlineSelected(const CAirlineIcaoCode &icao)
|
||||
void CDbQuickMappingWizard::onAirlineSelected(const CAirlineIcaoCode &icao)
|
||||
{
|
||||
if (icao.isLoadedFromDb())
|
||||
{
|
||||
@@ -329,7 +329,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbQuickMappingWizard::ps_aircraftSelected(const CAircraftIcaoCode &icao)
|
||||
void CDbQuickMappingWizard::onAircraftSelected(const CAircraftIcaoCode &icao)
|
||||
{
|
||||
if (icao.isLoadedFromDb())
|
||||
{
|
||||
|
||||
@@ -100,24 +100,23 @@ namespace BlackGui
|
||||
//! Write the model to DB
|
||||
void writeModelToDb();
|
||||
|
||||
private slots:
|
||||
//! Web data have been read
|
||||
void ps_webDataRead();
|
||||
|
||||
//! Models published
|
||||
void ps_publishedModels(const BlackMisc::Simulation::CAircraftModelList &modelsPublished,
|
||||
void onPublishedModels(const BlackMisc::Simulation::CAircraftModelList &modelsPublished,
|
||||
const BlackMisc::Simulation::CAircraftModelList &modelsSkipped,
|
||||
const BlackMisc::CStatusMessageList &messages,
|
||||
bool requestSuccessful, bool directWrite);
|
||||
|
||||
//! Web data have been read
|
||||
void onWebDataRead();
|
||||
|
||||
//! Current page has been changed
|
||||
void ps_currentWizardPageChanged(int id);
|
||||
void currentWizardPageChanged(int id);
|
||||
|
||||
//! Airline selected
|
||||
void ps_airlineSelected(const BlackMisc::Aviation::CAirlineIcaoCode &icao);
|
||||
void onAirlineSelected(const BlackMisc::Aviation::CAirlineIcaoCode &icao);
|
||||
|
||||
//! Aircraft selected
|
||||
void ps_aircraftSelected(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
void onAircraftSelected(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -61,27 +61,27 @@ namespace BlackGui
|
||||
ui->tvp_StashAircraftModels->setAcceptedMetaTypeIds();
|
||||
ui->tvp_StashAircraftModels->menuAddItems(CAircraftModelView::MenuLoadAndSave);
|
||||
|
||||
connect(ui->pb_Unstash, &QPushButton::pressed, this, &CDbStashComponent::ps_onUnstashPressed);
|
||||
connect(ui->pb_Validate, &QPushButton::pressed, this, &CDbStashComponent::ps_onValidatePressed);
|
||||
connect(ui->pb_RemoveInvalid, &QPushButton::pressed, this, &CDbStashComponent::ps_onRemoveInvalidPressed);
|
||||
connect(ui->pb_Publish, &QPushButton::pressed, this, &CDbStashComponent::ps_onPublishPressed);
|
||||
connect(ui->pb_Unstash, &QPushButton::pressed, this, &CDbStashComponent::onUnstashPressed);
|
||||
connect(ui->pb_Validate, &QPushButton::pressed, this, &CDbStashComponent::onValidatePressed);
|
||||
connect(ui->pb_RemoveInvalid, &QPushButton::pressed, this, &CDbStashComponent::onRemoveInvalidPressed);
|
||||
connect(ui->pb_Publish, &QPushButton::pressed, this, &CDbStashComponent::onPublishPressed);
|
||||
connect(ui->tvp_StashAircraftModels, &CAircraftModelView::modelChanged, this, &CDbStashComponent::stashedModelsChanged);
|
||||
connect(ui->tvp_StashAircraftModels, &CAircraftModelView::modelDataChanged, this, &CDbStashComponent::ps_onRowCountChanged);
|
||||
connect(ui->tvp_StashAircraftModels, &CAircraftModelView::modelDataChanged, this, &CDbStashComponent::onRowCountChanged);
|
||||
|
||||
// copy over buttons
|
||||
connect(ui->pb_AircraftIcao, &QPushButton::pressed, this, &CDbStashComponent::ps_copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_AirlineIcao, &QPushButton::pressed, this, &CDbStashComponent::ps_copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Livery, &QPushButton::pressed, this, &CDbStashComponent::ps_copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Distributor, &QPushButton::pressed, this, &CDbStashComponent::ps_copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Model, &QPushButton::pressed, this, &CDbStashComponent::ps_modifyModelDialog);
|
||||
connect(ui->pb_AircraftIcao, &QPushButton::pressed, this, &CDbStashComponent::copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_AirlineIcao, &QPushButton::pressed, this, &CDbStashComponent::copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Livery, &QPushButton::pressed, this, &CDbStashComponent::copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Distributor, &QPushButton::pressed, this, &CDbStashComponent::copyOverValuesToSelectedModels);
|
||||
connect(ui->pb_Model, &QPushButton::pressed, this, &CDbStashComponent::modifyModelDialog);
|
||||
|
||||
ui->tvp_StashAircraftModels->menuAddItems(CAircraftModelView::MenuRemoveSelectedRows);
|
||||
ui->tvp_StashAircraftModels->setHighlightModelStrings(true);
|
||||
ui->tvp_StashAircraftModels->setHighlightModelStringsColor(Qt::red);
|
||||
this->enableButtonRow();
|
||||
|
||||
connect(sApp->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbStashComponent::ps_publishedModelsResponse);
|
||||
this->ps_userChanged();
|
||||
connect(sApp->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbStashComponent::onPublishedModelsResponse, Qt::QueuedConnection);
|
||||
this->onUserChanged();
|
||||
}
|
||||
|
||||
CDbStashComponent::~CDbStashComponent()
|
||||
@@ -243,12 +243,12 @@ namespace BlackGui
|
||||
ui->tvp_StashAircraftModels->applyToSelected(vm);
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_onUnstashPressed()
|
||||
void CDbStashComponent::onUnstashPressed()
|
||||
{
|
||||
ui->tvp_StashAircraftModels->removeSelectedRows();
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_onValidatePressed()
|
||||
void CDbStashComponent::onValidatePressed()
|
||||
{
|
||||
if (ui->tvp_StashAircraftModels->isEmpty()) {return; }
|
||||
CAircraftModelList validModels;
|
||||
@@ -256,7 +256,7 @@ namespace BlackGui
|
||||
this->validateAndDisplay(validModels, invalidModels, true);
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_onRemoveInvalidPressed()
|
||||
void CDbStashComponent::onRemoveInvalidPressed()
|
||||
{
|
||||
if (ui->tvp_StashAircraftModels->isEmpty()) {return; }
|
||||
CAircraftModelList validModels;
|
||||
@@ -265,7 +265,7 @@ namespace BlackGui
|
||||
this->unstashModels(invalidModels);
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_onPublishPressed()
|
||||
void CDbStashComponent::onPublishPressed()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (ui->tvp_StashAircraftModels->isEmpty()) { return; }
|
||||
@@ -296,7 +296,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_publishedModelsResponse(const CAircraftModelList &publishedModels, const CAircraftModelList &skippedModels, const CStatusMessageList &msgs, bool sendingSuccesful, bool directWrite)
|
||||
void CDbStashComponent::onPublishedModelsResponse(const CAircraftModelList &publishedModels, const CAircraftModelList &skippedModels, const CStatusMessageList &msgs, bool sendingSuccesful, bool directWrite)
|
||||
{
|
||||
Q_UNUSED(skippedModels);
|
||||
ui->tvp_StashAircraftModels->hideLoadIndicator();
|
||||
@@ -313,10 +313,12 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
QPointer<CDbStashComponent> myself(this);
|
||||
const QString confirm("Remove %1 published models from stash?");
|
||||
auto lambda = [this, publishedModels]()
|
||||
auto lambda = [ = ]()
|
||||
{
|
||||
this->unstashModels(publishedModels.getModelStringList(false));
|
||||
if (!myself) { return; }
|
||||
myself->unstashModels(publishedModels.getModelStringList(false));
|
||||
};
|
||||
this->showOverlayMessagesWithConfirmation(msgs, false, confirm.arg(publishedModels.size()), lambda, QMessageBox::Ok);
|
||||
}
|
||||
@@ -379,7 +381,7 @@ namespace BlackGui
|
||||
ui->pb_Validate->setEnabled(e);
|
||||
ui->pb_RemoveInvalid->setEnabled(e);
|
||||
ui->pb_Model->setEnabled(e);
|
||||
this->ps_userChanged();
|
||||
this->onUserChanged();
|
||||
}
|
||||
|
||||
const CLogCategoryList &CDbStashComponent::validationCategories() const
|
||||
@@ -463,7 +465,7 @@ namespace BlackGui
|
||||
ui->tvp_StashAircraftModels->clearHighlighting();
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_copyOverValuesToSelectedModels()
|
||||
void CDbStashComponent::copyOverValuesToSelectedModels()
|
||||
{
|
||||
const QObject *sender = QObject::sender();
|
||||
BLACK_VERIFY_X(this->getMappingComponent(), Q_FUNC_INFO, "Missing mapping component");
|
||||
@@ -489,7 +491,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_modifyModelDialog()
|
||||
void CDbStashComponent::modifyModelDialog()
|
||||
{
|
||||
if (this->getMappingComponent())
|
||||
{
|
||||
@@ -497,14 +499,14 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_onRowCountChanged(int number, bool filter)
|
||||
void CDbStashComponent::onRowCountChanged(int number, bool filter)
|
||||
{
|
||||
Q_UNUSED(number);
|
||||
Q_UNUSED(filter);
|
||||
this->enableButtonRow();
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_userChanged()
|
||||
void CDbStashComponent::onUserChanged()
|
||||
{
|
||||
const CAuthenticatedUser user(this->getSwiftDbUser());
|
||||
if (!user.isAuthenticated())
|
||||
|
||||
@@ -144,39 +144,38 @@ namespace BlackGui
|
||||
//! Models succesfully published
|
||||
void modelsSuccessfullyPublished(const BlackMisc::Simulation::CAircraftModelList &publishedModels, bool directWrite);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
QScopedPointer<Ui::CDbStashComponent> ui;
|
||||
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CDbStashComponent::onUserChanged}; //!< authenticated user
|
||||
|
||||
//! Unstash pressed
|
||||
void ps_onUnstashPressed();
|
||||
void onUnstashPressed();
|
||||
|
||||
//! Validate pressed
|
||||
void ps_onValidatePressed();
|
||||
void onValidatePressed();
|
||||
|
||||
//! Remove invalid (validates and removes invalid models)
|
||||
void ps_onRemoveInvalidPressed();
|
||||
void onRemoveInvalidPressed();
|
||||
|
||||
//! Publish pressed
|
||||
void ps_onPublishPressed();
|
||||
void onPublishPressed();
|
||||
|
||||
//! Publish response received
|
||||
void ps_publishedModelsResponse(const BlackMisc::Simulation::CAircraftModelList &publishedModels,
|
||||
void onPublishedModelsResponse(const BlackMisc::Simulation::CAircraftModelList &publishedModels,
|
||||
const BlackMisc::Simulation::CAircraftModelList &skippedModels,
|
||||
const BlackMisc::CStatusMessageList &msgs, bool sendingSuccesful, bool directWrite);
|
||||
|
||||
//! Copy over values
|
||||
void ps_copyOverValuesToSelectedModels();
|
||||
void copyOverValuesToSelectedModels();
|
||||
|
||||
//! Display model dialog
|
||||
void ps_modifyModelDialog();
|
||||
void modifyModelDialog();
|
||||
|
||||
//! Row count changed
|
||||
void ps_onRowCountChanged(int number, bool filter);
|
||||
void onRowCountChanged(int number, bool filter);
|
||||
|
||||
//! User has been changed
|
||||
void ps_userChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbStashComponent> ui;
|
||||
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CDbStashComponent::ps_userChanged}; //!< authenticated user
|
||||
void onUserChanged();
|
||||
|
||||
//! Display messages
|
||||
bool showOverlayMessages(const BlackMisc::CStatusMessageList &msgs, bool onlyErrors = false, bool appendOldMessages = false, int timeoutMs = -1);
|
||||
|
||||
Reference in New Issue
Block a user