重命名ViewSession类

This commit is contained in:
玉宇清音 2023-08-29 09:37:58 +08:00
parent bcccbb9b3e
commit 7d9f6a3f33
5 changed files with 19 additions and 19 deletions

View File

@ -34,8 +34,8 @@ SOURCES += \
srcedit_defaulttext.cpp \ srcedit_defaulttext.cpp \
srcedit_storyboard.cpp \ srcedit_storyboard.cpp \
tools.cpp \ tools.cpp \
viewsession.cpp \
viewstackedbar.cpp \ viewstackedbar.cpp \
vsession.cpp \
welcomepanel.cpp \ welcomepanel.cpp \
xapp.cpp xapp.cpp
@ -56,8 +56,8 @@ HEADERS += \
srcedit_defaulttext.h \ srcedit_defaulttext.h \
srcedit_storyboard.h \ srcedit_storyboard.h \
tools.h \ tools.h \
viewsession.h \
viewstackedbar.h \ viewstackedbar.h \
vsession.h \
welcomepanel.h \ welcomepanel.h \
xapp.h xapp.h

View File

@ -35,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent)
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 VSession(XApp::global_configration, present_host)), session_service(new ViewSession(XApp::global_configration, present_host)),
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)) {

View File

@ -9,7 +9,7 @@
#include "projectpresent.h" #include "projectpresent.h"
#include "tools.h" #include "tools.h"
#include "viewstackedbar.h" #include "viewstackedbar.h"
#include "vsession.h" #include "viewsession.h"
#include "welcomepanel.h" #include "welcomepanel.h"
#include <QListView> #include <QListView>
#include <QMainWindow> #include <QMainWindow>
@ -33,7 +33,7 @@ private:
Project::ProjectManager *const project_manager; Project::ProjectManager *const project_manager;
Core::DocumentsManager *const active_docscollect; Core::DocumentsManager *const active_docscollect;
SplitFrame::ViewPresent *const present_host; SplitFrame::ViewPresent *const present_host;
Core::VSession *const session_service; Core::ViewSession *const session_service;
// view ============================================= // view =============================================
Components::ViewStackedBar *const views_bar; Components::ViewStackedBar *const views_bar;

View File

@ -1,4 +1,4 @@
#include "vsession.h" #include "viewsession.h"
#include "messagespresent.h" #include "messagespresent.h"
#include "presentcontainer.h" #include "presentcontainer.h"
#include "projectpresent.h" #include "projectpresent.h"
@ -8,9 +8,9 @@ using namespace Core;
using namespace SplitFrame; using namespace SplitFrame;
using namespace Components; using namespace Components;
VSession::VSession(Config::Configration *port, ViewPresent *host) : host(host), recover_port(port) {} ViewSession::ViewSession(Config::Configration *port, ViewPresent *host) : host(host), recover_port(port) {}
void VSession::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();
auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理")); auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理"));
@ -55,7 +55,7 @@ void views_state_store(Config::Configration *port, const QList<QString> &base_pa
} }
} }
void VSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) { void ViewSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) {
recover_port->deleteX(base_path); recover_port->deleteX(base_path);
auto childs = root->child(); auto childs = root->child();
@ -70,8 +70,8 @@ void VSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) {
views_state_store(recover_port, base_path, QList<RectCom *>() << childs.first << childs.second); 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, RectCom *ViewSession::views_state_restore(const QHash<QString, SplitFrame::RectCom *> &cache, const QList<QString> &target_path,
Config::Configration *port, SplitFrame::ViewPresent *host) { Config::Configration *port, SplitFrame::ViewPresent *host) {
auto values = port->getMap(target_path); auto values = port->getMap(target_path);
if (!values.size()) if (!values.size())
return nullptr; return nullptr;
@ -102,7 +102,7 @@ RectCom *VSession::views_state_restore(const QHash<QString, SplitFrame::RectCom
} }
} }
void VSession::relayout_cascade(SplitFrame::RectCom *root) { void ViewSession::relayout_cascade(SplitFrame::RectCom *root) {
auto xinst = dynamic_cast<SplitRect *>(root); auto xinst = dynamic_cast<SplitRect *>(root);
if (!xinst) if (!xinst)
return; return;
@ -115,7 +115,7 @@ void VSession::relayout_cascade(SplitFrame::RectCom *root) {
relayout_cascade(child_pair.second); relayout_cascade(child_pair.second);
} }
bool VSession::eventFilter(QObject *watched, QEvent *event) { bool ViewSession::eventFilter(QObject *watched, QEvent *event) {
if (watched == (QObject *)host && event->type() == QEvent::Show) { if (watched == (QObject *)host && event->type() == QEvent::Show) {
relayout_cascade(host->child().first); relayout_cascade(host->child().first);
host->bind()->removeEventFilter(this); host->bind()->removeEventFilter(this);
@ -124,7 +124,7 @@ bool VSession::eventFilter(QObject *watched, QEvent *event) {
return QObject::eventFilter(watched, event); return QObject::eventFilter(watched, event);
} }
void VSession::viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root) { void ViewSession::viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root) {
auto key_path0 = base_path; auto key_path0 = base_path;
key_path0 << "rect_0"; key_path0 << "rect_0";
auto rect = views_state_restore(this->view_store, key_path0, recover_port, root); auto rect = views_state_restore(this->view_store, key_path0, recover_port, root);

View File

@ -1,5 +1,5 @@
#ifndef VSESSION_H #ifndef VIEWSESSION_H
#define VSESSION_H #define VIEWSESSION_H
#include "projectpresent.h" #include "projectpresent.h"
@ -11,10 +11,10 @@
#include <splitpanel.h> #include <splitpanel.h>
namespace Core { namespace Core {
class VSession : public QObject { class ViewSession : public QObject {
Q_OBJECT Q_OBJECT
public: public:
VSession(Config::Configration *port, SplitFrame::ViewPresent *host); ViewSession(Config::Configration *port, SplitFrame::ViewPresent *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);
@ -43,4 +43,4 @@ namespace Core {
} // namespace Core } // namespace Core
#endif // VSESSION_H #endif // VIEWSESSION_H