2022-11-22 03:42:48 +00:00
|
|
|
|
#include "storyvolumesourceedit.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
|
|
|
|
//FileExtensionFactory *StoryVolumeSourceEdit::factory() const
|
|
|
|
|
//{
|
|
|
|
|
// return factory_ins;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryVolumeSourceEdit::reloadConfigrations(QList<Config::Configration *> configs)
|
|
|
|
|
//{
|
|
|
|
|
// // TODO: 设置格式
|
|
|
|
|
// auto font_family = Config::ConfigHelper::getConfigAsDefaultSequence
|
|
|
|
|
// (configs, {"sourcecode_voledit","default_font","font_family"}, "微软雅黑");
|
|
|
|
|
// auto font_size = Config::ConfigHelper::getConfigAsDefaultSequence(
|
|
|
|
|
// configs, {"sourcecode_voledit","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 StoryVolumeSourceEdit::resetProcsType(const QString &suffix)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//StoryVolumeSourceEdit::StoryVolumeSourceEdit(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();});
|
|
|
|
|
// });
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryVolumeSourceEdit::modeReset(const QString &) const{}
|
|
|
|
|
|
|
|
|
|
//QList<QString> StoryVolumeSourceEdit::modes() const
|
|
|
|
|
//{
|
|
|
|
|
// return QList<QString>() << "源码";
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QString StoryVolumeSourceEdit::currentMode() const
|
|
|
|
|
//{
|
|
|
|
|
// return modes()[0];
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QString StoryVolumeSourceEdit::title() const
|
|
|
|
|
//{
|
|
|
|
|
// return source_target.fileName();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryVolumeSourceEdit::applySetting(const QString &name, Core::AppCore *core)
|
|
|
|
|
//{
|
|
|
|
|
//// this->source_target = src;
|
|
|
|
|
//// FormattedTextEdit::initSource(core, src, parent);
|
|
|
|
|
//// static_cast<KeywordsHightlighter*>(words_highlighter)
|
|
|
|
|
//// ->reset(core->parseCore()->queryDocument(src));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryVolumeSourceEdit::rehighlighter()
|
|
|
|
|
//{
|
|
|
|
|
// this->words_highlighter->rehighlight();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//void StoryVolumeSourceEdit::jumpTo(const QList<QString> &path)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Extension *StoryVolumeSourceEditFactory::newInstance(Core::AppCore *core)
|
|
|
|
|
//{
|
|
|
|
|
// return new StoryVolumeSourceEdit(this);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QList<Scale> StoryVolumeSourceEditFactory::configs() const
|
|
|
|
|
//{
|
|
|
|
|
// return QList<Scale>() << Scale::Project << Scale::Global;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//namespace __impl_temp {
|
|
|
|
|
// class VolumeConfigration : public QWidget
|
|
|
|
|
// {
|
|
|
|
|
// public:
|
|
|
|
|
// VolumeConfigration(Config::Configration* port)
|
|
|
|
|
// {
|
|
|
|
|
// auto layout = new QVBoxLayout(this);
|
|
|
|
|
|
|
|
|
|
// auto fontfamily = new QComboBox(this);
|
|
|
|
|
// auto families = QFontDatabase().families(QFontDatabase::WritingSystem::SimplifiedChinese);
|
|
|
|
|
// fontfamily->addItems(families);
|
|
|
|
|
// auto family = Config::ConfigHelper::getConfigAsDefault(
|
|
|
|
|
// port, {"sourcecode_voledit","default_font","font_family"}, "微软雅黑");
|
|
|
|
|
// fontfamily->setCurrentText(family);
|
|
|
|
|
// connect(fontfamily, &QComboBox::currentTextChanged, [port](const QString &text){
|
|
|
|
|
// port->setConfig({"sourcecode_voledit","default_font","font_family"}, text);
|
|
|
|
|
// });
|
|
|
|
|
// layout->addWidget(fontfamily);
|
|
|
|
|
|
|
|
|
|
// auto fontsize = new QSpinBox(this);
|
|
|
|
|
// fontsize->setRange(10, 200);
|
|
|
|
|
// fontsize->setSingleStep(1);
|
|
|
|
|
// auto size = Config::ConfigHelper::getConfigAsDefault(
|
|
|
|
|
// port, {"sourcecode_voledit","default_font","font_sizept"}, "20");
|
|
|
|
|
// fontsize->setValue(size.toInt());
|
|
|
|
|
// connect(fontsize, QOverload<int>::of(&QSpinBox::valueChanged), [port](int val){
|
|
|
|
|
// port->setConfig({"sourcecode_voledit","default_font","font_sizept"}, QString("%1").arg(val));
|
|
|
|
|
// });
|
|
|
|
|
// layout->addWidget(fontsize);
|
|
|
|
|
|
|
|
|
|
// layout->addWidget(new QWidget(this), 1);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
//}
|
|
|
|
|
//QWidget *StoryVolumeSourceEditFactory::getNewPanel(Config::Configration *config)
|
|
|
|
|
//{
|
|
|
|
|
// return new __impl_temp::VolumeConfigration(config);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QString StoryVolumeSourceEditFactory::extensionName() const
|
|
|
|
|
//{
|
|
|
|
|
// return "卷纲编辑";
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//QList<QString> StoryVolumeSourceEditFactory::suffixPeers() const
|
|
|
|
|
//{
|
|
|
|
|
// return QList<QString>() << "storyvolume";
|
|
|
|
|
//}
|