1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/opencs/editor.hpp

111 lines
2.7 KiB
C++
Raw Normal View History

2012-11-22 13:30:02 +01:00
#ifndef CS_EDITOR_H
#define CS_EDITOR_H
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/filesystem/fstream.hpp>
2012-11-23 14:05:49 +01:00
#include <QObject>
#include <QString>
#include <QLocalServer>
#include <QLocalSocket>
#ifndef Q_MOC_RUN
#include <components/files/configurationmanager.hpp>
#endif
#include <components/files/multidircollection.hpp>
2012-11-22 13:30:02 +01:00
#include "model/doc/documentmanager.hpp"
2013-02-02 16:14:58 +01:00
#include "model/prefs/state.hpp"
2012-11-22 13:30:02 +01:00
#include "view/doc/viewmanager.hpp"
2013-02-02 16:14:58 +01:00
#include "view/doc/startup.hpp"
#include "view/doc/filedialog.hpp"
#include "view/doc/newgame.hpp"
#include "view/prefs/dialogue.hpp"
#include "view/tools/merge.hpp"
namespace CSMDoc
{
class Document;
}
2012-11-22 13:30:02 +01:00
namespace CS
{
2012-11-23 14:05:49 +01:00
class Editor : public QObject
2012-11-22 13:30:02 +01:00
{
2012-11-23 14:05:49 +01:00
Q_OBJECT
Files::ConfigurationManager mCfgMgr;
CSMPrefs::State mSettingsState;
2012-11-22 13:30:02 +01:00
CSMDoc::DocumentManager mDocumentManager;
CSVDoc::ViewManager mViewManager;
2013-02-02 16:14:58 +01:00
CSVDoc::StartupDialogue mStartup;
CSVDoc::NewGameDialogue mNewGame;
CSVPrefs::Dialogue mSettings;
CSVDoc::FileDialog mFileDialog;
boost::filesystem::path mLocal;
2014-03-16 12:44:01 +01:00
boost::filesystem::path mResources;
boost::filesystem::path mPid;
boost::interprocess::file_lock mLock;
boost::filesystem::ofstream mPidFile;
bool mFsStrict;
CSVTools::Merge mMerge;
void setupDataFiles (const Files::PathContainer& dataDirs);
std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
///< \return data paths
2012-11-22 13:30:02 +01:00
// not implemented
Editor (const Editor&);
Editor& operator= (const Editor&);
public:
Editor ();
~Editor ();
2012-11-22 13:30:02 +01:00
bool makeIPCServer();
void connectToIPCServer();
2012-11-22 13:30:02 +01:00
int run();
///< \return error status
2012-11-23 14:05:49 +01:00
2013-02-02 16:14:58 +01:00
private slots:
2012-11-23 14:05:49 +01:00
void createGame();
void createAddon();
void cancelCreateGame();
void cancelFileDialog();
2013-02-02 16:14:58 +01:00
void loadDocument();
2013-10-26 22:55:44 -05:00
void openFiles (const boost::filesystem::path &path);
void createNewFile (const boost::filesystem::path& path);
2013-09-10 16:45:01 +02:00
void createNewGame (const boost::filesystem::path& file);
void showStartup();
void showSettings();
void documentAdded (CSMDoc::Document *document);
void documentAboutToBeRemoved (CSMDoc::Document *document);
void lastDocumentDeleted();
void mergeDocument (CSMDoc::Document *document);
private:
QString mIpcServerName;
QLocalServer *mServer;
QLocalSocket *mClientSocket;
2012-11-22 13:30:02 +01:00
};
}
#endif