refactor: replace Open All with Open Missing
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
e08d97825d
commit
c06abd9b6b
@ -1,14 +1,16 @@
|
|||||||
#include "BlockedModsDialog.h"
|
#include "BlockedModsDialog.h"
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include "Application.h"
|
|
||||||
#include "ui_BlockedModsDialog.h"
|
#include "ui_BlockedModsDialog.h"
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
|
#include "modplatform/helpers/HashUtils.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods)
|
BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods)
|
||||||
@ -19,8 +21,8 @@ BlockedModsDialog::BlockedModsDialog(QWidget* parent, const QString& title, cons
|
|||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
auto openAllButton = ui->buttonBox->addButton(tr("Open All"), QDialogButtonBox::ActionRole);
|
m_openMissingButton = ui->buttonBox->addButton(tr("Open Missing"), QDialogButtonBox::ActionRole);
|
||||||
connect(openAllButton, &QPushButton::clicked, this, &BlockedModsDialog::openAll);
|
connect(m_openMissingButton, &QPushButton::clicked, this, [this]() { openAll(true); });
|
||||||
|
|
||||||
auto downloadFolderButton = ui->buttonBox->addButton(tr("Add Download Folder"), QDialogButtonBox::ActionRole);
|
auto downloadFolderButton = ui->buttonBox->addButton(tr("Add Download Folder"), QDialogButtonBox::ActionRole);
|
||||||
connect(downloadFolderButton, &QPushButton::clicked, this, &BlockedModsDialog::addDownloadFolder);
|
connect(downloadFolderButton, &QPushButton::clicked, this, &BlockedModsDialog::addDownloadFolder);
|
||||||
@ -78,10 +80,12 @@ void BlockedModsDialog::done(int r)
|
|||||||
disconnect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &BlockedModsDialog::directoryChanged);
|
disconnect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &BlockedModsDialog::directoryChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockedModsDialog::openAll()
|
void BlockedModsDialog::openAll(bool missingOnly)
|
||||||
{
|
{
|
||||||
for (auto& mod : m_mods) {
|
for (auto& mod : m_mods) {
|
||||||
QDesktopServices::openUrl(mod.websiteUrl);
|
if (!missingOnly || !mod.matched) {
|
||||||
|
QDesktopServices::openUrl(mod.websiteUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +128,10 @@ void BlockedModsDialog::update()
|
|||||||
|
|
||||||
if (allModsMatched()) {
|
if (allModsMatched()) {
|
||||||
ui->labelModsFound->setText("<span style=\"color:green\">✔</span>" + tr("All mods found"));
|
ui->labelModsFound->setText("<span style=\"color:green\">✔</span>" + tr("All mods found"));
|
||||||
|
m_openMissingButton->setDisabled(true);
|
||||||
} else {
|
} else {
|
||||||
ui->labelModsFound->setText(tr("Please download the missing mods."));
|
ui->labelModsFound->setText(tr("Please download the missing mods."));
|
||||||
|
m_openMissingButton->setDisabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
|
|
||||||
#include "modplatform/helpers/HashUtils.h"
|
|
||||||
|
|
||||||
#include "tasks/ConcurrentTask.h"
|
#include "tasks/ConcurrentTask.h"
|
||||||
|
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
struct BlockedMod {
|
struct BlockedMod {
|
||||||
QString name;
|
QString name;
|
||||||
QString websiteUrl;
|
QString websiteUrl;
|
||||||
@ -46,8 +46,9 @@ class BlockedModsDialog : public QDialog {
|
|||||||
shared_qobject_ptr<ConcurrentTask> m_hashing_task;
|
shared_qobject_ptr<ConcurrentTask> m_hashing_task;
|
||||||
QSet<QString> m_pending_hash_paths;
|
QSet<QString> m_pending_hash_paths;
|
||||||
bool m_rehash_pending;
|
bool m_rehash_pending;
|
||||||
|
QPushButton *m_openMissingButton;
|
||||||
|
|
||||||
void openAll();
|
void openAll(bool missingOnly);
|
||||||
void addDownloadFolder();
|
void addDownloadFolder();
|
||||||
void update();
|
void update();
|
||||||
void directoryChanged(QString path);
|
void directoryChanged(QString path);
|
||||||
|
Loading…
Reference in New Issue
Block a user