From 9af1b00df52d974a53925345efcd5c047b7d041c Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 11 Nov 2022 18:05:19 -0700 Subject: [PATCH] feat: add list of watched folders move explanation text into dialog class and it's own label Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .../flame/FlameInstanceCreationTask.cpp | 11 ++-- .../modpacksch/FTBPackInstallTask.cpp | 15 ++--- launcher/ui/dialogs/BlockedModsDialog.cpp | 27 +++++++-- launcher/ui/dialogs/BlockedModsDialog.ui | 58 ++++++++++++++++++- 4 files changed, 86 insertions(+), 25 deletions(-) diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp index 4b9e7b860..91554b587 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp @@ -393,13 +393,10 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) qWarning() << "Blocked mods found, displaying mod list"; auto message_dialog = new BlockedModsDialog(m_parent, tr("Blocked mods found"), - tr("The following files are not available for download in third party launchers.
" - "You will need to manually download them and add them to the instance.

" - "Your configured global mods folder and default downloads folder
" - "are automatically checked for the downloaded mods and they will be copied to the instance if found.
" - "Optionally, you may drag and drop the downloaded mods onto this dialog or add a folder to watch
" - "if you did not download the mods to a default location."), - blocked_mods); + tr("The following files are not available for download in third party launchers.
" + "You will need to manually download them and add them to the instance."), + blocked_mods); + message_dialog->setModal(true); if (message_dialog->exec()) { diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp index 26d0c5a1b..4c7b7a4fe 100644 --- a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp +++ b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp @@ -211,22 +211,17 @@ void PackInstallTask::onResolveModsSucceeded() qDebug() << "Blocked files found, displaying file list"; auto message_dialog = new BlockedModsDialog(m_parent, tr("Blocked files found"), - tr("The following files are not available for download in third party launchers.
" - "You will need to manually download them and add them to the instance.

" - "Your configured global mods folder and default downloads folder
" - "are automatically checked for the downloaded mods and they will be copied to the instance if found.
" - "Optionally, you may drag and drop the downloaded mods onto this dialog or add a folder to watch
" - "if you did not download the mods to a default location."), - m_blocked_mods); + tr("The following files are not available for download in third party launchers.
" + "You will need to manually download them and add them to the instance."), + m_blocked_mods); if (message_dialog->exec() == QDialog::Accepted) { qDebug() << "Post dialog blocked mods list: " << m_blocked_mods; createInstance(); - } - else { + } else { abort(); } - + } else { createInstance(); } diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp index ff3316174..7f6b377b1 100644 --- a/launcher/ui/dialogs/BlockedModsDialog.cpp +++ b/launcher/ui/dialogs/BlockedModsDialog.cpp @@ -1,5 +1,4 @@ #include "BlockedModsDialog.h" -#include #include #include #include @@ -34,7 +33,16 @@ BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, cons scanPaths(); this->setWindowTitle(title); - ui->label->setText(text); + ui->labelDescription->setText(text); + ui->labelExplain->setText( + QString(tr("Your configured global mods folder and default downloads folder " + "are automatically checked for the downloaded mods and they will be copied to the instance if found.
" + "Optionally, you may drag and drop the downloaded mods onto this dialog or add a folder to watch " + "if you did not download the mods to a default location.

" + "Global Mods Folder: %1
" + "Default Downloads Folder: %2")) + .arg(APPLICATION->settings()->get("CentralModsDir").toString(), + QStandardPaths::writableLocation(QStandardPaths::DownloadLocation))); ui->labelModsFound->setText(tr("Please download the missing mods.")); setAcceptDrops(true); @@ -56,7 +64,7 @@ void BlockedModsDialog::dragEnterEvent(QDragEnterEvent* e) void BlockedModsDialog::dropEvent(QDropEvent* e) { - foreach (const QUrl& url, e->mimeData()->urls()) { + for (const QUrl& url : e->mimeData()->urls()) { QString filePath = url.toLocalFile(); qDebug() << "[Blocked Mods Dialog] Dropped file:" << filePath; addHashTask(filePath); @@ -106,7 +114,14 @@ void BlockedModsDialog::update() text += QString(tr("%1: %2

Hash: %3 %4


")).arg(mod.name, mod.websiteUrl, mod.hash, span); } - ui->textBrowser->setText(text); + ui->textBrowserModsListing->setText(text); + + QString watching; + for (auto& dir : m_watcher.directories()) { + watching += QString("%1
").arg(dir); + } + + ui->textBrowserWatched->setText(watching); if (allModsMatched()) { ui->labelModsFound->setText(tr("All mods found ✔")); @@ -181,8 +196,8 @@ void BlockedModsDialog::buildHashTask(QString path) qDebug() << "[Blocked Mods Dialog] Creating Hash task for path: " << path; - connect(hash_task.get(), &Task::succeeded, [this, hash_task, path] { checkMatchHash(hash_task->getResult(), path); }); - connect(hash_task.get(), &Task::failed, [path] { qDebug() << "Failed to hash path: " << path; }); + connect(hash_task.get(), &Task::succeeded, this, [this, hash_task, path] { checkMatchHash(hash_task->getResult(), path); }); + connect(hash_task.get(), &Task::failed, this, [path] { qDebug() << "Failed to hash path: " << path; }); m_hashing_task->addTask(hash_task); } diff --git a/launcher/ui/dialogs/BlockedModsDialog.ui b/launcher/ui/dialogs/BlockedModsDialog.ui index 371549cf4..fb1036b77 100644 --- a/launcher/ui/dialogs/BlockedModsDialog.ui +++ b/launcher/ui/dialogs/BlockedModsDialog.ui @@ -15,17 +15,36 @@ - + Qt::RichText + + true + - + + + + + + true + + + + + + + + 0 + 165 + + true @@ -34,6 +53,41 @@ + + + + + 0 + 1 + + + + Watched Folders: + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + 0 + 12 + + + +