OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
document.hpp
Go to the documentation of this file.
1 #ifndef CSM_DOC_DOCUMENT_H
2 #define CSM_DOC_DOCUMENT_H
3 
4 #include <string>
5 
6 #include <boost/shared_ptr.hpp>
7 #include <boost/filesystem/path.hpp>
8 
9 #include <QUndoStack>
10 #include <QObject>
11 #include <QTimer>
12 
14 
15 #include "../world/data.hpp"
16 #include "../world/idcompletionmanager.hpp"
17 
18 #include "../tools/tools.hpp"
19 
20 #include "state.hpp"
21 #include "saving.hpp"
22 #include "blacklist.hpp"
23 #include "runner.hpp"
24 #include "operationholder.hpp"
25 
26 class QAbstractItemModel;
27 
28 namespace Fallback
29 {
30  class Map;
31 }
32 
33 namespace VFS
34 {
35  class Manager;
36 }
37 
38 namespace ESM
39 {
40  struct GameSetting;
41  struct Global;
42  struct MagicEffect;
43 }
44 
45 namespace Files
46 {
47  struct ConfigurationManager;
48 }
49 
50 namespace CSMWorld
51 {
52  class ResourcesManager;
53 }
54 
55 namespace CSMDoc
56 {
57  class Document : public QObject
58  {
59  Q_OBJECT
60 
61  private:
62 
64  boost::filesystem::path mSavePath;
65  std::vector<boost::filesystem::path> mContentFiles;
66  bool mNew;
69  boost::filesystem::path mProjectPath;
72  boost::filesystem::path mResDir;
76  bool mDirty;
77 
79 
80  // It is important that the undo stack is declared last, because on desctruction it fires a signal, that is connected to a slot, that is
81  // using other member variables. Unfortunately this connection is cut only in the QObject destructor, which is way too late.
82  QUndoStack mUndoStack;
83 
84  // not implemented
85  Document (const Document&);
86  Document& operator= (const Document&);
87 
88  void createBase();
89 
90  void addGmsts();
91 
92  void addOptionalGmsts();
93 
94  void addOptionalGlobals();
95 
97 
98  void addOptionalGmst (const ESM::GameSetting& gmst);
99 
100  void addOptionalGlobal (const ESM::Global& global);
101 
102  void addOptionalMagicEffect (const ESM::MagicEffect& effect);
103 
104  public:
105 
106  Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration,
107  const std::vector< boost::filesystem::path >& files, bool new_,
108  const boost::filesystem::path& savePath, const boost::filesystem::path& resDir,
109  const Fallback::Map* fallback,
110  ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager,
111  const std::vector<std::string>& blacklistedScripts);
112 
113  ~Document();
114 
115  const VFS::Manager* getVFS() const;
116 
117  QUndoStack& getUndoStack();
118 
119  int getState() const;
120 
121  const boost::filesystem::path& getSavePath() const;
122 
123  const boost::filesystem::path& getProjectPath() const;
124 
125  const std::vector<boost::filesystem::path>& getContentFiles() const;
128 
129  bool isNew() const;
131 
132  void save();
133 
135 
137 
138  void runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search);
139 
140  void runMerge (std::auto_ptr<CSMDoc::Document> target);
141 
142  void abortOperation (int type);
143 
144  const CSMWorld::Data& getData() const;
145 
147 
150 
151  bool isBlacklisted (const CSMWorld::UniversalId& id) const;
152 
153  void startRunning (const std::string& profile,
154  const std::string& startupInstruction = "");
155 
156  void stopRunning();
157 
158  QTextDocument *getRunLog();
159 
161 
162  void flagAsDirty();
163 
164  signals:
165 
166  void stateChanged (int state, CSMDoc::Document *document);
167 
168  void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
169 
172  void mergeDone (CSMDoc::Document *document);
173 
174  private slots:
175 
176  void modificationStateChanged (bool clean);
177 
178  void reportMessage (const CSMDoc::Message& message, int type);
179 
180  void operationDone (int type, bool failed);
181 
182  void runStateChanged();
183 
184  public slots:
185 
186  void progress (int current, int max, int type);
187  };
188 }
189 
190 #endif
const std::vector< boost::filesystem::path > & getContentFiles() const
Definition: document.cpp:378
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
const VFS::Manager * mVFS
Definition: document.hpp:63
CSMWorld::Data mData
Definition: document.hpp:67
static const struct @2 signals[]
ID blacklist sorted by UniversalId type.
Definition: blacklist.hpp:13
CSMWorld::UniversalId verify(const CSMWorld::UniversalId &reportId=CSMWorld::UniversalId())
Definition: document.cpp:399
void mergeDone(CSMDoc::Document *document)
QUndoStack mUndoStack
Definition: document.hpp:82
std::vector< boost::filesystem::path > mContentFiles
Definition: document.hpp:65
void abortOperation(int type)
Definition: document.cpp:424
bool mDirty
Definition: document.hpp:76
Creates and stores all ID completers.
Definition: idcompletionmanager.hpp:19
contains settings imported from the Morrowind INI file.
Definition: fallback.hpp:12
Definition: resourcesmanager.hpp:16
const boost::filesystem::path & getProjectPath() const
Definition: document.cpp:373
Definition: saving.hpp:15
Definition: messages.hpp:13
Definition: configurationmanager.hpp:20
boost::filesystem::path mResDir
Definition: document.hpp:72
Definition: loadgmst.hpp:19
void addOptionalGlobals()
Definition: document.cpp:76
Definition: reportmodel.hpp:15
Definition: loadglob.hpp:18
void addOptionalGmst(const ESM::GameSetting &gmst)
Definition: document.cpp:113
~Document()
Definition: document.cpp:335
void addOptionalGmsts()
Definition: document.cpp:45
MWWorld::Ptr searchId(MWWorld::CellRefList< T > &list, const std::string &id, MWWorld::ContainerStore *store)
Definition: containerstore.cpp:42
void operationDone(int type, bool failed)
Definition: document.cpp:443
Blacklist mBlacklist
Definition: document.hpp:74
void flagAsDirty()
Definition: document.cpp:525
CSMWorld::UniversalId newSearch()
Definition: document.cpp:407
Saving mSavingOperation
Definition: document.hpp:70
CSMTools::ReportModel * getReport(const CSMWorld::UniversalId &id)
The ownership of the returned report is not transferred.
Definition: document.cpp:461
void progress(int current, int max, int type, int threads, CSMDoc::Document *document)
Document & operator=(const Document &)
boost::filesystem::path mSavePath
Definition: document.hpp:64
bool mNew
Definition: document.hpp:66
Definition: data.hpp:77
Document(const Document &)
void startRunning(const std::string &profile, const std::string &startupInstruction="")
Definition: document.cpp:472
void createBase()
Definition: document.cpp:146
FromType
Definition: to_utf8.hpp:11
bool isNew() const
Is this a newly created content file?
Definition: document.cpp:383
Definition: loadmgef.hpp:13
int getState() const
Definition: document.cpp:349
void addGmsts()
Definition: document.cpp:15
void reportMessage(const CSMDoc::Message &message, int type)
Definition: document.cpp:437
void runMerge(std::auto_ptr< CSMDoc::Document > target)
Definition: document.cpp:418
Definition: document.hpp:57
QTextDocument * getRunLog()
Definition: document.cpp:505
void addOptionalGlobal(const ESM::Global &global)
Definition: document.cpp:124
CSMWorld::IdCompletionManager & getIdCompletionManager()
Definition: document.cpp:520
const CSMWorld::Data & getData() const
Definition: document.cpp:451
CSMTools::Tools mTools
Definition: document.hpp:68
void stateChanged(int state, CSMDoc::Document *document)
void runSearch(const CSMWorld::UniversalId &searchId, const CSMTools::Search &search)
Definition: document.cpp:412
const Fallback::Map * mFallbackMap
Definition: document.hpp:73
Runner mRunner
Definition: document.hpp:75
CSMWorld::IdCompletionManager mIdCompletionManager
Definition: document.hpp:78
Definition: tools.hpp:34
QUndoStack & getUndoStack()
Definition: document.cpp:344
Definition: runner.hpp:21
OperationHolder mSaving
Definition: document.hpp:71
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
bool isBlacklisted(const CSMWorld::UniversalId &id) const
Definition: document.cpp:466
void stopRunning()
Definition: document.cpp:500
void modificationStateChanged(bool clean)
Definition: document.cpp:432
void runStateChanged()
Definition: document.cpp:510
const VFS::Manager * getVFS() const
Definition: document.cpp:339
Definition: operationholder.hpp:18
Definition: search.hpp:26
const boost::filesystem::path & getSavePath() const
Definition: document.cpp:368
void addOptionalMagicEffect(const ESM::MagicEffect &effect)
Definition: document.cpp:135
void addOptionalMagicEffects()
Definition: document.cpp:100
boost::filesystem::path mProjectPath
Definition: document.hpp:69
void save()
Definition: document.cpp:388
Definition: universalid.hpp:12