2022-11-18 23:47:32 +00:00
|
|
|
#ifndef APPCORE_H
|
|
|
|
#define APPCORE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <libConfig.h>
|
2022-11-22 03:42:48 +00:00
|
|
|
#include <libParse.h>
|
|
|
|
#include <libProjectManager.h>
|
|
|
|
|
2022-11-22 04:00:53 +00:00
|
|
|
class MainWindow;
|
2022-11-22 03:42:48 +00:00
|
|
|
namespace MakeTools {
|
|
|
|
class StoryTool;
|
2022-12-31 13:05:58 +00:00
|
|
|
class DocsManager;
|
2023-02-26 14:44:00 +00:00
|
|
|
class ContentPresent;
|
2022-11-22 03:42:48 +00:00
|
|
|
}
|
2022-11-18 23:47:32 +00:00
|
|
|
|
2023-02-26 16:22:44 +00:00
|
|
|
class SimpleException : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SimpleException(const QString &msg);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString msg_store;
|
|
|
|
|
|
|
|
// exception interface
|
|
|
|
public:
|
|
|
|
virtual const char *what() const override;
|
|
|
|
};
|
|
|
|
|
2022-11-18 23:47:32 +00:00
|
|
|
namespace Core {
|
2022-11-25 01:18:54 +00:00
|
|
|
class Extension;
|
2022-11-22 03:42:48 +00:00
|
|
|
class AppCore;
|
2022-11-18 23:47:32 +00:00
|
|
|
|
|
|
|
enum class Scale
|
|
|
|
{
|
|
|
|
Global,
|
|
|
|
Project,
|
|
|
|
File,
|
|
|
|
};
|
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
/**
|
|
|
|
* @brief 软件内核类型
|
|
|
|
*/
|
2022-11-22 03:42:48 +00:00
|
|
|
class AppCore : public QObject
|
|
|
|
{
|
|
|
|
public:
|
2022-11-22 04:00:53 +00:00
|
|
|
AppCore(MainWindow *win, QObject *parent = nullptr);
|
2022-11-18 23:47:32 +00:00
|
|
|
virtual ~AppCore() = default;
|
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
/**
|
|
|
|
* @brief 全局保存操作
|
|
|
|
*/
|
2022-11-22 03:42:48 +00:00
|
|
|
void save();
|
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
/**
|
|
|
|
* @brief 全局配置端口
|
|
|
|
* @return
|
|
|
|
*/
|
2022-11-22 03:42:48 +00:00
|
|
|
Config::Configration * globalConfig() const;
|
|
|
|
|
|
|
|
void setCurrentProject(Project::ProjectManager *project);
|
|
|
|
Project::ProjectManager* currentProject() const;
|
2022-11-18 23:47:32 +00:00
|
|
|
QList<Config::Configration*> getConfigs(QList<Scale> types) const;
|
2022-11-22 03:42:48 +00:00
|
|
|
Parse::Result::ParseCore * parseCore() const;
|
|
|
|
|
2023-02-26 14:44:00 +00:00
|
|
|
QList<MakeTools::ContentPresent*> extensions(const QString &suffix = QString()) const;
|
2022-11-22 03:42:48 +00:00
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
MakeTools::StoryTool *getMakeCore() const;
|
2022-11-22 04:00:53 +00:00
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
MakeTools::DocsManager *getDocsManager() const;
|
2022-11-22 04:00:53 +00:00
|
|
|
|
2022-11-22 03:42:48 +00:00
|
|
|
private:
|
2022-11-29 03:47:12 +00:00
|
|
|
MainWindow *const views_holder;
|
2022-11-22 03:42:48 +00:00
|
|
|
Config::Configration *const global_config;
|
|
|
|
Project::ProjectManager * current_project;
|
2023-02-26 14:44:00 +00:00
|
|
|
QList<MakeTools::ContentPresent*> extensions_list;
|
2022-11-18 23:47:32 +00:00
|
|
|
|
2022-12-31 13:05:58 +00:00
|
|
|
MakeTools::StoryTool *const makes_core;
|
|
|
|
MakeTools::DocsManager *const docs_manager;
|
2022-11-18 23:47:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // APPCORE_H
|