清除了编译错误,尚且欠缺构建机制和关联机制
This commit is contained in:
parent
576b5bfe67
commit
d2ac84894d
|
@ -81,12 +81,6 @@ else:unix: LIBS += -L$$OUT_PWD/../libProjectManager/ -llibProjectManager
|
||||||
INCLUDEPATH += $$PWD/../libProjectManager
|
INCLUDEPATH += $$PWD/../libProjectManager
|
||||||
DEPENDPATH += $$PWD/../libProjectManager
|
DEPENDPATH += $$PWD/../libProjectManager
|
||||||
|
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libParse/release/ -llibParse
|
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libParse/debug/ -llibParse
|
|
||||||
else:unix: LIBS += -L$$OUT_PWD/../libParse/ -llibParse
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../libParse
|
|
||||||
DEPENDPATH += $$PWD/../libParse
|
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
design.md
|
design.md
|
||||||
|
|
|
@ -130,7 +130,7 @@ void CloseProject::run(Schedule::CommandsDispatcher *core) const
|
||||||
{
|
{
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
||||||
vmgr->save();
|
vmgr->save();
|
||||||
vmgr->close();
|
vmgr->closeFile(vmgr->actives());
|
||||||
vmgr->projectManager()->save();
|
vmgr->projectManager()->save();
|
||||||
vmgr->projectManager()->closeProject();
|
vmgr->projectManager()->closeProject();
|
||||||
}
|
}
|
||||||
|
@ -168,33 +168,6 @@ void NewProject::fromText(const QString &line)
|
||||||
name_val = list[1];
|
name_val = list[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Build::Build(bool fromdisk)
|
|
||||||
:all_from_disk(fromdisk)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Build::name() const
|
|
||||||
{
|
|
||||||
return NAME(Build);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Build::run(Schedule::CommandsDispatcher *core) const
|
|
||||||
{
|
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
vmgr->build(all_from_disk);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Build::toText() const
|
|
||||||
{
|
|
||||||
return QString("%1").arg(all_from_disk);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Build::fromText(const QString &line)
|
|
||||||
{
|
|
||||||
all_from_disk = line.toUInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenFile::OpenFile(const Core::Route &path_node)
|
OpenFile::OpenFile(const Core::Route &path_node)
|
||||||
{
|
{
|
||||||
path_store = path_node.links();
|
path_store = path_node.links();
|
||||||
|
@ -214,13 +187,13 @@ void OpenFile::run(Schedule::CommandsDispatcher *core) const
|
||||||
{
|
{
|
||||||
auto mgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
auto mgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
||||||
if(path_store.size()){
|
if(path_store.size()){
|
||||||
mgr->openFile(Route::collect(path_store));
|
mgr->openFile(QList<Core::Route>() << Route::collect(path_store));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
auto index = mgr->projectManager()->queryIndex(final_file);
|
auto index = mgr->projectManager()->queryAccess()->queryIndex(final_file);
|
||||||
auto route = mgr->pathOf(index);
|
auto route = mgr->convertPath(index);
|
||||||
|
|
||||||
mgr->openFile(route);
|
mgr->openFile(QList<Core::Route>() << route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,204 +207,9 @@ void OpenFile::fromText(const QString &line)
|
||||||
path_store = line.split("/");
|
path_store = line.split("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StorychainJumpTo::StorychainJumpTo(const QList<QString> &node_path)
|
|
||||||
{
|
|
||||||
jump_path.append(node_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StorychainJumpTo::name() const
|
|
||||||
{
|
|
||||||
return NAME(StorychainJumpTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StorychainJumpTo::run(Schedule::CommandsDispatcher *core) const
|
|
||||||
{
|
|
||||||
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
|
||||||
auto chain_ins = core_ins->parseCore()->queryStoryChain(jump_path[0]).first();
|
|
||||||
|
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
auto index = vmgr->projectManager()->queryIndex(chain_ins->doc()->filePath());
|
|
||||||
auto route = vmgr->pathOf(index);
|
|
||||||
|
|
||||||
vmgr->openFile(route);
|
|
||||||
vmgr->activePresentOf(route)->jumpTo(jump_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StorychainJumpTo::toText() const
|
|
||||||
{
|
|
||||||
return jump_path.join("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
void StorychainJumpTo::fromText(const QString &line)
|
|
||||||
{
|
|
||||||
jump_path=line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "storyboardspresent.h"
|
|
||||||
#include "storychainspresent.h"
|
|
||||||
#include "storyunitspresent.h"
|
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
using namespace DataModel;
|
using namespace DataModel;
|
||||||
|
|
||||||
StorychainDetailShow::StorychainDetailShow(const QList<QString> &chain_path)
|
|
||||||
: chain_path(chain_path)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StorychainDetailShow::name() const
|
|
||||||
{
|
|
||||||
return NAME(StorychainDetailShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StorychainDetailShow::run(Schedule::CommandsDispatcher *core) const
|
|
||||||
{
|
|
||||||
auto backend = core->get<StorychainsPresentModel>(NAME(StorychainsPresentModel));
|
|
||||||
backend->showDetails(chain_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StorychainDetailShow::toText() const
|
|
||||||
{
|
|
||||||
return chain_path.join("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
void StorychainDetailShow::fromText(const QString &line)
|
|
||||||
{
|
|
||||||
chain_path = line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
StoryunitDetailShow::StoryunitDetailShow(const QList<QString> &path) {
|
|
||||||
unit_nav.append(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryunitDetailShow::name() const { return NAME(StoryunitDetailShow); }
|
|
||||||
|
|
||||||
void StoryunitDetailShow::run(Schedule::CommandsDispatcher *core) const {
|
|
||||||
auto backend =
|
|
||||||
core->get<StoryunitsPresentModel>(NAME(StoryunitsPresentModel));
|
|
||||||
backend->details_show(unit_nav);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryunitDetailShow::toText() const { return unit_nav.join("/"); }
|
|
||||||
|
|
||||||
void StoryunitDetailShow::fromText(const QString &line) {
|
|
||||||
unit_nav = line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
StoryunitJumpTo::StoryunitJumpTo(const QList<QString> &path) {
|
|
||||||
unit_nav = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryunitJumpTo::name() const { return NAME(StoryunitJumpTo); }
|
|
||||||
|
|
||||||
void StoryunitJumpTo::run(Schedule::CommandsDispatcher *core) const {
|
|
||||||
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
|
|
||||||
auto unit_ins = core_ins->parseCore()->queryStoryUnit(unit_nav[0]).first();
|
|
||||||
auto index =
|
|
||||||
vmgr->projectManager()->queryIndex(unit_ins->doc()->filePath());
|
|
||||||
auto pjt_path = vmgr->converter(index);
|
|
||||||
vmgr->openFile(pjt_path);
|
|
||||||
vmgr->activePresentOf(pjt_path)->jumpTo(unit_nav);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryunitJumpTo::toText() const { return unit_nav.join("/"); }
|
|
||||||
|
|
||||||
void StoryunitJumpTo::fromText(const QString &line) {
|
|
||||||
unit_nav = line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "storyconceptspresent.h"
|
|
||||||
StoryconceptDetailShow::StoryconceptDetailShow(const QList<QString> &path) {
|
|
||||||
navi_path.append(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryconceptDetailShow::name() const {
|
|
||||||
return NAME(StoryconceptDetailShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StoryconceptDetailShow::run(Schedule::CommandsDispatcher *core) const {
|
|
||||||
auto vmgr =
|
|
||||||
core->get<StoryconceptsPresentModel>(NAME(StoryconceptsPresentModel));
|
|
||||||
vmgr->detailsShow(navi_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryconceptDetailShow::toText() const { return navi_path.join("/"); }
|
|
||||||
|
|
||||||
void StoryconceptDetailShow::fromText(const QString &line) {
|
|
||||||
navi_path = line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
StoryconceptJumpTo::StoryconceptJumpTo(const QList<QString> &path) {
|
|
||||||
navi_path.append(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryconceptJumpTo::name() const { return NAME(StoryconceptJumpTo); }
|
|
||||||
|
|
||||||
void StoryconceptJumpTo::run(Schedule::CommandsDispatcher *core) const {
|
|
||||||
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
|
|
||||||
auto cept_ins =
|
|
||||||
core_ins->parseCore()->queryStoryConcept(navi_path[0]).first();
|
|
||||||
auto cept_doc = cept_ins->doc();
|
|
||||||
auto idx = vmgr->projectManager()->queryIndex(cept_doc->filePath());
|
|
||||||
auto route = vmgr->converter(idx);
|
|
||||||
vmgr->openFile(route);
|
|
||||||
vmgr->activePresentOf(route)->jumpTo(navi_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryconceptJumpTo::toText() const { return navi_path.join("/"); }
|
|
||||||
|
|
||||||
void StoryconceptJumpTo::fromText(const QString &line) {
|
|
||||||
navi_path = line.split("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
StoryboardJumpTo::StoryboardJumpTo(const QList<QString> &path) {
|
|
||||||
navi_path.append(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryboardJumpTo::name() const { return NAME(StoryboardJumpTo); }
|
|
||||||
|
|
||||||
void StoryboardJumpTo::run(Schedule::CommandsDispatcher *core) const {
|
|
||||||
auto core_ins = core->get<AppCore>(NAME(AppCore));
|
|
||||||
|
|
||||||
auto unit_ins = core_ins->parseCore()->queryStoryUnit(navi_path[0]).first();
|
|
||||||
auto unit_doc = unit_ins->doc();
|
|
||||||
|
|
||||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
|
||||||
|
|
||||||
auto index = vmgr->projectManager()->queryIndex(unit_doc->filePath());
|
|
||||||
auto route = vmgr->converter(index);
|
|
||||||
vmgr->openFile(route);
|
|
||||||
vmgr->activePresentOf(route)->jumpTo(navi_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString StoryboardJumpTo::toText() const { return navi_path.join("/"); }
|
|
||||||
|
|
||||||
void StoryboardJumpTo::fromText(const QString &line) { navi_path.append(line.split("/")); }
|
|
||||||
|
|
||||||
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("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
CompVisible::CompVisible(Components::PresentHost *host, PresentBase *target, bool state) : host_ins(host), target_ins(target), state_val(state) {
|
CompVisible::CompVisible(Components::PresentHost *host, PresentBase *target, bool state) : host_ins(host), target_ins(target), state_val(state) {
|
||||||
path = Route::collect(QList<QString>() << target->name());
|
path = Route::collect(QList<QString>() << target->name());
|
||||||
}
|
}
|
||||||
|
@ -441,9 +219,9 @@ QString CompVisible::name() const { return QString("/%1[%2]").arg(NAME(CompVisib
|
||||||
void CompVisible::run(Schedule::CommandsDispatcher *core) const {
|
void CompVisible::run(Schedule::CommandsDispatcher *core) const {
|
||||||
target_ins->widget()->setVisible(state_val);
|
target_ins->widget()->setVisible(state_val);
|
||||||
if (state_val) {
|
if (state_val) {
|
||||||
host_ins->append(target_ins, path);
|
host_ins->append(target_ins);
|
||||||
} else {
|
} else {
|
||||||
host_ins->remove(path);
|
host_ins->remove(target_ins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,143 +113,6 @@ namespace CommandList {
|
||||||
virtual void fromText(const QString &line) override;
|
virtual void fromText(const QString &line) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Build : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
Build(bool fromdisk);
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool all_from_disk;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 故事脉络相关命令 ========================================================
|
|
||||||
class StorychainDetailShow : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StorychainDetailShow(const QList<QString> &chain_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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> chain_path;
|
|
||||||
};
|
|
||||||
class StorychainJumpTo : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StorychainJumpTo(const QList<QString> &node_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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> jump_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 故事单元相关命令 ======================================================
|
|
||||||
class StoryunitDetailShow : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StoryunitDetailShow(const QList<QString> &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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> unit_nav;
|
|
||||||
};
|
|
||||||
|
|
||||||
class StoryunitJumpTo : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StoryunitJumpTo(const QList<QString> &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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> unit_nav;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 故事概念相关命令===================================================
|
|
||||||
class StoryconceptDetailShow : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StoryconceptDetailShow(const QList<QString> &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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> navi_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
class StoryconceptJumpTo : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
StoryconceptJumpTo(const QList<QString> &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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> navi_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
class StoryboardDetailShow : public Schedule::GeCommand {
|
|
||||||
public:
|
|
||||||
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
|
|
||||||
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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QString> navi_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 切换视图组件 ================================================================
|
// 切换视图组件 ================================================================
|
||||||
class CompVisible : public Schedule::GeCommand {
|
class CompVisible : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -28,59 +28,49 @@ using namespace Core;
|
||||||
using namespace Tools;
|
using namespace Tools;
|
||||||
using namespace CommandList;
|
using namespace CommandList;
|
||||||
using namespace DataModel;
|
using namespace DataModel;
|
||||||
|
using namespace bridge;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
app_core(new AppCore(this)),
|
|
||||||
sync_kernel(new StatusSyncCore(this)),
|
sync_kernel(new StatusSyncCore(this)),
|
||||||
|
parse_service(new ParseBridge()),
|
||||||
split_first(new QSplitter(Qt::Horizontal, this)),
|
split_first(new QSplitter(Qt::Horizontal, this)),
|
||||||
split_second(new QSplitter(Qt::Vertical, this)),
|
split_second(new QSplitter(Qt::Vertical, this)),
|
||||||
split_third(new QSplitter(Qt::Horizontal, this)),
|
split_third(new QSplitter(Qt::Horizontal, this)),
|
||||||
project_manager(new XMLProjectManager(this)),
|
project_manager(new XMLProjectManager(this)),
|
||||||
|
center_frame(new PresentContainer(QTabWidget::North, this)),
|
||||||
|
messages_frame(new QTabWidget(this)),
|
||||||
|
active_docscollect(new DocumentsManager(project_manager)),
|
||||||
welcome_list(new WelcomePanel()),
|
welcome_list(new WelcomePanel()),
|
||||||
errors_present(new MessagesPresent(app_core->getMakeCore(), this)),
|
errors_present(new MessagesPresent(parse_service->errorsPresentModel(), this)),
|
||||||
project_present(new ProjectPresent(XApp::disp_core, docs_container, this)) {
|
project_present(new ProjectPresent(XApp::disp_core, active_docscollect, this)) {
|
||||||
|
|
||||||
QApplication::instance()->installEventFilter(this);
|
QApplication::instance()->installEventFilter(this);
|
||||||
initial_commandlist(XApp::disp_core);
|
initial_commandlist(XApp::disp_core);
|
||||||
|
|
||||||
XApp::disp_core->registerMember(this->app_core);
|
XApp::disp_core->registerMember(active_docscollect);
|
||||||
this->app_core->setCurrentProject(project_manager);
|
|
||||||
XApp::disp_core->registerMember(docs_container);
|
|
||||||
XApp::disp_core->registerMember(fragments_model);
|
|
||||||
XApp::disp_core->registerMember(boards_model);
|
|
||||||
XApp::disp_core->registerMember(chains_model);
|
|
||||||
XApp::disp_core->registerMember(concepts_model);
|
|
||||||
XApp::disp_core->registerMember(units_model);
|
|
||||||
|
|
||||||
setMinimumSize(1000, 600);
|
setMinimumSize(1000, 600);
|
||||||
setWindowTitle("提线木偶");
|
setWindowTitle("提线木偶");
|
||||||
|
|
||||||
project_present->widget()->setVisible(false);
|
project_present->widget()->setVisible(false);
|
||||||
chains_view->setVisible(false);
|
|
||||||
units_view->setVisible(false);
|
|
||||||
errors_present->setVisible(false);
|
errors_present->setVisible(false);
|
||||||
boards_view->setVisible(false);
|
|
||||||
concept_view->setVisible(false);
|
|
||||||
fragments_order->setVisible(false);
|
|
||||||
|
|
||||||
auto mbar = menuBar();
|
auto mbar = menuBar();
|
||||||
initial_menubar(mbar);
|
initial_menubar(mbar);
|
||||||
|
|
||||||
setCentralWidget(this->split_first);
|
setCentralWidget(this->split_first);
|
||||||
this->split_first->addWidget(left_funcs->hostWidget());
|
this->split_first->addWidget(project_present);
|
||||||
this->split_first->addWidget(this->split_second);
|
this->split_first->addWidget(this->split_second);
|
||||||
|
|
||||||
this->split_second->addWidget(this->split_third);
|
this->split_second->addWidget(this->split_third);
|
||||||
this->split_second->addWidget(this->bottom_funcs->hostWidget());
|
this->split_second->addWidget(this->errors_present);
|
||||||
|
|
||||||
this->split_third->addWidget(this->center_funcs->hostWidget());
|
this->split_third->addWidget(this->center_frame->hostWidget());
|
||||||
this->split_third->addWidget(this->right_funcs->hostWidget());
|
this->split_third->addWidget(this->messages_frame);
|
||||||
|
this->messages_frame->setTabPosition(QTabWidget::TabPosition::South);
|
||||||
|
|
||||||
connect(static_cast<PresentContainer *>(left_funcs), &PresentContainer::presentTransTo, this, &MainWindow::accept_view_transport);
|
this->active_docscollect->setPresent(this);
|
||||||
connect(static_cast<PresentContainer *>(right_funcs), &PresentContainer::presentTransTo, this, &MainWindow::accept_view_transport);
|
|
||||||
connect(static_cast<PresentContainer *>(bottom_funcs), &PresentContainer::presentTransTo, this, &MainWindow::accept_view_transport);
|
|
||||||
connect(static_cast<PresentContainer *>(center_funcs), &PresentContainer::presentTransTo, this, &MainWindow::accept_view_transport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() {}
|
||||||
|
@ -95,7 +85,6 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XApp::disp_core->postCommand(OpenProject(file));
|
XApp::disp_core->postCommand(OpenProject(file));
|
||||||
build_internal(true);
|
|
||||||
});
|
});
|
||||||
sync_kernel->actionEnableSync(opnp, [this]() -> bool { return !project_manager->isOpenning(); });
|
sync_kernel->actionEnableSync(opnp, [this]() -> bool { return !project_manager->isOpenning(); });
|
||||||
|
|
||||||
|
@ -111,11 +100,9 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
});
|
});
|
||||||
sync_kernel->actionEnableSync(newp, [this]() -> bool { return !project_manager->isOpenning(); });
|
sync_kernel->actionEnableSync(newp, [this]() -> bool { return !project_manager->isOpenning(); });
|
||||||
|
|
||||||
auto clsp = project->addAction("关闭项目", [this]() {
|
auto clsp = project->addAction("关闭项目", [this]() { XApp::disp_core->postCommand(CloseProject()); });
|
||||||
XApp::disp_core->postCommand(CloseProject());
|
|
||||||
this->refresh_views();
|
|
||||||
});
|
|
||||||
sync_kernel->actionEnableSync(clsp, [this]() -> bool { return project_manager->isOpenning(); });
|
sync_kernel->actionEnableSync(clsp, [this]() -> bool { return project_manager->isOpenning(); });
|
||||||
|
|
||||||
project->addSeparator();
|
project->addSeparator();
|
||||||
|
|
||||||
auto pnew = project->addAction("新建路径", [this]() {
|
auto pnew = project->addAction("新建路径", [this]() {
|
||||||
|
@ -127,7 +114,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
|
|
||||||
auto _xnew = project->addMenu("新建文件");
|
auto _xnew = project->addMenu("新建文件");
|
||||||
_xnew->setEnabled(project_manager->isOpenning());
|
_xnew->setEnabled(project_manager->isOpenning());
|
||||||
auto types = docs_container->fileTypes();
|
auto types = active_docscollect->fileTypes();
|
||||||
for (auto &t : types) {
|
for (auto &t : types) {
|
||||||
_xnew->addAction(t, [this, &t]() {
|
_xnew->addAction(t, [this, &t]() {
|
||||||
auto name = QInputDialog::getText(this, "输入名称", "名称:");
|
auto name = QInputDialog::getText(this, "输入名称", "名称:");
|
||||||
|
@ -138,7 +125,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
idx = project_manager->model()->item(0)->index();
|
idx = project_manager->model()->item(0)->index();
|
||||||
|
|
||||||
auto group_path = docs_container->converter(idx);
|
auto group_path = active_docscollect->convertPath(idx);
|
||||||
XApp::disp_core->postCommand(NewFile(group_path, name, t));
|
XApp::disp_core->postCommand(NewFile(group_path, name, t));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -148,6 +135,7 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
auto sav = project->addAction("保存全部", [this]() { XApp::disp_core->postCommand(SaveAll()); });
|
auto sav = project->addAction("保存全部", [this]() { XApp::disp_core->postCommand(SaveAll()); });
|
||||||
sav->setShortcut(QKeySequence::StandardKey::Save);
|
sav->setShortcut(QKeySequence::StandardKey::Save);
|
||||||
sync_kernel->actionEnableSync(sav, [this]() -> bool { return project_manager->isOpenning(); });
|
sync_kernel->actionEnableSync(sav, [this]() -> bool { return project_manager->isOpenning(); });
|
||||||
|
|
||||||
project->addSeparator();
|
project->addSeparator();
|
||||||
|
|
||||||
project->addAction("退出", [this]() {
|
project->addAction("退出", [this]() {
|
||||||
|
@ -181,18 +169,6 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
sync_kernel->actionCheckSync(act_status, [xstatus]() -> bool { return xstatus->isVisible(); });
|
sync_kernel->actionCheckSync(act_status, [xstatus]() -> bool { return xstatus->isVisible(); });
|
||||||
connect(act_status, &QAction::triggered, [xstatus](bool v) { xstatus->setVisible(v); });
|
connect(act_status, &QAction::triggered, [xstatus](bool v) { xstatus->setVisible(v); });
|
||||||
|
|
||||||
auto act_left = area->addAction("左侧功能区");
|
|
||||||
sync_kernel->actionCheckSync(act_left, [this]() -> bool { return this->left_funcs->visibleState(); });
|
|
||||||
connect(act_left, &QAction::triggered, [this](bool v) { this->left_funcs->setVisibleState(v); });
|
|
||||||
|
|
||||||
auto act_right = area->addAction("右侧功能区");
|
|
||||||
sync_kernel->actionCheckSync(act_right, [this]() -> bool { return this->right_funcs->visibleState(); });
|
|
||||||
connect(act_right, &QAction::triggered, [this](bool v) { this->right_funcs->setVisibleState(v); });
|
|
||||||
|
|
||||||
auto act_bottom = area->addAction("底部功能区");
|
|
||||||
sync_kernel->actionCheckSync(act_bottom, [this]() -> bool { return this->bottom_funcs->visibleState(); });
|
|
||||||
connect(act_bottom, &QAction::triggered, [this](bool v) { this->bottom_funcs->setVisibleState(v); });
|
|
||||||
|
|
||||||
view->addSeparator();
|
view->addSeparator();
|
||||||
auto change = view->addMenu("内容切换");
|
auto change = view->addMenu("内容切换");
|
||||||
change->addAction("序列视图");
|
change->addAction("序列视图");
|
||||||
|
@ -207,64 +183,6 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
}
|
}
|
||||||
func->addAction("引用统计");
|
func->addAction("引用统计");
|
||||||
func->addAction("脉络分蘖");
|
func->addAction("脉络分蘖");
|
||||||
// 编译信息
|
|
||||||
{
|
|
||||||
auto msgs = func->addAction("编译输出", [this](bool v) {
|
|
||||||
XApp::disp_core->postCommand(CompVisible(this, this->errors_present, true));
|
|
||||||
XApp::disp_core->postCommand(Build(false));
|
|
||||||
});
|
|
||||||
sync_kernel->actionCheckSync(msgs, [this]() -> bool { return bottom_funcs->contains(errors_present); });
|
|
||||||
}
|
|
||||||
// 脉络统计
|
|
||||||
{
|
|
||||||
auto chain_v = func->addAction("脉络统计", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, this->chains_view, v)); });
|
|
||||||
chain_v->setCheckable(true);
|
|
||||||
sync_kernel->registerTrigger([this]() -> bool { return right_funcs->contains(chains_view); },
|
|
||||||
[chain_v](bool v) {
|
|
||||||
if (v != chain_v->isChecked())
|
|
||||||
chain_v->setChecked(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 单元统计
|
|
||||||
{
|
|
||||||
auto unit_v = func->addAction("单元统计", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, this->units_view, v)); });
|
|
||||||
unit_v->setCheckable(true);
|
|
||||||
sync_kernel->registerTrigger([this]() -> bool { return right_funcs->contains(units_view); },
|
|
||||||
[unit_v](bool v) {
|
|
||||||
if (v != unit_v->isChecked())
|
|
||||||
unit_v->setChecked(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 故事统计
|
|
||||||
{
|
|
||||||
auto board_v = func->addAction("故事统计", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, boards_view, v)); });
|
|
||||||
board_v->setCheckable(true);
|
|
||||||
sync_kernel->registerTrigger([this]() -> bool { return right_funcs->contains(boards_view); },
|
|
||||||
[board_v](bool v) {
|
|
||||||
if (v != board_v->isChecked())
|
|
||||||
board_v->setChecked(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 概念统计
|
|
||||||
{
|
|
||||||
auto concept_v = func->addAction("概念统计", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, concept_view, v)); });
|
|
||||||
concept_v->setCheckable(true);
|
|
||||||
sync_kernel->registerTrigger([this]() -> bool { return right_funcs->contains(concept_view); },
|
|
||||||
[concept_v](bool v) {
|
|
||||||
if (v != concept_v->isChecked())
|
|
||||||
concept_v->setChecked(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 情节序列
|
|
||||||
{
|
|
||||||
auto fragments_v = func->addAction("情节序列", [this](bool v) { XApp::disp_core->postCommand(CompVisible(this, fragments_order, v)); });
|
|
||||||
fragments_v->setCheckable(true);
|
|
||||||
sync_kernel->registerTrigger([this]() -> bool { return right_funcs->contains(fragments_order); },
|
|
||||||
[fragments_v](bool v) {
|
|
||||||
if (v != fragments_v->isChecked())
|
|
||||||
fragments_v->setChecked(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 工具菜单
|
// 工具菜单
|
||||||
auto tool = mbar->addMenu("工具");
|
auto tool = mbar->addMenu("工具");
|
||||||
|
@ -282,8 +200,6 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
exp->addAction("导出WsOutlines");
|
exp->addAction("导出WsOutlines");
|
||||||
exp->addSeparator();
|
exp->addSeparator();
|
||||||
exp->addAction("导出TXT内容");
|
exp->addAction("导出TXT内容");
|
||||||
auto build = tool->addAction("编译", [this]() { this->build_internal(); });
|
|
||||||
sync_kernel->actionEnableSync(build, [this]() -> bool { return project_manager->isOpenning(); });
|
|
||||||
|
|
||||||
// 窗口菜单
|
// 窗口菜单
|
||||||
auto window = mbar->addMenu("窗口");
|
auto window = mbar->addMenu("窗口");
|
||||||
|
@ -303,17 +219,11 @@ void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initial_commandlist(Schedule::CommandsDispatcher *host) {
|
void MainWindow::initial_commandlist(Schedule::CommandsDispatcher *host) {
|
||||||
host->registerCommand(new Build(true));
|
|
||||||
host->registerCommand(new CloseProject());
|
host->registerCommand(new CloseProject());
|
||||||
|
|
||||||
host->registerCommand(new CompVisible(this, welcome_list, true));
|
host->registerCommand(new CompVisible(this, welcome_list, true));
|
||||||
host->registerCommand(new CompVisible(this, errors_present, true));
|
host->registerCommand(new CompVisible(this, errors_present, true));
|
||||||
host->registerCommand(new CompVisible(this, project_present, true));
|
host->registerCommand(new CompVisible(this, project_present, true));
|
||||||
host->registerCommand(new CompVisible(this, fragments_order, true));
|
|
||||||
host->registerCommand(new CompVisible(this, boards_view, true));
|
|
||||||
host->registerCommand(new CompVisible(this, chains_view, true));
|
|
||||||
host->registerCommand(new CompVisible(this, concept_view, true));
|
|
||||||
host->registerCommand(new CompVisible(this, units_view, true));
|
|
||||||
|
|
||||||
host->registerCommand(new NewFile(Route(), "", ""));
|
host->registerCommand(new NewFile(Route(), "", ""));
|
||||||
host->registerCommand(new NewPackage(""));
|
host->registerCommand(new NewPackage(""));
|
||||||
|
@ -321,113 +231,18 @@ void MainWindow::initial_commandlist(Schedule::CommandsDispatcher *host) {
|
||||||
host->registerCommand(new OpenFile(Route()));
|
host->registerCommand(new OpenFile(Route()));
|
||||||
host->registerCommand(new OpenProject(""));
|
host->registerCommand(new OpenProject(""));
|
||||||
host->registerCommand(new SaveAll());
|
host->registerCommand(new SaveAll());
|
||||||
host->registerCommand(new StoryboardDetailShow(QList<QString>()));
|
|
||||||
host->registerCommand(new StoryboardJumpTo(QList<QString>()));
|
|
||||||
host->registerCommand(new StorychainDetailShow(QList<QString>()));
|
|
||||||
host->registerCommand(new StorychainJumpTo(QList<QString>()));
|
|
||||||
host->registerCommand(new StoryconceptDetailShow(QList<QString>()));
|
|
||||||
host->registerCommand(new StoryconceptJumpTo(QList<QString>()));
|
|
||||||
host->registerCommand(new StoryunitDetailShow(QList<QString>()));
|
|
||||||
host->registerCommand(new StoryunitJumpTo(QList<QString>()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refresh_views() {
|
void MainWindow::append(PresentBase *ins) { this->center_frame->append(ins); }
|
||||||
errors_present->refresh();
|
|
||||||
chains_model->refreshTree();
|
|
||||||
units_model->refreshTree();
|
|
||||||
boards_model->refresh();
|
|
||||||
concepts_model->refreshTree();
|
|
||||||
fragments_model->refreshTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::build_internal(bool all_from_disk) {
|
|
||||||
XApp::disp_core->postCommand(Build(all_from_disk));
|
|
||||||
refresh_views();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::splitter_layout_save(const QList<QString> &path_type, const QList<int> &size) {
|
|
||||||
auto convert = [](QList<int> sizes) -> QStringList {
|
|
||||||
QStringList size_strs;
|
|
||||||
for (auto i : sizes)
|
|
||||||
size_strs << QString("%1").arg(i);
|
|
||||||
return size_strs;
|
|
||||||
};
|
|
||||||
app_core->globalConfig()->setList(path_type, convert(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LEFT_SIDE "left"
|
|
||||||
#define RIGHT_SIDE "right"
|
|
||||||
#define BOTTOM_SIDE "bottom"
|
|
||||||
#define CENTER_SIDE "center"
|
|
||||||
void MainWindow::append(PresentBase *ins) {
|
|
||||||
auto cfg = project_manager->configraions();
|
|
||||||
auto pos_query = QList<QString>() << "unique-record"
|
|
||||||
<< "split-area"
|
|
||||||
<< "index-hash"
|
|
||||||
<< "store-point";
|
|
||||||
|
|
||||||
auto hash_pos = cfg->getMap(pos_query);
|
|
||||||
auto unique_key = unique.links().join("/");
|
|
||||||
auto pos = hash_pos[unique_key];
|
|
||||||
|
|
||||||
if (pos == "") {
|
|
||||||
pos = CENTER_SIDE;
|
|
||||||
hash_pos[unique_key] = pos;
|
|
||||||
cfg->setMap(pos_query, hash_pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pos == LEFT_SIDE) {
|
|
||||||
left_funcs->append(ins, unique);
|
|
||||||
} else if (pos == RIGHT_SIDE) {
|
|
||||||
right_funcs->append(ins, unique);
|
|
||||||
} else if (pos == BOTTOM_SIDE) {
|
|
||||||
bottom_funcs->append(ins, unique);
|
|
||||||
} else if (pos == CENTER_SIDE) {
|
|
||||||
center_funcs->append(ins, unique);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void MainWindow::accept_view_transport(const Core::Route &key, Components::GroupType type) {
|
|
||||||
auto cfg = project_manager->configraions();
|
|
||||||
auto pos_query = QList<QString>() << "unique-record"
|
|
||||||
<< "split-area"
|
|
||||||
<< "index-hash"
|
|
||||||
<< "store-point";
|
|
||||||
|
|
||||||
auto hash_pos = cfg->getMap(pos_query);
|
|
||||||
auto unique_key = key.links().join("/");
|
|
||||||
|
|
||||||
if (type == GroupType::LEFT)
|
|
||||||
hash_pos[unique_key] = LEFT_SIDE;
|
|
||||||
else if (type == GroupType::RIGHT)
|
|
||||||
hash_pos[unique_key] = RIGHT_SIDE;
|
|
||||||
else if (type == GroupType::BOTTOM)
|
|
||||||
hash_pos[unique_key] = BOTTOM_SIDE;
|
|
||||||
else
|
|
||||||
hash_pos[unique_key] = CENTER_SIDE;
|
|
||||||
cfg->setMap(pos_query, hash_pos);
|
|
||||||
|
|
||||||
auto xins = remove(key);
|
|
||||||
append(xins, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::active(const PresentBase *ins) {
|
bool MainWindow::active(const PresentBase *ins) {
|
||||||
PresentHost *array[4] = {left_funcs, right_funcs, bottom_funcs, center_funcs};
|
center_frame->active(ins);
|
||||||
for (auto &it : array)
|
|
||||||
it->active(ins);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::remove(const PresentBase *ins) {
|
void MainWindow::remove(const PresentBase *ins) { this->center_frame->remove(ins); }
|
||||||
PresentHost *array[4] = {left_funcs, right_funcs, bottom_funcs, center_funcs};
|
|
||||||
for (auto &it : array) {
|
|
||||||
auto ins = it->remove(unique);
|
|
||||||
if (ins)
|
|
||||||
return ins;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::contains(const PresentBase *ins) const { return false; }
|
bool MainWindow::contains(const PresentBase *ins) const { return this->center_frame->contains(ins); }
|
||||||
|
|
||||||
QWidget *MainWindow::hostWidget() const { return (QWidget *)this; }
|
QWidget *MainWindow::hostWidget() const { return (QWidget *)this; }
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "DocsManager.h"
|
#include "DocsManager.h"
|
||||||
#include "manager_docs.h"
|
#include "manager_docs.h"
|
||||||
#include "messagespresent.h"
|
#include "messagespresent.h"
|
||||||
|
#include "parsebridge.h"
|
||||||
#include "presentcontainer.h"
|
#include "presentcontainer.h"
|
||||||
#include "projectpresent.h"
|
#include "projectpresent.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
@ -24,6 +25,7 @@ class MainWindow : public QMainWindow, public Components::PresentHost {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tools::StatusSyncCore *const sync_kernel;
|
Tools::StatusSyncCore *const sync_kernel;
|
||||||
|
bridge::ParseBridge *const parse_service;
|
||||||
QSplitter *const split_first;
|
QSplitter *const split_first;
|
||||||
QSplitter *const split_second;
|
QSplitter *const split_second;
|
||||||
QSplitter *const split_third;
|
QSplitter *const split_third;
|
||||||
|
@ -31,13 +33,11 @@ private:
|
||||||
Project::ProjectManager *const project_manager;
|
Project::ProjectManager *const project_manager;
|
||||||
|
|
||||||
// containers =======================================
|
// containers =======================================
|
||||||
Components::PresentHost *const left_funcs;
|
Components::PresentHost *const center_frame;
|
||||||
Components::PresentHost *const right_funcs;
|
QTabWidget *const messages_frame;
|
||||||
Components::PresentHost *const center_funcs;
|
|
||||||
Components::PresentHost *const bottom_funcs;
|
|
||||||
|
|
||||||
// model ============================================
|
// model ============================================
|
||||||
DataModel::DocumentsManager *const docs_container;
|
DataModel::DocumentsManager *const active_docscollect;
|
||||||
|
|
||||||
// view =============================================
|
// view =============================================
|
||||||
Components::WelcomePanel *const welcome_list;
|
Components::WelcomePanel *const welcome_list;
|
||||||
|
@ -48,14 +48,6 @@ private:
|
||||||
void initial_menubar(QMenuBar *mbar);
|
void initial_menubar(QMenuBar *mbar);
|
||||||
void initial_commandlist(Schedule::CommandsDispatcher *host);
|
void initial_commandlist(Schedule::CommandsDispatcher *host);
|
||||||
|
|
||||||
void accept_view_transport(const Core::Route &key, Components::GroupType type);
|
|
||||||
|
|
||||||
void refresh_views();
|
|
||||||
|
|
||||||
void build_internal(bool all_from_disk = false);
|
|
||||||
|
|
||||||
void splitter_layout_save(const QList<QString> &path_type, const QList<int> &size);
|
|
||||||
|
|
||||||
// PresentContainer interface
|
// PresentContainer interface
|
||||||
public:
|
public:
|
||||||
virtual QWidget *hostWidget() const override;
|
virtual QWidget *hostWidget() const override;
|
||||||
|
|
|
@ -36,8 +36,12 @@ ParseBridge::~ParseBridge() {
|
||||||
|
|
||||||
QString ParseBridge::novelName() const { return name_store; }
|
QString ParseBridge::novelName() const { return name_store; }
|
||||||
|
|
||||||
|
QStandardItemModel *ParseBridge::chainsPresentModel() const { return chains_model; }
|
||||||
|
|
||||||
QStandardItemModel *ParseBridge::volumesPresentModel() const { return volumes_model; }
|
QStandardItemModel *ParseBridge::volumesPresentModel() const { return volumes_model; }
|
||||||
|
|
||||||
|
QStandardItemModel *ParseBridge::errorsPresentModel() const { return errors_model; }
|
||||||
|
|
||||||
void bridge::ParseBridge::load(const QString &data_path) {
|
void bridge::ParseBridge::load(const QString &data_path) {
|
||||||
// clear cache
|
// clear cache
|
||||||
this->doc_ins.clear();
|
this->doc_ins.clear();
|
||||||
|
@ -368,6 +372,10 @@ QString StoryfragmentInst::operator[](int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoryfragmentRefer::StoryfragmentRefer(StoryfragmentInst *inst) : ContentNode(""), inst(inst) {
|
||||||
|
setText(QString("@%1/%2").arg(inst->parent()->text(), inst->text()));
|
||||||
|
}
|
||||||
|
|
||||||
QString StoryfragmentRefer::storyRef() const { return this->story; }
|
QString StoryfragmentRefer::storyRef() const { return this->story; }
|
||||||
|
|
||||||
void StoryfragmentRefer::appointStory(const QString &ref) { this->story = ref; }
|
void StoryfragmentRefer::appointStory(const QString &ref) { this->story = ref; }
|
||||||
|
|
|
@ -102,6 +102,7 @@ namespace bridge {
|
||||||
QString operator[](int index);
|
QString operator[](int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
StoryfragmentInst *const inst;
|
||||||
QString story, fragment;
|
QString story, fragment;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,94 +40,6 @@ namespace Tools {
|
||||||
QList<Run *> alltriggers;
|
QList<Run *> alltriggers;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BaseType> class TreeSyncs {
|
|
||||||
public:
|
|
||||||
TreeSyncs(
|
|
||||||
QStandardItemModel *model_base,
|
|
||||||
std::function<bool(const BaseType &n, QStandardItem *p)> _equal,
|
|
||||||
std::function<void(const BaseType &n, QStandardItem *p)> sync_proc)
|
|
||||||
: model_present(model_base), sync_process(sync_proc),
|
|
||||||
compare_process(_equal) {}
|
|
||||||
|
|
||||||
void presentSync(
|
|
||||||
std::function<QList<BaseType>(const BaseType &pnode)> items_peak) {
|
|
||||||
auto default_pdata = BaseType();
|
|
||||||
auto datas = items_peak(default_pdata);
|
|
||||||
|
|
||||||
Operate::OpStream<QStandardItem *>(
|
|
||||||
[this](int &cnt, int idx) -> QStandardItem * {
|
|
||||||
cnt = model_present->rowCount();
|
|
||||||
if (cnt <= 0)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return model_present->item(idx);
|
|
||||||
})
|
|
||||||
.filter([&datas, this](QStandardItem *const &it) -> bool {
|
|
||||||
for (auto &d : datas)
|
|
||||||
if (compare_process(d, it))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.forEach([this](QStandardItem *const &it) {
|
|
||||||
model_present->removeRow(it->row());
|
|
||||||
});
|
|
||||||
|
|
||||||
for (auto idx = 0; idx < datas.size(); ++idx) {
|
|
||||||
if (idx >= model_present->rowCount()) {
|
|
||||||
auto ins = new QStandardItem();
|
|
||||||
ins->setEditable(false);
|
|
||||||
model_present->appendRow(ins);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &data = datas[idx];
|
|
||||||
auto item = model_present->item(idx);
|
|
||||||
sync_process(data, item);
|
|
||||||
|
|
||||||
layer_items_sync(data, item, items_peak);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStandardItemModel *model_present;
|
|
||||||
std::function<void(const BaseType &n, QStandardItem *p)> sync_process;
|
|
||||||
std::function<bool(const BaseType &n, QStandardItem *p)>
|
|
||||||
compare_process;
|
|
||||||
|
|
||||||
void layer_items_sync(
|
|
||||||
const BaseType &data, QStandardItem *pnode,
|
|
||||||
std::function<QList<BaseType>(const BaseType &pnode)> items_peak) {
|
|
||||||
auto datas = items_peak(data);
|
|
||||||
|
|
||||||
Operate::OpStream<QStandardItem *>(
|
|
||||||
[pnode](int &cnt, int idx) -> QStandardItem * {
|
|
||||||
cnt = pnode->rowCount();
|
|
||||||
return pnode->child(idx);
|
|
||||||
})
|
|
||||||
.filter([&datas, this](QStandardItem *const &it) -> bool {
|
|
||||||
for (auto &d : datas)
|
|
||||||
if (compare_process(d, it))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.forEach([pnode](QStandardItem *const &it) {
|
|
||||||
pnode->removeRow(it->row());
|
|
||||||
});
|
|
||||||
|
|
||||||
for (auto idx = 0; idx < datas.size(); ++idx) {
|
|
||||||
if (idx >= pnode->rowCount()) {
|
|
||||||
auto ins = new QStandardItem();
|
|
||||||
ins->setEditable(false);
|
|
||||||
pnode->appendRow(ins);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &data = datas[idx];
|
|
||||||
auto item = pnode->child(idx);
|
|
||||||
sync_process(data, item);
|
|
||||||
|
|
||||||
layer_items_sync(data, item, items_peak);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // namespace Tools
|
} // namespace Tools
|
||||||
|
|
||||||
#endif // COMNTOOLS_H
|
#endif // COMNTOOLS_H
|
||||||
|
|
Loading…
Reference in New Issue