Work on System Check tab of hecl-gui; add HECL icon

This commit is contained in:
Jack Andersen 2017-12-25 11:53:37 -10:00
parent 15ccb5e928
commit cc63d4852f
30 changed files with 1283 additions and 121 deletions

View File

@ -6,9 +6,34 @@ set(CMAKE_AUTOUIC ON)
find_package(Qt5Widgets)
add_executable(hecl-gui
if(APPLE)
set(PLAT_SRCS MacOSSystemVersion.hpp MacOSSystemVersion.mm)
find_library(FOUNDATION_LIBRARY Foundation)
set(PLAT_LIBS ${FOUNDATION_LIBRARY})
endif()
if(WIN32)
list(APPEND PLAT_SRCS platforms/win/urde.rc)
elseif(APPLE)
list(APPEND PLAT_SRCS platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endif()
add_subdirectory(platforms/freedesktop)
declare_qticon_target()
list(APPEND PLAT_SRCS mainicon_qt.c)
add_executable(hecl-gui WIN32 MACOSX_BUNDLE
MainWindow.ui MainWindow.hpp MainWindow.cpp
FileDirDialog.hpp FileDirDialog.cpp
main.cpp)
SysReqTableView.hpp SysReqTableView.cpp
VectorISATableView.hpp VectorISATableView.cpp
VectorISATableModel.hpp VectorISATableModelIntel.hpp
SysInstallReport.hpp SysInstallReport.cpp
${PLAT_SRCS} main.cpp)
target_link_libraries(hecl-gui ${Qt5Widgets_LIBRARIES})
set_target_properties(hecl-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist")
target_link_libraries(hecl-gui ${Qt5Widgets_LIBRARIES} ${PLAT_LIBS} zeus)

View File

@ -20,7 +20,7 @@ private:
QStringList m_selectedFiles;
public slots:
void chooseClicked();
void chooseClicked();
public:
FileDirDialog(QWidget* parent = nullptr);
QStringList selectedFiles();

View File

@ -0,0 +1,6 @@
#ifndef GUI_MACOSSYSTEMVERSION_HPP
#define GUI_MACOSSYSTEMVERSION_HPP
void GetMacOSSystemVersion(int& major, int& minor, int& patch);
#endif // GUI_MACOSSYSTEMVERSION_HPP

View File

@ -0,0 +1,168 @@
#include "MacOSSystemVersion.hpp"
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
void GetMacOSSystemVersion(int& major, int& minor, int& patch)
{
major = 0;
minor = 0;
patch = 0;
id pInfo = [NSProcessInfo processInfo];
if ([pInfo respondsToSelector:@selector(operatingSystemVersion)])
{
NSOperatingSystemVersion version = [pInfo operatingSystemVersion];
major = version.majorVersion;
minor = version.minorVersion;
patch = version.patchVersion;
}
else
{
major = 10;
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_9_2)
{
minor = 9;
patch = 2;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_9_1)
{
minor = 9;
patch = 1;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_9)
{
minor = 9;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_8_4)
{
minor = 8;
patch = 4;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_8_3)
{
minor = 8;
patch = 3;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_8_2)
{
minor = 8;
patch = 2;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_8_1)
{
minor = 8;
patch = 1;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_8)
{
minor = 8;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7_5)
{
minor = 7;
patch = 5;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7_4)
{
minor = 7;
patch = 4;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7_3)
{
minor = 7;
patch = 3;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7_2)
{
minor = 7;
patch = 2;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7_1)
{
minor = 7;
patch = 1;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_7)
{
minor = 7;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_8)
{
minor = 6;
patch = 8;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_7)
{
minor = 6;
patch = 7;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_6)
{
minor = 6;
patch = 6;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_5)
{
minor = 6;
patch = 5;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_4)
{
minor = 6;
patch = 4;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_3)
{
minor = 6;
patch = 3;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_2)
{
minor = 6;
patch = 2;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6_1)
{
minor = 6;
patch = 1;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_6)
{
minor = 6;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_5)
{
minor = 5;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_4)
{
minor = 4;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_3)
{
minor = 3;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_2)
{
minor = 2;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_1)
{
minor = 1;
patch = 0;
}
else if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_0)
{
minor = 0;
patch = 0;
}
}
}

