diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | launcher/Application.cpp | 3 | ||||
-rw-r--r-- | launcher/settings/INISettingsObject.cpp | 25 | ||||
-rw-r--r-- | launcher/settings/INISettingsObject.h | 5 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ExternalResourcesPage.cpp | 4 | ||||
-rw-r--r-- | launcher/ui/pages/instance/ModFolderPage.cpp | 4 | ||||
-rw-r--r-- | program_info/CMakeLists.txt | 2 |
7 files changed, 36 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e149ce1..a3b74a73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ set(Launcher_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can g set(Launcher_BUG_TRACKER_URL "https://github.com/PrismLauncher/PrismLauncher/issues" CACHE STRING "URL for the bug tracker.") # Translations Platform URL -set(Launcher_TRANSLATIONS_URL "https://hosted.weblate.org/projects/prismlauncher/prismlauncher/" CACHE STRING "URL for the translations platform.") +set(Launcher_TRANSLATIONS_URL "https://hosted.weblate.org/projects/prismlauncher/launcher/" CACHE STRING "URL for the translations platform.") # Matrix Space set(Launcher_MATRIX_URL "https://matrix.to/#/#prismlauncher:matrix.org" CACHE STRING "URL to the Matrix Space") diff --git a/launcher/Application.cpp b/launcher/Application.cpp index e94e96a9..b85729f0 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -488,7 +488,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // Initialize application settings { - m_settings.reset(new INISettingsObject(BuildConfig.LAUNCHER_CONFIGFILE, this)); + // Provide a fallback for migration from PolyMC + m_settings.reset(new INISettingsObject({ BuildConfig.LAUNCHER_CONFIGFILE, "polymc.cfg" }, this)); // Updates // Multiple channels are separated by spaces m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL); diff --git a/launcher/settings/INISettingsObject.cpp b/launcher/settings/INISettingsObject.cpp index 12513403..da962ee9 100644 --- a/launcher/settings/INISettingsObject.cpp +++ b/launcher/settings/INISettingsObject.cpp @@ -16,7 +16,30 @@ #include "INISettingsObject.h" #include "Setting.h" -INISettingsObject::INISettingsObject(const QString &path, QObject *parent) +#include <QDebug> +#include <QFile> + +INISettingsObject::INISettingsObject(QStringList paths, QObject *parent) + : SettingsObject(parent) +{ + auto first_path = paths.constFirst(); + for (auto path : paths) { + if (!QFile::exists(path)) + continue; + + if (path != first_path && QFile::exists(path)) { + // Copy the fallback to the preferred path. + QFile::copy(path, first_path); + qDebug() << "Copied settings from" << path << "to" << first_path; + break; + } + } + + m_filePath = first_path; + m_ini.loadFile(first_path); +} + +INISettingsObject::INISettingsObject(QString path, QObject* parent) : SettingsObject(parent) { m_filePath = path; diff --git a/launcher/settings/INISettingsObject.h b/launcher/settings/INISettingsObject.h index 26cc32e5..d2f448a9 100644 --- a/launcher/settings/INISettingsObject.h +++ b/launcher/settings/INISettingsObject.h @@ -28,7 +28,10 @@ class INISettingsObject : public SettingsObject { Q_OBJECT public: - explicit INISettingsObject(const QString &path, QObject *parent = 0); + /** 'paths' is a list of INI files to try, in order, for fallback support. */ + explicit INISettingsObject(QStringList paths, QObject* parent = nullptr); + + explicit INISettingsObject(QString path, QObject* parent = nullptr); /*! * \brief Gets the path to the INI file. diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp index f31e8325..b6c873cc 100644 --- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp +++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp @@ -103,10 +103,6 @@ void ExternalResourcesPage::runningStateChanged(bool running) return; m_controlsEnabled = !running; - ui->actionAddItem->setEnabled(m_controlsEnabled); - ui->actionDisableItem->setEnabled(m_controlsEnabled); - ui->actionEnableItem->setEnabled(m_controlsEnabled); - ui->actionRemoveItem->setEnabled(m_controlsEnabled); } bool ExternalResourcesPage::shouldDisplay() const diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp index 28a874c2..f0106066 100644 --- a/launcher/ui/pages/instance/ModFolderPage.cpp +++ b/launcher/ui/pages/instance/ModFolderPage.cpp @@ -117,6 +117,10 @@ void ModFolderPage::runningStateChanged(bool running) ExternalResourcesPage::runningStateChanged(running); ui->actionDownloadItem->setEnabled(!running); ui->actionUpdateItem->setEnabled(!running); + ui->actionAddItem->setEnabled(!running); + ui->actionEnableItem->setEnabled(!running); + ui->actionDisableItem->setEnabled(!running); + ui->actionRemoveItem->setEnabled(!running); } bool ModFolderPage::shouldDisplay() const diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 4d7c224d..e46f63a3 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -17,7 +17,7 @@ set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE) set(Launcher_DisplayName "Prism Launcher" PARENT_SCOPE) set(Launcher_UserAgent "${Launcher_CommonName}/${Launcher_VERSION_NAME}" PARENT_SCOPE) set(Launcher_ConfigFile "prismlauncher.cfg" PARENT_SCOPE) -set(Launcher_Git "https://github.com/PlaceholderMC/PrismLauncher" PARENT_SCOPE) +set(Launcher_Git "https://github.com/PrismLauncher/PrismLauncher" PARENT_SCOPE) set(Launcher_DesktopFileName "org.prismlauncher.PrismLauncher.desktop" PARENT_SCOPE) set(Launcher_Desktop "program_info/org.prismlauncher.PrismLauncher.desktop" PARENT_SCOPE) |