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 
15 
16 #include "loader.hpp"
17 
18 namespace VFS
19 {
20  class Manager;
21 }
22 
23 namespace Files
24 {
25  struct ConfigurationManager;
26 }
27 
28 namespace CSMDoc
29 {
30  class Document;
31 
32  class DocumentManager : public QObject
33  {
34  Q_OBJECT
35 
36  std::vector<Document *> mDocuments;
38  QThread mLoaderThread;
41  std::vector<std::string> mBlacklistedScripts;
42 
43  boost::filesystem::path mResDir;
45 
46  bool mFsStrict;
48  std::vector<std::string> mArchives;
49 
52 
53  public:
54 
55  DocumentManager (const Files::ConfigurationManager& configuration);
56 
58 
59  void addDocument (const std::vector< boost::filesystem::path >& files,
60  const boost::filesystem::path& savePath, bool new_);
63 
70  Document *makeDocument (const std::vector< boost::filesystem::path >& files,
71  const boost::filesystem::path& savePath, bool new_);
72 
73  void setResourceDir (const boost::filesystem::path& parResDir);
74 
75  void setFallbackMap (const std::map<std::string, std::string>& fallbackMap);
76 
77  void setEncoding (ToUTF8::FromType encoding);
78 
79  void setBlacklistedScripts (const std::vector<std::string>& scriptIds);
80 
82  void setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives);
83 
84  bool isEmpty();
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:106
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
void documentLoaded(Document *document)
The ownership of document is not transferred.
Definition: documentmanager.cpp:116
static const struct @8 signals[]
contains settings imported from the Morrowind INI file.
Definition: fallback.hpp:12
Definition: configurationmanager.hpp:20
Definition: loader.hpp:15
Definition: documentmanager.hpp:32
Fallback::Map mFallbackMap
Definition: documentmanager.hpp:44
DocumentManager(const DocumentManager &)
void loadingStopped(CSMDoc::Document *document, bool completed, const std::string &error)
bool isEmpty()
Definition: documentmanager.cpp:49
void setBlacklistedScripts(const std::vector< std::string > &scriptIds)
Definition: documentmanager.cpp:111
std::vector< Document * > mDocuments
Definition: documentmanager.hpp:36
void nextStage(CSMDoc::Document *document, const std::string &name, int totalRecords)
~DocumentManager()
Definition: documentmanager.cpp:38
const Files::ConfigurationManager & mConfiguration
Definition: documentmanager.hpp:37
void documentAboutToBeRemoved(CSMDoc::Document *document)
void insertDocument(CSMDoc::Document *document)
Definition: documentmanager.cpp:68
void loadMessage(CSMDoc::Document *document, const std::string &message)
Files::PathContainer mDataPaths
Definition: documentmanager.hpp:47
boost::filesystem::path mResDir
Definition: documentmanager.hpp:43
bool mFsStrict
Definition: documentmanager.hpp:46
DocumentManager & operator=(const DocumentManager &)
FromType
Definition: to_utf8.hpp:11
Definition: document.hpp:57
void removeDocument(CSMDoc::Document *document)
Emits the lastDocumentDeleted signal, if applicable.
Definition: documentmanager.cpp:80
void documentNotLoaded(Document *document, const std::string &error)
Definition: documentmanager.cpp:122
std::vector< std::string > mArchives
Definition: documentmanager.hpp:48
Loader mLoader
Definition: documentmanager.hpp:39
QThread mLoaderThread
Definition: documentmanager.hpp:38
Document * makeDocument(const std::vector< boost::filesystem::path > &files, const boost::filesystem::path &savePath, bool new_)
Definition: documentmanager.cpp:61
std::vector< std::string > mBlacklistedScripts
Definition: documentmanager.hpp:41
void documentAdded(CSMDoc::Document *document)
void setResourceDir(const boost::filesystem::path &parResDir)
Definition: documentmanager.cpp:96
void loadRequest(CSMDoc::Document *document)
void cancelLoading(CSMDoc::Document *document)
void setFileData(bool strict, const Files::PathContainer &dataPaths, const std::vector< std::string > &archives)
Sets the file data that gets passed to newly created documents.
Definition: documentmanager.cpp:130
void nextRecord(CSMDoc::Document *document, int records)
std::vector< boost::filesystem::path > PathContainer
Definition: gamesettings.hpp:14
void setFallbackMap(const std::map< std::string, std::string > &fallbackMap)
Definition: documentmanager.cpp:101
void addDocument(const std::vector< boost::filesystem::path > &files, const boost::filesystem::path &savePath, bool new_)
Definition: documentmanager.cpp:54
const char * name
Definition: crashcatcher.cpp:67
ToUTF8::FromType mEncoding
Definition: documentmanager.hpp:40