Simplify system requirements table

Removes vector ISA table entirely
This commit is contained in:
Luke Street 2021-03-19 18:46:56 -04:00
parent aace28fc19
commit 3f0615bf94
10 changed files with 23 additions and 385 deletions

View File

@ -26,12 +26,6 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(QUAZIP_INSTALL OFF CACHE BOOL "") set(QUAZIP_INSTALL OFF CACHE BOOL "")
add_subdirectory(quazip) add_subdirectory(quazip)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
set(VectorISATableModel_HEADER VectorISATableModelIntel.hpp)
else ()
set(VectorISATableModel_HEADER "")
endif ()
add_executable(hecl-gui WIN32 MACOSX_BUNDLE add_executable(hecl-gui WIN32 MACOSX_BUNDLE
#ArgumentEditor.cpp #ArgumentEditor.cpp
#ArgumentEditor.hpp #ArgumentEditor.hpp
@ -59,10 +53,6 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE
LayerDialog.ui LayerDialog.ui
SysReqTableView.cpp SysReqTableView.cpp
SysReqTableView.hpp SysReqTableView.hpp
VectorISATableModel.hpp
${VectorISATableModel_HEADER}
VectorISATableView.cpp
VectorISATableView.hpp
main.cpp main.cpp

View File

@ -108,13 +108,6 @@ MainWindow::MainWindow(QWidget* parent)
} }
}); });
// m_updateURDEButton = new QPushButton(tr("Update URDE"), m_ui->centralwidget);
// m_ui->gridLayout->addWidget(m_updateURDEButton, 2, 3, 1, 1);
// m_updateURDEButton->hide();
// QPalette pal = m_updateURDEButton->palette();
// pal.setColor(QPalette::Button, QColor(53, 53, 72));
// m_updateURDEButton->setPalette(pal);
// connect(m_updateURDEButton, &QPushButton::clicked, this, &MainWindow::onUpdateURDEPressed);
qDebug() << "Stored track " << m_settings.value(QStringLiteral("update_track")); qDebug() << "Stored track " << m_settings.value(QStringLiteral("update_track"));
const int index = skUpdateTracks.indexOf(m_settings.value(QStringLiteral("update_track")).toString()); const int index = skUpdateTracks.indexOf(m_settings.value(QStringLiteral("update_track")).toString());
m_ui->devTrackWarning->setVisible(index == 1); m_ui->devTrackWarning->setVisible(index == 1);
@ -270,8 +263,6 @@ void MainWindow::onIndexDownloaded(const QStringList& index) {
m_ui->binaryComboBox->clear(); m_ui->binaryComboBox->clear();
for (const QString& str : index) { for (const QString& str : index) {
URDEVersion version(str); URDEVersion version(str);
if (m_ui->sysReqTable->willRun(version))
bestVersion = m_ui->binaryComboBox->count();
m_ui->binaryComboBox->addItem(version.fileString(false), QVariant::fromValue(version)); m_ui->binaryComboBox->addItem(version.fileString(false), QVariant::fromValue(version));
} }
m_ui->binaryComboBox->setCurrentIndex(bestVersion); m_ui->binaryComboBox->setCurrentIndex(bestVersion);
@ -286,7 +277,6 @@ void MainWindow::onIndexDownloaded(const QStringList& index) {
} }
void MainWindow::onDownloadPressed() { void MainWindow::onDownloadPressed() {
// m_updateURDEButton->hide();
QString filename = m_ui->binaryComboBox->currentData().value<URDEVersion>().fileString(true); QString filename = m_ui->binaryComboBox->currentData().value<URDEVersion>().fileString(true);
#if PLATFORM_ZIP_DOWNLOAD #if PLATFORM_ZIP_DOWNLOAD
disableOperations(); disableOperations();
@ -295,11 +285,6 @@ void MainWindow::onDownloadPressed() {
m_dlManager.fetchBinary(filename, m_path + QLatin1Char{'/'} + filename); m_dlManager.fetchBinary(filename, m_path + QLatin1Char{'/'} + filename);
} }
//void MainWindow::onUpdateURDEPressed() {
// m_ui->heclTabs->setCurrentIndex(2);
// onDownloadPressed();
//}
void MainWindow::onBinaryDownloaded(QuaZip& file) { void MainWindow::onBinaryDownloaded(QuaZip& file) {
const bool err = !ExtractZip::extractDir(file, m_path); const bool err = !ExtractZip::extractDir(file, m_path);
@ -416,8 +401,6 @@ static bool GetDLPackage(const QString& path, QString& dlPackage) {
} }
bool MainWindow::checkDownloadedBinary() { bool MainWindow::checkDownloadedBinary() {
// m_updateURDEButton->hide();
m_urdePath = QString(); m_urdePath = QString();
m_heclPath = QString(); m_heclPath = QString();
@ -453,9 +436,6 @@ bool MainWindow::checkDownloadedBinary() {
if (!urdeDlPackage.isEmpty() && urdeDlPackage == heclDlPackage && urdeDlPackage == visigenDlPackage) { if (!urdeDlPackage.isEmpty() && urdeDlPackage == heclDlPackage && urdeDlPackage == visigenDlPackage) {
URDEVersion v(urdeDlPackage); URDEVersion v(urdeDlPackage);
m_ui->currentBinaryLabel->setText(v.fileString(false)); m_ui->currentBinaryLabel->setText(v.fileString(false));
// if (m_recommendedVersion.isValid() && v.isValid() && m_recommendedVersion.getVersion() > v.getVersion()) {
// m_updateURDEButton->show();
// }
} else { } else {
m_ui->currentBinaryLabel->setText(tr("unknown -- re-download recommended")); m_ui->currentBinaryLabel->setText(tr("unknown -- re-download recommended"));
} }

View File

@ -40,7 +40,6 @@ class MainWindow : public QMainWindow {
QStringList m_warpSettings; QStringList m_warpSettings;
QSettings m_settings; QSettings m_settings;
URDEVersion m_recommendedVersion; URDEVersion m_recommendedVersion;
// QPushButton* m_updateURDEButton;
bool m_inContinueNote = false; bool m_inContinueNote = false;
QStringListModel m_launchOptionsModel; QStringListModel m_launchOptionsModel;

View File

@ -24,7 +24,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QTabWidget" name="heclTabs"> <widget class="QTabWidget" name="heclTabs">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="dataTab"> <widget class="QWidget" name="dataTab">
<attribute name="title"> <attribute name="title">
@ -244,15 +244,15 @@
<item row="0" column="0" rowspan="4"> <item row="0" column="0" rowspan="4">
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="graphicsGroup"> <widget class="QWidget" name="graphicsGroup">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>236</width> <width>450</width>
<height>198</height> <height>633</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -479,8 +479,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>226</width>
<height>633</height> <height>482</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -712,12 +712,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>

View File

@ -42,66 +42,6 @@ static QString GetWindowsVersionString() {
#endif #endif
SysReqTableModel::SysReqTableModel(QObject* parent) : QAbstractTableModel(parent) { SysReqTableModel::SysReqTableModel(QObject* parent) : QAbstractTableModel(parent) {
#ifdef __linux__
QFile file(QStringLiteral("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"));
if (file.open(QFile::ReadOnly)) {
const QString str(QString::fromUtf8(file.readAll()));
m_cpuSpeed = str.toInt() / 1000;
m_cpuSpeedStr = tr("%1 GHz").arg(m_cpuSpeed / 1000.0);
}
#elif defined(__APPLE__)
QProcess spProc;
spProc.start(QStringLiteral("system_profiler"), {QStringLiteral("-xml"), QStringLiteral("SPHardwareDataType")},
QProcess::ReadOnly);
spProc.waitForFinished();
QDomDocument spDoc;
spDoc.setContent(spProc.readAll());
QDomElement spDocElem = spDoc.documentElement();
QDomElement n = spDocElem.firstChildElement(QStringLiteral("array"))
.firstChildElement(QStringLiteral("dict"))
.firstChildElement(QStringLiteral("key"));
while (!n.isNull() && n.text() != QStringLiteral("_items")) {
n = n.nextSiblingElement(QStringLiteral("key"));
}
if (!n.isNull()) {
n = n.nextSiblingElement(QStringLiteral("array"))
.firstChildElement(QStringLiteral("dict"))
.firstChildElement(QStringLiteral("key"));
while (!n.isNull() && n.text() != QStringLiteral("current_processor_speed")) {
n = n.nextSiblingElement(QStringLiteral("key"));
}
if (!n.isNull()) {
n = n.nextSiblingElement(QStringLiteral("string"));
const double speed = n.text().split(QLatin1Char{' '}).front().toDouble();
m_cpuSpeed = uint64_t(speed * 1000.0);
m_cpuSpeedStr = tr("%1 GHz").arg(speed);
}
}
#elif _WIN32
HKEY hkey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _SYS_STR("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), 0,
KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) {
DWORD MHz;
DWORD size = sizeof(MHz);
if (RegQueryValueEx(hkey, _SYS_STR("~MHz"), nullptr, nullptr, (LPBYTE)&MHz, &size) == ERROR_SUCCESS) {
m_cpuSpeed = uint64_t(MHz);
m_cpuSpeedStr = tr("%1 GHz").arg(MHz / 1000.f, 1, 'f', 1);
}
}
RegCloseKey(hkey);
#else
/* This only works for Skylake+ */
int regs[4] = {};
zeus::getCpuInfo(0, regs);
if (regs[0] >= 0x16) {
zeus::getCpuInfo(0x16, regs);
m_cpuSpeed = uint64_t(regs[0]);
}
m_cpuSpeedStr = tr("%1 GHz").arg(m_cpuSpeed / 1000.f);
#endif
#if _WIN32 #if _WIN32
ULONGLONG memSize; ULONGLONG memSize;
GetPhysicallyInstalledSystemMemory(&memSize); GetPhysicallyInstalledSystemMemory(&memSize);
@ -140,10 +80,10 @@ void SysReqTableModel::updateFreeDiskSpace(const QString& path) {
m_freeDiskSpace = QStorageInfo(path).bytesFree(); m_freeDiskSpace = QStorageInfo(path).bytesFree();
m_freeDiskSpaceStr = tr("%1 GB").arg(m_freeDiskSpace / 1000.f / 1000.f / 1000.f, 1, 'f', 1); m_freeDiskSpaceStr = tr("%1 GB").arg(m_freeDiskSpace / 1000.f / 1000.f / 1000.f, 1, 'f', 1);
} }
emit dataChanged(index(3, 0), index(3, 0)); emit dataChanged(index(1, 0), index(1, 0));
} }
int SysReqTableModel::rowCount(const QModelIndex& parent) const { return 7; } int SysReqTableModel::rowCount(const QModelIndex& parent) const { return 4; }
int SysReqTableModel::columnCount(const QModelIndex& parent) const { return 2; } int SysReqTableModel::columnCount(const QModelIndex& parent) const { return 2; }
@ -155,14 +95,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
if (role == Qt::UserRole) { if (role == Qt::UserRole) {
switch (index.row()) { switch (index.row()) {
case 0: case 0:
return true;
case 1:
return m_cpuSpeed >= 1500;
case 2:
return m_memorySize >= 0xC0000000; return m_memorySize >= 0xC0000000;
case 3: case 1:
return m_freeDiskSpace >= qint64(5) * 1000 * 1000 * 1000; return m_freeDiskSpace >= qint64(5) * 1000 * 1000 * 1000;
case 4: case 2:
#ifdef __APPLE__ #ifdef __APPLE__
return m_macosMajor > 10 || m_macosMinor >= 11; return m_macosMajor > 10 || m_macosMinor >= 11;
#elif defined(_WIN32) #elif defined(_WIN32)
@ -170,7 +106,7 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
#else #else
return true; return true;
#endif #endif
case 5: case 3:
return isBlenderVersionOk(); return isBlenderVersionOk();
} }
} else { } else {
@ -178,18 +114,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
/* Recommended */ /* Recommended */
switch (index.row()) { switch (index.row()) {
case 0: case 0:
#if ZEUS_ARCH_X86 || ZEUS_ARCH_X86_64
return tr("x86_64");
#else
return {};
#endif
case 1:
return tr("1.5 GHz");
case 2:
return tr("3 GiB"); return tr("3 GiB");
case 3: case 1:
return tr("5 GB (MP1)"); return tr("5 GB (MP1)");
case 4: case 2:
#ifdef __APPLE__ #ifdef __APPLE__
return tr("macOS 10.11"); return tr("macOS 10.11");
#elif defined(_WIN32) #elif defined(_WIN32)
@ -199,7 +127,7 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
#else #else
return {}; return {};
#endif #endif
case 5: case 3:
return QStringLiteral("Blender %1.%2+") return QStringLiteral("Blender %1.%2+")
.arg(hecl::blender::MinBlenderMajorSearch) .arg(hecl::blender::MinBlenderMajorSearch)
.arg(hecl::blender::MinBlenderMinorSearch); .arg(hecl::blender::MinBlenderMinorSearch);
@ -208,20 +136,12 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
/* Your System */ /* Your System */
switch (index.row()) { switch (index.row()) {
case 0: case 0:
#if ZEUS_ARCH_X86 || ZEUS_ARCH_X86_64
return CurArchitectureString;
#else
return {};
#endif
case 1:
return m_cpuSpeedStr;
case 2:
return m_memorySizeStr; return m_memorySizeStr;
case 3: case 1:
return m_freeDiskSpaceStr; return m_freeDiskSpaceStr;
case 4: case 2:
return m_osVersion; return m_osVersion;
case 5: case 3:
return m_blendVersionStr; return m_blendVersionStr;
} }
} }
@ -244,24 +164,19 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation,
} }
} else { } else {
switch (section) { switch (section) {
case 0:
default: default:
return tr("Architecture"); case 0:
case 1:
return tr("CPU Speed");
case 2:
return tr("Memory"); return tr("Memory");
case 3: case 1:
return tr("Disk Space"); return tr("Disk Space");
case 4: case 2:
return tr("OS"); return tr("OS");
case 5: case 3:
return tr("Blender"); return tr("Blender");
case 6:
return tr("Vector ISA");
} }
} }
} }
bool SysReqTableModel::isBlenderVersionOk() const { bool SysReqTableModel::isBlenderVersionOk() const {
return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch && return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch &&
m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) && m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) &&
@ -300,10 +215,8 @@ void SysReqTableView::paintEvent(QPaintEvent* e) {
QTableView::paintEvent(e); QTableView::paintEvent(e);
} }
SysReqTableView::SysReqTableView(QWidget* parent) : QTableView(parent), m_vectorISATable(this) { SysReqTableView::SysReqTableView(QWidget* parent) : QTableView(parent) {
setModel(&m_model); setModel(&m_model);
setIndexWidget(m_model.index(6, 0), &m_vectorISATable);
setSpan(6, 0, 1, 2);
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);

View File

@ -1,14 +1,11 @@
#pragma once #pragma once
#include <QTableView> #include <QTableView>
#include "VectorISATableView.hpp"
class QSequentialAnimationGroup; class QSequentialAnimationGroup;
class SysReqTableModel : public QAbstractTableModel { class SysReqTableModel : public QAbstractTableModel {
Q_OBJECT Q_OBJECT
uint64_t m_cpuSpeed = 0;
QString m_cpuSpeedStr;
uint64_t m_memorySize = 0; uint64_t m_memorySize = 0;
QString m_memorySizeStr; QString m_memorySizeStr;
qint64 m_freeDiskSpace = 0; qint64 m_freeDiskSpace = 0;
@ -38,21 +35,12 @@ public:
class SysReqTableView : public QTableView { class SysReqTableView : public QTableView {
Q_OBJECT Q_OBJECT
SysReqTableModel m_model; SysReqTableModel m_model;
VectorISATableView m_vectorISATable;
std::tuple<QWidget*, QSequentialAnimationGroup*, bool> m_backgroundWidgets[6] = {}; std::tuple<QWidget*, QSequentialAnimationGroup*, bool> m_backgroundWidgets[6] = {};
public: public:
SysReqTableView(QWidget* parent = Q_NULLPTR); SysReqTableView(QWidget* parent = Q_NULLPTR);
void paintEvent(QPaintEvent* e) override; void paintEvent(QPaintEvent* e) override;
const SysReqTableModel& getModel() const { return m_model; } const SysReqTableModel& getModel() const { return m_model; }
const VectorISATableView& getVectorISATable() const { return m_vectorISATable; }
bool willRun(const URDEVersion& v) const {
return v.getArchitecture() == CurArchitecture && v.getPlatform() == CurPlatform
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
&& m_vectorISATable.willRun(v.getVectorISA())
#endif
;
}
bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); } bool isBlenderVersionOk() const { return m_model.isBlenderVersionOk(); }
void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); } void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); }
}; };

