99 lines
2.2 KiB
C++
99 lines
2.2 KiB
C++
#ifndef APPCORE_H
|
|
#define APPCORE_H
|
|
|
|
#include <QObject>
|
|
#include <libConfig.h>
|
|
#include <libParse.h>
|
|
#include <libProjectManager.h>
|
|
#include <commandsdispatcher.h>
|
|
|
|
class MainWindow;
|
|
|
|
namespace Enhancement {
|
|
class HighlightFeature;
|
|
}
|
|
|
|
namespace MakeTools {
|
|
class StoryTool;
|
|
class DocsManager;
|
|
class ContentPresent;
|
|
}
|
|
|
|
class SimpleException : public std::exception
|
|
{
|
|
public:
|
|
explicit SimpleException(const QString &msg);
|
|
|
|
private:
|
|
QString msg_store;
|
|
|
|
// exception interface
|
|
public:
|
|
virtual const char *what() const override;
|
|
};
|
|
|
|
namespace Core {
|
|
class Extension;
|
|
class AppCore;
|
|
|
|
enum class Scale
|
|
{
|
|
Global,
|
|
Project,
|
|
File,
|
|
};
|
|
|
|
/**
|
|
* @brief 软件内核类型
|
|
*/
|
|
class AppCore : public QObject, public Schedule::AccessibleObject
|
|
{
|
|
public:
|
|
AppCore(MainWindow *win, QObject *parent = nullptr);
|
|
virtual ~AppCore() = default;
|
|
|
|
void registerHighlightType(Enhancement::HighlightFeature *base_type);
|
|
bool isHighlightDemand(void* ins) const;
|
|
|
|
QList<MakeTools::ContentPresent*> allViews() const;
|
|
|
|
/**
|
|
* @brief 全局保存操作
|
|
*/
|
|
void save();
|
|
|
|
/**
|
|
* @brief 全局配置端口
|
|
* @return
|
|
*/
|
|
Config::Configration * globalConfig() const;
|
|
|
|
void setCurrentProject(Project::ProjectManager *project);
|
|
Project::ProjectManager* currentProject() const;
|
|
QList<Config::Configration*> getConfigs(QList<Scale> types) const;
|
|
Parse::Result::ParseCore * parseCore() const;
|
|
|
|
QList<MakeTools::ContentPresent*> extensions(const QString &suffix = QString()) const;
|
|
|
|
MakeTools::StoryTool *getMakeCore() const;
|
|
|
|
private:
|
|
MainWindow *const views_holder;
|
|
Config::Configration *const global_config;
|
|
Project::ProjectManager * current_project;
|
|
QList<MakeTools::ContentPresent*> present_types;
|
|
QList<Enhancement::HighlightFeature*> render_types;
|
|
|
|
|
|
MakeTools::StoryTool *const makes_core;
|
|
// MakeTools::DocsManager *const docs_manager;
|
|
|
|
// AccessibleObject interface
|
|
public:
|
|
virtual QString name() const override;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // APPCORE_H
|