mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-08 22:05:53 +00:00
CMakeLists: Add Qt 5 type-safety compile definitions
Migrates the Qt compile definitions that were added to amuse over to the hecl GUI.
This commit is contained in:
parent
a86b98837d
commit
79e522a03e
@ -8,7 +8,7 @@ ArgumentEditor::ArgumentEditor(QWidget* parent)
|
|||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(std::make_unique<Ui::ArgumentEditor>()) {
|
, m_ui(std::make_unique<Ui::ArgumentEditor>()) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_model.setStringList(QSettings().value("urde_arguments").toStringList());
|
m_model.setStringList(QSettings().value(QStringLiteral("urde_arguments")).toStringList());
|
||||||
m_ui->argumentEditor->setModel(&m_model);
|
m_ui->argumentEditor->setModel(&m_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void ArgumentEditor::on_deleteButton_clicked() {
|
|||||||
void ArgumentEditor::on_buttonBox_clicked(QAbstractButton* button) {
|
void ArgumentEditor::on_buttonBox_clicked(QAbstractButton* button) {
|
||||||
QDialogButtonBox* buttonBox = qobject_cast<QDialogButtonBox*>(sender());
|
QDialogButtonBox* buttonBox = qobject_cast<QDialogButtonBox*>(sender());
|
||||||
if (button == buttonBox->button(QDialogButtonBox::Ok)) {
|
if (button == buttonBox->button(QDialogButtonBox::Ok)) {
|
||||||
QSettings().setValue("urde_arguments", m_model.stringList());
|
QSettings().setValue(QStringLiteral("urde_arguments"), m_model.stringList());
|
||||||
accept();
|
accept();
|
||||||
} else {
|
} else {
|
||||||
reject();
|
reject();
|
||||||
|
@ -48,6 +48,27 @@ add_executable(hecl-gui WIN32 MACOSX_BUNDLE
|
|||||||
${QUAZIP_SRCS}
|
${QUAZIP_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(hecl-gui PRIVATE
|
||||||
|
# Disable implicit conversions from ASCII to QString.
|
||||||
|
-DQT_NO_CAST_FROM_ASCII
|
||||||
|
-DQT_NO_CAST_TO_ASCII
|
||||||
|
|
||||||
|
# Disable implicit conversions of QByteArray to const char* or const void*
|
||||||
|
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||||
|
|
||||||
|
# Disable narrowing conversions in signal/slot connect() calls.
|
||||||
|
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
||||||
|
|
||||||
|
# Disable unsafe overloads of QProcess' start() function.
|
||||||
|
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START
|
||||||
|
|
||||||
|
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
|
||||||
|
-DQT_NO_URL_CAST_FROM_STRING
|
||||||
|
|
||||||
|
# Allows for more efficient string concatenation, resulting in less temporaries.
|
||||||
|
-DQT_USE_QSTRINGBUILDER
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(hecl-gui PRIVATE
|
target_link_libraries(hecl-gui PRIVATE
|
||||||
Qt5::Network
|
Qt5::Network
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
|
@ -92,32 +92,40 @@ VectorISA StringToVectorISA(const QString& str) {
|
|||||||
URDEVersion::URDEVersion(const QString& filename) {
|
URDEVersion::URDEVersion(const QString& filename) {
|
||||||
int idx;
|
int idx;
|
||||||
QString useFilename = filename;
|
QString useFilename = filename;
|
||||||
if ((idx = filename.indexOf('.')) >= 0) {
|
if ((idx = filename.indexOf(QLatin1Char{'.'})) >= 0) {
|
||||||
m_extension = QString(filename).remove(0, idx);
|
m_extension = QString(filename).remove(0, idx);
|
||||||
useFilename.truncate(idx);
|
useFilename.truncate(idx);
|
||||||
}
|
}
|
||||||
QStringList list = useFilename.split('-');
|
|
||||||
if (list.size() >= 2)
|
const QStringList list = useFilename.split(QLatin1Char{'-'});
|
||||||
|
if (list.size() >= 2) {
|
||||||
m_version = list[1].toInt();
|
m_version = list[1].toInt();
|
||||||
if (list.size() >= 3)
|
}
|
||||||
|
if (list.size() >= 3) {
|
||||||
m_platform = StringToPlatform(list[2]);
|
m_platform = StringToPlatform(list[2]);
|
||||||
if (list.size() >= 4)
|
}
|
||||||
|
if (list.size() >= 4) {
|
||||||
m_architecture = StringToArchitecture(list[3]);
|
m_architecture = StringToArchitecture(list[3]);
|
||||||
if (list.size() >= 5)
|
}
|
||||||
|
if (list.size() >= 5) {
|
||||||
m_vectorISA = StringToVectorISA(list[4]);
|
m_vectorISA = StringToVectorISA(list[4]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString URDEVersion::fileString(bool withExtension) const {
|
QString URDEVersion::fileString(bool withExtension) const {
|
||||||
if (m_version < 0)
|
if (m_version < 0) {
|
||||||
return {};
|
return {};
|
||||||
if (withExtension && !m_extension.isEmpty())
|
}
|
||||||
return QString("urde-%1-%2-%3-%4%5")
|
|
||||||
|
if (withExtension && !m_extension.isEmpty()) {
|
||||||
|
return QStringLiteral("urde-%1-%2-%3-%4%5")
|
||||||
.arg(QString::number(m_version), PlatformToString(m_platform), ArchitectureToString(m_architecture),
|
.arg(QString::number(m_version), PlatformToString(m_platform), ArchitectureToString(m_architecture),
|
||||||
VectorISAToString(m_vectorISA), m_extension);
|
VectorISAToString(m_vectorISA), m_extension);
|
||||||
else
|
} else {
|
||||||
return QString("urde-%1-%2-%3-%4")
|
return QStringLiteral("urde-%1-%2-%3-%4")
|
||||||
.arg(QString::number(m_version), PlatformToString(m_platform), ArchitectureToString(m_architecture),
|
.arg(QString::number(m_version), PlatformToString(m_platform), ArchitectureToString(m_architecture),
|
||||||
VectorISAToString(m_vectorISA));
|
VectorISAToString(m_vectorISA));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -32,12 +32,12 @@ void DownloadManager::_validateCert(QNetworkReply* reply) {
|
|||||||
QSslCertificate peerCert = reply->sslConfiguration().peerCertificate();
|
QSslCertificate peerCert = reply->sslConfiguration().peerCertificate();
|
||||||
QSslKey peerKey = peerCert.publicKey();
|
QSslKey peerKey = peerCert.publicKey();
|
||||||
if (peerKey != AxioDLPublicKey && peerKey != AxioDLEdgePublicKey) {
|
if (peerKey != AxioDLPublicKey && peerKey != AxioDLEdgePublicKey) {
|
||||||
auto cn = peerCert.subjectInfo(QSslCertificate::CommonName);
|
const auto cn = peerCert.subjectInfo(QSslCertificate::CommonName);
|
||||||
if (!cn.empty())
|
if (cn.empty()) {
|
||||||
setError(QNetworkReply::SslHandshakeFailedError,
|
setError(QNetworkReply::SslHandshakeFailedError, tr("Certificate pinning mismatch"));
|
||||||
QStringLiteral("Certificate pinning mismatch \"") + cn.first() + "\"");
|
} else {
|
||||||
else
|
setError(QNetworkReply::SslHandshakeFailedError, tr("Certificate pinning mismatch \"%1\"").arg(cn.first()));
|
||||||
setError(QNetworkReply::SslHandshakeFailedError, QStringLiteral("Certificate pinning mismatch"));
|
}
|
||||||
reply->abort();
|
reply->abort();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -47,12 +47,15 @@ static const QString Domain = QStringLiteral("https://releases.axiodl.com/");
|
|||||||
static const QString Index = QStringLiteral("index.txt");
|
static const QString Index = QStringLiteral("index.txt");
|
||||||
|
|
||||||
void DownloadManager::fetchIndex() {
|
void DownloadManager::fetchIndex() {
|
||||||
if (m_indexInProgress)
|
if (m_indexInProgress) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetError();
|
resetError();
|
||||||
QString track = QSettings().value("update_track").toString();
|
|
||||||
QString url = Domain + track + '/' + CurPlatformString + '/' + Index;
|
const QString track = QSettings().value(QStringLiteral("update_track")).toString();
|
||||||
|
const auto url = QUrl(QStringLiteral("%1%2/%3/%4").arg(Domain, track, CurPlatformString, Index));
|
||||||
|
|
||||||
m_indexInProgress = m_netManager.get(QNetworkRequest(url));
|
m_indexInProgress = m_netManager.get(QNetworkRequest(url));
|
||||||
connect(m_indexInProgress, &QNetworkReply::finished, this, &DownloadManager::indexFinished);
|
connect(m_indexInProgress, &QNetworkReply::finished, this, &DownloadManager::indexFinished);
|
||||||
connect(m_indexInProgress, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this,
|
connect(m_indexInProgress, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this,
|
||||||
@ -61,14 +64,15 @@ void DownloadManager::fetchIndex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DownloadManager::fetchBinary(const QString& str, const QString& outPath) {
|
void DownloadManager::fetchBinary(const QString& str, const QString& outPath) {
|
||||||
if (m_binaryInProgress)
|
if (m_binaryInProgress) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetError();
|
resetError();
|
||||||
m_outPath = outPath;
|
m_outPath = outPath;
|
||||||
|
|
||||||
const QString track = QSettings().value("update_track").toString();
|
const QString track = QSettings().value(QStringLiteral("update_track")).toString();
|
||||||
const QString url = Domain + track + '/' + CurPlatformString + '/' + str;
|
const auto url = QUrl(QStringLiteral("%1%2/%3/%4").arg(Domain, track, CurPlatformString, str));
|
||||||
m_binaryInProgress = m_netManager.get(QNetworkRequest(url));
|
m_binaryInProgress = m_netManager.get(QNetworkRequest(url));
|
||||||
connect(m_binaryInProgress, &QNetworkReply::finished, this, &DownloadManager::binaryFinished);
|
connect(m_binaryInProgress, &QNetworkReply::finished, this, &DownloadManager::binaryFinished);
|
||||||
connect(m_binaryInProgress, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this,
|
connect(m_binaryInProgress, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this,
|
||||||
@ -121,7 +125,7 @@ void DownloadManager::binaryFinished() {
|
|||||||
QBuffer buff(&all);
|
QBuffer buff(&all);
|
||||||
QuaZip zip(&buff);
|
QuaZip zip(&buff);
|
||||||
if (!zip.open(QuaZip::mdUnzip)) {
|
if (!zip.open(QuaZip::mdUnzip)) {
|
||||||
setError(QNetworkReply::UnknownContentError, "Unable to open zip archive.");
|
setError(QNetworkReply::UnknownContentError, tr("Unable to open zip archive."));
|
||||||
m_binaryInProgress->deleteLater();
|
m_binaryInProgress->deleteLater();
|
||||||
m_binaryInProgress = nullptr;
|
m_binaryInProgress = nullptr;
|
||||||
return;
|
return;
|
||||||
|
@ -485,14 +485,14 @@ void ParseEscapeSequence(int attribute, QListIterator<QString>& i, QTextCharForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReturnInsert(QTextCursor& cur, const QString& text) {
|
void ReturnInsert(QTextCursor& cur, const QString& text) {
|
||||||
auto DoLine = [&](const QString& line) {
|
const auto DoLine = [&](const QString& line) {
|
||||||
auto DoReturn = [&](const QString& ret) {
|
const auto DoReturn = [&](const QString& ret) {
|
||||||
if (!ret.isEmpty()) {
|
if (!ret.isEmpty()) {
|
||||||
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
||||||
cur.insertText(ret);
|
cur.insertText(ret);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
QStringList list = line.split('\r');
|
const QStringList list = line.split(QLatin1Char{'\r'});
|
||||||
DoReturn(list.front());
|
DoReturn(list.front());
|
||||||
if (list.size() > 1) {
|
if (list.size() > 1) {
|
||||||
for (auto it = list.begin() + 1; it != list.end(); ++it) {
|
for (auto it = list.begin() + 1; it != list.end(); ++it) {
|
||||||
@ -503,9 +503,9 @@ void ReturnInsert(QTextCursor& cur, const QString& text) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
QStringList lineSplit = text.split("\r\n");
|
const QStringList lineSplit = text.split(QStringLiteral("\r\n"));
|
||||||
#else
|
#else
|
||||||
QStringList lineSplit = text.split('\n');
|
const QStringList lineSplit = text.split(QLatin1Char{'\n'});
|
||||||
#endif
|
#endif
|
||||||
DoLine(lineSplit.front());
|
DoLine(lineSplit.front());
|
||||||
if (lineSplit.size() > 1) {
|
if (lineSplit.size() > 1) {
|
||||||
@ -518,14 +518,14 @@ void ReturnInsert(QTextCursor& cur, const QString& text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReturnInsert(QTextCursor& cur, const QString& text, const QTextCharFormat& format) {
|
void ReturnInsert(QTextCursor& cur, const QString& text, const QTextCharFormat& format) {
|
||||||
auto DoLine = [&](const QString& line) {
|
const auto DoLine = [&](const QString& line) {
|
||||||
auto DoReturn = [&](const QString& ret) {
|
const auto DoReturn = [&](const QString& ret) {
|
||||||
if (!ret.isEmpty()) {
|
if (!ret.isEmpty()) {
|
||||||
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ret.size());
|
||||||
cur.insertText(ret, format);
|
cur.insertText(ret, format);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
QStringList list = line.split('\r');
|
const QStringList list = line.split(QLatin1Char{'\r'});
|
||||||
DoReturn(list.front());
|
DoReturn(list.front());
|
||||||
if (list.size() > 1) {
|
if (list.size() > 1) {
|
||||||
for (auto it = list.begin() + 1; it != list.end(); ++it) {
|
for (auto it = list.begin() + 1; it != list.end(); ++it) {
|
||||||
@ -536,9 +536,9 @@ void ReturnInsert(QTextCursor& cur, const QString& text, const QTextCharFormat&
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
QStringList lineSplit = text.split("\r\n");
|
const QStringList lineSplit = text.split(QStringLiteral("\r\n"));
|
||||||
#else
|
#else
|
||||||
QStringList lineSplit = text.split('\n');
|
const QStringList lineSplit = text.split(QLatin1Char{'\n'});
|
||||||
#endif
|
#endif
|
||||||
DoLine(lineSplit.front());
|
DoLine(lineSplit.front());
|
||||||
if (lineSplit.size() > 1) {
|
if (lineSplit.size() > 1) {
|
||||||
|
@ -66,7 +66,7 @@ bool ExtractZip::extractFile(QuaZip& zip, QString fileName, QString fileDest) {
|
|||||||
|
|
||||||
// Controllo esistenza cartella file risultato
|
// Controllo esistenza cartella file risultato
|
||||||
QDir curDir;
|
QDir curDir;
|
||||||
if (fileDest.endsWith('/')) {
|
if (fileDest.endsWith(QLatin1Char{'/'})) {
|
||||||
if (!curDir.mkpath(fileDest)) {
|
if (!curDir.mkpath(fileDest)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ bool ExtractZip::extractFile(QuaZip& zip, QString fileName, QString fileDest) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
QFile::Permissions srcPerm = info.getPermissions();
|
QFile::Permissions srcPerm = info.getPermissions();
|
||||||
if (fileDest.endsWith('/') && QFileInfo(fileDest).isDir()) {
|
if (fileDest.endsWith(QLatin1Char{'/'}) && QFileInfo(fileDest).isDir()) {
|
||||||
if (srcPerm != 0) {
|
if (srcPerm != 0) {
|
||||||
QFile(fileDest).setPermissions(srcPerm);
|
QFile(fileDest).setPermissions(srcPerm);
|
||||||
}
|
}
|
||||||
@ -125,15 +125,16 @@ bool ExtractZip::extractFile(QuaZip& zip, QString fileName, QString fileDest) {
|
|||||||
* * non si riesce a chiudere l'oggetto zip;
|
* * non si riesce a chiudere l'oggetto zip;
|
||||||
*/
|
*/
|
||||||
bool ExtractZip::extractDir(QuaZip& zip, QString dir) {
|
bool ExtractZip::extractDir(QuaZip& zip, QString dir) {
|
||||||
QDir directory(dir);
|
const QDir directory(dir);
|
||||||
if (!zip.goToFirstFile()) {
|
if (!zip.goToFirstFile()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
QString name = zip.getCurrentFileName();
|
const QString name = zip.getCurrentFileName();
|
||||||
QString absFilePath = directory.absoluteFilePath(name);
|
const QString absFilePath = directory.absoluteFilePath(name);
|
||||||
if (!extractFile(zip, "", absFilePath))
|
if (!extractFile(zip, {}, absFilePath)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
} while (zip.goToNextFile());
|
} while (zip.goToNextFile());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
extern hecl::CVar* hecl::com_developer;
|
extern hecl::CVar* hecl::com_developer;
|
||||||
|
|
||||||
LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
|
LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
|
||||||
: QMenu("Launch Menu", parent)
|
: QMenu(tr("Launch Menu"), parent)
|
||||||
, m_commons(commons)
|
, m_commons(commons)
|
||||||
, m_apiMenu("Graphics API", this)
|
, m_apiMenu(tr("Graphics API"), this)
|
||||||
, m_msaaMenu("Anti-Aliasing", this)
|
, m_msaaMenu(tr("Anti-Aliasing"), this)
|
||||||
, m_anisoMenu("Anisotropic Filtering", this)
|
, m_anisoMenu(tr("Anisotropic Filtering"), this)
|
||||||
, m_apiGroup(this)
|
, m_apiGroup(this)
|
||||||
, m_msaaGroup(this)
|
, m_msaaGroup(this)
|
||||||
, m_anisoGroup(this) {
|
, m_anisoGroup(this) {
|
||||||
@ -42,16 +42,18 @@ LaunchMenu::LaunchMenu(hecl::CVarCommons& commons, QWidget* parent)
|
|||||||
m_apiMenu.addActions(m_apiGroup.actions());
|
m_apiMenu.addActions(m_apiGroup.actions());
|
||||||
m_msaaMenu.addActions(m_msaaGroup.actions());
|
m_msaaMenu.addActions(m_msaaGroup.actions());
|
||||||
m_anisoMenu.addActions(m_anisoGroup.actions());
|
m_anisoMenu.addActions(m_anisoGroup.actions());
|
||||||
addMenu(&m_apiMenu)->setToolTip(m_commons.m_graphicsApi->rawHelp().data());
|
addMenu(&m_apiMenu)->setToolTip(QString::fromUtf8(m_commons.m_graphicsApi->rawHelp().data()));
|
||||||
addMenu(&m_msaaMenu)->setToolTip(m_commons.m_drawSamples->rawHelp().data());
|
addMenu(&m_msaaMenu)->setToolTip(QString::fromUtf8(m_commons.m_drawSamples->rawHelp().data()));
|
||||||
addMenu(&m_anisoMenu)->setToolTip(m_commons.m_texAnisotropy->rawHelp().data());
|
addMenu(&m_anisoMenu)->setToolTip(QString::fromUtf8(m_commons.m_texAnisotropy->rawHelp().data()));
|
||||||
QAction* argumentEditor = addAction("Edit Runtime Arguments");
|
const QAction* argumentEditor = addAction(tr("Edit Runtime Arguments"));
|
||||||
connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs);
|
connect(argumentEditor, &QAction::triggered, this, &LaunchMenu::editRuntimeArgs);
|
||||||
initDeepColor();
|
initDeepColor();
|
||||||
initDeveloperMode();
|
initDeveloperMode();
|
||||||
initCheats();
|
initCheats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LaunchMenu::~LaunchMenu() = default;
|
||||||
|
|
||||||
void LaunchMenu::initApiAction(const QString& action) {
|
void LaunchMenu::initApiAction(const QString& action) {
|
||||||
QAction* act = m_apiGroup.addAction(action);
|
QAction* act = m_apiGroup.addAction(action);
|
||||||
connect(act, &QAction::triggered, this, &LaunchMenu::apiTriggered);
|
connect(act, &QAction::triggered, this, &LaunchMenu::apiTriggered);
|
||||||
@ -77,32 +79,32 @@ void LaunchMenu::initAnisoAction(const QString& action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::initDeepColor() {
|
void LaunchMenu::initDeepColor() {
|
||||||
QAction* act = addAction("Deep Color");
|
QAction* act = addAction(tr("Deep Color"));
|
||||||
act->setToolTip(m_commons.m_deepColor->rawHelp().data());
|
act->setToolTip(QString::fromUtf8(m_commons.m_deepColor->rawHelp().data()));
|
||||||
act->setCheckable(true);
|
act->setCheckable(true);
|
||||||
act->setChecked(m_commons.getDeepColor());
|
act->setChecked(m_commons.getDeepColor());
|
||||||
connect(act, &QAction::triggered, this, &LaunchMenu::deepColorTriggered);
|
connect(act, &QAction::triggered, this, &LaunchMenu::deepColorTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::initDeveloperMode() {
|
void LaunchMenu::initDeveloperMode() {
|
||||||
QAction* act = addAction("Developer Mode");
|
m_developerMode = addAction(tr("Developer Mode"));
|
||||||
act->setToolTip(hecl::com_developer->rawHelp().data());
|
m_developerMode->setToolTip(QString::fromUtf8(hecl::com_developer->rawHelp().data()));
|
||||||
act->setCheckable(true);
|
m_developerMode->setCheckable(true);
|
||||||
act->setChecked(hecl::com_developer->toBoolean());
|
m_developerMode->setChecked(hecl::com_developer->toBoolean());
|
||||||
connect(act, &QAction::triggered, this, &LaunchMenu::developerModeTriggered);
|
connect(m_developerMode, &QAction::triggered, this, &LaunchMenu::developerModeTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::initCheats() {
|
void LaunchMenu::initCheats() {
|
||||||
QAction* act = addAction("Enable Cheats");
|
m_enableCheats = addAction(tr("Enable Cheats"));
|
||||||
act->setToolTip(hecl::com_enableCheats->rawHelp().data());
|
m_enableCheats->setToolTip(QString::fromUtf8(hecl::com_enableCheats->rawHelp().data()));
|
||||||
act->setCheckable(true);
|
m_enableCheats->setCheckable(true);
|
||||||
act->setChecked(hecl::com_enableCheats->toBoolean());
|
m_enableCheats->setChecked(hecl::com_enableCheats->toBoolean());
|
||||||
connect(act, &QAction::triggered, this, &LaunchMenu::cheatsTriggered);
|
connect(m_enableCheats, &QAction::triggered, this, &LaunchMenu::cheatsTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::apiTriggered() {
|
void LaunchMenu::apiTriggered() {
|
||||||
QString apiStr = qobject_cast<QAction*>(sender())->text();
|
QString apiStr = qobject_cast<QAction*>(sender())->text();
|
||||||
apiStr = apiStr.remove('&');
|
apiStr = apiStr.remove(QLatin1Char{'&'});
|
||||||
m_commons.setGraphicsApi(apiStr.toStdString());
|
m_commons.setGraphicsApi(apiStr.toStdString());
|
||||||
m_commons.serialize();
|
m_commons.serialize();
|
||||||
}
|
}
|
||||||
@ -123,13 +125,10 @@ void LaunchMenu::deepColorTriggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::developerModeTriggered() {
|
void LaunchMenu::developerModeTriggered() {
|
||||||
bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
|
const bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
|
||||||
|
|
||||||
if (hecl::com_enableCheats->toBoolean() && !isChecked) {
|
if (hecl::com_enableCheats->toBoolean() && !isChecked) {
|
||||||
for (QAction* action : actions()) {
|
m_enableCheats->setChecked(false);
|
||||||
QString text = action->text().remove('&');
|
|
||||||
if (text == "Enable Cheats" && action->isChecked())
|
|
||||||
action->setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hecl::CVarManager::instance()->setDeveloperMode(isChecked, true);
|
hecl::CVarManager::instance()->setDeveloperMode(isChecked, true);
|
||||||
@ -137,13 +136,10 @@ void LaunchMenu::developerModeTriggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LaunchMenu::cheatsTriggered() {
|
void LaunchMenu::cheatsTriggered() {
|
||||||
bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
|
const bool isChecked = qobject_cast<QAction*>(sender())->isChecked();
|
||||||
|
|
||||||
if (!hecl::com_developer->toBoolean() && isChecked) {
|
if (!hecl::com_developer->toBoolean() && isChecked) {
|
||||||
for (QAction* action : actions()) {
|
m_developerMode->setChecked(false);
|
||||||
QString text = action->text().remove('&');
|
|
||||||
if (text == "Developer Mode" && !action->isChecked())
|
|
||||||
action->setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hecl::CVarManager::instance()->setCheatsEnabled(isChecked, true);
|
hecl::CVarManager::instance()->setCheatsEnabled(isChecked, true);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
namespace hecl {
|
namespace hecl {
|
||||||
struct CVarCommons;
|
struct CVarCommons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
class LaunchMenu : public QMenu {
|
class LaunchMenu : public QMenu {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
hecl::CVarCommons& m_commons;
|
hecl::CVarCommons& m_commons;
|
||||||
@ -17,6 +20,9 @@ class LaunchMenu : public QMenu {
|
|||||||
QActionGroup m_msaaGroup;
|
QActionGroup m_msaaGroup;
|
||||||
QActionGroup m_anisoGroup;
|
QActionGroup m_anisoGroup;
|
||||||
|
|
||||||
|
QAction* m_developerMode = nullptr;
|
||||||
|
QAction* m_enableCheats = nullptr;
|
||||||
|
|
||||||
void initApiAction(const QString& action);
|
void initApiAction(const QString& action);
|
||||||
void initMsaaAction(const QString& action);
|
void initMsaaAction(const QString& action);
|
||||||
void initAnisoAction(const QString& action);
|
void initAnisoAction(const QString& action);
|
||||||
@ -25,7 +31,8 @@ class LaunchMenu : public QMenu {
|
|||||||
void initCheats();
|
void initCheats();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR);
|
explicit LaunchMenu(hecl::CVarCommons& commons, QWidget* parent = Q_NULLPTR);
|
||||||
|
~LaunchMenu() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void apiTriggered();
|
void apiTriggered();
|
||||||
|
@ -53,7 +53,7 @@ static void KillProcessTree(QProcess& proc) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QStringList MainWindow::skUpdateTracks = QStringList() << "stable" << "dev";
|
const QStringList MainWindow::skUpdateTracks = {QStringLiteral("stable"), QStringLiteral("dev")};
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent)
|
MainWindow::MainWindow(QWidget* parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
@ -64,10 +64,12 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
, m_heclProc(this)
|
, m_heclProc(this)
|
||||||
, m_dlManager(this)
|
, m_dlManager(this)
|
||||||
, m_launchMenu(m_cvarCommons, this) {
|
, m_launchMenu(m_cvarCommons, this) {
|
||||||
if (m_settings.value("urde_arguments").isNull())
|
if (m_settings.value(QStringLiteral("urde_arguments")).isNull()) {
|
||||||
m_settings.setValue("urde_arguments", QStringList() << "--no-shader-warmup");
|
m_settings.setValue(QStringLiteral("urde_arguments"), QStringList{QStringLiteral("--no-shader-warmup")});
|
||||||
if (m_settings.value("update_track").isNull())
|
}
|
||||||
m_settings.setValue("update_track", "stable");
|
if (m_settings.value(QStringLiteral("update_track")).isNull()) {
|
||||||
|
m_settings.setValue(QStringLiteral("update_track"), QStringLiteral("stable"));
|
||||||
|
}
|
||||||
|
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
@ -89,8 +91,8 @@ MainWindow::MainWindow(QWidget* parent)
|
|||||||
pal.setColor(QPalette::Button, QColor(53, 53, 72));
|
pal.setColor(QPalette::Button, QColor(53, 53, 72));
|
||||||
m_updateURDEButton->setPalette(pal);
|
m_updateURDEButton->setPalette(pal);
|
||||||
connect(m_updateURDEButton, &QPushButton::clicked, this, &MainWindow::onUpdateURDEPressed);
|
connect(m_updateURDEButton, &QPushButton::clicked, this, &MainWindow::onUpdateURDEPressed);
|
||||||
qDebug() << "Stored track " << m_settings.value("update_track");
|
qDebug() << "Stored track " << m_settings.value(QStringLiteral("update_track"));
|
||||||
const int index = skUpdateTracks.indexOf(m_settings.value("update_track").toString());
|
const int index = skUpdateTracks.indexOf(m_settings.value(QStringLiteral("update_track")).toString());
|
||||||
m_ui->devTrackWarning->setVisible(index == 1);
|
m_ui->devTrackWarning->setVisible(index == 1);
|
||||||
m_ui->updateTrackComboBox->setCurrentIndex(index);
|
m_ui->updateTrackComboBox->setCurrentIndex(index);
|
||||||
connect(m_ui->updateTrackComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
connect(m_ui->updateTrackComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||||
@ -125,13 +127,15 @@ void MainWindow::onExtract() {
|
|||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
env.insert("TERM", "xterm-color");
|
env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color"));
|
||||||
env.insert("ConEmuANSI", "ON");
|
env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON"));
|
||||||
m_heclProc.setProcessEnvironment(env);
|
m_heclProc.setProcessEnvironment(env);
|
||||||
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
||||||
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onExtractFinished);
|
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onExtractFinished);
|
||||||
m_heclProc.start(m_heclPath, {"extract", "-y", "-g", "-o", m_path, imgPath},
|
|
||||||
QIODevice::ReadOnly | QIODevice::Unbuffered);
|
const QStringList heclProcArguments{
|
||||||
|
QStringLiteral("extract"), QStringLiteral("-y"), QStringLiteral("-g"), QStringLiteral("-o"), m_path, imgPath};
|
||||||
|
m_heclProc.start(m_heclPath, heclProcArguments, QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
|
|
||||||
@ -158,12 +162,14 @@ void MainWindow::onPackage() {
|
|||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
env.insert("TERM", "xterm-color");
|
env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color"));
|
||||||
env.insert("ConEmuANSI", "ON");
|
env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON"));
|
||||||
m_heclProc.setProcessEnvironment(env);
|
m_heclProc.setProcessEnvironment(env);
|
||||||
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
||||||
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onPackageFinished);
|
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onPackageFinished);
|
||||||
m_heclProc.start(m_heclPath, {"package", "-y", "-g"}, QIODevice::ReadOnly | QIODevice::Unbuffered);
|
|
||||||
|
const QStringList heclProcArguments{QStringLiteral("package"), QStringLiteral("-y"), QStringLiteral("-g")};
|
||||||
|
m_heclProc.start(m_heclPath, heclProcArguments, QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
|
|
||||||
@ -195,14 +201,18 @@ void MainWindow::onLaunch() {
|
|||||||
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
m_heclProc.setProcessChannelMode(QProcess::ProcessChannelMode::MergedChannels);
|
||||||
m_heclProc.setWorkingDirectory(m_path);
|
m_heclProc.setWorkingDirectory(m_path);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
env.insert("TERM", "xterm-color");
|
env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-color"));
|
||||||
env.insert("ConEmuANSI", "ON");
|
env.insert(QStringLiteral("ConEmuANSI"), QStringLiteral("ON"));
|
||||||
m_heclProc.setProcessEnvironment(env);
|
m_heclProc.setProcessEnvironment(env);
|
||||||
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
disconnect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), nullptr, nullptr);
|
||||||
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onLaunchFinished);
|
connect(&m_heclProc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &MainWindow::onLaunchFinished);
|
||||||
m_heclProc.start(m_urdePath, QStringList() << (m_path + "/out")
|
|
||||||
<< m_settings.value("urde_arguments").toStringList().join(' ').split(' '),
|
const auto heclProcArguments = QStringList{m_path + QStringLiteral("/out")}
|
||||||
QIODevice::ReadOnly | QIODevice::Unbuffered);
|
<< m_settings.value(QStringLiteral("urde_arguments"))
|
||||||
|
.toStringList()
|
||||||
|
.join(QLatin1Char{' '})
|
||||||
|
.split(QLatin1Char{' '});
|
||||||
|
m_heclProc.start(m_urdePath, heclProcArguments, QIODevice::ReadOnly | QIODevice::Unbuffered);
|
||||||
|
|
||||||
m_ui->heclTabs->setCurrentIndex(0);
|
m_ui->heclTabs->setCurrentIndex(0);
|
||||||
|
|
||||||
@ -247,7 +257,7 @@ void MainWindow::onDownloadPressed() {
|
|||||||
QString filename = m_ui->binaryComboBox->currentData().value<URDEVersion>().fileString(true);
|
QString filename = m_ui->binaryComboBox->currentData().value<URDEVersion>().fileString(true);
|
||||||
disableOperations();
|
disableOperations();
|
||||||
m_ui->downloadButton->setEnabled(false);
|
m_ui->downloadButton->setEnabled(false);
|
||||||
m_dlManager.fetchBinary(filename, m_path + '/' + filename);
|
m_dlManager.fetchBinary(filename, m_path + QLatin1Char{'/'} + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdateURDEPressed() {
|
void MainWindow::onUpdateURDEPressed() {
|
||||||
@ -305,41 +315,50 @@ void MainWindow::enableOperations() {
|
|||||||
m_ui->launchBtn->setText(QStringLiteral("Launch"));
|
m_ui->launchBtn->setText(QStringLiteral("Launch"));
|
||||||
|
|
||||||
m_ui->extractBtn->setEnabled(true);
|
m_ui->extractBtn->setEnabled(true);
|
||||||
if (QFile::exists(m_path + "/MP1/!original_ids.yaml")) {
|
if (QFile::exists(m_path + QStringLiteral("/MP1/!original_ids.yaml"))) {
|
||||||
m_ui->packageBtn->setEnabled(true);
|
m_ui->packageBtn->setEnabled(true);
|
||||||
if (isPackageComplete())
|
if (isPackageComplete())
|
||||||
m_ui->launchBtn->setEnabled(true);
|
m_ui->launchBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_ui->sysReqTable->isBlenderVersionOk())
|
if (!m_ui->sysReqTable->isBlenderVersionOk())
|
||||||
insertContinueNote("Blender 2.78+ must be installed. Please download via Steam or blender.org.");
|
insertContinueNote(tr("Blender 2.78+ must be installed. Please download via Steam or blender.org."));
|
||||||
else if (m_ui->launchBtn->isEnabled())
|
else if (m_ui->launchBtn->isEnabled())
|
||||||
insertContinueNote("Package complete - Press 'Launch' to start URDE.");
|
insertContinueNote(tr("Package complete - Press 'Launch' to start URDE."));
|
||||||
else if (m_ui->packageBtn->isEnabled())
|
else if (m_ui->packageBtn->isEnabled())
|
||||||
insertContinueNote("Extract complete - Press 'Package' to continue.");
|
insertContinueNote(tr("Extract complete - Press 'Package' to continue."));
|
||||||
else if (m_ui->extractBtn->isEnabled())
|
else if (m_ui->extractBtn->isEnabled())
|
||||||
insertContinueNote("Press 'Extract' to begin.");
|
insertContinueNote(tr("Press 'Extract' to begin."));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isPackageComplete() const {
|
bool MainWindow::isPackageComplete() const {
|
||||||
return
|
return
|
||||||
#if RUNTIME_ORIGINAL_IDS
|
#if RUNTIME_ORIGINAL_IDS
|
||||||
QFile::exists(m_path + "/out/files/!original_ids.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/!original_ids.upak")) &&
|
||||||
#endif
|
#endif
|
||||||
QFile::exists(m_path + "/out/files/AudioGrp.upak") && QFile::exists(m_path + "/out/files/GGuiSys.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/AudioGrp.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/Metroid1.upak") && QFile::exists(m_path + "/out/files/Metroid2.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/GGuiSys.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/Metroid3.upak") && QFile::exists(m_path + "/out/files/Metroid4.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid1.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/metroid5.upak") && QFile::exists(m_path + "/out/files/Metroid6.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid2.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/Metroid7.upak") && QFile::exists(m_path + "/out/files/Metroid8.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid3.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/MidiData.upak") && QFile::exists(m_path + "/out/files/MiscData.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid4.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/NoARAM.upak") && QFile::exists(m_path + "/out/files/SamGunFx.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/metroid5.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/SamusGun.upak") && QFile::exists(m_path + "/out/files/SlideShow.upak") &&
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid6.upak")) &&
|
||||||
QFile::exists(m_path + "/out/files/TestAnim.upak") && QFile::exists(m_path + "/out/files/Tweaks.upak");
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid7.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/Metroid8.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/MidiData.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/MiscData.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/NoARAM.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/SamGunFx.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/SamusGun.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/SlideShow.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/TestAnim.upak")) &&
|
||||||
|
QFile::exists(m_path + QStringLiteral("/out/files/Tweaks.upak"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetDLPackage(const QString& path, QString& dlPackage) {
|
static bool GetDLPackage(const QString& path, QString& dlPackage) {
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
proc.start(path, {"--dlpackage"}, QIODevice::ReadOnly);
|
proc.start(path, {QStringLiteral("--dlpackage")}, QIODevice::ReadOnly);
|
||||||
if (proc.waitForStarted()) {
|
if (proc.waitForStarted()) {
|
||||||
proc.waitForFinished();
|
proc.waitForFinished();
|
||||||
if (proc.exitCode() == 100)
|
if (proc.exitCode() == 100)
|
||||||
@ -363,17 +382,17 @@ bool MainWindow::checkDownloadedBinary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
QString urdePath = m_path + "/URDE.app/Contents/MacOS/urde";
|
QString urdePath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/urde");
|
||||||
QString heclPath = m_path + "/URDE.app/Contents/MacOS/hecl";
|
QString heclPath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/hecl");
|
||||||
QString visigenPath = m_path + "/URDE.app/Contents/MacOS/visigen";
|
QString visigenPath = m_path + QStringLiteral("/URDE.app/Contents/MacOS/visigen");
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
QString urdePath = m_path + "/urde.exe";
|
QString urdePath = m_path + QStringLiteral("/urde.exe");
|
||||||
QString heclPath = m_path + "/hecl.exe";
|
QString heclPath = m_path + QStringLiteral("/hecl.exe");
|
||||||
QString visigenPath = m_path + "/visigen.exe";
|
QString visigenPath = m_path + QStringLiteral("/visigen.exe");
|
||||||
#else
|
#else
|
||||||
QString urdePath = m_path + "/urde";
|
QString urdePath = m_path + QStringLiteral("/urde");
|
||||||
QString heclPath = m_path + "/hecl";
|
QString heclPath = m_path + QStringLiteral("/hecl");
|
||||||
QString visigenPath = m_path + "/visigen";
|
QString visigenPath = m_path + QStringLiteral("/visigen");
|
||||||
#endif
|
#endif
|
||||||
urdePath = QFileInfo(urdePath).absoluteFilePath();
|
urdePath = QFileInfo(urdePath).absoluteFilePath();
|
||||||
heclPath = QFileInfo(heclPath).absoluteFilePath();
|
heclPath = QFileInfo(heclPath).absoluteFilePath();
|
||||||
@ -445,8 +464,8 @@ void MainWindow::setPath(const QString& path) {
|
|||||||
|
|
||||||
void MainWindow::initSlots() {
|
void MainWindow::initSlots() {
|
||||||
connect(&m_heclProc, &QProcess::readyRead, [=]() {
|
connect(&m_heclProc, &QProcess::readyRead, [=]() {
|
||||||
QByteArray bytes = m_heclProc.readAll();
|
const QByteArray bytes = m_heclProc.readAll();
|
||||||
setTextTermFormatting(bytes);
|
setTextTermFormatting(QString::fromUtf8(bytes));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_ui->extractBtn, &QPushButton::clicked, this, &MainWindow::onExtract);
|
connect(m_ui->extractBtn, &QPushButton::clicked, this, &MainWindow::onExtract);
|
||||||
@ -457,7 +476,7 @@ void MainWindow::initSlots() {
|
|||||||
connect(m_ui->browseBtn, &QPushButton::clicked, [=]() {
|
connect(m_ui->browseBtn, &QPushButton::clicked, [=]() {
|
||||||
FileDirDialog dialog(this);
|
FileDirDialog dialog(this);
|
||||||
dialog.setDirectory(m_path);
|
dialog.setDirectory(m_path);
|
||||||
dialog.setWindowTitle("Select Working Directory");
|
dialog.setWindowTitle(tr("Select Working Directory"));
|
||||||
int res = dialog.exec();
|
int res = dialog.exec();
|
||||||
if (res == QFileDialog::Rejected)
|
if (res == QFileDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
@ -474,7 +493,7 @@ void MainWindow::initSlots() {
|
|||||||
void MainWindow::setTextTermFormatting(const QString& text) {
|
void MainWindow::setTextTermFormatting(const QString& text) {
|
||||||
m_inContinueNote = false;
|
m_inContinueNote = false;
|
||||||
|
|
||||||
QRegExp const escapeSequenceExpression(R"(\x1B\[([\d;\?FA]+)([mlh]?))");
|
QRegExp const escapeSequenceExpression(QStringLiteral(R"(\x1B\[([\d;\?FA]+)([mlh]?))"));
|
||||||
QTextCharFormat defaultTextCharFormat = m_cursor.charFormat();
|
QTextCharFormat defaultTextCharFormat = m_cursor.charFormat();
|
||||||
int offset = escapeSequenceExpression.indexIn(text);
|
int offset = escapeSequenceExpression.indexIn(text);
|
||||||
ReturnInsert(m_cursor, text.mid(0, offset));
|
ReturnInsert(m_cursor, text.mid(0, offset));
|
||||||
@ -482,8 +501,8 @@ void MainWindow::setTextTermFormatting(const QString& text) {
|
|||||||
while (offset >= 0) {
|
while (offset >= 0) {
|
||||||
int previousOffset = offset + escapeSequenceExpression.matchedLength();
|
int previousOffset = offset + escapeSequenceExpression.matchedLength();
|
||||||
QStringList captures = escapeSequenceExpression.capturedTexts();
|
QStringList captures = escapeSequenceExpression.capturedTexts();
|
||||||
if (captures.size() >= 3 && captures[2] == "m") {
|
if (captures.size() >= 3 && captures[2] == QStringLiteral("m")) {
|
||||||
QStringList capturedTexts = captures[1].split(';');
|
QStringList capturedTexts = captures[1].split(QLatin1Char{';'});
|
||||||
QListIterator<QString> i(capturedTexts);
|
QListIterator<QString> i(capturedTexts);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -491,7 +510,8 @@ void MainWindow::setTextTermFormatting(const QString& text) {
|
|||||||
Q_ASSERT(ok);
|
Q_ASSERT(ok);
|
||||||
ParseEscapeSequence(attribute, i, textCharFormat, defaultTextCharFormat);
|
ParseEscapeSequence(attribute, i, textCharFormat, defaultTextCharFormat);
|
||||||
}
|
}
|
||||||
} else if (captures.size() >= 2 && (captures[1].endsWith('F') || captures[1].endsWith('A'))) {
|
} else if (captures.size() >= 2 &&
|
||||||
|
(captures[1].endsWith(QLatin1Char{'F'}) || captures[1].endsWith(QLatin1Char{'A'}))) {
|
||||||
int lineCount = captures[1].chopped(1).toInt();
|
int lineCount = captures[1].chopped(1).toInt();
|
||||||
if (!lineCount)
|
if (!lineCount)
|
||||||
lineCount = 1;
|
lineCount = 1;
|
||||||
@ -526,8 +546,9 @@ void MainWindow::insertContinueNote(const QString& text) {
|
|||||||
m_ui->processOutput->ensureCursorVisible();
|
m_ui->processOutput->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
void MainWindow::onUpdateTrackChanged(int index) {
|
void MainWindow::onUpdateTrackChanged(int index) {
|
||||||
qDebug() << "Track changed from " << m_settings.value("update_track") << " to " << skUpdateTracks[index];
|
qDebug() << "Track changed from " << m_settings.value(QStringLiteral("update_track")) << " to "
|
||||||
m_settings.setValue("update_track", skUpdateTracks[index]);
|
<< skUpdateTracks[index];
|
||||||
|
m_settings.setValue(QStringLiteral("update_track"), skUpdateTracks[index]);
|
||||||
m_dlManager.fetchIndex();
|
m_dlManager.fetchIndex();
|
||||||
m_ui->devTrackWarning->setVisible(index == 1);
|
m_ui->devTrackWarning->setVisible(index == 1);
|
||||||
}
|
}
|
||||||
|
@ -43,29 +43,39 @@ static QString GetWindowsVersionString() {
|
|||||||
|
|
||||||
SysReqTableModel::SysReqTableModel(QObject* parent) : QAbstractTableModel(parent) {
|
SysReqTableModel::SysReqTableModel(QObject* parent) : QAbstractTableModel(parent) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
QFile file("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
|
QFile file(QStringLiteral("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"));
|
||||||
if (file.open(QFile::ReadOnly)) {
|
if (file.open(QFile::ReadOnly)) {
|
||||||
QString str(file.readAll());
|
const QString str(QString::fromUtf8(file.readAll()));
|
||||||
m_cpuSpeed = str.toInt() / 1000;
|
m_cpuSpeed = str.toInt() / 1000;
|
||||||
m_cpuSpeedStr.sprintf("%g GHz", m_cpuSpeed / 1000.0);
|
m_cpuSpeedStr.sprintf("%g GHz", m_cpuSpeed / 1000.0);
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
QProcess spProc;
|
QProcess spProc;
|
||||||
spProc.start("system_profiler", {"-xml", "SPHardwareDataType"}, QProcess::ReadOnly);
|
spProc.start(QStringLiteral("system_profiler"), {QStringLiteral("-xml"), QStringLiteral("SPHardwareDataType")},
|
||||||
|
QProcess::ReadOnly);
|
||||||
spProc.waitForFinished();
|
spProc.waitForFinished();
|
||||||
QDomDocument spDoc;
|
QDomDocument spDoc;
|
||||||
spDoc.setContent(spProc.readAll());
|
spDoc.setContent(spProc.readAll());
|
||||||
QDomElement spDocElem = spDoc.documentElement();
|
QDomElement spDocElem = spDoc.documentElement();
|
||||||
QDomElement n = spDocElem.firstChildElement("array").firstChildElement("dict").firstChildElement("key");
|
QDomElement n = spDocElem.firstChildElement(QStringLiteral("array"))
|
||||||
while (!n.isNull() && n.text() != "_items")
|
.firstChildElement(QStringLiteral("dict"))
|
||||||
n = n.nextSiblingElement("key");
|
.firstChildElement(QStringLiteral("key"));
|
||||||
|
while (!n.isNull() && n.text() != QStringLiteral("_items")) {
|
||||||
|
n = n.nextSiblingElement(QStringLiteral("key"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!n.isNull()) {
|
if (!n.isNull()) {
|
||||||
n = n.nextSiblingElement("array").firstChildElement("dict").firstChildElement("key");
|
n = n.nextSiblingElement(QStringLiteral("array"))
|
||||||
while (!n.isNull() && n.text() != "current_processor_speed")
|
.firstChildElement(QStringLiteral("dict"))
|
||||||
n = n.nextSiblingElement("key");
|
.firstChildElement(QStringLiteral("key"));
|
||||||
|
|
||||||
|
while (!n.isNull() && n.text() != QStringLiteral("current_processor_speed")) {
|
||||||
|
n = n.nextSiblingElement(QStringLiteral("key"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!n.isNull()) {
|
if (!n.isNull()) {
|
||||||
n = n.nextSiblingElement("string");
|
n = n.nextSiblingElement(QStringLiteral("string"));
|
||||||
double speed = n.text().split(' ').front().toDouble();
|
const double speed = n.text().split(QLatin1Char{' '}).front().toDouble();
|
||||||
m_cpuSpeed = uint64_t(speed * 1000.0);
|
m_cpuSpeed = uint64_t(speed * 1000.0);
|
||||||
m_cpuSpeedStr.sprintf("%g GHz", speed);
|
m_cpuSpeedStr.sprintf("%g GHz", speed);
|
||||||
}
|
}
|
||||||
@ -113,11 +123,12 @@ SysReqTableModel::SysReqTableModel(QObject* parent) : QAbstractTableModel(parent
|
|||||||
m_osVersion = QStringLiteral("Linux");
|
m_osVersion = QStringLiteral("Linux");
|
||||||
#endif
|
#endif
|
||||||
hecl::blender::FindBlender(m_blendMajor, m_blendMinor);
|
hecl::blender::FindBlender(m_blendMajor, m_blendMinor);
|
||||||
if (m_blendMajor)
|
if (m_blendMajor) {
|
||||||
m_blendVersionStr =
|
m_blendVersionStr =
|
||||||
QStringLiteral("Blender ") + QString::number(m_blendMajor) + '.' + QString::number(m_blendMinor);
|
QStringLiteral("Blender ") + QString::number(m_blendMajor) + QLatin1Char{'.'} + QString::number(m_blendMinor);
|
||||||
else
|
} else {
|
||||||
m_blendVersionStr = QStringLiteral("Not Found");
|
m_blendVersionStr = QStringLiteral("Not Found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysReqTableModel::updateFreeDiskSpace(const QString& path) {
|
void SysReqTableModel::updateFreeDiskSpace(const QString& path) {
|
||||||
|
@ -25,14 +25,14 @@ static QIcon MakeAppIcon() {
|
|||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
InitializePlatform();
|
InitializePlatform();
|
||||||
|
|
||||||
QApplication::setOrganizationName("AxioDL");
|
QApplication::setOrganizationName(QStringLiteral("AxioDL"));
|
||||||
QApplication::setApplicationName("HECL");
|
QApplication::setApplicationName(QStringLiteral("HECL"));
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
#endif
|
#endif
|
||||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
QApplication::setStyle(QStyleFactory::create(QStringLiteral("Fusion")));
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
QApplication::setWindowIcon(MakeAppIcon());
|
QApplication::setWindowIcon(MakeAppIcon());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user