整理类型命名空间分类

This commit is contained in:
玉宇清音 2023-08-29 12:31:29 +08:00
parent 7c631975b2
commit 2867cce510
13 changed files with 49 additions and 56 deletions

View File

@ -28,7 +28,7 @@ SOURCES += \
manager_docs.cpp \ manager_docs.cpp \
messageview.cpp \ messageview.cpp \
parsebridge.cpp \ parsebridge.cpp \
presentcontainer.cpp \ presentcontainerview.cpp \
projectview.cpp \ projectview.cpp \
route.cpp \ route.cpp \
srcedit_defaulttext.cpp \ srcedit_defaulttext.cpp \
@ -50,7 +50,7 @@ HEADERS += \
messageview.h \ messageview.h \
opstream.h \ opstream.h \
parsebridge.h \ parsebridge.h \
presentcontainer.h \ presentcontainerview.h \
projectview.h \ projectview.h \
route.h \ route.h \
srcedit_defaulttext.h \ srcedit_defaulttext.h \

View File

@ -4,7 +4,6 @@
#include "DocsManager.h" #include "DocsManager.h"
using namespace CommandList; using namespace CommandList;
using namespace Components;
using namespace Core; using namespace Core;
using namespace Presents; using namespace Presents;
@ -186,12 +185,7 @@ QString OpenFile::toText() const
return path_store.join("/"); return path_store.join("/");
} }
void OpenFile::fromText(const QString &line) void OpenFile::fromText(const QString &line) { path_store = line.split("/"); }
{
path_store = line.split("/");
}
using namespace Components;
CompVisible::CompVisible(PresentHost *host, FilePresent *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());

View File

@ -5,10 +5,8 @@
#include <commandsdispatcher.h> #include <commandsdispatcher.h>
namespace Components {
class PresentHost;
}
namespace Presents { namespace Presents {
class PresentHost;
class FilePresent; class FilePresent;
} }
@ -117,7 +115,7 @@ namespace CommandList {
// 切换视图组件 ================================================================ // 切换视图组件 ================================================================
class CompVisible : public Schedule::GeCommand { class CompVisible : public Schedule::GeCommand {
public: public:
CompVisible(Components::PresentHost *host, Presents::FilePresent *target, bool state); CompVisible(Presents::PresentHost *host, Presents::FilePresent *target, bool state);
// GeCommand interface // GeCommand interface
public: public:
@ -127,10 +125,10 @@ namespace CommandList {
virtual void fromText(const QString &line) override; virtual void fromText(const QString &line) override;
private: private:
Components::PresentHost *host_ins; Presents::PresentHost *host_ins;
Presents::FilePresent *target_ins; Presents::FilePresent *target_ins;
Core::Route path; Core::Route path;
bool state_val; bool state_val;
}; };
} // namespace CommandList } // namespace CommandList

View File

@ -38,7 +38,7 @@ MainWindow::MainWindow(const QString &layout, QWidget *parent)
present_host(new SplitFrame::ViewPresent(this)), present_host(new SplitFrame::ViewPresent(this)),
session_service(new ViewSession(XApp::global_configration, this)), 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 PresentContainerView(present_host, this)),
project_present(new ProjectView(present_host, XApp::disp_core, active_docscollect, this)) { project_present(new ProjectView(present_host, XApp::disp_core, active_docscollect, this)) {
QApplication::instance()->installEventFilter(this); QApplication::instance()->installEventFilter(this);

View File

@ -5,7 +5,7 @@
#include "manager_docs.h" #include "manager_docs.h"
#include "messageview.h" #include "messageview.h"
#include "parsebridge.h" #include "parsebridge.h"
#include "presentcontainer.h" #include "presentcontainerview.h"
#include "projectview.h" #include "projectview.h"
#include "tools.h" #include "tools.h"
#include "viewsession.h" #include "viewsession.h"
@ -41,7 +41,7 @@ private:
// view ============================================= // view =============================================
Components::ViewStackedBar *const views_bar; Components::ViewStackedBar *const views_bar;
Components::PresentContainer *const center_frame; Components::PresentContainerView *const center_frame;
Components::ProjectView *const project_present; Components::ProjectView *const project_present;
// 内部逻辑 =========================================== // 内部逻辑 ===========================================

View File

@ -2,21 +2,20 @@
#include "DocsManager.h" #include "DocsManager.h"
#include "keywordshighlighter.h" #include "keywordshighlighter.h"
using namespace Components;
using namespace Core; using namespace Core;
using namespace Config; using namespace Config;
using namespace Presents; using namespace Presents;
DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project) { initContentViewPlugins(); } DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project) { initContentViewPlugins(); }
void DocumentsManager::appendPresent(Components::PresentHost *container) { void DocumentsManager::appendPresent(PresentHost *container) {
if (present_ui.contains(container)) if (present_ui.contains(container))
return; return;
present_ui << container; present_ui << container;
} }
void DocumentsManager::removePresent(Components::PresentHost *container) {} void DocumentsManager::removePresent(PresentHost *container) {}
Project::ProjectManager *DocumentsManager::projectManager() const { return pjtins; } Project::ProjectManager *DocumentsManager::projectManager() const { return pjtins; }

