mirror of https://github.com/AxioDL/metaforce.git
Simplify system requirements table
Removes vector ISA table entirely
This commit is contained in:
parent
aace28fc19
commit
3f0615bf94
|
@ -26,12 +26,6 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
|
|||
set(QUAZIP_INSTALL OFF CACHE BOOL "")
|
||||
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
|
||||
#ArgumentEditor.cpp
|
||||
#ArgumentEditor.hpp
|
||||
|
@ -59,10 +53,6 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE
|
|||
LayerDialog.ui
|
||||
SysReqTableView.cpp
|
||||
SysReqTableView.hpp
|
||||
VectorISATableModel.hpp
|
||||
${VectorISATableModel_HEADER}
|
||||
VectorISATableView.cpp
|
||||
VectorISATableView.hpp
|
||||
|
||||
main.cpp
|
||||
|
||||
|
|
|
@ -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"));
|
||||
const int index = skUpdateTracks.indexOf(m_settings.value(QStringLiteral("update_track")).toString());
|
||||
m_ui->devTrackWarning->setVisible(index == 1);
|
||||
|
@ -270,8 +263,6 @@ void MainWindow::onIndexDownloaded(const QStringList& index) {
|
|||
m_ui->binaryComboBox->clear();
|
||||
for (const QString& str : index) {
|
||||
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->setCurrentIndex(bestVersion);
|
||||
|
@ -286,7 +277,6 @@ void MainWindow::onIndexDownloaded(const QStringList& index) {
|
|||
}
|
||||
|
||||
void MainWindow::onDownloadPressed() {
|
||||
// m_updateURDEButton->hide();
|
||||
QString filename = m_ui->binaryComboBox->currentData().value<URDEVersion>().fileString(true);
|
||||
#if PLATFORM_ZIP_DOWNLOAD
|
||||
disableOperations();
|
||||
|
@ -295,11 +285,6 @@ void MainWindow::onDownloadPressed() {
|
|||
m_dlManager.fetchBinary(filename, m_path + QLatin1Char{'/'} + filename);
|
||||
}
|
||||
|
||||
//void MainWindow::onUpdateURDEPressed() {
|
||||
// m_ui->heclTabs->setCurrentIndex(2);
|
||||
// onDownloadPressed();
|
||||
//}
|
||||
|
||||
void MainWindow::onBinaryDownloaded(QuaZip& file) {
|
||||
const bool err = !ExtractZip::extractDir(file, m_path);
|
||||
|
||||
|
@ -416,8 +401,6 @@ static bool GetDLPackage(const QString& path, QString& dlPackage) {
|
|||
}
|
||||
|
||||
bool MainWindow::checkDownloadedBinary() {
|
||||
// m_updateURDEButton->hide();
|
||||
|
||||
m_urdePath = QString();
|
||||
m_heclPath = QString();
|
||||
|
||||
|
@ -453,9 +436,6 @@ bool MainWindow::checkDownloadedBinary() {
|
|||
if (!urdeDlPackage.isEmpty() && urdeDlPackage == heclDlPackage && urdeDlPackage == visigenDlPackage) {
|
||||
URDEVersion v(urdeDlPackage);
|
||||
m_ui->currentBinaryLabel->setText(v.fileString(false));
|
||||
// if (m_recommendedVersion.isValid() && v.isValid() && m_recommendedVersion.getVersion() > v.getVersion()) {
|
||||
// m_updateURDEButton->show();
|
||||
// }
|
||||
} else {
|
||||
m_ui->currentBinaryLabel->setText(tr("unknown -- re-download recommended"));
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ class MainWindow : public QMainWindow {
|
|||
QStringList m_warpSettings;
|
||||
QSettings m_settings;
|
||||
URDEVersion m_recommendedVersion;
|
||||
// QPushButton* m_updateURDEButton;
|
||||
bool m_inContinueNote = false;
|
||||
QStringListModel m_launchOptionsModel;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<item row="2" column="0">
|
||||
<widget class="QTabWidget" name="heclTabs">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="dataTab">
|
||||
<attribute name="title">
|
||||
|
@ -244,15 +244,15 @@
|
|||
<item row="0" column="0" rowspan="4">
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="graphicsGroup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>236</width>
|
||||
<height>198</height>
|
||||
<width>450</width>
|
||||
<height>633</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -479,8 +479,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>633</height>
|
||||
<width>226</width>
|
||||
<height>482</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -712,12 +712,6 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
|
|
|
@ -42,66 +42,6 @@ static QString GetWindowsVersionString() {
|
|||
#endif
|
||||
|
||||
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
|
||||
ULONGLONG memSize;
|
||||
GetPhysicallyInstalledSystemMemory(&memSize);
|
||||
|
@ -140,10 +80,10 @@ void SysReqTableModel::updateFreeDiskSpace(const QString& path) {
|
|||
m_freeDiskSpace = QStorageInfo(path).bytesFree();
|
||||
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; }
|
||||
|
||||
|
@ -155,14 +95,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
|
|||
if (role == Qt::UserRole) {
|
||||
switch (index.row()) {
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return m_cpuSpeed >= 1500;
|
||||
case 2:
|
||||
return m_memorySize >= 0xC0000000;
|
||||
case 3:
|
||||
case 1:
|
||||
return m_freeDiskSpace >= qint64(5) * 1000 * 1000 * 1000;
|
||||
case 4:
|
||||
case 2:
|
||||
#ifdef __APPLE__
|
||||
return m_macosMajor > 10 || m_macosMinor >= 11;
|
||||
#elif defined(_WIN32)
|
||||
|
@ -170,7 +106,7 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
|
|||
#else
|
||||
return true;
|
||||
#endif
|
||||
case 5:
|
||||
case 3:
|
||||
return isBlenderVersionOk();
|
||||
}
|
||||
} else {
|
||||
|
@ -178,18 +114,10 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
|
|||
/* Recommended */
|
||||
switch (index.row()) {
|
||||
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");
|
||||
case 3:
|
||||
case 1:
|
||||
return tr("5 GB (MP1)");
|
||||
case 4:
|
||||
case 2:
|
||||
#ifdef __APPLE__
|
||||
return tr("macOS 10.11");
|
||||
#elif defined(_WIN32)
|
||||
|
@ -199,7 +127,7 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
|
|||
#else
|
||||
return {};
|
||||
#endif
|
||||
case 5:
|
||||
case 3:
|
||||
return QStringLiteral("Blender %1.%2+")
|
||||
.arg(hecl::blender::MinBlenderMajorSearch)
|
||||
.arg(hecl::blender::MinBlenderMinorSearch);
|
||||
|
@ -208,20 +136,12 @@ QVariant SysReqTableModel::data(const QModelIndex& index, int role) const {
|
|||
/* Your System */
|
||||
switch (index.row()) {
|
||||
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;
|
||||
case 3:
|
||||
case 1:
|
||||
return m_freeDiskSpaceStr;
|
||||
case 4:
|
||||
case 2:
|
||||
return m_osVersion;
|
||||
case 5:
|
||||
case 3:
|
||||
return m_blendVersionStr;
|
||||
}
|
||||
}
|
||||
|
@ -244,24 +164,19 @@ QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
}
|
||||
} else {
|
||||
switch (section) {
|
||||
case 0:
|
||||
default:
|
||||
return tr("Architecture");
|
||||
case 1:
|
||||
return tr("CPU Speed");
|
||||
case 2:
|
||||
case 0:
|
||||
return tr("Memory");
|
||||
case 3:
|
||||
case 1:
|
||||
return tr("Disk Space");
|
||||
case 4:
|
||||
case 2:
|
||||
return tr("OS");
|
||||
case 5:
|
||||
case 3:
|
||||
return tr("Blender");
|
||||
case 6:
|
||||
return tr("Vector ISA");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SysReqTableModel::isBlenderVersionOk() const {
|
||||
return (m_blendMajor >= hecl::blender::MinBlenderMajorSearch &&
|
||||
m_blendMajor <= hecl::blender::MaxBlenderMajorSearch) &&
|
||||
|
@ -300,10 +215,8 @@ void SysReqTableView::paintEvent(QPaintEvent* e) {
|
|||
QTableView::paintEvent(e);
|
||||
}
|
||||
|
||||
SysReqTableView::SysReqTableView(QWidget* parent) : QTableView(parent), m_vectorISATable(this) {
|
||||
SysReqTableView::SysReqTableView(QWidget* parent) : QTableView(parent) {
|
||||
setModel(&m_model);
|
||||
setIndexWidget(m_model.index(6, 0), &m_vectorISATable);
|
||||
setSpan(6, 0, 1, 2);
|
||||
|
||||
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <QTableView>
|
||||
#include "VectorISATableView.hpp"
|
||||
|
||||
class QSequentialAnimationGroup;
|
||||
|
||||
class SysReqTableModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
uint64_t m_cpuSpeed = 0;
|
||||
QString m_cpuSpeedStr;
|
||||
uint64_t m_memorySize = 0;
|
||||
QString m_memorySizeStr;
|
||||
qint64 m_freeDiskSpace = 0;
|
||||
|
@ -38,21 +35,12 @@ public:
|
|||
class SysReqTableView : public QTableView {
|
||||
Q_OBJECT
|
||||
SysReqTableModel m_model;
|
||||
VectorISATableView m_vectorISATable;
|
||||
std::tuple<QWidget*, QSequentialAnimationGroup*, bool> m_backgroundWidgets[6] = {};
|
||||
|
||||
public:
|
||||
SysReqTableView(QWidget* parent = Q_NULLPTR);
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
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(); }
|
||||
void updateFreeDiskSpace(const QString& path) { m_model.updateFreeDiskSpace(path); }
|
||||
};
|
||||
|
|
|
@ -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; }
|
||||
};
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
};
|
Loading…
Reference in New Issue