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 CSV_DOC_LOADER_H
2 #define CSV_DOC_LOADER_H
3 
4 #include <map>
5 
6 #include <QObject>
7 #include <QWidget>
8 #include <QSignalMapper>
9 
10 class QLabel;
11 class QProgressBar;
12 class QDialogButtonBox;
13 class QListWidget;
14 class QVBoxLayout;
15 
16 namespace CSMDoc
17 {
18  class Document;
19 }
20 
21 namespace CSVDoc
22 {
23  class LoadingDocument : public QWidget
24  {
25  Q_OBJECT
26 
28  QLabel *mFile;
29  QLabel *mRecords;
30  QProgressBar *mFileProgress;
31  QProgressBar *mRecordProgress;
32  bool mAborted;
33  QDialogButtonBox *mButtons;
34  QLabel *mError;
36  QVBoxLayout *mLayout;
38 
39  private:
40 
41  void closeEvent (QCloseEvent *event);
42 
43  public:
44 
46 
47  void nextStage (const std::string& name, int totalRecords);
48 
49  void nextRecord (int records);
50 
51  void abort (const std::string& error);
52 
53  void addMessage (const std::string& message);
54 
55  private slots:
56 
57  void cancel();
58 
59  signals:
60 
61  void cancel (CSMDoc::Document *document);
63 
64  void close (CSMDoc::Document *document);
66  };
67 
68  class Loader : public QObject
69  {
70  Q_OBJECT
71 
72  std::map<CSMDoc::Document *, LoadingDocument *> mDocuments;
73 
74  public:
75 
76  Loader();
77 
78  virtual ~Loader();
79 
80  signals:
81 
82  void cancel (CSMDoc::Document *document);
83 
84  void close (CSMDoc::Document *document);
85 
86  public slots:
87 
88  void add (CSMDoc::Document *document);
89 
90  void loadingStopped (CSMDoc::Document *document, bool completed,
91  const std::string& error);
92 
93  void nextStage (CSMDoc::Document *document, const std::string& name, int totalRecords);
94 
95  void nextRecord (CSMDoc::Document *document, int records);
96 
97  void loadMessage (CSMDoc::Document *document, const std::string& message);
98  };
99 }
100 
101 #endif
void closeEvent(QCloseEvent *event)
Definition: loader.cpp:13
void nextStage(CSMDoc::Document *document, const std::string &name, int totalRecords)
Definition: loader.cpp:178
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
void addMessage(const std::string &message)
Definition: loader.cpp:110
static const struct @2 signals[]
LoadingDocument(CSMDoc::Document *document)
Definition: loader.cpp:19
bool mAborted
Definition: loader.hpp:32
QLabel * mFile
Definition: loader.hpp:28
QListWidget * mMessages
Definition: loader.hpp:35
int mTotalRecords
Definition: loader.hpp:37
virtual ~Loader()
Definition: loader.cpp:135
void nextStage(const std::string &name, int totalRecords)
Definition: loader.cpp:77
QDialogButtonBox * mButtons
Definition: loader.hpp:33
void loadingStopped(CSMDoc::Document *document, bool completed, const std::string &error)
Definition: loader.cpp:153
void loadMessage(CSMDoc::Document *document, const std::string &message)
Definition: loader.cpp:195
Loader()
Definition: loader.cpp:133
QProgressBar * mRecordProgress
Definition: loader.hpp:31
Definition: loader.hpp:68
void abort(const std::string &error)
Definition: loader.cpp:103
QLabel * mRecords
Definition: loader.hpp:29
void add(CSMDoc::Document *document)
Definition: loader.cpp:142
void cancel()
Definition: loader.cpp:121
void cancel(CSMDoc::Document *document)
QProgressBar * mFileProgress
Definition: loader.hpp:30
QVBoxLayout * mLayout
Definition: loader.hpp:36
void close(CSMDoc::Document *document)
Close stopped loading process.
Definition: document.hpp:57
CSMDoc::Document * mDocument
Definition: loader.hpp:27
void nextRecord(CSMDoc::Document *document, int records)
Definition: loader.cpp:187
void nextRecord(int records)
Definition: loader.cpp:89
Definition: loader.hpp:23
QLabel * mError
Definition: loader.hpp:34
std::map< CSMDoc::Document *, LoadingDocument * > mDocuments
Definition: loader.hpp:72
void close(CSMDoc::Document *document)
const char * name
Definition: crashcatcher.cpp:59