View File

@ -10,7 +10,7 @@
#include <commandsdispatcher.h> #include <commandsdispatcher.h>
#include <libProjectManager.h> #include <libProjectManager.h>
namespace Components { namespace Presents {
class PresentHost { class PresentHost {
public: public:
@ -52,7 +52,7 @@ namespace Components {
virtual bool contains(const Presents::FilePresent *ins) const = 0; virtual bool contains(const Presents::FilePresent *ins) const = 0;
}; };
} // namespace Components } // namespace Presents
namespace Core { namespace Core {
@ -68,8 +68,8 @@ namespace Core {
* @brief * @brief
* @param container * @param container
*/ */
void appendPresent(Components::PresentHost *container); void appendPresent(Presents::PresentHost *container);
void removePresent(Components::PresentHost *container); void removePresent(Presents::PresentHost *container);
/** /**
* @brief * @brief
@ -189,7 +189,7 @@ namespace Core {
private: private:
Project::ProjectManager *pjtins; Project::ProjectManager *pjtins;
QList<Components::PresentHost *> present_ui; QList<Presents::PresentHost *> present_ui;
QHash<QString, Presents::PresentFactory *> factory_map; QHash<QString, Presents::PresentFactory *> factory_map;
QHash<Core::Route, Presents::FilePresent *> doc_openning; QHash<Core::Route, Presents::FilePresent *> doc_openning;

View File

@ -1,4 +1,4 @@
#include "presentcontainer.h" #include "presentcontainerview.h"
#include "DocsManager.h" #include "DocsManager.h"
#include "welcomepanel.h" #include "welcomepanel.h"
@ -13,8 +13,8 @@ using namespace Core;
using namespace SplitFrame; using namespace SplitFrame;
using namespace Presents; using namespace Presents;
PresentContainer::PresentContainer(ViewPresent *host, QWidget *parent) PresentContainerView::PresentContainerView(ViewPresent *host, QWidget *parent)
: FnWrap<PresentContainer, true>(host, parent), : FnWrap<PresentContainerView, true>(host, parent),
title_store(new QComboBox(this)), title_store(new QComboBox(this)),
stack_container(new QStackedWidget(this)), stack_container(new QStackedWidget(this)),
welcome_list(new WelcomePanel(this)), welcome_list(new WelcomePanel(this)),
@ -38,16 +38,16 @@ PresentContainer::PresentContainer(ViewPresent *host, QWidget *parent)
layout->setColumnStretch(2, 1); layout->setColumnStretch(2, 1);
layout->setColumnStretch(3, 0); layout->setColumnStretch(3, 0);
connect(title_store, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PresentContainer::change_view); connect(title_store, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PresentContainerView::change_view);
connect(close_btn, &QPushButton::toggled, this, &PresentContainer::close_current_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 <libConfig.h> #include <libConfig.h>
using namespace Config; using namespace Config;
void PresentContainer::append(FilePresent *ins) { void PresentContainerView::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());
@ -57,7 +57,7 @@ void PresentContainer::append(FilePresent *ins) {
throw new SimpleException<bool>("非法操作", "重复添加视图:" + ins->name()); throw new SimpleException<bool>("非法操作", "重复添加视图:" + ins->name());
} }
bool PresentContainer::active(const FilePresent *ins) { bool PresentContainerView::active(const FilePresent *ins) {
if (!items_store.contains(ins)) if (!items_store.contains(ins))
return false; return false;
@ -68,7 +68,7 @@ bool PresentContainer::active(const FilePresent *ins) {
return true; return true;
} }
void PresentContainer::remove(const FilePresent *ins) { void PresentContainerView::remove(const FilePresent *ins) {
if (!items_store.contains(ins)) if (!items_store.contains(ins))
return; return;
@ -78,7 +78,7 @@ void PresentContainer::remove(const FilePresent *ins) {
stack_container->removeWidget(ins->widget()); stack_container->removeWidget(ins->widget());
} }
bool PresentContainer::contains(const FilePresent *ins) const { bool PresentContainerView::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;
@ -86,13 +86,13 @@ bool PresentContainer::contains(const FilePresent *ins) const {
return false; return false;
} }
bool PresentContainer::avaliable(FilePresent *vins) { bool PresentContainerView::avaliable(FilePresent *vins) {
if (!QApplication::activeWindow()) if (!QApplication::activeWindow())
return true; return true;
return this->hasFocus(); return this->hasFocus();
} }
void PresentContainer::change_view(int view_index) { void PresentContainerView::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);
@ -100,7 +100,7 @@ void PresentContainer::change_view(int view_index) {
} }
#include <QMessageBox> #include <QMessageBox>
void PresentContainer::close_current_view() { void PresentContainerView::close_current_view() {
auto index = title_store->currentIndex(); auto index = title_store->currentIndex();
const_cast<FilePresent *>(items_store[index])->beforeClose(); const_cast<FilePresent *>(items_store[index])->beforeClose();
} }

View File

@ -1,21 +1,24 @@
#ifndef PRESENTHOSTX_H #ifndef PRESENTCONTAINERVIEW_H
#define PRESENTHOSTX_H #define PRESENTCONTAINERVIEW_H
#include "manager_docs.h" #include "manager_docs.h"
#include <QPushButton> #include <QPushButton>
#include <QStackedWidget> #include <QStackedWidget>
#include <splitpanel.h> #include <splitpanel.h>
namespace Components { namespace Presents {
class WelcomePanel; class WelcomePanel;
}
namespace Components {
/** /**
* @brief * @brief
*/ */
class PresentContainer : public SplitFrame::FnWrap<PresentContainer, true>, public PresentHost { class PresentContainerView : public SplitFrame::FnWrap<PresentContainerView, true>, public Presents::PresentHost {
Q_OBJECT Q_OBJECT
public: public:
PresentContainer(SplitFrame::ViewPresent *host, QWidget *parent = nullptr); PresentContainerView(SplitFrame::ViewPresent *host, QWidget *parent = nullptr);
// PresentContainer interface // PresentContainer interface
public: public:
@ -32,7 +35,7 @@ namespace Components {
QComboBox *const title_store; QComboBox *const title_store;
QStackedWidget *const stack_container; QStackedWidget *const stack_container;
Components::WelcomePanel *const welcome_list; Presents::WelcomePanel *const welcome_list;
QPushButton *const close_btn; QPushButton *const close_btn;
void change_view(int view_index); void change_view(int view_index);
@ -41,4 +44,4 @@ namespace Components {
} // namespace Components } // namespace Components
#endif // PRESENTHOSTX_H #endif // PRESENTCONTAINERVIEW_H

View File

@ -1,7 +1,7 @@
#include "viewsession.h" #include "viewsession.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "messageview.h" #include "messageview.h"
#include "presentcontainer.h" #include "presentcontainerview.h"
#include "projectview.h" #include "projectview.h"
using namespace Config; 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"}; 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(); 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("项目管理"));

View File

@ -7,7 +7,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <libConfig.h> #include <libConfig.h>
#include <presentcontainer.h> #include <presentcontainerview.h>
#include <splitpanel.h> #include <splitpanel.h>
class MainWindow; class MainWindow;
@ -18,7 +18,7 @@ namespace Core {
public: public:
ViewSession(Config::Configration *port, MainWindow *host); 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 viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root);
void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root); void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root);

View File

@ -1,6 +1,5 @@
#include "welcomepanel.h" #include "welcomepanel.h"
using namespace Components;
using namespace Core; using namespace Core;
using namespace Presents; using namespace Presents;

View File

@ -5,9 +5,9 @@
#include <QWidget> #include <QWidget>
namespace Components { namespace Presents {
class WelcomePanel : public QWidget, public Presents::FilePresent { class WelcomePanel : public QWidget, public FilePresent {
public: public:
WelcomePanel(QWidget *parent = nullptr); WelcomePanel(QWidget *parent = nullptr);
@ -28,6 +28,6 @@ namespace Components {
virtual void jumpTo(const QList<QString> &path) override; virtual void jumpTo(const QList<QString> &path) override;
}; };
} // namespace Components } // namespace Presents
#endif // WELCOMEPANEL_H #endif // WELCOMEPANEL_H