chore: reformat code

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-12-06 13:16:27 +01:00
parent 07359865c6
commit 85bddbed86
No known key found for this signature in database
GPG Key ID: C10411294912A422
3 changed files with 28 additions and 31 deletions

View File

@ -72,7 +72,8 @@ bool FlameCreationTask::updateInstance()
tr("One or more of your instances are from this same modpack%1. Do you want to create a " tr("One or more of your instances are from this same modpack%1. Do you want to create a "
"separate instance, or update the existing one?\n\nNOTE: Make sure you made a backup of your important instance data before " "separate instance, or update the existing one?\n\nNOTE: Make sure you made a backup of your important instance data before "
"updating, as worlds can be corrupted and some configuration may be lost (due to pack overrides).") "updating, as worlds can be corrupted and some configuration may be lost (due to pack overrides).")
.arg(version_str), QMessageBox::Information, QMessageBox::Ok | QMessageBox::Reset | QMessageBox::Abort); .arg(version_str),
QMessageBox::Information, QMessageBox::Ok | QMessageBox::Reset | QMessageBox::Abort);
info->setButtonText(QMessageBox::Ok, tr("Update existing instance")); info->setButtonText(QMessageBox::Ok, tr("Update existing instance"));
info->setButtonText(QMessageBox::Abort, tr("Create new instance")); info->setButtonText(QMessageBox::Abort, tr("Create new instance"));
info->setButtonText(QMessageBox::Reset, tr("Cancel")); info->setButtonText(QMessageBox::Reset, tr("Cancel"));
@ -197,9 +198,9 @@ bool FlameCreationTask::updateInstance()
m_process_update_file_info_job = nullptr; m_process_update_file_info_job = nullptr;
} else { } else {
// We don't have an old index file, so we may duplicate stuff! // We don't have an old index file, so we may duplicate stuff!
auto dialog = CustomMessageBox::selectable(m_parent, auto dialog = CustomMessageBox::selectable(m_parent, tr("No index file."),
tr("No index file."), tr("We couldn't find a suitable index file for the older version. This may cause some "
tr("We couldn't find a suitable index file for the older version. This may cause some of the files to be duplicated. Do you want to continue?"), "of the files to be duplicated. Do you want to continue?"),
QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel); QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel);
if (dialog->exec() == QDialog::DialogCode::Rejected) { if (dialog->exec() == QDialog::DialogCode::Rejected) {
@ -377,7 +378,6 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop)
auto anyBlocked = false; auto anyBlocked = false;
for (const auto& result : results.files.values()) { for (const auto& result : results.files.values()) {
if (!result.resolved || result.url.isEmpty()) { if (!result.resolved || result.url.isEmpty()) {
BlockedMod blocked_mod; BlockedMod blocked_mod;
blocked_mod.name = result.fileName; blocked_mod.name = result.fileName;
blocked_mod.websiteUrl = result.websiteUrl; blocked_mod.websiteUrl = result.websiteUrl;
@ -484,9 +484,7 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop)
} }
m_mod_id_resolver.reset(); m_mod_id_resolver.reset();
connect(m_files_job.get(), &NetJob::succeeded, this, [&]() { connect(m_files_job.get(), &NetJob::succeeded, this, [&]() { m_files_job.reset(); });
m_files_job.reset();
});
connect(m_files_job.get(), &NetJob::failed, [&](QString reason) { connect(m_files_job.get(), &NetJob::failed, [&](QString reason) {
m_files_job.reset(); m_files_job.reset();
setError(reason); setError(reason);

View File

@ -189,7 +189,6 @@ void PackInstallTask::onResolveModsSucceeded()
// First check for blocked mods // First check for blocked mods
if (!results_file.resolved || results_file.url.isEmpty()) { if (!results_file.resolved || results_file.url.isEmpty()) {
BlockedMod blocked_mod; BlockedMod blocked_mod;
blocked_mod.name = local_file.name; blocked_mod.name = local_file.name;
blocked_mod.websiteUrl = results_file.websiteUrl; blocked_mod.websiteUrl = results_file.websiteUrl;

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <QDialog> #include <QDialog>
#include <QString>
#include <QList> #include <QList>
#include <QString>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
@ -16,32 +16,32 @@ struct BlockedMod {
QString hash; QString hash;
bool matched; bool matched;
QString localPath; QString localPath;
}; };
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class BlockedModsDialog; } namespace Ui {
class BlockedModsDialog;
}
QT_END_NAMESPACE QT_END_NAMESPACE
class BlockedModsDialog : public QDialog { class BlockedModsDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, QList<BlockedMod> &mods); BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods);
~BlockedModsDialog() override; ~BlockedModsDialog() override;
protected: protected:
void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent* event) override;
protected protected slots:
slots:
void done(int r) override; void done(int r) override;
private: private:
Ui::BlockedModsDialog *ui; Ui::BlockedModsDialog* ui;
QList<BlockedMod> &m_mods; QList<BlockedMod>& m_mods;
QFileSystemWatcher m_watcher; QFileSystemWatcher m_watcher;
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;
@ -65,4 +65,4 @@ private:
bool allModsMatched(); bool allModsMatched();
}; };
QDebug operator<<(QDebug debug, const BlockedMod &m); QDebug operator<<(QDebug debug, const BlockedMod& m);