1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/apps/opencs/editor.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

122 lines
3.0 KiB
C++
Raw Normal View History

2012-11-22 12:30:02 +00:00
#ifndef CS_EDITOR_H
#define CS_EDITOR_H
#include <boost/program_options/variables_map.hpp>
2023-04-24 13:34:06 +00:00
#include <QLockFile>
2012-11-23 13:05:49 +00:00
#include <QObject>
#include <QString>
2022-10-19 17:02:00 +00:00
#include <filesystem>
#include <fstream>
#include <string>
#include <utility>
#include <vector>
#ifndef Q_MOC_RUN
#include <components/files/configurationmanager.hpp>
#endif
#include <components/files/multidircollection.hpp>
2012-11-22 12:30:02 +00:00
#include "model/doc/documentmanager.hpp"
#include "model/prefs/state.hpp"
#include "view/doc/filedialog.hpp"
#include "view/doc/newgame.hpp"
2013-02-02 15:14:58 +00:00
#include "view/doc/startup.hpp"
#include "view/prefs/dialogue.hpp"
#include "view/tools/merge.hpp"
2022-10-09 10:39:43 +00:00
class QLocalServer;
class QLocalSocket;
namespace CSMDoc
{
class Document;
}
2022-10-09 10:39:43 +00:00
namespace CSVDoc
{
class ViewManager;
}
2012-11-22 12:30:02 +00:00
namespace CS
{
2012-11-23 13:05:49 +00:00
class Editor : public QObject
2012-11-22 12:30:02 +00:00
{
2012-11-23 13:05:49 +00:00
Q_OBJECT
2022-09-22 18:26:05 +00:00
Files::ConfigurationManager mCfgMgr;
boost::program_options::variables_map mConfigVariables;
CSMPrefs::State mSettingsState;
2012-11-22 12:30:02 +00:00
CSMDoc::DocumentManager mDocumentManager;
2013-02-02 15:14:58 +00:00
CSVDoc::StartupDialogue mStartup;
CSVDoc::NewGameDialogue mNewGame;
CSVPrefs::Dialogue mSettings;
CSVDoc::FileDialog mFileDialog;
std::filesystem::path mLocal;
std::filesystem::path mResources;
std::filesystem::path mPid;
2023-04-24 13:34:06 +00:00
QLockFile mLockFile;
std::ofstream mPidFile;
CSVTools::Merge mMerge;
CSVDoc::ViewManager* mViewManager;
std::filesystem::path mFileToLoad;
Files::PathContainer mDataDirs;
std::string mEncodingName;
2022-09-22 18:26:05 +00:00
boost::program_options::variables_map readConfiguration();
///< Calls mCfgMgr.readConfiguration; should be used before initialization of mSettingsState as it depends on
///< the configuration.
std::pair<Files::PathContainer, std::vector<std::string>> readConfig(bool quiet = false);
///< \return data paths
2022-09-22 18:26:05 +00:00
2012-11-22 12:30:02 +00:00
// not implemented
Editor(const Editor&);
Editor& operator=(const Editor&);
2022-09-22 18:26:05 +00:00
2012-11-22 12:30:02 +00:00
public:
Editor(int argc, char** argv);
~Editor();
2022-09-22 18:26:05 +00:00
bool makeIPCServer();
void connectToIPCServer();
2022-09-22 18:26:05 +00:00
2012-11-22 12:30:02 +00:00
int run();
///< \return error status
2022-09-22 18:26:05 +00:00
2013-02-02 15:14:58 +00:00
private slots:
2022-09-22 18:26:05 +00:00
void createGame();
void createAddon();
void cancelCreateGame();
void cancelFileDialog();
2022-09-22 18:26:05 +00:00
2013-02-02 15:14:58 +00:00
void loadDocument();
void openFiles(
const std::filesystem::path& path, const std::vector<std::filesystem::path>& discoveredFiles = {});
void createNewFile(const std::filesystem::path& path);
void createNewGame(const std::filesystem::path& file);
2022-09-22 18:26:05 +00:00
void showStartup();
2022-09-22 18:26:05 +00:00
void showSettings();
2022-09-22 18:26:05 +00:00
void documentAdded(CSMDoc::Document* document);
2022-09-22 18:26:05 +00:00
void documentAboutToBeRemoved(CSMDoc::Document* document);
2022-09-22 18:26:05 +00:00
void lastDocumentDeleted();
2022-09-22 18:26:05 +00:00
void mergeDocument(CSMDoc::Document* document);
2022-09-22 18:26:05 +00:00
private:
QString mIpcServerName;
QLocalServer* mServer;
QLocalSocket* mClientSocket;
2012-11-22 12:30:02 +00:00
};
}
#endif