修改集成中
This commit is contained in:
parent
bd9a4c156e
commit
0230e60e81
|
@ -3,7 +3,7 @@ TEMPLATE = subdirs
|
|||
SUBDIRS += \
|
||||
libGenericConsole \
|
||||
libSplitView \
|
||||
# WordsIDE \
|
||||
WordsIDE \
|
||||
libConfig \
|
||||
libProjectManager \
|
||||
# libTextEdit \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.15.0, 2024-02-10T14:34:11. -->
|
||||
<!-- Written by QtCreator 4.15.0, 2024-02-14T13:04:42. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -306,7 +306,80 @@
|
|||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/u_test</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <QDebug>
|
||||
#include <QTextCodec>
|
||||
|
||||
using namespace Components;
|
||||
using namespace Core;
|
||||
using namespace Presents;
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef DOCSMANAGER_H
|
||||
#define DOCSMANAGER_H
|
||||
|
||||
#include "route.h"
|
||||
#include "Route.h"
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <libConfig.h>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Core {
|
||||
class DocumentsManager;
|
||||
|
@ -20,6 +21,12 @@ namespace Presents {
|
|||
explicit FilePresent(QObject *parent = nullptr);
|
||||
virtual ~FilePresent() = default;
|
||||
|
||||
/**
|
||||
* @brief 文件编辑菜单
|
||||
* @return
|
||||
*/
|
||||
virtual QMenu* bindMenu() const = 0;
|
||||
|
||||
/**
|
||||
* @brief 获取实例的别名
|
||||
* @return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "route.h"
|
||||
#include "Route.h"
|
||||
|
||||
using namespace Core;
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "command_list.h"
|
||||
#include "manager_docs.h"
|
||||
#include "route.h"
|
||||
#include "Route.h"
|
||||
#include "DocsManager.h"
|
||||
|
||||
using namespace CommandList;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef COMMAND_LIST_H
|
||||
#define COMMAND_LIST_H
|
||||
|
||||
#include "route.h"
|
||||
#include "Route.h"
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <commandsdispatcher.h>
|
||||
|
|
|
@ -1,331 +1,331 @@
|
|||
#include "mainwindow.h"
|
||||
#include "srcedit_defaulttext.h"
|
||||
#include "srcedit_storyboard.h"
|
||||
#include "xapp.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QStatusBar>
|
||||
#include <QTextEdit>
|
||||
#include <QToolBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <xmlconfig.h>
|
||||
#include <xmlprojectmanager.h>
|
||||
|
||||
#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<QAction*> &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<QString> 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 <QApplication>
|
||||
//#include <QDateTime>
|
||||
//#include <QDebug>
|
||||
//#include <QFileDialog>
|
||||
//#include <QInputDialog>
|
||||
//#include <QLabel>
|
||||
//#include <QList>
|
||||
//#include <QMenuBar>
|
||||
//#include <QMessageBox>
|
||||
//#include <QStatusBar>
|
||||
//#include <QTextEdit>
|
||||
//#include <QToolBar>
|
||||
//#include <QVBoxLayout>
|
||||
//#include <xmlconfig.h>
|
||||
//#include <xmlprojectmanager.h>
|
||||
|
||||
//#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<QAction*> &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<QString> 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) {}
|
||||
|
|
|
@ -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 <QListView>
|
||||
#include <QMainWindow>
|
||||
#include <QSplitter>
|
||||
#include <QTableView>
|
||||
#include <QTreeView>
|
||||
#include <libProjectManager.h>
|
||||
#include <splitwindow.h>
|
||||
//#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 <QListView>
|
||||
//#include <QMainWindow>
|
||||
//#include <QSplitter>
|
||||
//#include <QTableView>
|
||||
//#include <QTreeView>
|
||||
//#include <libProjectManager.h>
|
||||
//#include <splitwindow.h>
|
||||
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define MANAGER_DOCS_H
|
||||
|
||||
#include "DocsManager.h"
|
||||
#include "route.h"
|
||||
#include "Route.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QTreeView>
|
||||
|
@ -12,9 +12,20 @@
|
|||
|
||||
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
|
||||
|
@ -22,6 +33,12 @@ namespace Presents {
|
|||
*/
|
||||
virtual QWidget *hostWidget() const = 0;
|
||||
|
||||
/**
|
||||
* @brief 当前文件视图
|
||||
* @return
|
||||
*/
|
||||
virtual Presents::FilePresent* currentPresent() const = 0;
|
||||
|
||||
/**
|
||||
* @brief 是否可以放置此视图
|
||||
* @param vins
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#include "message_view.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
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<MessageView*>(this);
|
||||
}
|
||||
|
||||
void MessageView::saveProcess()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MessageView::closeProcess()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
#ifndef MESSAGE_VIEW_H
|
||||
#define MESSAGE_VIEW_H
|
||||
|
||||
#include "DocsManager.h"
|
||||
#include <QHash>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTableView>
|
||||
#include <SplitWindow.h>
|
||||
#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
|
|
@ -1,28 +0,0 @@
|
|||
#include "messageview.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace Components;
|
||||
using namespace SplitFrame;
|
||||
|
||||
QHash<SplitFrame::SplitPanel *, MessageView *> MessageView::panel_map;
|
||||
|
||||
MessageView::MessageView(SplitFrame::SplitPanel *ins, QStandardItemModel *base)
|
||||
: FnWrap<MessageView, false>(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;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef MESSAGEVIEW_H
|
||||
#define MESSAGEVIEW_H
|
||||
|
||||
#include "DocsManager.h"
|
||||
#include <QHash>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTableView>
|
||||
#include <splitwindow.h>
|
||||
|
||||
namespace Components {
|
||||
/**
|
||||
* @brief 显示各种提示信息
|
||||
*/
|
||||
class MessageView : public SplitFrame::FnWrap<MessageView, false> {
|
||||
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<SplitFrame::SplitPanel *, MessageView *> panel_map;
|
||||
};
|
||||
} // namespace Components
|
||||
|
||||
#endif // MESSAGEVIEW_H
|
|
@ -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<PresentContainerView, true>(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<int>::of(&QComboBox::currentIndexChanged), this, &PresentContainerView::change_view);
|
||||
connect(close_btn, &QPushButton::toggled, this, &PresentContainerView::close_current_view);
|
||||
connect(title_store, QOverload<int>::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 <libConfig.h>
|
||||
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 <QDebug>
|
||||
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 <QMessageBox>
|
||||
void PresentContainerView::close_current_view() {
|
||||
void PresentContainer::close_current_view() {
|
||||
auto index = title_store->currentIndex();
|
||||
const_cast<FilePresent *>(items_store[index])->beforeClose();
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef PRESENTCONTAINERVIEW_H
|
||||
#define PRESENTCONTAINERVIEW_H
|
||||
#ifndef PRESENT_CONTAINER_H
|
||||
#define PRESENT_CONTAINER_H
|
||||
|
||||
#include "manager_docs.h"
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QStackedLayout>
|
||||
#include <QStackedWidget>
|
||||
#include <splitwindow.h>
|
||||
#include <SplitWindow.h>
|
||||
#include "message_view.h"
|
||||
|
||||
namespace Presents {
|
||||
class WelcomePanel;
|
||||
|
@ -15,24 +16,37 @@ namespace Presents {
|
|||
namespace Components {
|
||||
|
||||
/**
|
||||
* @brief 文档视图容器
|
||||
* @brief 内容视图容器
|
||||
*/
|
||||
class PresentContainerView : public SplitFrame::FnWrap<PresentContainerView, true>, public Presents::PresentHost {
|
||||
class PresentContainer : public QWidget ,public ExtendView, public Presents::PresentHost {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PresentContainerView(SplitFrame::SplitPanel *host);
|
||||
PresentContainer(QWidget *ptr = nullptr);
|
||||
|
||||
// PresentContainer interface
|
||||
// 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<Presents::HostListener*> listeners_store;
|
||||
QList<const Presents::FilePresent *> 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
|
|
@ -0,0 +1,104 @@
|
|||
#include "project_view.h"
|
||||
#include "command_list.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
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<DocumentsManager>(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<ProjectView*>(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<DocumentsManager>(NAME(DocumentsManager));
|
||||
auto path = mgr->convertPath(t);
|
||||
source->postCommand(OpenFile(path));
|
||||
}
|
||||
|
||||
void ProjectView::closeProcess() { project_manager->save(); }
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef PROJECT_VIEW_H
|
||||
#define PROJECT_VIEW_H
|
||||
|
||||
#include "DocsManager.h"
|
||||
#include "manager_docs.h"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QWidget>
|
||||
#include <commandsdispatcher.h>
|
||||
#include <libProjectManager.h>
|
||||
#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
|
|
@ -1,72 +0,0 @@
|
|||
#include "projectview.h"
|
||||
#include "command_list.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
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<ProjectView, false>(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<DocumentsManager>(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<DocumentsManager>(NAME(DocumentsManager));
|
||||
auto path = mgr->convertPath(t);
|
||||
source->postCommand(OpenFile(path));
|
||||
}
|
||||
|
||||
void ProjectView::closeProcess() { project_manager->save(); }
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef PROJECTVIEW_H
|
||||
#define PROJECTVIEW_H
|
||||
|
||||
#include "DocsManager.h"
|
||||
#include "manager_docs.h"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QWidget>
|
||||
#include <commandsdispatcher.h>
|
||||
#include <libProjectManager.h>
|
||||
#include <splitwindow.h>
|
||||
|
||||
namespace Components {
|
||||
/**
|
||||
* @brief 项目视图
|
||||
*/
|
||||
class ProjectView : public SplitFrame::FnWrap<ProjectView, false> {
|
||||
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
|
|
@ -0,0 +1,87 @@
|
|||
#include "session_binder.h"
|
||||
#include "mainwindow.h"
|
||||
#include "message_view.h"
|
||||
#include "present_container.h"
|
||||
#include "project_view.h"
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
|
||||
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 <DockPanel.h>
|
||||
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<void(bool)> 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);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef SESSIONBINDER_H
|
||||
#define SESSIONBINDER_H
|
||||
|
||||
#include "project_view.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
#include <QStandardItemModel>
|
||||
#include <libConfig.h>
|
||||
#include <present_container.h>
|
||||
#include <SplitWindow.h>
|
||||
|
||||
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<Components::ExtendView*> actived_views;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // SESSIONBINDER_H
|
|
@ -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<QString> &base_path, const QList<RectCom *> &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<SplitView *>(it);
|
||||
if (conv) { // split
|
||||
QHash<QString, QString> 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<RectCom *>() << split_childs.first << split_childs.second);
|
||||
} else { // view
|
||||
QHash<QString, QString> 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<QString, QString> 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<RectCom *>() << childs.first << childs.second);
|
||||
}
|
||||
|
||||
RectCom *ViewSession::views_state_restore(const QHash<QString, SplitFrame::RectCom *> &cache, const QList<QString> &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<SplitView *>(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);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
#ifndef VIEWSESSION_H
|
||||
#define VIEWSESSION_H
|
||||
|
||||
#include "projectview.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
#include <QStandardItemModel>
|
||||
#include <libConfig.h>
|
||||
#include <presentcontainerview.h>
|
||||
#include <splitwindow.h>
|
||||
|
||||
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<QString> base_path;
|
||||
SplitFrame::SplitPanel *host;
|
||||
SplitFrame::RectCom *edit_panel = nullptr;
|
||||
Config::Configration *const recover_port;
|
||||
QHash<QString, SplitFrame::RectCom *> view_store;
|
||||
|
||||
typedef float split_pos;
|
||||
typedef float split_width;
|
||||
std::map<SplitFrame::SplitView *, std::tuple<SplitFrame::SplitType, split_pos, split_width>> split_infos;
|
||||
|
||||
SplitFrame::RectCom *views_state_restore(const QHash<QString, SplitFrame::RectCom *> &cache, const QList<QString> &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
|
|
@ -1,61 +0,0 @@
|
|||
#include "viewstackedbar.h"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QMainWindow>
|
||||
|
||||
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<QMainWindow *>(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);
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef VIEWSTACKEDBAR_H
|
||||
#define VIEWSTACKEDBAR_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QToolBar>
|
||||
#include <splitwindow.h>
|
||||
|
||||
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<SplitFrame::RectCom *, QAction *> freedom_views;
|
||||
};
|
||||
} // namespace Components
|
||||
|
||||
#endif // VIEWSTACKEDBAR_H
|
|
@ -35,3 +35,8 @@ QString WelcomePanel::absoluteTargetPath() const { return ""; }
|
|||
bool WelcomePanel::isModified() const { return false; }
|
||||
|
||||
void WelcomePanel::jumpTo(const QList<QString> &path) {}
|
||||
|
||||
QMenu *WelcomePanel::bindMenu() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Presents {
|
|||
virtual QString absoluteTargetPath() const override;
|
||||
virtual bool isModified() const override;
|
||||
virtual void jumpTo(const QList<QString> &path) override;
|
||||
virtual QMenu *bindMenu() const override;
|
||||
};
|
||||
|
||||
} // namespace Presents
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -9,24 +9,33 @@
|
|||
#include <libConfig.h>
|
||||
#include <libProjectManager.h>
|
||||
|
||||
namespace Components {
|
||||
class ExtendView;
|
||||
}
|
||||
|
||||
class XApp : public QApplication {
|
||||
public:
|
||||
XApp(int argc, char **argv);
|
||||
|
||||
virtual bool notify(QObject *receiver, QEvent *event);
|
||||
|
||||
QList<Components::ExtendView*> 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);
|
||||
};
|
||||
|
|
|
@ -316,3 +316,9 @@ void SplitWindow::hasBeenAppend(split_frame::ViewBase *inst)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
void SplitWindow::focusInEvent(QFocusEvent *event)
|
||||
{
|
||||
QMainWindow::focusInEvent(event);
|
||||
emit this->windowActived(this);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue