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