1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 09:23:51 +00:00
openmw-tes3mp/apps/opencs/view/doc/loader.hpp

98 lines
2 KiB
C++
Raw Normal View History

2014-04-29 12:17:25 +00:00
#ifndef CSV_DOC_LOADER_H
#define CSV_DOC_LOADER_H
#include <map>
#include <QObject>
#include <QWidget>
2014-05-03 14:44:50 +00:00
#include <QSignalMapper>
2014-04-29 12:17:25 +00:00
2014-05-03 11:01:29 +00:00
class QLabel;
class QProgressBar;
class QDialogButtonBox;
class QListWidget;
2014-05-03 11:01:29 +00:00
2014-04-29 12:17:25 +00:00
namespace CSMDoc
{
class Document;
}
namespace CSVDoc
{
class LoadingDocument : public QWidget
{
Q_OBJECT
2014-05-03 14:44:50 +00:00
CSMDoc::Document *mDocument;
2014-05-03 11:01:29 +00:00
QLabel *mFile;
QProgressBar *mFileProgress;
2014-05-03 13:33:35 +00:00
QProgressBar *mRecordProgress;
bool mAborted;
QDialogButtonBox *mButtons;
QLabel *mError;
QListWidget *mMessages;
2014-05-03 11:01:29 +00:00
private:
void closeEvent (QCloseEvent *event);
2014-04-29 12:17:25 +00:00
public:
LoadingDocument (CSMDoc::Document *document);
2014-05-03 11:01:29 +00:00
2014-05-03 13:33:35 +00:00
void nextStage (const std::string& name, int steps);
void nextRecord();
2014-05-03 14:44:50 +00:00
void abort (const std::string& error);
void addMessage (const std::string& message);
2014-05-03 14:44:50 +00:00
private slots:
void cancel();
signals:
void cancel (CSMDoc::Document *document);
///< Stop loading process.
void close (CSMDoc::Document *document);
///< Close stopped loading process.
2014-04-29 12:17:25 +00:00
};
class Loader : public QObject
{
Q_OBJECT
std::map<CSMDoc::Document *, LoadingDocument *> mDocuments;
public:
Loader();
virtual ~Loader();
2014-05-03 14:44:50 +00:00
signals:
void cancel (CSMDoc::Document *document);
void close (CSMDoc::Document *document);
2014-04-29 12:17:25 +00:00
public slots:
void add (CSMDoc::Document *document);
2014-04-29 12:17:25 +00:00
void loadingStopped (CSMDoc::Document *document, bool completed,
const std::string& error);
2014-05-03 11:01:29 +00:00
2014-05-03 13:33:35 +00:00
void nextStage (CSMDoc::Document *document, const std::string& name, int steps);
void nextRecord (CSMDoc::Document *document);
void loadMessage (CSMDoc::Document *document, const std::string& message);
2014-04-29 12:17:25 +00:00
};
}
#endif