feat(mod parsing): load extra mod details

- (image, license, issuetracker)

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2023-05-04 23:42:42 -07:00
parent 64ba5e4ed1
commit ec157b766e
5 changed files with 369 additions and 0 deletions

View File

@ -38,6 +38,10 @@
#include <QDateTime>
#include <QFileInfo>
#include <QList>
#include <QImage>
#include <QMutex>
#include <QPixmap>
#include <QPixmapCache>
#include <optional>
@ -65,6 +69,13 @@ public:
auto status() const -> ModStatus;
auto provider() const -> std::optional<QString>;
/** Get the intneral path to the mod's icon file*/
QString iconPath() const { return m_local_details.icon_file; };
/** Gets the icon of the mod, converted to a QPixmap for drawing, and scaled to size. */
[[nodiscard]] QPixmap icon(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const;
/** Thread-safe. */
void setIcon(QImage new_image) const;
auto metadata() -> std::shared_ptr<Metadata::ModStruct>;
auto metadata() const -> const std::shared_ptr<Metadata::ModStruct>;
@ -85,4 +96,13 @@ public:
protected:
ModDetails m_local_details;
mutable QMutex m_data_lock;
struct {
QPixmapCache::Key key;
bool was_ever_used = false;
bool was_read_attempt = false;
} mutable m_pack_image_cache_key;
};