From 7ac04508368c42aeb01ea121112e83019c8c7f0b Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 7 May 2019 02:32:14 +0200 Subject: [PATCH] Setting to display validation only in case of warnings/errors --- src/blackgui/editors/matchingform.cpp | 13 ++++++++----- src/blackgui/editors/matchingform.ui | 11 ++++++++++- src/blackmisc/simulation/aircraftmatchersetup.cpp | 9 +++++++-- src/blackmisc/simulation/aircraftmatchersetup.h | 7 ++++++- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/blackgui/editors/matchingform.cpp b/src/blackgui/editors/matchingform.cpp index 4d9d68c5b..88201f39a 100644 --- a/src/blackgui/editors/matchingform.cpp +++ b/src/blackgui/editors/matchingform.cpp @@ -24,11 +24,11 @@ namespace BlackGui ui(new Ui::CMatchingForm) { ui->setupUi(this); - connect(ui->rb_Reduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); + connect(ui->rb_Reduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); connect(ui->rb_ScoreAndReduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); - connect(ui->rb_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); - connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection); - connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection); + connect(ui->rb_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); + connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection); + connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection); } CMatchingForm::~CMatchingForm() @@ -48,6 +48,7 @@ namespace BlackGui CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetRemoveFailed, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ModelFailedFailover, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetVerification, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetVerificationOnlyErrorWarning, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_CategoryGlider, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_CategoryMilitaryAircraft, readonly); @@ -89,6 +90,7 @@ namespace BlackGui ui->cb_ModelSetRemoveFailed->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelSetRemoveFailedModel) || mode.testFlag(CAircraftMatcherSetup::ModelFailoverIfNoModelCanBeAdded)); ui->cb_ModelFailedFailover->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelFailoverIfNoModelCanBeAdded)); ui->cb_ModelSetVerification->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelVerificationAtStartup)); + ui->cb_ModelSetVerificationOnlyErrorWarning->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelVerificationOnlyWarnError)); this->setMatchingAlgorithm(setup); this->setPickStrategy(setup); @@ -138,7 +140,8 @@ namespace BlackGui ui->cb_CategoryMilitaryAircraft->isChecked(), ui->cb_ScoreIgnoreZeros->isChecked(), ui->cb_ScorePreferColorLiveries->isChecked(), ui->cb_ExclNoDbData->isChecked(), ui->cb_ExclNoExcludedModels->isChecked(), - ui->cb_ModelSetVerification->isChecked(), ui->cb_ModelSetRemoveFailed->isChecked(), + ui->cb_ModelSetVerification->isChecked(), ui->cb_ModelSetVerificationOnlyErrorWarning->isChecked(), + ui->cb_ModelSetRemoveFailed->isChecked(), ui->cb_ModelFailedFailover->isChecked() ); } diff --git a/src/blackgui/editors/matchingform.ui b/src/blackgui/editors/matchingform.ui index 20c4965a0..af79352eb 100644 --- a/src/blackgui/editors/matchingform.ui +++ b/src/blackgui/editors/matchingform.ui @@ -247,6 +247,13 @@ + + + + dialog only if wanrings/error + + + @@ -305,7 +312,6 @@ - rb_Reduction rb_ScoreOnly rb_ScoreAndReduction pb_ResetAlgorithm @@ -324,12 +330,15 @@ cb_CategoryGlider cb_CategoryMilitaryAircraft cb_ModelSetVerification + cb_ModelSetVerificationOnlyErrorWarning cb_ModelSetRemoveFailed cb_ModelFailedFailover cb_ExclNoExcludedModels cb_ExclNoDbData cb_ScorePreferColorLiveries cb_ScoreIgnoreZeros + pb_ResetAll + rb_Reduction diff --git a/src/blackmisc/simulation/aircraftmatchersetup.cpp b/src/blackmisc/simulation/aircraftmatchersetup.cpp index 9e8d07e1e..500aae020 100644 --- a/src/blackmisc/simulation/aircraftmatchersetup.cpp +++ b/src/blackmisc/simulation/aircraftmatchersetup.cpp @@ -151,6 +151,7 @@ namespace BlackMisc static const QString exExcl("excl.excluded"); static const QString removeFromModelSet("rem.from model set"); static const QString verification("Verify models at startup"); + static const QString verificationWarn("Show only validation warnings/errors"); static const QString modelFailedAdded("Replace models failed to be added"); static const QString categoryGlider("glider categories"); static const QString categoryMilitary("military categories"); @@ -175,6 +176,7 @@ namespace BlackMisc case ExcludeNoExcluded: return exExcl; case ModelSetRemoveFailedModel: return removeFromModelSet; case ModelVerificationAtStartup: return verification; + case ModelVerificationOnlyWarnError: return verificationWarn; case ModelFailoverIfNoModelCanBeAdded: return modelFailedAdded; default: break; } @@ -202,6 +204,7 @@ namespace BlackMisc if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); } if (mode.testFlag(ModelSetRemoveFailedModel)) { modes << modeFlagToString(ModelSetRemoveFailedModel); } if (mode.testFlag(ModelVerificationAtStartup)) { modes << modeFlagToString(ModelVerificationAtStartup); } + if (mode.testFlag(ModelVerificationOnlyWarnError)) { modes << modeFlagToString(ModelVerificationOnlyWarnError); } if (mode.testFlag(ModelFailoverIfNoModelCanBeAdded)) { modes << modeFlagToString(ModelFailoverIfNoModelCanBeAdded); } return modes.join(", "); @@ -231,7 +234,8 @@ namespace BlackMisc bool byGliderCategory, bool byMilitaryCategory, bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded, - bool modelVerification, bool modelSetRemoveFailedModel, bool modelFailover) + bool modelVerification, bool modelVerificationWarnError, + bool modelSetRemoveFailedModel, bool modelFailover) { if (modelFailover) { modelSetRemoveFailedModel = true; } // otherwise this does not make sense @@ -252,7 +256,8 @@ namespace BlackMisc if (excludeNoExcluded) { mode |= ExcludeNoExcluded; } if (modelSetRemoveFailedModel) { mode |= ModelSetRemoveFailedModel; } if (modelVerification) { mode |= ModelVerificationAtStartup; } - if (modelFailover) { mode |= ModelFailoverIfNoModelCanBeAdded; } + if (modelVerificationWarnError) { mode |= ModelVerificationOnlyWarnError; } + if (modelFailover) { mode |= ModelFailoverIfNoModelCanBeAdded; } return mode; } } // namespace diff --git a/src/blackmisc/simulation/aircraftmatchersetup.h b/src/blackmisc/simulation/aircraftmatchersetup.h index 119995d77..46832155a 100644 --- a/src/blackmisc/simulation/aircraftmatchersetup.h +++ b/src/blackmisc/simulation/aircraftmatchersetup.h @@ -59,6 +59,7 @@ namespace BlackMisc // --- model set --- ModelSetRemoveFailedModel = 1 << 15, ModelVerificationAtStartup = 1 << 16, + ModelVerificationOnlyWarnError = 1 << 18, // later added, hence 18 ModelFailoverIfNoModelCanBeAdded = 1 << 17, // --- others --- @@ -116,6 +117,10 @@ namespace BlackMisc //! \sa ModelVerificationOnStartup bool doVerificationAtStartup() const { return this->getMatchingMode().testFlag(ModelVerificationAtStartup); } + //! Verification only shown for warning/errors? + //! \sa ModelVerificationOnlyWarnError + bool onlyShowVerificationWarningsAndErrors() const { return this->getMatchingMode().testFlag(ModelVerificationOnlyWarnError); } + //! Failover if model cannot be loaded //! \sa ModelFailoverIfNoModelCanBeAdded bool doModelAddFailover() const { return this->getMatchingMode().testFlag(ModelFailoverIfNoModelCanBeAdded); } @@ -177,7 +182,7 @@ namespace BlackMisc bool byForceMilitary, bool byForceCivilian, bool byVtol, bool byGliderCategory, bool byMilitaryCategory, bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded, - bool modelVerification, bool modelSetRemoveFailedModel, bool modelFailover); + bool modelVerification, bool modelVerificationWarnError, bool modelSetRemoveFailedModel, bool modelFailover); private: int m_algorithm = static_cast(MatchingStepwiseReducePlusScoreBased);