OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loader.hpp
Go to the documentation of this file.
1 #ifndef CSM_DOC_LOADER_H
2 #define CSM_DOC_LOADER_H
3 
4 #include <vector>
5 
6 #include <QObject>
7 #include <QMutex>
8 #include <QTimer>
9 #include <QWaitCondition>
10 
11 namespace CSMDoc
12 {
13  class Document;
14 
15  class Loader : public QObject
16  {
17  Q_OBJECT
18 
19  struct Stage
20  {
21  int mFile;
24 
25  Stage();
26  };
27 
28  QMutex mMutex;
29  QWaitCondition mThingsToDo;
30  std::vector<std::pair<Document *, Stage> > mDocuments;
31 
32  QTimer* mTimer;
34 
35  public:
36 
37  Loader();
38 
39  QWaitCondition& hasThingsToDo();
40 
41  void stop();
42 
43  private slots:
44 
45  void load();
46 
47  public slots:
48 
49  void loadDocument (CSMDoc::Document *document);
51 
52  void abortLoading (CSMDoc::Document *document);
56 
57  signals:
58 
59  void documentLoaded (Document *document);
61 
62  void documentNotLoaded (Document *document, const std::string& error);
65 
66  void nextStage (CSMDoc::Document *document, const std::string& name,
67  int totalRecords);
68 
69  void nextRecord (CSMDoc::Document *document, int records);
73 
74  void loadMessage (CSMDoc::Document *document, const std::string& message);
76  };
77 }
78 
79 #endif
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
static const struct @2 signals[]
QWaitCondition & hasThingsToDo()
Definition: loader.cpp:22
QTimer * mTimer
Definition: loader.hpp:32
void abortLoading(CSMDoc::Document *document)
Definition: loader.cpp:133
void nextStage(CSMDoc::Document *document, const std::string &name, int totalRecords)
Stage()
Definition: loader.cpp:10
Definition: loader.hpp:15
void documentLoaded(Document *document)
The ownership of document is not transferred.
bool mRecordsLeft
Definition: loader.hpp:23
void stop()
Definition: loader.cpp:27
void documentNotLoaded(Document *document, const std::string &error)
Loader()
Definition: loader.cpp:13
QWaitCondition mThingsToDo
Definition: loader.hpp:29
Definition: document.hpp:57
void loadMessage(CSMDoc::Document *document, const std::string &message)
Non-critical load error or warning.
Definition: loader.hpp:19
int mRecordsLoaded
Definition: loader.hpp:22
void nextRecord(CSMDoc::Document *document, int records)
int mFile
Definition: loader.hpp:21
void loadDocument(CSMDoc::Document *document)
The ownership of document is not transferred.
Definition: loader.cpp:128
QMutex mMutex
Definition: loader.hpp:28
std::vector< std::pair< Document *, Stage > > mDocuments
Definition: loader.hpp:30
bool mShouldStop
Definition: loader.hpp:33
void load()
Definition: loader.cpp:32
const char * name
Definition: crashcatcher.cpp:59