diff --git a/README.md b/README.md index 7c22a6c..2ac157e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ sudo dnf install qt6-qtbase-devel qt6-qttools-devel qt6-qt5compat-devel quazip-q ``` #### Debian/Ubuntu (& derivatives) ``` -sudo apt install build-essential cmake qt6-base-dev qttools6-dev qt6-5compat-dev libquazip1-qt6 +sudo apt install build-essential cmake qt6-base-dev qt6-tools-dev qt6-5compat-dev libquazip1-qt6-dev ``` Additionally, Nero uses the following external components, either implicitly or optionally: diff --git a/src/nerofs.cpp b/src/nerofs.cpp index feb8cad..5578f97 100644 --- a/src/nerofs.cpp +++ b/src/nerofs.cpp @@ -22,6 +22,7 @@ #include #include +#include NeroFS::NeroFS() {} @@ -38,7 +39,7 @@ QStringList NeroFS::prefixes; QStringList NeroFS::availableProtons; bool NeroFS::InitPaths() { - QSettings managerCfg(QString("%1/NeroLauncher.ini").arg(qEnvironmentVariable("XDG_CONFIG_HOME")), QSettings::IniFormat); + QSettings managerCfg(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/Nero-UMU.ini", QSettings::IniFormat); managerCfg.beginGroup("NeroSettings"); if(managerCfg.value("Home").toString().isEmpty()) { @@ -52,27 +53,26 @@ bool NeroFS::InitPaths() { QString dir = QFileDialog::getExistingDirectory(NULL, "Select Nero Home Directory", qEnvironmentVariable("HOME")); - if(!dir.isEmpty()) { - managerCfg.setValue("Home", dir); - } else { + if(!dir.isEmpty()) managerCfg.setValue("Home", dir); + else { QMessageBox::critical(NULL, - "ERROR: No directory!", + "ERROR: No Home Directory!", "Directory is empty, or the operation was canceled."); return false; } } prefixesPath.setPath(managerCfg.value("Home").toString()); - QDir steamDir(QString("%1/.steam/steam/compatibilitytools.d").arg(qEnvironmentVariable("HOME"))); + QDir steamDir(qEnvironmentVariable("HOME") + "/.steam/steam/compatibilitytools.d"); if(steamDir.exists()) { protonsPath.setPath(steamDir.path()); printf("Steam detected, using existing compatibilitytools.d\n"); } else { printf("Working Steam install not detected, using Nero data directory for Proton versions\n"); - protonsPath.setPath(QString("%1/NeroLauncher/protons").arg(qEnvironmentVariable("XDG_DATA_HOME"))); + protonsPath.setPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Nero-UMU/protons"); if(!protonsPath.exists()) { printf("Nero directory doesn't exist! Creating paths...\n"); - protonsPath.mkpath(QString("%1/NeroLauncher/protons").arg(qEnvironmentVariable("XDG_DATA_HOME"))); + protonsPath.mkpath("."); } } @@ -82,10 +82,10 @@ bool NeroFS::InitPaths() { QStringList NeroFS::GetPrefixes() { if(prefixes.isEmpty()) { - prefixes = NeroFS::GetPrefixesPath().entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); + prefixes = prefixesPath.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); for(int i = prefixes.count()-1; i >= 0; i--) { // should we do ACTUAL ini verification? Or just checking to make sure it exists? - if(!QDir(NeroFS::GetPrefixesPath()).exists(QString("%1/nero-settings.ini").arg(prefixes.at(i)))) { + if(!prefixesPath.exists(prefixes.at(i) + "/nero-settings.ini")) { prefixes.removeAt(i); } } @@ -96,7 +96,7 @@ QStringList NeroFS::GetPrefixes() void NeroFS::CreateUserLinks(QString prefixName) { - QDir prefixDir(QString("%1/%2").arg(NeroFS::GetPrefixesPath().path(), prefixName)); + QDir prefixDir(NeroFS::GetPrefixesPath().path() + '/' + prefixName); if(prefixDir.exists()) { // TODO: should we allow the user to selectively link certain directories? prefixDir.setPath(QString("%1/%2/drive_c/users/%3/Desktop").arg(NeroFS::GetPrefixesPath().path(), @@ -201,11 +201,19 @@ QString NeroFS::GetUmU() } else { return ""; } } -QString NeroFS::GetWinetricks() +QString NeroFS::GetWinetricks(const QString &runner) { - // Each Proton version comes with a Winetricks script. Neat! - if(QDir(QString("%1/%2/protonfixes").arg(GetProtonsPath().path(), GetCurrentRunner())).exists("winetricks")) - return QString("%1/%2/protonfixes/winetricks").arg(GetProtonsPath().path(), GetCurrentRunner()); + if(!runner.isEmpty()) { + if(QDir(protonsPath.path() + '/' + runner + "/protonfixes").exists("winetricks")) + return protonsPath.path() + '/' + runner + "/protonfixes/winetricks"; + else { + // fall back to system winetricks + if(QDir("/usr/bin").exists("winetricks")) + return "/usr/bin/winetricks"; + else return ""; + } + } else if(QDir(protonsPath.path() + '/' + currentRunner + "/protonfixes").exists("winetricks")) + return protonsPath.path() + '/' + currentRunner + "/protonfixes/winetricks"; else { // fall back to system winetricks if(QDir("/usr/bin").exists("winetricks")) @@ -228,7 +236,7 @@ QSettings* NeroFS::GetCurrentPrefixCfg() { if(prefixCfg != nullptr) { delete prefixCfg; } if(!currentPrefix.isEmpty()) { - prefixCfg = new QSettings(QString("%1/%2/nero-settings.ini").arg(prefixesPath.path(), currentPrefix), QSettings::IniFormat); + prefixCfg = new QSettings(prefixesPath.path() + '/' + currentPrefix + "/nero-settings.ini", QSettings::IniFormat); return prefixCfg; } else { // if we're running into this problem, then something's gone horribly wrong. @@ -340,7 +348,7 @@ QMap NeroFS::GetShortcutSettings(const QString shortcutHash) { GetCurrentPrefixCfg(); if(!prefixCfg->group().isEmpty()) prefixCfg->endGroup(); - prefixCfg->beginGroup(QString("Shortcuts--%1").arg(shortcutHash)); + prefixCfg->beginGroup("Shortcuts--" + shortcutHash); const QStringList settingKeys = prefixCfg->childKeys(); QMap settings; for(const auto &key : settingKeys) { @@ -391,7 +399,7 @@ QMap NeroFS::GetCurrentShortcutsMap() bool NeroFS::DeletePrefix(const QString prefix) { prefixes.removeOne(prefix); - if(QDir(QString("%1/%2").arg(prefixesPath.path(), prefix)).removeRecursively()) + if(QDir(prefixesPath.path() + '/' + prefix).removeRecursively()) return true; else return false; } @@ -404,9 +412,9 @@ void NeroFS::DeleteShortcut(const QString shortcutHash) QString name = prefixCfg->value(shortcutHash).toString(); prefixCfg->remove(shortcutHash); prefixCfg->endGroup(); - prefixCfg->beginGroup(QString("Shortcuts--%1").arg(shortcutHash)); + prefixCfg->beginGroup("Shortcuts--" + shortcutHash); prefixCfg->remove(""); prefixCfg->endGroup(); - QFile icoFile(QString("%1/%2/.icoCache/%3-%4.png").arg(prefixesPath.path(), currentPrefix, name, shortcutHash)); + QFile icoFile(prefixesPath.path() + '/' + currentPrefix + "/.icoCache/" + name + '-' + shortcutHash + ".png"); if(icoFile.exists()) icoFile.remove(); } diff --git a/src/nerofs.h b/src/nerofs.h index 5c4c184..8d7a167 100644 --- a/src/nerofs.h +++ b/src/nerofs.h @@ -68,7 +68,7 @@ class NeroFS static QString GetIcoextract(); static QString GetIcoutils(); static QString GetUmU(); - static QString GetWinetricks(); + static QString GetWinetricks(const QString & = ""); static void SetCurrentPrefix(const QString); static bool SetCurrentPrefixCfg(const QString, const QString, const QVariant); diff --git a/src/neromanager.cpp b/src/neromanager.cpp index 7803f46..ec363b3 100644 --- a/src/neromanager.cpp +++ b/src/neromanager.cpp @@ -38,6 +38,8 @@ NeroManagerWindow::NeroManagerWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::NeroManagerWindow) { + QCoreApplication::setApplicationName("Nero-UMU"); + // rand + undefined int, bit shifted to only give the three least significant bytes (0-7) // THIS can be set before window setup... switch(((LOLRANDOM + rand()) >> 29)) { @@ -75,7 +77,7 @@ NeroManagerWindow::NeroManagerWindow(QWidget *parent) "Please install at least one Proton version at:\n\n" + NeroFS::GetProtonsPath().path() + "\n\nYou can install new runners either through Steam, or a Proton Manager such as ProtonUp-Qt or ProtonPlus." - "\n\nNero Will now exit, umu."); + "\n\nNero will now exit, umu."); exit(1); } managerCfg = new QSettings(NeroFS::GetManagerCfg()); @@ -106,11 +108,7 @@ NeroManagerWindow::NeroManagerWindow(QWidget *parent) ui->prefixContentsScrollArea->setVisible(false); - if(NeroFS::GetWinetricks().isEmpty()) { - ui->prefixTricksBtn->setEnabled(false); - ui->prefixTricksBtn->setText("Winetricks Not Found"); - ui->prefixTricksBtn->setStyleSheet("color: red"); - } + CheckWinetricks(); blinkTimer = new QTimer(); connect(blinkTimer, &QTimer::timeout, this, &NeroManagerWindow::blinkTimer_timeout); @@ -376,6 +374,19 @@ void NeroManagerWindow::CreatePrefix(const QString newPrefix, const QString runn QGuiApplication::restoreOverrideCursor(); } +void NeroManagerWindow::CheckWinetricks() +{ + if(NeroFS::GetWinetricks().isEmpty()) { + ui->prefixTricksBtn->setEnabled(false); + ui->prefixTricksBtn->setText("Winetricks Not Found"); + ui->prefixTricksBtn->setStyleSheet("color: red"); + } else { + ui->prefixTricksBtn->setEnabled(true); + ui->prefixTricksBtn->setText("Install Winetricks Components"); + ui->prefixTricksBtn->setStyleSheet(""); + } +} + void NeroManagerWindow::AddTricks(QStringList verbs, const QString prefix) { QProcess umu; @@ -571,6 +582,8 @@ void NeroManagerWindow::prefixMainButtons_clicked() } SetHeader(NeroFS::GetCurrentPrefix(), NeroFS::GetCurrentPrefixShortcuts().count()); + + CheckWinetricks(); } void NeroManagerWindow::prefixDeleteButtons_clicked() diff --git a/src/neromanager.h b/src/neromanager.h index de2a4b5..555b086 100644 --- a/src/neromanager.h +++ b/src/neromanager.h @@ -139,6 +139,7 @@ private slots: // METHODS void SetHeader(const QString prefix = "", const unsigned int shortcutsCount = 0); + void CheckWinetricks(); void RenderPrefixes(); void RenderPrefixList(); void CreatePrefix(const QString newPrefix, const QString runner, QStringList tricksToInstall = {}); diff --git a/src/neromanager.ui b/src/neromanager.ui index 535b4c9..0708c05 100644 --- a/src/neromanager.ui +++ b/src/neromanager.ui @@ -72,7 +72,7 @@ - false + true @@ -85,6 +85,9 @@ 9 + + color: gray + Subtitle @@ -261,7 +264,10 @@ - false + true + + + color: gray <html><head/><body><p><span style=" font-size:12pt; font-weight:700;">There are no Proton prefixes available!</span></p><p>Press the + button above to create one.</p></body></html> diff --git a/src/neroprefixsettings.cpp b/src/neroprefixsettings.cpp index efce27e..a5a551e 100644 --- a/src/neroprefixsettings.cpp +++ b/src/neroprefixsettings.cpp @@ -152,6 +152,12 @@ NeroPrefixSettingsWindow::NeroPrefixSettingsWindow(QWidget *parent, const QStrin // QComboboxes aren't new syntax friendly? if(!child->property("isFor").isNull()) connect(child, SIGNAL(activated(int)), this, SLOT(OptionSet())); } + + // light mode styling adjustments: + if(this->palette().window().color().value() > this->palette().text().color().value()) { + ui->infoBox->setStyleSheet("QGroupBox::title { color: #909000 }"); + ui->infoText->setStyleSheet("color: doubledarkgray"); + } } bool NeroPrefixSettingsWindow::eventFilter(QObject* object, QEvent* event) diff --git a/src/neroprefixsettings.ui b/src/neroprefixsettings.ui index f0d3eb6..2397942 100644 --- a/src/neroprefixsettings.ui +++ b/src/neroprefixsettings.ui @@ -933,8 +933,8 @@ 0 0 - 600 - 454 + 618 + 359 @@ -1685,12 +1685,7 @@ - QGroupBox::title { -color: yellow -} - - - + QGroupBox::title { color: yellow } @@ -1715,8 +1710,8 @@ color: yellow 0 0 - 624 - 68 + 636 + 229 diff --git a/src/nerotricks.cpp b/src/nerotricks.cpp index 6d5fa35..26a8eec 100644 --- a/src/nerotricks.cpp +++ b/src/nerotricks.cpp @@ -39,13 +39,13 @@ QStringList NeroTricksWindow::winetricksAvailVerbs; QStringList NeroTricksWindow::winetricksDescriptions; -NeroTricksWindow::NeroTricksWindow(QWidget *parent) +NeroTricksWindow::NeroTricksWindow(QWidget *parent, const QString &runner) : QDialog(parent) , ui(new Ui::NeroTricksWindow) { ui->setupUi(this); - if(winetricksAvailVerbs.isEmpty()) { InitVerbs(); } + if(winetricksAvailVerbs.isEmpty()) { InitVerbs(runner); } for(int i = 0; i < winetricksAvailVerbs.count(); i++) { verbSelector << new QCheckBox(winetricksAvailVerbs.at(i), this); @@ -74,14 +74,14 @@ NeroTricksWindow::~NeroTricksWindow() delete ui; } -void NeroTricksWindow::InitVerbs() +void NeroTricksWindow::InitVerbs(const QString &runner) { if(winetricksAvailVerbs.isEmpty()) { - if(!NeroFS::GetWinetricks().isEmpty()) { + if(!NeroFS::GetWinetricks(runner).isEmpty()) { QProcess winetricksList; QMessageBox waitBox(QMessageBox::NoIcon, "Winetricks Loading", "Please wait..."); - winetricksList.start(NeroFS::GetWinetricks(), {"dlls", "list"}); + winetricksList.start(NeroFS::GetWinetricks(runner), {"dlls", "list"}); waitBox.open(); waitBox.raise(); QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -97,7 +97,7 @@ void NeroTricksWindow::InitVerbs() winetricksDescriptions.clear(); } - if(NeroFS::GetWinetricks().contains("protontricks")) + if(NeroFS::GetWinetricks(runner).contains("protontricks")) // read first line, which is boilerplate cd winetricksList.readLine(); diff --git a/src/nerotricks.h b/src/nerotricks.h index 0be3128..5614794 100644 --- a/src/nerotricks.h +++ b/src/nerotricks.h @@ -35,10 +35,10 @@ class NeroTricksWindow : public QDialog Q_OBJECT public: - explicit NeroTricksWindow(QWidget *parent = nullptr); + explicit NeroTricksWindow(QWidget *parent = nullptr, const QString & = ""); ~NeroTricksWindow(); - void InitVerbs(); + void InitVerbs(const QString & = ""); void AddTricks(const QStringList newTricks); void SetPreinstalledVerbs(const QStringList installed); diff --git a/src/nerowizard.cpp b/src/nerowizard.cpp index 3ce1fd3..798b541 100644 --- a/src/nerowizard.cpp +++ b/src/nerowizard.cpp @@ -54,6 +54,9 @@ NeroPrefixWizard::NeroPrefixWizard(QWidget *parent) connect(winetricksPresets.at(1), &QAction::triggered, this, &NeroPrefixWizard::SetDXtricks); connect(winetricksPresets.at(2), &QAction::triggered, this, &NeroPrefixWizard::SetVCRunTricks); connect(winetricksPresets.at(3), &QAction::triggered, this, &NeroPrefixWizard::SetXactTricks); + + if(this->palette().window().color().value() > this->palette().text().color().value()) + ui->symlinkDisclaimer->setStyleSheet("color: doubledarkgray"); } NeroPrefixWizard::~NeroPrefixWizard() @@ -95,7 +98,7 @@ void NeroPrefixWizard::on_prefixNameInput_textChanged(const QString &arg1) void NeroPrefixWizard::on_winetricksBox_clicked() { - if(tricks == nullptr) { tricks = new NeroTricksWindow(this); } + if(tricks == nullptr) { tricks = new NeroTricksWindow(this, ui->protonRunnerBox->currentText()); } bool confirmed = false; QStringList prevVerbs = verbsToInstall; diff --git a/src/nerowizard.ui b/src/nerowizard.ui index 7edb72d..0efffed 100644 --- a/src/nerowizard.ui +++ b/src/nerowizard.ui @@ -17,7 +17,7 @@ - QLayout::SizeConstraint::SetNoConstraint + QLayout::SetNoConstraint @@ -53,14 +53,14 @@ This name is already in use by an existing prefix! - Qt::AlignmentFlag::AlignHCenter|Qt::AlignmentFlag::AlignTop + Qt::AlignHCenter|Qt::AlignTop - Qt::Orientation::Vertical + Qt::Vertical @@ -73,7 +73,7 @@ - Qt::Orientation::Horizontal + Qt::Horizontal @@ -82,7 +82,7 @@ - Qt::Orientation::Horizontal + Qt::Horizontal @@ -128,7 +128,7 @@ - Qt::Orientation::Horizontal + Qt::Horizontal @@ -140,7 +140,7 @@ - + @@ -156,13 +156,16 @@ - false + true 9 + + color: gray + Be advised that by enabling this, Windows apps running in this prefix will have access to any data in your home directory! This may be desirable if you want many prefixes to access common files, such as save files stored in Documents. @@ -170,7 +173,7 @@ However, this may come with a privacy risk if you happen to run a malicious app When using this, please practice common sense and don't run applications you wouldn't trust with your data. - Qt::AlignmentFlag::AlignCenter + Qt::AlignCenter true @@ -182,7 +185,7 @@ When using this, please practice common sense and don't run applications you wou - Qt::Orientation::Vertical + Qt::Vertical @@ -195,12 +198,12 @@ When using this, please practice common sense and don't run applications you wou - QLayout::SizeConstraint::SetFixedSize + QLayout::SetFixedSize - Qt::Orientation::Horizontal + Qt::Horizontal @@ -209,7 +212,7 @@ When using this, please practice common sense and don't run applications you wou - Qt::Orientation::Horizontal + Qt::Horizontal @@ -245,17 +248,17 @@ When using this, please practice common sense and don't run applications you wou - QToolButton::ToolButtonPopupMode::MenuButtonPopup + QToolButton::MenuButtonPopup - Qt::ToolButtonStyle::ToolButtonTextBesideIcon + Qt::ToolButtonTextBesideIcon - Qt::Orientation::Horizontal + Qt::Horizontal @@ -270,10 +273,10 @@ When using this, please practice common sense and don't run applications you wou - Qt::Orientation::Horizontal + Qt::Horizontal - QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok