From 7d9f6a3f33dcdca81aea87a1fc6167e76556df86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E5=AE=87=E6=B8=85=E9=9F=B3?= <2422523675@qq.com> Date: Tue, 29 Aug 2023 09:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8DViewSession=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WordsIDE/WordsIDE.pro | 4 ++-- WordsIDE/mainwindow.cpp | 2 +- WordsIDE/mainwindow.h | 4 ++-- WordsIDE/{vsession.cpp => viewsession.cpp} | 18 +++++++++--------- WordsIDE/{vsession.h => viewsession.h} | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) rename WordsIDE/{vsession.cpp => viewsession.cpp} (85%) rename WordsIDE/{vsession.h => viewsession.h} (87%) diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index 15cfdb4..b4be8f0 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -34,8 +34,8 @@ SOURCES += \ srcedit_defaulttext.cpp \ srcedit_storyboard.cpp \ tools.cpp \ + viewsession.cpp \ viewstackedbar.cpp \ - vsession.cpp \ welcomepanel.cpp \ xapp.cpp @@ -56,8 +56,8 @@ HEADERS += \ srcedit_defaulttext.h \ srcedit_storyboard.h \ tools.h \ + viewsession.h \ viewstackedbar.h \ - vsession.h \ welcomepanel.h \ xapp.h diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index 486506a..0c1ae60 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -35,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent) project_manager(new XMLProjectManager(this)), active_docscollect(new DocumentsManager(project_manager)), 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)), center_frame(new PresentContainer(present_host, this)), project_present(new ProjectPresent(present_host, XApp::disp_core, active_docscollect, this)) { diff --git a/WordsIDE/mainwindow.h b/WordsIDE/mainwindow.h index 0946074..0c70b68 100644 --- a/WordsIDE/mainwindow.h +++ b/WordsIDE/mainwindow.h @@ -9,7 +9,7 @@ #include "projectpresent.h" #include "tools.h" #include "viewstackedbar.h" -#include "vsession.h" +#include "viewsession.h" #include "welcomepanel.h" #include #include @@ -33,7 +33,7 @@ private: Project::ProjectManager *const project_manager; Core::DocumentsManager *const active_docscollect; SplitFrame::ViewPresent *const present_host; - Core::VSession *const session_service; + Core::ViewSession *const session_service; // view ============================================= Components::ViewStackedBar *const views_bar; diff --git a/WordsIDE/vsession.cpp b/WordsIDE/viewsession.cpp similarity index 85% rename from WordsIDE/vsession.cpp rename to WordsIDE/viewsession.cpp index 798813d..2fdf5cd 100644 --- a/WordsIDE/vsession.cpp +++ b/WordsIDE/viewsession.cpp @@ -1,4 +1,4 @@ -#include "vsession.h" +#include "viewsession.h" #include "messagespresent.h" #include "presentcontainer.h" #include "projectpresent.h" @@ -8,9 +8,9 @@ using namespace Core; using namespace SplitFrame; 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(); 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 &base_pa } } -void VSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) { +void ViewSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) { recover_port->deleteX(base_path); auto childs = root->child(); @@ -70,8 +70,8 @@ void VSession::viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root) { views_state_store(recover_port, base_path, QList() << childs.first << childs.second); } -RectCom *VSession::views_state_restore(const QHash &cache, const QList &target_path, - Config::Configration *port, SplitFrame::ViewPresent *host) { +RectCom *ViewSession::views_state_restore(const QHash &cache, const QList &target_path, + Config::Configration *port, SplitFrame::ViewPresent *host) { auto values = port->getMap(target_path); if (!values.size()) return nullptr; @@ -102,7 +102,7 @@ RectCom *VSession::views_state_restore(const QHash(root); if (!xinst) return; @@ -115,7 +115,7 @@ void VSession::relayout_cascade(SplitFrame::RectCom *root) { 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) { relayout_cascade(host->child().first); host->bind()->removeEventFilter(this); @@ -124,7 +124,7 @@ bool VSession::eventFilter(QObject *watched, QEvent *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; key_path0 << "rect_0"; auto rect = views_state_restore(this->view_store, key_path0, recover_port, root); diff --git a/WordsIDE/vsession.h b/WordsIDE/viewsession.h similarity index 87% rename from WordsIDE/vsession.h rename to WordsIDE/viewsession.h index 828dd9d..d9aafc9 100644 --- a/WordsIDE/vsession.h +++ b/WordsIDE/viewsession.h @@ -1,5 +1,5 @@ -#ifndef VSESSION_H -#define VSESSION_H +#ifndef VIEWSESSION_H +#define VIEWSESSION_H #include "projectpresent.h" @@ -11,10 +11,10 @@ #include namespace Core { - class VSession : public QObject { + class ViewSession : public QObject { Q_OBJECT 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); @@ -43,4 +43,4 @@ namespace Core { } // namespace Core -#endif // VSESSION_H +#endif // VIEWSESSION_H