QtNovelUI/WordsIDE/appcore.h

97 lines
2.1 KiB
C
Raw Normal View History

2022-11-18 23:47:32 +00:00
#ifndef APPCORE_H
#define APPCORE_H
2023-03-17 13:58:38 +00:00
#include <QMenu>
2022-11-18 23:47:32 +00:00
#include <QObject>
2023-03-17 13:58:38 +00:00
#include <commandsdispatcher.h>
2022-11-18 23:47:32 +00:00
#include <libConfig.h>
#include <libParse.h>
#include <libProjectManager.h>
class MainWindow;
namespace Enhancement {
2023-03-01 14:19:13 +00:00
class HighlightFeature;
}
namespace MakeTools {
class StoryTool;
2022-12-31 13:05:58 +00:00
class DocsManager;
2023-03-17 13:58:38 +00:00
class FilePresent;
}
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;
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
*/
2023-03-10 13:01:19 +00:00
class AppCore : public QObject, public Schedule::AccessibleObject
{
2023-03-11 05:55:16 +00:00
public:
2023-03-17 13:58:38 +00:00
AppCore(QObject *parent = nullptr);
2022-11-18 23:47:32 +00:00
virtual ~AppCore() = default;
2023-03-01 14:19:13 +00:00
void registerHighlightType(Enhancement::HighlightFeature *base_type);
bool isHighlightDemand(void* ins) const;
2023-03-17 13:58:38 +00:00
QList<MakeTools::FilePresent *> allViews() const;
2022-12-31 13:05:58 +00:00
/**
* @brief
*/
void save();
2022-12-31 13:05:58 +00:00
/**
* @brief
* @return
*/
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;
Parse::Result::ParseCore * parseCore() const;
2023-03-17 13:58:38 +00:00
QList<MakeTools::FilePresent*> extensions(const QString &suffix = QString()) const;
2022-12-31 13:05:58 +00:00
MakeTools::StoryTool *getMakeCore() const;
2023-03-17 13:58:38 +00:00
private:
Config::Configration *const global_config;
Project::ProjectManager * current_project;
2023-03-17 13:58:38 +00:00
QList<MakeTools::FilePresent*> present_types;
QList<Enhancement::HighlightFeature *> render_types;
2022-11-18 23:47:32 +00:00
2022-12-31 13:05:58 +00:00
MakeTools::StoryTool *const makes_core;
2023-03-10 13:01:19 +00:00
// AccessibleObject interface
public:
virtual QString name() const override;
2022-11-18 23:47:32 +00:00
};
}
#endif // APPCORE_H