View File

@ -1,14 +0,0 @@
#pragma once
#include <QTableView>
#include "zeus/Math.hpp"
class VectorISATableModel : public QAbstractTableModel {
Q_OBJECT
protected:
const zeus::CPUInfo& m_features = zeus::cpuFeatures();
public:
VectorISATableModel(QObject* parent = Q_NULLPTR) : QAbstractTableModel(parent) {}
int rowCount(const QModelIndex& parent = QModelIndex()) const override { return 1; }
};

View File

@ -1,96 +0,0 @@
#pragma once
#include "VectorISATableModel.hpp"
class VectorISATableModelIntel : public VectorISATableModel {
Q_OBJECT
public:
VectorISATableModelIntel(QObject* parent = Q_NULLPTR) : VectorISATableModel(parent) {}
int columnCount(const QModelIndex& parent = QModelIndex()) const override { return 7; }
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override {
if (role != Qt::DisplayRole && role != Qt::UserRole)
return {};
if (role == Qt::UserRole) {
switch (index.column()) {
case 0:
default:
return true;
case 1:
return m_features.SSE1;
case 2:
return m_features.SSE2;
case 3:
return m_features.SSE3;
case 4:
return m_features.SSE41;
case 5:
return m_features.AVX;
case 6:
return m_features.AVX2;
}
} else {
switch (index.column()) {
case 0:
default:
return QStringLiteral("x87");
case 1:
return QStringLiteral("SSE");
case 2:
return QStringLiteral("SSE2");
case 3:
return QStringLiteral("SSE3");
case 4:
return QStringLiteral("SSE4.1");
case 5:
return QStringLiteral("AVX");
case 6:
return QStringLiteral("AVX2");
}
}
}
VectorISA getISA(int idx) const {
switch (idx) {
default:
return VectorISA::Invalid;
case 0:
return VectorISA::X87;
case 1:
return VectorISA::SSE;
case 2:
return VectorISA::SSE2;
case 3:
return VectorISA::SSE3;
case 4:
return VectorISA::SSE41;
case 5:
return VectorISA::AVX;
case 6:
return VectorISA::AVX2;
}
}
bool willRun(VectorISA visa) const {
switch (visa) {
default:
return false;
case VectorISA::X87:
return true;
case VectorISA::SSE:
return m_features.SSE1;
case VectorISA::SSE2:
return m_features.SSE2;
case VectorISA::SSE3:
return m_features.SSE3;
case VectorISA::SSE41:
return m_features.SSE41;
case VectorISA::AVX:
return m_features.AVX;
case VectorISA::AVX2:
return m_features.AVX2;
}
}
};