View File

@ -15,6 +15,7 @@ MainWindow::MainWindow(QWidget *parent) :
m_ui->setupUi(this);
m_ui->heclTabs->setCurrentIndex(0);
m_ui->splitter->setSizes({0,-1});
m_ui->aboutIcon->setPixmap(QApplication::windowIcon().pixmap(256, 256));
initSlots();
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,30 @@
#include "SysInstallReport.hpp"
#include <QFontDatabase>
#include <QPushButton>
#include <QFormLayout>
SysInstallReport::SysInstallReport(QWidget* parent)
: QWidget(parent)
{
QFormLayout* formLayout = new QFormLayout(this);
QString labelText;
labelText.sprintf("Recommended URDE %s:", installEntity().toUtf8().data());
m_installFile = new QLabel("fetching...", this);
QFont mFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mFont.setPointSize(m_installFile->font().pointSize());
m_installFile->setFont(mFont);
formLayout->addRow(labelText, m_installFile);
QHBoxLayout* buttonLayout = new QHBoxLayout(this);
QPushButton* b1 = new QPushButton("Install In Applications", this);
b1->setEnabled(false);
buttonLayout->addWidget(b1);
QPushButton* b2 = new QPushButton("Just Download", this);
b2->setEnabled(false);
buttonLayout->addWidget(b2);
formLayout->addRow(buttonLayout);
}

View File

@ -0,0 +1,29 @@
#ifndef GUI_SYSINSTALLREPORT_HPP
#define GUI_SYSINSTALLREPORT_HPP
#include <QWidget>
#include <QLabel>
class SysInstallReport : public QWidget
{
Q_OBJECT
QLabel* m_installFile;
public:
SysInstallReport(QWidget* parent = Q_NULLPTR);
virtual QString installEntity() const { return QStringLiteral("Binary"); }
virtual QString installFile(int version, QString os, QString architecture, QString vectorISA,
QString extension) const
{
QString ret;
if (!extension.isEmpty())
ret.sprintf("urde-%d-%s-%s-%s.%s", version, os.toUtf8().data(), architecture.toUtf8().data(),
vectorISA.toUtf8().data(), extension.toUtf8().data());
else
ret.sprintf("urde-%d-%s-%s-%s", version, os.toUtf8().data(), architecture.toUtf8().data(),
vectorISA.toUtf8().data());
return ret;
}
};
#endif // GUI_SYSINSTALLREPORT_HPP

View File

