mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Validation dialog allows to directly removed from model set
There is some moderate riks involved here, as this allows to change the model set in the client, but many users have asked for this
This commit is contained in:
committed by
Mat Sutcliffe
parent
2e96caef5c
commit
9bd2d294a3
@@ -6,8 +6,8 @@
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "aircraftmodelvalidationcomponent.h"
|
||||
#include "ui_aircraftmodelvalidationcomponent.h"
|
||||
#include "aircraftmodelvalidationcomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
|
||||
@@ -38,10 +38,13 @@ namespace BlackGui
|
||||
connect(ui->cb_EnableStartupCheck, &QCheckBox::toggled, this, &CAircraftModelValidationComponent::onCheckAtStartupChanged);
|
||||
connect(ui->cb_OnlyIfErrorsOrWarnings, &QCheckBox::toggled, this, &CAircraftModelValidationComponent::onOnlyErrorWarningChanged);
|
||||
|
||||
connect(ui->pb_TempDisableInvalid, &QPushButton::released, this, &CAircraftModelValidationComponent::onButtonClicked);
|
||||
connect(ui->pb_TempDisableSelected, &QPushButton::released, this, &CAircraftModelValidationComponent::onButtonClicked);
|
||||
connect(ui->pb_TriggerValidation, &QPushButton::released, this, &CAircraftModelValidationComponent::triggerValidation);
|
||||
connect(ui->pb_help, &QPushButton::released, this, &CAircraftModelValidationComponent::showHelp);
|
||||
connect(ui->pb_TempDisableInvalid, &QPushButton::released, this, &CAircraftModelValidationComponent::onTempDisabledButtonClicked, Qt::QueuedConnection);
|
||||
connect(ui->pb_TempDisableSelected, &QPushButton::released, this, &CAircraftModelValidationComponent::onTempDisabledButtonClicked, Qt::QueuedConnection);
|
||||
connect(ui->pb_RemoveInvalid, &QPushButton::released, this, &CAircraftModelValidationComponent::onRemoveButtonClicked, Qt::QueuedConnection);
|
||||
connect(ui->pb_RemoveSelected, &QPushButton::released, this, &CAircraftModelValidationComponent::onRemoveButtonClicked, Qt::QueuedConnection);
|
||||
|
||||
connect(ui->pb_TriggerValidation, &QPushButton::released, this, &CAircraftModelValidationComponent::triggerValidation, Qt::QueuedConnection);
|
||||
connect(ui->pb_Help, &QPushButton::released, this, &CAircraftModelValidationComponent::showHelp, Qt::QueuedConnection);
|
||||
|
||||
// 1st init when running in distributed environment
|
||||
QPointer<CAircraftModelValidationComponent> myself(this);
|
||||
@@ -85,6 +88,8 @@ namespace BlackGui
|
||||
ui->cb_EnableStartupCheck->setChecked(setup.doVerificationAtStartup());
|
||||
ui->pb_TempDisableInvalid->setEnabled(!invalid.isEmpty());
|
||||
ui->pb_TempDisableSelected->setEnabled(!invalid.isEmpty());
|
||||
ui->pb_RemoveInvalid->setEnabled(!invalid.isEmpty());
|
||||
ui->pb_RemoveSelected->setEnabled(!invalid.isEmpty());
|
||||
|
||||
const QString msg = stopped ?
|
||||
QStringLiteral("Validation for '%1' stopped, maybe your models are not accessible or too many issues").arg(simulator.toQString(true)) :
|
||||
@@ -164,22 +169,50 @@ namespace BlackGui
|
||||
sGui->getIContextSimulator()->triggerModelSetValidation(CSimulatorInfo());
|
||||
}
|
||||
|
||||
void CAircraftModelValidationComponent::onButtonClicked()
|
||||
void CAircraftModelValidationComponent::onTempDisabledButtonClicked()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
|
||||
CAircraftModelList disableModels;
|
||||
const QObject *sender = QObject::sender();
|
||||
CAircraftModelList disabledModels;
|
||||
if (sender == ui->pb_TempDisableInvalid) { disabledModels = ui->tvp_InvalidModels->container(); }
|
||||
else if (sender == ui->pb_TempDisableSelected) { disabledModels = ui->tvp_InvalidModels->selectedObjects(); }
|
||||
if (sender == ui->pb_TempDisableInvalid) { disableModels = ui->tvp_InvalidModels->container(); }
|
||||
else if (sender == ui->pb_TempDisableSelected) { disableModels = ui->tvp_InvalidModels->selectedObjects(); }
|
||||
|
||||
this->tempDisableModels(disabledModels);
|
||||
|
||||
if (disabledModels.isEmpty())
|
||||
if (disableModels.isEmpty())
|
||||
{
|
||||
this->showOverlayHTMLMessage("No models disabled");
|
||||
this->showOverlayHTMLMessage("No models disabled", 4000);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayHTMLMessage(QStringLiteral("%1 models disabled").arg(disabledModels.size()));
|
||||
this->tempDisableModels(disableModels);
|
||||
this->showOverlayHTMLMessage(QStringLiteral("%1 models disabled").arg(disableModels.size()));
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftModelValidationComponent::onRemoveButtonClicked()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
if (!sGui->getIContextSimulator()) { return; }
|
||||
|
||||
CAircraftModelList removeModels;
|
||||
const QObject *sender = QObject::sender();
|
||||
if (sender == ui->pb_RemoveInvalid) { removeModels = ui->tvp_InvalidModels->container(); }
|
||||
else if (sender == ui->pb_RemoveSelected) { removeModels = ui->tvp_InvalidModels->selectedObjects(); }
|
||||
|
||||
if (removeModels.isEmpty())
|
||||
{
|
||||
this->showOverlayHTMLMessage("No models removed", 4000);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QMessageBox::StandardButton ret = QMessageBox::question(this,
|
||||
tr("Model validation"),
|
||||
tr("Do you really want to delete %1 models from model set?").arg(removeModels.sizeInt()),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (ret != QMessageBox::Ok) { return; }
|
||||
|
||||
const int r = sGui->getIContextSimulator()->removeModelsFromSet(removeModels);
|
||||
this->showOverlayHTMLMessage(QStringLiteral("%1 models removed").arg(r));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace BlackGui
|
||||
void requestLastResults();
|
||||
|
||||
//! Button has been clicked
|
||||
void onButtonClicked();
|
||||
void onTempDisabledButtonClicked();
|
||||
|
||||
//! Remove from model set
|
||||
void onRemoveButtonClicked();
|
||||
|
||||
//! Show help
|
||||
void showHelp();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Model validation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelValidation" stretch="0,1,0">
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelValidation" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Summay">
|
||||
<property name="text">
|
||||
@@ -26,6 +26,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tw_CAircraftModelValidationComponent">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tb_InvalidModels">
|
||||
<attribute name="title">
|
||||
<string>Invalid models</string>
|
||||
@@ -41,6 +44,127 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QGridLayout" name="gl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_Simulator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_RemoveInvalid">
|
||||
<property name="text">
|
||||
<string>remove invalid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_TriggerValidation">
|
||||
<property name="text">
|
||||
<string>trigger validation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QWidget" name="wi_Enable" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Enable">
|
||||
<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="QCheckBox" name="cb_EnableStartupCheck">
|
||||
<property name="text">
|
||||
<string>check at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_OnlyIfErrorsOrWarnings">
|
||||
<property name="text">
|
||||
<string>only if errors/warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_Enable">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="pb_RemoveSelected">
|
||||
<property name="text">
|
||||
<string>remove selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pb_TempDisableInvalid">
|
||||
<property name="text">
|
||||
<string>temp.disable invalid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pb_TempDisableSelected">
|
||||
<property name="text">
|
||||
<string>temp.disable selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_Help">
|
||||
<property name="text">
|
||||
<string>help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_Messages">
|
||||
@@ -62,70 +186,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="pb_TempDisableSelected">
|
||||
<property name="text">
|
||||
<string>temp.disable selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_Simulator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pb_TriggerValidation">
|
||||
<property name="text">
|
||||
<string>trigger validation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pb_TempDisableInvalid">
|
||||
<property name="text">
|
||||
<string>temp.disable invalid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_help">
|
||||
<property name="text">
|
||||
<string>help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QCheckBox" name="cb_EnableStartupCheck">
|
||||
<property name="text">
|
||||
<string>check at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QCheckBox" name="cb_OnlyIfErrorsOrWarnings">
|
||||
<property name="text">
|
||||
<string>only if errors/warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -150,12 +210,14 @@
|
||||
<tabstops>
|
||||
<tabstop>tw_CAircraftModelValidationComponent</tabstop>
|
||||
<tabstop>tvp_InvalidModels</tabstop>
|
||||
<tabstop>pb_help</tabstop>
|
||||
<tabstop>pb_Help</tabstop>
|
||||
<tabstop>pb_TriggerValidation</tabstop>
|
||||
<tabstop>pb_TempDisableInvalid</tabstop>
|
||||
<tabstop>pb_TempDisableSelected</tabstop>
|
||||
<tabstop>cb_EnableStartupCheck</tabstop>
|
||||
<tabstop>cb_OnlyIfErrorsOrWarnings</tabstop>
|
||||
<tabstop>pb_RemoveInvalid</tabstop>
|
||||
<tabstop>pb_RemoveSelected</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user