2022-11-23 13:54:04 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
|
|
|
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
|
|
|
// SPDX-FileCopyrightText: 2022 kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prism Launcher - Minecraft Launcher
|
|
|
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
|
|
|
* Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
|
|
|
* Copyright (C) 2022 kumquat-ir <66188216+kumquat-ir@users.noreply.github.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/>.
|
|
|
|
*/
|
|
|
|
|
2022-07-17 00:14:54 +01:00
|
|
|
#include "BlockedModsDialog.h"
|
2022-11-01 14:06:36 +00:00
|
|
|
#include "ui_BlockedModsDialog.h"
|
2022-07-17 00:14:54 +01:00
|
|
|
|
2022-11-23 13:29:23 +00:00
|
|
|
#include "Application.h"
|
|
|
|
#include "modplatform/helpers/HashUtils.h"
|
|
|
|
|
2022-10-24 12:08:38 +01:00
|
|
|
#include <QDebug>
|
2022-11-23 13:29:23 +00:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QDialogButtonBox>
|
2022-11-11 21:10:45 +00:00
|
|
|
#include <QDragEnterEvent>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QFileInfo>
|
2022-11-23 13:29:23 +00:00
|
|
|
#include <QPushButton>
|
2022-11-11 23:07:57 +00:00
|
|
|
#include <QStandardPaths>
|
2022-07-17 00:14:54 +01:00
|
|
|
|
2022-11-01 14:06:36 +00:00
|
|
|
BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods)
|
2022-11-11 22:45:40 +00:00
|
|
|
: QDialog(parent), ui(new Ui::BlockedModsDialog), m_mods(mods)
|
2022-11-01 14:06:36 +00:00
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
m_hashing_task = shared_qobject_ptr<ConcurrentTask>(new ConcurrentTask(this, "MakeHashesTask", 10));
|
|
|
|
connect(m_hashing_task.get(), &Task::finished, this, &BlockedModsDialog::hashTaskFinished);
|
2022-11-11 23:07:57 +00:00
|
|
|
|
2022-07-17 00:14:54 +01:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
2022-11-23 13:29:23 +00:00
|
|
|
m_openMissingButton = ui->buttonBox->addButton(tr("Open Missing"), QDialogButtonBox::ActionRole);
|
|
|
|
connect(m_openMissingButton, &QPushButton::clicked, this, [this]() { openAll(true); });
|
2022-07-17 00:14:54 +01:00
|
|
|
|
2022-11-11 21:10:45 +00:00
|
|
|
auto downloadFolderButton = ui->buttonBox->addButton(tr("Add Download Folder"), QDialogButtonBox::ActionRole);
|
|
|
|
connect(downloadFolderButton, &QPushButton::clicked, this, &BlockedModsDialog::addDownloadFolder);
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &BlockedModsDialog::directoryChanged);
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Mods List: " << mods;
|
2022-10-24 12:08:38 +01:00
|
|
|
|
2022-10-25 09:19:19 +01:00
|
|
|
setupWatch();
|
2022-10-26 04:18:14 +01:00
|
|
|
scanPaths();
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-07-17 00:14:54 +01:00
|
|
|
this->setWindowTitle(title);
|
2022-11-12 01:05:19 +00:00
|
|
|
ui->labelDescription->setText(text);
|
2022-11-23 12:25:17 +00:00
|
|
|
|
|
|
|
// force all URL handling as external
|
2022-11-12 01:32:11 +00:00
|
|
|
connect(ui->textBrowserWatched, &QTextBrowser::anchorClicked, this, [](const QUrl url) { QDesktopServices::openUrl(url); });
|
|
|
|
|
2022-11-11 21:10:45 +00:00
|
|
|
setAcceptDrops(true);
|
|
|
|
|
2022-10-24 12:08:38 +01:00
|
|
|
update();
|
2022-07-17 00:14:54 +01:00
|
|
|
}
|
|
|
|
|
2022-11-01 14:06:36 +00:00
|
|
|
BlockedModsDialog::~BlockedModsDialog()
|
|
|
|
{
|
2022-07-17 00:14:54 +01:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::dragEnterEvent(QDragEnterEvent* e)
|
|
|
|
{
|
2022-11-11 21:10:45 +00:00
|
|
|
if (e->mimeData()->hasUrls()) {
|
|
|
|
e->acceptProposedAction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::dropEvent(QDropEvent* e)
|
2022-11-11 21:10:45 +00:00
|
|
|
{
|
2022-12-10 00:21:40 +00:00
|
|
|
for (QUrl& url : e->mimeData()->urls()) {
|
|
|
|
if (url.scheme().isEmpty()) { // ensure isLocalFile() works correctly
|
|
|
|
url.setScheme("file");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!url.isLocalFile()) { // can't drop external files here.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
QString filePath = url.toLocalFile();
|
|
|
|
qDebug() << "[Blocked Mods Dialog] Dropped file:" << filePath;
|
|
|
|
addHashTask(filePath);
|
|
|
|
|
|
|
|
// watch for changes
|
|
|
|
QFileInfo file = QFileInfo(filePath);
|
|
|
|
QString path = file.dir().absolutePath();
|
|
|
|
qDebug() << "[Blocked Mods Dialog] Adding watch path:" << path;
|
|
|
|
m_watcher.addPath(path);
|
2022-11-11 21:10:45 +00:00
|
|
|
}
|
2022-11-11 22:45:40 +00:00
|
|
|
scanPaths();
|
|
|
|
update();
|
2022-11-11 21:10:45 +00:00
|
|
|
}
|
|
|
|
|
2022-12-05 20:27:23 +00:00
|
|
|
void BlockedModsDialog::done(int r)
|
|
|
|
{
|
|
|
|
QDialog::done(r);
|
|
|
|
disconnect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &BlockedModsDialog::directoryChanged);
|
|
|
|
}
|
|
|
|
|
2022-11-23 13:29:23 +00:00
|
|
|
void BlockedModsDialog::openAll(bool missingOnly)
|
2022-11-01 14:06:36 +00:00
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& mod : m_mods) {
|
2022-11-23 13:29:23 +00:00
|
|
|
if (!missingOnly || !mod.matched) {
|
|
|
|
QDesktopServices::openUrl(mod.websiteUrl);
|
|
|
|
}
|
2022-07-17 00:14:54 +01:00
|
|
|
}
|
|
|
|
}
|
2022-10-24 12:08:38 +01:00
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::addDownloadFolder()
|
|
|
|
{
|
|
|
|
QString dir =
|
|
|
|
QFileDialog::getExistingDirectory(this, tr("Select directory where you downloaded the mods"),
|
|
|
|
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation), QFileDialog::ShowDirsOnly);
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Adding watch path:" << dir;
|
|
|
|
m_watcher.addPath(dir);
|
|
|
|
scanPath(dir, true);
|
|
|
|
update();
|
2022-11-11 21:10:45 +00:00
|
|
|
}
|
|
|
|
|
2022-10-26 04:18:14 +01:00
|
|
|
/// @brief update UI with current status of the blocked mod detection
|
2022-11-01 14:06:36 +00:00
|
|
|
void BlockedModsDialog::update()
|
|
|
|
{
|
2022-10-24 12:08:38 +01:00
|
|
|
QString text;
|
|
|
|
QString span;
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& mod : m_mods) {
|
2022-10-24 12:08:38 +01:00
|
|
|
if (mod.matched) {
|
|
|
|
// ✔ -> html for HEAVY CHECK MARK : ✔
|
2022-10-31 05:39:12 +00:00
|
|
|
span = QString(tr("<span style=\"color:green\"> ✔ Found at %1 </span>")).arg(mod.localPath);
|
2022-10-24 12:08:38 +01:00
|
|
|
} else {
|
|
|
|
// ✘ -> html for HEAVY BALLOT X : ✘
|
2022-10-31 05:39:12 +00:00
|
|
|
span = QString(tr("<span style=\"color:red\"> ✘ Not Found </span>"));
|
2022-10-24 12:08:38 +01:00
|
|
|
}
|
2022-10-31 05:39:12 +00:00
|
|
|
text += QString(tr("%1: <a href='%2'>%2</a> <p>Hash: %3 %4</p> <br/>")).arg(mod.name, mod.websiteUrl, mod.hash, span);
|
2022-10-24 12:08:38 +01:00
|
|
|
}
|
|
|
|
|
2022-11-12 01:05:19 +00:00
|
|
|
ui->textBrowserModsListing->setText(text);
|
|
|
|
|
|
|
|
QString watching;
|
|
|
|
for (auto& dir : m_watcher.directories()) {
|
2022-11-12 01:32:11 +00:00
|
|
|
watching += QString("<a href=\"%1\">%1</a><br/>").arg(dir);
|
2022-11-12 01:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ui->textBrowserWatched->setText(watching);
|
2022-10-25 18:59:37 +01:00
|
|
|
|
|
|
|
if (allModsMatched()) {
|
2022-11-17 18:46:14 +00:00
|
|
|
ui->labelModsFound->setText("<span style=\"color:green\">✔</span>" + tr("All mods found"));
|
2022-11-23 13:29:23 +00:00
|
|
|
m_openMissingButton->setDisabled(true);
|
2022-10-25 18:59:37 +01:00
|
|
|
} else {
|
2022-10-31 05:39:12 +00:00
|
|
|
ui->labelModsFound->setText(tr("Please download the missing mods."));
|
2022-11-23 13:29:23 +00:00
|
|
|
m_openMissingButton->setDisabled(false);
|
2022-10-25 18:59:37 +01:00
|
|
|
}
|
2022-10-24 12:08:38 +01:00
|
|
|
}
|
|
|
|
|
2022-10-26 04:18:14 +01:00
|
|
|
/// @brief Signal fired when a watched direcotry has changed
|
|
|
|
/// @param path the path to the changed directory
|
2022-11-01 14:06:36 +00:00
|
|
|
void BlockedModsDialog::directoryChanged(QString path)
|
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Directory changed: " << path;
|
2022-11-11 21:10:45 +00:00
|
|
|
validateMatchedMods();
|
2022-11-11 22:45:40 +00:00
|
|
|
scanPath(path, true);
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
2022-10-26 04:18:14 +01:00
|
|
|
/// @brief add the user downloads folder and the global mods folder to the filesystem watcher
|
2022-11-01 14:06:36 +00:00
|
|
|
void BlockedModsDialog::setupWatch()
|
|
|
|
{
|
2022-10-25 09:19:19 +01:00
|
|
|
const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
|
|
|
const QString modsFolder = APPLICATION->settings()->get("CentralModsDir").toString();
|
2022-11-11 22:45:40 +00:00
|
|
|
m_watcher.addPath(downloadsFolder);
|
|
|
|
m_watcher.addPath(modsFolder);
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
2022-10-26 04:18:14 +01:00
|
|
|
/// @brief scan all watched folder
|
2022-11-01 14:06:36 +00:00
|
|
|
void BlockedModsDialog::scanPaths()
|
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& dir : m_watcher.directories()) {
|
|
|
|
scanPath(dir, false);
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
2022-11-11 22:45:40 +00:00
|
|
|
runHashTask();
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
2022-11-01 14:06:36 +00:00
|
|
|
/// @brief Scan the directory at path, skip paths that do not contain a file name
|
2022-10-26 04:18:14 +01:00
|
|
|
/// of a blocked mod we are looking for
|
|
|
|
/// @param path the directory to scan
|
2022-11-11 22:45:40 +00:00
|
|
|
void BlockedModsDialog::scanPath(QString path, bool start_task)
|
2022-11-01 14:06:36 +00:00
|
|
|
{
|
2022-10-25 09:19:19 +01:00
|
|
|
QDir scan_dir(path);
|
|
|
|
QDirIterator scan_it(path, QDir::Filter::Files | QDir::Filter::Hidden, QDirIterator::NoIteratorFlags);
|
|
|
|
while (scan_it.hasNext()) {
|
|
|
|
QString file = scan_it.next();
|
|
|
|
|
|
|
|
if (!checkValidPath(file)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2022-11-11 21:10:45 +00:00
|
|
|
addHashTask(file);
|
|
|
|
}
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
if (start_task) {
|
|
|
|
runHashTask();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief add a hashing task for the file located at path, add the path to the pending set if the hasing task is already running
|
|
|
|
/// @param path the path to the local file being hashed
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::addHashTask(QString path)
|
|
|
|
{
|
2022-11-11 23:33:52 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] adding a Hash task for" << path << "to the pending set.";
|
|
|
|
m_pending_hash_paths.insert(path);
|
2022-11-11 21:10:45 +00:00
|
|
|
}
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
/// @brief add a hashing task for the file located at path and connect it to check that hash against
|
2022-11-11 21:10:45 +00:00
|
|
|
/// our blocked mods list
|
|
|
|
/// @param path the path to the local file being hashed
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::buildHashTask(QString path)
|
|
|
|
{
|
2022-11-25 12:23:46 +00:00
|
|
|
auto hash_task = Hashing::createBlockedModHasher(path, ModPlatform::ResourceProvider::FLAME, "sha1");
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Creating Hash task for path: " << path;
|
2022-11-01 14:06:36 +00:00
|
|
|
|
2022-11-12 01:05:19 +00:00
|
|
|
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; });
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
m_hashing_task->addTask(hash_task);
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
2022-10-31 05:39:12 +00:00
|
|
|
/// @brief check if the computed hash for the provided path matches a blocked
|
2022-10-26 04:18:14 +01:00
|
|
|
/// mod we are looking for
|
|
|
|
/// @param hash the computed hash for the provided path
|
|
|
|
/// @param path the path to the local file being compared
|
2022-11-01 14:06:36 +00:00
|
|
|
void BlockedModsDialog::checkMatchHash(QString hash, QString path)
|
|
|
|
{
|
2022-10-25 09:19:19 +01:00
|
|
|
bool match = false;
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Checking for match on hash: " << hash << "| From path:" << path;
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& mod : m_mods) {
|
2022-10-25 09:19:19 +01:00
|
|
|
if (mod.matched) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (mod.hash.compare(hash, Qt::CaseInsensitive) == 0) {
|
|
|
|
mod.matched = true;
|
|
|
|
mod.localPath = path;
|
|
|
|
match = true;
|
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Hash match found:" << mod.name << hash << "| From path:" << path;
|
2022-10-25 09:19:19 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match) {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-31 05:39:12 +00:00
|
|
|
/// @brief Check if the name of the file at path matches the name of a blocked mod we are searching for
|
2022-10-26 04:18:14 +01:00
|
|
|
/// @param path the path to check
|
|
|
|
/// @return boolean: did the path match the name of a blocked mod?
|
2022-11-01 14:06:36 +00:00
|
|
|
bool BlockedModsDialog::checkValidPath(QString path)
|
|
|
|
{
|
2022-11-23 12:54:50 +00:00
|
|
|
const QFileInfo file = QFileInfo(path);
|
|
|
|
const QString filename = file.fileName();
|
|
|
|
QString laxFilename(filename);
|
|
|
|
laxFilename.replace('+', ' ');
|
|
|
|
|
|
|
|
auto compare = [](QString fsfilename, QString metadataFilename) {
|
|
|
|
return metadataFilename.compare(fsfilename, Qt::CaseInsensitive) == 0;
|
|
|
|
};
|
2022-10-25 09:19:19 +01:00
|
|
|
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& mod : m_mods) {
|
2022-11-23 12:54:50 +00:00
|
|
|
if (compare(filename, mod.name)) {
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
|
2022-10-25 09:19:19 +01:00
|
|
|
return true;
|
|
|
|
}
|
2022-11-23 12:54:50 +00:00
|
|
|
if (compare(laxFilename, mod.name)) {
|
|
|
|
qDebug() << "[Blocked Mods Dialog] Lax name match found:" << mod.name << "| From path:" << path;
|
|
|
|
return true;
|
|
|
|
}
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-11-01 14:06:36 +00:00
|
|
|
bool BlockedModsDialog::allModsMatched()
|
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
return std::all_of(m_mods.begin(), m_mods.end(), [](auto const& mod) { return mod.matched; });
|
2022-10-25 09:19:19 +01:00
|
|
|
}
|
|
|
|
|
2022-11-11 21:10:45 +00:00
|
|
|
/// @brief ensure matched file paths still exist
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::validateMatchedMods()
|
|
|
|
{
|
2022-11-11 21:10:45 +00:00
|
|
|
bool changed = false;
|
2022-11-11 22:45:40 +00:00
|
|
|
for (auto& mod : m_mods) {
|
2022-11-11 21:10:45 +00:00
|
|
|
if (mod.matched) {
|
|
|
|
QFileInfo file = QFileInfo(mod.localPath);
|
|
|
|
if (!file.exists() || !file.isFile()) {
|
2022-11-11 23:33:52 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] File" << mod.localPath << "for mod" << mod.name
|
|
|
|
<< "has vanshed! marking as not matched.";
|
2022-11-11 21:10:45 +00:00
|
|
|
mod.localPath = "";
|
|
|
|
mod.matched = false;
|
|
|
|
changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed) {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
/// @brief run hash task or mark a pending run if it is already runing
|
|
|
|
void BlockedModsDialog::runHashTask()
|
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
if (!m_hashing_task->isRunning()) {
|
|
|
|
m_rehash_pending = false;
|
2022-11-11 23:33:52 +00:00
|
|
|
|
|
|
|
if (!m_pending_hash_paths.isEmpty()) {
|
|
|
|
qDebug() << "[Blocked Mods Dialog] there are pending hash tasks, building and running tasks";
|
|
|
|
|
|
|
|
auto path = m_pending_hash_paths.begin();
|
|
|
|
while (path != m_pending_hash_paths.end()) {
|
|
|
|
buildHashTask(*path);
|
|
|
|
path = m_pending_hash_paths.erase(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_hashing_task->start();
|
|
|
|
}
|
2022-11-11 22:45:40 +00:00
|
|
|
} else {
|
|
|
|
qDebug() << "[Blocked Mods Dialog] queueing another run of the hashing task";
|
|
|
|
qDebug() << "[Blocked Mods Dialog] pending hash tasks:" << m_pending_hash_paths;
|
|
|
|
m_rehash_pending = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-11 23:07:57 +00:00
|
|
|
void BlockedModsDialog::hashTaskFinished()
|
|
|
|
{
|
2022-11-11 22:45:40 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] All hash tasks finished";
|
|
|
|
if (m_rehash_pending) {
|
2022-11-11 23:33:52 +00:00
|
|
|
qDebug() << "[Blocked Mods Dialog] task finished with a rehash pending, rerunning";
|
2022-11-11 22:45:40 +00:00
|
|
|
runHashTask();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 04:18:14 +01:00
|
|
|
/// qDebug print support for the BlockedMod struct
|
2022-11-01 14:06:36 +00:00
|
|
|
QDebug operator<<(QDebug debug, const BlockedMod& m)
|
|
|
|
{
|
2022-10-24 12:08:38 +01:00
|
|
|
QDebugStateSaver saver(debug);
|
|
|
|
|
2022-11-01 14:06:36 +00:00
|
|
|
debug.nospace() << "{ name: " << m.name << ", websiteUrl: " << m.websiteUrl << ", hash: " << m.hash << ", matched: " << m.matched
|
|
|
|
<< ", localPath: " << m.localPath << "}";
|
2022-10-24 12:08:38 +01:00
|
|
|
|
|
|
|
return debug;
|
2022-10-26 04:18:14 +01:00
|
|
|
}
|