@ -0,0 +1,227 @@
#include "SysReqTableView.hpp"
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
#include <QHeaderView>
#if _WIN32
#else
#include <unistd.h>
#endif
#if __APPLE__
#include "MacOSSystemVersion.hpp"
#endif
SysReqTableModel::SysReqTableModel(QObject* parent)
: QAbstractTableModel(parent)
{
int regs[4] = {};
zeus::getCpuInfo(0, regs);
if (regs[0] >= 0x16)
{
zeus::getCpuInfo(0x16, regs);
m_cpuSpeed = uint64_t(regs[0]);
}
m_cpuSpeedStr.sprintf("%g GHz", m_cpuSpeed / 1000.f);
#if _WIN32
#else
m_memorySize = uint64_t(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE);
#endif
m_memorySizeStr.sprintf("%g GB", m_memorySize / 1024.f / 1024.f / 1024.f);
#ifdef __APPLE__
GetMacOSSystemVersion(m_macosMajor, m_macosMinor, m_macosPatch);
if (m_macosPatch == 0)
m_osVersion.sprintf("macOS %d.%d", m_macosMajor, m_macosMinor);
else
m_osVersion.sprintf("macOS %d.%d.%d", m_macosMajor, m_macosMinor, m_macosPatch);
#elif _WIN32
#else
m_is64Bit = sysconf(_SC_WORD_BIT) == 64;
#endif
}
int SysReqTableModel::rowCount(const QModelIndex& parent) const
{
return 5;
}
int SysReqTableModel::columnCount(const QModelIndex& parent) const
{
return 2;
}
QVariant SysReqTableModel::data(const QModelIndex& index, int role) const
{
if (role != Qt::DisplayRole && role != Qt::UserRole)
{
return {};
}
if (role == Qt::UserRole)
{
switch (index.row())
{
case 0:
return true;
case 1:
return m_cpuSpeed >= 1500;
case 2:
return m_memorySize >= 0x100000000;
case 3:
#ifdef __APPLE__
return m_macosMajor > 10 || m_macosMinor >= 9;
#else
return true;
#endif
}
}
else
{
if (index.column() == 0)
{
/* Recommended */
switch (index.row())
{
case 0:
#if ZEUS_ARCH_X86 || ZEUS_ARCH_X86_64
return QStringLiteral("x86, x86_64");
#else
return {};
#endif
case 1:
return QStringLiteral("1.5 GHz");
case 2:
return QStringLiteral("4 GB");
case 3:
#ifdef __APPLE__
return QStringLiteral("macOS 10.9");
#else
return {};
#endif
}
}
else if (index.column() == 1)
{
/* Your System */
switch (index.row())
{
case 0:
#if ZEUS_ARCH_X86 || ZEUS_ARCH_X86_64
return m_is64Bit ? QStringLiteral("x86_64") : QStringLiteral("x86");
#else
return {};
#endif
case 1:
return m_cpuSpeedStr;
case 2:
return m_memorySizeStr;
case 3:
return m_osVersion;
}
}
}
return {};
}
QVariant SysReqTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
{
return {};
}
if (orientation == Qt::Horizontal)
{
switch (section)
{
case 0:
default:
return QStringLiteral("Recommended");
case 1:
return QStringLiteral("Your System");
}
}
else
{
switch (section)
{
case 0:
default:
return QStringLiteral("Architecture");
case 1:
return QStringLiteral("CPU Speed");
case 2:
return QStringLiteral("Memory");
case 3:
return QStringLiteral("OS");
case 4:
return QStringLiteral("Vector ISA");
}
}
}
void SysReqTableView::paintEvent(QPaintEvent* e)
{
int tableWidth = columnWidth(0) + columnWidth(1);
int tableX = verticalHeader()->width() + columnViewportPosition(0);
int tableY = horizontalHeader()->height();
for (int i = 0; i < 4; ++i)
{
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 + rowViewportPosition(i), 0, rowHeight(i)));
pAnimation->setStartValue(QRect(tableX, tableY + rowViewportPosition(i), 0, rowHeight(i)));
pAnimation->setEndValue(QRect(tableX, tableY + rowViewportPosition(i), tableWidth, rowHeight(i)));
animation->start();
running = true;
}
if (animation->state() == QAbstractAnimation::State::Running)
pAnimation->setEndValue(QRect(tableX, tableY + rowViewportPosition(i), tableWidth, rowHeight(i)));
else
w->setGeometry(QRect(tableX, tableY + rowViewportPosition(i), tableWidth, rowHeight(i)));
}
QTableView::paintEvent(e);
}
SysReqTableView::SysReqTableView(QWidget* parent)
: QTableView(parent), m_vectorISATable(this)
{
setModel(&m_model);
setIndexWidget(m_model.index(4, 0), &m_vectorISATable);
setSpan(4, 0, 1, 2);
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setSelectionMode(QAbstractItemView::SelectionMode::NoSelection);
setFocusPolicy(Qt::NoFocus);
for (int i = 0; i < 4; ++i)
{
QWidget* w = new QWidget(this);
std::get<0>(m_backgroundWidgets[i]) = w;
QPalette pal = palette();
if (m_model.data(m_model.index(i, 0), Qt::UserRole).toBool())
pal.setColor(QPalette::Background, QColor::fromRgbF(0.f, 1.f, 0.f, 0.2f));
else
pal.setColor(QPalette::Background, 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(i * 100);
seq->addAnimation(animation);
}
}

View File

@ -0,0 +1,42 @@
#ifndef GUI_SYSREQTABLEVIEW_HPP
#define GUI_SYSREQTABLEVIEW_HPP
#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;
#if __APPLE__
int m_macosMajor = 0;
int m_macosMinor = 0;
int m_macosPatch = 0;
#endif
QString m_osVersion;
bool m_is64Bit = true;
public:
SysReqTableModel(QObject* parent = Q_NULLPTR);
int rowCount(const QModelIndex& parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
};
class SysReqTableView : public QTableView
{
Q_OBJECT
SysReqTableModel m_model;
VectorISATableView m_vectorISATable;
std::tuple<QWidget*, QSequentialAnimationGroup*, bool> m_backgroundWidgets[4] = {};
public:
SysReqTableView(QWidget* parent = Q_NULLPTR);
void paintEvent(QPaintEvent* e) Q_DECL_OVERRIDE;
};
#endif // GUI_SYSREQTABLEVIEW_HPP

View File

@ -0,0 +1,17 @@
#ifndef GUI_VECTORISATABLEMODEL_HPP
#define GUI_VECTORISATABLEMODEL_HPP
#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 { return 1; }
};
#endif // GUI_VECTORISATABLEMODEL_HPP

