diff --git a/hecl-gui/CMakeLists.txt b/hecl-gui/CMakeLists.txt index 1d565529d..a375ebb1b 100644 --- a/hecl-gui/CMakeLists.txt +++ b/hecl-gui/CMakeLists.txt @@ -5,6 +5,7 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) find_package(Qt5Widgets) +find_package(Qt5Network) if(APPLE) set(PLAT_SRCS MacOSSystemVersion.hpp MacOSSystemVersion.mm) @@ -30,10 +31,10 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE SysReqTableView.hpp SysReqTableView.cpp VectorISATableView.hpp VectorISATableView.cpp VectorISATableModel.hpp VectorISATableModelIntel.hpp - SysInstallReport.hpp SysInstallReport.cpp - ${PLAT_SRCS} main.cpp) + DownloadManager.hpp DownloadManager.cpp + Common.hpp Common.cpp ${PLAT_SRCS} main.cpp) 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) +target_link_libraries(hecl-gui ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${PLAT_LIBS} zeus) diff --git a/hecl-gui/Common.cpp b/hecl-gui/Common.cpp new file mode 100644 index 000000000..ece4caf35 --- /dev/null +++ b/hecl-gui/Common.cpp @@ -0,0 +1,102 @@ +#include "Common.hpp" + +#if __APPLE__ +const QString CurPlatformString = QStringLiteral("macos"); +#elif _WIN32 +const QString CurPlatformString = QStringLiteral("win32"); +#elif __linux__ +const QString CurPlatformString = QStringLiteral("linux"); +#else +#error HECL does not know which OS to fetch for +#endif + +QString PlatformToString(Platform plat) +{ + switch (plat) + { + case Platform::MacOS: + return QStringLiteral("macos"); + case Platform::Win32: + return QStringLiteral("win32"); + case Platform::Linux: + return QStringLiteral("linux"); + default: + return QString(); + } +} + +#if ZEUS_ARCH_X86_64 +const QString CurArchitectureString = QStringLiteral("x86_64"); +#elif ZEUS_ARCH_X86 +const QString CurArchitectureString = QStringLiteral("x86"); +#elif ZEUS_ARCH_ARM +const QString CurArchitectureString = QStringLiteral("arm"); +#elif ZEUS_ARCH_AARCH64 +const QString CurArchitectureString = QStringLiteral("aarch64"); +#else +#error HECL does not know which architecture to fetch for +#endif + +Platform StringToPlatform(const QString& str) +{ + for (int i = 1; i < int(Platform::MAXPlatform); ++i) + if (str.contains(PlatformToString(Platform(i)), Qt::CaseInsensitive)) + return Platform(i); + return Platform::Invalid; +} + +QString ArchitectureToString(Architecture arch) +{ + switch (arch) + { + case Architecture::X86: + return QStringLiteral("x86"); + case Architecture::X86_64: + return QStringLiteral("x86_64"); + case Architecture::ARM: + return QStringLiteral("arm"); + case Architecture::AARCH64: + return QStringLiteral("aarch64"); + default: + return QString(); + } +} + +Architecture StringToArchitecture(const QString& str) +{ + for (int i = 1; i < int(Architecture::MAXArchitecture); ++i) + if (str.contains(ArchitectureToString(Architecture(i)), Qt::CaseInsensitive)) + return Architecture(i); + return Architecture::Invalid; +} + +QString VectorISAToString(VectorISA visa) +{ + switch (visa) + { + case VectorISA::X87: + return QStringLiteral("x87"); + case VectorISA::SSE: + return QStringLiteral("sse"); + case VectorISA::SSE2: + return QStringLiteral("sse2"); + case VectorISA::SSE3: + return QStringLiteral("sse3"); + case VectorISA::SSE41: + return QStringLiteral("sse41"); + case VectorISA::AVX: + return QStringLiteral("avx"); + case VectorISA::AVX2: + return QStringLiteral("avx2"); + default: + return QString(); + } +} + +VectorISA StringToVectorISA(const QString& str) +{ + for (int i = 1; i < int(VectorISA::MAXVectorISA); ++i) + if (str.contains(VectorISAToString(VectorISA(i)), Qt::CaseInsensitive)) + return VectorISA(i); + return VectorISA::Invalid; +} diff --git a/hecl-gui/Common.hpp b/hecl-gui/Common.hpp new file mode 100644 index 000000000..3f70e6b03 --- /dev/null +++ b/hecl-gui/Common.hpp @@ -0,0 +1,77 @@ +#ifndef GUI_COMMON_HPP +#define GUI_COMMON_HPP + +#include +#include "zeus/Math.hpp" + +enum class Platform +{ + Invalid, + MacOS, + Win32, + Linux, + MAXPlatform +}; +QString PlatformToString(Platform plat); +Platform StringToPlatform(const QString& str); + +#if __APPLE__ +constexpr Platform CurPlatform = Platform::MacOS; +#elif _WIN32 +constexpr Platform CurPlatform = Platform::Win32; +#elif __linux__ +constexpr Platform CurPlatform = Platform::Linux; +#endif + +extern const QString CurPlatformString; + +enum class Architecture +{ + Invalid, + X86, + X86_64, + ARM, + AARCH64, + MAXArchitecture +}; +QString ArchitectureToString(Architecture arch); +Architecture StringToArchitecture(const QString& str); + +#if ZEUS_ARCH_X86_64 +constexpr Architecture CurArchitecture = Architecture::X86_64; +#elif ZEUS_ARCH_X86 +constexpr Architecture CurArchitecture = Architecture::X86; +#elif ZEUS_ARCH_ARM +constexpr Architecture CurArchitecture = Architecture::ARM; +#elif ZEUS_ARCH_AARCH64 +constexpr Architecture CurArchitecture = Architecture::AARCH64; +#endif + +extern const QString CurArchitectureString; + +enum class VectorISA +{ + Invalid, + X87, + SSE, + SSE2, + SSE3, + SSE41, + AVX, + AVX2, + MAXVectorISA +}; +QString VectorISAToString(VectorISA visa); +VectorISA StringToVectorISA(const QString& str); + +class URDEVersion +{ + int m_version = -1; + VectorISA m_vectorISA; +public: + explicit URDEVersion(const QString& filename); + bool isValid() const { return m_version >= 0; } + +}; + +#endif // GUI_COMMON_HPP diff --git a/hecl-gui/DownloadManager.cpp b/hecl-gui/DownloadManager.cpp new file mode 100644 index 000000000..32b9e736b --- /dev/null +++ b/hecl-gui/DownloadManager.cpp @@ -0,0 +1,166 @@ +#include "DownloadManager.hpp" +#include "Common.hpp" + +static const char AxioDLPublicKeyPEM[] = +"-----BEGIN PUBLIC KEY-----\n" +"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvtshImzoP1a++9P5RK0k\n" +"btTOpwie7O7S/wWFZxwwbMezEPhjw2uu86TPqJe3P/1v+6xRKrEf9zFn/sKNygvD\n" +"bO64ZkJre4M46IYd0XxwIhiu7PBR+13CD+fqbrbYwPkoG090CP4MtZZN6mt5NAKB\n" +"QHoIj0wV5K/jJE9cBQxViwOqrxK05Cl/ivy0gRtpL7Ot6S+QHL3++rb6U2hWydIQ\n" +"kS+ucufKCIL77RcDwAc9vwNvzxf9EUU2pmq+EsEtLgRw3fR6BInoltOI8P9X5Wo6\n" +"/skeg92xZA++vv0neq5gjjDfa2A1zDgJRysz3Xps/AMlLOe55XCzXse9BpvChT+Z\n" +"pwIDAQAB\n" +"-----END PUBLIC KEY-----\n"; + +static const QSslKey AxioDLPublicKey = + QSslKey({AxioDLPublicKeyPEM}, QSsl::Rsa, QSsl::Pem, QSsl::PublicKey); + +void DownloadManager::_validateCert(QNetworkReply* reply) +{ + QSslCertificate peerCert = reply->sslConfiguration().peerCertificate(); + if (peerCert.publicKey() != AxioDLPublicKey) + { + auto cn = peerCert.subjectInfo(QSslCertificate::CommonName); + if (!cn.empty()) + setError(QNetworkReply::SslHandshakeFailedError, + QStringLiteral("Certificate pinning mismatch \"") + cn.first() + "\""); + else + setError(QNetworkReply::SslHandshakeFailedError, + QStringLiteral("Certificate pinning mismatch")); + reply->abort(); + } +} + +static const QString Domain = QStringLiteral("https://releases.axiodl.com/"); +static const QString Index = QStringLiteral("index.txt"); + +void DownloadManager::fetchIndex() +{ + if (m_indexInProgress) + return; + + resetError(); + + QString url = Domain + CurPlatformString + '/' + Index; + m_indexInProgress = m_netManager.get(QNetworkRequest(url)); + connect(m_indexInProgress, SIGNAL(finished()), + this, SLOT(indexFinished())); + connect(m_indexInProgress, SIGNAL(error(QNetworkReply::NetworkError)), + this, SLOT(indexError(QNetworkReply::NetworkError))); + connect(m_indexInProgress, SIGNAL(encrypted()), + this, SLOT(indexValidateCert())); +} + +void DownloadManager::fetchBinary(const QString& str, const QString& outPath) +{ + if (m_binaryInProgress) + return; + + resetError(); + m_outPath = outPath; + + QString url = Domain + CurPlatformString + '/' + str; + m_binaryInProgress = m_netManager.get(QNetworkRequest(url)); + connect(m_binaryInProgress, SIGNAL(finished()), + this, SLOT(binaryFinished())); + connect(m_binaryInProgress, SIGNAL(error(QNetworkReply::NetworkError)), + this, SLOT(binaryError(QNetworkReply::NetworkError))); + connect(m_binaryInProgress, SIGNAL(encrypted()), + this, SLOT(binaryValidateCert())); + connect(m_binaryInProgress, SIGNAL(downloadProgress(qint64, qint64)), + this, SLOT(binaryDownloadProgress(qint64, qint64))); + + if (m_progBar) + { + m_progBar->setEnabled(true); + m_progBar->setValue(0); + } +} + +void DownloadManager::indexFinished() +{ + if (m_hasError) + return; + + QStringList files; + + while (true) + { + if (m_indexInProgress->atEnd()) + break; + QByteArray line = m_indexInProgress->readLine(); + if (line.isEmpty()) + continue; + files.push_back(QString::fromUtf8(line).trimmed()); + } + + if (m_indexCompletionHandler) + m_indexCompletionHandler(files); + + m_indexInProgress->deleteLater(); + m_indexInProgress = nullptr; +} + +void DownloadManager::indexError(QNetworkReply::NetworkError error) +{ + setError(error, m_indexInProgress->errorString()); + m_indexInProgress->deleteLater(); + m_indexInProgress = nullptr; +} + +void DownloadManager::indexValidateCert() +{ + _validateCert(m_indexInProgress); +} + +void DownloadManager::binaryFinished() +{ + if (m_hasError) + return; + + if (m_progBar) + m_progBar->setValue(100); + + QFile fp(m_outPath); + if (!fp.open(QIODevice::WriteOnly)) + { + setError(QNetworkReply::ContentAccessDenied, fp.errorString()); + m_binaryInProgress->deleteLater(); + m_binaryInProgress = nullptr; + return; + } + fp.write(m_binaryInProgress->readAll()); + fp.close(); + + if (m_completionHandler) + m_completionHandler(m_outPath); + + m_binaryInProgress->deleteLater(); + m_binaryInProgress = nullptr; +} + +void DownloadManager::binaryError(QNetworkReply::NetworkError error) +{ + setError(error, m_binaryInProgress->errorString()); + m_binaryInProgress->deleteLater(); + m_binaryInProgress = nullptr; + + if (m_progBar) + m_progBar->setEnabled(false); +} + +void DownloadManager::binaryValidateCert() +{ + _validateCert(m_binaryInProgress); +} + +void DownloadManager::binaryDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) +{ + if (m_progBar) + { + if (bytesReceived == bytesTotal) + m_progBar->setValue(100); + else + m_progBar->setValue(int(bytesReceived * 100 / bytesTotal)); + } +} diff --git a/hecl-gui/DownloadManager.hpp b/hecl-gui/DownloadManager.hpp new file mode 100644 index 000000000..cf1e8608a --- /dev/null +++ b/hecl-gui/DownloadManager.hpp @@ -0,0 +1,69 @@ +#ifndef GUI_DOWNLOADMANAGER_HPP +#define GUI_DOWNLOADMANAGER_HPP + +#include +#include +#include +#include +#include + +class DownloadManager : public QObject +{ + Q_OBJECT + QNetworkAccessManager m_netManager; + QNetworkReply* m_indexInProgress = nullptr; + QNetworkReply* m_binaryInProgress = nullptr; + QString m_outPath; + bool m_hasError = false; + QProgressBar* m_progBar = nullptr; + QLabel* m_errorLabel = nullptr; + std::function m_indexCompletionHandler; + std::function m_completionHandler; + + void resetError() + { + m_hasError = false; + if (m_errorLabel) + m_errorLabel->setText(QString()); + } + + void setError(QNetworkReply::NetworkError error, const QString& errStr) + { + if (m_hasError && error == QNetworkReply::OperationCanceledError) + return; + m_hasError = true; + if (m_errorLabel) + m_errorLabel->setText(errStr); + } + + void _validateCert(QNetworkReply* reply); + +public: + explicit DownloadManager(QObject* parent = Q_NULLPTR) + : QObject(parent), m_netManager(this) {} + void connectWidgets(QProgressBar* progBar, QLabel* errorLabel, + std::function&& indexCompletionHandler, + std::function&& completionHandler) + { + m_progBar = progBar; + m_errorLabel = errorLabel; + m_indexCompletionHandler = std::move(indexCompletionHandler); + m_completionHandler = std::move(completionHandler); + } + void fetchIndex(); + void fetchBinary(const QString& str, const QString& outPath); + bool hasError() const { return m_hasError; } + +public slots: + void indexFinished(); + void indexError(QNetworkReply::NetworkError error); + void indexValidateCert(); + + void binaryFinished(); + void binaryError(QNetworkReply::NetworkError error); + void binaryValidateCert(); + void binaryDownloadProgress(qint64 bytesReceived, qint64 bytesTotal); + +}; + +#endif // GUI_DOWNLOADMANAGER_HPP diff --git a/hecl-gui/MainWindow.cpp b/hecl-gui/MainWindow.cpp index 4d3acfdb7..33d95d5c2 100644 --- a/hecl-gui/MainWindow.cpp +++ b/hecl-gui/MainWindow.cpp @@ -11,12 +11,26 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow) , m_heclProc(this) + , m_dlManager(this) { m_ui->setupUi(this); m_ui->heclTabs->setCurrentIndex(0); m_ui->splitter->setSizes({0,-1}); + m_ui->aboutIcon->setPixmap(QApplication::windowIcon().pixmap(256, 256)); + + QFont mFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + mFont.setPointSize(m_ui->currentBinaryLabel->font().pointSize()); + m_ui->currentBinaryLabel->setFont(mFont); + m_ui->recommendedBinaryLabel->setFont(mFont); + + m_dlManager.connectWidgets(m_ui->downloadProgressBar, m_ui->downloadErrorLabel, + std::bind(&MainWindow::onIndexDownloaded, this, std::placeholders::_1), + std::bind(&MainWindow::onBinaryDownloaded, this, std::placeholders::_1)); + initSlots(); + + m_dlManager.fetchIndex(); } MainWindow::~MainWindow() @@ -546,6 +560,19 @@ void MainWindow::onReturnPressed() m_path = m_ui->pathEdit->text(); } +void MainWindow::onIndexDownloaded(const QStringList& index) +{ + m_ui->binaryComboBox->clear(); + for (const QString& str : index) + m_ui->binaryComboBox->addItem(str); + m_ui->binaryComboBox->setEnabled(true); +} + +void MainWindow::onBinaryDownloaded(const QString& file) +{ + +} + void MainWindow::initSlots() { #ifdef Q_OS_WIN diff --git a/hecl-gui/MainWindow.hpp b/hecl-gui/MainWindow.hpp index b1eb66d2a..8db11631c 100644 --- a/hecl-gui/MainWindow.hpp +++ b/hecl-gui/MainWindow.hpp @@ -4,6 +4,7 @@ #include #include #include +#include "DownloadManager.hpp" class QTextEdit; class QTextCharFormat; @@ -18,6 +19,7 @@ class MainWindow : public QMainWindow QString m_ansiString; QString m_path; QProcess m_heclProc; + DownloadManager m_dlManager; public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); @@ -28,6 +30,8 @@ private slots: void onReturnPressed(); private: void initSlots(); + void onIndexDownloaded(const QStringList& index); + void onBinaryDownloaded(const QString& file); }; #endif // MAINWINDOW_HPP diff --git a/hecl-gui/MainWindow.ui b/hecl-gui/MainWindow.ui index 2e2cc400f..0e4a87948 100644 --- a/hecl-gui/MainWindow.ui +++ b/hecl-gui/MainWindow.ui @@ -260,8 +260,96 @@ p, li { white-space: pre-wrap; } System Check - - + + + + 12 + + + + + Recommended URDE Binary: + + + + + + + fetching... + + + + + + + Downloaded URDE Binary: + + + + + + + fetching... + + + + + + + + + false + + + 0 + + + + + + + Qt::Vertical + + + + + + + + + false + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + false + + + + 0 + 0 + + + + Download + + + + @@ -351,18 +439,49 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 164 + 166 + 168 + + + + + - - - 20 - 40 - + + - + @@ -371,35 +490,6 @@ p, li { white-space: pre-wrap; } &About - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p align="center"><span style=" font-size:x-large; font-weight:600;">About HECL Frontend</span></p><p align="center"><br/>The hecl frontend UI is designed and built by <a href="https://axiodl.com">Axiomatic Data</a> Copyright 2017 <br/><br/><span style=" font-weight:600;">Authors:</span><br/>Phillip &quot;Antidote&quot; Stephens<br/>Jack &quot;jackoalan&quot; Andersen<br/><span style=" font-weight:600;">License:</span></p><pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The MIT License</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Copyright (c) 2015-2017 URDE Contributors</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Permission is hereby granted, free of charge, to any person obtaining a copy</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">of this software and associated documentation files (the &quot;Software&quot;), to deal</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">in the Software without restriction, including without limitation the rights</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">copies of the Software, and to permit persons to whom the Software is</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">furnished to do so, subject to the following conditions:</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The above copyright notice and this permission notice shall be included in all</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">copies or substantial portions of the Software.</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></pre><pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">SOFTWARE.</span></pre></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - @@ -429,9 +519,21 @@ p, li { white-space: pre-wrap; } 128 + + + 128 + 128 + + Icon + + true + + + 16 + @@ -449,6 +551,35 @@ p, li { white-space: pre-wrap; } + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p align="center"><span style=" font-size:x-large; font-weight:600;">About HECL Frontend</span></p><p align="center"><br/>The hecl frontend UI is designed and built by <a href="https://axiodl.com"><span style=" text-decoration: underline; color:#007af4;">Axiomatic Data</span></a> Copyright 2017 <br/><br/><span style=" font-weight:600;">Authors:</span><br/>Phillip &quot;Antidote&quot; Stephens<br/>Jack &quot;jackoalan&quot; Andersen</p><pre style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The MIT License</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Copyright (c) 2015-2017 URDE Contributors</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Original Authors: Jack Andersen and Phillip &quot;Antidote&quot; Stephens</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">Permission is hereby granted, free of charge, to any person obtaining a copy</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">of this software and associated documentation files (the &quot;Software&quot;), to deal</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">in the Software without restriction, including without limitation the rights</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">copies of the Software, and to permit persons to whom the Software is</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">furnished to do so, subject to the following conditions:</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">The above copyright notice and this permission notice shall be included in all</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">copies or substantial portions of the Software.</span></pre><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New';"><br/></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></pre><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></pre><pre style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New';">SOFTWARE.</span></pre></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + @@ -476,12 +607,6 @@ p, li { white-space: pre-wrap; } QTableView
SysReqTableView.hpp
- - SysInstallReport - QWidget -
SysInstallReport.hpp
- 1 -
diff --git a/hecl-gui/SysInstallReport.cpp b/hecl-gui/SysInstallReport.cpp deleted file mode 100644 index 6ec9aa37b..000000000 --- a/hecl-gui/SysInstallReport.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "SysInstallReport.hpp" -#include -#include -#include - -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); -} diff --git a/hecl-gui/SysInstallReport.hpp b/hecl-gui/SysInstallReport.hpp deleted file mode 100644 index 5b87e6390..000000000 --- a/hecl-gui/SysInstallReport.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GUI_SYSINSTALLREPORT_HPP -#define GUI_SYSINSTALLREPORT_HPP - -#include -#include - -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 diff --git a/hecl-gui/VectorISATableModelIntel.hpp b/hecl-gui/VectorISATableModelIntel.hpp index 61245d8cd..08cffe998 100644 --- a/hecl-gui/VectorISATableModelIntel.hpp +++ b/hecl-gui/VectorISATableModelIntel.hpp @@ -60,25 +60,26 @@ public: } } - QString getISAString(int idx) const + VectorISA getISA(int idx) const { switch (idx) { - case 0: default: - return QStringLiteral("x87"); + return VectorISA::Invalid; + case 0: + return VectorISA::X87; case 1: - return QStringLiteral("sse"); + return VectorISA::SSE; case 2: - return QStringLiteral("sse2"); + return VectorISA::SSE2; case 3: - return QStringLiteral("sse3"); + return VectorISA::SSE3; case 4: - return QStringLiteral("sse41"); + return VectorISA::SSE41; case 5: - return QStringLiteral("avx"); + return VectorISA::AVX; case 6: - return QStringLiteral("avx2"); + return VectorISA::AVX2; } } }; diff --git a/hecl-gui/VectorISATableView.hpp b/hecl-gui/VectorISATableView.hpp index 04a88a3fd..745f0c696 100644 --- a/hecl-gui/VectorISATableView.hpp +++ b/hecl-gui/VectorISATableView.hpp @@ -2,7 +2,7 @@ #define GUI_VECTORISATABLEVIEW_HPP #include -#include +#include "Common.hpp" #if ZEUS_ARCH_X86_64 || ZEUS_ARCH_X86 #include "VectorISATableModelIntel.hpp" @@ -21,7 +21,7 @@ class VectorISATableView : public QTableView public: VectorISATableView(QWidget* parent = Q_NULLPTR); void paintEvent(QPaintEvent* e) Q_DECL_OVERRIDE; - QString getISAString() const { return m_model.getISAString(m_maxISA); } + VectorISA getISA() const { return m_model.getISA(m_maxISA); } }; #endif // GUI_VECTORISATABLEVIEW_HPP diff --git a/hecl-gui/main.cpp b/hecl-gui/main.cpp index 22f931ac8..7fdf8e8bc 100644 --- a/hecl-gui/main.cpp +++ b/hecl-gui/main.cpp @@ -38,10 +38,12 @@ int main(int argc, char* argv[]) 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::Disabled, QPalette::Base, QColor(25,25,25,53)); 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::Disabled, QPalette::Text, QColor(255,255,255,120)); 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); @@ -49,6 +51,7 @@ int main(int argc, char* argv[]) 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::Disabled, QPalette::Highlight, QColor(42, 130, 218, 53)); darkPalette.setColor(QPalette::HighlightedText, Qt::black); a.setPalette(darkPalette);