1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 18:37:08 +00:00
OpenMW/apps/opencs/model/doc/document.hpp

123 lines
3.3 KiB
C++
Raw Normal View History

2012-11-22 12:30:02 +00:00
#ifndef CSM_DOC_DOCUMENT_H
#define CSM_DOC_DOCUMENT_H
2012-11-21 16:31:18 +00:00
2012-11-23 13:05:49 +00:00
#include <string>
#include <boost/filesystem/path.hpp>
2012-11-22 14:54:31 +00:00
#include <QUndoStack>
#include <QObject>
#include <QTimer>
2012-11-22 14:54:31 +00:00
#include "../world/data.hpp"
#include "../tools/tools.hpp"
#include "state.hpp"
#include "saving.hpp"
2012-12-11 14:35:47 +00:00
class QAbstractItemModel;
namespace ESM
{
struct GameSetting;
struct Global;
}
namespace Files
{
class ConfigurationManager;
}
2012-11-21 16:31:18 +00:00
namespace CSMDoc
{
class Document : public QObject
2012-11-21 16:31:18 +00:00
{
Q_OBJECT
private:
2013-09-10 14:45:01 +00:00
boost::filesystem::path mSavePath;
std::vector<boost::filesystem::path> mContentFiles;
CSMWorld::Data mData;
CSMTools::Tools mTools;
boost::filesystem::path mProjectPath;
Saving mSaving;
2013-10-21 16:15:26 +00:00
boost::filesystem::path mResDir;
2012-11-22 14:54:31 +00:00
2012-12-08 22:27:59 +00: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 12:30:02 +00:00
// not implemented
Document (const Document&);
2012-11-21 16:31:18 +00:00
Document& operator= (const Document&);
void load (const std::vector<boost::filesystem::path>::const_iterator& begin,
2013-02-07 10:33:08 +00: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.
void createBase();
void addGmsts();
void addOptionalGmsts();
void addOptionalGlobals();
void addOptionalGmst (const ESM::GameSetting& gmst);
void addOptionalGlobal (const ESM::Global& global);
2012-11-21 16:31:18 +00:00
public:
Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, bool new_);
2013-09-10 14:45:01 +00:00
~Document();
2012-11-22 14:54:31 +00:00
QUndoStack& getUndoStack();
int getState() const;
2013-09-10 14:45:01 +00:00
const boost::filesystem::path& getSavePath() const;
2012-11-23 13:05:49 +00:00
const std::vector<boost::filesystem::path>& getContentFiles() const;
///< \attention The last element in this collection is the file that is being edited,
/// but with its original path instead of the save path.
void save();
2012-12-11 14:35:47 +00:00
CSMWorld::UniversalId verify();
2012-11-23 11:20:35 +00:00
void abortOperation (int type);
const CSMWorld::Data& getData() const;
CSMWorld::Data& getData();
2012-12-11 14:35:47 +00:00
CSMTools::ReportModel *getReport (const CSMWorld::UniversalId& id);
///< The ownership of the returned report is not transferred.
signals:
void stateChanged (int state, CSMDoc::Document *document);
2012-11-23 11:20:35 +00:00
void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
2012-11-23 09:25:34 +00:00
private slots:
void modificationStateChanged (bool clean);
void reportMessage (const QString& message, int type);
void operationDone (int type);
public slots:
void progress (int current, int max, int type);
2012-11-21 16:31:18 +00:00
};
}
#endif
2013-10-21 16:15:26 +00:00