From f84759936cd75aee12c6f505a253f98bccaf9790 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 28 Feb 2021 12:33:28 -0800 Subject: [PATCH] Relax minimum blender version, consolidate version constants --- hecl-gui/FindBlender.cpp | 4 ---- hecl-gui/FindBlender.hpp | 4 ++++ hecl-gui/SysReqTableView.cpp | 9 ++++++++- hecl-gui/SysReqTableView.hpp | 10 +--------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hecl-gui/FindBlender.cpp b/hecl-gui/FindBlender.cpp index d9d278792..c34618b6a 100644 --- a/hecl-gui/FindBlender.cpp +++ b/hecl-gui/FindBlender.cpp @@ -12,10 +12,6 @@ namespace hecl::blender { #define DEFAULT_BLENDER_BIN "blender" #endif -static const uint32_t MinBlenderMajorSearch = 2; -static const uint32_t MaxBlenderMajorSearch = 2; -static const uint32_t MinBlenderMinorSearch = 90; -static const uint32_t MaxBlenderMinorSearch = 91; static const std::regex regBlenderVersion(R"(Blender (\d+)\.(\d+)(?:\.(\d+))?)", std::regex::ECMAScript | std::regex::optimize); diff --git a/hecl-gui/FindBlender.hpp b/hecl-gui/FindBlender.hpp index 358d37d29..cd23bf6bf 100644 --- a/hecl-gui/FindBlender.hpp +++ b/hecl-gui/FindBlender.hpp @@ -3,6 +3,10 @@ #include "hecl/hecl.hpp" namespace hecl::blender { +constexpr uint32_t MinBlenderMajorSearch = 2; +constexpr uint32_t MaxBlenderMajorSearch = 2; +constexpr uint32_t MinBlenderMinorSearch = 83; +constexpr uint32_t MaxBlenderMinorSearch = 91; hecl::SystemString FindBlender(int& major, int& minor); diff --git a/hecl-gui/SysReqTableView.cpp b/hecl-gui/SysReqTableView.cpp index 81a6348b8..2c119d0cc 100644 --- a/hecl-gui/SysReqTableView.cpp +++ b/hecl-gui/SysReqTableView.cpp @@ -200,7 +200,9 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const { return {}; #endif case 5: - return tr("Blender 2.90+"); + return QStringLiteral("Blender %1.%2+") + .arg(hecl::blender::MinBlenderMajorSearch) + .arg(hecl::blender::MinBlenderMinorSearch); } } else if (index.column() == 1) { /* Your System */ @@ -260,6 +262,11 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation, } } } +bool SysReqTableModel::isBlenderVersionOk() const { + return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch && + m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) && + (m_blendMinor >= hecl::blender::MinBlenderMinorSearch && m_blendMinor <= hecl::blender::MaxBlenderMinorSearch); +} void SysReqTableView::paintEvent(QPaintEvent* e) { int tableWidth = columnWidth(0) + columnWidth(1); diff --git a/hecl-gui/SysReqTableView.hpp b/hecl-gui/SysReqTableView.hpp index 7db891fd2..f7aa6b7cf 100644 --- a/hecl-gui/SysReqTableView.hpp +++ b/hecl-gui/SysReqTableView.hpp @@ -5,11 +5,6 @@ class QSequentialAnimationGroup; -const uint32_t MinBlenderVersionMajor = 2; -const uint32_t MaxBlenderVersionMajor = 2; -const uint32_t MinBlenderVersionMinor = 90; -const uint32_t MaxBlenderVersionMinor = 91; - class SysReqTableModel : public QAbstractTableModel { Q_OBJECT uint64_t m_cpuSpeed = 0; @@ -36,10 +31,7 @@ public: int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - bool isBlenderVersionOk() const { - return (m_blendMajor >= MinBlenderVersionMajor && m_blendMajor <= MaxBlenderVersionMajor) && - (m_blendMinor >= MinBlenderVersionMinor && m_blendMinor <= MaxBlenderVersionMinor); - } + bool isBlenderVersionOk() const; void updateFreeDiskSpace(const QString& path); };