整理类型命名空间分类

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 \
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 \

View File

@ -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<QString>() << target->name());

View File

@ -5,10 +5,8 @@
#include <commandsdispatcher.h>
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

View File

@ -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);

View File

@ -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;
// 内部逻辑 ===========================================

View File

@ -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; }

View File

@ -10,7 +10,7 @@
#include <commandsdispatcher.h>
#include <libProjectManager.h>
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<Components::PresentHost *> present_ui;
QList<Presents::PresentHost *> present_ui;
QHash<QString, Presents::PresentFactory *> factory_map;
QHash<Core::Route, Presents::FilePresent *> doc_openning;

View File

@ -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<PresentContainer, true>(host, parent),
PresentContainerView::PresentContainerView(ViewPresent *host, QWidget *parent)
: FnWrap<PresentContainerView, true>(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<int>::of(&QComboBox::currentIndexChanged), this, &PresentContainer::change_view);
connect(close_btn, &QPushButton::toggled, this, &PresentContainer::close_current_view);
connect(title_store, QOverload<int>::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 <libConfig.h>
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<bool>("非法操作", "重复添加视图:" + 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 <QMessageBox>
void PresentContainer::close_current_view() {
void PresentContainerView::close_current_view() {
auto index = title_store->currentIndex();
const_cast<FilePresent *>(items_store[index])->beforeClose();
}

View File

@ -1,21 +1,24 @@
#ifndef PRESENTHOSTX_H
#define PRESENTHOSTX_H
#ifndef PRESENTCONTAINERVIEW_H
#define PRESENTCONTAINERVIEW_H
#include "manager_docs.h"
#include <QPushButton>
#include <QStackedWidget>
#include <splitpanel.h>
namespace Components {
namespace Presents {
class WelcomePanel;
}
namespace Components {
/**
* @brief
*/
class PresentContainer : public SplitFrame::FnWrap<PresentContainer, true>, public PresentHost {
class PresentContainerView : public SplitFrame::FnWrap<PresentContainerView, true>, 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

View File

@ -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("项目管理"));

View File

@ -7,7 +7,7 @@
#include <QMainWindow>
#include <QStandardItemModel>
#include <libConfig.h>
#include <presentcontainer.h>
#include <presentcontainerview.h>
#include <splitpanel.h>
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);

View File

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

View File

@ -5,9 +5,9 @@
#include <QWidget>
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<QString> &path) override;
};
} // namespace Components
} // namespace Presents
#endif // WELCOMEPANEL_H