View File

@ -1,89 +0,0 @@
#include "VectorISATableView.hpp"
#include <QHeaderView>
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
void VectorISATableView::paintEvent(QPaintEvent* e) {
QTableView* p = static_cast<QTableView*>(parent()->parent());
int tableY = p->horizontalHeader()->height() + p->rowViewportPosition(6);
int rHeight = rowHeight(0);
for (int i = 0; i < 2; ++i) {
int tableX;
int width = 0;
if (i == 0) {
tableX = p->verticalHeader()->width() + columnViewportPosition(0);
for (int j = 0; j <= m_maxISA; ++j)
width += columnWidth(j);
} else {
tableX = p->verticalHeader()->width() + columnViewportPosition(m_maxISA + 1);
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
for (int j = m_maxISA + 1; j < m_model.columnCount({}); ++j)
width += columnWidth(j);
#endif
}
QWidget* w = std::get<0>(m_backgroundWidgets[i]);
QSequentialAnimationGroup* animation = std::get<1>(m_backgroundWidgets[i]);
QPropertyAnimation* pAnimation = static_cast<QPropertyAnimation*>(animation->animationAt(1));
bool& running = std::get<2>(m_backgroundWidgets[i]);
if (!running) {
w->setGeometry(QRect(tableX, tableY, 0, rHeight));
pAnimation->setStartValue(QRect(tableX, tableY, 0, rHeight));
pAnimation->setEndValue(QRect(tableX, tableY, width, rHeight));
animation->start();
running = true;
}
if (animation->state() == QAbstractAnimation::State::Running)
pAnimation->setEndValue(QRect(tableX, tableY, width, rHeight));
else
w->setGeometry(QRect(tableX, tableY, width, rHeight));
}
QTableView::paintEvent(e);
}
VectorISATableView::VectorISATableView(QWidget* parent) : QTableView(parent) {
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
setModel(&m_model);
for (int i = 0; i < m_model.columnCount({}); ++i) {
if (m_model.data(m_model.index(0, i), Qt::UserRole).toBool())
m_maxISA = i;
else
break;
}
#endif
horizontalHeader()->hide();
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
setFrameShape(QFrame::Shape::NoFrame);
verticalHeader()->hide();
verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setSelectionMode(QAbstractItemView::SelectionMode::NoSelection);
setFocusPolicy(Qt::NoFocus);
for (int i = 0; i < 2; ++i) {
QWidget* w = new QWidget(parent);
std::get<0>(m_backgroundWidgets[i]) = w;
QPalette pal = palette();
if (i == 0)
pal.setColor(QPalette::Window, QColor::fromRgbF(0.f, 1.f, 0.f, 0.2f));
else
pal.setColor(QPalette::Window, QColor::fromRgbF(1.f, 0.f, 0.f, 0.2f));
w->setAutoFillBackground(true);
w->setPalette(pal);
w->lower();
w->show();
QPropertyAnimation* animation = new QPropertyAnimation(w, "geometry", this);
animation->setDuration(2000);
animation->setEasingCurve(QEasingCurve::Type::InOutCubic);
QSequentialAnimationGroup* seq = new QSequentialAnimationGroup(this);
std::get<1>(m_backgroundWidgets[i]) = seq;
seq->addPause(6 * 100);
seq->addAnimation(animation);
}
}

View File

@ -1,27 +0,0 @@
#pragma once
#include <QTableView>
#include "Common.hpp"
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
#include "VectorISATableModelIntel.hpp"
#endif
class QSequentialAnimationGroup;
class VectorISATableView : public QTableView {
Q_OBJECT
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
VectorISATableModelIntel m_model;
#endif
std::tuple<QWidget*, QSequentialAnimationGroup*, bool> m_backgroundWidgets[2] = {};
int m_maxISA = 0;
public:
VectorISATableView(QWidget* parent = Q_NULLPTR);
void paintEvent(QPaintEvent* e) override;
#if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86
VectorISA getISA() const { return m_model.getISA(m_maxISA); }
bool willRun(VectorISA visa) const { return m_model.willRun(visa); }
#endif
};