1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 14:53:52 +00:00
openmw/apps/opencs/view/doc/loader.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 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>
2022-10-19 17:02:00 +00:00
#include <string>
2014-04-29 12:17:25 +00:00
#include <QObject>
#include <QWidget>
2022-10-19 17:02:00 +00:00
class QCloseEvent;
2014-05-03 11:01:29 +00:00
class QLabel;
class QProgressBar;
class QDialogButtonBox;
class QListWidget;
2014-05-10 11:29:28 +00:00
class QVBoxLayout;
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;
QLabel* mTotalRecordsLabel;
QLabel* mRecordsLabel;
QProgressBar* mTotalProgress;
2014-05-03 13:33:35 +00:00
QProgressBar* mRecordProgress;
bool mAborted;
QDialogButtonBox* mButtons;
QLabel* mError;
QListWidget* mMessages;
2014-05-10 11:29:28 +00:00
QVBoxLayout* mLayout;
int mRecords;
2014-06-26 09:41:21 +00:00
int mTotalRecords;
int mFilesLoaded;
2014-05-03 11:01:29 +00:00
private:
void closeEvent(QCloseEvent* event) override;
2022-09-22 18:26:05 +00:00
public:
LoadingDocument(CSMDoc::Document* document);
2014-06-26 09:41:21 +00:00
void nextStage(const std::string& name, int totalRecords);
2014-04-29 12:17:25 +00:00
void nextRecord(int records);
2014-05-03 11:01:29 +00:00
2014-06-26 09:41:21 +00:00
void abort(const std::string& error);
2014-05-03 13:33:35 +00:00
2014-06-26 09:41:21 +00:00
void addMessage(const std::string& message);
2014-05-03 14:44:50 +00:00
private slots:
void cancel();
2014-05-03 14:44:50 +00:00
signals:
void cancel(CSMDoc::Document* document);
///< Stop loading process.
2014-05-03 14:44:50 +00:00
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;
2022-09-22 18:26:05 +00:00
public:
2014-04-29 12:17:25 +00:00
Loader();
~Loader() override;
2014-04-29 12:17:25 +00:00
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-06-26 09:41:21 +00:00
void nextStage(CSMDoc::Document* document, const std::string& name, int totalRecords);
2014-05-03 13:33:35 +00:00
2014-06-26 09:41:21 +00:00
void nextRecord(CSMDoc::Document* document, int records);
void loadMessage(CSMDoc::Document* document, const std::string& message);
2014-04-29 12:17:25 +00:00
};
}
#endif