移除了废弃的PresentBase类型
今后的界面视图只有两种:1,窗口绑定功能视图继承SplitRectCom;2,全局唯一文件视图继承FilePresent
This commit is contained in:
parent
5161b79608
commit
748dbd2f0a
|
@ -12,45 +12,41 @@ namespace Core {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Components {
|
namespace Components {
|
||||||
class PresentBase {
|
/**
|
||||||
|
* @brief 内容编辑和呈现接口
|
||||||
|
*/
|
||||||
|
class FilePresent : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
/**
|
explicit FilePresent(QObject *parent = nullptr);
|
||||||
* @brief 获取新实例内的widget
|
virtual ~FilePresent() = default;
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
virtual QWidget *widget() const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取实例的别名
|
* @brief 获取实例的别名
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
|
virtual Core::Route accessPath() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取新实例内的widget
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual QWidget *widget() const = 0;
|
||||||
|
virtual Core::DocumentsManager *docsManager() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 视图关闭处理,额外处理步骤
|
* @brief 视图关闭处理,额外处理步骤
|
||||||
*/
|
*/
|
||||||
virtual void beforeClose() = 0;
|
virtual void beforeClose() = 0;
|
||||||
|
|
||||||
virtual Core::DocumentsManager *docsManager() const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 内容编辑和呈现接口
|
|
||||||
*/
|
|
||||||
class FilePresent : public QObject, public PresentBase {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit FilePresent(QObject *parent = nullptr);
|
|
||||||
virtual ~FilePresent() = default;
|
|
||||||
|
|
||||||
virtual Core::Route accessPath() const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 载入设置和命名
|
* @brief 载入设置和命名
|
||||||
* @param core
|
* @param core
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
virtual void applySetting(const QString &name) = 0;
|
virtual void applySetting(const QString &name) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 使用此实例打开指定的路径文件,冲刷掉所有状态
|
* @brief 使用此实例打开指定的路径文件,冲刷掉所有状态
|
||||||
* @param target_file 指定文件的info
|
* @param target_file 指定文件的info
|
||||||
|
@ -106,7 +102,7 @@ namespace Components {
|
||||||
* @brief 生成一个新Present实例
|
* @brief 生成一个新Present实例
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual FilePresent *newInst(Core::DocumentsManager *mgr, const Core::Route &path, QObject *parent) const = 0;
|
virtual FilePresent *newInst(Core::DocumentsManager *mgr, const Core::Route &path, QObject *parent = nullptr) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class PresentType> class TypedPresentFactory : public PresentFactory {
|
template <class PresentType> class TypedPresentFactory : public PresentFactory {
|
||||||
|
@ -117,7 +113,7 @@ namespace Components {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static QString suffix() { return PresentType::file_suffix; }
|
static QString suffix() { return PresentType::file_suffix; }
|
||||||
virtual FilePresent *newInst(Core::DocumentsManager *mgr, const Core::Route &path, QObject *parent) const {
|
virtual FilePresent *newInst(Core::DocumentsManager *mgr, const Core::Route &path, QObject *parent = nullptr) const {
|
||||||
return new PresentType(mgr, path, parent);
|
return new PresentType(mgr, path, parent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -192,7 +192,7 @@ void OpenFile::fromText(const QString &line)
|
||||||
|
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
|
|
||||||
CompVisible::CompVisible(PresentHost *host, PresentBase *target, bool state) : host_ins(host), target_ins(target), state_val(state) {
|
CompVisible::CompVisible(PresentHost *host, FilePresent *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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace Components {
|
namespace Components {
|
||||||
class PresentHost;
|
class PresentHost;
|
||||||
class PresentBase;
|
class FilePresent;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CommandList {
|
namespace CommandList {
|
||||||
|
@ -29,7 +29,7 @@ namespace CommandList {
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpenProject : public Schedule::GeCommand {
|
class OpenProject : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
OpenProject(const QString &path);
|
OpenProject(const QString &path);
|
||||||
|
|
||||||
// GeCommand interface
|
// GeCommand interface
|
||||||
|
@ -115,7 +115,7 @@ namespace CommandList {
|
||||||
// 切换视图组件 ================================================================
|
// 切换视图组件 ================================================================
|
||||||
class CompVisible : public Schedule::GeCommand {
|
class CompVisible : public Schedule::GeCommand {
|
||||||
public:
|
public:
|
||||||
CompVisible(Components::PresentHost *host, Components::PresentBase *target, bool state);
|
CompVisible(Components::PresentHost *host, Components::FilePresent *target, bool state);
|
||||||
|
|
||||||
// GeCommand interface
|
// GeCommand interface
|
||||||
public:
|
public:
|
||||||
|
@ -126,7 +126,7 @@ namespace CommandList {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Components::PresentHost *host_ins;
|
Components::PresentHost *host_ins;
|
||||||
Components::PresentBase *target_ins;
|
Components::FilePresent *target_ins;
|
||||||
Core::Route path;
|
Core::Route path;
|
||||||
bool state_val;
|
bool state_val;
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w("default");
|
||||||
w.show();
|
w.show();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,15 @@ using namespace Tools;
|
||||||
using namespace CommandList;
|
using namespace CommandList;
|
||||||
using namespace bridge;
|
using namespace bridge;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(const QString &layout, QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
|
layout_name_store(layout),
|
||||||
sync_kernel(new StatusSyncCore(this)),
|
sync_kernel(new StatusSyncCore(this)),
|
||||||
parse_service(new ParseBridge()),
|
parse_service(new ParseBridge()),
|
||||||
project_manager(new XMLProjectManager(this)),
|
project_manager(new XMLProjectManager(this)),
|
||||||
active_docscollect(new DocumentsManager(project_manager)),
|
active_docscollect(new DocumentsManager(project_manager)),
|
||||||
present_host(new SplitFrame::ViewPresent(this)),
|
present_host(new SplitFrame::ViewPresent(this)),
|
||||||
session_service(new ViewSession(XApp::global_configration, present_host)),
|
session_service(new ViewSession(XApp::global_configration, this)),
|
||||||
views_bar(new ViewStackedBar(present_host, this)),
|
views_bar(new ViewStackedBar(present_host, this)),
|
||||||
center_frame(new PresentContainer(present_host, this)),
|
center_frame(new PresentContainer(present_host, this)),
|
||||||
project_present(new ProjectPresent(present_host, XApp::disp_core, active_docscollect, this)) {
|
project_present(new ProjectPresent(present_host, XApp::disp_core, active_docscollect, this)) {
|
||||||
|
@ -57,12 +58,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
initial_menubar(mbar);
|
initial_menubar(mbar);
|
||||||
|
|
||||||
project_present->setVisible(true);
|
project_present->setVisible(true);
|
||||||
this->active_docscollect->setPresent(center_frame);
|
this->active_docscollect->appendPresent(center_frame);
|
||||||
|
|
||||||
session_service->viewStatesRestore(this, present_host);
|
session_service->viewStatesRestore(this, present_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() { active_docscollect->removePresent(center_frame); }
|
||||||
|
|
||||||
|
SplitFrame::ViewPresent *MainWindow::bindPresent() const { return present_host; }
|
||||||
|
|
||||||
|
QString MainWindow::layoutName() const { return layout_name_store; }
|
||||||
|
|
||||||
void MainWindow::initial_menubar(QMenuBar *mbar) {
|
void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,15 @@
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(const QString &layout, QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
virtual ~MainWindow();
|
||||||
|
|
||||||
|
SplitFrame::ViewPresent *bindPresent() const;
|
||||||
|
QString layoutName() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString layout_name_store;
|
||||||
// model ============================================
|
// model ============================================
|
||||||
Tools::StatusSyncCore *const sync_kernel;
|
Tools::StatusSyncCore *const sync_kernel;
|
||||||
bridge::ParseBridge *const parse_service;
|
bridge::ParseBridge *const parse_service;
|
||||||
|
@ -45,7 +49,7 @@ private:
|
||||||
void initial_commandlist(Schedule::CommandsDispatcher *host);
|
void initial_commandlist(Schedule::CommandsDispatcher *host);
|
||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
// QObject interface
|
// QObject interface
|
||||||
|
|
|
@ -6,15 +6,22 @@ using namespace Components;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Config;
|
using namespace Config;
|
||||||
|
|
||||||
DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project), present_ui(nullptr) { initViewPlugins(); }
|
DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project) { initContentViewPlugins(); }
|
||||||
|
|
||||||
void DocumentsManager::setPresent(Components::PresentHost *container) { present_ui = container; }
|
void DocumentsManager::appendPresent(Components::PresentHost *container) {
|
||||||
|
if (present_ui.contains(container))
|
||||||
|
return;
|
||||||
|
|
||||||
|
present_ui << container;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DocumentsManager::removePresent(Components::PresentHost *container) {}
|
||||||
|
|
||||||
Project::ProjectManager *DocumentsManager::projectManager() const { return pjtins; }
|
Project::ProjectManager *DocumentsManager::projectManager() const { return pjtins; }
|
||||||
|
|
||||||
#include "srcedit_defaulttext.h"
|
#include "srcedit_defaulttext.h"
|
||||||
#include "srcedit_storyboard.h"
|
#include "srcedit_storyboard.h"
|
||||||
void DocumentsManager::initViewPlugins() {
|
void DocumentsManager::initContentViewPlugins() {
|
||||||
registPresentType(new DefaultTextEditFactory);
|
registPresentType(new DefaultTextEditFactory);
|
||||||
registPresentType(new StorySourceEditFactory);
|
registPresentType(new StorySourceEditFactory);
|
||||||
}
|
}
|
||||||
|
@ -85,11 +92,14 @@ void DocumentsManager::openFile(const QList<Route> &doc_paths) {
|
||||||
if (!info.isFile())
|
if (!info.isFile())
|
||||||
throw new SimpleException<QString>("打开文件错误", "指向的节点不是文件节点");
|
throw new SimpleException<QString>("打开文件错误", "指向的节点不是文件节点");
|
||||||
|
|
||||||
auto view = factory_map[info.suffix()]->newInst(this, it, present_ui->hostWidget());
|
auto view = factory_map[info.suffix()]->newInst(this, it);
|
||||||
doc_openning[it] = view;
|
doc_openning[it] = view;
|
||||||
view->load(info);
|
view->load(info);
|
||||||
view->applySetting(it.links().last());
|
view->applySetting(it.links().last());
|
||||||
present_ui->append(view);
|
|
||||||
|
for (auto con : present_ui)
|
||||||
|
if (con->avaliable(view))
|
||||||
|
con->append(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +110,10 @@ void DocumentsManager::closeFile(const QList<Core::Route> &doc_paths) {
|
||||||
auto inst = convertPresent(idx);
|
auto inst = convertPresent(idx);
|
||||||
inst->saveAs();
|
inst->saveAs();
|
||||||
|
|
||||||
present_ui->remove(inst);
|
for (auto vit : present_ui)
|
||||||
|
if (present_ui.contains(vit))
|
||||||
|
vit->remove(inst);
|
||||||
|
|
||||||
delete inst;
|
delete inst;
|
||||||
doc_openning.remove(idx);
|
doc_openning.remove(idx);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +158,9 @@ QList<Route> DocumentsManager::actives() const { return doc_openning.keys(); }
|
||||||
void DocumentsManager::active(const Core::Route &node_path) {
|
void DocumentsManager::active(const Core::Route &node_path) {
|
||||||
if (doc_openning.contains(node_path)) {
|
if (doc_openning.contains(node_path)) {
|
||||||
auto inst = convertPresent(node_path);
|
auto inst = convertPresent(node_path);
|
||||||
present_ui->active(inst);
|
for (auto vit : present_ui)
|
||||||
|
if (vit->contains(inst))
|
||||||
|
vit->active(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,27 +22,34 @@ namespace Components {
|
||||||
*/
|
*/
|
||||||
virtual QWidget *hostWidget() const = 0;
|
virtual QWidget *hostWidget() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 是否可以放置此视图
|
||||||
|
* @param vins
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual bool avaliable(FilePresent *vins) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 添加内容展示实例
|
* @brief 添加内容展示实例
|
||||||
* @param ins
|
* @param ins
|
||||||
*/
|
*/
|
||||||
virtual void append(Components::PresentBase *ins) = 0;
|
virtual void append(FilePresent *ins) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief 激活内容展示实例
|
* @brief 激活内容展示实例
|
||||||
* @param ins
|
* @param ins
|
||||||
*/
|
*/
|
||||||
virtual bool active(const Components::PresentBase *ins) = 0;
|
virtual bool active(const FilePresent *ins) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief 移除内容展示实例
|
* @brief 移除内容展示实例
|
||||||
* @param ins
|
* @param ins
|
||||||
*/
|
*/
|
||||||
virtual void remove(const Components::PresentBase *ins) = 0;
|
virtual void remove(const FilePresent *ins) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief 是否包含指定
|
* @brief 是否包含指定
|
||||||
* @param ins
|
* @param ins
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual bool contains(const Components::PresentBase *ins) const = 0;
|
virtual bool contains(const FilePresent *ins) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Components
|
} // namespace Components
|
||||||
|
@ -61,7 +68,8 @@ namespace Core {
|
||||||
* @brief 设置文档呈现窗口
|
* @brief 设置文档呈现窗口
|
||||||
* @param container
|
* @param container
|
||||||
*/
|
*/
|
||||||
void setPresent(Components::PresentHost *container);
|
void appendPresent(Components::PresentHost *container);
|
||||||
|
void removePresent(Components::PresentHost *container);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 项目获取管理器
|
* @brief 项目获取管理器
|
||||||
|
@ -69,7 +77,10 @@ namespace Core {
|
||||||
*/
|
*/
|
||||||
Project::ProjectManager *projectManager() const;
|
Project::ProjectManager *projectManager() const;
|
||||||
|
|
||||||
void initViewPlugins();
|
/**
|
||||||
|
* @brief 初始化内容视图插件
|
||||||
|
*/
|
||||||
|
void initContentViewPlugins();
|
||||||
|
|
||||||
// ==========================================================
|
// ==========================================================
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +189,7 @@ namespace Core {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Project::ProjectManager *pjtins;
|
Project::ProjectManager *pjtins;
|
||||||
Components::PresentHost *present_ui;
|
QList<Components::PresentHost *> present_ui;
|
||||||
|
|
||||||
QHash<QString, Components::PresentFactory *> factory_map;
|
QHash<QString, Components::PresentFactory *> factory_map;
|
||||||
QHash<Core::Route, Components::FilePresent *> doc_openning;
|
QHash<Core::Route, Components::FilePresent *> doc_openning;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "DocsManager.h"
|
#include "DocsManager.h"
|
||||||
#include "welcomepanel.h"
|
#include "welcomepanel.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -45,7 +46,7 @@ QWidget *PresentContainer::hostWidget() const { return (QWidget *)this; }
|
||||||
#include <libConfig.h>
|
#include <libConfig.h>
|
||||||
using namespace Config;
|
using namespace Config;
|
||||||
|
|
||||||
void PresentContainer::append(PresentBase *ins) {
|
void PresentContainer::append(FilePresent *ins) {
|
||||||
if (!items_store.contains(ins)) {
|
if (!items_store.contains(ins)) {
|
||||||
items_store.append(ins);
|
items_store.append(ins);
|
||||||
title_store->addItem(ins->name());
|
title_store->addItem(ins->name());
|
||||||
|
@ -55,7 +56,7 @@ void PresentContainer::append(PresentBase *ins) {
|
||||||
throw new SimpleException<bool>("非法操作", "重复添加视图:" + ins->name());
|
throw new SimpleException<bool>("非法操作", "重复添加视图:" + ins->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PresentContainer::active(const PresentBase *ins) {
|
bool PresentContainer::active(const FilePresent *ins) {
|
||||||
if (!items_store.contains(ins))
|
if (!items_store.contains(ins))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ bool PresentContainer::active(const PresentBase *ins) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PresentContainer::remove(const PresentBase *ins) {
|
void PresentContainer::remove(const FilePresent *ins) {
|
||||||
if (!items_store.contains(ins))
|
if (!items_store.contains(ins))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ void PresentContainer::remove(const PresentBase *ins) {
|
||||||
stack_container->removeWidget(ins->widget());
|
stack_container->removeWidget(ins->widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PresentContainer::contains(const PresentBase *ins) const {
|
bool PresentContainer::contains(const FilePresent *ins) const {
|
||||||
for (auto &insit : items_store) {
|
for (auto &insit : items_store) {
|
||||||
if (insit == ins)
|
if (insit == ins)
|
||||||
return true;
|
return true;
|
||||||
|
@ -84,6 +85,12 @@ bool PresentContainer::contains(const PresentBase *ins) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PresentContainer::avaliable(FilePresent *vins) {
|
||||||
|
if (!QApplication::activeWindow())
|
||||||
|
return true;
|
||||||
|
return this->hasFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void PresentContainer::change_view(int view_index) {
|
void PresentContainer::change_view(int view_index) {
|
||||||
auto view_inst = items_store[view_index];
|
auto view_inst = items_store[view_index];
|
||||||
active(view_inst);
|
active(view_inst);
|
||||||
|
@ -94,5 +101,5 @@ void PresentContainer::change_view(int view_index) {
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
void PresentContainer::close_current_view() {
|
void PresentContainer::close_current_view() {
|
||||||
auto index = title_store->currentIndex();
|
auto index = title_store->currentIndex();
|
||||||
const_cast<PresentBase *>(items_store[index])->beforeClose();
|
const_cast<FilePresent *>(items_store[index])->beforeClose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,14 @@ namespace Components {
|
||||||
public:
|
public:
|
||||||
virtual QWidget *hostWidget() const override;
|
virtual QWidget *hostWidget() const override;
|
||||||
|
|
||||||
virtual void append(PresentBase *ins) override;
|
virtual void append(FilePresent *ins) override;
|
||||||
virtual bool active(const PresentBase *ins) override;
|
virtual bool active(const FilePresent *ins) override;
|
||||||
virtual void remove(const PresentBase *ins) override;
|
virtual void remove(const FilePresent *ins) override;
|
||||||
virtual bool contains(const PresentBase *ins) const override;
|
virtual bool contains(const FilePresent *ins) const override;
|
||||||
|
virtual bool avaliable(FilePresent *vins) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<const PresentBase *> items_store;
|
QList<const FilePresent *> items_store;
|
||||||
QComboBox *const title_store;
|
QComboBox *const title_store;
|
||||||
QStackedWidget *const stack_container;
|
QStackedWidget *const stack_container;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "viewsession.h"
|
#include "viewsession.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "messagespresent.h"
|
#include "messagespresent.h"
|
||||||
#include "presentcontainer.h"
|
#include "presentcontainer.h"
|
||||||
#include "projectpresent.h"
|
#include "projectpresent.h"
|
||||||
|
@ -8,7 +9,9 @@ using namespace Core;
|
||||||
using namespace SplitFrame;
|
using namespace SplitFrame;
|
||||||
using namespace Components;
|
using namespace Components;
|
||||||
|
|
||||||
ViewSession::ViewSession(Config::Configration *port, ViewPresent *host) : host(host), recover_port(port) {}
|
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(PresentContainer *center_frame, ProjectPresent *project_present, QStandardItemModel *error_model) {
|
void ViewSession::initPresentView(PresentContainer *center_frame, ProjectPresent *project_present, QStandardItemModel *error_model) {
|
||||||
split_infos.clear();
|
split_infos.clear();
|
||||||
|
@ -26,7 +29,6 @@ void ViewSession::initPresentView(PresentContainer *center_frame, ProjectPresent
|
||||||
view_store[msg_panel->title()] = msg_panel;
|
view_store[msg_panel->title()] = msg_panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<QString> base_path = {"sys-config", "front-end", "view-state"};
|
|
||||||
void views_state_store(Config::Configration *port, const QList<QString> &base_path, const QList<RectCom *> &child) {
|
void views_state_store(Config::Configration *port, const QList<QString> &base_path, const QList<RectCom *> &child) {
|
||||||
for (auto &it : child) {
|
for (auto &it : child) {
|
||||||
if (!it)
|
if (!it)
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
#include <presentcontainer.h>
|
#include <presentcontainer.h>
|
||||||
#include <splitpanel.h>
|
#include <splitpanel.h>
|
||||||
|
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ViewSession : public QObject {
|
class ViewSession : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ViewSession(Config::Configration *port, SplitFrame::ViewPresent *host);
|
ViewSession(Config::Configration *port, MainWindow *host);
|
||||||
|
|
||||||
void initPresentView(Components::PresentContainer *center_frame, Components::ProjectPresent *project_present, QStandardItemModel *model);
|
void initPresentView(Components::PresentContainer *center_frame, Components::ProjectPresent *project_present, QStandardItemModel *model);
|
||||||
|
|
||||||
|
@ -22,6 +24,7 @@ namespace Core {
|
||||||
void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root);
|
void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QList<QString> base_path;
|
||||||
SplitFrame::ViewPresent *host;
|
SplitFrame::ViewPresent *host;
|
||||||
SplitFrame::RectCom *edit_panel = nullptr;
|
SplitFrame::RectCom *edit_panel = nullptr;
|
||||||
Config::Configration *const recover_port;
|
Config::Configration *const recover_port;
|
||||||
|
|
|
@ -12,3 +12,19 @@ QString WelcomePanel::name() const { return "WelcomePanel"; }
|
||||||
void WelcomePanel::beforeClose() {}
|
void WelcomePanel::beforeClose() {}
|
||||||
|
|
||||||
DocumentsManager *WelcomePanel::docsManager() const { return nullptr; }
|
DocumentsManager *WelcomePanel::docsManager() const { return nullptr; }
|
||||||
|
|
||||||
|
Route WelcomePanel::accessPath() const { return Route(); }
|
||||||
|
|
||||||
|
void WelcomePanel::applySetting(const QString &name) {}
|
||||||
|
|
||||||
|
void WelcomePanel::load(const QFileInfo &target_file) {}
|
||||||
|
|
||||||
|
void WelcomePanel::saveAs(const QString &path) {}
|
||||||
|
|
||||||
|
QString WelcomePanel::relativeTargetPath(const QDir &base) const { return ""; }
|
||||||
|
|
||||||
|
QString WelcomePanel::absoluteTargetPath() const { return ""; }
|
||||||
|
|
||||||
|
bool WelcomePanel::isModified() const { return false; }
|
||||||
|
|
||||||
|
void WelcomePanel::jumpTo(const QList<QString> &path) {}
|
||||||
|
|
|
@ -7,16 +7,25 @@
|
||||||
|
|
||||||
namespace Components {
|
namespace Components {
|
||||||
|
|
||||||
class WelcomePanel : public QWidget, public Components::PresentBase {
|
class WelcomePanel : public QWidget, public Components::FilePresent {
|
||||||
public:
|
public:
|
||||||
WelcomePanel(QWidget *parent = nullptr);
|
WelcomePanel(QWidget *parent = nullptr);
|
||||||
|
|
||||||
// PresentBase interface
|
// FilePresent interface
|
||||||
public:
|
public:
|
||||||
virtual QWidget *widget() const override;
|
virtual QWidget *widget() const override;
|
||||||
virtual QString name() const override;
|
virtual QString name() const override;
|
||||||
virtual void beforeClose() override;
|
virtual void beforeClose() override;
|
||||||
virtual Core::DocumentsManager *docsManager() const override;
|
virtual Core::DocumentsManager *docsManager() const override;
|
||||||
|
|
||||||
|
virtual Core::Route accessPath() const override;
|
||||||
|
virtual void applySetting(const QString &name) override;
|
||||||
|
virtual void load(const QFileInfo &target_file) override;
|
||||||
|
virtual void saveAs(const QString &path) override;
|
||||||
|
virtual QString relativeTargetPath(const QDir &base) const override;
|
||||||
|
virtual QString absoluteTargetPath() const override;
|
||||||
|
virtual bool isModified() const override;
|
||||||
|
virtual void jumpTo(const QList<QString> &path) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Components
|
} // namespace Components
|
||||||
|
|
Loading…
Reference in New Issue