2012-11-22 13:30:02 +01:00
|
|
|
#ifndef CSM_DOC_DOCUMENT_H
|
|
|
|
#define CSM_DOC_DOCUMENT_H
|
2012-11-21 17:31:18 +01:00
|
|
|
|
2012-11-23 14:05:49 +01:00
|
|
|
#include <string>
|
|
|
|
|
2013-02-04 13:46:54 +01:00
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
2012-11-22 15:54:31 +01:00
|
|
|
#include <QUndoStack>
|
2012-11-22 23:42:17 +01:00
|
|
|
#include <QObject>
|
2012-11-23 00:36:01 +01:00
|
|
|
#include <QTimer>
|
2012-11-22 15:54:31 +01:00
|
|
|
|
2012-11-26 12:29:22 +01:00
|
|
|
#include "../world/data.hpp"
|
|
|
|
|
2012-12-08 11:59:13 +01:00
|
|
|
#include "../tools/tools.hpp"
|
|
|
|
|
2012-12-08 14:44:03 +01:00
|
|
|
#include "state.hpp"
|
2013-09-15 12:48:57 +02:00
|
|
|
#include "saving.hpp"
|
2012-12-08 14:44:03 +01:00
|
|
|
|
2012-12-11 15:35:47 +01:00
|
|
|
class QAbstractItemModel;
|
|
|
|
|
2013-02-17 20:03:39 +01:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct GameSetting;
|
2013-02-23 12:51:45 +01:00
|
|
|
struct Global;
|
2013-02-17 20:03:39 +01:00
|
|
|
}
|
|
|
|
|
2012-11-21 17:31:18 +01:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
2012-11-22 23:42:17 +01:00
|
|
|
class Document : public QObject
|
2012-11-21 17:31:18 +01:00
|
|
|
{
|
2012-11-22 23:42:17 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-26 12:29:22 +01:00
|
|
|
private:
|
|
|
|
|
2013-09-10 16:45:01 +02:00
|
|
|
boost::filesystem::path mSavePath;
|
2012-11-26 12:29:22 +01:00
|
|
|
CSMWorld::Data mData;
|
2012-12-08 11:59:13 +01:00
|
|
|
CSMTools::Tools mTools;
|
2013-09-15 12:48:57 +02:00
|
|
|
Saving mSaving;
|
2012-11-22 15:54:31 +01:00
|
|
|
|
2012-12-08 23:27:59 +01:00
|
|
|
// It is important that the undo stack is declared last, because on desctruction it fires a signal, that is connected to a slot, that is
|
|
|
|
// using other member variables. Unfortunately this connection is cut only in the QObject destructor, which is way too late.
|
|
|
|
QUndoStack mUndoStack;
|
|
|
|
|
2012-11-22 13:30:02 +01:00
|
|
|
// not implemented
|
2012-11-21 17:31:18 +01:00
|
|
|
Document (const Document&);
|
|
|
|
Document& operator= (const Document&);
|
|
|
|
|
2013-02-04 13:46:54 +01:00
|
|
|
void load (const std::vector<boost::filesystem::path>::const_iterator& begin,
|
2013-02-07 11:33:08 +01:00
|
|
|
const std::vector<boost::filesystem::path>::const_iterator& end, bool lastAsModified);
|
|
|
|
///< \param lastAsModified Store the last file in Modified instead of merging it into Base.
|
2013-02-04 13:46:54 +01:00
|
|
|
|
|
|
|
void createBase();
|
|
|
|
|
2013-06-23 15:19:08 -04:00
|
|
|
void addGmsts();
|
2013-06-22 21:01:27 -04:00
|
|
|
|
2013-02-17 20:03:39 +01:00
|
|
|
void addOptionalGmsts();
|
|
|
|
|
2013-02-23 12:51:45 +01:00
|
|
|
void addOptionalGlobals();
|
|
|
|
|
2013-02-17 20:03:39 +01:00
|
|
|
void addOptionalGmst (const ESM::GameSetting& gmst);
|
|
|
|
|
2013-02-23 12:51:45 +01:00
|
|
|
void addOptionalGlobal (const ESM::Global& global);
|
|
|
|
|
2012-11-21 17:31:18 +01:00
|
|
|
public:
|
|
|
|
|
2013-09-10 16:45:01 +02:00
|
|
|
Document (const std::vector<boost::filesystem::path>& files,
|
|
|
|
const boost::filesystem::path& savePath, bool new_);
|
|
|
|
|
2013-03-12 06:28:13 -05:00
|
|
|
~Document();
|
2012-11-22 15:54:31 +01:00
|
|
|
|
|
|
|
QUndoStack& getUndoStack();
|
2012-11-22 23:42:17 +01:00
|
|
|
|
|
|
|
int getState() const;
|
|
|
|
|
2013-09-10 16:45:01 +02:00
|
|
|
const boost::filesystem::path& getSavePath() const;
|
2012-11-23 14:05:49 +01:00
|
|
|
|
2012-11-23 00:36:01 +01:00
|
|
|
void save();
|
|
|
|
|
2012-12-11 15:35:47 +01:00
|
|
|
CSMWorld::UniversalId verify();
|
2012-11-23 13:15:45 +01:00
|
|
|
|
2012-11-23 12:20:35 +01:00
|
|
|
void abortOperation (int type);
|
2012-11-23 00:36:01 +01:00
|
|
|
|
2012-11-26 12:29:22 +01:00
|
|
|
const CSMWorld::Data& getData() const;
|
|
|
|
|
|
|
|
CSMWorld::Data& getData();
|
|
|
|
|
2012-12-11 15:35:47 +01:00
|
|
|
CSMTools::ReportModel *getReport (const CSMWorld::UniversalId& id);
|
|
|
|
///< The ownership of the returned report is not transferred.
|
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void stateChanged (int state, CSMDoc::Document *document);
|
|
|
|
|
2012-11-23 12:20:35 +01:00
|
|
|
void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
|
2012-11-23 10:25:34 +01:00
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void modificationStateChanged (bool clean);
|
2012-11-23 00:36:01 +01:00
|
|
|
|
2012-12-08 11:59:13 +01:00
|
|
|
void operationDone (int type);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void progress (int current, int max, int type);
|
2012-11-21 17:31:18 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-03-12 06:28:13 -05:00
|
|
|
#endif
|