Setting to display validation only in case of warnings/errors

This commit is contained in:
Klaus Basan
2019-05-07 02:32:14 +02:00
parent 2139fc2a5f
commit 7ac0450836
4 changed files with 31 additions and 9 deletions

View File

@@ -24,11 +24,11 @@ namespace BlackGui
ui(new Ui::CMatchingForm) ui(new Ui::CMatchingForm)
{ {
ui->setupUi(this); 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_ScoreAndReduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
connect(ui->rb_ScoreOnly, &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_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection);
connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection); connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection);
} }
CMatchingForm::~CMatchingForm() CMatchingForm::~CMatchingForm()
@@ -48,6 +48,7 @@ namespace BlackGui
CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetRemoveFailed, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetRemoveFailed, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ModelFailedFailover, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ModelFailedFailover, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetVerification, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetVerification, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetVerificationOnlyErrorWarning, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_CategoryGlider, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_CategoryGlider, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_CategoryMilitaryAircraft, 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_ModelSetRemoveFailed->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelSetRemoveFailedModel) || mode.testFlag(CAircraftMatcherSetup::ModelFailoverIfNoModelCanBeAdded));
ui->cb_ModelFailedFailover->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelFailoverIfNoModelCanBeAdded)); ui->cb_ModelFailedFailover->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelFailoverIfNoModelCanBeAdded));
ui->cb_ModelSetVerification->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelVerificationAtStartup)); ui->cb_ModelSetVerification->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelVerificationAtStartup));
ui->cb_ModelSetVerificationOnlyErrorWarning->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelVerificationOnlyWarnError));
this->setMatchingAlgorithm(setup); this->setMatchingAlgorithm(setup);
this->setPickStrategy(setup); this->setPickStrategy(setup);
@@ -138,7 +140,8 @@ namespace BlackGui
ui->cb_CategoryMilitaryAircraft->isChecked(), ui->cb_CategoryMilitaryAircraft->isChecked(),
ui->cb_ScoreIgnoreZeros->isChecked(), ui->cb_ScorePreferColorLiveries->isChecked(), ui->cb_ScoreIgnoreZeros->isChecked(), ui->cb_ScorePreferColorLiveries->isChecked(),
ui->cb_ExclNoDbData->isChecked(), ui->cb_ExclNoExcludedModels->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() ui->cb_ModelFailedFailover->isChecked()
); );
} }

View File

