2012-11-22 12:30:02 +00:00
|
|
|
#ifndef CSM_DOC_DOCUMENTMGR_H
|
|
|
|
#define CSM_DOC_DOCUMENTMGR_H
|
2012-11-21 16:31:18 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2012-11-23 13:05:49 +00:00
|
|
|
#include <string>
|
2012-11-21 16:31:18 +00:00
|
|
|
|
2013-02-04 12:46:54 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
2014-04-21 07:02:58 +00:00
|
|
|
#include <QObject>
|
2014-04-24 13:09:25 +00:00
|
|
|
#include <QThread>
|
|
|
|
|
2014-05-12 08:32:57 +00:00
|
|
|
#include <components/to_utf8/to_utf8.hpp>
|
|
|
|
|
2014-07-04 10:46:57 +00:00
|
|
|
#include "../world/resourcesmanager.hpp"
|
|
|
|
|
2014-04-24 13:09:25 +00:00
|
|
|
#include "loader.hpp"
|
2014-04-21 07:02:58 +00:00
|
|
|
|
2013-09-27 13:24:58 +00:00
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
class ConfigurationManager;
|
|
|
|
}
|
|
|
|
|
2012-11-21 16:31:18 +00:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
|
2014-04-21 07:02:58 +00:00
|
|
|
class DocumentManager : public QObject
|
2012-11-21 16:31:18 +00:00
|
|
|
{
|
2014-04-21 07:02:58 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-21 16:31:18 +00:00
|
|
|
std::vector<Document *> mDocuments;
|
2013-09-27 13:24:58 +00:00
|
|
|
const Files::ConfigurationManager& mConfiguration;
|
2014-04-24 13:09:25 +00:00
|
|
|
QThread mLoaderThread;
|
|
|
|
Loader mLoader;
|
2014-05-12 08:32:57 +00:00
|
|
|
ToUTF8::FromType mEncoding;
|
2014-07-04 10:46:57 +00:00
|
|
|
CSMWorld::ResourcesManager mResourcesManager;
|
2014-07-21 10:15:21 +00:00
|
|
|
std::vector<std::string> mBlacklistedScripts;
|
2012-11-21 16:31:18 +00:00
|
|
|
|
|
|
|
DocumentManager (const DocumentManager&);
|
|
|
|
DocumentManager& operator= (const DocumentManager&);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2013-09-27 13:24:58 +00:00
|
|
|
DocumentManager (const Files::ConfigurationManager& configuration);
|
2012-11-21 16:31:18 +00:00
|
|
|
|
|
|
|
~DocumentManager();
|
|
|
|
|
2014-04-21 07:02:58 +00:00
|
|
|
void addDocument (const std::vector< boost::filesystem::path >& files,
|
|
|
|
const boost::filesystem::path& savePath, bool new_);
|
|
|
|
///< \param new_ Do not load the last content file in \a files and instead create in an
|
2013-02-04 12:46:54 +00:00
|
|
|
/// appropriate way.
|
2012-11-21 16:31:18 +00:00
|
|
|
|
2013-10-17 16:21:41 +00:00
|
|
|
void setResourceDir (const boost::filesystem::path& parResDir);
|
2014-04-21 07:02:58 +00:00
|
|
|
|
2014-05-12 08:32:57 +00:00
|
|
|
void setEncoding (ToUTF8::FromType encoding);
|
|
|
|
|
2014-07-21 10:15:21 +00:00
|
|
|
void setBlacklistedScripts (const std::vector<std::string>& scriptIds);
|
|
|
|
|
2014-07-04 10:46:57 +00:00
|
|
|
/// Ask OGRE for a list of available resources.
|
|
|
|
void listResources();
|
|
|
|
|
2014-04-21 07:02:58 +00:00
|
|
|
private:
|
|
|
|
|
2013-10-17 16:21:41 +00:00
|
|
|
boost::filesystem::path mResDir;
|
2014-04-21 07:02:58 +00:00
|
|
|
|
2014-04-24 13:09:25 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void documentLoaded (Document *document);
|
|
|
|
///< The ownership of \a document is not transferred.
|
|
|
|
|
|
|
|
void documentNotLoaded (Document *document, const std::string& error);
|
|
|
|
///< Document load has been interrupted either because of a call to abortLoading
|
|
|
|
/// or a problem during loading). In the former case error will be an empty string.
|
|
|
|
|
2014-05-06 07:39:39 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void removeDocument (CSMDoc::Document *document);
|
|
|
|
///< Emits the lastDocumentDeleted signal, if applicable.
|
|
|
|
|
2014-04-21 07:02:58 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void documentAdded (CSMDoc::Document *document);
|
2014-04-24 13:09:25 +00:00
|
|
|
|
2014-04-29 12:27:44 +00:00
|
|
|
void loadRequest (CSMDoc::Document *document);
|
2014-04-26 11:11:27 +00:00
|
|
|
|
|
|
|
void lastDocumentDeleted();
|
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);
|
2014-05-03 14:44:50 +00:00
|
|
|
|
|
|
|
void cancelLoading (CSMDoc::Document *document);
|
2014-05-10 11:18:40 +00:00
|
|
|
|
|
|
|
void loadMessage (CSMDoc::Document *document, const std::string& message);
|
2012-11-21 16:31:18 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|