diff --git a/src/main.cpp b/src/main.cpp index 1dea452..bf47903 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,6 +39,8 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); + QCoreApplication::setApplicationName("Nero-UMU"); + QTranslator translator; const QStringList uiLanguages = QLocale::system().uiLanguages(); for (const QString &locale : uiLanguages) { diff --git a/src/neromanager.cpp b/src/neromanager.cpp index fd99dda..327bc80 100644 --- a/src/neromanager.cpp +++ b/src/neromanager.cpp @@ -38,8 +38,6 @@ NeroManagerWindow::NeroManagerWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::NeroManagerWindow) { - QCoreApplication::setApplicationName("Nero-UMU"); - /* OLD ICON CODE // rand + undefined int, bit shifted to only give the three least significant bytes (0-7) // THIS can be set before window setup... @@ -55,8 +53,6 @@ NeroManagerWindow::NeroManagerWindow(QWidget *parent) } */ - this->setWindowIcon(QIcon(":/ico/systrayPhi")); - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // required for good hidpi icon quality because Qt < 6 didn't set this automatically. QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); @@ -634,6 +630,9 @@ void NeroManagerWindow::prefixShortcutPlayButtons_clicked() umuController.at(prefixShortcutPlayButton.at(slot)->property("thread").toInt())->Stop(); } else { + ui->prefixSettingsBtn->setEnabled(false); + ui->prefixTricksBtn->setEnabled(false); + prefixShortcutPlayButton.at(slot)->setIcon(QIcon::fromTheme("media-playback-stop")); prefixShortcutPlayButton.at(slot)->setToolTip("Stop " + prefixShortcutLabel.at(slot)->text()); ui->backButton->setIcon(QIcon::fromTheme("media-playback-stop")); @@ -677,6 +676,9 @@ void NeroManagerWindow::prefixShortcutEditButtons_clicked() prefixSettings = new NeroPrefixSettingsWindow(this, settings.value(prefixShortcutLabel.at(slot)->text())); prefixSettings->setProperty("slot", slot); connect(prefixSettings, &NeroPrefixSettingsWindow::finished, this, &NeroManagerWindow::prefixSettings_result); + if(currentlyRunning.count()) + if(prefixSettings->deleteShortcut != nullptr) + prefixSettings->deleteShortcut->setEnabled(false); prefixSettings->show(); } @@ -690,6 +692,9 @@ void NeroManagerWindow::on_oneTimeRunBtn_clicked() QFileDialog::DontResolveSymlinks)); if(!oneTimeApp.isEmpty()) { + ui->prefixSettingsBtn->setEnabled(false); + ui->prefixTricksBtn->setEnabled(false); + ui->backButton->setIcon(QIcon::fromTheme("media-playback-stop")); ui->backButton->setToolTip("Shut down all running programs in this prefix."); sysTray->setIcon(QIcon(":/ico/systrayPhiPlaying")); @@ -724,6 +729,8 @@ void NeroManagerWindow::on_oneTimeRunBtn_clicked() } umuController.last()->setProperty("slot", threadsCount-1); + umuController.last()->setProperty("running", oneTimeApp.mid(oneTimeApp.lastIndexOf('/')+1)); + oneOffsRunning.append(oneTimeApp.mid(oneTimeApp.lastIndexOf('/')+1)); connect(umuController.last(), &NeroThreadController::passUmuResults, this, &NeroManagerWindow::handleUmuResults); connect(&umuController.last()->umuWorker->Runner, &NeroRunner::StatusUpdate, this, &NeroManagerWindow::handleUmuSignal); emit umuController.last()->operate(); @@ -846,6 +853,7 @@ void NeroManagerWindow::prefixSettings_result() } } delete prefixSettings; + prefixSettings = nullptr; } void NeroManagerWindow::on_managerSettings_clicked() @@ -876,16 +884,16 @@ void NeroManagerWindow::actionExit_activated() close(); } -void NeroManagerWindow::on_actionAbout_Nero_triggered() +void NeroManagerWindow::on_aboutBtn_clicked() { // TODO: better about screen pls QString vInfo; - #ifdef NERO_VERSION +#ifdef NERO_VERSION vInfo.append(" v" + QString(NERO_VERSION)); - #endif // NERO_VERSION - #ifdef NERO_GITHASH +#endif // NERO_VERSION +#ifdef NERO_GITHASH vInfo.append("-" + QString(NERO_GITHASH)); - #endif // NERO_GITHASH +#endif // NERO_GITHASH vInfo.append("\nRunning on Qt " + QString::number(QT_VERSION_MAJOR) + '.' + QString::number(QT_VERSION_MINOR) + '.' + @@ -893,10 +901,9 @@ void NeroManagerWindow::on_actionAbout_Nero_triggered() QMessageBox::about(this, "About Nero Manager", "Nero Manager" + vInfo + - "\n\nA simple Proton manager."); + "\n\nA simple Proton manager."); } - void NeroManagerWindow::blinkTimer_timeout() { switch(blinkingState) { @@ -955,7 +962,7 @@ void NeroManagerWindow::handleUmuResults(const int &buttonSlot, const int &resul if(managerCfg->value("ShortcutHidesManager").toBool()) if(this->isHidden()) this->show(); - } + } else oneOffsRunning.removeOne(sender()->property("running").toString()); delete umuController[threadSlot]; umuController[threadSlot] = nullptr; @@ -969,9 +976,13 @@ void NeroManagerWindow::handleUmuResults(const int &buttonSlot, const int &resul ui->backButton->setToolTip("Go back to prefixes list."); sysTray->setIcon(QIcon(":/ico/systrayPhi")); sysTray->setToolTip("Nero Manager"); - } else { - sysTray->setToolTip("Nero Manager (" + NeroFS::GetCurrentPrefix() + " is running " + QString::number(currentlyRunning.count()) + " apps)"); - } + ui->prefixSettingsBtn->setEnabled(true); + ui->prefixTricksBtn->setEnabled(true); + } else if(currentlyRunning.count() == 1) { + if(currentlyRunning.first() != -1) + sysTray->setToolTip("Nero Manager (" + NeroFS::GetCurrentPrefix() + " is running " + prefixShortcutLabel.at(currentlyRunning.first())->text() + ')'); + else sysTray->setToolTip("Nero Manager (" + NeroFS::GetCurrentPrefix() + " is running " + oneOffsRunning.first() + ')'); + } else sysTray->setToolTip("Nero Manager (" + NeroFS::GetCurrentPrefix() + " is running " + QString::number(currentlyRunning.count()) + " apps)"); } void NeroManagerWindow::handleUmuSignal(const int &signalType) diff --git a/src/neromanager.h b/src/neromanager.h index ceba133..3351d36 100644 --- a/src/neromanager.h +++ b/src/neromanager.h @@ -125,12 +125,12 @@ private slots: void on_prefixSettingsBtn_clicked(); - void on_actionAbout_Nero_triggered(); - void on_oneTimeRunBtn_clicked(); void on_managerSettings_clicked(); + void on_aboutBtn_clicked(); + private: Ui::NeroManagerWindow *ui; NeroManagerPreferences *prefs = nullptr; @@ -165,6 +165,7 @@ private slots: QList umuController; QList currentlyRunning; int threadsCount = 0; + QStringList oneOffsRunning; // Prefixes list assets QList prefixMainButton; diff --git a/src/neromanager.ui b/src/neromanager.ui index 00e8c43..a8f6cad 100644 --- a/src/neromanager.ui +++ b/src/neromanager.ui @@ -13,6 +13,10 @@ NeroManagerWindow + + + :/ico/systrayPhi:/ico/systrayPhi + @@ -65,7 +69,7 @@ Top Text - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -92,7 +96,7 @@ Subtitle - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter @@ -128,7 +132,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -176,7 +180,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -193,7 +197,7 @@ - QFrame::Raised + QFrame::Shadow::Raised 2 @@ -202,7 +206,7 @@ 1 - Qt::Horizontal + Qt::Orientation::Horizontal @@ -215,27 +219,27 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame - QFrame::Plain + QFrame::Shadow::Plain - Qt::ScrollBarAlwaysOff + Qt::ScrollBarPolicy::ScrollBarAlwaysOff true - Qt::AlignHCenter|Qt::AlignTop + Qt::AlignmentFlag::AlignHCenter|Qt::AlignmentFlag::AlignTop 0 0 - 563 - 183 + 557 + 179 @@ -251,7 +255,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -273,14 +277,14 @@ <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> - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter - Qt::Vertical + Qt::Orientation::Vertical @@ -290,24 +294,69 @@ - - - - - - - - - - - 32 - 32 - - - - true + + + + 0 - + + + + About Nero... + + + + + + + + + + 32 + 32 + + + + true + + + + + + + Qt::Orientation::Horizontal + + + + 0 + 20 + + + + + + + + Set Nero Manager settings + + + + + + + + + + 32 + 32 + + + + true + + + + @@ -316,27 +365,27 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame - QFrame::Plain + QFrame::Shadow::Plain - Qt::ScrollBarAlwaysOff + Qt::ScrollBarPolicy::ScrollBarAlwaysOff true - Qt::AlignHCenter|Qt::AlignTop + Qt::AlignmentFlag::AlignHCenter|Qt::AlignmentFlag::AlignTop 0 0 - 563 - 182 + 557 + 178 @@ -345,14 +394,14 @@ - QLayout::SetNoConstraint + QLayout::SizeConstraint::SetNoConstraint - Qt::Vertical + Qt::Orientation::Vertical @@ -365,7 +414,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -381,14 +430,14 @@ Prefix Management: - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter - QLayout::SetFixedSize + QLayout::SizeConstraint::SetFixedSize @@ -442,29 +491,9 @@ - - - - 0 - 0 - 575 - 19 - - - - - About - - - - - - - - &About Nero... - - - + + + diff --git a/src/neroprefixsettings.h b/src/neroprefixsettings.h index 41c48c5..eb9c5d5 100644 --- a/src/neroprefixsettings.h +++ b/src/neroprefixsettings.h @@ -49,6 +49,8 @@ class NeroPrefixSettingsWindow : public QDialog QString newAppIcon; QString appName; + QPushButton *deleteShortcut = nullptr; + private slots: void on_shortcutIco_clicked(); @@ -122,8 +124,6 @@ private slots: QFont boldFont; - QPushButton *deleteShortcut; - bool umuRunning = false; const QStringList dllOverrideNames = { diff --git a/src/nerorunner.cpp b/src/nerorunner.cpp index f7d500a..4fbe7f3 100644 --- a/src/nerorunner.cpp +++ b/src/nerorunner.cpp @@ -34,7 +34,7 @@ int NeroRunner::StartShortcut(const QString &hash, const bool &prefixAlreadyRunn QProcess runner; if(!settings->value("Shortcuts--"+hash+"/PreRunScript").toString().isEmpty()) { - runner.start(settings->value("Shortcuts--"+hash+"/PreRunScript").toString(), {""}); + runner.start(settings->value("Shortcuts--"+hash+"/PreRunScript").toString(), {}); while(runner.state() != QProcess::NotRunning) { runner.waitForReadyRead(-1); @@ -380,8 +380,11 @@ int NeroRunner::StartShortcut(const QString &hash, const bool &prefixAlreadyRunn WaitLoop(runner, log); + // in case settings changed from manager + settings = NeroFS::GetCurrentPrefixCfg(); + if(!settings->value("Shortcuts--"+hash+"/PostRunScript").toString().isEmpty()) { - runner.start(settings->value("Shortcuts--"+hash+"/PostRunScript").toString(), {""}); + runner.start(settings->value("Shortcuts--"+hash+"/PostRunScript").toString(), {}); while(runner.state() != QProcess::NotRunning) { runner.waitForReadyRead(-1);