@@ -247,6 +247,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QCheckBox" name="cb_ModelSetVerificationOnlyErrorWarning">
<property name="text">
<string>dialog only if wanrings/error</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -305,7 +312,6 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>rb_Reduction</tabstop>
<tabstop>rb_ScoreOnly</tabstop> <tabstop>rb_ScoreOnly</tabstop>
<tabstop>rb_ScoreAndReduction</tabstop> <tabstop>rb_ScoreAndReduction</tabstop>
<tabstop>pb_ResetAlgorithm</tabstop> <tabstop>pb_ResetAlgorithm</tabstop>
@@ -324,12 +330,15 @@
<tabstop>cb_CategoryGlider</tabstop> <tabstop>cb_CategoryGlider</tabstop>
<tabstop>cb_CategoryMilitaryAircraft</tabstop> <tabstop>cb_CategoryMilitaryAircraft</tabstop>
<tabstop>cb_ModelSetVerification</tabstop> <tabstop>cb_ModelSetVerification</tabstop>
<tabstop>cb_ModelSetVerificationOnlyErrorWarning</tabstop>
<tabstop>cb_ModelSetRemoveFailed</tabstop> <tabstop>cb_ModelSetRemoveFailed</tabstop>
<tabstop>cb_ModelFailedFailover</tabstop> <tabstop>cb_ModelFailedFailover</tabstop>
<tabstop>cb_ExclNoExcludedModels</tabstop> <tabstop>cb_ExclNoExcludedModels</tabstop>
<tabstop>cb_ExclNoDbData</tabstop> <tabstop>cb_ExclNoDbData</tabstop>
<tabstop>cb_ScorePreferColorLiveries</tabstop> <tabstop>cb_ScorePreferColorLiveries</tabstop>
<tabstop>cb_ScoreIgnoreZeros</tabstop> <tabstop>cb_ScoreIgnoreZeros</tabstop>
<tabstop>pb_ResetAll</tabstop>
<tabstop>rb_Reduction</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@@ -151,6 +151,7 @@ namespace BlackMisc
static const QString exExcl("excl.excluded"); static const QString exExcl("excl.excluded");
static const QString removeFromModelSet("rem.from model set"); static const QString removeFromModelSet("rem.from model set");
static const QString verification("Verify models at startup"); 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 modelFailedAdded("Replace models failed to be added");
static const QString categoryGlider("glider categories"); static const QString categoryGlider("glider categories");
static const QString categoryMilitary("military categories"); static const QString categoryMilitary("military categories");
@@ -175,6 +176,7 @@ namespace BlackMisc
case ExcludeNoExcluded: return exExcl; case ExcludeNoExcluded: return exExcl;
case ModelSetRemoveFailedModel: return removeFromModelSet; case ModelSetRemoveFailedModel: return removeFromModelSet;
case ModelVerificationAtStartup: return verification; case ModelVerificationAtStartup: return verification;
case ModelVerificationOnlyWarnError: return verificationWarn;
case ModelFailoverIfNoModelCanBeAdded: return modelFailedAdded; case ModelFailoverIfNoModelCanBeAdded: return modelFailedAdded;
default: break; default: break;
} }
@@ -202,6 +204,7 @@ namespace BlackMisc
if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); } if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); }
if (mode.testFlag(ModelSetRemoveFailedModel)) { modes << modeFlagToString(ModelSetRemoveFailedModel); } if (mode.testFlag(ModelSetRemoveFailedModel)) { modes << modeFlagToString(ModelSetRemoveFailedModel); }
if (mode.testFlag(ModelVerificationAtStartup)) { modes << modeFlagToString(ModelVerificationAtStartup); } if (mode.testFlag(ModelVerificationAtStartup)) { modes << modeFlagToString(ModelVerificationAtStartup); }
if (mode.testFlag(ModelVerificationOnlyWarnError)) { modes << modeFlagToString(ModelVerificationOnlyWarnError); }
if (mode.testFlag(ModelFailoverIfNoModelCanBeAdded)) { modes << modeFlagToString(ModelFailoverIfNoModelCanBeAdded); } if (mode.testFlag(ModelFailoverIfNoModelCanBeAdded)) { modes << modeFlagToString(ModelFailoverIfNoModelCanBeAdded); }
return modes.join(", "); return modes.join(", ");
@@ -231,7 +234,8 @@ namespace BlackMisc
bool byGliderCategory, bool byMilitaryCategory, bool byGliderCategory, bool byMilitaryCategory,
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool scoreIgnoreZeros, bool scorePreferColorLiveries,
bool excludeNoDbData, bool excludeNoExcluded, 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 if (modelFailover) { modelSetRemoveFailedModel = true; } // otherwise this does not make sense
@@ -252,7 +256,8 @@ namespace BlackMisc
if (excludeNoExcluded) { mode |= ExcludeNoExcluded; } if (excludeNoExcluded) { mode |= ExcludeNoExcluded; }
if (modelSetRemoveFailedModel) { mode |= ModelSetRemoveFailedModel; } if (modelSetRemoveFailedModel) { mode |= ModelSetRemoveFailedModel; }
if (modelVerification) { mode |= ModelVerificationAtStartup; } if (modelVerification) { mode |= ModelVerificationAtStartup; }
if (modelFailover) { mode |= ModelFailoverIfNoModelCanBeAdded; } if (modelVerificationWarnError) { mode |= ModelVerificationOnlyWarnError; }
if (modelFailover) { mode |= ModelFailoverIfNoModelCanBeAdded; }
return mode; return mode;
} }
} // namespace } // namespace

View File

@@ -59,6 +59,7 @@ namespace BlackMisc
// --- model set --- // --- model set ---
ModelSetRemoveFailedModel = 1 << 15, ModelSetRemoveFailedModel = 1 << 15,
ModelVerificationAtStartup = 1 << 16, ModelVerificationAtStartup = 1 << 16,
ModelVerificationOnlyWarnError = 1 << 18, // later added, hence 18
ModelFailoverIfNoModelCanBeAdded = 1 << 17, ModelFailoverIfNoModelCanBeAdded = 1 << 17,
// --- others --- // --- others ---
@@ -116,6 +117,10 @@ namespace BlackMisc
//! \sa ModelVerificationOnStartup //! \sa ModelVerificationOnStartup
bool doVerificationAtStartup() const { return this->getMatchingMode().testFlag(ModelVerificationAtStartup); } 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 //! Failover if model cannot be loaded
//! \sa ModelFailoverIfNoModelCanBeAdded //! \sa ModelFailoverIfNoModelCanBeAdded
bool doModelAddFailover() const { return this->getMatchingMode().testFlag(ModelFailoverIfNoModelCanBeAdded); } bool doModelAddFailover() const { return this->getMatchingMode().testFlag(ModelFailoverIfNoModelCanBeAdded); }
@@ -177,7 +182,7 @@ namespace BlackMisc
bool byForceMilitary, bool byForceCivilian, bool byForceMilitary, bool byForceCivilian,
bool byVtol, bool byGliderCategory, bool byMilitaryCategory, bool byVtol, bool byGliderCategory, bool byMilitaryCategory,
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded, bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded,
bool modelVerification, bool modelSetRemoveFailedModel, bool modelFailover); bool modelVerification, bool modelVerificationWarnError, bool modelSetRemoveFailedModel, bool modelFailover);
private: private:
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased); int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);