自动编译框架

This commit is contained in:
玉宇清音 2022-11-15 20:58:12 +08:00
parent 43e6daefec
commit f43a264c78
6 changed files with 56 additions and 31 deletions

View File

@ -8,16 +8,6 @@ CONFIG -= app_bundle
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
LexFoundation.cpp \
ParseFrame.cpp \
StoryBoardDocumentParser.cpp \
StoryChainDocumentParser.cpp \
StoryOutlineDocumentParser.cpp \
StoryTool.cpp \
StoryUnitDocumentParser.cpp \
SyntaxBase.cpp \
WordsPeak.cpp \
XSyntaxBase.cpp \
main.cpp
TRANSLATIONS += \
@ -31,20 +21,17 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
ComnDef.h \
LexFoundation.h \
ParseFrame.h \
StoryBoardDocumentParser.h \
StoryChainDocumentParser.h \
StoryOutlineDocumentParser.h \
StoryTool.h \
StoryUnitDocumentParser.h \
SyntaxBase.h \
WordsPeak.h \
XSyntaxBase.h
DISTFILES += \
example.storyboard \
example.storychain \
example.storyunit \
example.storyvolume
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libParse/release/ -llibParse
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libParse/debug/ -llibParse
else:unix: LIBS += -L$$OUT_PWD/../libParse/ -llibParse
INCLUDEPATH += $$PWD/../libParse
DEPENDPATH += $$PWD/../libParse

View File

@ -2,12 +2,7 @@
#include <QLocale>
#include <QTranslator>
#include <QDebug>
#include "StoryChainDocumentParser.h"
#include "StoryUnitDocumentParser.h"
#include "StoryBoardDocumentParser.h"
#include "StoryOutlineDocumentParser.h"
#include "ParseFrame.h"
#include "StoryTool.h"
#include <StoryTool.h>
using namespace Parse;
using namespace Parse::Result;
@ -41,7 +36,7 @@ int main(int argc, char *argv[])
// auto retlist = frame.analysis(&doc, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyboard");
ParseCore core("empty");
ParseCore core;
Make::StoryTool tool(&core);
auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyvolume";

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.0, 2022-11-15T01:50:08. -->
<!-- Written by QtCreator 4.15.0, 2022-11-15T20:57:04. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -9,10 +9,12 @@ CONFIG += c++11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
SensitiveFramework.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
SensitiveFramework.h \
mainwindow.h
TRANSLATIONS += \
@ -38,3 +40,10 @@ else:unix: LIBS += -L$$OUT_PWD/../libProjectManager/ -llibProjectManager
INCLUDEPATH += $$PWD/../libProjectManager
DEPENDPATH += $$PWD/../libProjectManager
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libParse/release/ -llibParse
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libParse/debug/ -llibParse
else:unix: LIBS += -L$$OUT_PWD/../libParse/ -llibParse
INCLUDEPATH += $$PWD/../libParse
DEPENDPATH += $$PWD/../libParse

View File

@ -12,6 +12,8 @@
#include <QInputDialog>
using namespace Project;
using namespace Make;
using namespace Parse::Result;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
@ -23,10 +25,12 @@ MainWindow::MainWindow(QWidget *parent)
bottom_funcs(new QTabWidget(this)),
project_view(new QTreeView(this)),
errors_present(new QTableView(this)),
project_manager(new XMLProjectManager(this))
project_manager(new XMLProjectManager(this)),
syntax_core(new ParseCore()),
make_tool(new StoryTool(syntax_core))
{
setMinimumSize(1000, 600);
setWindowTitle("提线木偶文学项目集成开发工具");
setWindowTitle("提线木偶集成开发工具");
auto xtool = new QToolBar(this);
addToolBar(Qt::ToolBarArea::TopToolBarArea, xtool);
@ -42,6 +46,7 @@ MainWindow::MainWindow(QWidget *parent)
_xnew->addAction("故事单元");
_xnew->addAction("故事大纲");
_xnew->addAction("叙事大纲");
_xnew->addSeparator();
_xnew->addAction("小说章节");
project->addSeparator();
auto sav = project->addAction("保存");
@ -137,6 +142,9 @@ MainWindow::MainWindow(QWidget *parent)
exp->addSeparator();
exp->addAction("导出TXT内容");
exp->addAction("导出TXT大纲");
tool->addAction("编译", [this](){
this->build_internal();
});
// 窗口菜单
auto window = mbar->addMenu("窗口");
@ -172,3 +180,22 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow()
{
}
void MainWindow::build_internal()
{
auto chains = project_manager->filesWithEnds("storychain");
for(auto &it : chains)
make_tool->compile(it);
auto units = project_manager->filesWithEnds("storyunit");
for(auto &it : units)
make_tool->compile(it);
auto storys = project_manager->filesWithEnds("storyboard");
for(auto &it : storys)
make_tool->compile(it);
auto volumes = project_manager->filesWithEnds("storyvolume");
for(auto &it : volumes)
make_tool->compile(it);
}

View File

@ -5,6 +5,7 @@
#include <QSplitter>
#include <QTableView>
#include <ProjectManager.h>
#include <StoryTool.h>
#include <QTreeView>
class MainWindow : public QMainWindow
@ -28,5 +29,11 @@ private:
QTableView *const errors_present;
Project::ProjectManager *const project_manager;
Parse::Result::ParseCore *const syntax_core;
Make::StoryTool *const make_tool;
// 内部逻辑 ===========================================
void build_internal();
};
#endif // MAINWINDOW_H