QtNovelUI/WordsIDE/appcore.h

84 lines
1.8 KiB
C
Raw Normal View History

2022-11-18 23:47:32 +00:00
#ifndef APPCORE_H
#define APPCORE_H
#include <QObject>
#include <libConfig.h>
#include <libParse.h>
#include <libProjectManager.h>
class MainWindow;
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-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
*/
class AppCore : public QObject
{
public:
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
*/
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-02-26 14:44:00 +00:00
QList<MakeTools::ContentPresent*> extensions(const QString &suffix = QString()) const;
2022-12-31 13:05:58 +00:00
MakeTools::StoryTool *getMakeCore() const;
2022-12-31 13:05:58 +00:00
MakeTools::DocsManager *getDocsManager() const;
private:
2022-11-29 03:47:12 +00:00
MainWindow *const views_holder;
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