aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp10
-rw-r--r--launcher/Application.h2
-rw-r--r--launcher/CMakeLists.txt2
-rw-r--r--launcher/DesktopServices.cpp12
-rw-r--r--launcher/Flatpak.cpp31
-rw-r--r--launcher/Flatpak.h21
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp18
7 files changed, 26 insertions, 70 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 33b1774c..abdfc06d 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -1139,6 +1139,16 @@ std::vector<ITheme *> Application::getValidApplicationThemes()
return ret;
}
+bool Application::isFlatpak()
+{
+ #ifdef Q_OS_LINUX
+ QFileInfo check_file("/.flatpak-info");
+ return check_file.exists();
+ #else
+ return false;
+ #endif
+}
+
void Application::setApplicationTheme(const QString& name, bool initial)
{
auto systemPalette = qApp->palette();
diff --git a/launcher/Application.h b/launcher/Application.h
index c3e29ef5..54d9ba5f 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -104,6 +104,8 @@ public:
QIcon getThemedIcon(const QString& name);
+ bool isFlatpak();
+
void setIconTheme(const QString& name);
std::vector<ITheme *> getValidApplicationThemes();
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 1a16485e..98cb0a3b 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -582,8 +582,6 @@ SET(LAUNCHER_SOURCES
ApplicationMessage.cpp
# GUI - general utilities
- Flatpak.h
- Flatpak.cpp
DesktopServices.h
DesktopServices.cpp
VersionProxyModel.h
diff --git a/launcher/DesktopServices.cpp b/launcher/DesktopServices.cpp
index f4226c15..c29cbe7d 100644
--- a/launcher/DesktopServices.cpp
+++ b/launcher/DesktopServices.cpp
@@ -37,7 +37,7 @@
#include <QDesktopServices>
#include <QProcess>
#include <QDebug>
-#include "Flatpak.h"
+#include "Application.h"
/**
* This shouldn't exist, but until QTBUG-9328 and other unreported bugs are fixed, it needs to be a thing.
@@ -119,7 +119,7 @@ bool openDirectory(const QString &path, bool ensureExists)
return QDesktopServices::openUrl(QUrl::fromLocalFile(dir.absolutePath()));
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!Flatpak::IsFlatpak())
+ if(!APPLICATION->isFlatpak())
{
return IndirectOpen(f);
}
@@ -140,7 +140,7 @@ bool openFile(const QString &path)
return QDesktopServices::openUrl(QUrl::fromLocalFile(path));
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!Flatpak::IsFlatpak())
+ if(!APPLICATION->isFlatpak())
{
return IndirectOpen(f);
}
@@ -158,7 +158,7 @@ bool openFile(const QString &application, const QString &path, const QString &wo
qDebug() << "Opening file" << path << "using" << application;
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
- if(!Flatpak::IsFlatpak())
+ if(!APPLICATION->isFlatpak())
{
return IndirectOpen([&]()
{
@@ -178,7 +178,7 @@ bool run(const QString &application, const QStringList &args, const QString &wor
{
qDebug() << "Running" << application << "with args" << args.join(' ');
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!Flatpak::IsFlatpak())
+ if(!APPLICATION->isFlatpak())
{
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
@@ -203,7 +203,7 @@ bool openUrl(const QUrl &url)
return QDesktopServices::openUrl(url);
};
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
- if(!Flatpak::IsFlatpak())
+ if(!APPLICATION->isFlatpak())
{
return IndirectOpen(f);
}
diff --git a/launcher/Flatpak.cpp b/launcher/Flatpak.cpp
deleted file mode 100644
index 2c28903c..00000000
--- a/launcher/Flatpak.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-only
-/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 dada513 <dada513@protonmail.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-#include <QFileInfo>
-
-namespace Flatpak
-{
- bool IsFlatpak()
- {
- #ifdef Q_OS_LINUX
- QFileInfo check_file("/.flatpak-info");
- return check_file.exists();
- #else
- return false;
- #endif
- }
-}
diff --git a/launcher/Flatpak.h b/launcher/Flatpak.h
deleted file mode 100644
index 8fd315fb..00000000
--- a/launcher/Flatpak.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-only
-/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 dada513 <dada513@protonmail.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-namespace Flatpak
-{
- bool IsFlatpak();
-}
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index c3dde8e6..42ad5ae3 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -49,7 +49,6 @@
#include "Application.h"
#include "BuildConfig.h"
#include "ui/themes/ITheme.h"
-#include "Flatpak.h"
#include <QApplication>
#include <QProcess>
@@ -136,28 +135,27 @@ void LauncherPage::on_instDirBrowseBtn_clicked()
warning.setInformativeText(
tr("Do you really want to use this path? "
"Selecting \"No\" will close this and not alter your instance path."));
- warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ warning.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
int result = warning.exec();
- if (result == QMessageBox::Yes)
+ if (result == QMessageBox::Ok)
{
ui->instDirTextBox->setText(cooked_dir);
}
}
- else if(Flatpak::IsFlatpak() && raw_dir.startsWith("/run/user"))
+ else if(APPLICATION->isFlatpak() && raw_dir.startsWith("/run/user"))
{
QMessageBox warning;
warning.setText(tr("You're trying to specify an instance folder "
"which was granted temporaily via Flatpak.\n"
- "This is known to cause problems, "
- "after a restart the launcher might break, "
+ "This is known to cause problems. "
+ "After a restart the launcher might break, "
"because it will no longer have access to that directory.\n\n"
"Granting PolyMC access to it via Flatseal is recommended."));
warning.setInformativeText(
- tr("Do you really want to use this path?\n"
- "Selecting \"No\" will close this and not alter your instance path."));
- warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ tr("Do you want to proceed anyway?"));
+ warning.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
int result = warning.exec();
- if (result == QMessageBox::Yes)
+ if (result == QMessageBox::Ok)
{
ui->instDirTextBox->setText(cooked_dir);
}