Relax minimum blender version, consolidate version constants

This commit is contained in:
Phillip Stephens 2021-02-28 12:33:28 -08:00
parent af7f4601ac
commit f84759936c
4 changed files with 13 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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