From 2867cce510e57c61c051c42c4088321fdf03a02b 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 12:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E7=B1=BB=E5=9E=8B=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WordsIDE/WordsIDE.pro | 4 +-- WordsIDE/command_list.cpp | 8 +----- WordsIDE/command_list.h | 14 +++++----- WordsIDE/mainwindow.cpp | 2 +- WordsIDE/mainwindow.h | 4 +-- WordsIDE/manager_docs.cpp | 5 ++-- WordsIDE/manager_docs.h | 10 +++---- ...container.cpp => presentcontainerview.cpp} | 26 +++++++++---------- ...sentcontainer.h => presentcontainerview.h} | 17 +++++++----- WordsIDE/viewsession.cpp | 4 +-- WordsIDE/viewsession.h | 4 +-- WordsIDE/welcomepanel.cpp | 1 - WordsIDE/welcomepanel.h | 6 ++--- 13 files changed, 49 insertions(+), 56 deletions(-) rename WordsIDE/{presentcontainer.cpp => presentcontainerview.cpp} (76%) rename WordsIDE/{presentcontainer.h => presentcontainerview.h} (72%) diff --git a/WordsIDE/WordsIDE.pro b/WordsIDE/WordsIDE.pro index 0887ab6..da965ae 100644 --- a/WordsIDE/WordsIDE.pro +++ b/WordsIDE/WordsIDE.pro @@ -28,7 +28,7 @@ SOURCES += \ manager_docs.cpp \ messageview.cpp \ parsebridge.cpp \ - presentcontainer.cpp \ + presentcontainerview.cpp \ projectview.cpp \ route.cpp \ srcedit_defaulttext.cpp \ @@ -50,7 +50,7 @@ HEADERS += \ messageview.h \ opstream.h \ parsebridge.h \ - presentcontainer.h \ + presentcontainerview.h \ projectview.h \ route.h \ srcedit_defaulttext.h \ diff --git a/WordsIDE/command_list.cpp b/WordsIDE/command_list.cpp index 249ab2f..632e534 100644 --- a/WordsIDE/command_list.cpp +++ b/WordsIDE/command_list.cpp @@ -4,7 +4,6 @@ #include "DocsManager.h" using namespace CommandList; -using namespace Components; using namespace Core; using namespace Presents; @@ -186,12 +185,7 @@ QString OpenFile::toText() const return path_store.join("/"); } -void OpenFile::fromText(const QString &line) -{ - path_store = line.split("/"); -} - -using namespace Components; +void OpenFile::fromText(const QString &line) { path_store = line.split("/"); } CompVisible::CompVisible(PresentHost *host, FilePresent *target, bool state) : host_ins(host), target_ins(target), state_val(state) { path = Route::collect(QList() << target->name()); diff --git a/WordsIDE/command_list.h b/WordsIDE/command_list.h index 3e74a3d..d1d7083 100644 --- a/WordsIDE/command_list.h +++ b/WordsIDE/command_list.h @@ -5,10 +5,8 @@ #include -namespace Components { - class PresentHost; -} namespace Presents { + class PresentHost; class FilePresent; } @@ -117,7 +115,7 @@ namespace CommandList { // 切换视图组件 ================================================================ class CompVisible : public Schedule::GeCommand { public: - CompVisible(Components::PresentHost *host, Presents::FilePresent *target, bool state); + CompVisible(Presents::PresentHost *host, Presents::FilePresent *target, bool state); // GeCommand interface public: @@ -127,10 +125,10 @@ namespace CommandList { virtual void fromText(const QString &line) override; private: - Components::PresentHost *host_ins; - Presents::FilePresent *target_ins; - Core::Route path; - bool state_val; + Presents::PresentHost *host_ins; + Presents::FilePresent *target_ins; + Core::Route path; + bool state_val; }; } // namespace CommandList diff --git a/WordsIDE/mainwindow.cpp b/WordsIDE/mainwindow.cpp index d58417c..b028f15 100644 --- a/WordsIDE/mainwindow.cpp +++ b/WordsIDE/mainwindow.cpp @@ -38,7 +38,7 @@ MainWindow::MainWindow(const QString &layout, QWidget *parent) present_host(new SplitFrame::ViewPresent(this)), session_service(new ViewSession(XApp::global_configration, this)), views_bar(new ViewStackedBar(present_host, this)), - center_frame(new PresentContainer(present_host, this)), + center_frame(new PresentContainerView(present_host, this)), project_present(new ProjectView(present_host, XApp::disp_core, active_docscollect, this)) { QApplication::instance()->installEventFilter(this); diff --git a/WordsIDE/mainwindow.h b/WordsIDE/mainwindow.h index 556c2d6..b858cfe 100644 --- a/WordsIDE/mainwindow.h +++ b/WordsIDE/mainwindow.h @@ -5,7 +5,7 @@ #include "manager_docs.h" #include "messageview.h" #include "parsebridge.h" -#include "presentcontainer.h" +#include "presentcontainerview.h" #include "projectview.h" #include "tools.h" #include "viewsession.h" @@ -41,7 +41,7 @@ private: // view ============================================= Components::ViewStackedBar *const views_bar; - Components::PresentContainer *const center_frame; + Components::PresentContainerView *const center_frame; Components::ProjectView *const project_present; // 内部逻辑 =========================================== diff --git a/WordsIDE/manager_docs.cpp b/WordsIDE/manager_docs.cpp index 823675f..9871dd1 100644 --- a/WordsIDE/manager_docs.cpp +++ b/WordsIDE/manager_docs.cpp @@ -2,21 +2,20 @@ #include "DocsManager.h" #include "keywordshighlighter.h" -using namespace Components; using namespace Core; using namespace Config; using namespace Presents; DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project) { initContentViewPlugins(); } -void DocumentsManager::appendPresent(Components::PresentHost *container) { +void DocumentsManager::appendPresent(PresentHost *container) { if (present_ui.contains(container)) return; present_ui << container; } -void DocumentsManager::removePresent(Components::PresentHost *container) {} +void DocumentsManager::removePresent(PresentHost *container) {} Project::ProjectManager *DocumentsManager::projectManager() const { return pjtins; } diff --git a/WordsIDE/manager_docs.h b/WordsIDE/manager_docs.h index a8674d7..52fc626 100644 --- a/WordsIDE/manager_docs.h +++ b/WordsIDE/manager_docs.h @@ -10,7 +10,7 @@ #include #include -namespace Components { +namespace Presents { class PresentHost { public: @@ -52,7 +52,7 @@ namespace Components { virtual bool contains(const Presents::FilePresent *ins) const = 0; }; -} // namespace Components +} // namespace Presents namespace Core { @@ -68,8 +68,8 @@ namespace Core { * @brief 设置文档呈现窗口 * @param container */ - void appendPresent(Components::PresentHost *container); - void removePresent(Components::PresentHost *container); + void appendPresent(Presents::PresentHost *container); + void removePresent(Presents::PresentHost *container); /** * @brief 项目获取管理器 @@ -189,7 +189,7 @@ namespace Core { private: Project::ProjectManager *pjtins; - QList present_ui; + QList present_ui; QHash factory_map; QHash doc_openning; diff --git a/WordsIDE/presentcontainer.cpp b/WordsIDE/presentcontainerview.cpp similarity index 76% rename from WordsIDE/presentcontainer.cpp rename to WordsIDE/presentcontainerview.cpp index 9ede268..02d6df2 100644 --- a/WordsIDE/presentcontainer.cpp +++ b/WordsIDE/presentcontainerview.cpp @@ -1,4 +1,4 @@ -#include "presentcontainer.h" +#include "presentcontainerview.h" #include "DocsManager.h" #include "welcomepanel.h" @@ -13,8 +13,8 @@ using namespace Core; using namespace SplitFrame; using namespace Presents; -PresentContainer::PresentContainer(ViewPresent *host, QWidget *parent) - : FnWrap(host, parent), +PresentContainerView::PresentContainerView(ViewPresent *host, QWidget *parent) + : FnWrap(host, parent), title_store(new QComboBox(this)), stack_container(new QStackedWidget(this)), welcome_list(new WelcomePanel(this)), @@ -38,16 +38,16 @@ PresentContainer::PresentContainer(ViewPresent *host, QWidget *parent) layout->setColumnStretch(2, 1); layout->setColumnStretch(3, 0); - connect(title_store, QOverload::of(&QComboBox::currentIndexChanged), this, &PresentContainer::change_view); - connect(close_btn, &QPushButton::toggled, this, &PresentContainer::close_current_view); + connect(title_store, QOverload::of(&QComboBox::currentIndexChanged), this, &PresentContainerView::change_view); + connect(close_btn, &QPushButton::toggled, this, &PresentContainerView::close_current_view); } -QWidget *PresentContainer::hostWidget() const { return (QWidget *)this; } +QWidget *PresentContainerView::hostWidget() const { return (QWidget *)this; } #include using namespace Config; -void PresentContainer::append(FilePresent *ins) { +void PresentContainerView::append(FilePresent *ins) { if (!items_store.contains(ins)) { items_store.append(ins); title_store->addItem(ins->name()); @@ -57,7 +57,7 @@ void PresentContainer::append(FilePresent *ins) { throw new SimpleException("非法操作", "重复添加视图:" + ins->name()); } -bool PresentContainer::active(const FilePresent *ins) { +bool PresentContainerView::active(const FilePresent *ins) { if (!items_store.contains(ins)) return false; @@ -68,7 +68,7 @@ bool PresentContainer::active(const FilePresent *ins) { return true; } -void PresentContainer::remove(const FilePresent *ins) { +void PresentContainerView::remove(const FilePresent *ins) { if (!items_store.contains(ins)) return; @@ -78,7 +78,7 @@ void PresentContainer::remove(const FilePresent *ins) { stack_container->removeWidget(ins->widget()); } -bool PresentContainer::contains(const FilePresent *ins) const { +bool PresentContainerView::contains(const FilePresent *ins) const { for (auto &insit : items_store) { if (insit == ins) return true; @@ -86,13 +86,13 @@ bool PresentContainer::contains(const FilePresent *ins) const { return false; } -bool PresentContainer::avaliable(FilePresent *vins) { +bool PresentContainerView::avaliable(FilePresent *vins) { if (!QApplication::activeWindow()) return true; return this->hasFocus(); } -void PresentContainer::change_view(int view_index) { +void PresentContainerView::change_view(int view_index) { auto view_inst = items_store[view_index]; active(view_inst); @@ -100,7 +100,7 @@ void PresentContainer::change_view(int view_index) { } #include -void PresentContainer::close_current_view() { +void PresentContainerView::close_current_view() { auto index = title_store->currentIndex(); const_cast(items_store[index])->beforeClose(); } diff --git a/WordsIDE/presentcontainer.h b/WordsIDE/presentcontainerview.h similarity index 72% rename from WordsIDE/presentcontainer.h rename to WordsIDE/presentcontainerview.h index 5fb8f7f..a69ccde 100644 --- a/WordsIDE/presentcontainer.h +++ b/WordsIDE/presentcontainerview.h @@ -1,21 +1,24 @@ -#ifndef PRESENTHOSTX_H -#define PRESENTHOSTX_H +#ifndef PRESENTCONTAINERVIEW_H +#define PRESENTCONTAINERVIEW_H #include "manager_docs.h" #include #include #include -namespace Components { +namespace Presents { class WelcomePanel; +} + +namespace Components { /** * @brief 文档视图容器 */ - class PresentContainer : public SplitFrame::FnWrap, public PresentHost { + class PresentContainerView : public SplitFrame::FnWrap, public Presents::PresentHost { Q_OBJECT public: - PresentContainer(SplitFrame::ViewPresent *host, QWidget *parent = nullptr); + PresentContainerView(SplitFrame::ViewPresent *host, QWidget *parent = nullptr); // PresentContainer interface public: @@ -32,7 +35,7 @@ namespace Components { QComboBox *const title_store; QStackedWidget *const stack_container; - Components::WelcomePanel *const welcome_list; + Presents::WelcomePanel *const welcome_list; QPushButton *const close_btn; void change_view(int view_index); @@ -41,4 +44,4 @@ namespace Components { } // namespace Components -#endif // PRESENTHOSTX_H +#endif // PRESENTCONTAINERVIEW_H diff --git a/WordsIDE/viewsession.cpp b/WordsIDE/viewsession.cpp index 6df763f..4ce873a 100644 --- a/WordsIDE/viewsession.cpp +++ b/WordsIDE/viewsession.cpp @@ -1,7 +1,7 @@ #include "viewsession.h" #include "mainwindow.h" #include "messageview.h" -#include "presentcontainer.h" +#include "presentcontainerview.h" #include "projectview.h" using namespace Config; @@ -13,7 +13,7 @@ ViewSession::ViewSession(Config::Configration *port, MainWindow *host) : host(ho base_path = {"sys-config", "front-end", host->layoutName(), "view-state"}; } -void ViewSession::initPresentView(PresentContainer *center_frame, ProjectView *project_present, QStandardItemModel *error_model) { +void ViewSession::initPresentView(PresentContainerView *center_frame, ProjectView *project_present, QStandardItemModel *error_model) { split_infos.clear(); auto project_panel = host->appendView(project_present, QIcon(":/ui/icons/dir_icon.jpg"), tr("项目管理")); diff --git a/WordsIDE/viewsession.h b/WordsIDE/viewsession.h index 5db4a10..e3e45fd 100644 --- a/WordsIDE/viewsession.h +++ b/WordsIDE/viewsession.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include class MainWindow; @@ -18,7 +18,7 @@ namespace Core { public: ViewSession(Config::Configration *port, MainWindow *host); - void initPresentView(Components::PresentContainer *center_frame, Components::ProjectView *project_present, QStandardItemModel *model); + void initPresentView(Components::PresentContainerView *center_frame, Components::ProjectView *project_present, QStandardItemModel *model); void viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root); void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root); diff --git a/WordsIDE/welcomepanel.cpp b/WordsIDE/welcomepanel.cpp index 2eaf50e..7ce03f7 100644 --- a/WordsIDE/welcomepanel.cpp +++ b/WordsIDE/welcomepanel.cpp @@ -1,6 +1,5 @@ #include "welcomepanel.h" -using namespace Components; using namespace Core; using namespace Presents; diff --git a/WordsIDE/welcomepanel.h b/WordsIDE/welcomepanel.h index 6ea2dc0..7effd74 100644 --- a/WordsIDE/welcomepanel.h +++ b/WordsIDE/welcomepanel.h @@ -5,9 +5,9 @@ #include -namespace Components { +namespace Presents { - class WelcomePanel : public QWidget, public Presents::FilePresent { + class WelcomePanel : public QWidget, public FilePresent { public: WelcomePanel(QWidget *parent = nullptr); @@ -28,6 +28,6 @@ namespace Components { virtual void jumpTo(const QList &path) override; }; -} // namespace Components +} // namespace Presents #endif // WELCOMEPANEL_H