From a0045ece075d5caf5d0b6982002dd6bd845ddf0f Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Mon, 27 Mar 2023 19:01:53 -0700 Subject: [PATCH] feat: add setting to watch recursively Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- launcher/Application.cpp | 1 + launcher/ui/dialogs/BlockedModsDialog.cpp | 3 +- launcher/ui/pages/global/LauncherPage.cpp | 6 +++ launcher/ui/pages/global/LauncherPage.h | 1 + launcher/ui/pages/global/LauncherPage.ui | 64 +++++++++++++---------- 5 files changed, 47 insertions(+), 28 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 879af535..1fc31549 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -517,6 +517,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods"); m_settings->registerSetting("IconsDir", "icons"); m_settings->registerSetting("DownloadsDir", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)); + m_settings->registerSetting("DownloadsDirWatchRecursive", false); // Editors m_settings->registerSetting("JsonEditor", QString()); diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp index ac06625e..36df5f46 100644 --- a/launcher/ui/dialogs/BlockedModsDialog.cpp +++ b/launcher/ui/dialogs/BlockedModsDialog.cpp @@ -185,7 +185,8 @@ void BlockedModsDialog::setupWatch() { const QString downloadsFolder = APPLICATION->settings()->get("DownloadsDir").toString(); const QString modsFolder = APPLICATION->settings()->get("CentralModsDir").toString(); - watchPath(downloadsFolder, true); + const bool downloadsFolderWatchRecursive = APPLICATION->settings()->get("DownloadsDirWatchRecursive").toBool(); + watchPath(downloadsFolder, downloadsFolderWatchRecursive); watchPath(modsFolder, true); } diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 324eb461..20e02230 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -184,6 +184,11 @@ void LauncherPage::on_downloadsDirBrowseBtn_clicked() } } +void LauncherPage::on_downloadsDirWatchRecursiveCheckBox_clicked() +{ + // incase anything needs to be done here +} + void LauncherPage::on_metadataDisableBtn_clicked() { ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); @@ -217,6 +222,7 @@ void LauncherPage::applySettings() s->set("CentralModsDir", ui->modsDirTextBox->text()); s->set("IconsDir", ui->iconsDirTextBox->text()); s->set("DownloadsDir", ui->downloadsDirTextBox->text()); + s->set("DownloadsDirWatchRecursive", ui->downloadsDirWatchRecursiveCheckBox->isChecked()); auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId(); switch (sortMode) diff --git a/launcher/ui/pages/global/LauncherPage.h b/launcher/ui/pages/global/LauncherPage.h index 33f66f1b..c5ebbe39 100644 --- a/launcher/ui/pages/global/LauncherPage.h +++ b/launcher/ui/pages/global/LauncherPage.h @@ -90,6 +90,7 @@ slots: void on_iconsDirBrowseBtn_clicked(); void on_downloadsDirBrowseBtn_clicked(); void on_metadataDisableBtn_clicked(); + void on_downloadsDirWatchRecursiveCheckBox_clicked(); /*! * Updates the font preview diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 923b7f95..6279d879 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -67,19 +67,16 @@ Folders - - + + - ... + &Downloads: + + + downloadsDirTextBox - - - - - - @@ -90,16 +87,25 @@ + + + + + + - - + + - ... + ... + + + @@ -117,6 +123,20 @@ + + + + ... + + + + + + + ... + + + @@ -127,23 +147,13 @@ - - - - &Downloads: + + + + when looking for mods in places like the blocked mods dialog Prismlauncher will check in sub folders of your downloads folder too. - - downloadsDirTextBox - - - - - - - - - ... + Check downloads folder recursively