2012-12-30 13:01:52 +00:00
|
|
|
#ifndef CSM_WOLRD_DATA_H
|
|
|
|
#define CSM_WOLRD_DATA_H
|
2012-11-26 11:29:22 +00:00
|
|
|
|
|
|
|
#include <map>
|
2012-12-30 13:01:52 +00:00
|
|
|
#include <vector>
|
2012-11-26 11:29:22 +00:00
|
|
|
|
2013-02-07 10:33:08 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
2013-09-19 10:11:27 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QModelIndex>
|
|
|
|
|
2012-11-26 11:29:22 +00:00
|
|
|
#include <components/esm/loadglob.hpp>
|
2013-02-08 08:58:19 +00:00
|
|
|
#include <components/esm/loadgmst.hpp>
|
2013-03-21 13:31:32 +00:00
|
|
|
#include <components/esm/loadskil.hpp>
|
2013-03-25 12:22:06 +00:00
|
|
|
#include <components/esm/loadclas.hpp>
|
2013-04-02 10:00:45 +00:00
|
|
|
#include <components/esm/loadfact.hpp>
|
2013-04-04 12:34:39 +00:00
|
|
|
#include <components/esm/loadrace.hpp>
|
2013-04-06 19:21:10 +00:00
|
|
|
#include <components/esm/loadsoun.hpp>
|
2013-04-07 13:17:35 +00:00
|
|
|
#include <components/esm/loadscpt.hpp>
|
2013-04-07 14:32:06 +00:00
|
|
|
#include <components/esm/loadregn.hpp>
|
2013-04-07 18:26:39 +00:00
|
|
|
#include <components/esm/loadbsgn.hpp>
|
2013-04-09 09:40:36 +00:00
|
|
|
#include <components/esm/loadspel.hpp>
|
2012-11-26 11:29:22 +00:00
|
|
|
|
2013-07-22 19:18:47 +00:00
|
|
|
#include "../filter/filter.hpp"
|
|
|
|
|
2012-11-26 11:29:22 +00:00
|
|
|
#include "idcollection.hpp"
|
|
|
|
#include "universalid.hpp"
|
2013-04-14 15:04:55 +00:00
|
|
|
#include "cell.hpp"
|
2013-05-07 09:23:18 +00:00
|
|
|
#include "refidcollection.hpp"
|
2013-07-06 15:03:18 +00:00
|
|
|
#include "refcollection.hpp"
|
2012-11-26 11:29:22 +00:00
|
|
|
|
2013-03-21 09:07:25 +00:00
|
|
|
class QAbstractItemModel;
|
2012-11-26 11:29:22 +00:00
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
2013-09-19 10:11:27 +00:00
|
|
|
class Data : public QObject
|
2012-11-26 11:29:22 +00:00
|
|
|
{
|
2013-09-19 10:11:27 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-26 11:29:22 +00:00
|
|
|
IdCollection<ESM::Global> mGlobals;
|
2013-02-08 08:58:19 +00:00
|
|
|
IdCollection<ESM::GameSetting> mGmsts;
|
2013-03-21 13:31:32 +00:00
|
|
|
IdCollection<ESM::Skill> mSkills;
|
2013-03-25 12:22:06 +00:00
|
|
|
IdCollection<ESM::Class> mClasses;
|
2013-04-02 10:00:45 +00:00
|
|
|
IdCollection<ESM::Faction> mFactions;
|
2013-04-04 12:34:39 +00:00
|
|
|
IdCollection<ESM::Race> mRaces;
|
2013-04-06 19:21:10 +00:00
|
|
|
IdCollection<ESM::Sound> mSounds;
|
2013-04-07 13:17:35 +00:00
|
|
|
IdCollection<ESM::Script> mScripts;
|
2013-04-07 14:32:06 +00:00
|
|
|
IdCollection<ESM::Region> mRegions;
|
2013-04-07 18:26:39 +00:00
|
|
|
IdCollection<ESM::BirthSign> mBirthsigns;
|
2013-04-09 09:40:36 +00:00
|
|
|
IdCollection<ESM::Spell> mSpells;
|
2013-04-14 15:04:55 +00:00
|
|
|
IdCollection<Cell> mCells;
|
2013-05-07 09:23:18 +00:00
|
|
|
RefIdCollection mReferenceables;
|
2013-07-06 15:03:18 +00:00
|
|
|
RefCollection mRefs;
|
2013-07-22 19:18:47 +00:00
|
|
|
IdCollection<CSMFilter::Filter> mFilters;
|
2013-03-21 09:07:25 +00:00
|
|
|
std::vector<QAbstractItemModel *> mModels;
|
|
|
|
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
|
2012-11-26 11:29:22 +00:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
Data (const Data&);
|
|
|
|
Data& operator= (const Data&);
|
|
|
|
|
2013-03-21 09:07:25 +00:00
|
|
|
void addModel (QAbstractItemModel *model, UniversalId::Type type1,
|
2013-09-19 10:11:27 +00:00
|
|
|
UniversalId::Type type2 = UniversalId::Type_None, bool update = true);
|
|
|
|
|
2013-09-19 11:42:19 +00:00
|
|
|
static void appendIds (std::vector<std::string>& ids, const CollectionBase& collection,
|
|
|
|
bool listDeleted);
|
2013-09-19 10:11:27 +00:00
|
|
|
///< Append all IDs from collection to \a ids.
|
2012-12-30 13:01:52 +00:00
|
|
|
|
2012-11-26 11:29:22 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
Data();
|
|
|
|
|
2013-09-19 10:11:27 +00:00
|
|
|
virtual ~Data();
|
2012-11-26 11:29:22 +00:00
|
|
|
|
|
|
|
const IdCollection<ESM::Global>& getGlobals() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Global>& getGlobals();
|
|
|
|
|
2013-02-17 19:03:39 +00:00
|
|
|
const IdCollection<ESM::GameSetting>& getGmsts() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::GameSetting>& getGmsts();
|
|
|
|
|
2013-03-24 14:10:03 +00:00
|
|
|
const IdCollection<ESM::Skill>& getSkills() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Skill>& getSkills();
|
|
|
|
|
2013-04-04 08:10:26 +00:00
|
|
|
const IdCollection<ESM::Class>& getClasses() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Class>& getClasses();
|
|
|
|
|
2013-04-02 10:00:45 +00:00
|
|
|
const IdCollection<ESM::Faction>& getFactions() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Faction>& getFactions();
|
|
|
|
|
2013-04-04 12:34:39 +00:00
|
|
|
const IdCollection<ESM::Race>& getRaces() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Race>& getRaces();
|
|
|
|
|
2013-04-06 19:21:10 +00:00
|
|
|
const IdCollection<ESM::Sound>& getSounds() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Sound>& getSounds();
|
|
|
|
|
2013-04-07 13:17:35 +00:00
|
|
|
const IdCollection<ESM::Script>& getScripts() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Script>& getScripts();
|
|
|
|
|
2013-04-07 14:32:06 +00:00
|
|
|
const IdCollection<ESM::Region>& getRegions() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Region>& getRegions();
|
|
|
|
|
2013-04-07 18:26:39 +00:00
|
|
|
const IdCollection<ESM::BirthSign>& getBirthsigns() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::BirthSign>& getBirthsigns();
|
|
|
|
|
2013-04-09 09:40:36 +00:00
|
|
|
const IdCollection<ESM::Spell>& getSpells() const;
|
|
|
|
|
|
|
|
IdCollection<ESM::Spell>& getSpells();
|
|
|
|
|
2013-04-14 15:04:55 +00:00
|
|
|
const IdCollection<Cell>& getCells() const;
|
|
|
|
|
|
|
|
IdCollection<Cell>& getCells();
|
|
|
|
|
2013-05-07 09:23:18 +00:00
|
|
|
const RefIdCollection& getReferenceables() const;
|
|
|
|
|
|
|
|
RefIdCollection& getReferenceables();
|
|
|
|
|
2013-07-30 10:53:03 +00:00
|
|
|
const RefCollection& getReferences() const;
|
|
|
|
|
|
|
|
RefCollection& getReferences();
|
|
|
|
|
2013-08-24 15:40:00 +00:00
|
|
|
const IdCollection<CSMFilter::Filter>& getFilters() const;
|
|
|
|
|
|
|
|
IdCollection<CSMFilter::Filter>& getFilters();
|
|
|
|
|
2013-03-21 09:07:25 +00:00
|
|
|
QAbstractItemModel *getTableModel (const UniversalId& id);
|
2012-12-30 13:01:52 +00:00
|
|
|
///< If no table model is available for \a id, an exception is thrown.
|
|
|
|
///
|
|
|
|
/// \note The returned table may either be the model for the ID itself or the model that
|
|
|
|
/// contains the record specified by the ID.
|
2012-12-03 12:56:02 +00:00
|
|
|
|
|
|
|
void merge();
|
|
|
|
///< Merge modified into base.
|
2013-02-07 10:33:08 +00:00
|
|
|
|
|
|
|
void loadFile (const boost::filesystem::path& path, bool base);
|
|
|
|
///< Merging content of a file into base or modified.
|
2013-07-28 13:27:15 +00:00
|
|
|
|
|
|
|
bool hasId (const std::string& id) const;
|
2013-09-19 10:11:27 +00:00
|
|
|
|
2013-09-19 11:42:19 +00:00
|
|
|
std::vector<std::string> getIds (bool listDeleted = true) const;
|
2013-09-19 10:11:27 +00:00
|
|
|
///< Return a sorted collection of all IDs that are not internal to the editor.
|
|
|
|
///
|
2013-09-19 11:42:19 +00:00
|
|
|
/// \param listDeleted include deleted record in the list
|
2013-09-19 10:11:27 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
void idListChanged();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
|
|
|
|
|
|
void rowsChanged (const QModelIndex& parent, int start, int end);
|
2012-11-26 11:29:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|