1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
2.6 KiB
C++
Raw Normal View History

#ifndef ESMFILE_HPP
#define ESMFILE_HPP
#include <QDateTime>
#include <QStringList>
#include <components/esm3/formatversion.hpp>
#include "modelitem.hpp"
2013-09-18 02:36:23 -05:00
class QMimeData;
namespace ContentSelectorModel
{
class EsmFile : public ModelItem
{
Q_OBJECT
Q_PROPERTY(QString filename READ fileName)
public:
enum FileProperty
{
FileProperty_FileName = 0,
FileProperty_Author = 1,
FileProperty_Format = 2,
FileProperty_DateModified = 3,
FileProperty_FilePath = 4,
FileProperty_Description = 5,
FileProperty_GameFile = 6
};
2020-11-13 11:39:47 +04:00
EsmFile(QString fileName = QString(), ModelItem* parent = nullptr);
2013-09-07 15:57:40 -05:00
// EsmFile(const EsmFile &);
~EsmFile() {}
void setFileProperty(const FileProperty prop, const QString& value);
2013-09-18 02:36:23 -05:00
void setFileName(const QString& fileName);
void setAuthor(const QString& author);
void setSize(const int size);
2013-09-18 02:36:23 -05:00
void setDate(const QDateTime& modified);
void setFormat(const int format);
void setFilePath(const QString& path);
void setGameFiles(const QStringList& gameFiles);
void setDescription(const QString& description);
inline void addGameFile(const QString& name) { mGameFiles.append(name); }
QVariant fileProperty(const FileProperty prop) const;
inline QString fileName() const { return mFileName; }
inline QString author() const { return mAuthor; }
inline QDateTime modified() const { return mModified; }
ESM::FormatVersion formatVersion() const { return mVersion; }
inline QString filePath() const { return mPath; }
/// @note Contains file names, not paths.
inline const QStringList& gameFiles() const { return mGameFiles; }
inline QString description() const { return mDescription; }
inline QString toolTip() const
{
return sToolTip.arg(mAuthor)
.arg(mVersion)
.arg(mModified.toString(Qt::ISODate))
2013-11-03 00:02:46 -05:00
.arg(mPath)
.arg(mDescription)
.arg(mGameFiles.join(", "));
}
bool isGameFile() const;
2013-09-18 02:36:23 -05:00
QByteArray encodedData() const;
public:
static int sPropertyCount;
static QString sToolTip;
private:
QString mFileName;
QString mAuthor;
QDateTime mModified;
ESM::FormatVersion mVersion = ESM::DefaultFormatVersion;
QString mPath;
QStringList mGameFiles;
QString mDescription;
QString mToolTip;
};
}
#endif