fix linux and resize

This commit is contained in:
DanielSvoboda 2024-09-18 16:33:28 -03:00
parent 9e6b6ba4d9
commit 4fbcbc857d
3 changed files with 18 additions and 17 deletions

View File

@ -142,7 +142,6 @@ void CheckUpdate::CheckForUpdates(const bool showMessage) {
close(); close();
return; return;
} else { } else {
setFixedSize(420, 205);
setupUI_UpdateAvailable(downloadUrl, latestDate, latestRev, currentDate, currentRev); setupUI_UpdateAvailable(downloadUrl, latestDate, latestRev, currentDate, currentRev);
} }
reply->deleteLater(); reply->deleteLater();
@ -215,13 +214,13 @@ void CheckUpdate::setupUI_UpdateAvailable(const QString& downloadUrl, const QStr
if (!textField->isVisible()) { if (!textField->isVisible()) {
requestChangelog(currentRev, latestRev, downloadUrl, latestDate, requestChangelog(currentRev, latestRev, downloadUrl, latestDate,
currentDate); currentDate);
setFixedSize(420, 410);
textField->setVisible(true); textField->setVisible(true);
toggleButton->setText(tr("Hide Changelog")); toggleButton->setText(tr("Hide Changelog"));
adjustSize();
} else { } else {
setFixedSize(420, 205);
textField->setVisible(false); textField->setVisible(false);
toggleButton->setText(tr("Show Changelog")); toggleButton->setText(tr("Show Changelog"));
adjustSize();
} }
} else { } else {
QMessageBox::information( QMessageBox::information(
@ -230,7 +229,7 @@ void CheckUpdate::setupUI_UpdateAvailable(const QString& downloadUrl, const QStr
} }
}); });
} else { } else {
setFixedSize(420, 175); adjustSize();
} }
connect(yesButton, &QPushButton::clicked, this, connect(yesButton, &QPushButton::clicked, this,
@ -555,9 +554,9 @@ void CheckUpdate::Install() {
scriptContent = QStringLiteral("@echo off\n" scriptContent = QStringLiteral("@echo off\n"
"chcp 65001\n" "chcp 65001\n"
"echo %1\n" "echo %1\n"
"timeout /t 3 /nobreak\n" "timeout /t 2 /nobreak\n"
"xcopy /E /I /Y \"%2\\*\" \"%3\\\"\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\\update.bat\"\n"
"del /Q \"%3\\temp_download_update.zip\"\n" "del /Q \"%3\\temp_download_update.zip\"\n"
"start \"\" \"%3\\shadps4.exe\"\n" "start \"\" \"%3\\shadps4.exe\"\n"
@ -570,14 +569,14 @@ void CheckUpdate::Install() {
scriptFileName = tempDirPath + "/update.sh"; scriptFileName = tempDirPath + "/update.sh";
scriptContent = QStringLiteral("#!/bin/bash\n" scriptContent = QStringLiteral("#!/bin/bash\n"
"echo \"%1\"\n" "echo \"%1\"\n"
"sleep 3\n" "sleep 2\n"
"cp -r \"%2/\"* \"%3/\"\n" "cp -r \"%2/\"* \"%3/\"\n"
"sleep 3\n" "sleep 2\n"
"rm \"%3/update.sh\"\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" "chmod +x \"%3/Shadps4-qt.AppImage\"\n"
"cd \"%3\" && ./Shadps4-qt.AppImage\n" "cd \"%3\" && ./Shadps4-qt.AppImage\n");
"rm -r \"%2\"\n");
arguments << scriptFileName; arguments << scriptFileName;
processCommand = "bash"; processCommand = "bash";
@ -586,9 +585,9 @@ void CheckUpdate::Install() {
scriptFileName = tempDirPath + "/update.sh"; scriptFileName = tempDirPath + "/update.sh";
scriptContent = QStringLiteral("#!/bin/bash\n" scriptContent = QStringLiteral("#!/bin/bash\n"
"echo \"%1\"\n" "echo \"%1\"\n"
"sleep 3\n" "sleep 2\n"
"tar -xzf \"%2/temp_download_update.tar.gz\" -C \"%3\"\n" "tar -xzf \"%2/temp_download_update.tar.gz\" -C \"%3\"\n"
"sleep 3\n" "sleep 2\n"
"rm \"%3/update.sh\"\n" "rm \"%3/update.sh\"\n"
"chmod +x \"%3/shadps4.app/Contents/MacOS/shadps4\"\n" "chmod +x \"%3/shadps4.app/Contents/MacOS/shadps4\"\n"
"open \"%3/shadps4.app\"\n" "open \"%3/shadps4.app\"\n"
@ -608,8 +607,10 @@ void CheckUpdate::Install() {
// Make the script executable on Unix-like systems // Make the script executable on Unix-like systems
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) #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 #endif
QProcess::startDetached(processCommand, arguments); QProcess::startDetached(processCommand, arguments);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);

View File

@ -169,7 +169,7 @@ void MainWindow::CheckUpdateMain(bool checkSave) {
} }
} }
auto checkUpdate = new CheckUpdate(false); auto checkUpdate = new CheckUpdate(false);
checkUpdate->show(); checkUpdate->exec();
} }
void MainWindow::GetPhysicalDevices() { void MainWindow::GetPhysicalDevices() {
@ -235,7 +235,7 @@ void MainWindow::CreateConnects() {
connect(ui->updaterAct, &QAction::triggered, this, [this]() { connect(ui->updaterAct, &QAction::triggered, this, [this]() {
auto checkUpdate = new CheckUpdate(true); auto checkUpdate = new CheckUpdate(true);
checkUpdate->show(); checkUpdate->exec();
}); });
connect(ui->aboutAct, &QAction::triggered, this, [this]() { connect(ui->aboutAct, &QAction::triggered, this, [this]() {

View File

@ -131,7 +131,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
connect(ui->checkUpdateButton, &QPushButton::clicked, this, []() { connect(ui->checkUpdateButton, &QPushButton::clicked, this, []() {
auto checkUpdate = new CheckUpdate(true); auto checkUpdate = new CheckUpdate(true);
checkUpdate->show(); checkUpdate->exec();
}); });
} }