1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 09:23:53 +00:00
openmw/components/contentselector/model/esmfile.hpp

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

97 lines
2.8 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 07:36:23 +00: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
};
2023-07-29 07:44:39 +00:00
EsmFile(const QString& fileName = QString(), ModelItem* parent = nullptr);
2013-09-07 20:57:40 +00:00
// EsmFile(const EsmFile &);
~EsmFile() {}
void setFileProperty(const FileProperty prop, const QString& value);
2013-09-18 07:36:23 +00:00
void setFileName(const QString& fileName);
void setAuthor(const QString& author);
void setSize(const int size);
2013-09-18 07:36:23 +00: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);
2023-03-20 22:03:39 +00:00
void addGameFile(const QString& name) { mGameFiles.append(name); }
QVariant fileProperty(const FileProperty prop) const;
2023-03-20 22:03:39 +00:00
QString fileName() const { return mFileName; }
QString author() const { return mAuthor; }
QDateTime modified() const { return mModified; }
ESM::FormatVersion formatVersion() const { return mVersion; }
2023-03-20 22:03:39 +00:00
QString filePath() const { return mPath; }
/// @note Contains file names, not paths.
2023-03-20 22:03:39 +00:00
const QStringList& gameFiles() const { return mGameFiles; }
QString description() const { return mDescription; }
QString toolTip() const
{
return mTooltipTemlate.arg(mAuthor)
.arg(mVersion)
.arg(mModified.toString(Qt::ISODate))
2013-11-03 05:02:46 +00:00
.arg(mPath)
.arg(mDescription)
.arg(mGameFiles.join(", "));
}
bool isGameFile() const;
2013-09-18 07:36:23 +00:00
QByteArray encodedData() const;
public:
static int sPropertyCount;
private:
QString mTooltipTemlate = tr(
"<b>Author:</b> %1<br/>"
"<b>Version:</b> %2<br/>"
"<b>Modified:</b> %3<br/>"
"<b>Path:</b><br/>%4<br/>"
"<br/><b>Description:</b><br/>%5<br/>"
"<br/><b>Dependencies: </b>%6<br/>");
QString mFileName;
QString mAuthor;
QDateTime mModified;
ESM::FormatVersion mVersion = ESM::DefaultFormatVersion;
QString mPath;
QStringList mGameFiles;
QString mDescription;
QString mToolTip;
};
}
#endif