Skip to content

Commit

Permalink
Merge branch 'main' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongGino committed Dec 7, 2024
2 parents 4163b40 + 1da8c4e commit 6a25851
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 87 deletions.
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
41 changes: 26 additions & 15 deletions src/neromanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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();
}

Expand All @@ -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"));
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -846,6 +853,7 @@ void NeroManagerWindow::prefixSettings_result()
}
}
delete prefixSettings;
prefixSettings = nullptr;
}

void NeroManagerWindow::on_managerSettings_clicked()
Expand Down Expand Up @@ -876,27 +884,26 @@ 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) + '.' +
QString::number(QT_VERSION_PATCH));
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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/neromanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -165,6 +165,7 @@ private slots:
QList<NeroThreadController*> umuController;
QList<int> currentlyRunning;
int threadsCount = 0;
QStringList oneOffsRunning;

// Prefixes list assets
QList<QPushButton*> prefixMainButton;
Expand Down
Loading

0 comments on commit 6a25851

Please sign in to comment.