View File

@ -0,0 +1,86 @@
#ifndef GUI_VECTORISATABLEMODELINTEL_HPP
#define GUI_VECTORISATABLEMODELINTEL_HPP
#include "VectorISATableModel.hpp"
class VectorISATableModelIntel : public VectorISATableModel
{
Q_OBJECT
public:
VectorISATableModelIntel(QObject* parent = Q_NULLPTR) : VectorISATableModel(parent) {}
int columnCount(const QModelIndex &parent = QModelIndex()) const { return 7; }
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
{
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");
}
}
}
QString getISAString(int idx) const
{
switch (idx)
{
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("sse41");
case 5:
return QStringLiteral("avx");
case 6:
return QStringLiteral("avx2");
}
}
};
#endif // GUI_VECTORISATABLEMODELINTEL_HPP

View File

@ -0,0 +1,95 @@
#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(4);
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);
for (int j = m_maxISA + 1; j < m_model.columnCount({}); ++j)
width += columnWidth(j);
}
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)
{
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;
}
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::Background, QColor::fromRgbF(0.f, 1.f, 0.f, 0.2f));
else
pal.setColor(QPalette::Background, 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(4 * 100);
seq->addAnimation(animation);
}
}

View File

@ -0,0 +1,27 @@
#ifndef GUI_VECTORISATABLEVIEW_HPP
#define GUI_VECTORISATABLEVIEW_HPP
#include <QTableView>
#include <zeus/Math.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) Q_DECL_OVERRIDE;
QString getISAString() const { return m_model.getISAString(m_maxISA); }
};
#endif // GUI_VECTORISATABLEVIEW_HPP

View File

