OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
documentmanager.hpp
Go to the documentation of this file.
1 #ifndef CSM_DOC_DOCUMENTMGR_H
2 #define CSM_DOC_DOCUMENTMGR_H
3 
4 #include <vector>
5 #include <string>
6 
7 #include <boost/filesystem/path.hpp>
8 
9 #include <QObject>
10 #include <QThread>
11 
14 
15 #include "../world/resourcesmanager.hpp"
16 
17 #include "loader.hpp"
18 
19 namespace VFS
20 {
21  class Manager;
22 }
23 
24 namespace Files
25 {
26  struct ConfigurationManager;
27 }
28 
29 namespace CSMDoc
30 {
31  class Document;
32 
33  class DocumentManager : public QObject
34  {
35  Q_OBJECT
36 
37  std::vector<Document *> mDocuments;
39  QThread mLoaderThread;
43  std::vector<std::string> mBlacklistedScripts;
45 
48 
49  public:
50 
51  DocumentManager (const Files::ConfigurationManager& configuration);
52 
54 
55  void addDocument (const std::vector< boost::filesystem::path >& files,
56  const boost::filesystem::path& savePath, bool new_);
59 
66  Document *makeDocument (const std::vector< boost::filesystem::path >& files,
67  const boost::filesystem::path& savePath, bool new_);
68 
69  void setResourceDir (const boost::filesystem::path& parResDir);
70 
71  void setFallbackMap (const std::map<std::string, std::string>& fallbackMap);
72 
73  void setEncoding (ToUTF8::FromType encoding);
74 
75  void setBlacklistedScripts (const std::vector<std::string>& scriptIds);
76 
77  void setVFS(const VFS::Manager* vfs);
78 
79  bool isEmpty();
80 
81  private:
82 
83  boost::filesystem::path mResDir;
85 
86  private slots:
87 
88  void documentLoaded (Document *document);
90 
91  void documentNotLoaded (Document *document, const std::string& error);
94 
95  public slots:
96 
97  void removeDocument (CSMDoc::Document *document);
99 
102  void insertDocument (CSMDoc::Document *document);
103 
104  signals:
105 
106  void documentAdded (CSMDoc::Document *document);
107 
109 
110  void loadRequest (CSMDoc::Document *document);
111 
112  void lastDocumentDeleted();
113 
114  void loadingStopped (CSMDoc::Document *document, bool completed,
115  const std::string& error);
116 
117  void nextStage (CSMDoc::Document *document, const std::string& name,
118  int totalRecords);
119 
120  void nextRecord (CSMDoc::Document *document, int records);
121 
122  void cancelLoading (CSMDoc::Document *document);
123 
124  void loadMessage (CSMDoc::Document *document, const std::string& message);
125  };
126 }
127 
128 #endif
void setEncoding(ToUTF8::FromType encoding)
Definition: documentmanager.cpp:109
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
static const struct @2 signals[]
void documentLoaded(Document *document)
The ownership of document is not transferred.
Definition: documentmanager.cpp:119
contains settings imported from the Morrowind INI file.
Definition: fallback.hpp:12
Definition: resourcesmanager.hpp:16
Definition: configurationmanager.hpp:20
Definition: loader.hpp:15
Definition: documentmanager.hpp:33
Fallback::Map mFallbackMap
Definition: documentmanager.hpp:84
DocumentManager(const DocumentManager &)
void loadingStopped(CSMDoc::Document *document, bool completed, const std::string &error)
bool isEmpty()
Definition: documentmanager.cpp:52
void setBlacklistedScripts(const std::vector< std::string > &scriptIds)
Definition: documentmanager.cpp:114
std::vector< Document * > mDocuments
Definition: documentmanager.hpp:37
void nextStage(CSMDoc::Document *document, const std::string &name, int totalRecords)
~DocumentManager()
Definition: documentmanager.cpp:41
const Files::ConfigurationManager & mConfiguration
Definition: documentmanager.hpp:38
void documentAboutToBeRemoved(CSMDoc::Document *document)
void insertDocument(CSMDoc::Document *document)
Definition: documentmanager.cpp:71
CSMWorld::ResourcesManager mResourcesManager
Definition: documentmanager.hpp:42
void loadMessage(CSMDoc::Document *document, const std::string &message)
boost::filesystem::path mResDir
Definition: documentmanager.hpp:83
DocumentManager & operator=(const DocumentManager &)
FromType
Definition: to_utf8.hpp:11
void setVFS(const VFS::Manager *vfs)
Definition: documentmanager.cpp:133
Definition: document.hpp:57
void removeDocument(CSMDoc::Document *document)
Emits the lastDocumentDeleted signal, if applicable.
Definition: documentmanager.cpp:83
void documentNotLoaded(Document *document, const std::string &error)
Definition: documentmanager.cpp:125
Loader mLoader
Definition: documentmanager.hpp:40
QThread mLoaderThread
Definition: documentmanager.hpp:39
Document * makeDocument(const std::vector< boost::filesystem::path > &files, const boost::filesystem::path &savePath, bool new_)
Definition: documentmanager.cpp:64
std::vector< std::string > mBlacklistedScripts
Definition: documentmanager.hpp:43
void documentAdded(CSMDoc::Document *document)
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
void setResourceDir(const boost::filesystem::path &parResDir)
Definition: documentmanager.cpp:99
void loadRequest(CSMDoc::Document *document)
void cancelLoading(CSMDoc::Document *document)
void nextRecord(CSMDoc::Document *document, int records)
void setFallbackMap(const std::map< std::string, std::string > &fallbackMap)
Definition: documentmanager.cpp:104
void addDocument(const std::vector< boost::filesystem::path > &files, const boost::filesystem::path &savePath, bool new_)
Definition: documentmanager.cpp:57
const VFS::Manager * mVFS
Definition: documentmanager.hpp:44
const char * name
Definition: crashcatcher.cpp:59
ToUTF8::FromType mEncoding
Definition: documentmanager.hpp:41