OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
esmfile.hpp
Go to the documentation of this file.
1 #ifndef ESMFILE_HPP
2 #define ESMFILE_HPP
3 
4 #include <QDateTime>
5 #include <QStringList>
6 
7 #include "modelitem.hpp"
8 
9 class QMimeData;
10 
11 namespace ContentSelectorModel
12 {
13  class EsmFile : public ModelItem
14  {
15  Q_OBJECT
16  Q_PROPERTY(QString filename READ fileName)
17 
18  public:
19 
21  {
29  };
30 
31  EsmFile(QString fileName = QString(), ModelItem *parent = 0);
32  // EsmFile(const EsmFile &);
33 
35  {}
36 
37  void setFileProperty (const FileProperty prop, const QString &value);
38 
39  void setFileName(const QString &fileName);
40  void setAuthor(const QString &author);
41  void setSize(const int size);
42  void setDate(const QDateTime &modified);
43  void setFormat(const int format);
44  void setFilePath(const QString &path);
45  void setGameFiles(const QStringList &gameFiles);
46  void setDescription(const QString &description);
47 
48  inline void addGameFile (const QString &name) {mGameFiles.append(name); }
49  QVariant fileProperty (const FileProperty prop) const;
50 
51  inline QString fileName() const { return mFileName; }
52  inline QString author() const { return mAuthor; }
53  inline QDateTime modified() const { return mModified; }
54  inline float format() const { return mFormat; }
55  inline QString filePath() const { return mPath; }
56 
58  inline const QStringList &gameFiles() const { return mGameFiles; }
59  inline QString description() const { return mDescription; }
60  inline QString toolTip() const { return sToolTip.arg(mAuthor)
61  .arg(mFormat)
62  .arg(mModified.toString(Qt::ISODate))
63  .arg(mPath)
64  .arg(mDescription)
65  .arg(mGameFiles.join(", "));
66  }
67 
68  bool isGameFile() const;
69  QByteArray encodedData() const;
70 
71  public:
72  static int sPropertyCount;
73  static QString sToolTip;
74 
75  private:
76 
77  QString mFileName;
78  QString mAuthor;
79  QDateTime mModified;
80  int mFormat;
81  QString mPath;
82  QStringList mGameFiles;
83  QString mDescription;
84  QString mToolTip;
85 
86  };
87 }
88 
89 #endif
static int sPropertyCount
Definition: esmfile.hpp:72
int mFormat
Definition: esmfile.hpp:80
QString toolTip() const
Definition: esmfile.hpp:60
bool isGameFile() const
Definition: esmfile.cpp:66
QString fileName() const
Definition: esmfile.hpp:51
void addGameFile(const QString &name)
Definition: esmfile.hpp:48
void setFileName(const QString &fileName)
Definition: esmfile.cpp:19
void setFileProperty(const FileProperty prop, const QString &value)
Definition: esmfile.cpp:110
QDateTime modified() const
Definition: esmfile.hpp:53
QString author() const
Definition: esmfile.hpp:52
EsmFile(QString fileName=QString(), ModelItem *parent=0)
Definition: esmfile.cpp:15
float format() const
Definition: esmfile.hpp:54
Definition: modelitem.hpp:9
Definition: esmfile.hpp:13
QString filename
Definition: esmfile.hpp:16
QString mPath
Definition: esmfile.hpp:81
QString mToolTip
Definition: esmfile.hpp:84
static QString sToolTip
Definition: esmfile.hpp:73
void setFilePath(const QString &path)
Definition: esmfile.cpp:39
void setDate(const QDateTime &modified)
Definition: esmfile.cpp:29
QVariant fileProperty(const FileProperty prop) const
Definition: esmfile.cpp:73
QString filePath() const
Definition: esmfile.hpp:55
void setFormat(const int format)
Definition: esmfile.cpp:34
void setAuthor(const QString &author)
Definition: esmfile.cpp:24
QDateTime mModified
Definition: esmfile.hpp:79
~EsmFile()
Definition: esmfile.hpp:34
FileProperty
Definition: esmfile.hpp:20
QByteArray encodedData() const
Definition: esmfile.cpp:54
QString mAuthor
Definition: esmfile.hpp:78
QStringList mGameFiles
Definition: esmfile.hpp:82
void setSize(const int size)
const QStringList & gameFiles() const
Definition: esmfile.hpp:58
void setDescription(const QString &description)
Definition: esmfile.cpp:49
QString mDescription
Definition: esmfile.hpp:83
QString mFileName
Definition: esmfile.hpp:77
ModelItem * parent() const
Definition: modelitem.cpp:20
void setGameFiles(const QStringList &gameFiles)
Definition: esmfile.cpp:44
const char * name
Definition: crashcatcher.cpp:59
QString description() const
Definition: esmfile.hpp:59