OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
editor.hpp
Go to the documentation of this file.
1 #ifndef CS_EDITOR_H
2 #define CS_EDITOR_H
3 
4 #include <boost/interprocess/sync/file_lock.hpp>
5 #include <boost/filesystem/fstream.hpp>
6 
7 #include <QObject>
8 #include <QString>
9 #include <QLocalServer>
10 #include <QLocalSocket>
11 
12 #ifndef Q_MOC_RUN
14 #endif
15 
17 
19 
20 #include "model/prefs/state.hpp"
21 
22 #include "view/doc/viewmanager.hpp"
23 #include "view/doc/startup.hpp"
24 #include "view/doc/filedialog.hpp"
25 #include "view/doc/newgame.hpp"
26 
27 #include "view/prefs/dialogue.hpp"
28 
29 #include "view/tools/merge.hpp"
30 
31 namespace CSMDoc
32 {
33  class Document;
34 }
35 
36 namespace CS
37 {
38  class Editor : public QObject
39  {
40  Q_OBJECT
41 
50  boost::filesystem::path mLocal;
51  boost::filesystem::path mResources;
52  boost::filesystem::path mPid;
53  boost::interprocess::file_lock mLock;
54  boost::filesystem::ofstream mPidFile;
55  bool mFsStrict;
57 
58  void setupDataFiles (const Files::PathContainer& dataDirs);
59 
60  std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
62 
63  // not implemented
64  Editor (const Editor&);
65  Editor& operator= (const Editor&);
66 
67  public:
68 
69  Editor (int argc, char **argv);
70  ~Editor ();
71 
72  bool makeIPCServer();
73  void connectToIPCServer();
74 
75  int run();
77 
78  private slots:
79 
80  void createGame();
81  void createAddon();
82  void cancelCreateGame();
83  void cancelFileDialog();
84 
85  void loadDocument();
86  void openFiles (const boost::filesystem::path &path);
87  void createNewFile (const boost::filesystem::path& path);
88  void createNewGame (const boost::filesystem::path& file);
89 
90  void showStartup();
91 
92  void showSettings();
93 
94  void documentAdded (CSMDoc::Document *document);
95 
97 
98  void lastDocumentDeleted();
99 
100  void mergeDocument (CSMDoc::Document *document);
101 
102  private:
103 
104  QString mIpcServerName;
105  QLocalServer *mServer;
106  QLocalSocket *mClientSocket;
107  };
108 }
109 
110 #endif
void documentAboutToBeRemoved(CSMDoc::Document *document)
Definition: editor.cpp:370
boost::filesystem::ofstream mPidFile
Definition: editor.hpp:54
void mergeDocument(CSMDoc::Document *document)
Definition: editor.cpp:381
Definition: filedialog.hpp:26
Definition: viewmanager.hpp:30
void showSettings()
Definition: editor.cpp:275
void openFiles(const boost::filesystem::path &path)
Definition: editor.cpp:229
void lastDocumentDeleted()
Definition: editor.cpp:376
Definition: startup.hpp:14
boost::interprocess::file_lock mLock
Definition: editor.hpp:53
Definition: dialogue.hpp:15
void cancelFileDialog()
Definition: editor.cpp:204
boost::filesystem::path mResources
Definition: editor.hpp:51
CSMDoc::DocumentManager mDocumentManager
Definition: editor.hpp:44
void connectToIPCServer()
Definition: editor.cpp:346
Definition: newgame.hpp:21
Files::ConfigurationManager mCfgMgr
Definition: editor.hpp:42
Definition: configurationmanager.hpp:20
CSVDoc::ViewManager mViewManager
Definition: editor.hpp:45
QLocalServer * mServer
Definition: editor.hpp:105
void loadDocument()
Definition: editor.cpp:218
Definition: documentmanager.hpp:32
CSVDoc::NewGameDialogue mNewGame
Definition: editor.hpp:47
void setupDataFiles(const Files::PathContainer &dataDirs)
Definition: editor.cpp:78
void cancelCreateGame()
Definition: editor.cpp:179
void createGame()
Definition: editor.cpp:168
Editor & operator=(const Editor &)
~Editor()
Definition: editor.cpp:69
bool makeIPCServer()
Definition: editor.cpp:285
void documentAdded(CSMDoc::Document *document)
Definition: editor.cpp:365
CSVTools::Merge mMerge
Definition: editor.hpp:56
CSVPrefs::Dialogue mSettings
Definition: editor.hpp:48
void createNewGame(const boost::filesystem::path &file)
Definition: editor.cpp:256
User settings state.
Definition: state.hpp:36
bool mFsStrict
Definition: editor.hpp:55
QString mIpcServerName
Definition: editor.hpp:104
int run()
Definition: editor.cpp:353
Definition: merge.hpp:25
Definition: document.hpp:57
void createNewFile(const boost::filesystem::path &path)
Definition: editor.cpp:241
Definition: editor.hpp:38
boost::filesystem::path mPid
Definition: editor.hpp:52
Editor(const Editor &)
std::pair< Files::PathContainer, std::vector< std::string > > readConfig(bool quiet=false)
Definition: editor.cpp:87
CSMPrefs::State mSettingsState
Definition: editor.hpp:43
void createAddon()
Definition: editor.cpp:193
boost::filesystem::path mLocal
Definition: editor.hpp:50
CSVDoc::StartupDialogue mStartup
Definition: editor.hpp:46
CSVDoc::FileDialog mFileDialog
Definition: editor.hpp:49
void showStartup()
Definition: editor.cpp:267
std::vector< boost::filesystem::path > PathContainer
Definition: gamesettings.hpp:14
QLocalSocket * mClientSocket
Definition: editor.hpp:106