added basic loading GUI
parent
ddb0496dca
commit
5f1d2f72f6
@ -0,0 +1,44 @@
|
||||
|
||||
#include "loader.hpp"
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
||||
CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document)
|
||||
{
|
||||
setWindowTitle (("Loading " + document->getSavePath().filename().string()).c_str());
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
CSVDoc::Loader::Loader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSVDoc::Loader::~Loader()
|
||||
{
|
||||
for (std::map<CSMDoc::Document *, LoadingDocument *>::iterator iter (mDocuments.begin());
|
||||
iter!=mDocuments.end(); ++iter)
|
||||
delete iter->second;
|
||||
}
|
||||
|
||||
void CSVDoc::Loader::add (CSMDoc::Document *document, bool new_)
|
||||
{
|
||||
mDocuments.insert (std::make_pair (document, new LoadingDocument (document)));
|
||||
}
|
||||
|
||||
void CSVDoc::Loader::loadingStopped (CSMDoc::Document *document, bool completed,
|
||||
const std::string& error)
|
||||
{
|
||||
if (completed || error.empty())
|
||||
{
|
||||
for (std::map<CSMDoc::Document *, LoadingDocument *>::iterator iter (mDocuments.begin());
|
||||
iter!=mDocuments.end(); ++iter)
|
||||
if (iter->first==document)
|
||||
{
|
||||
delete iter->second;
|
||||
mDocuments.erase (iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
#ifndef CSV_DOC_LOADER_H
|
||||
#define CSV_DOC_LOADER_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
}
|
||||
|
||||
namespace CSVDoc
|
||||
{
|
||||
class LoadingDocument : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
LoadingDocument (CSMDoc::Document *document);
|
||||
};
|
||||
|
||||
class Loader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
std::map<CSMDoc::Document *, LoadingDocument *> mDocuments;
|
||||
|
||||
public:
|
||||
|
||||
Loader();
|
||||
|
||||
virtual ~Loader();
|
||||
|
||||
public slots:
|
||||
|
||||
void add (CSMDoc::Document *document, bool new_);
|
||||
|
||||
void loadingStopped (CSMDoc::Document *document, bool completed,
|
||||
const std::string& error);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue