From 945ecdc7fc63488fbc114c2f3036c10b82fee5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E5=AE=87=E6=B8=85=E9=9F=B3?= <2422523675@qq.com> Date: Mon, 27 Feb 2023 00:22:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9StorychainSourceEdit=E6=94=B9=E9=80=A0?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtNovelDesc.pro.user | 87 ++++++++- WordsIDE/DocsManager.cpp | 15 -- WordsIDE/WordsIDE.pro | 8 +- WordsIDE/appcore.cpp | 11 +- WordsIDE/appcore.h | 14 +- WordsIDE/contentpresenttest.cpp | 3 + ...ceEditView.cpp => default_textpresent.cpp} | 4 +- ...SourceEditView.h => default_textpresent.h} | 8 +- WordsIDE/keywordshightlighter.h | 14 +- WordsIDE/main.cpp | 6 +- WordsIDE/mainwindow.cpp | 4 +- WordsIDE/sourcecodeeditor.h | 2 +- WordsIDE/storyboardsourceedit.h | 2 +- WordsIDE/storychain_sourceeditor.cpp | 177 +++++++++++++++++ WordsIDE/storychain_sourceeditor.h | 62 ++++++ WordsIDE/storychainsourceeditor.cpp | 178 ------------------ WordsIDE/storychainsourceeditor.h | 72 ------- WordsIDE/storyunitsourceedit.h | 2 +- WordsIDE/storyvolumesourceedit.h | 2 +- 19 files changed, 377 insertions(+), 294 deletions(-) rename WordsIDE/{SourceEditView.cpp => default_textpresent.cpp} (97%) rename WordsIDE/{SourceEditView.h => default_textpresent.h} (92%) create mode 100644 WordsIDE/storychain_sourceeditor.cpp create mode 100644 WordsIDE/storychain_sourceeditor.h delete mode 100644 WordsIDE/storychainsourceeditor.cpp delete mode 100644 WordsIDE/storychainsourceeditor.h diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index 2ff4074..e11b17b 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -97,9 +97,9 @@ Desktop Qt 5.12.11 MSVC2017 64bit Desktop Qt 5.12.11 MSVC2017 64bit qt.qt5.51211.win64_msvc2017_64_kit - 0 + 3 0 - 2 + 3 0 D:\Projects\Cpp\build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug @@ -344,7 +344,7 @@ true false true - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/DesParser + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2/DesParser dwarf @@ -417,7 +417,7 @@ true false true - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/Testpad + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2/Testpad dwarf @@ -490,9 +490,82 @@ true false true - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/CoreTest + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2/CoreTest - 3 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + + 25 + + 1 + true + false + true + + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro + D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro + false + true + true + false + true + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2/WordsIDE + + 4 diff --git a/WordsIDE/DocsManager.cpp b/WordsIDE/DocsManager.cpp index ee32d8a..3ab1392 100644 --- a/WordsIDE/DocsManager.cpp +++ b/WordsIDE/DocsManager.cpp @@ -9,21 +9,6 @@ using namespace MakeTools; using namespace Core; -class SimpleException : public std::exception -{ -public: - explicit SimpleException(const QString &msg) - : msg_store(msg) {} - -private: - QString msg_store; - - // exception interface -public: - virtual const char *what() const override{ - return msg_store.toLocal8Bit(); - } -}; DocsManager::DocsManager(StoryTool *tool, AppCore *host, MainWindow *views) : host_core(host), views_holder(views), make_core(tool) diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index ee9e97f..23f6abf 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -20,9 +20,9 @@ msvc { SOURCES += \ ContentPresent.cpp \ DocsManager.cpp \ - SourceEditView.cpp \ appcore.cpp \ contentpresenttest.cpp \ + default_textpresent.cpp \ fragmentsorderview.cpp \ keywordshightlighter.cpp \ main.cpp \ @@ -31,7 +31,7 @@ SOURCES += \ sourcecodeeditor.cpp \ storyboardsourceedit.cpp \ storyboardspresent.cpp \ - storychainsourceeditor.cpp \ + storychain_sourceeditor.cpp \ storychainspresent.cpp \ storyconceptspresent.cpp \ storyunitsourceedit.cpp \ @@ -44,9 +44,9 @@ SOURCES += \ HEADERS += \ ContentPresent.h \ DocsManager.h \ - SourceEditView.h \ appcore.h \ contentpresenttest.h \ + default_textpresent.h \ fragmentsorderview.h \ keywordshightlighter.h \ mainwindow.h \ @@ -55,7 +55,7 @@ HEADERS += \ sourcecodeeditor.h \ storyboardsourceedit.h \ storyboardspresent.h \ - storychainsourceeditor.h \ + storychain_sourceeditor.h \ storychainspresent.h \ storyconceptspresent.h \ storyunitsourceedit.h \ diff --git a/WordsIDE/appcore.cpp b/WordsIDE/appcore.cpp index 03049bb..612896b 100644 --- a/WordsIDE/appcore.cpp +++ b/WordsIDE/appcore.cpp @@ -1,6 +1,6 @@ #include "appcore.h" #include "xmlconfig.h" -#include "storychainsourceeditor.h" +#include "storychain_sourceeditor.h" #include "storyunitsourceedit.h" #include "storyboardsourceedit.h" #include "storyvolumesourceedit.h" @@ -25,7 +25,7 @@ AppCore::AppCore(MainWindow *win, QObject *parent) docs_manager(new DocsManager(makes_core, this, win)) { global_config->loadFile(QDir(QApplication::applicationDirPath()).filePath(".software.xml")); - extensions_list //<< new StoryChainSourceEditFactory() + extensions_list << new StorychainSourceEdit() //<< new StoryUnitSourceEditFactory //<< new StoryBoardSourceEditFactory() //<< new StoryVolumeSourceEditFactory() @@ -101,3 +101,10 @@ MakeTools::DocsManager *AppCore::getDocsManager() const + +SimpleException::SimpleException(const QString &msg) + : msg_store(msg) {} + +const char *SimpleException::what() const{ + return msg_store.toLocal8Bit(); +} diff --git a/WordsIDE/appcore.h b/WordsIDE/appcore.h index be01b63..2d151ca 100644 --- a/WordsIDE/appcore.h +++ b/WordsIDE/appcore.h @@ -7,13 +7,25 @@ #include class MainWindow; - 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; diff --git a/WordsIDE/contentpresenttest.cpp b/WordsIDE/contentpresenttest.cpp index 426e051..02c8b33 100644 --- a/WordsIDE/contentpresenttest.cpp +++ b/WordsIDE/contentpresenttest.cpp @@ -36,6 +36,9 @@ void ContentPresentTest::test_Create_Load_SaveAs() { QDir curr("./"); for(auto &s : inst->suffixes()){ + if(s == "*") + continue; + auto files = curr.entryInfoList(QStringList() << s, QDir::Files); for(auto &x:files) curr.remove(x.fileName()); diff --git a/WordsIDE/SourceEditView.cpp b/WordsIDE/default_textpresent.cpp similarity index 97% rename from WordsIDE/SourceEditView.cpp rename to WordsIDE/default_textpresent.cpp index 9b4565b..6de3f62 100644 --- a/WordsIDE/SourceEditView.cpp +++ b/WordsIDE/default_textpresent.cpp @@ -1,4 +1,4 @@ -#include "SourceEditView.h" +#include "default_textpresent.h" #include "keywordshightlighter.h" #include #include @@ -14,7 +14,7 @@ using namespace Core; - DefaultTextPresent:: DefaultTextPresent() +DefaultTextPresent:: DefaultTextPresent() :edit_square(new QTextEdit){} diff --git a/WordsIDE/SourceEditView.h b/WordsIDE/default_textpresent.h similarity index 92% rename from WordsIDE/SourceEditView.h rename to WordsIDE/default_textpresent.h index 23c0b4f..7f7ef58 100644 --- a/WordsIDE/SourceEditView.h +++ b/WordsIDE/default_textpresent.h @@ -1,5 +1,5 @@ -#ifndef SOURCEEDITVIEW_H -#define SOURCEEDITVIEW_H +#ifndef DEFAULT_TEXTPRESENT_H +#define DEFAULT_TEXTPRESENT_H #include "DocsManager.h" #include "ContentPresent.h" @@ -11,7 +11,7 @@ namespace Components { /** - * @brief 默认文本编辑视图 + * @brief Text和默认文本编辑视图 */ class DefaultTextPresent : public MakeTools::ContentPresent, public Presents::ModeView { @@ -51,4 +51,4 @@ namespace Components { } -#endif // SOURCEEDITVIEW_H +#endif // DEFAULT_TEXTPRESENT_H diff --git a/WordsIDE/keywordshightlighter.h b/WordsIDE/keywordshightlighter.h index 21a200f..7fae5b2 100644 --- a/WordsIDE/keywordshightlighter.h +++ b/WordsIDE/keywordshightlighter.h @@ -5,9 +5,20 @@ #include #include - +namespace Core { + class AppCore; +} namespace Enhancement { + class HighlightDemand + { + public: + virtual ~HighlightDemand() = default; + + virtual void contexBind(Core::AppCore *app, Parse::Result::DocCore *core) = 0; + virtual void reHighlighter() const = 0; + }; + /** * @brief 词语语法高亮 */ @@ -15,6 +26,7 @@ namespace Enhancement { { public: KeywordsHightlighter(QObject *parent = nullptr); + void reset(Parse::Result::DocCore *base); private: diff --git a/WordsIDE/main.cpp b/WordsIDE/main.cpp index ad2a7f9..0436eff 100644 --- a/WordsIDE/main.cpp +++ b/WordsIDE/main.cpp @@ -1,7 +1,8 @@ #include "mainwindow.h" #include "xapplication.h" #include "contentpresenttest.h" -#include "SourceEditView.h" +#include "default_textpresent.h" +#include "storychain_sourceeditor.h" #include #include @@ -17,7 +18,8 @@ int main(int argc, char *argv[]) #ifdef UNIT_TEST MakeTools::ContentPresent *array[] = { - new Components::TextContentEdit() + new Components::DefaultTextPresent(), + new Components::StorychainSourceEdit() }; for(auto &it : array){ diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index 0b3f8b1..d7cc0e9 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -1,7 +1,7 @@ -#include "SourceEditView.h" +#include "default_textpresent.h" #include "mainwindow.h" #include "storyboardsourceedit.h" -#include "storychainsourceeditor.h" +#include "storychain_sourceeditor.h" #include "storyunitsourceedit.h" #include "storyvolumesourceedit.h" diff --git a/WordsIDE/sourcecodeeditor.h b/WordsIDE/sourcecodeeditor.h index e3aef42..c0bf823 100644 --- a/WordsIDE/sourcecodeeditor.h +++ b/WordsIDE/sourcecodeeditor.h @@ -1,7 +1,7 @@ #ifndef SOURCECODEEDITOR_H #define SOURCECODEEDITOR_H -#include "SourceEditView.h" +#include "default_textpresent.h" #include "appcore.h" #include diff --git a/WordsIDE/storyboardsourceedit.h b/WordsIDE/storyboardsourceedit.h index 665b119..3798fe4 100644 --- a/WordsIDE/storyboardsourceedit.h +++ b/WordsIDE/storyboardsourceedit.h @@ -1,7 +1,7 @@ #ifndef STORYBOARDSOURCEEDIT_H #define STORYBOARDSOURCEEDIT_H -#include "SourceEditView.h" +#include "default_textpresent.h" namespace Components { diff --git a/WordsIDE/storychain_sourceeditor.cpp b/WordsIDE/storychain_sourceeditor.cpp new file mode 100644 index 0000000..a79da73 --- /dev/null +++ b/WordsIDE/storychain_sourceeditor.cpp @@ -0,0 +1,177 @@ +#include "storychain_sourceeditor.h" +#include "keywordshightlighter.h" +#include +#include +#include +#include +#include + +using namespace Enhancement; +using namespace Parse::Result; +using namespace Core; +using namespace Components; + +StorychainSourceEdit::StorychainSourceEdit() + : highter_ins(new KeywordsHightlighter(this)), edit_square(new QTextEdit) +{ + connect(edit_square, &QTextEdit::textChanged, [this](){ + emit this->dataChanged(filepath_store); + }); + highter_ins->setDocument(edit_square->document()); +} + +void StorychainSourceEdit::contexBind(AppCore *app, Parse::Result::DocCore *core) +{ + core_ins = core; + app_core = app; +} + +void StorychainSourceEdit::reHighlighter() const +{ + highter_ins->rehighlight(); +} + +void StorychainSourceEdit::modeReset(const QString &) const{} + +QList StorychainSourceEdit::modes() const +{ + return QList() << "源码"; +} + +QString StorychainSourceEdit::currentMode() const +{ + return modes()[0]; +} + +QList StorychainSourceEdit::suffixes() const +{ + return QList() << "storychain"; +} + +std::tuple StorychainSourceEdit::create(const QDir &target, const QString &name, const QString &suffix) +{ + auto path = target.filePath(QString("%1.%2").arg(name, suffix)); + if(QFileInfo::exists(path)) + return std::make_tuple(false, path); + + QFile nwf(path); + if(!nwf.open(QIODevice::WriteOnly|QIODevice::Text)) + throw new SimpleException("指定文件"); + + return std::make_tuple(true, target.relativeFilePath(path)); +} + +MakeTools::ContentPresent *StorychainSourceEdit::newInst() const +{ + return new StorychainSourceEdit(); +} + +QWidget *StorychainSourceEdit::widget() const +{ + return edit_square; +} + +void StorychainSourceEdit::applySetting(const QString &name, Core::AppCore *core) +{ + this->name_store = name; +} + +QString StorychainSourceEdit::name() const +{ + return name_store; +} + +void StorychainSourceEdit::load(const QFileInfo &target_file) +{ + if(!target_file.exists()) + throw new SimpleException("参数错误:传入的文件不存在"); + if(!target_file.isFile()) + throw new SimpleException("参数错误:传入参数非文件类型"); + + filepath_store = target_file.absoluteFilePath(); + QFile bin(filepath_store); + if(!bin.open(QIODevice::ReadOnly|QIODevice::Text)) + throw new SimpleException("参数错误:指定的文件无法打开"); + + QTextStream tin(&bin); + tin.setCodec("UTF-8"); + this->edit_square->setText(tin.readAll()); +} + +void StorychainSourceEdit::saveAs(const QString &path) +{ + if(!path.isEmpty()) + filepath_store = path; + + QFile bout(filepath_store); + if(!bout.open(QIODevice::WriteOnly|QIODevice::Text)) + throw new SimpleException("参数错误:指定的文件无法打开"); + + QTextStream tout(&bout); + tout.setCodec("UTF-8"); + tout << this->edit_square->toPlainText(); + tout.flush(); +} + +QString StorychainSourceEdit::targetPath(const QDir &base) const +{ + return base.relativeFilePath(filepath_store); +} + +QString StorychainSourceEdit::absulateTargetPath() const +{ + return filepath_store; +} + +QString StorychainSourceEdit::getText() const +{ + return edit_square->toPlainText(); +} + +bool StorychainSourceEdit::isModified() const +{ + return true; +} + +void StorychainSourceEdit::jumpTo(const QList &path) +{ + auto fpath = this->absulateTargetPath(); + auto core = app_core->parseCore(); + if(path.size()){ + auto storynode = core->queryStoryChain(path[0]).first(); + auto first_word = storynode->refered()[0]; + + auto textblock = this->edit_square->document()->findBlockByNumber(first_word->row()); + auto cur = this->edit_square->textCursor(); + cur.setPosition(textblock.position()); + cur.select(QTextCursor::SelectionType::LineUnderCursor); + this->edit_square->setTextCursor(cur); + + if(path.size() > 1){ + auto storypoint = core->queryStoryPoint(storynode, path[1]).first(); + first_word = storypoint->refered()[0]; + + auto textblock = this->edit_square->document()->findBlockByNumber(first_word->row()); + cur.setPosition(textblock.position()); + cur.select(QTextCursor::SelectionType::LineUnderCursor); + this->edit_square->setTextCursor(cur); + } + } + + this->widget()->setFocus(); +} + + + + + + + + + + + + + + + diff --git a/WordsIDE/storychain_sourceeditor.h b/WordsIDE/storychain_sourceeditor.h new file mode 100644 index 0000000..2052e48 --- /dev/null +++ b/WordsIDE/storychain_sourceeditor.h @@ -0,0 +1,62 @@ +#ifndef STORYCHAIN_SOURCEEDITOR_H +#define STORYCHAIN_SOURCEEDITOR_H + +#include "ContentPresent.h" +#include "DocsManager.h" +#include "default_textpresent.h" +#include "keywordshightlighter.h" + +#include +#include + +namespace Components { + + /** + * @brief Storychain源码编辑器 + */ + class StorychainSourceEdit : public Presents::ModeView, + public MakeTools::ContentPresent, public Enhancement::HighlightDemand + { + public: + 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; + + // ModeView interface + public: + virtual void modeReset(const QString &) const override; + virtual QList modes() const override; + virtual QString currentMode() const override; + + // ContentPresent interface + public: + virtual QList suffixes() const override; + virtual std::tuple create(const QDir &target, const QString &name, const QString &suffix) override; + virtual MakeTools::ContentPresent *newInst() const override; + virtual QWidget *widget() const override; + 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; + virtual QString getText() const override; + virtual bool isModified() const override; + virtual void jumpTo(const QList &path) override; + }; + +} + +#endif // STORYCHAIN_SOURCEEDITOR_H diff --git a/WordsIDE/storychainsourceeditor.cpp b/WordsIDE/storychainsourceeditor.cpp deleted file mode 100644 index 072fa34..0000000 --- a/WordsIDE/storychainsourceeditor.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include "storychainsourceeditor.h" -#include "keywordshightlighter.h" -#include -#include -#include -#include -#include - -using namespace Enhancement; -using namespace Parse::Result; -using namespace Core; -using namespace Components; - -//StoryChainSourceEdit::StoryChainSourceEdit(Core::FileExtensionFactory *factory) -// : highter_ins(new KeywordsHightlighter(this)), doc_ins(nullptr), factory_ins(factory) -//{ - -// highter_ins->setDocument(this->textDocument()); - -// this->setContexMenuProcess([this](QMenu *menu){ -// menu->addSeparator(); -// menu->addAction("刷新", [this](){highter_ins->rehighlight();}); -// }); -//} - -//void StoryChainSourceEdit::modeReset(const QString &) const{} - -//QList StoryChainSourceEdit::modes() const -//{ -// return QList() << "源码"; -//} - -//QString StoryChainSourceEdit::currentMode() const -//{ -// return modes()[0]; -//} - -//QString StoryChainSourceEdit::title() const -//{ -// return doc_ins->filePath(); -//} - -//void StoryChainSourceEdit::initSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent) -//{ -// FormattedTextEdit::initSource(core, src, parent); -// this->doc_ins = core->parseCore()->queryDocument(src); -// this->core_ins = core; -// static_cast(this->highter_ins)->reset(doc_ins); -//} - -//FileExtensionFactory *StoryChainSourceEdit::factory() const -//{ -// return factory_ins; -//} - -//void StoryChainSourceEdit::reloadConfigrations(QList configs) -//{ -// // TODO: 设置格式 -// auto font_family = Config::ConfigHelper::getConfigAsDefaultSequence -// (configs, {"sourcecode_chainedit","default_font","font_family"}, "微软雅黑"); -// auto font_size = Config::ConfigHelper::getConfigAsDefaultSequence( -// configs, {"sourcecode_chainedit","default_font","font_sizept"}, "20"); -// QFont default_font; -// default_font.setFamily(font_family); -// default_font.setPointSize(font_size.toInt()); - -// this->textDocument()->setDefaultFont(default_font); -//} - -//void StoryChainSourceEdit::rehighlighter() -//{ -// this->highter_ins->rehighlight(); -//} - -//void StoryChainSourceEdit::resetProcsType(const QString &suffix) -//{ - -//} - -//void StoryChainSourceEdit::jumpTo(const QList &path) -//{ -// auto fpath = this->absoluteFilePath(); -// auto core = core_ins->parseCore(); -// if(path.size()){ -// auto storynode = core->queryStoryChain(path[0]).first(); -// auto first_word = storynode->refered()[0]; - -// auto textblock = this->textDocument()->findBlockByNumber(first_word->row()); -// auto cur = this->getTextCursor(); -// cur.setPosition(textblock.position()); -// cur.select(QTextCursor::SelectionType::LineUnderCursor); -// this->setTextCursor(cur); - -// if(path.size() > 1){ -// auto storypoint = core->queryStoryPoint(storynode, path[1]).first(); -// first_word = storypoint->refered()[0]; - -// auto textblock = this->textDocument()->findBlockByNumber(first_word->row()); -// cur.setPosition(textblock.position()); -// cur.select(QTextCursor::SelectionType::LineUnderCursor); -// this->setTextCursor(cur); -// } -// } - -// this->textView()->setFocus(); -//} - -//namespace __impl_temp { -// class ChainSrcConfig : public QWidget -// { -// public: -// virtual ~ChainSrcConfig(){ -// qDebug() << "析构"; -// } -// void init(Config::Configration *port){} -// }; -//} -//StoryChainSourceEditFactory::StoryChainSourceEditFactory(){} - -//Core::Extension *Components::StoryChainSourceEditFactory::newInstance(Core::AppCore *core) -//{ -// return new StoryChainSourceEdit(this); -//} - -//QList Components::StoryChainSourceEditFactory::configs() const -//{ -// return QList() << Scale::Project << Scale::Global; -//} - - -//namespace __impl_temp { -// class ChainConfigration : public QWidget -// { -// public: -// ChainConfigration(Config::Configration* port) -// { -// auto layout = new QVBoxLayout(this); - -// auto family = Config::ConfigHelper::getConfigAsDefault( -// port, {"sourcecode_chainedit","default_font","font_family"}, "微软雅黑"); -// auto fontfamily = new QComboBox(this); -// layout->addWidget(fontfamily); -// auto families = QFontDatabase().families(QFontDatabase::WritingSystem::SimplifiedChinese); -// fontfamily->addItems(families); -// fontfamily->setCurrentText(family); -// connect(fontfamily, &QComboBox::currentTextChanged, [port](const QString &text){ -// port->setConfig({"sourcecode_chainedit","default_font","font_family"}, text); -// }); - -// auto size = Config::ConfigHelper::getConfigAsDefault( -// port, {"sourcecode_chainedit","default_font","font_sizept"}, "20"); -// auto fontsize = new QSpinBox(this); -// layout->addWidget(fontsize); -// fontsize->setRange(10, 200); -// fontsize->setSingleStep(1); -// fontsize->setValue(size.toInt()); -// connect(fontsize, QOverload::of(&QSpinBox::valueChanged), [port](int val){ -// port->setConfig({"sourcecode_chainedit","default_font","font_sizept"}, QString("%1").arg(val)); -// }); - -// layout->addWidget(new QWidget(this), 1); -// } -// }; -//} -//QWidget *Components::StoryChainSourceEditFactory::getNewPanel(Config::Configration *config) -//{ -// return new __impl_temp::ChainConfigration(config); -//} - -//QString StoryChainSourceEditFactory::extensionName() const -//{ -// return "脉络编辑器"; -//} - -//QList StoryChainSourceEditFactory::suffixPeers() const -//{ -// return QList() << "storychain"; -//} diff --git a/WordsIDE/storychainsourceeditor.h b/WordsIDE/storychainsourceeditor.h deleted file mode 100644 index fbe5e94..0000000 --- a/WordsIDE/storychainsourceeditor.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef STORYCHAINSOURCEEDITOR_H -#define STORYCHAINSOURCEEDITOR_H - -#include "ContentPresent.h" -#include "DocsManager.h" -#include "SourceEditView.h" - -#include -#include - -namespace Components { - -// class StoryChainSourceEditFactory : public Core::FileExtensionFactory -// { -// public: -// StoryChainSourceEditFactory(); -// virtual ~StoryChainSourceEditFactory() = default; - -// // PluginFactory interface -// public: -// virtual Core::Extension *newInstance(Core::AppCore *core) override; -// virtual QList configs() const override; -// virtual QWidget *getNewPanel(Config::Configration *config) override; -// virtual QString extensionName() const override; -// virtual QList suffixPeers() const override; -// }; - -// /** -// * @brief StoryChain源码编辑器 -// */ -// class StoryChainSourceEdit : public FormattedTextEdit -// { -// public: -// StoryChainSourceEdit(Core::FileExtensionFactory *factory); -// virtual ~StoryChainSourceEdit() = default; - -// // ModeView interface -// public: -// virtual void modeReset(const QString &) const override; -// virtual QList modes() const override; -// virtual QString currentMode() const override; -// virtual QString title() const override; - -// // VariedTextView interface -// public: -// virtual void initSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent=nullptr) override; -// virtual void jumpTo(const QList &path) override; - -// // Plugin interface -// public: -// virtual Core::FileExtensionFactory *factory() const override; -// virtual void reloadConfigrations(QList configs) override; - -// // FormattedTextEdit interface -// protected: -// virtual void rehighlighter() override; - -// private: -// QSyntaxHighlighter *const highter_ins; -// Parse::Result::DocCore * doc_ins; -// Core::AppCore *core_ins; -// Core::FileExtensionFactory *const factory_ins; - - -// // Extension interface -// public: -// virtual void resetProcsType(const QString &suffix) override; -// }; - -} - -#endif // STORYCHAINSOURCEEDITOR_H diff --git a/WordsIDE/storyunitsourceedit.h b/WordsIDE/storyunitsourceedit.h index 5078ecc..e612790 100644 --- a/WordsIDE/storyunitsourceedit.h +++ b/WordsIDE/storyunitsourceedit.h @@ -1,7 +1,7 @@ #ifndef STORYUNITSOURCEEDIT_H #define STORYUNITSOURCEEDIT_H -#include "SourceEditView.h" +#include "default_textpresent.h" #include #include diff --git a/WordsIDE/storyvolumesourceedit.h b/WordsIDE/storyvolumesourceedit.h index 17b2567..bed53a0 100644 --- a/WordsIDE/storyvolumesourceedit.h +++ b/WordsIDE/storyvolumesourceedit.h @@ -1,7 +1,7 @@ #ifndef STORYVOLUMESOURCEEDIT_H #define STORYVOLUMESOURCEEDIT_H -#include "SourceEditView.h" +#include "default_textpresent.h" namespace Components {