From 4fbcbc857d07209bae782055fb8d4ee119a16f25 Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Wed, 18 Sep 2024 16:33:28 -0300 Subject: [PATCH] fix linux and resize --- src/qt_gui/checkUpdate.cpp | 29 +++++++++++++++-------------- src/qt_gui/main_window.cpp | 4 ++-- src/qt_gui/settings_dialog.cpp | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/qt_gui/checkUpdate.cpp b/src/qt_gui/checkUpdate.cpp index 3ee11d3bf..75e263f65 100644 --- a/src/qt_gui/checkUpdate.cpp +++ b/src/qt_gui/checkUpdate.cpp @@ -142,7 +142,6 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) { close(); return; } else { - setFixedSize(420, 205); setupUI_UpdateAvailable(downloadUrl, latestDate, latestRev, currentDate, currentRev); } reply->deleteLater(); @@ -215,13 +214,13 @@ void CheckUpdate::setupUI_UpdateAvailable(const QString& downloadUrl, const QStr if (!textField->isVisible()) { requestChangelog(currentRev, latestRev, downloadUrl, latestDate, currentDate); - setFixedSize(420, 410); textField->setVisible(true); toggleButton->setText(tr("Hide Changelog")); + adjustSize(); } else { - setFixedSize(420, 205); textField->setVisible(false); toggleButton->setText(tr("Show Changelog")); + adjustSize(); } } else { QMessageBox::information( @@ -230,7 +229,7 @@ void CheckUpdate::setupUI_UpdateAvailable(const QString& downloadUrl, const QStr } }); } else { - setFixedSize(420, 175); + adjustSize(); } connect(yesButton, &QPushButton::clicked, this, @@ -555,9 +554,9 @@ void CheckUpdate::Install() { scriptContent = QStringLiteral("@echo off\n" "chcp 65001\n" "echo %1\n" - "timeout /t 3 /nobreak\n" + "timeout /t 2 /nobreak\n" "xcopy /E /I /Y \"%2\\*\" \"%3\\\"\n" - "timeout /t 3 /nobreak\n" + "timeout /t 2 /nobreak\n" "del /Q \"%3\\update.bat\"\n" "del /Q \"%3\\temp_download_update.zip\"\n" "start \"\" \"%3\\shadps4.exe\"\n" @@ -570,14 +569,14 @@ void CheckUpdate::Install() { scriptFileName = tempDirPath + "/update.sh"; scriptContent = QStringLiteral("#!/bin/bash\n" "echo \"%1\"\n" - "sleep 3\n" + "sleep 2\n" "cp -r \"%2/\"* \"%3/\"\n" - "sleep 3\n" + "sleep 2\n" "rm \"%3/update.sh\"\n" - "rm \"%3/Shadps4-qt.AppImage\"\n" + "rm \"%3/temp_download_update.zip\"\n" + "rm -r \"%2\"\n" "chmod +x \"%3/Shadps4-qt.AppImage\"\n" - "cd \"%3\" && ./Shadps4-qt.AppImage\n" - "rm -r \"%2\"\n"); + "cd \"%3\" && ./Shadps4-qt.AppImage\n"); arguments << scriptFileName; processCommand = "bash"; @@ -586,9 +585,9 @@ void CheckUpdate::Install() { scriptFileName = tempDirPath + "/update.sh"; scriptContent = QStringLiteral("#!/bin/bash\n" "echo \"%1\"\n" - "sleep 3\n" + "sleep 2\n" "tar -xzf \"%2/temp_download_update.tar.gz\" -C \"%3\"\n" - "sleep 3\n" + "sleep 2\n" "rm \"%3/update.sh\"\n" "chmod +x \"%3/shadps4.app/Contents/MacOS/shadps4\"\n" "open \"%3/shadps4.app\"\n" @@ -608,8 +607,10 @@ void CheckUpdate::Install() { // Make the script executable on Unix-like systems #if defined(Q_OS_LINUX) || defined(Q_OS_MAC) - std::filesystem::permissions(scriptFileName, std::filesystem::perms::owner_exec); + scriptFile.setPermissions(QFileDevice::ExeOwner | QFileDevice::ReadOwner | + QFileDevice::WriteOwner); #endif + QProcess::startDetached(processCommand, arguments); exit(EXIT_SUCCESS); diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 8cb36cca5..fd9602b74 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -169,7 +169,7 @@ void MainWindow::CheckUpdateMain(bool checkSave) { } } auto checkUpdate = new CheckUpdate(false); - checkUpdate->show(); + checkUpdate->exec(); } void MainWindow::GetPhysicalDevices() { @@ -235,7 +235,7 @@ void MainWindow::CreateConnects() { connect(ui->updaterAct, &QAction::triggered, this, [this]() { auto checkUpdate = new CheckUpdate(true); - checkUpdate->show(); + checkUpdate->exec(); }); connect(ui->aboutAct, &QAction::triggered, this, [this]() { diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 52cf9ad0a..45fa33525 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -131,7 +131,7 @@ SettingsDialog::SettingsDialog(std::span physical_devices, QWidge connect(ui->checkUpdateButton, &QPushButton::clicked, this, []() { auto checkUpdate = new CheckUpdate(true); - checkUpdate->show(); + checkUpdate->exec(); }); }