分割命名空间、命令命名
This commit is contained in:
parent
e53b2a3a49
commit
87cc9aca79
|
@ -74,8 +74,8 @@ QString SaveAll::name() const
|
||||||
void SaveAll::run(Schedule::CommandsDispatcher *core) const
|
void SaveAll::run(Schedule::CommandsDispatcher *core) const
|
||||||
{
|
{
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(SaveAll));
|
auto vmgr = core->get<DocumentsManager>(NAME(SaveAll));
|
||||||
vmgr->projectManager()->save();
|
|
||||||
vmgr->save();
|
vmgr->save();
|
||||||
|
vmgr->projectManager()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SaveAll::toText() const
|
QString SaveAll::toText() const
|
||||||
|
@ -263,10 +263,11 @@ void StorychainJumpTo::fromText(const QString &line)
|
||||||
jump_path=line.split("/");
|
jump_path=line.split("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "storyboardspresent.h"
|
||||||
#include "storychainspresent.h"
|
#include "storychainspresent.h"
|
||||||
#include "storyunitspresent.h"
|
#include "storyunitspresent.h"
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
|
using namespace DataModel;
|
||||||
|
|
||||||
StorychainDetailShow::StorychainDetailShow(const QList<QString> &chain_path)
|
StorychainDetailShow::StorychainDetailShow(const QList<QString> &chain_path)
|
||||||
: chain_path(chain_path)
|
: chain_path(chain_path)
|
||||||
|
@ -383,23 +384,41 @@ void StoryconceptJumpTo::fromText(const QString &line) {
|
||||||
navi_path = line.split("/");
|
navi_path = line.split("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
StoryfragmentJumpTo::StoryfragmentJumpTo(const QList<QString> &path) {
|
StoryboardJumpTo::StoryboardJumpTo(const QList<QString> &path) {
|
||||||
navi_path.append(path);
|
navi_path.append(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StoryfragmentJumpTo::name() const { return NAME(StoryfragmentJumpTo); }
|
QString StoryboardJumpTo::name() const { return NAME(StoryboardJumpTo); }
|
||||||
|
|
||||||
void StoryfragmentJumpTo::run(Schedule::CommandsDispatcher *core) const {
|
void StoryboardJumpTo::run(Schedule::CommandsDispatcher *core) const {
|
||||||
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
||||||
|
|
||||||
auto unit_ins = core_ins->parseCore()->queryStoryUnit(navi_path[0]).first();
|
auto unit_ins = core_ins->parseCore()->queryStoryUnit(navi_path[0]).first();
|
||||||
auto unit_doc = unit_ins->doc();
|
auto unit_doc = unit_ins->doc();
|
||||||
|
|
||||||
auto vmgr =
|
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
||||||
core_ins->disp_core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
|
|
||||||
auto index = vmgr->projectManager()->queryIndex(unit_doc->filePath());
|
auto index = vmgr->projectManager()->queryIndex(unit_doc->filePath());
|
||||||
auto route = vmgr->converter(index);
|
auto route = vmgr->converter(index);
|
||||||
vmgr->openFile(route);
|
vmgr->openFile(route);
|
||||||
vmgr->activePresentOf(route)->jumpTo(navi_path);
|
vmgr->activePresentOf(route)->jumpTo(navi_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoryboardDetailShow::StoryboardDetailShow(const QList<QString> &path) {
|
||||||
|
navi_path.append(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StoryboardDetailShow::name() const {
|
||||||
|
return NAME(StoryboardDetailShow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoryboardDetailShow::run(Schedule::CommandsDispatcher *core) const {
|
||||||
|
auto vm = core->get<StoryboardsPresentModel>(NAME(StoryboardsPresentModel));
|
||||||
|
vm->detailShow(navi_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StoryboardDetailShow::toText() const { return navi_path.join("/"); }
|
||||||
|
|
||||||
|
void StoryboardDetailShow::fromText(const QString &line) {
|
||||||
|
navi_path = line.split("/");
|
||||||
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ namespace CommandList {
|
||||||
bool all_from_disk;
|
bool all_from_disk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 故事脉络相关命令 ========================================================
|
||||||
class StorychainDetailShow : public Schedule::GeCommand {
|
class StorychainDetailShow : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
StorychainDetailShow(const QList<QString> &chain_path);
|
StorychainDetailShow(const QList<QString> &chain_path);
|
||||||
|
@ -150,6 +151,7 @@ namespace CommandList {
|
||||||
QList<QString> jump_path;
|
QList<QString> jump_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 故事单元相关命令 ======================================================
|
||||||
class StoryunitDetailShow : public Schedule::GeCommand {
|
class StoryunitDetailShow : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
StoryunitDetailShow(const QList<QString> &path);
|
StoryunitDetailShow(const QList<QString> &path);
|
||||||
|
@ -180,6 +182,7 @@ namespace CommandList {
|
||||||
QList<QString> unit_nav;
|
QList<QString> unit_nav;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 故事概念相关命令===================================================
|
||||||
class StoryconceptDetailShow : public Schedule::GeCommand {
|
class StoryconceptDetailShow : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
StoryconceptDetailShow(const QList<QString> &path);
|
StoryconceptDetailShow(const QList<QString> &path);
|
||||||
|
@ -210,9 +213,24 @@ namespace CommandList {
|
||||||
QList<QString> navi_path;
|
QList<QString> navi_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StoryfragmentJumpTo : public Schedule::GeCommand {
|
class StoryboardDetailShow : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
StoryfragmentJumpTo(const QList<QString> &path);
|
StoryboardDetailShow(const QList<QString> &path);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<QString> navi_path;
|
||||||
|
|
||||||
|
// GeCommand interface
|
||||||
|
public:
|
||||||
|
virtual QString name() const override;
|
||||||
|
virtual void run(Schedule::CommandsDispatcher *core) const override;
|
||||||
|
virtual QString toText() const override;
|
||||||
|
virtual void fromText(const QString &line) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class StoryboardJumpTo : public Schedule::GeCommand {
|
||||||
|
public:
|
||||||
|
StoryboardJumpTo(const QList<QString> &path);
|
||||||
|
|
||||||
// GeCommand interface
|
// GeCommand interface
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
using namespace Parse;
|
using namespace Parse;
|
||||||
|
using namespace DataModel;
|
||||||
|
|
||||||
FragmentsOrderView::FragmentsOrderView(Schedule::CommandsDispatcher *core,
|
FragmentsOrderView::FragmentsOrderView(Schedule::CommandsDispatcher *core,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
|
@ -32,7 +33,7 @@ void FragmentsOrderView::double_click(const QModelIndex &index)
|
||||||
path << index.sibling(index.row(), 0).data().toString();
|
path << index.sibling(index.row(), 0).data().toString();
|
||||||
path << index.sibling(index.row(), 1).data().toString();
|
path << index.sibling(index.row(), 1).data().toString();
|
||||||
|
|
||||||
core_ins->postCommand(StoryfragmentJumpTo(path));
|
core_ins->postCommand(StoryboardJumpTo(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FragmentsOrderView::name() const { return NAME(FragmentsOrderView); }
|
QString FragmentsOrderView::name() const { return NAME(FragmentsOrderView); }
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
#include "appcore.h"
|
#include "appcore.h"
|
||||||
#include <commandsdispatcher.h>
|
#include <commandsdispatcher.h>
|
||||||
|
|
||||||
namespace Components {
|
namespace DataModel {
|
||||||
|
|
||||||
class FragmentsOrderviewModel : public Schedule::AccessibleObject {
|
class FragmentsOrderviewModel : public Schedule::AccessibleObject {
|
||||||
public:
|
public:
|
||||||
FragmentsOrderviewModel(Core::AppCore *core);
|
FragmentsOrderviewModel(Core::AppCore *core);
|
||||||
|
@ -26,7 +25,9 @@ namespace Components {
|
||||||
public:
|
public:
|
||||||
virtual QString name() const override;
|
virtual QString name() const override;
|
||||||
};
|
};
|
||||||
|
} // namespace DataModel
|
||||||
|
|
||||||
|
namespace Components {
|
||||||
class FragmentsOrderView : public QWidget, public Schedule::AccessibleObject
|
class FragmentsOrderView : public QWidget, public Schedule::AccessibleObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -32,7 +32,8 @@ using namespace Tools;
|
||||||
using namespace CommandList;
|
using namespace CommandList;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), app_core(new AppCore(this, true, this)),
|
: QMainWindow(parent), app_core(new AppCore(this, this)),
|
||||||
|
disp_core(new Schedule::CommandsDispatcher(QDir::home(), true)),
|
||||||
sync_kernel(new StatusSyncCore(this)),
|
sync_kernel(new StatusSyncCore(this)),
|
||||||
horizontal_split(new QSplitter(Qt::Horizontal, this)),
|
horizontal_split(new QSplitter(Qt::Horizontal, this)),
|
||||||
vertical_split(new QSplitter(Qt::Vertical, this)),
|
vertical_split(new QSplitter(Qt::Vertical, this)),
|
||||||
|
@ -42,17 +43,19 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
welcome_list(new QListView(this)),
|
welcome_list(new QListView(this)),
|
||||||
project_present(new ProjectPresent(app_core, this)),
|
project_present(new ProjectPresent(app_core, this)),
|
||||||
docs_container(new DocumentsManager(app_core, project_manager, this)),
|
docs_container(new DocumentsManager(app_core, project_manager, this)),
|
||||||
chains_view(new StorychainsPresent(app_core->disp_core, this)),
|
chains_view(new StorychainsPresent(disp_core, this)),
|
||||||
units_view(new StoryunitsPresent(app_core->disp_core, this)),
|
units_view(new StoryunitsPresent(disp_core, this)),
|
||||||
errors_present(new MessagePresent(app_core->getMakeCore(), this)),
|
errors_present(new MessagePresent(app_core->getMakeCore(), this)),
|
||||||
boards_view(new StoryBoardsPresent(app_core, this)),
|
boards_view(new StoryboardsPresent(app_core, this)),
|
||||||
concept_view(new StoryconceptsPresent(app_core, this)),
|
concept_view(new StoryconceptsPresent(disp_core, this)),
|
||||||
fragments_order(new FragmentsOrderView(app_core, this)) {
|
fragments_order(new FragmentsOrderView(disp_core, this)) {
|
||||||
|
|
||||||
QApplication::instance()->installEventFilter(this);
|
QApplication::instance()->installEventFilter(this);
|
||||||
|
|
||||||
this->app_core->setCurrentProject(project_manager);
|
this->app_core->setCurrentProject(project_manager);
|
||||||
this->app_core->disp_core->registerMember(docs_container);
|
disp_core->registerMember(docs_container);
|
||||||
this->app_core->disp_core->registerMember(project_present);
|
disp_core->registerMember(project_present);
|
||||||
this->app_core->disp_core->registerMember(this->app_core);
|
disp_core->registerMember(this->app_core);
|
||||||
|
|
||||||
setMinimumSize(1000, 600);
|
setMinimumSize(1000, 600);
|
||||||
setWindowTitle("提线木偶");
|
setWindowTitle("提线木偶");
|
||||||
|
@ -134,7 +137,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar)
|
||||||
if(file == "")
|
if(file == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this->app_core->disp_core->postCommand(OpenProject(file));
|
disp_core->postCommand(OpenProject(file));
|
||||||
build_internal(true);});
|
build_internal(true);});
|
||||||
sync_kernel->actionSync(opnp, [this]()->bool{return !project_manager->isOpen();});
|
sync_kernel->actionSync(opnp, [this]()->bool{return !project_manager->isOpen();});
|
||||||
|
|
||||||
|
@ -146,19 +149,22 @@ void MainWindow::initial_menubar(QMenuBar *mbar)
|
||||||
if(dir_path == "")
|
if(dir_path == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this->app_core->disp_core->postCommand(NewProject(QDir(dir_path), name));});
|
disp_core->postCommand(NewProject(QDir(dir_path), name));
|
||||||
|
});
|
||||||
sync_kernel->actionSync(newp, [this]()->bool{return !project_manager->isOpen();});
|
sync_kernel->actionSync(newp, [this]()->bool{return !project_manager->isOpen();});
|
||||||
|
|
||||||
auto clsp = project->addAction("关闭项目", [this]() {
|
auto clsp = project->addAction("关闭项目", [this]() {
|
||||||
this->app_core->disp_core->postCommand(CloseProject());
|
disp_core->postCommand(CloseProject());
|
||||||
this->refresh_views();});
|
this->refresh_views();
|
||||||
|
});
|
||||||
sync_kernel->actionSync(clsp, [this]()->bool{return project_manager->isOpen();});
|
sync_kernel->actionSync(clsp, [this]()->bool{return project_manager->isOpen();});
|
||||||
project->addSeparator();
|
project->addSeparator();
|
||||||
|
|
||||||
auto pnew = project->addAction("新建路径", [this]() {
|
auto pnew = project->addAction("新建路径", [this]() {
|
||||||
auto packages = QInputDialog::getText(this, "输入包路径名称/PackA/PackB/PackC", "包路径:");
|
auto packages = QInputDialog::getText(this, "输入包路径名称/PackA/PackB/PackC", "包路径:");
|
||||||
if(packages != "")
|
if(packages != "")
|
||||||
this->app_core->disp_core->postCommand(NewPackage(packages));});
|
disp_core->postCommand(NewPackage(packages));
|
||||||
|
});
|
||||||
sync_kernel->actionSync(pnew, [this]()->bool{return project_manager->isOpen();});
|
sync_kernel->actionSync(pnew, [this]()->bool{return project_manager->isOpen();});
|
||||||
|
|
||||||
auto _xnew = project->addMenu("新建文件");
|
auto _xnew = project->addMenu("新建文件");
|
||||||
|
@ -180,17 +186,16 @@ void MainWindow::initial_menubar(QMenuBar *mbar)
|
||||||
sync_kernel->widgetSync(_xnew, [this]()->bool{return project_manager->isOpen();});
|
sync_kernel->widgetSync(_xnew, [this]()->bool{return project_manager->isOpen();});
|
||||||
project->addSeparator();
|
project->addSeparator();
|
||||||
|
|
||||||
auto sav = project->addAction("保存全部", [this](){
|
auto sav = project->addAction(
|
||||||
this->app_core->disp_core->postCommand(SaveAll());});
|
"保存全部", [this]() { disp_core->postCommand(SaveAll()); });
|
||||||
sav->setShortcut(QKeySequence::StandardKey::Save);
|
sav->setShortcut(QKeySequence::StandardKey::Save);
|
||||||
sync_kernel->actionSync(sav, [this]()->bool{return project_manager->isOpen();});
|
sync_kernel->actionSync(sav, [this]()->bool{return project_manager->isOpen();});
|
||||||
project->addSeparator();
|
project->addSeparator();
|
||||||
|
|
||||||
project->addAction("退出", [this]() {
|
project->addAction("退出", [this]() {
|
||||||
this->app_core->disp_core->postCommand(SaveAll());
|
disp_core->postCommand(SaveAll());
|
||||||
QApplication::exit(0);});
|
QApplication::exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 编辑菜单
|
// 编辑菜单
|
||||||
auto edit = mbar->addMenu("编辑");
|
auto edit = mbar->addMenu("编辑");
|
||||||
|
@ -377,7 +382,7 @@ void MainWindow::refresh_views()
|
||||||
|
|
||||||
void MainWindow::build_internal(bool all_from_disk)
|
void MainWindow::build_internal(bool all_from_disk)
|
||||||
{
|
{
|
||||||
app_core->disp_core->postCommand(Build(all_from_disk));
|
disp_core->postCommand(Build(all_from_disk));
|
||||||
refresh_views();
|
refresh_views();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,13 +474,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// 关闭事件
|
// 关闭事件
|
||||||
if (project_manager->isOpen()) {
|
if (project_manager->isOpen()) {
|
||||||
project_manager->save();
|
disp_core->postCommand(CloseProject());
|
||||||
app_core->getDocsManager()->closeAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uilayout_save();
|
uilayout_save();
|
||||||
app_core->save();
|
|
||||||
|
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include "ContentPresent.h"
|
||||||
|
#include "DocsManager.h"
|
||||||
|
#include "fragmentsorderview.h"
|
||||||
|
#include "manager_docs.h"
|
||||||
|
#include "messagepresent.h"
|
||||||
|
#include "projectpresent.h"
|
||||||
|
#include "storyboardspresent.h"
|
||||||
|
#include "storychainspresent.h"
|
||||||
|
#include "storyconceptspresent.h"
|
||||||
|
#include "storyunitspresent.h"
|
||||||
|
#include "tools.h"
|
||||||
|
#include <QListView>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <libProjectManager.h>
|
|
||||||
#include <StoryTool.h>
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QListView>
|
#include <StoryTool.h>
|
||||||
#include "DocsManager.h"
|
#include <libProjectManager.h>
|
||||||
#include "messagepresent.h"
|
|
||||||
#include "storychainspresent.h"
|
|
||||||
#include "storyunitspresent.h"
|
|
||||||
#include "manager_docs.h"
|
|
||||||
#include "ContentPresent.h"
|
|
||||||
#include "storyboardspresent.h"
|
|
||||||
#include "storyconceptspresent.h"
|
|
||||||
#include "fragmentsorderview.h"
|
|
||||||
#include "tools.h"
|
|
||||||
#include "projectpresent.h"
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow, public Components::PresentContainer
|
class MainWindow : public QMainWindow, public Components::PresentContainer {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::AppCore *const app_core;
|
Core::AppCore *const app_core;
|
||||||
|
Schedule::CommandsDispatcher *const disp_core;
|
||||||
|
|
||||||
Tools::StatusSyncCore *const sync_kernel;
|
Tools::StatusSyncCore *const sync_kernel;
|
||||||
QSplitter *const horizontal_split;
|
QSplitter *const horizontal_split;
|
||||||
QSplitter *const vertical_split;
|
QSplitter *const vertical_split;
|
||||||
|
@ -40,7 +40,6 @@ private:
|
||||||
QTabWidget *const center_funcs;
|
QTabWidget *const center_funcs;
|
||||||
QTabWidget *const bottom_funcs;
|
QTabWidget *const bottom_funcs;
|
||||||
|
|
||||||
|
|
||||||
Project::ProjectManager *const project_manager;
|
Project::ProjectManager *const project_manager;
|
||||||
|
|
||||||
QListView *const welcome_list;
|
QListView *const welcome_list;
|
||||||
|
@ -49,7 +48,7 @@ private:
|
||||||
Components::StorychainsPresent *const chains_view;
|
Components::StorychainsPresent *const chains_view;
|
||||||
Components::StoryunitsPresent *const units_view;
|
Components::StoryunitsPresent *const units_view;
|
||||||
Components::MessagePresent *const errors_present;
|
Components::MessagePresent *const errors_present;
|
||||||
Components::StoryBoardsPresent *const boards_view;
|
Components::StoryboardsPresent *const boards_view;
|
||||||
Components::StoryconceptsPresent *const concept_view;
|
Components::StoryconceptsPresent *const concept_view;
|
||||||
Components::FragmentsOrderView *const fragments_order;
|
Components::FragmentsOrderView *const fragments_order;
|
||||||
|
|
||||||
|
@ -59,9 +58,11 @@ private:
|
||||||
void refresh_views();
|
void refresh_views();
|
||||||
|
|
||||||
void build_internal(bool all_from_disk = false);
|
void build_internal(bool all_from_disk = false);
|
||||||
void toggle_widget_visible(bool visible, QTabWidget *con, QWidget *target, const QString& title=QString());
|
void toggle_widget_visible(bool visible, QTabWidget *con, QWidget *target,
|
||||||
|
const QString &title = QString());
|
||||||
|
|
||||||
void splitter_layout_save(const QList<QString> &path_type, const QList<int> &size);
|
void splitter_layout_save(const QList<QString> &path_type,
|
||||||
|
const QList<int> &size);
|
||||||
|
|
||||||
void uilayout_save();
|
void uilayout_save();
|
||||||
void uilayout_load();
|
void uilayout_load();
|
||||||
|
@ -72,7 +73,6 @@ public:
|
||||||
virtual void active(MakeTools::ContentPresent *ins) override;
|
virtual void active(MakeTools::ContentPresent *ins) override;
|
||||||
virtual void remove(MakeTools::ContentPresent *ins) override;
|
virtual void remove(MakeTools::ContentPresent *ins) override;
|
||||||
|
|
||||||
|
|
||||||
void contentViewAppend(QWidget *widget, const QString &name);
|
void contentViewAppend(QWidget *widget, const QString &name);
|
||||||
void contentViewClose(QWidget *widget);
|
void contentViewClose(QWidget *widget);
|
||||||
|
|
||||||
|
@ -83,6 +83,5 @@ protected:
|
||||||
// QObject interface
|
// QObject interface
|
||||||
public:
|
public:
|
||||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -1,39 +1,83 @@
|
||||||
#include "storyboardspresent.h"
|
#include "storyboardspresent.h"
|
||||||
|
#include "command_list.h"
|
||||||
|
#include "opstream.h"
|
||||||
|
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
using namespace Parse::Result;
|
using namespace Parse::Result;
|
||||||
|
using namespace DataModel;
|
||||||
|
|
||||||
|
StoryboardsPresent::StoryboardsPresent(Schedule::CommandsDispatcher *core,
|
||||||
|
QWidget *parent)
|
||||||
|
: QWidget(parent), core_ins(core), tree_view(new QTreeView(this)),
|
||||||
|
details_view(new QTextEdit(this)) {
|
||||||
|
auto backend =
|
||||||
|
core->get<StoryboardsPresentModel>(NAME(StoryboardsPresentModel));
|
||||||
|
|
||||||
|
tree_view->setModel(backend->treeModel());
|
||||||
|
details_view->setDocument(backend->detailBackend());
|
||||||
|
details_view->setReadOnly(true);
|
||||||
|
|
||||||
StoryBoardsPresent::StoryBoardsPresent(Core::AppCore *core, QWidget *parent)
|
|
||||||
: QWidget(parent), core_ins(core),
|
|
||||||
tree_view(new QTreeView(this)), details_view(new QTextEdit(this)),
|
|
||||||
model_base(new QStandardItemModel(this))
|
|
||||||
{
|
|
||||||
tree_view->setModel(model_base);
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
auto splitter= new QSplitter(Qt::Vertical, this);
|
auto splitter= new QSplitter(Qt::Vertical, this);
|
||||||
layout->addWidget(splitter);
|
layout->addWidget(splitter);
|
||||||
|
|
||||||
splitter->addWidget(tree_view);
|
splitter->addWidget(tree_view);
|
||||||
splitter->addWidget(details_view);
|
splitter->addWidget(details_view);
|
||||||
details_view->setReadOnly(true);
|
|
||||||
|
|
||||||
connect(tree_view, &QTreeView::expanded, [this](){
|
connect(tree_view, &QTreeView::expanded, [this](){
|
||||||
tree_view->resizeColumnToContents(0);
|
tree_view->resizeColumnToContents(0);
|
||||||
tree_view->resizeColumnToContents(1);
|
tree_view->resizeColumnToContents(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(tree_view, &QTreeView::clicked, this, &StoryBoardsPresent::show_current_details);
|
connect(tree_view, &QTreeView::clicked, this, &StoryboardsPresent::show_current_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoryBoardsPresent::refresh()
|
using namespace CommandList;
|
||||||
{
|
void StoryboardsPresent::show_current_details(const QModelIndex &idx) {
|
||||||
|
if (!idx.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList<QString> path;
|
||||||
|
auto node = idx;
|
||||||
|
while (true) {
|
||||||
|
auto name = node.data().toString();
|
||||||
|
if (name.isEmpty())
|
||||||
|
break;
|
||||||
|
path.insert(0, name);
|
||||||
|
node = node.parent();
|
||||||
|
}
|
||||||
|
core_ins->postCommand(StoryboardDetailShow(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoryboardsPresent::jump_to(const QModelIndex &idx) {
|
||||||
|
if (!idx.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList<QString> path;
|
||||||
|
auto node = idx;
|
||||||
|
while (true) {
|
||||||
|
auto name = node.data().toString();
|
||||||
|
if (name.isEmpty())
|
||||||
|
break;
|
||||||
|
path.insert(0, name);
|
||||||
|
node = node.parent();
|
||||||
|
}
|
||||||
|
core_ins->postCommand(StoryboardJumpTo(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString StoryboardsPresent::name() const { return NAME(StoryboardsPresent); }
|
||||||
|
|
||||||
|
DataModel::StoryboardsPresentModel::StoryboardsPresentModel(Core::AppCore *core)
|
||||||
|
: core_ins(core), model_base(new QStandardItemModel),
|
||||||
|
detail_backend(new QTextDocument) {}
|
||||||
|
|
||||||
|
void DataModel::StoryboardsPresentModel::refresh() {
|
||||||
model_base->clear();
|
model_base->clear();
|
||||||
model_base->setHorizontalHeaderLabels(QStringList() << "名称" << "单元");
|
model_base->setHorizontalHeaderLabels(QStringList() << "名称"
|
||||||
|
<< "单元");
|
||||||
auto storys = core_ins->parseCore()->allStoryBoards();
|
auto storys = core_ins->parseCore()->allStoryBoards();
|
||||||
|
|
||||||
for (auto &b : storys) {
|
for (auto &b : storys) {
|
||||||
|
@ -47,7 +91,8 @@ void StoryBoardsPresent::refresh()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QList<QStandardItem *> row;
|
QList<QStandardItem *> row;
|
||||||
row << new QStandardItem("@"+static_cast<NamedNode*>(ref)->name()[0]);
|
row << new QStandardItem("@" +
|
||||||
|
static_cast<NamedNode *>(ref)->name()[0]);
|
||||||
row.last()->setEditable(false);
|
row.last()->setEditable(false);
|
||||||
row << new QStandardItem(static_cast<NamedNode *>(ref)->name()[1]);
|
row << new QStandardItem(static_cast<NamedNode *>(ref)->name()[1]);
|
||||||
row.last()->setEditable(false);
|
row.last()->setEditable(false);
|
||||||
|
@ -55,35 +100,69 @@ void StoryBoardsPresent::refresh()
|
||||||
item->appendRow(row);
|
item->appendRow(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->tree_view->resizeColumnToContents(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoryBoardsPresent::show_current_details(const QModelIndex &idx)
|
using namespace Operate;
|
||||||
{
|
void DataModel::StoryboardsPresentModel::detailShow(
|
||||||
if(!idx.isValid())
|
const QList<QString> &navi) {
|
||||||
return;
|
QList<QStandardItem *> items_list =
|
||||||
|
OpStream<QStandardItem *>([this](int &cnt, int idx) -> QStandardItem * {
|
||||||
|
cnt = model_base->rowCount();
|
||||||
|
if (cnt <= 0)
|
||||||
|
return nullptr;
|
||||||
|
return model_base->item(idx);
|
||||||
|
})
|
||||||
|
.select()
|
||||||
|
.toList();
|
||||||
|
|
||||||
details_view->clear();
|
for (auto &node : navi) {
|
||||||
auto item = model_base->itemFromIndex(idx.sibling(idx.row(), 0));
|
auto result = OpStream<QStandardItem *>(items_list)
|
||||||
|
.filter([node](QStandardItem *const &it) {
|
||||||
|
return node == it->text();
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (!result.size())
|
||||||
|
throw new SimpleException("指定的Storyunits路径无效:" +
|
||||||
|
navi.join("/"));
|
||||||
|
|
||||||
|
items_list = OpStream<QStandardItem *>(
|
||||||
|
[&result](int &cnt, int idx) -> QStandardItem * {
|
||||||
|
cnt = result[0]->rowCount();
|
||||||
|
if (cnt <= 0)
|
||||||
|
return nullptr;
|
||||||
|
return result[0]->child(idx);
|
||||||
|
})
|
||||||
|
.select()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString contents;
|
||||||
|
QStandardItem *item = items_list[0];
|
||||||
if (item->parent() == nullptr) {
|
if (item->parent() == nullptr) {
|
||||||
auto node = core_ins->parseCore()->queryStoryBoard(item->text());
|
auto node = core_ins->parseCore()->queryStoryBoard(item->text());
|
||||||
|
|
||||||
auto children = node.first()->children();
|
auto children = node.first()->children();
|
||||||
for (auto &it : children) {
|
for (auto &it : children) {
|
||||||
if (it->typeValue() != NODE_FRAGMENTREFERENCE) {
|
if (it->typeValue() != NODE_FRAGMENTREFERENCE) {
|
||||||
details_view->append(it->toString());
|
contents += it->toString() + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
auto node =
|
||||||
auto node = core_ins->parseCore()->queryStoryBoard(item->parent()->text());
|
core_ins->parseCore()->queryStoryBoard(item->parent()->text());
|
||||||
auto point = core_ins->parseCore()->queryStoryFragmentRefer(node.first(), item->text().mid(1));
|
auto point = core_ins->parseCore()->queryStoryFragmentRefer(
|
||||||
|
node.first(), item->text().mid(1));
|
||||||
|
|
||||||
auto children = point.first()->children();
|
auto children = point.first()->children();
|
||||||
for (auto &it : children) {
|
for (auto &it : children) {
|
||||||
details_view->append(it->toString());
|
contents += it->toString() + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detail_backend->setPlainText(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DataModel::StoryboardsPresentModel::name() const {
|
||||||
|
return NAME(StoryboardsPresentModel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,25 +7,51 @@
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Components {
|
namespace DataModel {
|
||||||
|
|
||||||
class StoryBoardsPresent : public QWidget
|
class StoryboardsPresentModel : public Schedule::AccessibleObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
StoryBoardsPresent(Core::AppCore *core, QWidget *parent=nullptr);
|
StoryboardsPresentModel(Core::AppCore *core);
|
||||||
|
virtual ~StoryboardsPresentModel();
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void detailShow(const QList<QString> &navi);
|
||||||
|
|
||||||
|
QStandardItemModel *treeModel() const;
|
||||||
|
QTextDocument *detailBackend() const;
|
||||||
|
|
||||||
|
// AccessibleObject interface
|
||||||
|
public:
|
||||||
|
virtual QString name() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::AppCore *const core_ins;
|
Core::AppCore *const core_ins;
|
||||||
|
QStandardItemModel *const model_base;
|
||||||
|
QTextDocument *const detail_backend;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace DataModel
|
||||||
|
|
||||||
|
namespace Components {
|
||||||
|
|
||||||
|
class StoryboardsPresent : public QWidget,
|
||||||
|
public Schedule::AccessibleObject {
|
||||||
|
public:
|
||||||
|
StoryboardsPresent(Schedule::CommandsDispatcher *core,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
// AccessibleObject interface
|
||||||
|
public:
|
||||||
|
virtual QString name() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Schedule::CommandsDispatcher *const core_ins;
|
||||||
QTreeView *const tree_view;
|
QTreeView *const tree_view;
|
||||||
QTextEdit *const details_view;
|
QTextEdit *const details_view;
|
||||||
QStandardItemModel *const model_base;
|
|
||||||
|
|
||||||
void show_current_details(const QModelIndex &idx);
|
void show_current_details(const QModelIndex &idx);
|
||||||
void click_to(const QModelIndex &idx);
|
void jump_to(const QModelIndex &idx);
|
||||||
};
|
};
|
||||||
}
|
} // namespace Components
|
||||||
|
|
||||||
|
|
||||||
#endif // STORYBOARDSPRESENT_H
|
#endif // STORYBOARDSPRESENT_H
|
||||||
|
|
|
@ -11,6 +11,7 @@ using namespace Parse;
|
||||||
using namespace Parse::Result;
|
using namespace Parse::Result;
|
||||||
using namespace Tools;
|
using namespace Tools;
|
||||||
using namespace CommandList;
|
using namespace CommandList;
|
||||||
|
using namespace DataModel;
|
||||||
|
|
||||||
StorychainsPresentModel::StorychainsPresentModel(Core::AppCore *core)
|
StorychainsPresentModel::StorychainsPresentModel(Core::AppCore *core)
|
||||||
: core_ins(core), model_base(new QStandardItemModel),
|
: core_ins(core), model_base(new QStandardItemModel),
|
||||||
|
|
|
@ -10,13 +10,12 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <libParse.h>
|
#include <libParse.h>
|
||||||
|
|
||||||
namespace Components {
|
namespace DataModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 情节链展示后端
|
* @brief 情节链展示后端
|
||||||
*/
|
*/
|
||||||
class StorychainsPresentModel : public Schedule::AccessibleObject
|
class StorychainsPresentModel : public Schedule::AccessibleObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
StorychainsPresentModel(Core::AppCore *core);
|
StorychainsPresentModel(Core::AppCore *core);
|
||||||
virtual ~StorychainsPresentModel();
|
virtual ~StorychainsPresentModel();
|
||||||
|
@ -36,9 +35,12 @@ namespace Components {
|
||||||
QStandardItemModel *const model_base;
|
QStandardItemModel *const model_base;
|
||||||
QTextDocument *const details_base;
|
QTextDocument *const details_base;
|
||||||
Tools::TreeSyncs<Parse::Result::DesNode *> *sync_tools;
|
Tools::TreeSyncs<Parse::Result::DesNode *> *sync_tools;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace DataModel
|
||||||
|
|
||||||
|
namespace Components {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 情节链展示视图
|
* @brief 情节链展示视图
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,8 +18,8 @@ StoryconceptsPresent::StoryconceptsPresent(CommandsDispatcher *core,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent), core_ins(core), tree_view(new QTreeView(this)),
|
: QWidget(parent), core_ins(core), tree_view(new QTreeView(this)),
|
||||||
details_view(new QTextBrowser(this)) {
|
details_view(new QTextBrowser(this)) {
|
||||||
auto backend =
|
auto backend = core->get<DataModel::StoryconceptsPresentModel>(
|
||||||
core->get<StoryconceptsPresentModel>(NAME(StoryconceptsPresentModel));
|
NAME(StoryconceptsPresentModel));
|
||||||
|
|
||||||
tree_view->setModel(backend->treeModel());
|
tree_view->setModel(backend->treeModel());
|
||||||
tree_view->setHeaderHidden(true);
|
tree_view->setHeaderHidden(true);
|
||||||
|
@ -78,6 +78,7 @@ QString StoryconceptsPresent::name() const {
|
||||||
return NAME(StoryconceptsPresent);
|
return NAME(StoryconceptsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace DataModel;
|
||||||
StoryconceptsPresentModel::StoryconceptsPresentModel(Core::AppCore *core)
|
StoryconceptsPresentModel::StoryconceptsPresentModel(Core::AppCore *core)
|
||||||
: core_ins(core), model_base(new QStandardItemModel),
|
: core_ins(core), model_base(new QStandardItemModel),
|
||||||
detail_backend(new QTextDocument) {
|
detail_backend(new QTextDocument) {
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Components {
|
namespace DataModel {
|
||||||
|
|
||||||
class StoryconceptsPresentModel : public Schedule::AccessibleObject {
|
class StoryconceptsPresentModel : public Schedule::AccessibleObject {
|
||||||
public:
|
public:
|
||||||
StoryconceptsPresentModel(Core::AppCore *core);
|
StoryconceptsPresentModel(Core::AppCore *core);
|
||||||
|
@ -33,6 +34,9 @@ namespace Components {
|
||||||
Tools::TreeSyncs<Parse::Result::DesNode *> *concept_model;
|
Tools::TreeSyncs<Parse::Result::DesNode *> *concept_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace DataModel
|
||||||
|
|
||||||
|
namespace Components {
|
||||||
class StoryconceptsPresent : public QWidget,
|
class StoryconceptsPresent : public QWidget,
|
||||||
public Schedule::AccessibleObject {
|
public Schedule::AccessibleObject {
|
||||||
public:
|
public:
|
||||||
|
@ -51,7 +55,6 @@ namespace Components {
|
||||||
public:
|
public:
|
||||||
virtual QString name() const override;
|
virtual QString name() const override;
|
||||||
};
|
};
|
||||||
}
|
} // namespace Components
|
||||||
|
|
||||||
|
|
||||||
#endif // STORYCONCEPTSPRESENT_H
|
#endif // STORYCONCEPTSPRESENT_H
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
using namespace Parse::Result;
|
using namespace Parse::Result;
|
||||||
using namespace Operate;
|
using namespace Operate;
|
||||||
|
using namespace DataModel;
|
||||||
|
|
||||||
StoryunitsPresentModel::StoryunitsPresentModel(Core::AppCore *core)
|
StoryunitsPresentModel::StoryunitsPresentModel(Core::AppCore *core)
|
||||||
: core_ins(core), model_ins(new QStandardItemModel),
|
: core_ins(core), model_ins(new QStandardItemModel),
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "appcore.h"
|
#include "appcore.h"
|
||||||
#include "libParse.h"
|
#include "libParse.h"
|
||||||
|
|
||||||
namespace Components {
|
namespace DataModel {
|
||||||
|
|
||||||
class StoryunitsPresentModel : public Schedule::AccessibleObject {
|
class StoryunitsPresentModel : public Schedule::AccessibleObject {
|
||||||
public:
|
public:
|
||||||
|
@ -33,6 +33,10 @@ namespace Components {
|
||||||
QTextDocument *const details_backend;
|
QTextDocument *const details_backend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace DataModel
|
||||||
|
|
||||||
|
namespace Components {
|
||||||
|
|
||||||
class StoryunitsPresent : public QWidget,
|
class StoryunitsPresent : public QWidget,
|
||||||
public Schedule::AccessibleObject {
|
public Schedule::AccessibleObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in New Issue