diff --git a/.gitignore b/.gitignore index 4ff8e30..c91295c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,9 @@ DesParser/debug/ .vs/ Testpad/debug/ Testpad/release/ +libConfig/debug/ +libParse/debug/ +libParse/release/ +libProjectManager/debug/ +libConfig/release/ +libProjectManager/release/ diff --git a/DesParser/DesParser.vcxproj b/DesParser/DesParser.vcxproj index 5a59137..cdf604a 100644 --- a/DesParser/DesParser.vcxproj +++ b/DesParser/DesParser.vcxproj @@ -78,7 +78,7 @@ - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libParse;release;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) release\ false @@ -98,8 +98,8 @@ true - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) + libParse.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libParse\release;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true false @@ -128,7 +128,7 @@ - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libParse;debug;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) debug\ false @@ -146,8 +146,8 @@ true - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) + libParse.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libParse\debug;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true true @@ -174,26 +174,7 @@ - - - - - - - - - - - - - - - - - - - @@ -237,6 +218,7 @@ + diff --git a/DesParser/DesParser.vcxproj.filters b/DesParser/DesParser.vcxproj.filters index cbb0f79..32f3bd9 100644 --- a/DesParser/DesParser.vcxproj.filters +++ b/DesParser/DesParser.vcxproj.filters @@ -9,14 +9,6 @@ {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} cpp;c;cxx;moc;h;def;odl;idl;res; - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} qrc;* @@ -57,62 +49,9 @@ - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - Source Files - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - @@ -145,5 +84,8 @@ Distribution Files + + Distribution Files + \ No newline at end of file diff --git a/DesParser/ParseFrame.cpp b/DesParser/ParseFrame.cpp deleted file mode 100644 index ac044e0..0000000 --- a/DesParser/ParseFrame.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include "ParseFrame.h" -#include "WordsPeak.h" - -using namespace Parse; -using namespace Parse::Result; -using namespace Syntax; -using namespace Lex; - -ParseFrame::ParseFrame() {} - -QList ParseFrame::analysis(DocCore*doc, const QString & path) -{ - ExStream stream; - if (stream.initSource(path)) - return QList(); - - LexFoundation token_s(this->token_seqs, this->unknown_token); - - QList lex_seqence; - std::tuple temp; - while ((std::get<2>(temp = stream.read())) != EOF) - { - auto results = token_s.push( - std::get<0>(temp), - std::get<1>(temp), - std::get<2>(temp)); - - lex_seqence.append(results); - } - - for (auto it : cascade_parsers) - it->docActive(doc); - - QList xrets; - do { - QList nodes; - auto rst = inner_parse(lex_seqence, cascade_parsers, nodes); - if (rst == ParseResult::Failed) - lex_seqence.removeFirst(); - - xrets.append(nodes); - } while (lex_seqence.size()); - - return xrets; -} - -void ParseFrame::appendTokensDefine(QList seqs, const QString & unknown_token) -{ - this->unknown_token = unknown_token; - token_seqs.append(seqs); -} - -void ParseFrame::appendParser(SyntaxParser * u) -{ - cascade_parsers << u; -} - -ParseResult ParseFrame::inner_parse(QList &lex_seqence, QList parsers, QList &nodes_out) -{ - QList nodes; - - // 遍历解析器,获取匹配 - for (auto it : parsers) { - if (!it->applied(lex_seqence)) - continue; - - it->reset(); - for (;;) { - // 在当前层级解析标记序列 - ParseResult result = it->parse(lex_seqence); - auto node = it->currNode(); - if (node && !nodes.contains(node)) - nodes << node; - - - switch (result) { - case ParseResult::SelfManipulate: - // 进入下一个循环,继续使用本解析器解析 - break; - - case ParseResult::EnterNext: { - // 移交解析任务给成员解析器 - ChildCheck: - QList tlist; - auto child_parsers = it->children(); - auto rst = inner_parse(lex_seqence, child_parsers, tlist); - // 一个成员解析器完成全部解析任务,继续核对下一个解析器 - if (rst == ParseResult::Completed) - goto ChildCheck; - // 成员解析器无法处理,返回父解析器 - }break; - - case ParseResult::Completed: - // 本解析器处理解析完成 - nodes_out.append(nodes); - return ParseResult::Completed; - - case ParseResult::Failed: - auto token = lex_seqence.first(); - auto word = new Words(it->docRef()->unknowns(), it->docRef(), token.Text, token.StartRow, token.StartCol); - it->docRef()->append(word); - lex_seqence.removeFirst(); - break; - } - } - } - - return ParseResult::Failed; -} diff --git a/DesParser/main.cpp b/DesParser/main.cpp index 327b3ed..2640ce5 100644 --- a/DesParser/main.cpp +++ b/DesParser/main.cpp @@ -37,9 +37,10 @@ int main(int argc, char *argv[]) ParseCore core; - Make::StoryTool tool(&core); + MakeTools::StoryTool tool(&core); - auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyvolume"; +// auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyvolume"; + auto path = "D:\\测试文学项目\\contentfile_851382615.storyboard"; tool.compile(QFileInfo(path)); auto doc = core.queryDocument(QFileInfo(path)); @@ -48,10 +49,10 @@ int main(int argc, char *argv[]) qDebug().noquote() << x->toString(); } - QList errors; + QList errors; if(!tool.checkPass(errors)) for(auto x : errors) - qDebug() << x; + qDebug() << QString("%1, %2, %3, %4, %5").arg(x.Reason).arg(x.Text).arg(x.FilePath).arg(x.CodeRow).arg(x.CodeCol); return a.exec(); } diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index 4c9ae6b..bd19266 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -234,79 +234,6 @@ 1 - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - - 25 - - 1 - true - false - true - - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro - D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro - false - true - true - false - true - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE - - dwarf cpu-cycles @@ -379,7 +306,7 @@ true D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/DesParser - + dwarf cpu-cycles @@ -452,6 +379,79 @@ true D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/Testpad + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + + 25 + + 1 + true + false + true + + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro + D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro + false + true + true + false + true + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE + 3 diff --git a/QtNovelDesc.sln b/QtNovelDesc.sln index 8db0f96..627fc21 100644 --- a/QtNovelDesc.sln +++ b/QtNovelDesc.sln @@ -3,16 +3,27 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 15.0.28307.2092 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DesParser", "DesParser\DesParser.vcxproj", "{CDBA4FCE-9275-3B08-87C8-B4473EB323EA}" + ProjectSection(ProjectDependencies) = postProject + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E} = {BF0B8C4D-69F9-391A-85A1-237D14A69C5E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Testpad", "Testpad\Testpad.vcxproj", "{D35B67A8-36AB-3A8B-8F10-73A2007910CB}" ProjectSection(ProjectDependencies) = postProject {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} + {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} = {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WordsIDE", "WordsIDE\WordsIDE.vcxproj", "{E0995577-1AB9-3B93-9990-97E99093D597}" + ProjectSection(ProjectDependencies) = postProject + {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} + {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} = {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E} = {BF0B8C4D-69F9-391A-85A1-237D14A69C5E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libConfig", "libConfig\libConfig.vcxproj", "{584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libParse", "libParse\libParse.vcxproj", "{BF0B8C4D-69F9-391A-85A1-237D14A69C5E}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libProjectManager", "libProjectManager\libProjectManager.vcxproj", "{5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}" ProjectSection(ProjectDependencies) = postProject {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} @@ -40,6 +51,10 @@ Global {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Debug|x64.Build.0 = Debug|x64 {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Release|x64.ActiveCfg = Release|x64 {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Release|x64.Build.0 = Release|x64 + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E}.Debug|x64.ActiveCfg = Debug|x64 + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E}.Debug|x64.Build.0 = Debug|x64 + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E}.Release|x64.ActiveCfg = Release|x64 + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E}.Release|x64.Build.0 = Release|x64 {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Debug|x64.ActiveCfg = Debug|x64 {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Debug|x64.Build.0 = Debug|x64 {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Release|x64.ActiveCfg = Release|x64 @@ -50,6 +65,6 @@ Global EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution Qt5Version = 5.12.11_msvc2017_64 - SolutionGuid = {8EE248B0-4C13-40AC-84CA-48205CA73C54} + SolutionGuid = {97C1CCC6-7EFF-4E27-9BDF-6B5F591E7860} EndGlobalSection EndGlobal diff --git a/Testpad/Testpad.vcxproj b/Testpad/Testpad.vcxproj index 9885f5c..9e7698a 100644 --- a/Testpad/Testpad.vcxproj +++ b/Testpad/Testpad.vcxproj @@ -44,11 +44,11 @@ - debug\debug\Testpadtruerelease\release\Testpadtruefalse5.12.11_msvc2017_64core;xml5.12.11_msvc2017_64core;xml + debug\debug\Testpadtruerelease\release\Testpadtruefalse5.12.11_msvc2017_64core;xml;gui5.12.11_msvc2017_64core;xml;gui - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;release;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;release;/include;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) release\ false @@ -66,8 +66,8 @@ Level3 true - libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\release;%(AdditionalLibraryDirectories) + libConfig.lib;libProjectManager.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libConfig\release;D:\Projects\Cpp\QtNovelDesc\libProjectManager\release;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true false @@ -84,12 +84,12 @@ 0 - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;debug;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;debug;/include;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) debug\ false @@ -106,8 +106,8 @@ Level3 true - D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\debug;%(AdditionalLibraryDirectories) + D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;libProjectManager.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libConfig\debug;D:\Projects\Cpp\QtNovelDesc\libProjectManager\debug;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true true @@ -123,7 +123,7 @@ 0 - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index 34a6d00..36dfab2 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -9,13 +9,23 @@ CONFIG += c++11 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ - SensitiveFramework.cpp \ + ContentPresent.cpp \ + SensitiveCore.cpp \ + SourceEditView.cpp \ + chainhightlighter.cpp \ main.cpp \ - mainwindow.cpp + mainwindow.cpp \ + messagepresent.cpp \ + projectview.cpp HEADERS += \ - SensitiveFramework.h \ - mainwindow.h + ContentPresent.h \ + SensitiveCore.h \ + SourceEditView.h \ + chainhightlighter.h \ + mainwindow.h \ + messagepresent.h \ + projectview.h TRANSLATIONS += \ WordsIDE_zh_CN.ts diff --git a/WordsIDE/WordsIDE.vcxproj b/WordsIDE/WordsIDE.vcxproj index 7dc0825..b19d4fd 100644 --- a/WordsIDE/WordsIDE.vcxproj +++ b/WordsIDE/WordsIDE.vcxproj @@ -16,7 +16,8 @@ QtVS_v304 10.0.22621.0 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild + $(MSBuildProjectDirectory)\QtMsBuild + v141 @@ -36,7 +37,10 @@ debug\ WordsIDE - + + + + @@ -44,11 +48,38 @@ - debug\debug\WordsIDEtruerelease\release\WordsIDEtruefalse5.12.11_msvc2017_64core;gui;widgets5.12.11_msvc2017_64core;gui;widgets - + + + + + + debug\ + debug\ + WordsIDE + true + D:\Projects\Cpp\QtNovelDesc\libProjectManager\debug;D:\Projects\Cpp\QtNovelDesc\libParse\debug;D:\Projects\Cpp\QtNovelDesc\libConfig\debug;$(LibraryPath) + + + release\ + release\ + WordsIDE + true + false + + + 5.12.11_msvc2017_64 + core;xml;gui;widgets + + + 5.12.11_msvc2017_64 + core;xml;gui;widgets + + + + - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;..\libParse;release;/include;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) release\ false @@ -59,15 +90,17 @@ MaxSpeed _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) false - + + MultiThreadedDLL true true Level3 - true + true + - shell32.lib;%(AdditionalDependencies) - C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories) + libConfig.lib;libProjectManager.lib;libParse.lib;shell32.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libConfig\release;D:\Projects\Cpp\QtNovelDesc\libProjectManager\release;D:\Projects\Cpp\QtNovelDesc\libParse\release;C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true false @@ -84,12 +117,27 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppqmake_qmake_qm_filesdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + qmake_qmake_qm_files + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;/include;%(AdditionalIncludeDirectories) + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;..\libParse;debug;/include;%(AdditionalIncludeDirectories) -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) debug\ false @@ -104,10 +152,11 @@ true true Level3 - true + true + - shell32.lib;%(AdditionalDependencies) - C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories) + D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;libProjectManager.lib;libParse.lib;shell32.lib;%(AdditionalDependencies) + D:\Projects\Cpp\QtNovelDesc\libConfig\debug;D:\Projects\Cpp\QtNovelDesc\libProjectManager\debug;D:\Projects\Cpp\QtNovelDesc\libParse\debug;C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true true @@ -123,28 +172,45 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_WIDGETS_LIB;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppqmake_qmake_qm_filesdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp + + qmake_qmake_qm_files + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + + + + + + + + + - - - - - - - - + + + - - Document true @@ -161,8 +227,6 @@ release\moc_predefs.h;%(Outputs) true - - @@ -183,23 +247,10 @@ true - - - - - - - - - - - - - - - - - + + + + \ No newline at end of file diff --git a/WordsIDE/WordsIDE.vcxproj.filters b/WordsIDE/WordsIDE.vcxproj.filters index c199ee1..68d3f38 100644 --- a/WordsIDE/WordsIDE.vcxproj.filters +++ b/WordsIDE/WordsIDE.vcxproj.filters @@ -47,29 +47,55 @@ + + Source Files + + + Source Files + + + Source Files + Source Files Source Files + + Source Files + + + Source Files + + + Header Files + + + Header Files + + + Header Files + Header Files + + Header Files + + + Header Files + - - Generated Files Generated Files - - @@ -83,11 +109,5 @@ Resource Files - - Resource Files - - - Resource Files - \ No newline at end of file diff --git a/WordsIDE/main.cpp b/WordsIDE/main.cpp index dad6c42..11e1b4c 100644 --- a/WordsIDE/main.cpp +++ b/WordsIDE/main.cpp @@ -2,7 +2,9 @@ #include #include +#include #include +#include int main(int argc, char *argv[]) { diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index 9c052e4..ff407e8 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -1,3 +1,4 @@ +#include "SourceEditView.h" #include "mainwindow.h" #include @@ -10,10 +11,13 @@ #include #include #include +#include +#include using namespace Project; -using namespace Make; +using namespace MakeTools; using namespace Parse::Result; +using namespace Components; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -23,11 +27,12 @@ MainWindow::MainWindow(QWidget *parent) right_funcs(new QTabWidget(this)), center_funcs(new QTabWidget(this)), bottom_funcs(new QTabWidget(this)), - project_view(new QTreeView(this)), - errors_present(new QTableView(this)), project_manager(new XMLProjectManager(this)), syntax_core(new ParseCore()), - make_tool(new StoryTool(syntax_core)) + make_tool(new StoryTool(syntax_core)), + project_view(new ProjectView(project_manager, this)), + errors_present(new MessagePresent(make_tool, this)), + framework(new SensitiveCore(make_tool)) { setMinimumSize(1000, 600); setWindowTitle("提线木偶集成开发工具"); @@ -41,7 +46,22 @@ MainWindow::MainWindow(QWidget *parent) auto mbar = menuBar(); // 项目菜单树 auto project = mbar->addMenu("项目"); - auto _xnew = project->addMenu("新建文件"); + project->addAction("新建路径", [this](){ + auto packages = QInputDialog::getText(this, "输入包路径名称", "packagea#packageb#packagec"); + if(packages == "") + return; + + QList names; + QRegExp exp("([^#]+)"); + auto idx=0; + while ((idx = exp.indexIn(packages, idx)) != -1) { + names << exp.capturedTexts()[1]; + idx += names.last().length(); + } + + project_manager->newPath(names); + }); + auto _xnew = project->addMenu("最后卷新建文件"); _xnew->addAction("发展脉络"); _xnew->addAction("故事单元"); _xnew->addAction("故事大纲"); @@ -53,6 +73,7 @@ MainWindow::MainWindow(QWidget *parent) sav->setEnabled(false); connect(sav, &QAction::triggered, [this](){ this->project_manager->save(); + framework->saveAll(); }); project->addSeparator(); auto opnp = project->addAction("打开项目"); @@ -63,6 +84,8 @@ MainWindow::MainWindow(QWidget *parent) project_manager->openProject(file); sav->setEnabled(true); + + build_internal(true); }); auto newp = project->addAction("新建项目"); connect(newp, &QAction::triggered, [this, sav](){ @@ -85,7 +108,7 @@ MainWindow::MainWindow(QWidget *parent) project->addAction("项目配置"); project->addAction("软件配置"); project->addSeparator(); - project->addAction("退出"); + project->addAction("退出", [](){ QApplication::exit(0); }); // 编辑菜单 auto edit = mbar->addMenu("编辑"); @@ -172,17 +195,64 @@ MainWindow::MainWindow(QWidget *parent) center_funcs->addTab(new QTextEdit(this), "编辑区域"); left_funcs->addTab(project_view, "项目管理"); - project_view->setHeaderHidden(true); - project_view->setModel(project_manager->model()); + connect(project_view, &ProjectView::activeDocument, [this](const QString &file_path, const QString &name){ + if(framework->contains(file_path)) + return; + + VariedTextView *tview = nullptr; + if(file_path.endsWith("storychain")){ + tview = new Components::StoryChainSourceEdit(QFileInfo(file_path), this); + framework->addPerceptionList(tview); + auto doc = syntax_core->queryDocument(QFileInfo(file_path)); + tview->reset(doc); + } + else if(file_path.endsWith("storyunit")){ + tview = new Components::StoryUnitSourceEdit(QFileInfo(file_path), this); + framework->addPerceptionList(tview); + } + else if(file_path.endsWith("storyboard")){ + tview = new Components::StoryBoardSourceEdit(QFileInfo(file_path), this); + framework->addPerceptionList(tview); + } + else if(file_path.endsWith("storyvolume")){ + tview = new Components::StoryVolumeSourceEdit(QFileInfo(file_path), this); + framework->addPerceptionList(tview); + } + else{ + tview = new Components::TextContentEdit(QFileInfo(file_path), this); + framework->addPerceptionList(tview, SensitiveType::DoNothing); + } + if(tview == nullptr) + { + QMessageBox::critical(this, "系统错误", "指定文件类型没有确定编辑器"); + return; + } + + QFile fin(file_path); + if(!fin.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::critical(this, "系统错误", QString("无法打开指定文件:%1(%2)").arg(name, file_path)); + return; + } + + QTextStream tin(&fin); + tview->textContentReset(tin.readAll()); + + center_funcs->addTab(tview->textView(), name); + center_funcs->setCurrentWidget(tview->textView()); + }); bottom_funcs->addTab(errors_present, "错误列表"); + framework->addProcTrigger([this](){ errors_present->refresh(); }); } MainWindow::~MainWindow() { } -void MainWindow::build_internal() +void MainWindow::build_internal(bool all_from_disk) { + if(!all_from_disk) + framework->saveAll(); + auto chains = project_manager->filesWithEnds("storychain"); for(auto &it : chains) make_tool->compile(it); @@ -198,4 +268,17 @@ void MainWindow::build_internal() auto volumes = project_manager->filesWithEnds("storyvolume"); for(auto &it : volumes) make_tool->compile(it); + + errors_present->refresh(); +} + +void MainWindow::closeEvent(QCloseEvent *event) +{ + // 关闭事件 + if(project_manager->isOpen()){ + project_manager->save(); + framework->saveAll(); + } + + QMainWindow::closeEvent(event); } diff --git a/WordsIDE/mainwindow.h b/WordsIDE/mainwindow.h index 1c04f5d..a4b05af 100644 --- a/WordsIDE/mainwindow.h +++ b/WordsIDE/mainwindow.h @@ -7,6 +7,9 @@ #include #include #include +#include "SensitiveCore.h" +#include "messagepresent.h" +#include "projectview.h" class MainWindow : public QMainWindow { @@ -25,15 +28,21 @@ private: QTabWidget *const center_funcs; QTabWidget *const bottom_funcs; - QTreeView *const project_view; - QTableView *const errors_present; Project::ProjectManager *const project_manager; Parse::Result::ParseCore *const syntax_core; - Make::StoryTool *const make_tool; + MakeTools::StoryTool *const make_tool; + + Components::ProjectView *const project_view; + Components::MessagePresent *const errors_present; + + MakeTools::SensitiveCore *const framework; // 内部逻辑 =========================================== - void build_internal(); + void build_internal(bool all_from_disk = false); + // QWidget interface +protected: + virtual void closeEvent(QCloseEvent *event) override; }; #endif // MAINWINDOW_H diff --git a/libParse/libParse.vcxproj b/libParse/libParse.vcxproj new file mode 100644 index 0000000..3528e89 --- /dev/null +++ b/libParse/libParse.vcxproj @@ -0,0 +1,179 @@ + + + + + Release + x64 + + + Debug + x64 + + + + {BF0B8C4D-69F9-391A-85A1-237D14A69C5E} + libParse + QtVS_v304 + 10.0.22621.0 + 10.0.22621.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + v141 + release\ + false + NotSet + DynamicLibrary + release\ + libParse + + + v141 + debug\ + false + NotSet + DynamicLibrary + debug\ + libParse + + + + + + + + + + debug\debug\libParsetruerelease\release\libParsetruefalse5.12.11_msvc2017_64core5.12.11_msvc2017_64core + + + + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;%(AdditionalIncludeDirectories) + -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) + release\ + false + None + 4577;4467;%(DisableSpecificWarnings) + Sync + release\ + MaxSpeed + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPARSE_LIBRARY;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) + false + + MultiThreadedDLL + true + true + Level3 + true + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + false + true + true + false + $(OutDir)\libParse.dll + true + Windows + true + + + Unsigned + None + 0 + + + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPARSE_LIBRARY;QT_NO_DEBUG;QT_CORE_LIB;%(PreprocessorDefinitions) + + + + + GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;%(AdditionalIncludeDirectories) + -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) + debug\ + false + ProgramDatabase + 4577;4467;%(DisableSpecificWarnings) + Sync + debug\ + Disabled + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPARSE_LIBRARY;%(PreprocessorDefinitions) + false + MultiThreadedDebugDLL + true + true + Level3 + true + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + true + true + true + true + $(OutDir)\libParse.dll + true + Windows + true + + + Unsigned + None + 0 + + + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPARSE_LIBRARY;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + true + $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) + cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h + Generate moc_predefs.h + debug\moc_predefs.h;%(Outputs) + + + Document + $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) + cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h + Generate moc_predefs.h + release\moc_predefs.h;%(Outputs) + true + + + + + + + + \ No newline at end of file diff --git a/libParse/libParse.vcxproj.filters b/libParse/libParse.vcxproj.filters new file mode 100644 index 0000000..f048bba --- /dev/null +++ b/libParse/libParse.vcxproj.filters @@ -0,0 +1,125 @@ + + + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + cpp;c;cxx;moc;h;def;odl;idl;res; + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + cpp;c;cxx;moc;h;def;odl;idl;res; + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts;xlf + false + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts;xlf + false + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Generated Files + + + Generated Files + + + + + Translation Files + + + \ No newline at end of file diff --git a/libParse/libParse.vcxproj.user b/libParse/libParse.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/libParse/libParse.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/libProjectManager/libProjectManager.vcxproj b/libProjectManager/libProjectManager.vcxproj index c0c7e44..ebcef3e 100644 --- a/libProjectManager/libProjectManager.vcxproj +++ b/libProjectManager/libProjectManager.vcxproj @@ -86,7 +86,7 @@ _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;QT_NO_DEBUG;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - + iconsdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;debug;/include;%(AdditionalIncludeDirectories) @@ -125,7 +125,7 @@ _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;QT_GUI_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) - + iconsdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp @@ -151,10 +151,27 @@ release\moc_predefs.h;%(Outputs) true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libProjectManager/libProjectManager.vcxproj.filters b/libProjectManager/libProjectManager.vcxproj.filters index fa83d63..afe9133 100644 --- a/libProjectManager/libProjectManager.vcxproj.filters +++ b/libProjectManager/libProjectManager.vcxproj.filters @@ -17,6 +17,16 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx @@ -59,10 +69,23 @@ Generated Files + + Translation Files + + + Resource Files + + + Resource Files + + + Resource Files + + \ No newline at end of file