实时编译,双击脉络或单元节点,自动打开文档和跳转节点
This commit is contained in:
parent
45f638dac6
commit
3ded30b981
|
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyvolume";
|
||||
auto path = "D:\\测试文学项目\\contentfile_851382615.storyboard";
|
||||
tool.compile(QFileInfo(path));
|
||||
tool.compile(QFileInfo(path), "后台编译");
|
||||
|
||||
auto doc = core.queryDocument(QFileInfo(path));
|
||||
auto retlist = core.queryRootNodes(doc);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ void SensitiveCore::closeTextComponent(const QFileInfo &target)
|
|||
void SensitiveCore::addPerceptionList(VariedTextView *ins, SensitiveType type)
|
||||
{
|
||||
if(type == SensitiveType::CompileAtChanged){
|
||||
connect(ins, &VariedTextView::dataChanged, this, &SensitiveCore::recompile);
|
||||
connect(ins, &VariedTextView::dataChanged, [ins, this](const QString &path){
|
||||
this->recompile(path, ins->docName());
|
||||
});
|
||||
this->sourcecode_map[ins->filePath()] = ins;
|
||||
}
|
||||
else{
|
||||
|
|
@ -89,13 +91,13 @@ void SensitiveCore::addProcTrigger(std::function<void ()> exc)
|
|||
this->trigger_list << exc;
|
||||
}
|
||||
|
||||
void SensitiveCore::recompile(const QString &file_path)
|
||||
void SensitiveCore::recompile(const QString &file_path, const QString &doc_name)
|
||||
{
|
||||
if(!sourcecode_map.contains(file_path))
|
||||
return;
|
||||
|
||||
auto view = this->sourcecode_map[file_path];
|
||||
make_core->compileSource(QFileInfo(file_path), view->textContent());
|
||||
make_core->compileSource(QFileInfo(file_path), view->textContent(), doc_name);
|
||||
|
||||
for(auto &ex : trigger_list)
|
||||
ex();
|
||||
|
|
@ -104,6 +106,12 @@ void SensitiveCore::recompile(const QString &file_path)
|
|||
VariedTextView::VariedTextView()
|
||||
: QObject(nullptr){}
|
||||
|
||||
void VariedTextView::setSource(Core::AppCore *core, const QFileInfo &src, const QString &name, QWidget *parent)
|
||||
{
|
||||
this->doc_name = name;
|
||||
this->setSource(core, src, parent);
|
||||
}
|
||||
|
||||
QString VariedTextView::filePath() const
|
||||
{
|
||||
return source_x.absoluteFilePath();
|
||||
|
|
@ -122,6 +130,11 @@ void VariedTextView::save() const
|
|||
tout.flush();
|
||||
}
|
||||
|
||||
QString VariedTextView::docName() const
|
||||
{
|
||||
return doc_name;
|
||||
}
|
||||
|
||||
void VariedTextView::setSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent)
|
||||
{
|
||||
this->source_x = src;
|
||||
|
|
|
|||
|
|
@ -18,13 +18,14 @@ namespace MakeTools {
|
|||
explicit VariedTextView();
|
||||
virtual ~VariedTextView() = default;
|
||||
|
||||
virtual void setSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent=nullptr);
|
||||
void setSource(Core::AppCore *core, const QFileInfo &src, const QString &name, QWidget *parent=nullptr);
|
||||
|
||||
QString filePath() const;
|
||||
void save() const;
|
||||
|
||||
virtual void jumpTo(const QList<QString> &path) = 0;
|
||||
|
||||
virtual QString docName() const;
|
||||
virtual QWidget* textView() const = 0;
|
||||
virtual QString textContent() const = 0;
|
||||
virtual void textContentReset(const QString &value) = 0;
|
||||
|
|
@ -32,8 +33,12 @@ namespace MakeTools {
|
|||
signals:
|
||||
void dataChanged(const QString &filePath);
|
||||
|
||||
protected:
|
||||
virtual void setSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent=nullptr);
|
||||
|
||||
private:
|
||||
QFileInfo source_x;
|
||||
QString doc_name;
|
||||
};
|
||||
|
||||
enum class SensitiveType
|
||||
|
|
@ -67,7 +72,7 @@ namespace MakeTools {
|
|||
QHash<QString, VariedTextView*> plaintext_map;
|
||||
QList<std::function<void()>> trigger_list;
|
||||
|
||||
void recompile(const QString &file_path);
|
||||
void recompile(const QString &file_path, const QString &doc_name);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,11 +111,11 @@ void AppCore::openTextDocument(const QString &src, const QString &name)
|
|||
|
||||
auto doc = parse_core->queryDocument(QFileInfo(src));
|
||||
if(doc == nullptr){
|
||||
this->make_tool->compile(QFileInfo(src));
|
||||
this->make_tool->compile(QFileInfo(src), name);
|
||||
doc = parse_core->queryDocument(QFileInfo(src));
|
||||
}
|
||||
|
||||
tview->setSource(this, QFileInfo(src), views);
|
||||
tview->setSource(this, QFileInfo(src), name, views);
|
||||
framework->addPerceptionList(tview);
|
||||
dynamic_cast<Core::FileExtension*>(tview)->reload(this->getConfigs(QList<Scale>() << Scale::Global << Scale::Project));
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
current_projects(new QListView(this)),
|
||||
project_structure(new ProjectView(app_core, project_manager, this)),
|
||||
chains_view(new StoryChainsPresent(app_core, this)),
|
||||
units_view(new StoryUnitsPresent(app_core->parseCore(), this)),
|
||||
units_view(new StoryUnitsPresent(app_core, this)),
|
||||
errors_present(new MessagePresent(app_core->getMake_tool(), this))
|
||||
{
|
||||
QApplication::instance()->installEventFilter(this);
|
||||
|
|
@ -67,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
auto mbar = menuBar();
|
||||
// 项目菜单树
|
||||
auto project = mbar->addMenu("项目");
|
||||
project->addAction("新建路径", [this](){
|
||||
auto pnew = project->addAction("新建路径", [this](){
|
||||
auto packages = QInputDialog::getText(this, "输入包路径名称", "packagea#packageb#packagec");
|
||||
if(packages == "")
|
||||
return;
|
||||
|
|
@ -82,6 +82,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
project_manager->newPath(names);
|
||||
});
|
||||
sync_kernel->registerActionSync(pnew, [this]()->bool{return project_manager->isOpen();});
|
||||
|
||||
auto _xnew = project->addMenu("最后卷新建文件");
|
||||
_xnew->addAction("小说章节");
|
||||
_xnew->addSeparator();
|
||||
|
|
@ -89,6 +91,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
_xnew->addAction("故事单元");
|
||||
_xnew->addAction("故事大纲");
|
||||
_xnew->addAction("叙事大纲");
|
||||
sync_kernel->registerWidgetSync(_xnew, [this]()->bool{return project_manager->isOpen();});
|
||||
|
||||
project->addSeparator();
|
||||
auto sav = project->addAction("保存");
|
||||
sav->setShortcut(QKeySequence::StandardKey::Save);
|
||||
|
|
@ -290,13 +294,14 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
sys->addSeparator();
|
||||
sys->addAction("关于……");
|
||||
|
||||
|
||||
setCentralWidget(this->horizontal_split);
|
||||
this->horizontal_split->addWidget(left_funcs);
|
||||
this->horizontal_split->addWidget(vertical_split);
|
||||
this->horizontal_split->addWidget(right_funcs);
|
||||
this->vertical_split->addWidget(center_funcs);
|
||||
setCentralWidget(this->vertical_split);
|
||||
this->vertical_split->addWidget(this->horizontal_split);
|
||||
this->vertical_split->addWidget(bottom_funcs);
|
||||
|
||||
this->horizontal_split->addWidget(left_funcs);
|
||||
this->horizontal_split->addWidget(center_funcs);
|
||||
this->horizontal_split->addWidget(right_funcs);
|
||||
|
||||
left_funcs->setTabsClosable(true);
|
||||
connect(left_funcs, &QTabWidget::tabCloseRequested,
|
||||
[this](int index){ toggle_widget_visible(false, left_funcs, left_funcs->widget(index)); });
|
||||
|
|
@ -316,6 +321,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
app_core->getFramework()->closeTextComponent(QFileInfo(comp->filePath()));
|
||||
});
|
||||
|
||||
this->app_core->getFramework()->addProcTrigger([this](){
|
||||
this->chains_view->refresh();
|
||||
this->units_view->refresh();
|
||||
this->errors_present->refresh();
|
||||
});
|
||||
|
||||
|
||||
center_funcs->addTab(current_projects, "欢迎界面");
|
||||
|
|
@ -357,19 +367,19 @@ void MainWindow::build_internal(bool all_from_disk)
|
|||
|
||||
auto chains = project_manager->filesWithEnds("storychain");
|
||||
for(auto &it : chains)
|
||||
app_core->getMake_tool()->compile(it);
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto units = project_manager->filesWithEnds("storyunit");
|
||||
for(auto &it : units)
|
||||
app_core->getMake_tool()->compile(it);
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto storys = project_manager->filesWithEnds("storyboard");
|
||||
for(auto &it : storys)
|
||||
app_core->getMake_tool()->compile(it);
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto volumes = project_manager->filesWithEnds("storyvolume");
|
||||
for(auto &it : volumes)
|
||||
app_core->getMake_tool()->compile(it);
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
errors_present->refresh();
|
||||
chains_view->refresh();
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ void StoryChainSourceEdit::jumpTo(const QList<QString> &path)
|
|||
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){
|
||||
|
|
@ -98,9 +99,12 @@ void StoryChainSourceEdit::jumpTo(const QList<QString> &path)
|
|||
|
||||
auto textblock = this->edit_square->document()->findBlockByNumber(first_word->row());
|
||||
cur.setPosition(textblock.position());
|
||||
cur.select(QTextCursor::SelectionType::LineUnderCursor);
|
||||
this->edit_square->setTextCursor(cur);
|
||||
}
|
||||
}
|
||||
|
||||
edit_square->setFocus();
|
||||
}
|
||||
|
||||
namespace __temp {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ void StoryChainsPresent::click_to(const QModelIndex &curr)
|
|||
}
|
||||
|
||||
auto chain_ins = this->core_ins->parseCore()->queryStoryChain(path[0]).first();
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_ins->doc()->filePath()));
|
||||
auto chain_doc = chain_ins->doc();
|
||||
this->core_ins->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ void StoryUnitSourceEdit::rehighlighter()
|
|||
void StoryUnitSourceEdit::setSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent)
|
||||
{
|
||||
this->source_target = src;
|
||||
this->core_ins = core;
|
||||
FormattedTextEdit::setSource(core, src, parent);
|
||||
static_cast<KeywordsHightlighter*>(words_highlighter)
|
||||
->reset(core->parseCore()->queryDocument(src));
|
||||
|
|
@ -82,7 +83,30 @@ void StoryUnitSourceEdit::setSource(Core::AppCore *core, const QFileInfo &src, Q
|
|||
|
||||
void StoryUnitSourceEdit::jumpTo(const QList<QString> &path)
|
||||
{
|
||||
auto fpath = this->filePath();
|
||||
auto core = core_ins->parseCore();
|
||||
if(path.size()){
|
||||
auto storynode = core->queryStoryUnit(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->queryStoryFragment(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);
|
||||
}
|
||||
}
|
||||
|
||||
edit_square->setFocus();
|
||||
}
|
||||
|
||||
FileExtension *StoryUnitSourceEditFactory::newInstance(Core::AppCore *core)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ namespace Components {
|
|||
QSyntaxHighlighter *const words_highlighter;
|
||||
Core::FileExtensionFactory *const factory_ins;
|
||||
QFileInfo source_target;
|
||||
Core::AppCore *core_ins;
|
||||
|
||||
// VariedTextView interface
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "storyunitspresent.h"
|
||||
#include "SensitiveCore.h"
|
||||
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -6,7 +7,7 @@
|
|||
using namespace Components;
|
||||
using namespace Parse::Result;
|
||||
|
||||
StoryUnitsPresent::StoryUnitsPresent(Parse::Result::ParseCore *core, QWidget *parent)
|
||||
StoryUnitsPresent::StoryUnitsPresent(Core::AppCore *core, QWidget *parent)
|
||||
: QWidget(parent), core_ins(core),
|
||||
model_ins(new QStandardItemModel(this)),
|
||||
units_view(new QTreeView(this)),
|
||||
|
|
@ -27,12 +28,13 @@ StoryUnitsPresent::StoryUnitsPresent(Parse::Result::ParseCore *core, QWidget *pa
|
|||
details_show->setReadOnly(true);
|
||||
|
||||
connect(units_view, &QTreeView::clicked, this, &StoryUnitsPresent::show_node_description);
|
||||
connect(units_view, &QTreeView::doubleClicked, this, &StoryUnitsPresent::click_to);
|
||||
}
|
||||
|
||||
void StoryUnitsPresent::refresh()
|
||||
{
|
||||
model_ins->clear();
|
||||
auto units = core_ins->allStoryUnits();
|
||||
auto units = core_ins->parseCore()->allStoryUnits();
|
||||
for(auto &unit : units){
|
||||
auto unit_node = new QStandardItem(static_cast<NamedNode*>(unit)->name());
|
||||
unit_node->setEditable(false);
|
||||
|
|
@ -57,7 +59,7 @@ void StoryUnitsPresent::show_node_description(const QModelIndex &curr)
|
|||
details_show->clear();
|
||||
auto item = model_ins->itemFromIndex(curr);
|
||||
if(item->parent() == nullptr){
|
||||
auto node = core_ins->queryStoryUnit(item->text());
|
||||
auto node = core_ins->parseCore()->queryStoryUnit(item->text());
|
||||
|
||||
auto children = node.first()->children();
|
||||
for(auto &it : children){
|
||||
|
|
@ -67,8 +69,8 @@ void StoryUnitsPresent::show_node_description(const QModelIndex &curr)
|
|||
}
|
||||
}
|
||||
else{
|
||||
auto node = core_ins->queryStoryUnit(item->parent()->text());
|
||||
auto point = core_ins->queryStoryFragment(node.first(), item->text());
|
||||
auto node = core_ins->parseCore()->queryStoryUnit(item->parent()->text());
|
||||
auto point = core_ins->parseCore()->queryStoryFragment(node.first(), item->text());
|
||||
|
||||
auto children = point.first()->children();
|
||||
for(auto &it : children){
|
||||
|
|
@ -77,6 +79,28 @@ void StoryUnitsPresent::show_node_description(const QModelIndex &curr)
|
|||
}
|
||||
}
|
||||
|
||||
void StoryUnitsPresent::click_to(const QModelIndex &curr)
|
||||
{
|
||||
if(!curr.isValid())
|
||||
return;
|
||||
|
||||
auto pnode = this->model_ins->itemFromIndex(curr);
|
||||
QList<QString> path;
|
||||
while (pnode) {
|
||||
path.insert(0, pnode->text());
|
||||
pnode = pnode->parent();
|
||||
}
|
||||
|
||||
auto unit_ins = this->core_ins->parseCore()->queryStoryUnit(path[0]).first();
|
||||
auto chain_doc = unit_ins->doc();
|
||||
this->core_ins->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <QTreeView>
|
||||
#include <QWidget>
|
||||
|
||||
#include "appcore.h"
|
||||
#include "libParse.h"
|
||||
|
||||
namespace Components {
|
||||
|
|
@ -15,20 +16,20 @@ namespace Components {
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit StoryUnitsPresent(Parse::Result::ParseCore *core, QWidget *parent = nullptr);
|
||||
explicit StoryUnitsPresent(Core::AppCore *core, QWidget *parent = nullptr);
|
||||
|
||||
void refresh();
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
Parse::Result::ParseCore *const core_ins;
|
||||
Core::AppCore *const core_ins;
|
||||
QStandardItemModel *const model_ins;
|
||||
QTreeView *const units_view;
|
||||
QPlainTextEdit *const details_show;
|
||||
|
||||
void show_node_description(const QModelIndex &curr);
|
||||
|
||||
void click_to(const QModelIndex &curr);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using namespace Parse::Result;
|
|||
StoryTool::StoryTool(Parse::Result::ParseCore *core)
|
||||
: parse_core(core){}
|
||||
|
||||
QList<QString> StoryTool::compile(const QFileInfo &file)
|
||||
QList<QString> StoryTool::compile(const QFileInfo &file, const QString &doc_name)
|
||||
{
|
||||
DocCore *doc_core = parse_core->queryDocument(file.absoluteFilePath());
|
||||
if(doc_core)
|
||||
|
|
@ -21,28 +21,28 @@ QList<QString> StoryTool::compile(const QFileInfo &file)
|
|||
QList<DesNode*> results;
|
||||
if(file.suffix() == "storychain"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYCHAIN, file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYCHAIN, file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryChainDocumentParser parser(parse_core);
|
||||
results.append(parser.analysis(doc_core, file.absoluteFilePath()));
|
||||
}
|
||||
else if(file.suffix() == "storyunit"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYUNIT, file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYUNIT, file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryUnitDocumentParser parser(parse_core);
|
||||
results.append(parser.analysis(doc_core, file.absoluteFilePath()));
|
||||
}
|
||||
else if(file.suffix() == "storyboard"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYBOARD, file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYBOARD, file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryBoardDocumentParser parser(parse_core);
|
||||
results.append(parser.analysis(doc_core, file.absoluteFilePath()));
|
||||
}
|
||||
else if(file.suffix() == "storyvolume"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYOUTLINES, file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYOUTLINES, file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryOutlineDocumentParser parser(parse_core);
|
||||
results.append(parser.analysis(doc_core, file.absoluteFilePath()));
|
||||
|
|
@ -56,7 +56,7 @@ QList<QString> StoryTool::compile(const QFileInfo &file)
|
|||
return QList<QString>();
|
||||
}
|
||||
|
||||
QList<QString> StoryTool::compileSource(const QFileInfo &_file, const QString &src)
|
||||
QList<QString> StoryTool::compileSource(const QFileInfo &_file, const QString &src, const QString &doc_name)
|
||||
{
|
||||
DocCore *doc_core = parse_core->queryDocument(_file.absoluteFilePath());
|
||||
if(doc_core)
|
||||
|
|
@ -65,28 +65,28 @@ QList<QString> StoryTool::compileSource(const QFileInfo &_file, const QString &s
|
|||
QList<DesNode*> results;
|
||||
if(_file.suffix() == "storychain"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYCHAIN, _file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYCHAIN, _file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryChainDocumentParser parser(parse_core);
|
||||
results.append(parser.analysisSource(doc_core, src));
|
||||
}
|
||||
else if(_file.suffix() == "storyunit"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYUNIT, _file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYUNIT, _file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryUnitDocumentParser parser(parse_core);
|
||||
results.append(parser.analysisSource(doc_core, src));
|
||||
}
|
||||
else if(_file.suffix() == "storyboard"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYBOARD, _file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYBOARD, _file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryBoardDocumentParser parser(parse_core);
|
||||
results.append(parser.analysisSource(doc_core, src));
|
||||
}
|
||||
else if(_file.suffix() == "storyvolume"){
|
||||
if(!doc_core)
|
||||
doc_core = new DocCore(parse_core, DocType::STORYOUTLINES, _file.absoluteFilePath());
|
||||
doc_core = new DocCore(parse_core, DocType::STORYOUTLINES, _file.absoluteFilePath(), doc_name);
|
||||
|
||||
StoryOutlineDocumentParser parser(parse_core);
|
||||
results.append(parser.analysisSource(doc_core, src));
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ namespace MakeTools {
|
|||
public:
|
||||
StoryTool(Parse::Result::ParseCore *core);
|
||||
|
||||
QList<QString> compile(const QFileInfo &file);
|
||||
QList<QString> compileSource(const QFileInfo &file, const QString &src);
|
||||
QList<QString> compile(const QFileInfo &file, const QString &doc_name);
|
||||
QList<QString> compileSource(const QFileInfo &file, const QString &src, const QString &doc_name);
|
||||
|
||||
bool checkPass(QList<Parse::ErrorMessage> &errors);
|
||||
|
||||
|
|
|
|||
|
|
@ -297,8 +297,8 @@ QString Words::toString() const
|
|||
return value_store;
|
||||
}
|
||||
|
||||
DocCore::DocCore(ParseCore * core, DocType type, const QFileInfo & path)
|
||||
: unknown_host(new Unknown(this)), core_store(core),
|
||||
DocCore::DocCore(ParseCore * core, DocType type, const QFileInfo & path, const QString &doc_name)
|
||||
: unknown_host(new Unknown(this)), core_store(core), doc_name(doc_name),
|
||||
file_path_store(path.absoluteFilePath()), type_store(type)
|
||||
{
|
||||
}
|
||||
|
|
@ -323,9 +323,9 @@ QString DocCore::filePath() const
|
|||
return file_path_store;
|
||||
}
|
||||
|
||||
QString DocCore::fileName() const
|
||||
QString DocCore::docName() const
|
||||
{
|
||||
return QFileInfo(file_path_store).fileName();
|
||||
return doc_name;
|
||||
}
|
||||
|
||||
void DocCore::clear()
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ namespace Parse
|
|||
class LIBPARSE_EXPORT DocCore
|
||||
{
|
||||
public:
|
||||
explicit DocCore(ParseCore* core, DocType type, const QFileInfo &path);
|
||||
explicit DocCore(ParseCore* core, DocType type, const QFileInfo &path, const QString &doc_name);
|
||||
virtual ~DocCore() = default;
|
||||
|
||||
/**
|
||||
|
|
@ -242,7 +242,7 @@ namespace Parse
|
|||
*
|
||||
* \return
|
||||
*/
|
||||
QString fileName() const;
|
||||
QString docName() const;
|
||||
|
||||
/**
|
||||
* 清除所有的词语节点和内容节点.
|
||||
|
|
@ -270,6 +270,7 @@ namespace Parse
|
|||
private:
|
||||
Result::DesNode *const unknown_host;
|
||||
ParseCore *const core_store;
|
||||
QString doc_name;
|
||||
QString file_path_store;
|
||||
DocType type_store;
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace Project {
|
|||
* @param suffix 后缀名类型
|
||||
* @return 文件集合
|
||||
*/
|
||||
virtual QList<QFileInfo> filesWithEnds(const QString &suffix) const = 0;
|
||||
virtual QList<std::tuple<QFileInfo, QString>> filesWithEnds(const QString &suffix) const = 0;
|
||||
|
||||
/**
|
||||
* @brief 建立新的包路径
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ bool XMLProjectManager::deletePath(const QList<QString> &path)
|
|||
return true;
|
||||
}
|
||||
|
||||
QList<QFileInfo> XMLProjectManager::filesWithEnds(const QString &suffix) const
|
||||
QList<std::tuple<QFileInfo, QString> > XMLProjectManager::filesWithEnds(const QString &suffix) const
|
||||
{
|
||||
auto root_project = mode_holder->item(0);
|
||||
return nodes_search(static_cast<ProjectNode*>(root_project), suffix);
|
||||
|
|
@ -265,10 +265,10 @@ ProjectNode *XMLProjectManager::node_follows(ProjectNode *pnode, const QList<QSt
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QList<QFileInfo> XMLProjectManager::nodes_search(ProjectNode *pnode, const QString &suffix) const
|
||||
QList<std::tuple<QFileInfo, QString> > XMLProjectManager::nodes_search(ProjectNode *pnode, const QString &suffix) const
|
||||
{
|
||||
auto root_dir = QFileInfo(file_path).dir();
|
||||
QList<QFileInfo> infos_return;
|
||||
QList<std::tuple<QFileInfo, QString>> infos_return;
|
||||
|
||||
for(auto idx=0; idx<pnode->rowCount(); ++idx){
|
||||
auto item = static_cast<ProjectNode*>(pnode->child(idx));
|
||||
|
|
@ -277,7 +277,7 @@ QList<QFileInfo> XMLProjectManager::nodes_search(ProjectNode *pnode, const QStri
|
|||
auto file_path = root_dir.filePath(item->file());
|
||||
QFileInfo xinfo(file_path);
|
||||
if(xinfo.suffix() == suffix)
|
||||
infos_return << xinfo;
|
||||
infos_return << std::make_tuple(xinfo, item->text());
|
||||
}
|
||||
else{
|
||||
auto elist = nodes_search(item, suffix);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Project {
|
|||
|
||||
virtual int createFile(const QList<QString> &path, const QString &name, const QString &suffix) override;
|
||||
virtual bool deletePath(const QList<QString> &path) override;
|
||||
virtual QList<QFileInfo> filesWithEnds(const QString &suffix) const override;
|
||||
virtual QList<std::tuple<QFileInfo, QString>> filesWithEnds(const QString &suffix) const override;
|
||||
virtual QStandardItem *newPath(const QList<QString> &path) override;
|
||||
|
||||
virtual QFileInfo queryWith(const QList<QString> &path) override;
|
||||
|
|
@ -69,7 +69,7 @@ namespace Project {
|
|||
void structure_severlize(ProjectNode *pnode, QDomElement &elm);
|
||||
|
||||
ProjectNode* node_follows(ProjectNode* pnode, const QList<QString> &path_remains);
|
||||
QList<QFileInfo> nodes_search(ProjectNode *pnode, const QString &suffix) const;
|
||||
QList<std::tuple<QFileInfo, QString>> nodes_search(ProjectNode *pnode, const QString &suffix) const;
|
||||
|
||||
|
||||
ProjectNode *groups_rebuild(ProjectNode *pnode, const QList<QString> &path_remains);
|
||||
|
|
|
|||
Loading…
Reference in New Issue