添加小说编译结果解析类型
This commit is contained in:
parent
fc0a6e2dac
commit
a57ebd0bbc
|
@ -4,4 +4,5 @@ SUBDIRS += \
|
|||
GenericConsole \
|
||||
WordsIDE \
|
||||
libConfig \
|
||||
libProjectManager
|
||||
libProjectManager \
|
||||
u_test
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.15.0, 2023-08-10T21:33:27. -->
|
||||
<!-- Written by QtCreator 4.15.0, 2023-08-13T11:50:05. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.51211.win64_msvc2017_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">3</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\Projects\Cpp\build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug</value>
|
||||
|
@ -337,235 +337,16 @@
|
|||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/DesParser/DesParser.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/DesParser/DesParser.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/u_test/u_test.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/u_test/u_test.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/DesParser</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/u_test</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/Testpad/Testpad.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/Testpad/Testpad.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/Testpad</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/CoreTest/CoreTest.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/CoreTest/CoreTest.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/CoreTest</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">4</value>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
|
|
|
@ -29,6 +29,7 @@ SOURCES += \
|
|||
mainwindow.cpp \
|
||||
manager_docs.cpp \
|
||||
messagespresent.cpp \
|
||||
parsebridge.cpp \
|
||||
presentcontainer.cpp \
|
||||
projectpresent.cpp \
|
||||
route.cpp \
|
||||
|
@ -58,6 +59,7 @@ HEADERS += \
|
|||
manager_docs.h \
|
||||
messagespresent.h \
|
||||
opstream.h \
|
||||
parsebridge.h \
|
||||
presentcontainer.h \
|
||||
projectpresent.h \
|
||||
route.h \
|
||||
|
|
|
@ -80,7 +80,7 @@ QList<Config::Configration *> AppCore::getConfigs(QList<Scale> types) const
|
|||
for(auto &x : types){
|
||||
if(x == Scale::Global)
|
||||
rets << global_config;
|
||||
if(x == Scale::Project && current_project->isOpen())
|
||||
if(x == Scale::Project && current_project->isOpenning())
|
||||
rets << current_project->configraions();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <QObject>
|
||||
#include <commandsdispatcher.h>
|
||||
#include <libConfig.h>
|
||||
#include <libParse.h>
|
||||
#include <libProjectManager.h>
|
||||
|
||||
class MainWindow;
|
||||
|
@ -71,8 +70,7 @@ namespace Core {
|
|||
|
||||
void setCurrentProject(Project::ProjectManager *project);
|
||||
Project::ProjectManager* currentProject() const;
|
||||
QList<Config::Configration*> getConfigs(QList<Scale> types) const;
|
||||
Parse::Result::ParseCore * parseCore() const;
|
||||
QList<Config::Configration *> getConfigs(QList<Scale> types) const;
|
||||
|
||||
QList<MakeTools::FilePresent*> extensions(const QString &suffix = QString()) const;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <QTableView>
|
||||
#include <QWidget>
|
||||
#include <commandsdispatcher.h>
|
||||
#include <libParse.h>
|
||||
|
||||
namespace DataModel {
|
||||
class FragmentsOrderviewModel : public Schedule::AccessibleObject {
|
||||
|
|
|
@ -116,7 +116,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
XApp::disp_core->postCommand(OpenProject(file));
|
||||
build_internal(true);
|
||||
});
|
||||
sync_kernel->actionEnableSync(opnp, [this]() -> bool { return !project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(opnp, [this]() -> bool { return !project_manager->isOpenning(); });
|
||||
|
||||
auto newp = project->addAction("新建项目", [this]() {
|
||||
auto name = QInputDialog::getText(this, "输入项目名称", "项目名称");
|
||||
|
@ -128,13 +128,13 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
|
||||
XApp::disp_core->postCommand(NewProject(QDir(dir_path), name));
|
||||
});
|
||||
sync_kernel->actionEnableSync(newp, [this]() -> bool { return !project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(newp, [this]() -> bool { return !project_manager->isOpenning(); });
|
||||
|
||||
auto clsp = project->addAction("关闭项目", [this]() {
|
||||
XApp::disp_core->postCommand(CloseProject());
|
||||
this->refresh_views();
|
||||
});
|
||||
sync_kernel->actionEnableSync(clsp, [this]() -> bool { return project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(clsp, [this]() -> bool { return project_manager->isOpenning(); });
|
||||
project->addSeparator();
|
||||
|
||||
auto pnew = project->addAction("新建路径", [this]() {
|
||||
|
@ -142,10 +142,10 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
if (packages != "")
|
||||
XApp::disp_core->postCommand(NewPackage(packages));
|
||||
});
|
||||
sync_kernel->actionEnableSync(pnew, [this]() -> bool { return project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(pnew, [this]() -> bool { return project_manager->isOpenning(); });
|
||||
|
||||
auto _xnew = project->addMenu("新建文件");
|
||||
_xnew->setEnabled(project_manager->isOpen());
|
||||
_xnew->setEnabled(project_manager->isOpenning());
|
||||
auto types = docs_container->fileTypes();
|
||||
for (auto &t : types) {
|
||||
_xnew->addAction(t, [this, &t]() {
|
||||
|
@ -161,12 +161,12 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
XApp::disp_core->postCommand(NewFile(group_path, name, t));
|
||||
});
|
||||
}
|
||||
sync_kernel->widgetEnableSync(_xnew, [this]() -> bool { return project_manager->isOpen(); });
|
||||
sync_kernel->widgetEnableSync(_xnew, [this]() -> bool { return project_manager->isOpenning(); });
|
||||
project->addSeparator();
|
||||
|
||||
auto sav = project->addAction("保存全部", [this]() { XApp::disp_core->postCommand(SaveAll()); });
|
||||
sav->setShortcut(QKeySequence::StandardKey::Save);
|
||||
sync_kernel->actionEnableSync(sav, [this]() -> bool { return project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(sav, [this]() -> bool { return project_manager->isOpenning(); });
|
||||
project->addSeparator();
|
||||
|
||||
project->addAction("退出", [this]() {
|
||||
|
@ -218,7 +218,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
change->addAction("编辑视图");
|
||||
view->addSeparator();
|
||||
auto func = view->addMenu("功能视图");
|
||||
sync_kernel->widgetEnableSync(func, [this]() { return this->project_manager->isOpen(); });
|
||||
sync_kernel->widgetEnableSync(func, [this]() { return this->project_manager->isOpenning(); });
|
||||
// 项目管理
|
||||
{
|
||||
auto project_v = func->addAction("项目管理", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, project_present, v)); });
|
||||
|
@ -302,7 +302,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
|||
exp->addSeparator();
|
||||
exp->addAction("导出TXT内容");
|
||||
auto build = tool->addAction("编译", [this]() { this->build_internal(); });
|
||||
sync_kernel->actionEnableSync(build, [this]() -> bool { return project_manager->isOpen(); });
|
||||
sync_kernel->actionEnableSync(build, [this]() -> bool { return project_manager->isOpenning(); });
|
||||
|
||||
// 窗口菜单
|
||||
auto window = mbar->addMenu("窗口");
|
||||
|
@ -483,7 +483,7 @@ void MainWindow::hasBeenClosed(const Core::Route &key) { docs_container->hasBeen
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
// 关闭事件
|
||||
if (project_manager->isOpen()) {
|
||||
if (project_manager->isOpenning()) {
|
||||
XApp::disp_core->postCommand(CloseProject());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,12 @@ QList<QString> DocumentsManager::fileTypes() const
|
|||
void DocumentsManager::newFile(const Route &group_path, const QString &name, const QString &suffix)
|
||||
{
|
||||
auto list = rtcore->extensions(suffix);
|
||||
QDir root = pjtins->projectDir();
|
||||
QDir root = pjtins->directory();
|
||||
|
||||
auto rst = list.first()->create(root, name, suffix);
|
||||
if(std::get<0>(rst)){
|
||||
auto rpath = root.relativeFilePath(std::get<1>(rst));
|
||||
auto idx = pjtins->signFile(converter(group_path), name, rpath);
|
||||
auto idx = pjtins->appendFile(converter(group_path), name, rpath);
|
||||
openFile(converter(idx));
|
||||
}
|
||||
else{
|
||||
|
@ -99,7 +99,7 @@ void DocumentsManager::removeNode(const Route &node_path)
|
|||
}
|
||||
|
||||
close(path_buff);
|
||||
pjtins->deleteTarget(node_mindex);
|
||||
pjtins->delete(node_mindex);
|
||||
}
|
||||
|
||||
void DocumentsManager::renameNode(const Route &node_path, const QString &name)
|
||||
|
|
|
@ -0,0 +1,416 @@
|
|||
#include "parsebridge.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QList>
|
||||
#include <libConfig.h>
|
||||
|
||||
using namespace bridge;
|
||||
|
||||
class Impl_NovelParseException : public Config::ParseException {
|
||||
private:
|
||||
QString title_s, reason_s;
|
||||
|
||||
public:
|
||||
Impl_NovelParseException(const QString &t, const QString &r) {
|
||||
this->title_s = t;
|
||||
this->reason_s = r;
|
||||
}
|
||||
|
||||
// ParseException interface
|
||||
public:
|
||||
virtual QString reason() const override { return reason_s; }
|
||||
virtual QString title() const override { return reason_s; }
|
||||
};
|
||||
|
||||
ParseBridge::ParseBridge() : chains_model(new QStandardItemModel), volumes_model(new QStandardItemModel), errors_model(new QStandardItemModel) {}
|
||||
|
||||
ParseBridge::~ParseBridge() {
|
||||
delete chains_model;
|
||||
delete volumes_model;
|
||||
delete errors_model;
|
||||
|
||||
for (auto it : docs_store)
|
||||
delete it;
|
||||
docs_store.clear();
|
||||
}
|
||||
|
||||
QString ParseBridge::novelName() const { return name_store; }
|
||||
|
||||
QStandardItemModel *ParseBridge::volumesPresentModel() const { return volumes_model; }
|
||||
|
||||
void bridge::ParseBridge::load(const QString &data_path) {
|
||||
// clear cache
|
||||
this->doc_ins.clear();
|
||||
chains_model->clear();
|
||||
volumes_model->clear();
|
||||
errors_model->clear();
|
||||
|
||||
for (auto it : docs_store)
|
||||
delete it;
|
||||
docs_store.clear();
|
||||
|
||||
// 重新载入小说编译结果
|
||||
QFileInfo target_xml(data_path);
|
||||
if (!target_xml.exists())
|
||||
throw new Impl_NovelParseException("小说解析过程错", "指定路径数据文件不存在:" + data_path);
|
||||
|
||||
QFile data_in(target_xml.canonicalFilePath());
|
||||
if (!data_in.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
throw new Impl_NovelParseException("小说解析过程错", "指定数据文件无法打开:" + target_xml.canonicalFilePath());
|
||||
|
||||
QString err_msg;
|
||||
int col, row;
|
||||
if (!this->doc_ins.setContent(&data_in, &err_msg, &row, &col)) {
|
||||
throw new Impl_NovelParseException("小说解析过程我", QString("数据文件格式错:<row:%1, col:%2>%3").arg(row).arg(col).arg(err_msg));
|
||||
}
|
||||
|
||||
// 载入语法节点
|
||||
auto root = doc_ins.documentElement();
|
||||
name_store = root.attribute("name", "空白小说名称");
|
||||
auto childnodes = root.childNodes();
|
||||
for (auto idx = 0; idx < childnodes.size(); ++idx) {
|
||||
auto child = childnodes.at(idx);
|
||||
if (child.isElement()) {
|
||||
auto elm_inst = child.toElement();
|
||||
if (elm_inst.tagName() == "doc") {
|
||||
load_document(elm_inst, this->docs_store);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_document(const QDomElement &pdoc, std::vector<DocumentInst *> node_sets) {
|
||||
auto doc_name = pdoc.attribute("name", "未命名文档名");
|
||||
auto file_path = pdoc.attribute("file");
|
||||
auto doc_ins = new DocumentInst(doc_name, file_path);
|
||||
node_sets.push_back(doc_ins);
|
||||
|
||||
// 载入解析错误
|
||||
auto errors = pdoc.elementsByTagName("error");
|
||||
for (auto idx = 0; idx < errors.size(); ++idx) {
|
||||
auto e_elm = errors.at(idx).toElement();
|
||||
load_errors(errorsPresentModel(), e_elm, doc_ins);
|
||||
}
|
||||
|
||||
auto children = pdoc.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), doc_ins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_element(const QDomElement &telm, DocumentInst *pinst, QStandardItem *pitem) {
|
||||
if (telm.tagName() == "story")
|
||||
load_story(chainsPresentModel(), telm, pinst);
|
||||
else if (telm.tagName() == "text")
|
||||
load_desc(telm, static_cast<ContentNode *>(pitem));
|
||||
else if (telm.tagName() == "fragment")
|
||||
load_fragment(telm, pitem);
|
||||
else if (telm.tagName() == "frag-refer")
|
||||
load_frag_refer(telm, pitem);
|
||||
else if (telm.tagName() == "volume")
|
||||
load_volumes(volumesPresentModel(), telm, pinst);
|
||||
else if (telm.tagName() == "article")
|
||||
load_article(telm, pitem);
|
||||
else
|
||||
throw new Impl_NovelParseException("小说解析结果载入错", "位置tagName:" + telm.tagName());
|
||||
}
|
||||
|
||||
void ParseBridge::load_errors(QStandardItemModel *anchor, const QDomElement &error_elm, DocumentInst *pinst) {
|
||||
auto pos_value = error_elm.attribute("pos");
|
||||
auto message = error_elm.attribute("message");
|
||||
|
||||
QRegExp exp0("(\\d+)");
|
||||
auto index = exp0.indexIn(pos_value);
|
||||
auto row = exp0.cap(1).toInt();
|
||||
exp0.indexIn(pos_value, index + exp0.cap(1).length());
|
||||
auto col = exp0.cap(1).toInt();
|
||||
|
||||
auto perror = new ParseException(pinst);
|
||||
perror->load(message, row, col);
|
||||
|
||||
QList<QStandardItem *> inst_row;
|
||||
inst_row << perror;
|
||||
inst_row << new SupplyItem<ParseException, 1>(perror);
|
||||
inst_row << new SupplyItem<ParseException, 2>(perror);
|
||||
inst_row << new SupplyItem<ParseException, 3>(perror);
|
||||
anchor->appendRow(inst_row);
|
||||
}
|
||||
|
||||
#define PEAK_POSITION(e) \
|
||||
auto start_pos = (e).attribute("start-pos"); \
|
||||
auto end_pos = (e).attribute("end-pos"); \
|
||||
QRegExp exp("(\\d+)"); \
|
||||
auto xidx = exp.indexIn(start_pos); \
|
||||
auto start_row = exp.cap(1).toInt(); \
|
||||
exp.indexIn(start_pos, xidx + exp.cap(1).length()); \
|
||||
auto start_col = exp.cap(1).toInt(); \
|
||||
xidx = exp.indexIn(end_pos); \
|
||||
auto end_row = exp.cap(1).toInt(); \
|
||||
exp.indexIn(start_pos, xidx + exp.cap(1).length()); \
|
||||
auto end_col = exp.cap(1).toInt();
|
||||
|
||||
void ParseBridge::load_story(QStandardItemModel *model, const QDomElement &chain_elm, DocumentInst *pinst) {
|
||||
auto name = chain_elm.attribute("name");
|
||||
auto index = chain_elm.attribute("sort");
|
||||
auto story = new StorychainInst(pinst, name);
|
||||
model->appendRow(story);
|
||||
story->indexSet(index.toInt());
|
||||
|
||||
PEAK_POSITION(chain_elm);
|
||||
|
||||
story->loadPos(start_row, start_col, end_row, end_col);
|
||||
|
||||
auto children = chain_elm.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), nullptr, story);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_desc(const QDomElement &desc_elm, ContentNode *pitem) {
|
||||
auto content = desc_elm.attribute("content");
|
||||
pitem->append(content);
|
||||
}
|
||||
|
||||
void ParseBridge::load_fragment(const QDomElement &frag_elm, QStandardItem *pinst) {
|
||||
auto name = frag_elm.attribute("name");
|
||||
auto logic_index = frag_elm.attribute("logic-index");
|
||||
PEAK_POSITION(frag_elm);
|
||||
|
||||
auto frag_inst = new StoryfragmentInst(name);
|
||||
pinst->appendRow(frag_inst);
|
||||
|
||||
frag_inst->setLogicIndex(logic_index.toInt());
|
||||
frag_inst->loadPos(start_row, start_col, end_row, end_col);
|
||||
|
||||
auto children = frag_elm.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), nullptr, frag_inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_frag_refer(const QDomElement &refer_elm, QStandardItem *pitem) {
|
||||
auto story = refer_elm.attribute("story-ref");
|
||||
auto frag = refer_elm.attribute("fragment-ref");
|
||||
PEAK_POSITION(refer_elm);
|
||||
|
||||
auto item = locate_node(chainsPresentModel(), QStringList() << story << frag);
|
||||
auto refer_inst = new StoryfragmentRefer(static_cast<StoryfragmentInst *>(item));
|
||||
pitem->appendRow(refer_inst);
|
||||
refer_inst->appointStory(story);
|
||||
refer_inst->appointFragment(frag);
|
||||
refer_inst->loadPos(start_row, start_col, end_row, end_col);
|
||||
|
||||
auto children = refer_elm.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), nullptr, refer_inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_volumes(QStandardItemModel *model, const QDomElement &volume_elm, DocumentInst *pinst) {
|
||||
auto name = volume_elm.attribute("content");
|
||||
PEAK_POSITION(volume_elm);
|
||||
|
||||
auto volume = new StoryvolumeInst(pinst, name);
|
||||
model->appendRow(volume);
|
||||
volume->loadPos(start_row, start_col, end_row, end_col);
|
||||
|
||||
auto children = volume_elm.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), nullptr, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBridge::load_article(const QDomElement &article_elm, QStandardItem *pitem) {
|
||||
auto name = article_elm.attribute("content");
|
||||
PEAK_POSITION(article_elm);
|
||||
|
||||
auto article = new StoryarticleInst(name);
|
||||
pitem->appendRow(article);
|
||||
article->loadPos(start_row, start_col, end_row, end_col);
|
||||
|
||||
auto children = article_elm.childNodes();
|
||||
for (auto idx = 0; idx < children.size(); ++idx) {
|
||||
auto node = children.at(idx);
|
||||
if (node.isElement()) {
|
||||
load_element(node.toElement(), nullptr, article);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *ParseBridge::locate_node(QStandardItemModel *model, const QStringList path) {
|
||||
QStandardItem *current_item = nullptr;
|
||||
for (auto n : path) {
|
||||
if (!current_item)
|
||||
current_item = model->findChild<QStandardItem *>(n, Qt::FindChildOption::FindDirectChildrenOnly);
|
||||
else {
|
||||
for (auto idx = 0; idx < current_item->rowCount(); ++idx) {
|
||||
if (current_item->child(idx)->text() == n) {
|
||||
current_item = current_item->child(idx);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return current_item;
|
||||
}
|
||||
|
||||
ParseException::ParseException(DocumentInst *pinst) : key_store(std::make_tuple(pinst, "尚未载入异常信息", 0, 0)) { setText(std::get<1>(key_store)); }
|
||||
|
||||
void ParseException::load(const QString &message, int row, int col) {
|
||||
this->key_store = std::make_tuple(std::get<0>(key_store), message, row, col);
|
||||
setText(std::get<1>(key_store));
|
||||
}
|
||||
|
||||
const DocumentInst *ParseException::doc() const { return std::get<0>(key_store); }
|
||||
|
||||
QString ParseException::message() const { return std::get<1>(key_store); }
|
||||
|
||||
int ParseException::row() const { return std::get<2>(key_store); }
|
||||
|
||||
int ParseException::col() const { return std::get<3>(key_store); }
|
||||
|
||||
QString ParseException::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return message();
|
||||
case 1:
|
||||
return QString("%1").arg(row());
|
||||
case 2:
|
||||
return QString("%1").arg(col());
|
||||
case 3:
|
||||
return QString("%1").arg(doc()->name());
|
||||
default:
|
||||
return "超出索引范围";
|
||||
}
|
||||
}
|
||||
|
||||
DocumentInst::DocumentInst(const QString &name, const QString &path) : n(name), p(path) {}
|
||||
|
||||
QString DocumentInst::name() const { return n; }
|
||||
|
||||
QString DocumentInst::path() const { return p; }
|
||||
|
||||
StorychainInst::StorychainInst(DocumentInst *pinst, const QString &name) : ContentNode(name), pinst_store(pinst) {}
|
||||
|
||||
void StorychainInst::indexSet(int sort) { this->sort_store = sort; }
|
||||
|
||||
int StorychainInst::sortIndex() const { return sort_store; }
|
||||
|
||||
ContentNode::ContentNode(const QString &name) {
|
||||
setText(name);
|
||||
name_store = name;
|
||||
}
|
||||
|
||||
std::tuple<int, int> SyntaxNode::startPos() const { return this->start; }
|
||||
|
||||
std::tuple<int, int> SyntaxNode::endPos() const { return this->end; }
|
||||
|
||||
void SyntaxNode::loadPos(int start_r, int start_c, int end_r, int end_c) {
|
||||
this->start = std::make_tuple(start_r, start_c);
|
||||
this->end = std::make_tuple(end_r, end_c);
|
||||
}
|
||||
|
||||
void ContentNode::append(const QString §ion) { this->desc_sections += section + "\n"; }
|
||||
|
||||
QString ContentNode::desc() const { return desc_sections; }
|
||||
|
||||
void ContentNode::clear() { desc_sections = ""; }
|
||||
|
||||
DocumentInst *StorychainInst::doc() const { return pinst_store; }
|
||||
|
||||
QString StorychainInst::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return text();
|
||||
case 1:
|
||||
return QString("%1").arg(sortIndex());
|
||||
case 2:
|
||||
return desc();
|
||||
default:
|
||||
return "超出索引范围";
|
||||
}
|
||||
}
|
||||
|
||||
StoryfragmentInst::StoryfragmentInst(const QString &name) : ContentNode(name) {}
|
||||
|
||||
int StoryfragmentInst::logicIndex() const { return sort_store; }
|
||||
|
||||
void StoryfragmentInst::setLogicIndex(int index) { this->sort_store = index; }
|
||||
|
||||
QString StoryfragmentInst::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return text();
|
||||
case 1:
|
||||
return QString("%1").arg(logicIndex());
|
||||
case 2:
|
||||
return desc();
|
||||
default:
|
||||
return "超出有效索引范围";
|
||||
}
|
||||
}
|
||||
|
||||
QString StoryfragmentRefer::storyRef() const { return this->story; }
|
||||
|
||||
void StoryfragmentRefer::appointStory(const QString &ref) { this->story = ref; }
|
||||
|
||||
QString StoryfragmentRefer::fragmentRef() const { return fragment; }
|
||||
|
||||
void StoryfragmentRefer::appointFragment(const QString &ref) { fragment = ref; }
|
||||
|
||||
QString StoryfragmentRefer::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return storyRef();
|
||||
case 1:
|
||||
return fragmentRef();
|
||||
case 2:
|
||||
return desc();
|
||||
default:
|
||||
return "超出有效索引范围";
|
||||
}
|
||||
}
|
||||
|
||||
StoryvolumeInst::StoryvolumeInst(DocumentInst *inst, const QString &name) : ContentNode(name), doc_store(inst) {}
|
||||
|
||||
DocumentInst *StoryvolumeInst::doc() const { return doc_store; }
|
||||
|
||||
QString StoryvolumeInst::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return text();
|
||||
case 1:
|
||||
return desc();
|
||||
default:
|
||||
return "超出有效索引范围";
|
||||
}
|
||||
}
|
||||
|
||||
StoryarticleInst::StoryarticleInst(const QString &name) : ContentNode(name) {}
|
||||
|
||||
QString StoryarticleInst::operator[](int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return text();
|
||||
case 1:
|
||||
return desc();
|
||||
default:
|
||||
return "超出有效索引范围";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
#ifndef PARSEBRIDGE_H
|
||||
#define PARSEBRIDGE_H
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
namespace bridge {
|
||||
|
||||
class DocumentInst {
|
||||
public:
|
||||
DocumentInst(const QString &name, const QString &path);
|
||||
|
||||
QString name() const;
|
||||
QString path() const;
|
||||
|
||||
private:
|
||||
QString n, p;
|
||||
};
|
||||
|
||||
class ContentNode : public QStandardItem {
|
||||
public:
|
||||
ContentNode(const QString &name);
|
||||
virtual ~ContentNode() = default;
|
||||
|
||||
virtual void append(const QString §ion);
|
||||
virtual QString desc() const;
|
||||
|
||||
virtual void clear();
|
||||
|
||||
private:
|
||||
QString desc_sections;
|
||||
QString name_store;
|
||||
};
|
||||
|
||||
class SyntaxNode {
|
||||
public:
|
||||
virtual ~SyntaxNode() = default;
|
||||
|
||||
virtual std::tuple<int, int> startPos() const;
|
||||
virtual std::tuple<int, int> endPos() const;
|
||||
virtual void loadPos(int start_r, int start_c, int end_r, int end_c);
|
||||
|
||||
private:
|
||||
std::tuple<int, int> start, end;
|
||||
};
|
||||
|
||||
class ParseException : public QStandardItem {
|
||||
public:
|
||||
ParseException(DocumentInst *pinst);
|
||||
|
||||
void load(const QString &message, int row, int col);
|
||||
|
||||
const DocumentInst *doc() const;
|
||||
QString message() const;
|
||||
int row() const;
|
||||
int col() const;
|
||||
|
||||
QString operator[](int index);
|
||||
|
||||
private:
|
||||
std::tuple<DocumentInst *, QString, int, int> key_store;
|
||||
};
|
||||
|
||||
class StorychainInst : public ContentNode, public SyntaxNode {
|
||||
public:
|
||||
StorychainInst(DocumentInst *pinst, const QString &name);
|
||||
|
||||
void indexSet(int sort);
|
||||
int sortIndex() const;
|
||||
|
||||
DocumentInst *doc() const;
|
||||
QString operator[](int index);
|
||||
|
||||
private:
|
||||
int sort_store;
|
||||
DocumentInst *const pinst_store;
|
||||
};
|
||||
|
||||
class StoryfragmentInst : public SyntaxNode, public ContentNode {
|
||||
public:
|
||||
StoryfragmentInst(const QString &name);
|
||||
|
||||
int logicIndex() const;
|
||||
void setLogicIndex(int index);
|
||||
|
||||
QString operator[](int index);
|
||||
|
||||
private:
|
||||
int sort_store;
|
||||
};
|
||||
|
||||
class StoryfragmentRefer : public SyntaxNode, public ContentNode {
|
||||
public:
|
||||
StoryfragmentRefer(StoryfragmentInst *inst);
|
||||
|
||||
QString storyRef() const;
|
||||
void appointStory(const QString &ref);
|
||||
|
||||
QString fragmentRef() const;
|
||||
void appointFragment(const QString &ref);
|
||||
|
||||
QString operator[](int index);
|
||||
|
||||
private:
|
||||
QString story, fragment;
|
||||
};
|
||||
|
||||
class StoryvolumeInst : public SyntaxNode, public ContentNode {
|
||||
public:
|
||||
StoryvolumeInst(DocumentInst *inst, const QString &name);
|
||||
|
||||
DocumentInst *doc() const;
|
||||
|
||||
QString operator[](int index);
|
||||
|
||||
private:
|
||||
DocumentInst *const doc_store;
|
||||
};
|
||||
|
||||
class StoryarticleInst : public SyntaxNode, public ContentNode {
|
||||
public:
|
||||
StoryarticleInst(const QString &name);
|
||||
|
||||
QString operator[](int index);
|
||||
};
|
||||
|
||||
template <class T, int idx> class SupplyItem : public QStandardItem {
|
||||
public:
|
||||
SupplyItem(const T *bitem) : value_store(bitem) { setText(bitem[idx]); }
|
||||
|
||||
private:
|
||||
const T *const value_store;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 小说解析核心
|
||||
*/
|
||||
class ParseBridge {
|
||||
public:
|
||||
ParseBridge();
|
||||
virtual ~ParseBridge();
|
||||
|
||||
QString novelName() const;
|
||||
|
||||
QStandardItemModel *chainsPresentModel() const;
|
||||
QStandardItemModel *volumesPresentModel() const;
|
||||
QStandardItemModel *errorsPresentModel() const;
|
||||
|
||||
void load(const QString &data_path);
|
||||
|
||||
private:
|
||||
QStandardItemModel *const chains_model, *const volumes_model, *const errors_model;
|
||||
QDomDocument doc_ins;
|
||||
QString name_store;
|
||||
std::vector<DocumentInst *> docs_store;
|
||||
|
||||
void load_document(const QDomElement &pdoc, std::vector<DocumentInst *> node_sets);
|
||||
void load_element(const QDomElement &telm, DocumentInst *pinst, QStandardItem *pitem = nullptr);
|
||||
|
||||
void load_errors(QStandardItemModel *anchor, const QDomElement &error_elm, DocumentInst *pinst);
|
||||
void load_story(QStandardItemModel *model, const QDomElement &chain_elm, DocumentInst *pinst);
|
||||
void load_desc(const QDomElement &desc_elm, ContentNode *pitem);
|
||||
void load_fragment(const QDomElement &frag_elm, QStandardItem *pinst);
|
||||
void load_frag_refer(const QDomElement &refer_elm, QStandardItem *pitem);
|
||||
|
||||
void load_volumes(QStandardItemModel *model, const QDomElement &volume_elm, DocumentInst *pinst);
|
||||
void load_article(const QDomElement &article_elm, QStandardItem *pitem);
|
||||
|
||||
QStandardItem *locate_node(QStandardItemModel *model, const QStringList path);
|
||||
};
|
||||
|
||||
} // namespace bridge
|
||||
|
||||
#endif // PARSEBRIDGE_H
|
|
@ -76,6 +76,7 @@ namespace Project {
|
|||
* @return 文件集合
|
||||
*/
|
||||
virtual QList<std::tuple<QString, QFileInfo>> filesWithEnds(const QString &suffix) const = 0;
|
||||
|
||||
/**
|
||||
* @brief 查询节点文件信息,文件节点返回文件的info,包节点返回文简介的info
|
||||
* @param path 树节点路径
|
||||
|
@ -182,6 +183,7 @@ namespace Project {
|
|||
*/
|
||||
virtual bool isModified() const noexcept = 0;
|
||||
};
|
||||
|
||||
} // namespace Project
|
||||
|
||||
#endif // LIBPROJECTMANAGER_H
|
||||
|
|
|
@ -193,11 +193,12 @@ void XMLProjectManager::structure_parser(QDomElement struct_elm, ProjectNode *pn
|
|||
ProjectNode *node = nullptr;
|
||||
if(xnode.tagName()=="package"){
|
||||
node = new ProjectNode(NodeType::GROUP, xnode.attribute("name"));
|
||||
}
|
||||
else if(xnode.tagName() == "file"){
|
||||
} else if (xnode.tagName() == "file") {
|
||||
node = new ProjectNode(NodeType::FILE, xnode.attribute("name"));
|
||||
node->setFile(xnode.attribute("path"));
|
||||
all_files_managed << node->file();
|
||||
} else {
|
||||
throw new Impl_ProjectException("项目解析错误", "未对指定节点类型进行解析:" + xnode.tagName());
|
||||
}
|
||||
|
||||
pnode->appendRow(node);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDomDocument>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
QString value = "row:23212,col:5234";
|
||||
QRegExp exp("(\\d+)");
|
||||
auto offset = exp.indexIn(value);
|
||||
qDebug() << exp.cap(1);
|
||||
|
||||
exp.indexIn(value, offset + exp.cap(1).length());
|
||||
qDebug() << exp.cap(1);
|
||||
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
QT -= gui
|
||||
|
||||
QT += xml
|
||||
|
||||
CONFIG += c++11 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
Loading…
Reference in New Issue