@ -1,9 +1,57 @@
#include <QGuiApplication>
#include <QApplication>
#include <QStyleFactory>
#include "MainWindow.hpp"
extern const size_t MAINICON_QT_SZ;
extern const uint8_t MAINICON_QT[];
static QIcon MakeAppIcon()
{
QIcon ret;
const uint8_t* ptr = MAINICON_QT;
for (int i = 0; i < 6; ++i)
{
uint32_t size = *reinterpret_cast<const uint32_t*>(ptr);
ptr += 4;
QPixmap pm;
pm.loadFromData(ptr, size);
ret.addPixmap(pm);
ptr += size;
}
return ret;
}
int main(int argc, char* argv[])
{
QGuiApplication a(argc, argv);
QApplication a(argc, argv);
a.setStyle(QStyleFactory::create("Fusion"));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
a.setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.setWindowIcon(MakeAppIcon());
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, QColor(53,53,53));
darkPalette.setColor(QPalette::Disabled, QPalette::Button, QColor(53,53,53,53));
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(255,255,255,120));
darkPalette.setColor(QPalette::BrightText, Qt::red);
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
a.setPalette(darkPalette);
MainWindow w;
w.show();
return a.exec();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,18 @@
include_directories(${LIBPNG_INCLUDE_DIR})
add_executable(mkqticon mkqticon.c)
target_link_libraries(mkqticon ${PNG_LIB} ${ZLIB_LIBRARIES})
macro(declare_qticon_target)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/hecl-gui/platforms/freedesktop/mainicon_qt.bin
COMMAND $<TARGET_FILE:mkqticon>
ARGS ${CMAKE_BINARY_DIR}/hecl-gui/platforms/freedesktop/mainicon_qt.bin
DEPENDS
${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop/128x128/apps/hecl.png
${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop/64x64/apps/hecl.png
${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop/48x48/apps/hecl.png
${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop/32x32/apps/hecl.png
${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop/16x16/apps/hecl.png
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hecl-gui/platforms/freedesktop
COMMENT "Generating mainicon_qt.bin")
bintoc(mainicon_qt.c ${CMAKE_BINARY_DIR}/hecl-gui/platforms/freedesktop/mainicon_qt.bin MAINICON_QT)
endmacro()

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=HECL
GenericName=Game Data Prep Tool
Comment=Prepare Game Data for URDE
Exec=hecl-gui
Icon=hecl
Terminal=false
Type=Application
Categories=Graphics;3DGraphics;

View File

@ -0,0 +1,71 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
static const int DIMS[] =
{
16,
32,
48,
64,
128,
256,
0
};
int main(int argc, char* argv[])
{
if (argc < 2)
{
fprintf(stderr, "Usage: makeqticon <out.bin>\n");
return 1;
}
FILE* ofp = fopen(argv[1], "wb");
if (!ofp)
{
fprintf(stderr, "'%s' is not able to be opened for writing as a regular file\n", argv[1]);
return 1;
}
char command[2048];
for (const int* d = DIMS ; *d != 0 ; ++d)
{
printf("Rendering main icon @%dx%d\n", *d, *d);
fflush(stdout);
snprintf(command, 2048, "%dx%d/apps/hecl.png", *d, *d);
FILE* fp = fopen(command, "rb");
if (!fp)
{
fprintf(stderr, "unable to open '%s' for reading\n", command);
fclose(ofp);
return 1;
}
fseek(fp, 0, SEEK_END);
uint32_t size = (uint32_t)ftell(fp);
fseek(fp, 0, SEEK_SET);
fwrite(&size, 1, 4, ofp);
uint8_t buf[1024];
while (size > 0)
{
long thisSize = size;
if (thisSize > 1024)
thisSize = 1024;
fread(buf, 1, (size_t)thisSize, fp);
fwrite(buf, 1, (size_t)thisSize, ofp);
size -= thisSize;
}
fclose(fp);
}
fclose(ofp);
return 0;
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>HECL</string>
<key>CFBundleGetInfoString</key>
<string>Version BETA</string>
<key>NSHumanReadableCopyright</key>
<string>2015-2017 Antidote / Jackoalan</string>
<key>CFBundleIconFile</key>
<string>mainicon.icns</string>
<key>CFBundleIdentifier</key>
<string>io.github.AxioDL.HECL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>HECL</string>
<key>CFBundleVersion</key>
<string>BETA</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,33 @@
#include "winver.h"
#define IDI_ICON1 101
IDI_ICON1 ICON DISCARDABLE "mainicon.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGS 0x0L
FILEFLAGSMASK 0x3fL
FILEOS 0x00040004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", "Antidote / Jackoalan"
VALUE "FileDescription", "HECL"
VALUE "FileVersion", "BETA"
VALUE "LegalCopyright", "Copyright (C) 2015-2017 Antidote / Jackoalan"
VALUE "InternalName", "urde"
VALUE "OriginalFilename", "hecl.exe"
VALUE "ProductName", "HECL"
VALUE "ProductVersion", "BETA"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB