QtNovelUI/WordsIDE/storychain_sourceeditor.h

63 lines
2.1 KiB
C
Raw Normal View History

2023-02-26 16:22:44 +00:00
#ifndef STORYCHAIN_SOURCEEDITOR_H
#define STORYCHAIN_SOURCEEDITOR_H
2022-11-17 08:26:05 +00:00
#include "ContentPresent.h"
2023-02-26 16:22:44 +00:00
#include "DocsManager.h"
#include "default_textpresent.h"
#include "keywordshightlighter.h"
2022-11-17 08:26:05 +00:00
2023-02-26 16:22:44 +00:00
#include <QObject>
#include <QSyntaxHighlighter>
2022-11-17 08:26:05 +00:00
namespace Components {
2023-02-26 14:44:00 +00:00
/**
2023-02-26 16:22:44 +00:00
* @brief Storychain源码编辑器
2023-02-26 14:44:00 +00:00
*/
2023-02-26 16:22:44 +00:00
class StorychainSourceEdit : public Presents::ModeView,
public MakeTools::ContentPresent, public Enhancement::HighlightDemand
2022-11-18 23:47:32 +00:00
{
public:
2023-02-26 16:22:44 +00:00
StorychainSourceEdit();
virtual ~StorychainSourceEdit() = default;
private:
QSyntaxHighlighter *const highter_ins;
Parse::Result::DocCore *core_ins;
Core::AppCore *app_core;
QTextEdit *edit_square;
QString name_store;
QString filepath_store;
// HighlightDemand interface
public:
virtual void contexBind(Core::AppCore *app, Parse::Result::DocCore *core) override;
virtual void reHighlighter() const override;
2022-11-17 08:26:05 +00:00
// ModeView interface
public:
virtual void modeReset(const QString &) const override;
virtual QList<QString> modes() const override;
virtual QString currentMode() const override;
2023-02-26 14:44:00 +00:00
// ContentPresent interface
public:
2023-02-26 16:22:44 +00:00
virtual QList<QString> suffixes() const override;
2023-02-26 14:44:00 +00:00
virtual std::tuple<bool, QString> create(const QDir &target, const QString &name, const QString &suffix) override;
virtual MakeTools::ContentPresent *newInst() const override;
2023-02-26 16:22:44 +00:00
virtual QWidget *widget() const override;
2023-02-26 14:44:00 +00:00
virtual void applySetting(const QString &name, Core::AppCore *core) override;
virtual QString name() const override;
virtual void load(const QFileInfo &target_file) override;
virtual void saveAs(const QString &path) override;
virtual QString targetPath(const QDir &base) const override;
virtual QString absulateTargetPath() const override;
2023-02-26 16:22:44 +00:00
virtual QString getText() const override;
virtual bool isModified() const override;
2023-02-26 14:44:00 +00:00
virtual void jumpTo(const QList<QString> &path) override;
2022-11-17 08:26:05 +00:00
};
}
2023-02-26 16:22:44 +00:00
#endif // STORYCHAIN_SOURCEEDITOR_H