最新状态:重构代码,剔除了部分无用代码
This commit is contained in:
parent
f20c732ba5
commit
bcccbb9b3e
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.15.0, 2023-08-27T12:04:44. -->
|
||||
<!-- Written by QtCreator 4.15.0, 2023-08-29T08:41:33. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
|
@ -43,13 +43,6 @@ namespace Components {
|
|||
explicit FilePresent(QObject *parent = nullptr);
|
||||
virtual ~FilePresent() = default;
|
||||
|
||||
enum class Feature {
|
||||
HighLight = 0x01,
|
||||
Compile = 0x02,
|
||||
};
|
||||
Q_DECLARE_FLAGS(Features, Feature)
|
||||
virtual Features features() = 0;
|
||||
|
||||
virtual Core::Route accessPath() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -97,7 +90,6 @@ namespace Components {
|
|||
*/
|
||||
void dataChanged(const QString &filePath);
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(FilePresent::Features);
|
||||
|
||||
class PresentFactory : public QObject {
|
||||
public:
|
||||
|
|
|
@ -35,7 +35,7 @@ SOURCES += \
|
|||
srcedit_storyboard.cpp \
|
||||
tools.cpp \
|
||||
viewstackedbar.cpp \
|
||||
vsessionmaintenance.cpp \
|
||||
vsession.cpp \
|
||||
welcomepanel.cpp \
|
||||
xapp.cpp
|
||||
|
||||
|
@ -57,7 +57,7 @@ HEADERS += \
|
|||
srcedit_storyboard.h \
|
||||
tools.h \
|
||||
viewstackedbar.h \
|
||||
vsessionmaintenance.h \
|
||||
vsession.h \
|
||||
welcomepanel.h \
|
||||
xapp.h
|
||||
|
||||
|
|
|
@ -7,6 +7,23 @@ using namespace CommandList;
|
|||
using namespace Components;
|
||||
using namespace Core;
|
||||
|
||||
NewProject::NewProject(const QDir &dir, const QString &name) : dir_symbo(dir), name_val(name) {}
|
||||
|
||||
QString NewProject::name() const { return NAME(NewProject); }
|
||||
|
||||
void NewProject::run(Schedule::CommandsDispatcher *core) const {
|
||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
||||
vmgr->projectManager()->newProject(dir_symbo.absolutePath(), name_val);
|
||||
}
|
||||
|
||||
QString NewProject::toText() const { return QString("%1:%2").arg(dir_symbo.absolutePath(), name_val); }
|
||||
|
||||
void NewProject::fromText(const QString &line) {
|
||||
auto list = line.split(":");
|
||||
dir_symbo = QDir(list[0]);
|
||||
name_val = list[1];
|
||||
}
|
||||
|
||||
NewPackage::NewPackage(const QString &path_string)
|
||||
{
|
||||
sequence = path_string.split("/");
|
||||
|
@ -137,39 +154,7 @@ QString CloseProject::toText() const { return ""; }
|
|||
|
||||
void CloseProject::fromText(const QString &line) {}
|
||||
|
||||
NewProject::NewProject(const QDir &dir, const QString &name)
|
||||
: dir_symbo(dir), name_val(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString NewProject::name() const
|
||||
{
|
||||
return NAME(NewProject);
|
||||
}
|
||||
|
||||
void NewProject::run(Schedule::CommandsDispatcher *core) const
|
||||
{
|
||||
auto vmgr = core->get<DocumentsManager>(NAME(DocumentsManager));
|
||||
vmgr->projectManager()->newProject(dir_symbo.absolutePath(), name_val);
|
||||
}
|
||||
|
||||
QString NewProject::toText() const
|
||||
{
|
||||
return QString("%1:%2").arg(dir_symbo.absolutePath(), name_val);
|
||||
}
|
||||
|
||||
void NewProject::fromText(const QString &line)
|
||||
{
|
||||
auto list = line.split(":");
|
||||
dir_symbo = QDir(list[0]);
|
||||
name_val = list[1];
|
||||
}
|
||||
|
||||
OpenFile::OpenFile(const Core::Route &path_node)
|
||||
{
|
||||
path_store = path_node.links();
|
||||
}
|
||||
OpenFile::OpenFile(const Core::Route &path_node) { path_store = path_node.links(); }
|
||||
|
||||
OpenFile::OpenFile(const QFileInfo &file_path)
|
||||
{
|
||||
|
|
|
@ -13,20 +13,21 @@ namespace Components {
|
|||
namespace CommandList {
|
||||
|
||||
class NewProject : public Schedule::GeCommand {
|
||||
public:
|
||||
public:
|
||||
NewProject(const QDir &dir, const QString &name);
|
||||
|
||||
// GeCommand interface
|
||||
public:
|
||||
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:
|
||||
private:
|
||||
QDir dir_symbo;
|
||||
QString name_val;
|
||||
};
|
||||
|
||||
class OpenProject : public Schedule::GeCommand {
|
||||
public:
|
||||
OpenProject(const QString &path);
|
||||
|
|
|
@ -34,8 +34,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
parse_service(new ParseBridge()),
|
||||
project_manager(new XMLProjectManager(this)),
|
||||
active_docscollect(new DocumentsManager(project_manager)),
|
||||
session_service(new VSessionMaintenance(XApp::global_configration)),
|
||||
present_host(new SplitFrame::ViewPresent(this)),
|
||||
session_service(new VSession(XApp::global_configration, present_host)),
|
||||
views_bar(new ViewStackedBar(present_host, this)),
|
||||
center_frame(new PresentContainer(present_host, this)),
|
||||
project_present(new ProjectPresent(present_host, XApp::disp_core, active_docscollect, this)) {
|
||||
|
@ -51,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
addToolBar(Qt::LeftToolBarArea, views_bar);
|
||||
present_host->addListener(views_bar);
|
||||
|
||||
session_service->initPresentView(present_host, center_frame, project_present, parse_service->errorsPresentModel());
|
||||
session_service->initPresentView(center_frame, project_present, parse_service->errorsPresentModel());
|
||||
|
||||
auto mbar = menuBar();
|
||||
initial_menubar(mbar);
|
||||
|
@ -59,13 +59,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
project_present->setVisible(true);
|
||||
this->active_docscollect->setPresent(center_frame);
|
||||
|
||||
session_service->viewStatesRestore(present_host);
|
||||
session_service->viewStatesRestore(this, present_host);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
this->session_service->viewStatesSave(present_host);
|
||||
XApp::global_configration->save();
|
||||
}
|
||||
MainWindow::~MainWindow() {}
|
||||
|
||||
void MainWindow::initial_menubar(QMenuBar *mbar) {
|
||||
|
||||
|
@ -221,6 +218,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
XApp::disp_core->postCommand(CloseProject());
|
||||
}
|
||||
|
||||
session_service->viewStatesSave(this, present_host);
|
||||
XApp::global_configration->save();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "projectpresent.h"
|
||||
#include "tools.h"
|
||||
#include "viewstackedbar.h"
|
||||
#include "vsessionmaintenance.h"
|
||||
#include "vsession.h"
|
||||
#include "welcomepanel.h"
|
||||
#include <QListView>
|
||||
#include <QMainWindow>
|
||||
|
@ -32,10 +32,10 @@ private:
|
|||
bridge::ParseBridge *const parse_service;
|
||||
Project::ProjectManager *const project_manager;
|
||||
Core::DocumentsManager *const active_docscollect;
|
||||
Core::VSessionMaintenance *const session_service;
|
||||
SplitFrame::ViewPresent *const present_host;
|
||||
Core::VSession *const session_service;
|
||||
|
||||
// view =============================================
|
||||
SplitFrame::ViewPresent *const present_host;
|
||||
Components::ViewStackedBar *const views_bar;
|
||||
Components::PresentContainer *const center_frame;
|
||||
Components::ProjectPresent *const project_present;
|
||||
|
|
|
@ -23,8 +23,6 @@ void DefaultTextEdit::jumpTo(const QList<QString> &path)
|
|||
|
||||
}
|
||||
|
||||
FilePresent::Features DefaultTextEdit::features() { return Features(); }
|
||||
|
||||
Route DefaultTextEdit::accessPath() const { return path_store; }
|
||||
|
||||
#include "manager_docs.h"
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace Components {
|
|||
virtual bool isModified() const override;
|
||||
virtual QString absoluteTargetPath() const override;
|
||||
virtual void jumpTo(const QList<QString> &path) override;
|
||||
virtual Features features() override;
|
||||
virtual Core::Route accessPath() const override;
|
||||
|
||||
// PresentBase interface
|
||||
|
|
|
@ -100,8 +100,6 @@ void StorySourceEdit::jumpTo(const QList<QString> &path) {
|
|||
// }
|
||||
}
|
||||
|
||||
FilePresent::Features StorySourceEdit::features() { return Feature::Compile | Feature::HighLight; }
|
||||
|
||||
#include "manager_docs.h"
|
||||
void StorySourceEdit::beforeClose() { mgr_inst->save(); }
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ namespace Components {
|
|||
virtual bool isModified() const override;
|
||||
virtual void applySetting(const QString &name) override;
|
||||
virtual void jumpTo(const QList<QString> &path) override;
|
||||
virtual Features features() override;
|
||||
virtual void beforeClose() override;
|
||||
virtual Core::DocumentsManager *docsManager() const override;
|
||||
virtual Core::Route accessPath() const override;
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
#include "vsession.h"
|
||||
#include "messagespresent.h"
|
||||
#include "presentcontainer.h"
|
||||
#include "projectpresent.h"
|
||||
|
||||
using namespace Config;
|
||||
using namespace Core;
|
||||
using namespace SplitFrame;
|
||||
using namespace Components;
|
||||
|
||||
VSession::VSession(Config::Configration *port, ViewPresent *host) : host(host), recover_port(port) {}
|
||||
|
||||
void VSession::initPresentView(PresentContainer *center_frame, ProjectPresent *project_present, QStandardItemModel *error_model) {
|
||||
split_infos.clear();
|
||||
|
||||
auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理"));
|
||||
host->markFreedom(project_panel);
|
||||
view_store[project_panel->title()] = project_panel;
|
||||
|
||||
edit_panel = host->appendView(center_frame, QIcon(":/ui/icons/file_icon.jpg"), tr("编辑窗口"));
|
||||
view_store[edit_panel->title()] = edit_panel;
|
||||
|
||||
auto msg_view = MessagesPresent::gen(host, error_model, host->bind());
|
||||
auto msg_panel = host->appendView(msg_view, QIcon(":/ui/icons/file_icon.jpg"), "信息提示");
|
||||
host->markFreedom(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) {
|
||||
for (auto &it : child) {
|
||||
if (!it)
|
||||
continue;
|
||||
|
||||
auto keys_path = base_path;
|
||||
keys_path << QString("rect_%1").arg(child.indexOf(it));
|
||||
|
||||
auto conv = dynamic_cast<SplitRect *>(it);
|
||||
if (conv) { // split
|
||||
QHash<QString, QString> values;
|
||||
values["rect-type"] = "split";
|
||||
values["split-type"] = QString("%1").arg((int)conv->splitType());
|
||||
values["split-width"] = QString("%1").arg(conv->splitterWidth());
|
||||
values["split-pos"] = QString("%1").arg(conv->splitterPos());
|
||||
port->setMap(keys_path, values);
|
||||
|
||||
auto split_childs = conv->child();
|
||||
views_state_store(port, keys_path, QList<RectCom *>() << split_childs.first << split_childs.second);
|
||||
} else { // view
|
||||
QHash<QString, QString> values;
|
||||
values["rect-type"] = "view";
|
||||
values["view-title"] = it->title();
|
||||
port->setMap(keys_path, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) {
|
||||
recover_port->deleteX(base_path);
|
||||
auto childs = root->child();
|
||||
|
||||
auto grect = win->geometry();
|
||||
QHash<QString, QString> values;
|
||||
values["win-width"] = QString("%1").arg(grect.width());
|
||||
values["win-height"] = QString("%1").arg(grect.height());
|
||||
values["win-xpos"] = QString("%1").arg(grect.topLeft().x());
|
||||
values["win-ypos"] = QString("%1").arg(grect.topLeft().y());
|
||||
recover_port->setMap(base_path, values);
|
||||
|
||||
views_state_store(recover_port, base_path, QList<RectCom *>() << childs.first << childs.second);
|
||||
}
|
||||
|
||||
RectCom *VSession::views_state_restore(const QHash<QString, SplitFrame::RectCom *> &cache, const QList<QString> &target_path,
|
||||
Config::Configration *port, SplitFrame::ViewPresent *host) {
|
||||
auto values = port->getMap(target_path);
|
||||
if (!values.size())
|
||||
return nullptr;
|
||||
|
||||
auto type = values["rect-type"];
|
||||
if (type == "view") {
|
||||
auto title = values["view-title"];
|
||||
auto view = cache[title];
|
||||
host->markFreedom(view, false);
|
||||
return view;
|
||||
} else {
|
||||
auto key_p0 = target_path;
|
||||
key_p0 << "rect_0";
|
||||
auto rect0 = views_state_restore(cache, key_p0, port, host);
|
||||
auto key_p1 = target_path;
|
||||
key_p1 << "rect_1";
|
||||
auto rect1 = views_state_restore(cache, key_p1, port, host);
|
||||
|
||||
auto ori = values["split-type"].toUInt();
|
||||
auto width = values["split-width"].toFloat();
|
||||
auto pos = values["split-pos"].toFloat();
|
||||
|
||||
auto split = host->createSplit(rect0, rect1);
|
||||
|
||||
this->split_infos[split] = std::make_tuple((SplitType)ori, pos, width);
|
||||
|
||||
return split;
|
||||
}
|
||||
}
|
||||
|
||||
void VSession::relayout_cascade(SplitFrame::RectCom *root) {
|
||||
auto xinst = dynamic_cast<SplitRect *>(root);
|
||||
if (!xinst)
|
||||
return;
|
||||
|
||||
auto info = split_infos[xinst];
|
||||
xinst->setSplitInfo(std::get<0>(info), std::get<1>(info), std::get<2>(info));
|
||||
|
||||
auto child_pair = xinst->child();
|
||||
relayout_cascade(child_pair.first);
|
||||
relayout_cascade(child_pair.second);
|
||||
}
|
||||
|
||||
bool VSession::eventFilter(QObject *watched, QEvent *event) {
|
||||
if (watched == (QObject *)host && event->type() == QEvent::Show) {
|
||||
relayout_cascade(host->child().first);
|
||||
host->bind()->removeEventFilter(this);
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void VSession::viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root) {
|
||||
auto key_path0 = base_path;
|
||||
key_path0 << "rect_0";
|
||||
auto rect = views_state_restore(this->view_store, key_path0, recover_port, root);
|
||||
if (!rect)
|
||||
rect = edit_panel;
|
||||
|
||||
root->resetEngross(rect);
|
||||
root->objsRelateRebuild();
|
||||
|
||||
auto values = recover_port->getMap(base_path);
|
||||
auto width = values["win-width"].toFloat();
|
||||
auto height = values["win-height"].toFloat();
|
||||
auto xpos = values["win-xpos"].toFloat();
|
||||
auto ypos = values["win-ypos"].toFloat();
|
||||
|
||||
win->setGeometry(xpos, ypos, width, height);
|
||||
root->bind()->installEventFilter(this);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef VSESSION_H
|
||||
#define VSESSION_H
|
||||
|
||||
#include "projectpresent.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
#include <QStandardItemModel>
|
||||
#include <libConfig.h>
|
||||
#include <presentcontainer.h>
|
||||
#include <splitpanel.h>
|
||||
|
||||
namespace Core {
|
||||
class VSession : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VSession(Config::Configration *port, SplitFrame::ViewPresent *host);
|
||||
|
||||
void initPresentView(Components::PresentContainer *center_frame, Components::ProjectPresent *project_present, QStandardItemModel *model);
|
||||
|
||||
void viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root);
|
||||
void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root);
|
||||
|
||||
private:
|
||||
SplitFrame::ViewPresent *host;
|
||||
SplitFrame::RectCom *edit_panel = nullptr;
|
||||
Config::Configration *const recover_port;
|
||||
QHash<QString, SplitFrame::RectCom *> view_store;
|
||||
|
||||
typedef float split_pos;
|
||||
typedef float split_width;
|
||||
std::map<SplitFrame::SplitRect *, std::tuple<SplitFrame::SplitType, split_pos, split_width>> split_infos;
|
||||
|
||||
SplitFrame::RectCom *views_state_restore(const QHash<QString, SplitFrame::RectCom *> &cache, const QList<QString> &target_path,
|
||||
Config::Configration *port, SplitFrame::ViewPresent *host);
|
||||
|
||||
void relayout_cascade(SplitFrame::RectCom *root);
|
||||
|
||||
// QObject interface
|
||||
public:
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // VSESSION_H
|
|
@ -1,89 +0,0 @@
|
|||
#include "vsessionmaintenance.h"
|
||||
#include "messagespresent.h"
|
||||
#include "presentcontainer.h"
|
||||
#include "projectpresent.h"
|
||||
|
||||
using namespace Config;
|
||||
using namespace Core;
|
||||
using namespace SplitFrame;
|
||||
using namespace Components;
|
||||
|
||||
VSessionMaintenance::VSessionMaintenance(Config::Configration *port) : recover_port(port) {}
|
||||
|
||||
void VSessionMaintenance::initPresentView(ViewPresent *host, PresentContainer *center_frame, ProjectPresent *project_present,
|
||||
QStandardItemModel *error_model) {
|
||||
|
||||
auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理"));
|
||||
host->markFreedom(project_panel);
|
||||
view_store[project_panel->title()] = project_panel;
|
||||
|
||||
auto edit_panel = host->appendView(center_frame, QIcon(":/ui/icons/file_icon.jpg"), tr("编辑窗口"));
|
||||
host->resetEngross(edit_panel);
|
||||
view_store[edit_panel->title()] = edit_panel;
|
||||
|
||||
auto msg_view = MessagesPresent::gen(host, error_model, host->bind());
|
||||
auto msg_panel = host->appendView(msg_view, QIcon(":/ui/icons/file_icon.jpg"), "信息提示");
|
||||
host->markFreedom(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) {
|
||||
for (auto &it : child) {
|
||||
if (!it)
|
||||
continue;
|
||||
|
||||
auto keys_path = base_path;
|
||||
keys_path << QString("rect_%1").arg(child.indexOf(it));
|
||||
|
||||
auto conv = dynamic_cast<SplitRect *>(it);
|
||||
if (conv) { // split
|
||||
QHash<QString, QString> values;
|
||||
values["rect-type"] = "split";
|
||||
values["split-type"] = QString("%1").arg((int)conv->splitType());
|
||||
values["split-width"] = QString("%1").arg(conv->splitterWidth());
|
||||
values["split-pos"] = QString("%1").arg(conv->splitterPos());
|
||||
port->setMap(keys_path, values);
|
||||
|
||||
auto split_childs = conv->child();
|
||||
views_state_store(port, keys_path, QList<RectCom *>() << split_childs.first << split_childs.second);
|
||||
} else { // view
|
||||
QHash<QString, QString> values;
|
||||
values["rect-type"] = "view";
|
||||
values["view-title"] = it->title();
|
||||
port->setMap(keys_path, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VSessionMaintenance::viewStatesSave(SplitFrame::ViewPresent *root) {
|
||||
recover_port->deleteX(base_path);
|
||||
auto childs = root->child();
|
||||
auto win = root->bind()->parentWidget();
|
||||
|
||||
QHash<QString, QString> values;
|
||||
values["win-width"] = win->width();
|
||||
values["win-height"] = win->height();
|
||||
values["win-xpos"] = win->rect().topLeft().x();
|
||||
values["win-ypos"] = win->rect().topLeft().y();
|
||||
recover_port->setMap(base_path, values);
|
||||
|
||||
views_state_store(recover_port, base_path, QList<RectCom *>() << childs.first << childs.second);
|
||||
}
|
||||
|
||||
RectCom *views_state_restore(const QHash<QString, RectCom *> &cache, const QList<QString> &target_path, Config::Configration *port) {
|
||||
auto values = port->getMap(target_path);
|
||||
if (!values.size())
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VSessionMaintenance::viewStatesRestore(SplitFrame::ViewPresent *root) {
|
||||
auto values = recover_port->getMap(base_path);
|
||||
auto win = root->bind()->parentWidget();
|
||||
|
||||
auto width = values["win-width"].toFloat();
|
||||
auto height = values["win-height"].toFloat();
|
||||
auto xpos = values["win-xpos"].toFloat();
|
||||
auto ypos = values["win-ypos"].toFloat();
|
||||
win->setGeometry(xpos, ypos, width, height);
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#ifndef VSESSIONMAINTENANCE_H
|
||||
#define VSESSIONMAINTENANCE_H
|
||||
|
||||
#include "projectpresent.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QStandardItemModel>
|
||||
#include <libConfig.h>
|
||||
#include <presentcontainer.h>
|
||||
#include <splitpanel.h>
|
||||
|
||||
namespace Core {
|
||||
class VSessionMaintenance : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VSessionMaintenance(Config::Configration *port);
|
||||
|
||||
void initPresentView(SplitFrame::ViewPresent *host, Components::PresentContainer *center_frame, Components::ProjectPresent *project_present,
|
||||
QStandardItemModel *model);
|
||||
|
||||
void viewStatesSave(SplitFrame::ViewPresent *root);
|
||||
void viewStatesRestore(SplitFrame::ViewPresent *root);
|
||||
|
||||
private:
|
||||
Config::Configration *const recover_port;
|
||||
QHash<QString, SplitFrame::RectCom *> view_store;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // VSESSIONMAINTENANCE_H
|
|
@ -216,21 +216,30 @@ void ViewPresent::regist_basepanel(RectCom *it) {
|
|||
all_func_views << it;
|
||||
}
|
||||
|
||||
void ViewPresent::markFreedom(ViewRes *view) {
|
||||
void ViewPresent::markFreedom(ViewRes *view, bool add) {
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
auto cinst = static_cast<RectCom *>(view);
|
||||
if (!freedom_views.contains(cinst)) {
|
||||
freedom_views << cinst;
|
||||
if (add) {
|
||||
if (!freedom_views.contains(cinst)) {
|
||||
freedom_views << cinst;
|
||||
|
||||
auto fview = static_cast<BaseView *>(view);
|
||||
for (auto &lsn : lsn_list)
|
||||
lsn->freedomAppended(cinst, fview->viewIcon(), fview->title());
|
||||
auto fview = static_cast<BaseView *>(view);
|
||||
for (auto &lsn : lsn_list)
|
||||
lsn->freedomAppended(cinst, fview->viewIcon(), fview->title());
|
||||
}
|
||||
|
||||
cinst->bind()->setVisible(false);
|
||||
cinst->setParentRes(nullptr);
|
||||
} else {
|
||||
if (freedom_views.contains(cinst)) {
|
||||
freedom_views.removeAll(cinst);
|
||||
|
||||
for (auto &lsn : lsn_list)
|
||||
lsn->freedomRemoved(cinst);
|
||||
}
|
||||
}
|
||||
|
||||
cinst->bind()->setVisible(false);
|
||||
cinst->setParentRes(nullptr);
|
||||
}
|
||||
|
||||
void ViewPresent::purge(ViewRes *target) {
|
||||
|
@ -291,10 +300,8 @@ RectCom *ViewPresent::adjustView() const { return this->adjust_view_temp; }
|
|||
|
||||
QObject *ViewPresent::globalEventFilter() const { return dynamic_cast<QObject *>(const_cast<ViewPresent *>(this)); }
|
||||
|
||||
SplitRect *ViewPresent::createSplit(RectCom *first, RectCom *next, SplitType sp, float pos, float split_width) {
|
||||
SplitRect *ViewPresent::createSplit(RectCom *first, RectCom *next) {
|
||||
auto inst = new SplitView(first, next, this);
|
||||
inst->setSplitInfo(sp, pos, split_width, false);
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace SplitFrame {
|
|||
|
||||
virtual ViewPresent *viewPanel() const = 0;
|
||||
virtual void objsRelateRebuild() = 0;
|
||||
virtual void markFreedom(ViewRes *view) = 0;
|
||||
virtual void markFreedom(ViewRes *view, bool add = true) = 0;
|
||||
virtual void purge(ViewRes *target) = 0;
|
||||
};
|
||||
|
||||
|
@ -147,7 +147,7 @@ namespace SplitFrame {
|
|||
bool adjustState() const;
|
||||
RectCom *adjustView() const;
|
||||
|
||||
SplitRect *createSplit(RectCom *first, RectCom *next, SplitType sp, float pos = 20, float split_width = 8);
|
||||
SplitRect *createSplit(RectCom *first, RectCom *next);
|
||||
|
||||
template <class FnView, bool _blank> RectCom *appendView(FnWrap<FnView, _blank> *view_inst, const QIcon &icon, const QString &title) {
|
||||
if (view_inst->bindHost() != this)
|
||||
|
@ -179,7 +179,7 @@ namespace SplitFrame {
|
|||
// ResManager interface
|
||||
public:
|
||||
virtual void objsRelateRebuild() override;
|
||||
virtual void markFreedom(ViewRes *view) override;
|
||||
virtual void markFreedom(ViewRes *view, bool add = true) override;
|
||||
virtual void purge(ViewRes *target) override;
|
||||
|
||||
// SplitRect interface
|
||||
|
|
Loading…
Reference in New Issue