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 <memory>
5 
6 #include <boost/interprocess/sync/file_lock.hpp>
7 #include <boost/filesystem/fstream.hpp>
8 
9 #include <QObject>
10 #include <QString>
11 #include <QLocalServer>
12 #include <QLocalSocket>
13 
14 #ifndef Q_MOC_RUN
16 #endif
17 
19 
21 
22 #include "model/prefs/state.hpp"
23 
24 #include "view/doc/viewmanager.hpp"
25 #include "view/doc/startup.hpp"
26 #include "view/doc/filedialog.hpp"
27 #include "view/doc/newgame.hpp"
28 
29 #include "view/prefs/dialogue.hpp"
30 
31 #include "view/tools/merge.hpp"
32 
33 namespace VFS
34 {
35  class Manager;
36 }
37 
38 namespace CSMDoc
39 {
40  class Document;
41 }
42 
43 namespace CS
44 {
45  class Editor : public QObject
46  {
47  Q_OBJECT
48 
49  // FIXME: should be moved to document, so we can have different resources for each opened project
50  std::auto_ptr<VFS::Manager> mVFS;
51 
60  boost::filesystem::path mLocal;
61  boost::filesystem::path mResources;
62  boost::filesystem::path mPid;
63  boost::interprocess::file_lock mLock;
64  boost::filesystem::ofstream mPidFile;
65  bool mFsStrict;
67 
68  void setupDataFiles (const Files::PathContainer& dataDirs);
69 
70  std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
72 
73  // not implemented
74  Editor (const Editor&);
75  Editor& operator= (const Editor&);
76 
77  public:
78 
79  Editor ();
80  ~Editor ();
81 
82  bool makeIPCServer();
83  void connectToIPCServer();
84 
85  int run();
87 
88  private slots:
89 
90  void createGame();
91  void createAddon();
92  void cancelCreateGame();
93  void cancelFileDialog();
94 
95  void loadDocument();
96  void openFiles (const boost::filesystem::path &path);
97  void createNewFile (const boost::filesystem::path& path);
98  void createNewGame (const boost::filesystem::path& file);
99 
100  void showStartup();
101 
102  void showSettings();
103 
104  void documentAdded (CSMDoc::Document *document);
105 
107 
108  void lastDocumentDeleted();
109 
110  void mergeDocument (CSMDoc::Document *document);
111 
112  private:
113 
114  QString mIpcServerName;
115  QLocalServer *mServer;
116  QLocalSocket *mClientSocket;
117  };
118 }
119 
120 #endif
void documentAboutToBeRemoved(CSMDoc::Document *document)
Definition: editor.cpp:372
boost::filesystem::ofstream mPidFile
Definition: editor.hpp:64
void mergeDocument(CSMDoc::Document *document)
Definition: editor.cpp:383
Definition: filedialog.hpp:26
Definition: viewmanager.hpp:30
void showSettings()
Definition: editor.cpp:277
void openFiles(const boost::filesystem::path &path)
Definition: editor.cpp:231
void lastDocumentDeleted()
Definition: editor.cpp:378
Definition: startup.hpp:14
boost::interprocess::file_lock mLock
Definition: editor.hpp:63
Definition: dialogue.hpp:15
void cancelFileDialog()
Definition: editor.cpp:206
boost::filesystem::path mResources
Definition: editor.hpp:61
CSMDoc::DocumentManager mDocumentManager
Definition: editor.hpp:54
void connectToIPCServer()
Definition: editor.cpp:348
Definition: newgame.hpp:21
Files::ConfigurationManager mCfgMgr
Definition: editor.hpp:52
Definition: configurationmanager.hpp:20
CSVDoc::ViewManager mViewManager
Definition: editor.hpp:55
QLocalServer * mServer
Definition: editor.hpp:115
Editor()
Definition: editor.cpp:24
void loadDocument()
Definition: editor.cpp:220
Definition: documentmanager.hpp:33
CSVDoc::NewGameDialogue mNewGame
Definition: editor.hpp:57
void setupDataFiles(const Files::PathContainer &dataDirs)
Definition: editor.cpp:85
void cancelCreateGame()
Definition: editor.cpp:181
void createGame()
Definition: editor.cpp:170
Editor & operator=(const Editor &)
~Editor()
Definition: editor.cpp:76
bool makeIPCServer()
Definition: editor.cpp:287
void documentAdded(CSMDoc::Document *document)
Definition: editor.cpp:367
CSVTools::Merge mMerge
Definition: editor.hpp:66
CSVPrefs::Dialogue mSettings
Definition: editor.hpp:58
void createNewGame(const boost::filesystem::path &file)
Definition: editor.cpp:258
User settings state.
Definition: state.hpp:36
bool mFsStrict
Definition: editor.hpp:65
QString mIpcServerName
Definition: editor.hpp:114
int run()
Definition: editor.cpp:355
Definition: merge.hpp:25
std::auto_ptr< VFS::Manager > mVFS
Definition: editor.hpp:50
Definition: document.hpp:57
void createNewFile(const boost::filesystem::path &path)
Definition: editor.cpp:243
Definition: editor.hpp:45
boost::filesystem::path mPid
Definition: editor.hpp:62
std::pair< Files::PathContainer, std::vector< std::string > > readConfig(bool quiet=false)
Definition: editor.cpp:94
CSMPrefs::State mSettingsState
Definition: editor.hpp:53
void createAddon()
Definition: editor.cpp:195
boost::filesystem::path mLocal
Definition: editor.hpp:60
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
CSVDoc::StartupDialogue mStartup
Definition: editor.hpp:56
CSVDoc::FileDialog mFileDialog
Definition: editor.hpp:59
void showStartup()
Definition: editor.cpp:269
std::vector< boost::filesystem::path > PathContainer
Definition: gamesettings.hpp:14
QLocalSocket * mClientSocket
Definition: editor.hpp:116