tidy: apply clang-tidy to some files
Mostly the ones created in this PR + Mod.h / Mod.cpp / ModDetails.h
This commit is contained in:
parent
d7f6b36990
commit
ba50765c30
@ -93,7 +93,7 @@ void Mod::repath(const QFileInfo& file)
|
||||
}
|
||||
}
|
||||
|
||||
bool Mod::enable(bool value)
|
||||
auto Mod::enable(bool value) -> bool
|
||||
{
|
||||
if (m_type == Mod::MOD_UNKNOWN || m_type == Mod::MOD_FOLDER)
|
||||
return false;
|
||||
@ -124,7 +124,7 @@ bool Mod::enable(bool value)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mod::destroy(QDir& index_dir)
|
||||
auto Mod::destroy(QDir& index_dir) -> bool
|
||||
{
|
||||
auto n = name();
|
||||
// FIXME: This can fail to remove the metadata if the
|
||||
@ -136,12 +136,12 @@ bool Mod::destroy(QDir& index_dir)
|
||||
return FS::deletePath(m_file.filePath());
|
||||
}
|
||||
|
||||
const ModDetails& Mod::details() const
|
||||
auto Mod::details() const -> const ModDetails&
|
||||
{
|
||||
return m_localDetails ? *m_localDetails : invalidDetails;
|
||||
}
|
||||
|
||||
QString Mod::name() const
|
||||
auto Mod::name() const -> QString
|
||||
{
|
||||
auto d_name = details().name;
|
||||
if (!d_name.isEmpty()) {
|
||||
@ -150,22 +150,22 @@ QString Mod::name() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString Mod::version() const
|
||||
auto Mod::version() const -> QString
|
||||
{
|
||||
return details().version;
|
||||
}
|
||||
|
||||
QString Mod::homeurl() const
|
||||
auto Mod::homeurl() const -> QString
|
||||
{
|
||||
return details().homeurl;
|
||||
}
|
||||
|
||||
QString Mod::description() const
|
||||
auto Mod::description() const -> QString
|
||||
{
|
||||
return details().description;
|
||||
}
|
||||
|
||||
QStringList Mod::authors() const
|
||||
auto Mod::authors() const -> QStringList
|
||||
{
|
||||
return details().authors;
|
||||
}
|
||||
|
@ -37,36 +37,36 @@ public:
|
||||
Mod(const QFileInfo &file);
|
||||
explicit Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata);
|
||||
|
||||
QFileInfo fileinfo() const { return m_file; }
|
||||
QDateTime dateTimeChanged() const { return m_changedDateTime; }
|
||||
QString internal_id() const { return m_internal_id; }
|
||||
ModType type() const { return m_type; }
|
||||
bool fromMetadata() const { return m_from_metadata; }
|
||||
bool enabled() const { return m_enabled; }
|
||||
auto fileinfo() const -> QFileInfo { return m_file; }
|
||||
auto dateTimeChanged() const -> QDateTime { return m_changedDateTime; }
|
||||
auto internal_id() const -> QString { return m_internal_id; }
|
||||
auto type() const -> ModType { return m_type; }
|
||||
auto fromMetadata() const -> bool { return m_from_metadata; }
|
||||
auto enabled() const -> bool { return m_enabled; }
|
||||
|
||||
bool valid() const { return m_type != MOD_UNKNOWN; }
|
||||
auto valid() const -> bool { return m_type != MOD_UNKNOWN; }
|
||||
|
||||
const ModDetails& details() const;
|
||||
QString name() const;
|
||||
QString version() const;
|
||||
QString homeurl() const;
|
||||
QString description() const;
|
||||
QStringList authors() const;
|
||||
auto details() const -> const ModDetails&;
|
||||
auto name() const -> QString;
|
||||
auto version() const -> QString;
|
||||
auto homeurl() const -> QString;
|
||||
auto description() const -> QString;
|
||||
auto authors() const -> QStringList;
|
||||
|
||||
const std::shared_ptr<Metadata::ModStruct> metadata() const { return details().metadata; };
|
||||
std::shared_ptr<Metadata::ModStruct> metadata() { return m_localDetails->metadata; };
|
||||
auto metadata() const -> const std::shared_ptr<Metadata::ModStruct> { return details().metadata; };
|
||||
auto metadata() -> std::shared_ptr<Metadata::ModStruct> { return m_localDetails->metadata; };
|
||||
|
||||
bool enable(bool value);
|
||||
auto enable(bool value) -> bool;
|
||||
|
||||
// delete all the files of this mod
|
||||
bool destroy(QDir& index_dir);
|
||||
auto destroy(QDir& index_dir) -> bool;
|
||||
|
||||
// change the mod's filesystem path (used by mod lists for *MAGIC* purposes)
|
||||
void repath(const QFileInfo &file);
|
||||
|
||||
bool shouldResolve() const { return !m_resolving && !m_resolved; }
|
||||
bool isResolving() const { return m_resolving; }
|
||||
int resolutionTicket() const { return m_resolutionTicket; }
|
||||
auto shouldResolve() const -> bool { return !m_resolving && !m_resolved; }
|
||||
auto isResolving() const -> bool { return m_resolving; }
|
||||
auto resolutionTicket() const -> int { return m_resolutionTicket; }
|
||||
|
||||
void setResolving(bool resolving, int resolutionTicket) {
|
||||
m_resolving = resolving;
|
||||
|
@ -30,7 +30,7 @@ void LocalModUpdateTask::executeTask()
|
||||
emitSucceeded();
|
||||
}
|
||||
|
||||
bool LocalModUpdateTask::abort()
|
||||
auto LocalModUpdateTask::abort() -> bool
|
||||
{
|
||||
emitAborted();
|
||||
return true;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "tasks/Task.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
class LocalModUpdateTask : public Task {
|
||||
Q_OBJECT
|
||||
@ -12,8 +12,8 @@ class LocalModUpdateTask : public Task {
|
||||
|
||||
explicit LocalModUpdateTask(QDir mods_dir, ModPlatform::IndexedPack& mod, ModPlatform::IndexedVersion& mod_version);
|
||||
|
||||
bool canAbort() const override { return true; }
|
||||
bool abort() override;
|
||||
auto canAbort() const -> bool override { return true; }
|
||||
auto abort() -> bool override;
|
||||
|
||||
protected slots:
|
||||
//! Entry point for tasks.
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
#include "toml.h"
|
||||
|
||||
#include "modplatform/ModIndex.h"
|
||||
#include "minecraft/mod/Mod.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
namespace Packwiz {
|
||||
|
||||
// Helpers
|
||||
static inline QString indexFileName(QString const& mod_name)
|
||||
static inline auto indexFileName(QString const& mod_name) -> QString
|
||||
{
|
||||
if(mod_name.endsWith(".toml"))
|
||||
return mod_name;
|
||||
@ -161,8 +161,9 @@ auto V1::getIndexForMod(QDir& index_dir, QString& index_file_name) -> Mod
|
||||
return {};
|
||||
}
|
||||
|
||||
toml_table_t* table;
|
||||
toml_table_t* table = nullptr;
|
||||
|
||||
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
|
||||
char errbuf[200];
|
||||
table = toml_parse(index_file.readAll().data(), errbuf, sizeof(errbuf));
|
||||
|
||||
@ -201,7 +202,7 @@ auto V1::getIndexForMod(QDir& index_dir, QString& index_file_name) -> Mod
|
||||
return {};
|
||||
}
|
||||
|
||||
toml_table_t* mod_provider_table;
|
||||
toml_table_t* mod_provider_table = nullptr;
|
||||
if ((mod_provider_table = toml_table_in(update_table, ProviderCaps::providerName(Provider::FLAME)))) {
|
||||
mod.provider = Provider::FLAME;
|
||||
mod.file_id = intEntry(mod_provider_table, "file-id");
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <QTemporaryDir>
|
||||
#include <QTest>
|
||||
|
||||
#include "TestUtil.h"
|
||||
#include "Packwiz.h"
|
||||
#include "TestUtil.h"
|
||||
|
||||
class PackwizTest : public QObject {
|
||||
Q_OBJECT
|
||||
|
Loading…
Reference in New Issue
Block a user