2022-11-22 03:42:48 +00:00
|
|
|
|
#include "storyboardsourceedit.h"
|
|
|
|
|
#include "keywordshightlighter.h"
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
|
|
using namespace Components;
|
|
|
|
|
using namespace Parse::Result;
|
|
|
|
|
using namespace Enhancement;
|
|
|
|
|
using namespace Core;
|
|
|
|
|
|
|
|
|
|
|
2023-02-26 14:44:00 +00:00
|
|
|
|
//StoryBoardSourceEdit::StoryBoardSourceEdit(FileExtensionFactory *factory)
|
|
|
|
|
// : words_highlighter(new KeywordsHightlighter(this)), factory_ins(factory)
|
|
|
|
|
//{
|
|
|
|
|
// words_highlighter->setDocument(this->textDocument());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this->setContexMenuProcess([this](QMenu *menu){
|
|
|
|
|
// menu->addSeparator();
|
|
|
|
|
// menu->addAction("刷新", [this](){words_highlighter->rehighlight();});
|
|
|
|
|
// });
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//FileExtensionFactory *StoryBoardSourceEdit::factory() const
|
|
|
|
|
//{
|
|
|
|
|
// return factory_ins;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryBoardSourceEdit::reloadConfigrations(QList<Config::Configration *> configs)
|
|
|
|
|
//{
|
|
|
|
|
// // TODO: 设置格式
|
|
|
|
|
// auto font_family = Config::ConfigHelper::getConfigAsDefaultSequence
|
|
|
|
|
// (configs, {"sourcecode_boardedit","default_font","font_family"}, "微软雅黑");
|
|
|
|
|
// auto font_size = Config::ConfigHelper::getConfigAsDefaultSequence(
|
|
|
|
|
// configs, {"sourcecode_boardedit","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 StoryBoardSourceEdit::modeReset(const QString &) const{}
|
|
|
|
|
|
|
|
|
|
//QList<QString> StoryBoardSourceEdit::modes() const
|
|
|
|
|
//{
|
|
|
|
|
// return QList<QString>() << "源码";
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QString StoryBoardSourceEdit::currentMode() const
|
|
|
|
|
//{
|
|
|
|
|
// return modes()[0];
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QString StoryBoardSourceEdit::title() const
|
|
|
|
|
//{
|
|
|
|
|
// return source_target.fileName();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryBoardSourceEdit::applySetting(const QString &name, Core::AppCore *core)
|
|
|
|
|
//{
|
|
|
|
|
// // this->source_target = src;
|
|
|
|
|
// this->core_temp = core;
|
|
|
|
|
// FormattedTextEdit::applySetting(name, core);
|
|
|
|
|
// // static_cast<KeywordsHightlighter*>(words_highlighter)
|
|
|
|
|
// // ->reset(core->parseCore()->queryDocument(src));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryBoardSourceEdit::jumpTo(const QList<QString> &path)
|
|
|
|
|
//{
|
|
|
|
|
// auto fpath = this->absoluteFilePath();
|
|
|
|
|
// auto core = core_temp->parseCore();
|
|
|
|
|
// if(path.size()){
|
|
|
|
|
// auto storynode = core->queryStoryBoard(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());
|
|
|
|
|
// this->setTextCursor(cur);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryBoardSourceEdit::rehighlighter()
|
|
|
|
|
//{
|
|
|
|
|
// this->words_highlighter->rehighlight();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryBoardSourceEdit::resetProcsType(const QString &suffix)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//Extension *StoryBoardSourceEditFactory::newInstance(Core::AppCore *core)
|
|
|
|
|
//{
|
|
|
|
|
// return new StoryBoardSourceEdit(this);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QList<Scale> StoryBoardSourceEditFactory::configs() const
|
|
|
|
|
//{
|
|
|
|
|
// return QList<Scale>() << Scale::Project << Scale::Global;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/*namespace __impl_temp {
|
2022-11-22 03:42:48 +00:00
|
|
|
|
class BoardConfigration : public QWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BoardConfigration(Config::Configration* port)
|
|
|
|
|
{
|
|
|
|
|
auto layout = new QVBoxLayout(this);
|
|
|
|
|
auto font_family = Config::ConfigHelper::getConfigAsDefault
|
|
|
|
|
(port, {"sourcecode_boardedit","default_font","font_family"}, "微软雅黑");
|
|
|
|
|
|
|
|
|
|
auto fontfamily = new QComboBox(this);
|
|
|
|
|
auto families = QFontDatabase().families(QFontDatabase::WritingSystem::SimplifiedChinese);
|
|
|
|
|
fontfamily->addItems(families);
|
|
|
|
|
fontfamily->setCurrentText(font_family);
|
|
|
|
|
connect(fontfamily, &QComboBox::currentTextChanged, [port](const QString &text){
|
|
|
|
|
port->setConfig({"sourcecode_boardedit","default_font","font_family"}, text);
|
|
|
|
|
});
|
|
|
|
|
layout->addWidget(fontfamily);
|
|
|
|
|
|
|
|
|
|
auto font_size = Config::ConfigHelper::getConfigAsDefault
|
|
|
|
|
(port, {"sourcecode_boardedit","default_font","font_sizept"}, "20");
|
|
|
|
|
auto fontsize = new QSpinBox(this);
|
|
|
|
|
fontsize->setRange(10, 200);
|
|
|
|
|
fontsize->setSingleStep(1);
|
|
|
|
|
fontsize->setValue(font_size.toInt());
|
|
|
|
|
connect(fontsize, QOverload<int>::of(&QSpinBox::valueChanged), [port](int val){
|
|
|
|
|
port->setConfig({"sourcecode_boardedit","default_font","font_sizept"}, QString("%1").arg(val));
|
|
|
|
|
});
|
|
|
|
|
layout->addWidget(fontsize);
|
|
|
|
|
|
|
|
|
|
layout->addWidget(new QWidget(this), 1);
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-02-26 14:44:00 +00:00
|
|
|
|
}*//*
|
2022-11-22 03:42:48 +00:00
|
|
|
|
QWidget *StoryBoardSourceEditFactory::getNewPanel(Config::Configration *config)
|
|
|
|
|
{
|
2023-02-25 09:44:18 +00:00
|
|
|
|
return new __impl_temp::BoardConfigration(config);
|
2022-11-22 03:42:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StoryBoardSourceEditFactory::extensionName() const
|
|
|
|
|
{
|
|
|
|
|
return "故事编辑";
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 01:32:42 +00:00
|
|
|
|
QList<QString> StoryBoardSourceEditFactory::suffixPeers() const
|
2022-11-22 03:42:48 +00:00
|
|
|
|
{
|
2022-11-25 01:32:42 +00:00
|
|
|
|
return QList<QString>() << "storyboard";
|
2023-02-26 14:44:00 +00:00
|
|
|
|
}*/
|