1 Star 0 Fork 0

旷野芦苇殇/texteditor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
texteditorenvironment.cpp 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
#include "texteditorenvironment.h"
#include "texteditorconstants.h"
#include "utils/theme/theme.h"
#include "utils/theme/theme_p.h"
#include "core/coreconstants.h"
#include "snippets/snippetprovider.h"
#include "languages/css/loader.h"
#include "languages/html/loader.h"
#include "languages/javascript/loader.h"
#include "languages/jsx/loader.h"
#include "languages/python/loader.h"
#include "languages/tsx/loader.h"
namespace TextEditor {
TextEditorEnvironment* TextEditorEnvironment::instance = nullptr;
TextEditorEnvironment::TextEditorEnvironment() {
this->registerLangLoader<Html::Loader>({"HTML","PHP/PHP","XML"});
this->registerLangLoader<Css::Loader>({"CSS"});
this->registerLangLoader<Javascript::Loader>({"JavaScript"});
this->registerLangLoader<Jsx::Loader>({"JavaScript React (JSX)"});
this->registerLangLoader<Python::Loader>({"Python"});
this->registerLangLoader<Tsx::Loader>({"TypeScript","TypeScript React (TSX)"});
}
void TextEditorEnvironment::init(){
if(instance==nullptr){
instance = new TextEditorEnvironment();
Utils::Theme *theme = new Utils::Theme(Core::Constants::DEFAULT_DARK_THEME);
Utils::setCreatorTheme(theme);
TextEditor::SnippetProvider::registerGroup(TextEditor::Constants::TEXT_SNIPPET_GROUP_ID,QObject::tr("Text", "SnippetProvider"));
}
}
void TextEditorEnvironment::destory(){
Utils::setCreatorTheme(nullptr);
delete instance;
instance = nullptr;
}
TextEditorEnvironment* TextEditorEnvironment::getIntance(){
return instance;
}
LanguageLoader* TextEditorEnvironment::loader(const QString& name,QTextDocument* doc){
if(instance!=nullptr){
for(auto one:m_loaderList){
if(one.first.contains(name)){
return one.second(doc);
}
}
}
return nullptr;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fengzhu2007/texteditor.git
git@gitee.com:fengzhu2007/texteditor.git
fengzhu2007
texteditor
texteditor
main

搜索帮助