2012-11-22 13:30:02 +01:00
|
|
|
#ifndef CS_EDITOR_H
|
|
|
|
#define CS_EDITOR_H
|
|
|
|
|
2014-12-05 01:09:42 +11:00
|
|
|
#include <boost/interprocess/sync/file_lock.hpp>
|
2014-12-05 07:50:03 +11:00
|
|
|
#include <boost/filesystem/fstream.hpp>
|
2014-12-05 01:09:42 +11:00
|
|
|
|
2012-11-23 14:05:49 +01:00
|
|
|
#include <QObject>
|
2013-09-03 04:12:19 -05:00
|
|
|
#include <QString>
|
2013-09-03 01:44:21 -05:00
|
|
|
#include <QLocalServer>
|
2013-09-03 04:12:19 -05:00
|
|
|
#include <QLocalSocket>
|
2013-09-03 01:44:21 -05:00
|
|
|
|
2013-03-31 18:00:46 +02:00
|
|
|
#ifndef Q_MOC_RUN
|
2013-03-07 03:00:59 +01:00
|
|
|
#include <components/files/configurationmanager.hpp>
|
2013-03-31 18:00:46 +02:00
|
|
|
#endif
|
2013-09-08 09:26:43 +02:00
|
|
|
|
2014-02-25 11:58:32 +01:00
|
|
|
#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
|
|
|
|
2015-12-06 11:18:31 +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"
|
2013-03-07 03:00:59 +01:00
|
|
|
#include "view/doc/filedialog.hpp"
|
2013-09-08 12:06:28 +02:00
|
|
|
#include "view/doc/newgame.hpp"
|
2013-09-08 09:26:43 +02:00
|
|
|
|
2015-12-06 11:18:31 +01:00
|
|
|
#include "view/prefs/dialogue.hpp"
|
|
|
|
|
2015-08-06 12:52:10 +02:00
|
|
|
#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
|
|
|
|
|
2013-09-27 11:36:06 +02:00
|
|
|
Files::ConfigurationManager mCfgMgr;
|
2015-12-06 11:18:31 +01:00
|
|
|
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;
|
2013-09-08 12:06:28 +02:00
|
|
|
CSVDoc::NewGameDialogue mNewGame;
|
2015-12-06 11:18:31 +01:00
|
|
|
CSVPrefs::Dialogue mSettings;
|
2013-08-18 15:11:29 -05:00
|
|
|
CSVDoc::FileDialog mFileDialog;
|
2013-09-08 14:31:20 +02:00
|
|
|
boost::filesystem::path mLocal;
|
2014-03-16 12:44:01 +01:00
|
|
|
boost::filesystem::path mResources;
|
2014-12-05 01:09:42 +11:00
|
|
|
boost::filesystem::path mPid;
|
|
|
|
boost::interprocess::file_lock mLock;
|
2014-12-05 07:50:03 +11:00
|
|
|
boost::filesystem::ofstream mPidFile;
|
2014-03-09 12:32:21 +01:00
|
|
|
bool mFsStrict;
|
2015-08-06 12:52:10 +02:00
|
|
|
CSVTools::Merge mMerge;
|
2013-09-08 14:31:20 +02:00
|
|
|
|
2014-02-25 11:58:32 +01:00
|
|
|
void setupDataFiles (const Files::PathContainer& dataDirs);
|
|
|
|
|
2015-06-16 12:48:45 +10:00
|
|
|
std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
|
2014-02-25 11:58:32 +01:00
|
|
|
///< \return data paths
|
2012-11-22 13:30:02 +01:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
Editor (const Editor&);
|
|
|
|
Editor& operator= (const Editor&);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2018-07-05 22:55:19 +02:00
|
|
|
Editor (int argc, char **argv);
|
2014-10-15 07:02:19 +11:00
|
|
|
~Editor ();
|
2012-11-22 13:30:02 +01:00
|
|
|
|
2013-09-03 01:44:21 -05:00
|
|
|
bool makeIPCServer();
|
2013-09-03 04:12:19 -05:00
|
|
|
void connectToIPCServer();
|
2013-09-03 01:44:21 -05:00
|
|
|
|
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
|
|
|
|
2013-09-08 12:06:28 +02:00
|
|
|
void createGame();
|
|
|
|
void createAddon();
|
2015-05-30 08:37:58 +10:00
|
|
|
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);
|
2013-09-03 01:44:21 -05:00
|
|
|
|
2013-09-03 04:12:19 -05:00
|
|
|
void showStartup();
|
|
|
|
|
2013-09-08 09:26:43 +02:00
|
|
|
void showSettings();
|
|
|
|
|
2014-04-21 09:02:58 +02:00
|
|
|
void documentAdded (CSMDoc::Document *document);
|
|
|
|
|
2015-08-06 12:52:10 +02:00
|
|
|
void documentAboutToBeRemoved (CSMDoc::Document *document);
|
|
|
|
|
2014-04-26 13:11:27 +02:00
|
|
|
void lastDocumentDeleted();
|
|
|
|
|
2015-08-06 12:52:10 +02:00
|
|
|
void mergeDocument (CSMDoc::Document *document);
|
|
|
|
|
2013-09-03 01:44:21 -05:00
|
|
|
private:
|
|
|
|
|
2013-09-03 05:22:48 -05:00
|
|
|
QString mIpcServerName;
|
|
|
|
QLocalServer *mServer;
|
|
|
|
QLocalSocket *mClientSocket;
|
2012-11-22 13:30:02 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-03-07 03:00:59 +01:00
|
|
|
#endif
|