OpenMW
|
00001 #ifndef CSM_WOLRD_DATA_H 00002 #define CSM_WOLRD_DATA_H 00003 00004 #include <map> 00005 #include <vector> 00006 00007 #include <boost/filesystem/path.hpp> 00008 00009 #include <QObject> 00010 #include <QModelIndex> 00011 00012 #include <components/esm/loadglob.hpp> 00013 #include <components/esm/loadgmst.hpp> 00014 #include <components/esm/loadskil.hpp> 00015 #include <components/esm/loadclas.hpp> 00016 #include <components/esm/loadfact.hpp> 00017 #include <components/esm/loadrace.hpp> 00018 #include <components/esm/loadsoun.hpp> 00019 #include <components/esm/loadscpt.hpp> 00020 #include <components/esm/loadregn.hpp> 00021 #include <components/esm/loadbsgn.hpp> 00022 #include <components/esm/loadspel.hpp> 00023 #include <components/esm/loaddial.hpp> 00024 00025 #include "../filter/filter.hpp" 00026 00027 #include "idcollection.hpp" 00028 #include "universalid.hpp" 00029 #include "cell.hpp" 00030 #include "refidcollection.hpp" 00031 #include "refcollection.hpp" 00032 #include "infocollection.hpp" 00033 00034 class QAbstractItemModel; 00035 00036 namespace CSMWorld 00037 { 00038 class Data : public QObject 00039 { 00040 Q_OBJECT 00041 00042 IdCollection<ESM::Global> mGlobals; 00043 IdCollection<ESM::GameSetting> mGmsts; 00044 IdCollection<ESM::Skill> mSkills; 00045 IdCollection<ESM::Class> mClasses; 00046 IdCollection<ESM::Faction> mFactions; 00047 IdCollection<ESM::Race> mRaces; 00048 IdCollection<ESM::Sound> mSounds; 00049 IdCollection<ESM::Script> mScripts; 00050 IdCollection<ESM::Region> mRegions; 00051 IdCollection<ESM::BirthSign> mBirthsigns; 00052 IdCollection<ESM::Spell> mSpells; 00053 IdCollection<ESM::Dialogue> mTopics; 00054 IdCollection<ESM::Dialogue> mJournals; 00055 InfoCollection mTopicInfos; 00056 InfoCollection mJournalInfos; 00057 IdCollection<Cell> mCells; 00058 RefIdCollection mReferenceables; 00059 RefCollection mRefs; 00060 IdCollection<CSMFilter::Filter> mFilters; 00061 std::vector<QAbstractItemModel *> mModels; 00062 std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex; 00063 std::string mAuthor; 00064 std::string mDescription; 00065 00066 // not implemented 00067 Data (const Data&); 00068 Data& operator= (const Data&); 00069 00070 void addModel (QAbstractItemModel *model, UniversalId::Type type1, 00071 UniversalId::Type type2 = UniversalId::Type_None, bool update = true); 00072 00073 static void appendIds (std::vector<std::string>& ids, const CollectionBase& collection, 00074 bool listDeleted); 00076 00077 static int count (RecordBase::State state, const CollectionBase& collection); 00078 00079 public: 00080 00081 Data(); 00082 00083 virtual ~Data(); 00084 00085 const IdCollection<ESM::Global>& getGlobals() const; 00086 00087 IdCollection<ESM::Global>& getGlobals(); 00088 00089 const IdCollection<ESM::GameSetting>& getGmsts() const; 00090 00091 IdCollection<ESM::GameSetting>& getGmsts(); 00092 00093 const IdCollection<ESM::Skill>& getSkills() const; 00094 00095 IdCollection<ESM::Skill>& getSkills(); 00096 00097 const IdCollection<ESM::Class>& getClasses() const; 00098 00099 IdCollection<ESM::Class>& getClasses(); 00100 00101 const IdCollection<ESM::Faction>& getFactions() const; 00102 00103 IdCollection<ESM::Faction>& getFactions(); 00104 00105 const IdCollection<ESM::Race>& getRaces() const; 00106 00107 IdCollection<ESM::Race>& getRaces(); 00108 00109 const IdCollection<ESM::Sound>& getSounds() const; 00110 00111 IdCollection<ESM::Sound>& getSounds(); 00112 00113 const IdCollection<ESM::Script>& getScripts() const; 00114 00115 IdCollection<ESM::Script>& getScripts(); 00116 00117 const IdCollection<ESM::Region>& getRegions() const; 00118 00119 IdCollection<ESM::Region>& getRegions(); 00120 00121 const IdCollection<ESM::BirthSign>& getBirthsigns() const; 00122 00123 IdCollection<ESM::BirthSign>& getBirthsigns(); 00124 00125 const IdCollection<ESM::Spell>& getSpells() const; 00126 00127 IdCollection<ESM::Spell>& getSpells(); 00128 00129 const IdCollection<ESM::Dialogue>& getTopics() const; 00130 00131 IdCollection<ESM::Dialogue>& getTopics(); 00132 00133 const IdCollection<ESM::Dialogue>& getJournals() const; 00134 00135 IdCollection<ESM::Dialogue>& getJournals(); 00136 00137 const InfoCollection& getTopicInfos() const; 00138 00139 InfoCollection& getTopicInfos(); 00140 00141 const InfoCollection& getJournalInfos() const; 00142 00143 InfoCollection& getJournalInfos(); 00144 00145 const IdCollection<Cell>& getCells() const; 00146 00147 IdCollection<Cell>& getCells(); 00148 00149 const RefIdCollection& getReferenceables() const; 00150 00151 RefIdCollection& getReferenceables(); 00152 00153 const RefCollection& getReferences() const; 00154 00155 RefCollection& getReferences(); 00156 00157 const IdCollection<CSMFilter::Filter>& getFilters() const; 00158 00159 IdCollection<CSMFilter::Filter>& getFilters(); 00160 00161 QAbstractItemModel *getTableModel (const UniversalId& id); 00166 00167 void merge(); 00169 00170 void loadFile (const boost::filesystem::path& path, bool base, bool project); 00174 00175 bool hasId (const std::string& id) const; 00176 00177 std::vector<std::string> getIds (bool listDeleted = true) const; 00181 00182 int count (RecordBase::State state) const; 00184 00185 void setDescription (const std::string& description); 00186 00187 std::string getDescription() const; 00188 00189 void setAuthor (const std::string& author); 00190 00191 std::string getAuthor() const; 00192 00193 signals: 00194 00195 void idListChanged(); 00196 00197 private slots: 00198 00199 void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight); 00200 00201 void rowsChanged (const QModelIndex& parent, int start, int end); 00202 }; 00203 } 00204 00205 #endif