Skip to content

Commit

Permalink
Refactor setting check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Sep 16, 2024
1 parent 4803dc1 commit 9aabb13
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/controllers/legacycontrollersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,13 @@ class LegacyControllerNumberSetting
/// and a strictly positive step, strictly less than max..
/// @return true if valid
bool valid() const override {
static constexpr bool typeSize = sizeof(long) == sizeof(int);
return AbstractLegacyControllerSetting::valid() &&
m_defaultValue >= m_minValue && m_savedValue >= m_minValue &&
m_editedValue >= m_minValue && m_defaultValue <= m_maxValue &&
m_savedValue <= m_maxValue && m_editedValue <= m_maxValue &&
m_stepValue > 0 &&
(typeSize ||
static_cast<long>(m_stepValue) <
static_cast<long>(m_maxValue) -
static_cast<long>(m_minValue));
((m_minValue <= 0 && m_minValue + m_stepValue <= m_maxValue) ||
(m_maxValue >= 0 && m_maxValue - m_stepValue >= m_minValue));
}

static AbstractLegacyControllerSetting* createFrom(const QDomElement& element) {
Expand Down

0 comments on commit 9aabb13

Please sign in to comment.