diff --git a/DesParser/DesParser.pro b/DesParser/DesParser.pro index 5067c9f..51c3d2e 100644 --- a/DesParser/DesParser.pro +++ b/DesParser/DesParser.pro @@ -30,6 +30,7 @@ DISTFILES += \ 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 diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index 85dba58..1182ea6 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/WordsIDE/SourceEditView.cpp b/WordsIDE/SourceEditView.cpp index 541f21b..915ec28 100644 --- a/WordsIDE/SourceEditView.cpp +++ b/WordsIDE/SourceEditView.cpp @@ -89,6 +89,14 @@ FormattedTextEdit::FormattedTextEdit() }); } +FormattedTextEdit::~FormattedTextEdit() +{ + if(edit_square){ + delete edit_square; + edit_square = nullptr; + } +} + void FormattedTextEdit::setContexMenuProcess(std::function exu) { this->ex_unit = exu; diff --git a/WordsIDE/SourceEditView.h b/WordsIDE/SourceEditView.h index 34a6fff..dc85e36 100644 --- a/WordsIDE/SourceEditView.h +++ b/WordsIDE/SourceEditView.h @@ -15,13 +15,12 @@ namespace Components { { public: FormattedTextEdit(); - virtual ~FormattedTextEdit() = default; + virtual ~FormattedTextEdit(); virtual void rehighlighter() = 0; virtual void setContexMenuProcess(std::function exu); virtual QTextCursor getTextCursor(); virtual void setTextCursor(QTextCursor s); - QTextEdit *const edit_square; // ModeView interface public: @@ -38,6 +37,7 @@ namespace Components { protected: QTextDocument *textDocument() const; + QTextEdit * edit_square; }; diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index edad0b8..5a98212 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -3,6 +3,7 @@ QT += core gui xml greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 +TARGET = Marionette # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index 2d90960..d59e158 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) this->app_core->setCurrentProject(project_manager); setMinimumSize(1000, 600); - setWindowTitle("提线木偶集成开发工具"); + setWindowTitle("提线木偶"); chains_view->setVisible(false); units_view->setVisible(false); @@ -135,6 +135,8 @@ MainWindow::MainWindow(QWidget *parent) sync_kernel->registerActionSync(clsp, [this]()->bool{return project_manager->isOpen();}); connect(clsp, &QAction::triggered, [this](){ this->project_manager->closeProject(); + this->app_core->getDocsManager()->closeAll(); + this->refresh_views(); }); project->addSeparator(); auto pcfg = project->addAction("项目配置"); @@ -365,12 +367,7 @@ MainWindow::MainWindow(QWidget *parent) }); this->app_core->getDocsManager()->addProcTrigger([this](){ - this->chains_view->refresh(); - this->units_view->refresh(); - this->errors_present->refresh(); - this->boards_view->refresh(); - this->concept_view->refresh(); - this->fragments_order->refresh(); + this->refresh_views(); }); @@ -405,6 +402,25 @@ void MainWindow::contentViewAppend(QWidget *widget, const QString &name) center_funcs->setCurrentWidget(widget); } +void MainWindow::contentViewClose(QWidget *widget) +{ + for(auto idx=0; idxcount(); ++idx){ + if(center_funcs->widget(idx) == widget){ + + } + } +} + +void MainWindow::refresh_views() +{ + errors_present->refresh(); + chains_view->refresh(); + units_view->refresh(); + boards_view->refresh(); + concept_view->refresh(); + fragments_order->refresh(); +} + void MainWindow::build_internal(bool all_from_disk) { if(!all_from_disk) @@ -430,12 +446,7 @@ void MainWindow::build_internal(bool all_from_disk) for(auto &it : concepts) app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it)); - errors_present->refresh(); - chains_view->refresh(); - units_view->refresh(); - boards_view->refresh(); - concept_view->refresh(); - fragments_order->refresh(); + refresh_views(); } void MainWindow::toggle_widget_visible(bool visible, QTabWidget *con, QWidget *target, const QString &title) @@ -512,7 +523,7 @@ void MainWindow::closeEvent(QCloseEvent *event) // 关闭事件 if(project_manager->isOpen()){ project_manager->save(); - app_core->getDocsManager()->saveAll(); + app_core->getDocsManager()->closeAll(); } uilayout_save(); diff --git a/WordsIDE/mainwindow.h b/WordsIDE/mainwindow.h index 2eb61d7..8eb0be9 100644 --- a/WordsIDE/mainwindow.h +++ b/WordsIDE/mainwindow.h @@ -28,6 +28,7 @@ public: ~MainWindow(); void contentViewAppend(QWidget *widget, const QString &name); + void contentViewClose(QWidget *widget); private: Core::AppCore *const app_core; @@ -53,6 +54,8 @@ private: Components::FragmentsOrderView *const fragments_order; // 内部逻辑 =========================================== + void refresh_views(); + void build_internal(bool all_from_disk = false); void toggle_widget_visible(bool visible, QTabWidget *con, QWidget *target, const QString& title=QString()); diff --git a/WordsIDE/storyunitsourceedit.cpp b/WordsIDE/storyunitsourceedit.cpp index 8c3d661..1abd2dc 100644 --- a/WordsIDE/storyunitsourceedit.cpp +++ b/WordsIDE/storyunitsourceedit.cpp @@ -26,6 +26,17 @@ StoryUnitSourceEdit::StoryUnitSourceEdit(FileExtensionFactory *factory) }); connect(edit_square, &QTextEdit::cursorPositionChanged, this, &StoryUnitSourceEdit::cursor_contex_query); + + auto vins = FormattedTextEdit::textView(); + split->addWidget(vins); + split->addWidget(this->refers_descriptions); +} + +StoryUnitSourceEdit::~StoryUnitSourceEdit() +{ + delete this->refers_descriptions; + + split->deleteLater(); } FileExtensionFactory *StoryUnitSourceEdit::factory() const @@ -205,9 +216,6 @@ void StoryUnitSourceEdit::resetProcsType(const QString &suffix) QWidget *StoryUnitSourceEdit::textView() const { - auto vins = FormattedTextEdit::textView(); - split->addWidget(vins); - split->addWidget(this->refers_descriptions); return split; } diff --git a/WordsIDE/storyunitsourceedit.h b/WordsIDE/storyunitsourceedit.h index b84d86d..f705aa5 100644 --- a/WordsIDE/storyunitsourceedit.h +++ b/WordsIDE/storyunitsourceedit.h @@ -24,6 +24,7 @@ namespace Components { { public: StoryUnitSourceEdit(Core::FileExtensionFactory *factory); + virtual ~StoryUnitSourceEdit(); // Plugin interface public: diff --git a/libParse/libParse.h b/libParse/libParse.h index 23301cc..87c706e 100644 --- a/libParse/libParse.h +++ b/libParse/libParse.h @@ -303,7 +303,6 @@ namespace Parse virtual ~ParseCore() = default; virtual void registerDoc(DocCore *ins); - virtual QList allDocuments() const; /** diff --git a/libParse/libParse.pro b/libParse/libParse.pro index ba0c488..79acc69 100644 --- a/libParse/libParse.pro +++ b/libParse/libParse.pro @@ -43,6 +43,8 @@ HEADERS += \ TRANSLATIONS += \ libParse_zh_CN.ts + + # Default rules for deployment. unix { target.path = /usr/lib diff --git a/libProjectManager/libProjectManager.pro b/libProjectManager/libProjectManager.pro index 221061d..e7ce6a4 100644 --- a/libProjectManager/libProjectManager.pro +++ b/libProjectManager/libProjectManager.pro @@ -21,6 +21,7 @@ HEADERS += \ TRANSLATIONS += \ libProjectManager_zh_CN.ts + # Default rules for deployment. unix { target.path = /usr/lib