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>
This commit is contained in:
Rachel Powers 2022-11-11 18:05:19 -07:00
parent 51c27e2748
commit 9af1b00df5
4 changed files with 86 additions and 25 deletions

View File

@ -394,12 +394,9 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop)
auto message_dialog = new BlockedModsDialog(m_parent, tr("Blocked mods found"),
tr("The following files are not available for download in third party launchers.<br/>"
"You will need to manually download them and add them to the instance.<br/><br/>"
"Your configured global mods folder and default downloads folder<br/>"
"are automatically checked for the downloaded mods and they will be copied to the instance if found.<br/>"
"Optionally, you may drag and drop the downloaded mods onto this dialog or add a folder to watch<br/>"
"if you did not download the mods to a default location."),
"You will need to manually download them and add them to the instance."),
blocked_mods);
message_dialog->setModal(true);
if (message_dialog->exec()) {

View File

@ -212,18 +212,13 @@ void PackInstallTask::onResolveModsSucceeded()
auto message_dialog = new BlockedModsDialog(m_parent, tr("Blocked files found"),
tr("The following files are not available for download in third party launchers.<br/>"
"You will need to manually download them and add them to the instance.<br/><br/>"
"Your configured global mods folder and default downloads folder<br/>"
"are automatically checked for the downloaded mods and they will be copied to the instance if found.<br/>"
"Optionally, you may drag and drop the downloaded mods onto this dialog or add a folder to watch<br/>"
"if you did not download the mods to a default location."),
"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();
}

View File

@ -1,5 +1,4 @@
#include "BlockedModsDialog.h"
#include <qfileinfo.h>
#include <QDesktopServices>
#include <QDialogButtonBox>
#include <QPushButton>
@ -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.<br/>"
"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.<br/><br/>"
"Global Mods Folder: %1<br/>"
"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: <a href='%2'>%2</a> <p>Hash: %3 %4</p> <br/>")).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<br/>").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);
}

View File

@ -15,17 +15,36 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelDescription">
<property name="text">
<string notr="true"/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser">
<widget class="QLabel" name="labelExplain">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowserModsListing">
<property name="minimumSize">
<size>
<width>0</width>
<height>165</height>
</size>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
@ -34,6 +53,41 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelWatched">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Watched Folders:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowserWatched">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>12</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="bottomBoxH">
<item>