diff --git a/QtNovelDesc.pro b/QtNovelDesc.pro index 40a1feb..ecb9006 100644 --- a/QtNovelDesc.pro +++ b/QtNovelDesc.pro @@ -3,7 +3,7 @@ TEMPLATE = subdirs SUBDIRS += \ libGenericConsole \ libSplitView \ - # WordsIDE \ + WordsIDE \ libConfig \ libProjectManager \ # libTextEdit \ diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index a257261..87d0d37 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -306,7 +306,80 @@ true D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/u_test - 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 + + 2 diff --git a/WordsIDE/DocsManager.cpp b/WordsIDE/DocsManager.cpp index bf1645b..713e926 100644 --- a/WordsIDE/DocsManager.cpp +++ b/WordsIDE/DocsManager.cpp @@ -6,7 +6,6 @@ #include #include -using namespace Components; using namespace Core; using namespace Presents; diff --git a/WordsIDE/DocsManager.h b/WordsIDE/DocsManager.h index 67136f5..1bd0fde 100644 --- a/WordsIDE/DocsManager.h +++ b/WordsIDE/DocsManager.h @@ -1,10 +1,11 @@ #ifndef DOCSMANAGER_H #define DOCSMANAGER_H -#include "route.h" +#include "Route.h" #include #include #include +#include namespace Core { class DocumentsManager; @@ -19,6 +20,12 @@ namespace Presents { public: explicit FilePresent(QObject *parent = nullptr); virtual ~FilePresent() = default; + + /** + * @brief 文件编辑菜单 + * @return + */ + virtual QMenu* bindMenu() const = 0; /** * @brief 获取实例的别名 diff --git a/WordsIDE/route.cpp b/WordsIDE/Route.cpp similarity index 98% rename from WordsIDE/route.cpp rename to WordsIDE/Route.cpp index fb3ef17..d0c3f77 100644 --- a/WordsIDE/route.cpp +++ b/WordsIDE/Route.cpp @@ -1,4 +1,4 @@ -#include "route.h" +#include "Route.h" using namespace Core; diff --git a/WordsIDE/route.h b/WordsIDE/Route.h similarity index 100% rename from WordsIDE/route.h rename to WordsIDE/Route.h diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index 72216ce..cd35d80 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -19,40 +19,38 @@ msvc { SOURCES += \ DocsManager.cpp \ + Route.cpp \ command_list.cpp \ # contentpresenttest.cpp \ # keywordshighlighter.cpp \ main.cpp \ mainwindow.cpp \ manager_docs.cpp \ - messageview.cpp \ + message_view.cpp \ parsebridge.cpp \ - presentcontainerview.cpp \ - projectview.cpp \ - route.cpp \ + present_container.cpp \ + project_view.cpp \ + session_binder.cpp \ srcedit_defaulttext.cpp \ srcedit_storyboard.cpp \ - viewsession.cpp \ - viewstackedbar.cpp \ welcomepanel.cpp \ xapp.cpp HEADERS += \ DocsManager.h \ + Route.h \ command_list.h \ # contentpresenttest.h \ # keywordshighlighter.h \ mainwindow.h \ manager_docs.h \ - messageview.h \ + message_view.h \ parsebridge.h \ - presentcontainerview.h \ - projectview.h \ - route.h \ + present_container.h \ + project_view.h \ + session_binder.h \ srcedit_defaulttext.h \ srcedit_storyboard.h \ - viewsession.h \ - viewstackedbar.h \ welcomepanel.h \ xapp.h diff --git a/WordsIDE/command_list.cpp b/WordsIDE/command_list.cpp index c8b3319..38c2c4c 100644 --- a/WordsIDE/command_list.cpp +++ b/WordsIDE/command_list.cpp @@ -1,6 +1,6 @@ #include "command_list.h" #include "manager_docs.h" -#include "route.h" +#include "Route.h" #include "DocsManager.h" using namespace CommandList; diff --git a/WordsIDE/command_list.h b/WordsIDE/command_list.h index 05576f3..47970c7 100644 --- a/WordsIDE/command_list.h +++ b/WordsIDE/command_list.h @@ -1,7 +1,7 @@ #ifndef COMMAND_LIST_H #define COMMAND_LIST_H -#include "route.h" +#include "Route.h" #include #include diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index 3ca4771..c500817 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -1,331 +1,331 @@ -#include "mainwindow.h" -#include "srcedit_defaulttext.h" -#include "srcedit_storyboard.h" -#include "xapp.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "command_list.h" - -using namespace Project; -using namespace Components; -using namespace Core; -using namespace CommandList; -using namespace bridge; - -MainWindow::MainWindow(XApp *core, const QString &layout, QWidget *parent) - : QMainWindow(parent), - layout_name_store(layout), - core_bind(core), - present_host(new SplitFrame::SplitPanel(this)), - session_service(new ViewSession(XApp::gconfig, this)), - actions_stack(new QToolBar(this)), - views_bar(new ViewStackedBar(present_host, this)), - center_frame(new PresentContainerView(present_host)), - project_present(new ProjectView(present_host, XApp::disp_core, core->docsManager())) { - setMinimumSize(1000, 600); - setWindowTitle(tr("提线木偶")); - - QApplication::instance()->installEventFilter(this); - auto mbar = menuBar(); - initial_menubar(mbar); - - setCentralWidget(present_host->bind()); - addToolBar(Qt::LeftToolBarArea, views_bar); - present_host->addListener(views_bar); - - session_service->initPresentView(center_frame, project_present, core->parseService()->errorsPresentModel()); - - project_present->setVisible(true); - core->docsManager()->appendPresent(center_frame); - - session_service->viewStatesRestore(this, present_host); -} - -MainWindow::~MainWindow() { core_bind->docsManager()->removePresent(center_frame); } - -SplitFrame::SplitPanel *MainWindow::bindPresent() const { return present_host; } - -QString MainWindow::layoutName() const { return layout_name_store; } - -void MainWindow::resetLayoutName(const QString &name) { layout_name_store = name; } - -void MainWindow::initial_menubar(QMenuBar *mbar) { - - // 项目菜单树 - project = mbar->addMenu("项目"); - this->build_project_menu(project); - - // 编辑菜单 - edit = mbar->addMenu("编辑"); - this->build_edit_menu(edit); - - // 视图菜单 - view = mbar->addMenu("视图"); - build_view_menu(view); - - // 工具菜单 - tool = mbar->addMenu("工具"); - build_tools_menu(tool); - - // 窗口菜单 - window = mbar->addMenu("窗口"); - build_window_menu(window); - - // 系统 - system = mbar->addMenu("系统"); - system_active = system->addAction("软件激活"); - system_info = system->addAction("系统信息"); - system->addSeparator(); - system_about = system->addAction("关于……"); -} - -auto action_sync = [](bool enable, const QList &same_state){ - for(auto &a : same_state) - a->setEnabled(enable); -}; - -void MainWindow::build_project_menu(QMenu *project) { - project_open = project->addAction("打开项目", [this]() { - auto file = QFileDialog::getOpenFileName(this, "打开项目", QString(), "小说项目(*.nsf)"); - if (file == "") - return; - - XApp::disp_core->postCommand(OpenProject(file)); - }); - - project_new = project->addAction("新建项目", [this]() { - auto name = QInputDialog::getText(this, "输入项目名称", "项目名称"); - if (name == "") - return; - auto dir_path = QFileDialog::getExistingDirectory(this, "指定项目存储路径"); - if (dir_path == "") - return; - - XApp::disp_core->postCommand(NewProject(QDir(dir_path), name)); - }); - - project_close = project->addAction("关闭项目", []() { XApp::disp_core->postCommand(CloseProject()); }); - - project->addSeparator(); - - project_newpath = project->addAction("新建路径", [this]() { - auto packages = QInputDialog::getText(this, "输入包路径名称/PackA/PackB/PackC", "包路径:"); - if (packages != "") - XApp::disp_core->postCommand(NewPackage(packages)); - }); - - project_newfile = project->addMenu("新建文件"); - auto types = core_bind->docsManager()->fileTypes(); - for (auto &t : types) { - project_newfile->addAction(t, [this, &t]() { - auto name = QInputDialog::getText(this, "输入名称", "名称:"); - if (name == "") - return; - - auto idx = project_present->currentIndex(); - if (!idx.isValid()) - idx = core_bind->pjtManager()->model()->item(0)->index(); - - auto group_path = core_bind->docsManager()->convertPath(idx); - XApp::disp_core->postCommand(NewFile(group_path, name, t)); - }); - } - - project->addSeparator(); - - project_save = project->addAction("保存全部", []() { XApp::disp_core->postCommand(SaveAll()); }); - project_save->setShortcut(QKeySequence::StandardKey::Save); - - project->addSeparator(); - - software_exit = project->addAction("退出", []() { - XApp::disp_core->postCommand(SaveAll()); - QApplication::exit(0); - }); - - this->hasBeenCLOSE(); -} - -void MainWindow::build_edit_menu(QMenu *edit) { - edit_undo = edit->addAction("撤销一步"); - edit_redo = edit->addAction("重做一步"); - edit->addSeparator(); - edit_find = edit->addAction("查找关键词"); - edit_replace = edit->addAction("替换关键词"); -} - -void MainWindow::build_view_menu(QMenu *view) { - view_area = view->addMenu("区域管理"); - - actions_stack->setMovable(false); - addToolBar(Qt::ToolBarArea::TopToolBarArea, actions_stack); - - view_area_toolbar = view_area->addAction("工具栏"); - - connect(view_area_toolbar, &QAction::triggered, [this](bool v) { actions_stack->setVisible(v); }); - - auto xstatus = statusBar(); - xstatus->setVisible(false); - xstatus->addWidget(new QLabel("文本消息", this)); - view_area_statusbar = view_area->addAction("状态栏"); - - connect(view_area_statusbar, &QAction::triggered, [xstatus](bool v) { xstatus->setVisible(v); }); - - view_config = view->addAction("视图配置", [this]() { - auto dialog = new QDialog(); - auto tabs = new QTabWidget(dialog); - auto layout = new QVBoxLayout(dialog); - layout->addWidget(tabs); - core_bind->docsManager()->loadViewConfigWidgets(tabs); - dialog->exec(); - }); -} - -void MainWindow::build_tools_menu(QMenu *tool) { - tool_console = tool->addAction("控制台"); - - tool->addSeparator(); - - tool_wcheck = tool->addMenu("敏感词检测"); - tool_wcheck_setting = tool_wcheck->addAction("工具配置"); - tool_wcheck_wordslist = tool_wcheck->addAction("敏感词编辑"); - - tool_version = tool->addMenu("版本管理"); - tool_version_setting = tool_version->addAction("工具配置"); - tool_version_enable = tool_version->addAction("启用"); - tool_version_commit = tool_version->addAction("提交版本"); - tool_version_rollback = tool_version->addAction("版本回滚"); - - tool_inout = tool->addMenu("导入导出"); - tool_inout_outline_in = tool_inout->addAction("导入WsOutlines"); - tool_inout->addSeparator(); - tool_inout_outline_out = tool_inout->addAction("导出WsOutlines"); - tool_inout_outline_webout = tool_inout->addAction("导出Web大纲"); - tool_inout->addSeparator(); - tool_inout_storytxt_out = tool_inout->addAction("导出TXT故事"); - tool_inout_storyepub_out = tool_inout->addAction("导出EQUP故事"); -} - -QList layout_peak_path = {"sys-configs", "foreground", "view-layouts"}; -void MainWindow::build_window_menu(QMenu *window) { - window_winnew = window->addMenu("新建窗口"); - connect(window_winnew, &QMenu::aboutToShow, [this]() { - auto names = XApp::gconfig->getList(layout_peak_path); - if (!names.size()) { - names << "default"; - XApp::gconfig->setList(layout_peak_path, names); - } - - window_winnew->clear(); - - for (auto &n : names) - window_winnew->addAction(n); - }); - connect(window_winnew, &QMenu::triggered, [this](QAction *s) { - auto layout = s->text(); - auto newone = new MainWindow(this->core_bind, layout); - newone->show(); - }); - - window_winclose = window->addAction("关闭窗口", [this]() { - XApp::disp_core->postCommand(SaveAll()); - this->close(); - }); - - window->addSeparator(); - window_layout_store = window->addAction("保存当前布局", [this]() { - auto new_name = QInputDialog::getText(this, "输入新布局名称", "名称:"); - if (new_name.isEmpty()) - return; - - auto names = XApp::gconfig->getList(layout_peak_path); - if (names.contains(new_name)) { - QMessageBox::critical(this, "数据校验", "输入错误,输入了重复的布局名称!"); - return; - } - names << new_name; - XApp::gconfig->setList(layout_peak_path, names); - - this->resetLayoutName(new_name); - session_service->viewStatesSave(this, this->present_host); - }); - - window_layout_load = window->addMenu("布局切换"); - window_layout_del = window->addMenu("布局删除"); -} - -void MainWindow::closeEvent(QCloseEvent *event) { - // 关闭事件 - if (core_bind->pjtManager()->isOpenning()) { - XApp::disp_core->postCommand(CloseProject()); - } - - session_service->viewStatesSave(this, present_host); - XApp::gconfig->save(); - QMainWindow::closeEvent(event); -} - -bool MainWindow::eventFilter(QObject *watched, QEvent *event) { - auto ev = event->type(); - switch (ev) { - case QEvent::Type::MouseButtonPress: - case QEvent::Type::MouseButtonRelease: - case QEvent::Type::Wheel: - case QEvent::Type::MouseMove: - case QEvent::Type::KeyPress: - case QEvent::Type::KeyRelease: - break; - default: - break; - } - return QMainWindow::eventFilter(watched, event); -} - -void MainWindow::ProjectNEW(const QString &) {} - -void MainWindow::ProjectOPEN(const QString &project_file) { - action_sync(false, {project_new, project_open}); - action_sync(true, {project_close, project_newpath, project_save}); - project_newfile->setEnabled(true); - - this->setWindowTitle(QString("WordIDE::%1 - %2").arg(this->core_bind->pjtManager()->name()).arg(project_file)); -} - -void MainWindow::hasBeenSAVE() {} - -void MainWindow::hasBeenCLOSE() { - action_sync(true, {project_open, project_new}); - action_sync(false, {project_close, project_newpath, project_save}); - project_newfile->setEnabled(false); - - this->setWindowTitle("WordIDE"); -} - -void MainWindow::hasBeenRENAME(const QModelIndex &path, const QString &new_name) {} - -void MainWindow::hasBeenAPPEND(const QModelIndex &new_path) {} - -void MainWindow::hasBeenMOVE(const QModelIndex &new_path) {} - -void MainWindow::aboutToBeSAVE() {} - -void MainWindow::aboutToBeCLOSE() {} - -void MainWindow::aboutToBeDELETE(const QModelIndex &path) {} - -void MainWindow::aboutToBeMOVE(const QModelIndex &old_path) {} +//#include "mainwindow.h" +//#include "srcedit_defaulttext.h" +//#include "srcedit_storyboard.h" +//#include "xapp.h" + +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include + +//#include "command_list.h" + +//using namespace Project; +//using namespace Components; +//using namespace Core; +//using namespace CommandList; +//using namespace bridge; + +//MainWindow::MainWindow(XApp *core, const QString &layout, QWidget *parent) +// : QMainWindow(parent), +// layout_name_store(layout), +// core_bind(core), +// present_host(new SplitFrame::SplitPanel(this)), +// session_service(new ViewSession(XApp::gconfig, this)), +// actions_stack(new QToolBar(this)), +// views_bar(new ViewStackedBar(present_host, this)), +// center_frame(new PresentContainer(present_host)), +// project_present(new ProjectView(present_host, XApp::disp_core, core->docsManager())) { +// setMinimumSize(1000, 600); +// setWindowTitle(tr("提线木偶")); + +// QApplication::instance()->installEventFilter(this); +// auto mbar = menuBar(); +// initial_menubar(mbar); + +// setCentralWidget(present_host->bind()); +// addToolBar(Qt::LeftToolBarArea, views_bar); +// present_host->addListener(views_bar); + +// session_service->initPresentView(center_frame, project_present, core->parseService()->errorsPresentModel()); + +// project_present->setVisible(true); +// core->docsManager()->appendPresent(center_frame); + +// session_service->viewStatesRestore(this, present_host); +//} + +//MainWindow::~MainWindow() { core_bind->docsManager()->removePresent(center_frame); } + +//SplitFrame::SplitPanel *MainWindow::bindPresent() const { return present_host; } + +//QString MainWindow::layoutName() const { return layout_name_store; } + +//void MainWindow::resetLayoutName(const QString &name) { layout_name_store = name; } + +//void MainWindow::initial_menubar(QMenuBar *mbar) { + +// // 项目菜单树 +// project = mbar->addMenu("项目"); +// this->build_project_menu(project); + +// // 编辑菜单 +// edit = mbar->addMenu("编辑"); +// this->build_edit_menu(edit); + +// // 视图菜单 +// view = mbar->addMenu("视图"); +// build_view_menu(view); + +// // 工具菜单 +// tool = mbar->addMenu("工具"); +// build_tools_menu(tool); + +// // 窗口菜单 +// window = mbar->addMenu("窗口"); +// build_window_menu(window); + +// // 系统 +// system = mbar->addMenu("系统"); +// system_active = system->addAction("软件激活"); +// system_info = system->addAction("系统信息"); +// system->addSeparator(); +// system_about = system->addAction("关于……"); +//} + +//auto action_sync = [](bool enable, const QList &same_state){ +// for(auto &a : same_state) +// a->setEnabled(enable); +//}; + +//void MainWindow::build_project_menu(QMenu *project) { +// project_open = project->addAction("打开项目", [this]() { +// auto file = QFileDialog::getOpenFileName(this, "打开项目", QString(), "小说项目(*.nsf)"); +// if (file == "") +// return; + +// XApp::disp_core->postCommand(OpenProject(file)); +// }); + +// project_new = project->addAction("新建项目", [this]() { +// auto name = QInputDialog::getText(this, "输入项目名称", "项目名称"); +// if (name == "") +// return; +// auto dir_path = QFileDialog::getExistingDirectory(this, "指定项目存储路径"); +// if (dir_path == "") +// return; + +// XApp::disp_core->postCommand(NewProject(QDir(dir_path), name)); +// }); + +// project_close = project->addAction("关闭项目", []() { XApp::disp_core->postCommand(CloseProject()); }); + +// project->addSeparator(); + +// project_newpath = project->addAction("新建路径", [this]() { +// auto packages = QInputDialog::getText(this, "输入包路径名称/PackA/PackB/PackC", "包路径:"); +// if (packages != "") +// XApp::disp_core->postCommand(NewPackage(packages)); +// }); + +// project_newfile = project->addMenu("新建文件"); +// auto types = core_bind->docsManager()->fileTypes(); +// for (auto &t : types) { +// project_newfile->addAction(t, [this, &t]() { +// auto name = QInputDialog::getText(this, "输入名称", "名称:"); +// if (name == "") +// return; + +// auto idx = project_present->currentIndex(); +// if (!idx.isValid()) +// idx = core_bind->pjtManager()->model()->item(0)->index(); + +// auto group_path = core_bind->docsManager()->convertPath(idx); +// XApp::disp_core->postCommand(NewFile(group_path, name, t)); +// }); +// } + +// project->addSeparator(); + +// project_save = project->addAction("保存全部", []() { XApp::disp_core->postCommand(SaveAll()); }); +// project_save->setShortcut(QKeySequence::StandardKey::Save); + +// project->addSeparator(); + +// software_exit = project->addAction("退出", []() { +// XApp::disp_core->postCommand(SaveAll()); +// QApplication::exit(0); +// }); + +// this->hasBeenCLOSE(); +//} + +//void MainWindow::build_edit_menu(QMenu *edit) { +// edit_undo = edit->addAction("撤销一步"); +// edit_redo = edit->addAction("重做一步"); +// edit->addSeparator(); +// edit_find = edit->addAction("查找关键词"); +// edit_replace = edit->addAction("替换关键词"); +//} + +//void MainWindow::build_view_menu(QMenu *view) { +// view_area = view->addMenu("区域管理"); + +// actions_stack->setMovable(false); +// addToolBar(Qt::ToolBarArea::TopToolBarArea, actions_stack); + +// view_area_toolbar = view_area->addAction("工具栏"); + +// connect(view_area_toolbar, &QAction::triggered, [this](bool v) { actions_stack->setVisible(v); }); + +// auto xstatus = statusBar(); +// xstatus->setVisible(false); +// xstatus->addWidget(new QLabel("文本消息", this)); +// view_area_statusbar = view_area->addAction("状态栏"); + +// connect(view_area_statusbar, &QAction::triggered, [xstatus](bool v) { xstatus->setVisible(v); }); + +// view_config = view->addAction("视图配置", [this]() { +// auto dialog = new QDialog(); +// auto tabs = new QTabWidget(dialog); +// auto layout = new QVBoxLayout(dialog); +// layout->addWidget(tabs); +// core_bind->docsManager()->loadViewConfigWidgets(tabs); +// dialog->exec(); +// }); +//} + +//void MainWindow::build_tools_menu(QMenu *tool) { +// tool_console = tool->addAction("控制台"); + +// tool->addSeparator(); + +// tool_wcheck = tool->addMenu("敏感词检测"); +// tool_wcheck_setting = tool_wcheck->addAction("工具配置"); +// tool_wcheck_wordslist = tool_wcheck->addAction("敏感词编辑"); + +// tool_version = tool->addMenu("版本管理"); +// tool_version_setting = tool_version->addAction("工具配置"); +// tool_version_enable = tool_version->addAction("启用"); +// tool_version_commit = tool_version->addAction("提交版本"); +// tool_version_rollback = tool_version->addAction("版本回滚"); + +// tool_inout = tool->addMenu("导入导出"); +// tool_inout_outline_in = tool_inout->addAction("导入WsOutlines"); +// tool_inout->addSeparator(); +// tool_inout_outline_out = tool_inout->addAction("导出WsOutlines"); +// tool_inout_outline_webout = tool_inout->addAction("导出Web大纲"); +// tool_inout->addSeparator(); +// tool_inout_storytxt_out = tool_inout->addAction("导出TXT故事"); +// tool_inout_storyepub_out = tool_inout->addAction("导出EQUP故事"); +//} + +//QList layout_peak_path = {"sys-configs", "foreground", "view-layouts"}; +//void MainWindow::build_window_menu(QMenu *window) { +// window_winnew = window->addMenu("新建窗口"); +// connect(window_winnew, &QMenu::aboutToShow, [this]() { +// auto names = XApp::gconfig->getList(layout_peak_path); +// if (!names.size()) { +// names << "default"; +// XApp::gconfig->setList(layout_peak_path, names); +// } + +// window_winnew->clear(); + +// for (auto &n : names) +// window_winnew->addAction(n); +// }); +// connect(window_winnew, &QMenu::triggered, [this](QAction *s) { +// auto layout = s->text(); +// auto newone = new MainWindow(this->core_bind, layout); +// newone->show(); +// }); + +// window_winclose = window->addAction("关闭窗口", [this]() { +// XApp::disp_core->postCommand(SaveAll()); +// this->close(); +// }); + +// window->addSeparator(); +// window_layout_store = window->addAction("保存当前布局", [this]() { +// auto new_name = QInputDialog::getText(this, "输入新布局名称", "名称:"); +// if (new_name.isEmpty()) +// return; + +// auto names = XApp::gconfig->getList(layout_peak_path); +// if (names.contains(new_name)) { +// QMessageBox::critical(this, "数据校验", "输入错误,输入了重复的布局名称!"); +// return; +// } +// names << new_name; +// XApp::gconfig->setList(layout_peak_path, names); + +// this->resetLayoutName(new_name); +// session_service->viewStatesSave(this, this->present_host); +// }); + +// window_layout_load = window->addMenu("布局切换"); +// window_layout_del = window->addMenu("布局删除"); +//} + +//void MainWindow::closeEvent(QCloseEvent *event) { +// // 关闭事件 +// if (core_bind->pjtManager()->isOpenning()) { +// XApp::disp_core->postCommand(CloseProject()); +// } + +// session_service->viewStatesSave(this, present_host); +// XApp::gconfig->save(); +// QMainWindow::closeEvent(event); +//} + +//bool MainWindow::eventFilter(QObject *watched, QEvent *event) { +// auto ev = event->type(); +// switch (ev) { +// case QEvent::Type::MouseButtonPress: +// case QEvent::Type::MouseButtonRelease: +// case QEvent::Type::Wheel: +// case QEvent::Type::MouseMove: +// case QEvent::Type::KeyPress: +// case QEvent::Type::KeyRelease: +// break; +// default: +// break; +// } +// return QMainWindow::eventFilter(watched, event); +//} + +//void MainWindow::ProjectNEW(const QString &) {} + +//void MainWindow::ProjectOPEN(const QString &project_file) { +// action_sync(false, {project_new, project_open}); +// action_sync(true, {project_close, project_newpath, project_save}); +// project_newfile->setEnabled(true); + +// this->setWindowTitle(QString("WordIDE::%1 - %2").arg(this->core_bind->pjtManager()->name()).arg(project_file)); +//} + +//void MainWindow::hasBeenSAVE() {} + +//void MainWindow::hasBeenCLOSE() { +// action_sync(true, {project_open, project_new}); +// action_sync(false, {project_close, project_newpath, project_save}); +// project_newfile->setEnabled(false); + +// this->setWindowTitle("WordIDE"); +//} + +//void MainWindow::hasBeenRENAME(const QModelIndex &path, const QString &new_name) {} + +//void MainWindow::hasBeenAPPEND(const QModelIndex &new_path) {} + +//void MainWindow::hasBeenMOVE(const QModelIndex &new_path) {} + +//void MainWindow::aboutToBeSAVE() {} + +//void MainWindow::aboutToBeCLOSE() {} + +//void MainWindow::aboutToBeDELETE(const QModelIndex &path) {} + +//void MainWindow::aboutToBeMOVE(const QModelIndex &old_path) {} diff --git a/WordsIDE/mainwindow.h b/WordsIDE/mainwindow.h index 1481712..26baaba 100644 --- a/WordsIDE/mainwindow.h +++ b/WordsIDE/mainwindow.h @@ -1,128 +1,128 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +//#ifndef MAINWINDOW_H +//#define MAINWINDOW_H -#include "DocsManager.h" -#include "manager_docs.h" -#include "messageview.h" -#include "parsebridge.h" -#include "presentcontainerview.h" -#include "projectview.h" -#include "viewsession.h" -#include "viewstackedbar.h" -#include "welcomepanel.h" -#include "xapp.h" -#include -#include -#include -#include -#include -#include -#include +//#include "DocsManager.h" +//#include "manager_docs.h" +//#include "MessageView.h" +//#include "parsebridge.h" +//#include "PresentContainer.h" +//#include "ProjectView.h" +//#include "viewsession.h" +//#include "viewstackedbar.h" +//#include "welcomepanel.h" +//#include "xapp.h" +//#include +//#include +//#include +//#include +//#include +//#include +//#include -class MainWindow : public QMainWindow , public Project::ManagerListener{ - Q_OBJECT +//class MainWindow : public QMainWindow , public Project::ManagerListener{ +// Q_OBJECT -public: - MainWindow(XApp *core, const QString &layout, QWidget *parent = nullptr); - virtual ~MainWindow(); +//public: +// MainWindow(XApp *core, const QString &layout, QWidget *parent = nullptr); +// virtual ~MainWindow(); - SplitFrame::SplitPanel *bindPresent() const; - QString layoutName() const; - void resetLayoutName(const QString &name); +// SplitFrame::SplitPanel *bindPresent() const; +// QString layoutName() const; +// void resetLayoutName(const QString &name); -private: - QString layout_name_store; - // model ============================================ - XApp *const core_bind; - SplitFrame::SplitPanel *const present_host; - Core::ViewSession *const session_service; +//private: +// QString layout_name_store; +// // model ============================================ +// XApp *const core_bind; +// SplitFrame::SplitPanel *const present_host; +// Core::ViewSession *const session_service; - // view ============================================= - QToolBar *const actions_stack; - Components::ViewStackedBar *const views_bar; - Components::PresentContainerView *const center_frame; - Components::ProjectView *const project_present; +// // view ============================================= +// QToolBar *const actions_stack; +// Components::ViewStackedBar *const views_bar; +// Components::PresentContainer *const center_frame; +// Components::ProjectView *const project_present; - // menu ============================================= - QMenu *project; - QAction *project_open; - QAction *project_new; - QAction *project_close; - QAction *project_newpath; - QMenu *project_newfile; - QAction *project_save; - QAction *software_exit; +// // menu ============================================= +// QMenu *project; +// QAction *project_open; +// QAction *project_new; +// QAction *project_close; +// QAction *project_newpath; +// QMenu *project_newfile; +// QAction *project_save; +// QAction *software_exit; - QMenu *edit; - QAction *edit_undo; - QAction *edit_redo; - QAction *edit_find; - QAction *edit_replace; +// QMenu *edit; +// QAction *edit_undo; +// QAction *edit_redo; +// QAction *edit_find; +// QAction *edit_replace; - QMenu *view; - QMenu *view_area; - QAction *view_area_toolbar; - QAction *view_area_statusbar; - QAction *view_config; +// QMenu *view; +// QMenu *view_area; +// QAction *view_area_toolbar; +// QAction *view_area_statusbar; +// QAction *view_config; - QMenu *tool; - QAction *tool_console; - QMenu *tool_wcheck; - QAction *tool_wcheck_setting; - QAction *tool_wcheck_wordslist; - QMenu *tool_version; - QAction *tool_version_enable; - QAction *tool_version_setting; - QAction *tool_version_commit; - QAction *tool_version_rollback; - QMenu *tool_inout; - QAction *tool_inout_outline_in; - QAction *tool_inout_outline_out; - QAction *tool_inout_outline_webout; - QAction *tool_inout_storytxt_out; - QAction *tool_inout_storyepub_out; +// QMenu *tool; +// QAction *tool_console; +// QMenu *tool_wcheck; +// QAction *tool_wcheck_setting; +// QAction *tool_wcheck_wordslist; +// QMenu *tool_version; +// QAction *tool_version_enable; +// QAction *tool_version_setting; +// QAction *tool_version_commit; +// QAction *tool_version_rollback; +// QMenu *tool_inout; +// QAction *tool_inout_outline_in; +// QAction *tool_inout_outline_out; +// QAction *tool_inout_outline_webout; +// QAction *tool_inout_storytxt_out; +// QAction *tool_inout_storyepub_out; - QMenu *window; - QMenu *window_winnew; - QAction *window_winclose; - QAction *window_layout_store; - QMenu *window_layout_load; - QMenu *window_layout_del; +// QMenu *window; +// QMenu *window_winnew; +// QAction *window_winclose; +// QAction *window_layout_store; +// QMenu *window_layout_load; +// QMenu *window_layout_del; - QMenu *system; - QAction *system_active; - QAction *system_info; - QAction *system_about; +// QMenu *system; +// QAction *system_active; +// QAction *system_info; +// QAction *system_about; - // 内部逻辑 =========================================== +// // 内部逻辑 =========================================== - void initial_menubar(QMenuBar *mbar); - void build_project_menu(QMenu *pmenu); - void build_edit_menu(QMenu *pmenu); - void build_view_menu(QMenu *pmenu); - void build_tools_menu(QMenu *pmenu); - void build_window_menu(QMenu *pmenu); +// void initial_menubar(QMenuBar *mbar); +// void build_project_menu(QMenu *pmenu); +// void build_edit_menu(QMenu *pmenu); +// void build_view_menu(QMenu *pmenu); +// void build_tools_menu(QMenu *pmenu); +// void build_window_menu(QMenu *pmenu); - // QWidget interface -protected: - virtual void closeEvent(QCloseEvent *event) override; +// // QWidget interface +//protected: +// virtual void closeEvent(QCloseEvent *event) override; - // QObject interface - public: - virtual bool eventFilter(QObject *watched, QEvent *event) override; +// // QObject interface +// public: +// virtual bool eventFilter(QObject *watched, QEvent *event) override; - // Project::ManagerListener interface -public: - virtual void ProjectNEW(const QString &project_file) override; - virtual void ProjectOPEN(const QString &project_file) override; - virtual void hasBeenSAVE() override; - virtual void hasBeenCLOSE() override; - virtual void hasBeenRENAME(const QModelIndex &path, const QString &new_name) override; - virtual void hasBeenAPPEND(const QModelIndex &new_path) override; - virtual void hasBeenMOVE(const QModelIndex &new_path) override; - virtual void aboutToBeSAVE() override; - virtual void aboutToBeCLOSE() override; - virtual void aboutToBeDELETE(const QModelIndex &path) override; - virtual void aboutToBeMOVE(const QModelIndex &old_path) override; -}; -#endif // MAINWINDOW_H +// // Project::ManagerListener interface +//public: +// virtual void ProjectNEW(const QString &project_file) override; +// virtual void ProjectOPEN(const QString &project_file) override; +// virtual void hasBeenSAVE() override; +// virtual void hasBeenCLOSE() override; +// virtual void hasBeenRENAME(const QModelIndex &path, const QString &new_name) override; +// virtual void hasBeenAPPEND(const QModelIndex &new_path) override; +// virtual void hasBeenMOVE(const QModelIndex &new_path) override; +// virtual void aboutToBeSAVE() override; +// virtual void aboutToBeCLOSE() override; +// virtual void aboutToBeDELETE(const QModelIndex &path) override; +// virtual void aboutToBeMOVE(const QModelIndex &old_path) override; +//}; +//#endif // MAINWINDOW_H diff --git a/WordsIDE/manager_docs.h b/WordsIDE/manager_docs.h index 7314f47..f542164 100644 --- a/WordsIDE/manager_docs.h +++ b/WordsIDE/manager_docs.h @@ -2,7 +2,7 @@ #define MANAGER_DOCS_H #include "DocsManager.h" -#include "route.h" +#include "Route.h" #include #include @@ -11,16 +11,33 @@ #include namespace Presents { + + class HostListener{ + public: + virtual ~HostListener() = default; + virtual void currentChanged(const Presents::FilePresent *inst) = 0; + }; class PresentHost { public: virtual ~PresentHost() = default; + /** + * @brief addListener + * @param lst + */ + virtual void addListener(HostListener *lst) = 0; /** * @brief 承载内容的Widget * @return */ virtual QWidget *hostWidget() const = 0; + + /** + * @brief 当前文件视图 + * @return + */ + virtual Presents::FilePresent* currentPresent() const = 0; /** * @brief 是否可以放置此视图 diff --git a/WordsIDE/message_view.cpp b/WordsIDE/message_view.cpp new file mode 100644 index 0000000..9be1127 --- /dev/null +++ b/WordsIDE/message_view.cpp @@ -0,0 +1,55 @@ +#include "message_view.h" + +#include +#include + +using namespace Components; + +MessageView::MessageView() : MessageView(nullptr, nullptr) {} + +MessageView::MessageView(QWidget *parent, XApp *core) : QTableView(parent), menu(core ? new QMenu("编译输出",this) : nullptr) { + if(core){ + setModel(core->messageModel()); + menu->addAction("清除信息", [core](){ + auto model = core->messageModel(); + while (model->rowCount()) { + model->removeRow(0); + } + }); + } +} + +ExtendView *MessageView::newInst(QWidget *parent, XApp *core) +{ + return new MessageView(parent, core); +} + +QMenu *MessageView::bindMenu() const +{ + return menu; +} + +QString MessageView::typeName() const +{ + return "编译输出"; +} + +ExtendType MessageView::type() const +{ + return ExtendType::FEATURE_PRESENT; +} + +QWidget *MessageView::presentWidget() const +{ + return const_cast(this); +} + +void MessageView::saveProcess() +{ + +} + +void MessageView::closeProcess() +{ + +} diff --git a/WordsIDE/message_view.h b/WordsIDE/message_view.h new file mode 100644 index 0000000..2eded7b --- /dev/null +++ b/WordsIDE/message_view.h @@ -0,0 +1,87 @@ +#ifndef MESSAGE_VIEW_H +#define MESSAGE_VIEW_H + +#include "DocsManager.h" +#include +#include +#include +#include +#include "xapp.h" + +namespace Components { + + enum class ExtendType{ + FEATURE_PRESENT, + VIEW_CONTAINTER + }; + + /** + * @brief 拓展视图 + */ + class ExtendView { + public: + virtual ~ExtendView() = default; + + /** + * @brief 创建新实例 + * @param parent 父实例 + * @param core 核心数据模型 + * @return + */ + virtual ExtendView* newInst(QWidget *parent, XApp *core) = 0; + /** + * @brief 获取指定视图的绑定菜单 + * @return + */ + virtual QMenu* bindMenu() const = 0; + /** + * @brief 视图类型名称 + * @return + */ + virtual QString typeName() const = 0; + /** + * @brief 视图类型 + * @return + */ + virtual ExtendType type() const = 0; + /** + * @brief 视图呈现组件 + * @return + */ + virtual QWidget* presentWidget() const = 0; + /** + * @brief 保存操作 + */ + virtual void saveProcess() = 0; + /** + * @brief 关闭操作 + */ + virtual void closeProcess() = 0; + }; + + /** + * @brief 消息视图 + */ + class MessageView : public QTableView, public ExtendView { + public: + MessageView(); + MessageView(QWidget*parent = nullptr, XApp *core = nullptr); + virtual ~MessageView() = default; + + // ExtendView interface + public: + virtual ExtendView *newInst(QWidget *parent, XApp *core) override; + virtual QMenu *bindMenu() const override; + virtual QString typeName() const override; + virtual ExtendType type() const override; + virtual QWidget* presentWidget() const override; + virtual void saveProcess() override; + virtual void closeProcess() override; + + private: + QMenu *const menu; + + }; +} // namespace Components + +#endif // MESSAGE_VIEW_H diff --git a/WordsIDE/messageview.cpp b/WordsIDE/messageview.cpp deleted file mode 100644 index 7b3819f..0000000 --- a/WordsIDE/messageview.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "messageview.h" - -#include - -using namespace Components; -using namespace SplitFrame; - -QHash MessageView::panel_map; - -MessageView::MessageView(SplitFrame::SplitPanel *ins, QStandardItemModel *base) - : FnWrap(ins), ui_present(new QTableView(this)), items_present(base) { - auto layout = new QVBoxLayout(this); - layout->setMargin(0); - layout->setSpacing(0); - - layout->addWidget(ui_present); - ui_present->setModel(items_present); - ui_present->setMouseTracking(true); -} - -MessageView *MessageView::gen(SplitFrame::SplitPanel *host, QStandardItemModel *base) { - if (panel_map.contains(host)) - return panel_map[host]; - - auto vins = new MessageView(host, base); - panel_map[host] = vins; - return vins; -} diff --git a/WordsIDE/messageview.h b/WordsIDE/messageview.h deleted file mode 100644 index eeee3fa..0000000 --- a/WordsIDE/messageview.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MESSAGEVIEW_H -#define MESSAGEVIEW_H - -#include "DocsManager.h" -#include -#include -#include -#include - -namespace Components { - /** - * @brief 显示各种提示信息 - */ - class MessageView : public SplitFrame::FnWrap { - public: - virtual ~MessageView() = default; - - static MessageView *gen(SplitFrame::SplitPanel *host, QStandardItemModel *base); - - private: - MessageView(SplitFrame::SplitPanel *ins, QStandardItemModel *base); - - QTableView *const ui_present; - QStandardItemModel *const items_present; - static QHash panel_map; - }; -} // namespace Components - -#endif // MESSAGEVIEW_H diff --git a/WordsIDE/presentcontainerview.cpp b/WordsIDE/present_container.cpp similarity index 74% rename from WordsIDE/presentcontainerview.cpp rename to WordsIDE/present_container.cpp index f8d5eeb..0f53ff1 100644 --- a/WordsIDE/presentcontainerview.cpp +++ b/WordsIDE/present_container.cpp @@ -1,4 +1,4 @@ -#include "presentcontainerview.h" +#include "present_container.h" #include "DocsManager.h" #include "welcomepanel.h" @@ -10,11 +10,10 @@ using namespace Components; using namespace Core; -using namespace SplitFrame; using namespace Presents; -PresentContainerView::PresentContainerView(SplitPanel *host) - : FnWrap(host), +PresentContainer::PresentContainer(QWidget *ptr) + : QWidget(ptr), title_store(new QComboBox(this)), stack_container(new QStackedWidget(this)), welcome_list(new WelcomePanel(this)), @@ -40,16 +39,24 @@ PresentContainerView::PresentContainerView(SplitPanel *host) layout->setColumnStretch(2, 1); layout->setColumnStretch(3, 0); - connect(title_store, QOverload::of(&QComboBox::currentIndexChanged), this, &PresentContainerView::change_view); - connect(close_btn, &QPushButton::toggled, this, &PresentContainerView::close_current_view); + connect(title_store, QOverload::of(&QComboBox::currentIndexChanged), this, &PresentContainer::change_view); + connect(close_btn, &QPushButton::toggled, this, &PresentContainer::close_current_view); + + connect(stack_container, &QStackedWidget::currentChanged, [this](int idx){ + if(idx >= 0){ + auto inst = items_store.at(idx); + for(auto &l : listeners_store) + l->currentChanged(inst); + } + }); } -QWidget *PresentContainerView::hostWidget() const { return (QWidget *)this; } +QWidget *PresentContainer::hostWidget() const { return (QWidget *)this; } #include using namespace Config; -void PresentContainerView::append(FilePresent *ins) { +void PresentContainer::append(FilePresent *ins) { if (!items_store.contains(ins)) { items_store.append(ins); title_store->addItem(ins->name()); @@ -62,7 +69,7 @@ void PresentContainerView::append(FilePresent *ins) { } #include -bool PresentContainerView::active(const FilePresent *ins) { +bool PresentContainer::active(const FilePresent *ins) { if (!items_store.contains(ins)) return false; @@ -73,7 +80,7 @@ bool PresentContainerView::active(const FilePresent *ins) { return true; } -void PresentContainerView::remove(const FilePresent *ins) { +void PresentContainer::remove(const FilePresent *ins) { if (!items_store.contains(ins)) return; @@ -83,7 +90,7 @@ void PresentContainerView::remove(const FilePresent *ins) { stack_container->removeWidget(ins->widget()); } -bool PresentContainerView::contains(const FilePresent *ins) const { +bool PresentContainer::contains(const FilePresent *ins) const { for (auto &insit : items_store) { if (insit == ins) return true; @@ -91,14 +98,14 @@ bool PresentContainerView::contains(const FilePresent *ins) const { return false; } -bool PresentContainerView::avaliable(FilePresent *vins) { +bool PresentContainer::avaliable(FilePresent *vins) { auto global_test = QApplication::activeWindow(); if (!global_test) return true; return this->isActiveWindow(); } -void PresentContainerView::change_view(int view_index) { +void PresentContainer::change_view(int view_index) { auto view_inst = items_store[view_index]; active(view_inst); @@ -106,7 +113,7 @@ void PresentContainerView::change_view(int view_index) { } #include -void PresentContainerView::close_current_view() { +void PresentContainer::close_current_view() { auto index = title_store->currentIndex(); const_cast(items_store[index])->beforeClose(); } diff --git a/WordsIDE/presentcontainerview.h b/WordsIDE/present_container.h similarity index 50% rename from WordsIDE/presentcontainerview.h rename to WordsIDE/present_container.h index 4e9e59b..d50ada7 100644 --- a/WordsIDE/presentcontainerview.h +++ b/WordsIDE/present_container.h @@ -1,12 +1,13 @@ -#ifndef PRESENTCONTAINERVIEW_H -#define PRESENTCONTAINERVIEW_H +#ifndef PRESENT_CONTAINER_H +#define PRESENT_CONTAINER_H #include "manager_docs.h" #include #include #include #include -#include +#include +#include "message_view.h" namespace Presents { class WelcomePanel; @@ -15,24 +16,37 @@ namespace Presents { namespace Components { /** - * @brief 文档视图容器 - */ - class PresentContainerView : public SplitFrame::FnWrap, public Presents::PresentHost { + * @brief 内容视图容器 + */ + class PresentContainer : public QWidget ,public ExtendView, public Presents::PresentHost { Q_OBJECT public: - PresentContainerView(SplitFrame::SplitPanel *host); - - // PresentContainer interface + PresentContainer(QWidget *ptr = nullptr); + + // PresentHost interface public: virtual QWidget *hostWidget() const override; - + + virtual void addListener(Presents::HostListener *lst) override; virtual void append(Presents::FilePresent *ins) override; virtual bool active(const Presents::FilePresent *ins) override; virtual void remove(const Presents::FilePresent *ins) override; virtual bool contains(const Presents::FilePresent *ins) const override; virtual bool avaliable(Presents::FilePresent *vins) override; + virtual Presents::FilePresent *currentPresent() const override; + + // ExtendView interface + public: + virtual ExtendView *newInst(QWidget *parent, XApp *core) override; + virtual QMenu *bindMenu() const override; + virtual QString typeName() const override; + virtual ExtendType type() const override; + virtual QWidget *presentWidget() const override; + virtual void saveProcess() override; + virtual void closeProcess() override; private: + QList listeners_store; QList items_store; QComboBox *const title_store; QStackedWidget *const stack_container; @@ -42,8 +56,9 @@ namespace Components { void change_view(int view_index); void close_current_view(); + }; } // namespace Components -#endif // PRESENTCONTAINERVIEW_H +#endif // PRESENT_CONTAINER_H diff --git a/WordsIDE/project_view.cpp b/WordsIDE/project_view.cpp new file mode 100644 index 0000000..6101b6b --- /dev/null +++ b/WordsIDE/project_view.cpp @@ -0,0 +1,104 @@ +#include "project_view.h" +#include "command_list.h" + +#include +#include +#include + +using namespace Components; +using namespace CommandList; +using namespace Schedule; +using namespace Core; + +ProjectView::ProjectView(QWidget *parent, CommandsDispatcher *core, Core::DocumentsManager *mgr) + : QWidget(parent), project_manager(mgr), source(core), view_present(new QTreeView(this)), menu_root(new QMenu("项目管理")) { + auto layout = new QVBoxLayout(this); + layout->addWidget(view_present); + layout->setMargin(1); + + this->menGenerate(menu_root); + + view_present->setModel(mgr->projectManager()->model()); + view_present->setHeaderHidden(true); + + view_present->setContextMenuPolicy(Qt::CustomContextMenu); + connect(view_present, &QTreeView::customContextMenuRequested, this, &ProjectView::menu_popup); + connect(view_present, &QTreeView::doubleClicked, this, &ProjectView::open_target); + connect(view_present->selectionModel(), &QItemSelectionModel::currentChanged, this, &ProjectView::currentIndexChanged); +} + +QMenu *ProjectView::menGenerate(QMenu *m) +{ + if(!m) + return menu_root; + + m->addAction("新建路径", [this](){ + auto path_string = QInputDialog::getText(this, "输入路径定义/packa/packb/packc", "路径定义:"); + if(path_string.isEmpty()) + return; + + source->postCommand(NewPackage(path_string)); + }); + + auto index = this->view_present->currentIndex(); + if(index.isValid()){ + auto mgr = source->get(NAME(DocumentsManager)); + auto menu = m->addMenu("新建文件"); + auto views = mgr->fileTypes(); + for (auto &it : views) { + menu->addAction(it, [this, it, &index, mgr]() { + auto name = QInputDialog::getText(this, "输入文件名称", "文件名称"); + auto path = mgr->convertPath(index); + source->postCommand(NewFile(path, name, it)); + }); + } + + m->addSeparator(); + m->addAction("移除节点", [&index, this]() { source->postCommand(DeleteTarget(index)); }); + } + return m; +} + +ProjectView::ProjectView() : project_manager(nullptr), source(nullptr), view_present(nullptr), menu_root(nullptr) {} + +ExtendView *ProjectView::newInst(QWidget *parent, XApp *core) +{ + return new ProjectView(parent, core->cmdsPort(), core->docsPort()); +} + +QMenu *ProjectView::bindMenu() const +{ + return menu_root; +} + +QString ProjectView::typeName() const +{ + return "项目管理"; +} + +ExtendType ProjectView::type() const +{ + return ExtendType::FEATURE_PRESENT; +} + +QWidget *ProjectView::presentWidget() const +{ + return const_cast(this); +} + +void ProjectView::saveProcess() { project_manager->save(); } + +void ProjectView::menu_popup(const QPoint &p) +{ + auto m = menGenerate(); + m->exec(mapToGlobal(p)); +} + +void ProjectView::open_target(const QModelIndex &t) +{ + auto mgr = source->get(NAME(DocumentsManager)); + auto path = mgr->convertPath(t); + source->postCommand(OpenFile(path)); +} + +void ProjectView::closeProcess() { project_manager->save(); } diff --git a/WordsIDE/project_view.h b/WordsIDE/project_view.h new file mode 100644 index 0000000..da23ae6 --- /dev/null +++ b/WordsIDE/project_view.h @@ -0,0 +1,50 @@ +#ifndef PROJECT_VIEW_H +#define PROJECT_VIEW_H + +#include "DocsManager.h" +#include "manager_docs.h" + +#include +#include +#include +#include +#include "message_view.h" + +namespace Components { + /** + * @brief 妞ゅ湱娲扮憴鍡楁禈 + */ + class ProjectView : public QWidget, public ExtendView { + Q_OBJECT + public: + ProjectView(); + explicit ProjectView(QWidget *parent, Schedule::CommandsDispatcher *core, Core::DocumentsManager *mgr); + + // ExtendView interface + public: + virtual ExtendView *newInst(QWidget *parent, XApp *core) override; + virtual QMenu *bindMenu() const override; + virtual QString typeName() const override; + virtual Components::ExtendType type() const override; + virtual QWidget *presentWidget() const override; + virtual void saveProcess() override; + virtual void closeProcess() override; + + signals: + void currentIndexChanged(const QModelIndex &index); + + private: + Core::DocumentsManager *const project_manager; + Schedule::CommandsDispatcher *const source; + QTreeView *const view_present; + QMenu *const menu_root; + + void menu_popup(const QPoint &p); + void open_target(const QModelIndex &t); + + QMenu* menGenerate(QMenu *m=nullptr); + + }; +} + +#endif // PROJECT_VIEW_H diff --git a/WordsIDE/projectview.cpp b/WordsIDE/projectview.cpp deleted file mode 100644 index c5dd55a..0000000 --- a/WordsIDE/projectview.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "projectview.h" -#include "command_list.h" - -#include -#include -#include - -using namespace Components; -using namespace CommandList; -using namespace Schedule; -using namespace SplitFrame; -using namespace Core; - -ProjectView::ProjectView(SplitPanel *host, CommandsDispatcher *core, Core::DocumentsManager *mgr) - : FnWrap(host), project_manager(mgr), source(core), view_present(new QTreeView(this)) { - auto layout = new QVBoxLayout(this); - layout->addWidget(view_present); - layout->setMargin(1); - - view_present->setModel(mgr->projectManager()->model()); - view_present->setHeaderHidden(true); - view_present->setMouseTracking(true); - - view_present->setContextMenuPolicy(Qt::CustomContextMenu); - connect(view_present, &QTreeView::customContextMenuRequested, - this, &ProjectView::menu_popup); - connect(view_present, &QTreeView::doubleClicked, - this, &ProjectView::open_target); -} - -QModelIndex ProjectView::currentIndex() const { return view_present->currentIndex(); } - -void ProjectView::menu_popup(const QPoint &p) -{ - QMenu m; - m.addAction("新建路径", [this](){ - auto path_string = QInputDialog::getText(this, "输入路径定义/packa/packb/packc", "路径定义:"); - if(path_string.isEmpty()) - return; - - source->postCommand(NewPackage(path_string)); - }); - - auto index = this->view_present->currentIndex(); - if(index.isValid()){ - auto mgr = source->get(NAME(DocumentsManager)); - auto menu = m.addMenu("新建文件"); - auto views = mgr->fileTypes(); - for (auto &it : views) { - menu->addAction(it, [this, it, &index, mgr]() { - auto name = QInputDialog::getText(this, "输入文件名称", "文件名称"); - auto path = mgr->convertPath(index); - source->postCommand(NewFile(path, name, it)); - }); - } - - m.addSeparator(); - m.addAction("移除节点", [&index, this]() { source->postCommand(DeleteTarget(index)); }); - } - - - m.exec(mapToGlobal(p)); -} - -void ProjectView::open_target(const QModelIndex &t) -{ - auto mgr = source->get(NAME(DocumentsManager)); - auto path = mgr->convertPath(t); - source->postCommand(OpenFile(path)); -} - -void ProjectView::closeProcess() { project_manager->save(); } diff --git a/WordsIDE/projectview.h b/WordsIDE/projectview.h deleted file mode 100644 index 36831bc..0000000 --- a/WordsIDE/projectview.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef PROJECTVIEW_H -#define PROJECTVIEW_H - -#include "DocsManager.h" -#include "manager_docs.h" - -#include -#include -#include -#include -#include - -namespace Components { - /** - * @brief 项目视图 - */ - class ProjectView : public SplitFrame::FnWrap { - Q_OBJECT - public: - explicit ProjectView(SplitFrame::SplitPanel *host, Schedule::CommandsDispatcher *core, Core::DocumentsManager *mgr); - - QModelIndex currentIndex() const; - - private: - Core::DocumentsManager *const project_manager; - Schedule::CommandsDispatcher *const source; - QTreeView *const view_present; - - void menu_popup(const QPoint &p); - void open_target(const QModelIndex &t); - - // FnWrap interface - public: - virtual void closeProcess() override; - }; -} - -#endif // PROJECTVIEW_H diff --git a/WordsIDE/session_binder.cpp b/WordsIDE/session_binder.cpp new file mode 100644 index 0000000..56a5450 --- /dev/null +++ b/WordsIDE/session_binder.cpp @@ -0,0 +1,87 @@ +#include "session_binder.h" +#include "mainwindow.h" +#include "message_view.h" +#include "present_container.h" +#include "project_view.h" +#include +#include + +using namespace Config; +using namespace Core; +using namespace Components; +using namespace split_window; + +SessionBinder::SessionBinder(XApp *core) + : QObject(core), + bind_window(new split_window::SplitWindow), + pjt_manager(new ProjectView(bind_window, core->cmdsPort(), core->docsPort())), + msg_present(new MessageView(bind_window, core)), + bind_core(core), + project_op(new QMenu("项目管理")), + edit_op(new QMenu("内容编辑")), + view_op(new QMenu("视图管理")), + build_op(new QMenu("构建服务")), + tool_op(new QMenu("功能拓展")), + system_op(new QMenu("系统帮助")) +{ + connect(bind_window, &SplitWindow::windowActived, [this](SplitWindow *inst){ + menus_refresh(inst->menuBar()); + }); + + menus_refresh(bind_window->menuBar(), true); +} + +#include +void SessionBinder::menus_refresh(QMenuBar *mbar, bool rebuild) +{ + if(rebuild){ + mbar->addMenu(project_op); + project_op->addActions(pjt_manager->bindMenu()->actions()); + + mbar->addMenu(edit_op); + + mbar->addMenu(view_op); + view_op->addAction("新建窗口"); + view_op->addAction("关闭窗口"); + view_op->addSeparator(); + for(auto &t : bind_core->viewTemplates()){ + auto act_item = view_op->addAction(t->typeName()); + act_item->setCheckable(t->type() == ExtendType::FEATURE_PRESENT); + + std::function open_view = [=, &open_view](bool state){ + auto vinst = t->newInst(bind_window, bind_core); + auto wrap_v = new dock_panel::DockableView(bind_window, vinst->presentWidget()); + bind_window->freedomHasBeenAppended(wrap_v); + + if(t->type() == ExtendType::FEATURE_PRESENT){ + disconnect(act_item, &QAction::triggered, nullptr, nullptr); + connect(act_item, &QAction::triggered, [=, &open_view](bool state){ + vinst->presentWidget()->setParent(nullptr); + bind_window->doRetrieve(wrap_v); + bind_window->doClose(wrap_v); + delete vinst; + + disconnect(act_item, &QAction::triggered, nullptr, nullptr); + connect(act_item, &QAction::triggered, open_view); + }); + } + }; + connect(act_item, &QAction::triggered, open_view); + } + + mbar->addMenu(build_op); + build_op->addActions(msg_present->bindMenu()->actions()); + + mbar->addMenu(tool_op); + + mbar->addMenu(system_op); + system_op->addAction("关于Qt", []() { QApplication::aboutQt(); }); + } + + auto action_list = edit_op->actions(); + for(auto &it : action_list) + edit_op->removeAction(it); + + + +} diff --git a/WordsIDE/session_binder.h b/WordsIDE/session_binder.h new file mode 100644 index 0000000..4d15530 --- /dev/null +++ b/WordsIDE/session_binder.h @@ -0,0 +1,42 @@ +#ifndef SESSIONBINDER_H +#define SESSIONBINDER_H + +#include "project_view.h" + +#include +#include +#include +#include +#include +#include + +class MainWindow; + +namespace Core { + class SessionBinder : public QObject { + Q_OBJECT + public: + SessionBinder(XApp *core); + + void menus_refresh(QMenuBar *mbar, bool rebuild = false); + + private: + split_window::SplitWindow *const bind_window; + Components::ProjectView *const pjt_manager; + Components::MessageView *const msg_present; + + XApp *const bind_core; + + QMenu *const project_op; // 项目文件管理 + QMenu *const edit_op; // 单个文件编辑操作 + QMenu *const view_op; // 窗口视图管理操作 + QMenu *const build_op; // 编译服务 + QMenu *const tool_op; // 拓展工具 + QMenu *const system_op; // 系统菜单 + + QList actived_views; + }; + +} // namespace Core + +#endif // SESSIONBINDER_H diff --git a/WordsIDE/viewsession.cpp b/WordsIDE/viewsession.cpp deleted file mode 100644 index 76ab909..0000000 --- a/WordsIDE/viewsession.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#include "viewsession.h" -#include "mainwindow.h" -#include "messageview.h" -#include "presentcontainerview.h" -#include "projectview.h" - -using namespace Config; -using namespace Core; -using namespace SplitFrame; -using namespace Components; - -ViewSession::ViewSession(Config::Configration *port, MainWindow *host) : host(host->bindPresent()), recover_port(port) { - base_path = {"sys-config", "front-end", host->layoutName(), "view-state"}; -} - -void ViewSession::initPresentView(PresentContainerView *center_frame, ProjectView *project_present, QStandardItemModel *error_model) { - split_infos.clear(); - - auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理")); - host->markFreedom(project_panel); - view_store[project_panel->title()] = project_panel; - - edit_panel = host->appendView(center_frame, QIcon(":/ui/icons/file_icon.jpg"), tr("编辑窗口")); - view_store[edit_panel->title()] = edit_panel; - - auto msg_view = MessageView::gen(host, error_model); - auto msg_panel = host->appendView(msg_view, QIcon(":/ui/icons/file_icon.jpg"), "信息提示"); - host->markFreedom(msg_panel); - view_store[msg_panel->title()] = msg_panel; -} - -void views_state_store(Config::Configration *port, const QList &base_path, const QList &child) { - for (auto &it : child) { - if (!it) - continue; - - auto keys_path = base_path; - keys_path << QString("rect_%1").arg(child.indexOf(it)); - - auto conv = dynamic_cast(it); - if (conv) { // split - QHash values; - values["rect-type"] = "split"; - values["split-type"] = QString("%1").arg((int)conv->splitType()); - values["split-width"] = QString("%1").arg(conv->splitterWidth()); - values["split-pos"] = QString("%1").arg(conv->splitterPos()); - port->setMap(keys_path, values); - - auto split_childs = conv->child(); - views_state_store(port, keys_path, QList() << split_childs.first << split_childs.second); - } else { // view - QHash values; - values["rect-type"] = "view"; - values["view-title"] = it->title(); - port->setMap(keys_path, values); - } - } -} - -void ViewSession::viewStatesSave(QMainWindow *win, SplitFrame::SplitPanel *root) { - recover_port->deleteX(base_path); - auto childs = root->child(); - - auto grect = win->geometry(); - QHash values; - values["win-width"] = QString("%1").arg(grect.width()); - values["win-height"] = QString("%1").arg(grect.height()); - values["win-xpos"] = QString("%1").arg(grect.topLeft().x()); - values["win-ypos"] = QString("%1").arg(grect.topLeft().y()); - recover_port->setMap(base_path, values); - - views_state_store(recover_port, base_path, QList() << childs.first << childs.second); -} - -RectCom *ViewSession::views_state_restore(const QHash &cache, const QList &target_path, - Config::Configration *port, SplitFrame::SplitPanel *host) { - auto values = port->getMap(target_path); - if (!values.size()) - return nullptr; - - auto type = values["rect-type"]; - if (type == "view") { - auto title = values["view-title"]; - auto view = cache[title]; - host->markFreedom(view, false); - return view; - } else { - auto key_p0 = target_path; - key_p0 << "rect_0"; - auto rect0 = views_state_restore(cache, key_p0, port, host); - auto key_p1 = target_path; - key_p1 << "rect_1"; - auto rect1 = views_state_restore(cache, key_p1, port, host); - - auto ori = values["split-type"].toUInt(); - auto width = values["split-width"].toFloat(); - auto pos = values["split-pos"].toFloat(); - - auto split = host->createSplit(rect0, rect1); - - this->split_infos[split] = std::make_tuple((SplitType)ori, pos, width); - - return split; - } -} - -void ViewSession::relayout_cascade(SplitFrame::RectCom *root) { - auto xinst = dynamic_cast(root); - if (!xinst) - return; - - auto info = split_infos[xinst]; - xinst->setSplitInfo(std::get<0>(info), std::get<1>(info), std::get<2>(info)); - - auto child_pair = xinst->child(); - relayout_cascade(child_pair.first); - relayout_cascade(child_pair.second); -} - -bool ViewSession::eventFilter(QObject *watched, QEvent *event) { - if (watched == (QObject *)host && event->type() == QEvent::Show) { - relayout_cascade(host->child().first); - host->bind()->removeEventFilter(this); - } - - return QObject::eventFilter(watched, event); -} - -void ViewSession::viewStatesRestore(QMainWindow *win, SplitFrame::SplitPanel *root) { - auto key_path0 = base_path; - key_path0 << "rect_0"; - auto rect = views_state_restore(this->view_store, key_path0, recover_port, root); - if (!rect) - rect = edit_panel; - - root->resetEngross(rect); - root->objsRelateRebuild(); - - auto values = recover_port->getMap(base_path); - auto width = values["win-width"].toFloat(); - auto height = values["win-height"].toFloat(); - auto xpos = values["win-xpos"].toFloat(); - auto ypos = values["win-ypos"].toFloat(); - - win->setGeometry(xpos, ypos, width, height); - root->bind()->installEventFilter(this); -} diff --git a/WordsIDE/viewsession.h b/WordsIDE/viewsession.h deleted file mode 100644 index df03574..0000000 --- a/WordsIDE/viewsession.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef VIEWSESSION_H -#define VIEWSESSION_H - -#include "projectview.h" - -#include -#include -#include -#include -#include -#include - -class MainWindow; - -namespace Core { - class ViewSession : public QObject { - Q_OBJECT - public: - ViewSession(Config::Configration *port, MainWindow *host); - - void initPresentView(Components::PresentContainerView *center_frame, Components::ProjectView *project_present, QStandardItemModel *model); - - void viewStatesSave(QMainWindow *win, SplitFrame::SplitPanel *root); - void viewStatesRestore(QMainWindow *win, SplitFrame::SplitPanel *root); - - private: - QList base_path; - SplitFrame::SplitPanel *host; - SplitFrame::RectCom *edit_panel = nullptr; - Config::Configration *const recover_port; - QHash view_store; - - typedef float split_pos; - typedef float split_width; - std::map> split_infos; - - SplitFrame::RectCom *views_state_restore(const QHash &cache, const QList &target_path, - Config::Configration *port, SplitFrame::SplitPanel *host); - - void relayout_cascade(SplitFrame::RectCom *root); - - // QObject interface - public: - virtual bool eventFilter(QObject *watched, QEvent *event) override; - }; - -} // namespace Core - -#endif // VIEWSESSION_H diff --git a/WordsIDE/viewstackedbar.cpp b/WordsIDE/viewstackedbar.cpp deleted file mode 100644 index 28bb536..0000000 --- a/WordsIDE/viewstackedbar.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "viewstackedbar.h" - -#include -#include - -using namespace Components; -using namespace SplitFrame; - -ViewStackedBar::ViewStackedBar(SplitPanel *host, QWidget *parent) : QToolBar(parent), host_ptr(host) { - setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonIconOnly); - setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea | Qt::TopToolBarArea | Qt::BottomToolBarArea); - setContextMenuPolicy(Qt::CustomContextMenu); - - layout()->setMargin(0); - layout()->setSpacing(0); - setIconSize(QSize(30, 30)); -} - -void ViewStackedBar::freedomAppended(SplitFrame::RectCom *ins, const QIcon &icon, const QString &title) { - if (freedom_views.contains(ins)) - return; - - auto action = addAction(icon, title); - freedom_views[ins] = action; - - connect(action, &QAction::triggered, [ins, this]() { - if (host_ptr->isTemporaryView(ins)) { - host_ptr->temporaryVisible(DockType::LEFT); - } else { - auto pinst = static_cast(this->parent()); - - DockType position = DockType::LEFT; - switch (pinst->toolBarArea(this)) { - case Qt::ToolBarArea::BottomToolBarArea: - position = DockType::BOTTOM; - break; - case Qt::ToolBarArea::TopToolBarArea: - position = DockType::TOP; - break; - case Qt::ToolBarArea::LeftToolBarArea: - position = DockType::LEFT; - break; - case Qt::ToolBarArea::RightToolBarArea: - position = DockType::RIGHT; - break; - default: - break; - } - - host_ptr->temporaryVisible(position, ins); - } - }); -} - -void ViewStackedBar::freedomRemoved(SplitFrame::RectCom *ins) { - if (freedom_views.contains(ins)) { - auto action = freedom_views[ins]; - removeAction(action); - freedom_views.remove(ins); - } -} diff --git a/WordsIDE/viewstackedbar.h b/WordsIDE/viewstackedbar.h deleted file mode 100644 index 0b19f61..0000000 --- a/WordsIDE/viewstackedbar.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef VIEWSTACKEDBAR_H -#define VIEWSTACKEDBAR_H - -#include -#include -#include - -namespace Components { - - class ViewStackedBar : public QToolBar, public SplitFrame::FreedomViewsListener { - public: - ViewStackedBar(SplitFrame::SplitPanel *host, QWidget *parent = nullptr); - - // FreedomViewsListener interface - public: - virtual void freedomAppended(SplitFrame::RectCom *ins, const QIcon &icon, const QString &title) override; - virtual void freedomRemoved(SplitFrame::RectCom *ins) override; - - private: - SplitFrame::SplitPanel *const host_ptr; - QHash freedom_views; - }; -} // namespace Components - -#endif // VIEWSTACKEDBAR_H diff --git a/WordsIDE/welcomepanel.cpp b/WordsIDE/welcomepanel.cpp index e8e7274..a3b1735 100644 --- a/WordsIDE/welcomepanel.cpp +++ b/WordsIDE/welcomepanel.cpp @@ -35,3 +35,8 @@ QString WelcomePanel::absoluteTargetPath() const { return ""; } bool WelcomePanel::isModified() const { return false; } void WelcomePanel::jumpTo(const QList &path) {} + +QMenu *WelcomePanel::bindMenu() const +{ + return nullptr; +} diff --git a/WordsIDE/welcomepanel.h b/WordsIDE/welcomepanel.h index cf598ca..93b121a 100644 --- a/WordsIDE/welcomepanel.h +++ b/WordsIDE/welcomepanel.h @@ -29,6 +29,7 @@ namespace Presents { virtual QString absoluteTargetPath() const override; virtual bool isModified() const override; virtual void jumpTo(const QList &path) override; + virtual QMenu *bindMenu() const override; }; } // namespace Presents diff --git a/WordsIDE/xapp.cpp b/WordsIDE/xapp.cpp index 39cf8d1..3ab34d8 100644 --- a/WordsIDE/xapp.cpp +++ b/WordsIDE/xapp.cpp @@ -15,7 +15,10 @@ XApp::XApp(int argc, char **argv) : QApplication(argc, argv), parse_service(new ParseBridge()), project_manager(new XMLProjectManager(this)), - active_docscollect(new DocumentsManager(this)) { + active_docscollect(new DocumentsManager(this)), + disp_core(new CommandsDispatcher(QDir("./"), true)), + gconfig(new XMLConfig) +{ gconfig->loadFile("./software.config"); init_commands(disp_core); @@ -38,7 +41,7 @@ ParseBridge *XApp::parseService() const { return parse_service; } ProjectManager *XApp::pjtManager() const { return project_manager; } -DocumentsManager *XApp::docsManager() const { return active_docscollect; } +DocumentsManager *XApp::docsPort() const { return active_docscollect; } using namespace CommandList; void XApp::init_commands(Schedule::CommandsDispatcher *host) { @@ -52,6 +55,3 @@ void XApp::init_commands(Schedule::CommandsDispatcher *host) { host->registerCommand(new SaveAll()); host->registerCommand(new DeleteTarget(Route())); } - -CommandsDispatcher *const XApp::disp_core = new CommandsDispatcher(QDir("./"), true); -Configration *const XApp::gconfig = new XMLConfig(); diff --git a/WordsIDE/xapp.h b/WordsIDE/xapp.h index 213fd4d..f01b24a 100644 --- a/WordsIDE/xapp.h +++ b/WordsIDE/xapp.h @@ -9,24 +9,33 @@ #include #include +namespace Components { + class ExtendView; +} + class XApp : public QApplication { public: XApp(int argc, char **argv); virtual bool notify(QObject *receiver, QEvent *event); - + + QList viewTemplates() const; + bridge::ParseBridge *parseService() const; Project::ProjectManager *pjtManager() const; - Core::DocumentsManager *docsManager() const; + Core::DocumentsManager *docsPort() const; + + Schedule::CommandsDispatcher *cmdsPort() const; + + QStandardItemModel* messageModel() const; -public: - static Schedule::CommandsDispatcher *const disp_core; - static Config::Configration *const gconfig; private: bridge::ParseBridge *const parse_service; Project::ProjectManager *const project_manager; Core::DocumentsManager *const active_docscollect; + Schedule::CommandsDispatcher *const disp_core; + Config::Configration *const gconfig; void init_commands(Schedule::CommandsDispatcher *core); }; diff --git a/libSplitView/SplitWindow.cpp b/libSplitView/SplitWindow.cpp index 816169d..aeb2c75 100644 --- a/libSplitView/SplitWindow.cpp +++ b/libSplitView/SplitWindow.cpp @@ -316,3 +316,9 @@ void SplitWindow::hasBeenAppend(split_frame::ViewBase *inst) { } + +void SplitWindow::focusInEvent(QFocusEvent *event) +{ + QMainWindow::focusInEvent(event); + emit this->windowActived(this); +} diff --git a/libSplitView/SplitWindow.h b/libSplitView/SplitWindow.h index 8a89fca..7743171 100644 --- a/libSplitView/SplitWindow.h +++ b/libSplitView/SplitWindow.h @@ -15,6 +15,8 @@ namespace split_window { * @brief 窗口即视图资源管理器 */ class SPLITVIEW_EXPORT SplitWindow : public QMainWindow, public split_frame::ResManager, public split_frame::FreedomViewsListener { + Q_OBJECT + private: bool active = false; QToolBar *const unused_stack; @@ -45,12 +47,16 @@ namespace split_window { void freedomHasBeenAppended(split_frame::ViewBase *inst); /** - * @brief 璁剧疆鎸囧畾瑙嗗浘涓烘牴瑙嗗浘鎴栬€呭彇娑 * @param inst + * @brief 设置临时显示视图 + * @param inst */ void setPresentTarget(split_frame::ViewRes *inst = nullptr); bool eventFilter(QObject *sender, QEvent *ev) override; + signals: + void windowActived(split_window::SplitWindow *inst); + // ResManager interface public: virtual void addListener(split_frame::FreedomViewsListener *lsn) override; @@ -70,6 +76,10 @@ namespace split_window { virtual void freedomRemove(split_frame::ViewBase *ins) override; virtual void aboutToBeDelete(split_frame::ViewBase *inst) override; virtual void hasBeenAppend(split_frame::ViewBase *inst) override; + + // QWidget interface + protected: + virtual void focusInEvent(QFocusEvent *event) override; }; } // namespace split_panel