chore(clang-tidy): fix clang tidy warnings

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2026-05-07 10:22:37 +03:00
parent 4c9081a934
commit bac959bc6f
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318
23 changed files with 650 additions and 546 deletions

View file

@ -45,7 +45,7 @@
class BaseInstance;
enum class ResourceType {
enum class ResourceType : std::uint8_t {
UNKNOWN, //!< Indicates an unspecified resource type.
ZIPFILE, //!< The resource is a zip file containing the resource's class files.
SINGLEFILE, //!< The resource is a single file (not a zip file).
@ -55,33 +55,33 @@ enum class ResourceType {
QDebug operator<<(QDebug debug, ResourceType type);
enum class ResourceStatus {
INSTALLED, // Both JAR and Metadata are present
NOT_INSTALLED, // Only the Metadata is present
NO_METADATA, // Only the JAR is present
UNKNOWN, // Default status
enum class ResourceStatus : std::uint8_t {
Installed, // Both JAR and Metadata are present
NotInstalled, // Only the Metadata is present
NoMetadata, // Only the JAR is present
Unknown, // Default status
};
QDebug operator<<(QDebug debug, ResourceStatus status);
enum class SortType {
NAME,
DATE,
VERSION,
ENABLED,
PACK_FORMAT,
PROVIDER,
SIZE,
SIDE,
MC_VERSIONS,
LOADERS,
RELEASE_TYPE,
REQUIRES,
REQUIRED_BY,
FILENAME,
enum class SortType : std::uint8_t {
Name,
Date,
Version,
Enabled,
PackFormat,
Provider,
Size,
Side,
McVersions,
Loaders,
ReleaseType,
Requires,
RequiredBy,
Filename,
};
enum class EnableAction { ENABLE, DISABLE, TOGGLE };
enum class EnableAction : std::uint8_t { ENABLE, DISABLE, TOGGLE };
/** General class for managed resources. It mirrors a file in disk, with some more info
* for display and house-keeping purposes.
@ -93,20 +93,19 @@ class Resource : public QObject {
Q_DISABLE_COPY(Resource)
public:
using Ptr = shared_qobject_ptr<Resource>;
using WeakPtr = QPointer<Resource>;
Resource(QObject* parent = nullptr);
Resource(QFileInfo file_info);
Resource(QString file_path) : Resource(QFileInfo(file_path)) {}
Resource(QFileInfo fileInfo);
Resource(const QString& filePath) : Resource(QFileInfo(filePath)) {}
~Resource() override = default;
void setFile(QFileInfo file_info);
void setFile(QFileInfo fileInfo);
void parseFile();
auto fileinfo() const -> QFileInfo { return m_file_info; }
auto dateTimeChanged() const -> QDateTime { return m_changed_date_time; }
auto internal_id() const -> QString { return m_internal_id; }
auto internalId() const -> QString { return m_internal_id; }
auto type() const -> ResourceType { return m_type; }
bool enabled() const { return m_enabled; }
auto getOriginalFileName() const -> QString;
@ -139,7 +138,7 @@ class Resource : public QObject {
* = 0: 'this' is equal to 'other'
* < 0: 'this' comes before 'other'
*/
virtual int compare(const Resource& other, SortType type = SortType::NAME) const;
virtual int compare(const Resource& other, SortType type = SortType::Name) const;
/** Returns whether the given filter should filter out 'this' (false),
* or if such filter includes the Resource (true).
@ -164,9 +163,9 @@ class Resource : public QObject {
}
// Delete all files of this resource.
auto destroy(const QDir& index_dir, bool preserve_metadata = false, bool attempt_trash = true) -> bool;
auto destroy(const QDir& indexDir, bool preserveMetadata = false, bool attemptTrash = true) -> bool;
// Delete the metadata only.
auto destroyMetadata(const QDir& index_dir) -> void;
auto destroyMetadata(const QDir& indexDir) -> void;
auto isSymLink() const -> bool { return m_file_info.isSymLink(); }
@ -196,7 +195,7 @@ class Resource : public QObject {
ResourceType m_type = ResourceType::UNKNOWN;
/* Installation status of the resource. */
ResourceStatus m_status = ResourceStatus::UNKNOWN;
ResourceStatus m_status = ResourceStatus::Unknown;
std::shared_ptr<Metadata::ModStruct> m_metadata = nullptr;