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->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()
);
}

View File

@@ -247,6 +247,13 @@
</property>
</widget>
</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>
</widget>
</item>
@@ -305,7 +312,6 @@
</layout>
</widget>
<tabstops>
<tabstop>rb_Reduction</tabstop>
<tabstop>rb_ScoreOnly</tabstop>
<tabstop>rb_ScoreAndReduction</tabstop>
<tabstop>pb_ResetAlgorithm</tabstop>
@@ -324,12 +330,15 @@
<tabstop>cb_CategoryGlider</tabstop>
<tabstop>cb_CategoryMilitaryAircraft</tabstop>
<tabstop>cb_ModelSetVerification</tabstop>
<tabstop>cb_ModelSetVerificationOnlyErrorWarning</tabstop>
<tabstop>cb_ModelSetRemoveFailed</tabstop>
<tabstop>cb_ModelFailedFailover</tabstop>
<tabstop>cb_ExclNoExcludedModels</tabstop>
<tabstop>cb_ExclNoDbData</tabstop>
<tabstop>cb_ScorePreferColorLiveries</tabstop>
<tabstop>cb_ScoreIgnoreZeros</tabstop>
<tabstop>pb_ResetAll</tabstop>
<tabstop>rb_Reduction</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -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

View File

@@ -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<int>(MatchingStepwiseReducePlusScoreBased);