From 32ba74db0882093e31d40c575efae7e21079d89f Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 19 Mar 2021 00:31:34 -0400 Subject: [PATCH] Add Continuous track, disable zip downloading Opens update links in browser until new auto-update is implemented --- hecl-gui/Common.cpp | 28 +- hecl-gui/DownloadManager.cpp | 6 + hecl-gui/DownloadManager.hpp | 6 + hecl-gui/MainWindow.cpp | 71 +++-- hecl-gui/MainWindow.hpp | 4 +- hecl-gui/MainWindow.ui | 582 ++++++++++++++++++----------------- 6 files changed, 361 insertions(+), 336 deletions(-) diff --git a/hecl-gui/Common.cpp b/hecl-gui/Common.cpp index 6e1cc1073..115994b64 100644 --- a/hecl-gui/Common.cpp +++ b/hecl-gui/Common.cpp @@ -128,21 +128,21 @@ URDEVersion::URDEVersion(const QString& filename) { } } if (state == architecture) { - state = vectorISA; + state = extra; Architecture archValue = StringToArchitecture(list[i]); if (archValue != Architecture::Invalid) { m_architecture = archValue; continue; } } - if (state == vectorISA) { - state = extra; - VectorISA isa = StringToVectorISA(list[i]); - if (isa != VectorISA::Invalid) { - m_vectorISA = isa; - continue; - } - } +// if (state == vectorISA) { +// state = extra; +// VectorISA isa = StringToVectorISA(list[i]); +// if (isa != VectorISA::Invalid) { +// m_vectorISA = isa; +// continue; +// } +// } m_extra += QLatin1Char('-') + list[i]; } } @@ -153,13 +153,11 @@ QString URDEVersion::fileString(bool withExtension) const { } if (withExtension && !m_extension.isEmpty()) { - return QStringLiteral("urde-%1-%2-%3-%4%5%6") - .arg(m_version, PlatformToString(m_platform), ArchitectureToString(m_architecture), - VectorISAToString(m_vectorISA), m_extra, m_extension); + return QStringLiteral("urde-%1-%2-%3%4%5") + .arg(m_version, PlatformToString(m_platform), ArchitectureToString(m_architecture), m_extra, m_extension); } else { - return QStringLiteral("urde-%1-%2-%3-%4%5") - .arg(m_version, PlatformToString(m_platform), ArchitectureToString(m_architecture), - VectorISAToString(m_vectorISA), m_extra); + return QStringLiteral("urde-%1-%2-%3%4") + .arg(m_version, PlatformToString(m_platform), ArchitectureToString(m_architecture), m_extra); } } diff --git a/hecl-gui/DownloadManager.cpp b/hecl-gui/DownloadManager.cpp index ade55a7eb..dca11f9b8 100644 --- a/hecl-gui/DownloadManager.cpp +++ b/hecl-gui/DownloadManager.cpp @@ -2,6 +2,8 @@ #include "Common.hpp" #include +#include + #define KEY_PINNING 0 #if KEY_PINNING @@ -77,6 +79,7 @@ void DownloadManager::fetchBinary(const QString& str, const QString& outPath) { const QString track = QSettings().value(QStringLiteral("update_track")).toString(); const auto url = QUrl(QStringLiteral("%1%2/%3/%4").arg(Domain, track, CurPlatformString, str)); +#if PLATFORM_ZIP_DOWNLOAD m_binaryInProgress = m_netManager.get(QNetworkRequest(url)); connect(m_binaryInProgress, &QNetworkReply::finished, this, &DownloadManager::binaryFinished); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) @@ -92,6 +95,9 @@ void DownloadManager::fetchBinary(const QString& str, const QString& outPath) { m_progBar->setEnabled(true); m_progBar->setValue(0); } +#else + QDesktopServices::openUrl(url); +#endif } void DownloadManager::indexFinished() { diff --git a/hecl-gui/DownloadManager.hpp b/hecl-gui/DownloadManager.hpp index d28412a09..03186d498 100644 --- a/hecl-gui/DownloadManager.hpp +++ b/hecl-gui/DownloadManager.hpp @@ -6,6 +6,12 @@ #include #include +//#if _WIN32 +//#define PLATFORM_ZIP_DOWNLOAD 1 +//#else +#define PLATFORM_ZIP_DOWNLOAD 0 +//#endif + class QuaZip; class DownloadManager : public QObject { diff --git a/hecl-gui/MainWindow.cpp b/hecl-gui/MainWindow.cpp index 848f8060a..f1cd3abc5 100644 --- a/hecl-gui/MainWindow.cpp +++ b/hecl-gui/MainWindow.cpp @@ -59,7 +59,7 @@ static void KillProcessTree(QProcess& proc) { } #endif -const QStringList MainWindow::skUpdateTracks = {QStringLiteral("stable"), QStringLiteral("dev")}; +const QStringList MainWindow::skUpdateTracks = {QStringLiteral("stable"), QStringLiteral("dev"), QStringLiteral("continuous")}; MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) @@ -73,7 +73,7 @@ MainWindow::MainWindow(QWidget* parent) m_settings.setValue(QStringLiteral("urde_arguments"), QStringList{QStringLiteral("--no-shader-warmup")}); } if (m_settings.value(QStringLiteral("update_track")).isNull()) { - m_settings.setValue(QStringLiteral("update_track"), QStringLiteral("stable")); + m_settings.setValue(QStringLiteral("update_track"), QStringLiteral("dev")); } m_ui->setupUi(this); @@ -108,16 +108,17 @@ 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); +// 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); + m_ui->continuousTrackWarning->setVisible(index == 2); m_ui->updateTrackComboBox->setCurrentIndex(index); connect(m_ui->updateTrackComboBox, qOverload(&QComboBox::currentIndexChanged), this, &MainWindow::onUpdateTrackChanged); @@ -126,6 +127,9 @@ MainWindow::MainWindow(QWidget* parent) std::bind(&MainWindow::onIndexDownloaded, this, std::placeholders::_1), std::bind(&MainWindow::onBinaryDownloaded, this, std::placeholders::_1), std::bind(&MainWindow::onBinaryFailed, this)); +#if !PLATFORM_ZIP_DOWNLOAD + m_ui->downloadProgressBar->hide(); +#endif initOptions(); initSlots(); @@ -282,17 +286,19 @@ void MainWindow::onIndexDownloaded(const QStringList& index) { } void MainWindow::onDownloadPressed() { - m_updateURDEButton->hide(); +// m_updateURDEButton->hide(); QString filename = m_ui->binaryComboBox->currentData().value().fileString(true); +#if PLATFORM_ZIP_DOWNLOAD disableOperations(); m_ui->downloadButton->setEnabled(false); +#endif m_dlManager.fetchBinary(filename, m_path + QLatin1Char{'/'} + filename); } -void MainWindow::onUpdateURDEPressed() { - m_ui->heclTabs->setCurrentIndex(2); - onDownloadPressed(); -} +//void MainWindow::onUpdateURDEPressed() { +// m_ui->heclTabs->setCurrentIndex(2); +// onDownloadPressed(); +//} void MainWindow::onBinaryDownloaded(QuaZip& file) { const bool err = !ExtractZip::extractDir(file, m_path); @@ -410,7 +416,7 @@ static bool GetDLPackage(const QString& path, QString& dlPackage) { } bool MainWindow::checkDownloadedBinary() { - m_updateURDEButton->hide(); +// m_updateURDEButton->hide(); m_urdePath = QString(); m_heclPath = QString(); @@ -422,24 +428,20 @@ bool MainWindow::checkDownloadedBinary() { return false; } -#if __APPLE__ - QString urdePath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/urde"); - QString heclPath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/hecl"); - QString visigenPath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/visigen"); -#elif _WIN32 - QString urdePath = m_path + QStringLiteral("/urde.exe"); - QString heclPath = m_path + QStringLiteral("/hecl.exe"); - QString visigenPath = m_path + QStringLiteral("/visigen.exe"); -#else - QString urdePath = m_path + QStringLiteral("/urde"); - QString heclPath = m_path + QStringLiteral("/hecl"); - QString visigenPath = m_path + QStringLiteral("/visigen"); + const QString dir = QApplication::instance()->applicationDirPath(); +#if _WIN32 + QString urdePath = dir + QStringLiteral("/urde.exe"); + QString heclPath = dir + QStringLiteral("/hecl.exe"); + QString visigenPath = dir + QStringLiteral("/visigen.exe"); if (!QFileInfo::exists(urdePath) || !QFileInfo::exists(heclPath) || !QFileInfo::exists(visigenPath)) { - const QString dir = QApplication::instance()->applicationDirPath(); - urdePath = dir + QStringLiteral("/urde"); - heclPath = dir + QStringLiteral("/hecl"); - visigenPath = dir + QStringLiteral("/visigen"); + urdePath = m_path + QStringLiteral("/urde.exe"); + heclPath = m_path + QStringLiteral("/hecl.exe"); + visigenPath = m_path + QStringLiteral("/visigen.exe"); } +#else + QString urdePath = dir + QStringLiteral("/urde"); + QString heclPath = dir + QStringLiteral("/hecl"); + QString visigenPath = dir + QStringLiteral("/visigen"); #endif urdePath = QFileInfo(urdePath).absoluteFilePath(); heclPath = QFileInfo(heclPath).absoluteFilePath(); @@ -451,9 +453,9 @@ 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(); - } +// if (m_recommendedVersion.isValid() && v.isValid() && m_recommendedVersion.getVersion() > v.getVersion()) { +// m_updateURDEButton->show(); +// } } else { m_ui->currentBinaryLabel->setText(tr("unknown -- re-download recommended")); } @@ -605,6 +607,7 @@ void MainWindow::onUpdateTrackChanged(int index) { m_settings.setValue(QStringLiteral("update_track"), skUpdateTracks[index]); m_dlManager.fetchIndex(); m_ui->devTrackWarning->setVisible(index == 1); + m_ui->continuousTrackWarning->setVisible(index == 2); } void MainWindow::initOptions() { diff --git a/hecl-gui/MainWindow.hpp b/hecl-gui/MainWindow.hpp index ae801a0e3..60c5df8e3 100644 --- a/hecl-gui/MainWindow.hpp +++ b/hecl-gui/MainWindow.hpp @@ -40,7 +40,7 @@ class MainWindow : public QMainWindow { QStringList m_warpSettings; QSettings m_settings; URDEVersion m_recommendedVersion; - QPushButton* m_updateURDEButton; +// QPushButton* m_updateURDEButton; bool m_inContinueNote = false; QStringListModel m_launchOptionsModel; @@ -61,7 +61,7 @@ private slots: void doHECLTerminate(); void onReturnPressed(); void onDownloadPressed(); - void onUpdateURDEPressed(); +// void onUpdateURDEPressed(); void onUpdateTrackChanged(int index); private: diff --git a/hecl-gui/MainWindow.ui b/hecl-gui/MainWindow.ui index 52e470e2b..3f3d46e6b 100644 --- a/hecl-gui/MainWindow.ui +++ b/hecl-gui/MainWindow.ui @@ -21,61 +21,6 @@ - - - - - - - 0 - 0 - - - - Extract Directory: - - - pathEdit - - - - - - - - 0 - 0 - - - - - 1 - 0 - - - - - - - - - 0 - 0 - - - - - 32 - 16777215 - - - - ... - - - - - @@ -299,15 +244,15 @@ - 3 + 2 0 0 - 225 - 186 + 236 + 198 @@ -450,8 +395,8 @@ 0 0 - 166 - 105 + 174 + 111 @@ -499,8 +444,8 @@ 0 0 - 164 - 47 + 450 + 633 @@ -510,7 +455,7 @@ - Variable Delta Time + Variable Delta Time (broken) @@ -535,7 +480,7 @@ 0 0 450 - 649 + 633 @@ -677,223 +622,6 @@ &System Check - - - - <html><head/><body><p><span style=" color:#ff0000;">Development Track selected!<br/>Development builds are considered unstable and may cause crashes. </span></p></body></html> - - - true - - - - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 255 - 47 - 0 - - - - - - - - - 164 - 166 - 168 - - - - - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 500 - 300 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 68 - 68 - 68 - - - - - - - - QAbstractItemView::NoSelection - - - - - - - false - - - 0 - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - 12 - - - - - Downloaded URDE Binary: - - - - - - - none - - - - - - - Recommended URDE Binary: - - - - - - - fetching... - - - - - - - Update Track: - - - - - - - - 0 - 0 - - - - - Stable - - - - - Development - - - - - - @@ -976,7 +704,236 @@ - + + + + + 0 + 0 + + + + + 500 + 300 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 68 + 68 + 68 + + + + + + + + QAbstractItemView::NoSelection + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + 12 + + + + + Downloaded URDE version: + + + + + + + none + + + + + + + Recommended URDE version: + + + + + + + fetching... + + + + + + + Update track: + + + + + + + + 0 + 0 + + + + + Stable + + + + + Development + + + + + Continuous + + + + + + + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 255 + 47 + 0 + + + + + + + + + 164 + 166 + 168 + + + + + + + + + + + true + + + + + + + <html><head/><body><p align="center"><span style=" color:#ff0000;">Continuous track selected!<br/>Continuous builds are built after every commit <br/>and have </span><span style=" font-weight:600; color:#ff0000;">no</span><span style=" color:#ff0000;"> guarantee of working at all.</span></p></body></html> + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + false + + + 0 + + + + + + + <html><head/><body><p align="center"><span style=" color:#1a5fb4;">Development track selected!<br/>Development builds are considered unstable and may cause crashes.</span></p></body></html> + + + true + + + + Qt::Vertical @@ -1247,7 +1204,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:10.5pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> <p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">About HECL Frontend</span></p> <p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />The HECL frontend UI is designed and built by </span><a href="https://axiodl.com"><span style=" font-family:'Noto Sans'; font-size:10pt; text-decoration: underline; color:#007af4;">Axiomatic Data Laboratories</span></a><span style=" font-family:'Noto Sans'; font-size:10pt;"> Copyright 2020<br /><br /></span><span style=" font-family:'Noto Sans'; font-size:10pt; font-weight:600;">Authors:</span><span style=" font-family:'Noto Sans'; font-size:10pt;"><br />Phillip &quot;Antidote&quot; Stephens<br />Jack &quot;jackoalan&quot; Andersen<br />Luke &quot;encounter&quot; Street</span></p> <p 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'; font-size:10pt;">The MIT License</span></p> @@ -1270,7 +1227,62 @@ p, li { white-space: pre-wrap; } - + + + + + + + 0 + 0 + + + + Extract Directory: + + + pathEdit + + + + + + + + 0 + 0 + + + + + 1 + 0 + + + + + + + + + 0 + 0 + + + + + 32 + 16777215 + + + + ... + + + + + + @@ -1359,7 +1371,7 @@ p, li { white-space: pre-wrap; } - + <center><h1 style="color:red">ALPHA VERSION</h1></center>