重新整理了类型的命名空间排布

This commit is contained in:
玉宇清音 2023-08-29 12:18:41 +08:00
parent 748dbd2f0a
commit 7c631975b2
26 changed files with 127 additions and 122 deletions

View File

@ -8,5 +8,6 @@
using namespace Components;
using namespace Core;
using namespace Presents;
FilePresent::FilePresent(QObject *parent) : QObject(parent) {}

View File

@ -11,7 +11,7 @@ namespace Core {
class DocumentsManager;
}
namespace Components {
namespace Presents {
/**
* @brief
*/
@ -121,8 +121,8 @@ namespace Components {
#define DECL_PRESENT(type) \
private: \
static QString file_suffix; \
friend class Components::TypedPresentFactory<type>;
friend class Presents::TypedPresentFactory<type>;
} // namespace Components
} // namespace Presents
#endif // DOCSMANAGER_H

View File

@ -26,10 +26,10 @@ SOURCES += \
main.cpp \
mainwindow.cpp \
manager_docs.cpp \
messagespresent.cpp \
messageview.cpp \
parsebridge.cpp \
presentcontainer.cpp \
projectpresent.cpp \
projectview.cpp \
route.cpp \
srcedit_defaulttext.cpp \
srcedit_storyboard.cpp \
@ -47,11 +47,11 @@ HEADERS += \
# keywordshighlighter.h \
mainwindow.h \
manager_docs.h \
messagespresent.h \
messageview.h \
opstream.h \
parsebridge.h \
presentcontainer.h \
projectpresent.h \
projectview.h \
route.h \
srcedit_defaulttext.h \
srcedit_storyboard.h \

View File

@ -6,6 +6,7 @@
using namespace CommandList;
using namespace Components;
using namespace Core;
using namespace Presents;
NewProject::NewProject(const QDir &dir, const QString &name) : dir_symbo(dir), name_val(name) {}

View File

@ -7,6 +7,8 @@
namespace Components {
class PresentHost;
}
namespace Presents {
class FilePresent;
}
@ -115,7 +117,7 @@ namespace CommandList {
// 切换视图组件 ================================================================
class CompVisible : public Schedule::GeCommand {
public:
CompVisible(Components::PresentHost *host, Components::FilePresent *target, bool state);
CompVisible(Components::PresentHost *host, Presents::FilePresent *target, bool state);
// GeCommand interface
public:
@ -126,7 +128,7 @@ namespace CommandList {
private:
Components::PresentHost *host_ins;
Components::FilePresent *target_ins;
Presents::FilePresent *target_ins;
Core::Route path;
bool state_val;
};

View File

@ -9,10 +9,10 @@ namespace TestCase {
{
Q_OBJECT
public:
ContentPresentTest(Components::FilePresent *view);
ContentPresentTest(Presents::FilePresent *view);
private:
Components::FilePresent *inst;
Presents::FilePresent *inst;
private slots:
void test_Suffixes();

View File

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

View File

@ -3,13 +3,13 @@
#include "DocsManager.h"
#include "manager_docs.h"
#include "messagespresent.h"
#include "messageview.h"
#include "parsebridge.h"
#include "presentcontainer.h"
#include "projectpresent.h"
#include "projectview.h"
#include "tools.h"
#include "viewstackedbar.h"
#include "viewsession.h"
#include "viewstackedbar.h"
#include "welcomepanel.h"
#include <QListView>
#include <QMainWindow>
@ -42,7 +42,7 @@ private:
// view =============================================
Components::ViewStackedBar *const views_bar;
Components::PresentContainer *const center_frame;
Components::ProjectPresent *const project_present;
Components::ProjectView *const project_present;
// 内部逻辑 ===========================================
void initial_menubar(QMenuBar *mbar);

View File

@ -5,6 +5,7 @@
using namespace Components;
using namespace Core;
using namespace Config;
using namespace Presents;
DocumentsManager::DocumentsManager(Project::ProjectManager *project) : pjtins(project) { initContentViewPlugins(); }

View File

@ -27,29 +27,29 @@ namespace Components {
* @param vins
* @return
*/
virtual bool avaliable(FilePresent *vins) = 0;
virtual bool avaliable(Presents::FilePresent *vins) = 0;
/**
* @brief
* @param ins
*/
virtual void append(FilePresent *ins) = 0;
virtual void append(Presents::FilePresent *ins) = 0;
/**
* @brief
* @param ins
*/
virtual bool active(const FilePresent *ins) = 0;
virtual bool active(const Presents::FilePresent *ins) = 0;
/**
* @brief
* @param ins
*/
virtual void remove(const FilePresent *ins) = 0;
virtual void remove(const Presents::FilePresent *ins) = 0;
/**
* @brief
* @param ins
* @return
*/
virtual bool contains(const FilePresent *ins) const = 0;
virtual bool contains(const Presents::FilePresent *ins) const = 0;
};
} // namespace Components
@ -87,8 +87,8 @@ namespace Core {
* @brief
* @param ins
*/
template <class PresentType> void registPresentType(Components::TypedPresentFactory<PresentType> *ins) {
auto suffix = Components::TypedPresentFactory<PresentType>::suffix();
template <class PresentType> void registPresentType(Presents::TypedPresentFactory<PresentType> *ins) {
auto suffix = Presents::TypedPresentFactory<PresentType>::suffix();
factory_map[suffix] = ins;
}
@ -161,13 +161,13 @@ namespace Core {
* @param ins
* @return
*/
Core::Route convertPresent(Components::FilePresent *ins) const;
Core::Route convertPresent(Presents::FilePresent *ins) const;
/**
* @brief null
* @param node_path
* @return null或打开的展示实例
*/
Components::FilePresent *convertPresent(const Core::Route &node_path);
Presents::FilePresent *convertPresent(const Core::Route &node_path);
/**
* @brief
@ -191,8 +191,8 @@ namespace Core {
Project::ProjectManager *pjtins;
QList<Components::PresentHost *> present_ui;
QHash<QString, Components::PresentFactory *> factory_map;
QHash<Core::Route, Components::FilePresent *> doc_openning;
QHash<QString, Presents::PresentFactory *> factory_map;
QHash<Core::Route, Presents::FilePresent *> doc_openning;
};
} // namespace Core

View File

@ -1,27 +0,0 @@
#include "messagespresent.h"
#include <QVBoxLayout>
using namespace Components;
using namespace SplitFrame;
QHash<SplitFrame::ViewPresent *, MessagesPresent *> MessagesPresent::panel_map;
MessagesPresent::MessagesPresent(SplitFrame::ViewPresent *ins, QStandardItemModel *base, QWidget *parent)
: FnWrap<MessagesPresent, false>(ins, parent), ui_present(new QTableView(this)), items_present(base) {
auto layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(ui_present);
ui_present->setModel(items_present);
}
MessagesPresent *MessagesPresent::gen(SplitFrame::ViewPresent *host, QStandardItemModel *base, QWidget *parent) {
if (panel_map.contains(host))
return panel_map[host];
auto vins = new MessagesPresent(host, base, parent);
panel_map[host] = vins;
return vins;
}

View File

@ -1,29 +0,0 @@
#ifndef MESSAGEPRESENT_H
#define MESSAGEPRESENT_H
#include "DocsManager.h"
#include <QHash>
#include <QStandardItemModel>
#include <QTableView>
#include <splitpanel.h>
namespace Components {
/**
* @brief
*/
class MessagesPresent : public SplitFrame::FnWrap<MessagesPresent, false> {
public:
virtual ~MessagesPresent() = default;
static MessagesPresent *gen(SplitFrame::ViewPresent *host, QStandardItemModel *base, QWidget *parent = nullptr);
private:
MessagesPresent(SplitFrame::ViewPresent *ins, QStandardItemModel *base, QWidget *parent = nullptr);
QTableView *const ui_present;
QStandardItemModel *const items_present;
static QHash<SplitFrame::ViewPresent *, MessagesPresent *> panel_map;
};
} // namespace Components
#endif // MESSAGEPRESENT_H

27
WordsIDE/messageview.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "messageview.h"
#include <QVBoxLayout>
using namespace Components;
using namespace SplitFrame;
QHash<SplitFrame::ViewPresent *, MessageView *> MessageView::panel_map;
MessageView::MessageView(SplitFrame::ViewPresent *ins, QStandardItemModel *base, QWidget *parent)
: FnWrap<MessageView, false>(ins, parent), ui_present(new QTableView(this)), items_present(base) {
auto layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(ui_present);
ui_present->setModel(items_present);
}
MessageView *MessageView::gen(SplitFrame::ViewPresent *host, QStandardItemModel *base, QWidget *parent) {
if (panel_map.contains(host))
return panel_map[host];
auto vins = new MessageView(host, base, parent);
panel_map[host] = vins;
return vins;
}

29
WordsIDE/messageview.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef MESSAGEVIEW_H
#define MESSAGEVIEW_H
#include "DocsManager.h"
#include <QHash>
#include <QStandardItemModel>
#include <QTableView>
#include <splitpanel.h>
namespace Components {
/**
* @brief
*/
class MessageView : public SplitFrame::FnWrap<MessageView, false> {
public:
virtual ~MessageView() = default;
static MessageView *gen(SplitFrame::ViewPresent *host, QStandardItemModel *base, QWidget *parent = nullptr);
private:
MessageView(SplitFrame::ViewPresent *ins, QStandardItemModel *base, QWidget *parent = nullptr);
QTableView *const ui_present;
QStandardItemModel *const items_present;
static QHash<SplitFrame::ViewPresent *, MessageView *> panel_map;
};
} // namespace Components
#endif // MESSAGEVIEW_H

View File

@ -11,6 +11,7 @@
using namespace Components;
using namespace Core;
using namespace SplitFrame;
using namespace Presents;
PresentContainer::PresentContainer(ViewPresent *host, QWidget *parent)
: FnWrap<PresentContainer, true>(host, parent),

View File

@ -21,14 +21,14 @@ namespace Components {
public:
virtual QWidget *hostWidget() const override;
virtual void append(FilePresent *ins) override;
virtual bool active(const FilePresent *ins) override;
virtual void remove(const FilePresent *ins) override;
virtual bool contains(const FilePresent *ins) const override;
virtual bool avaliable(FilePresent *vins) override;
virtual void append(Presents::FilePresent *ins) override;
virtual bool active(const Presents::FilePresent *ins) override;
virtual void remove(const Presents::FilePresent *ins) override;
virtual bool contains(const Presents::FilePresent *ins) const override;
virtual bool avaliable(Presents::FilePresent *vins) override;
private:
QList<const FilePresent *> items_store;
QList<const Presents::FilePresent *> items_store;
QComboBox *const title_store;
QStackedWidget *const stack_container;

View File

@ -1,4 +1,4 @@
#include "projectpresent.h"
#include "projectview.h"
#include "command_list.h"
#include <QInputDialog>
@ -11,8 +11,8 @@ using namespace Schedule;
using namespace SplitFrame;
using namespace Core;
ProjectPresent::ProjectPresent(ViewPresent *host, CommandsDispatcher *core, Core::DocumentsManager *mgr, QWidget *parent)
: FnWrap<ProjectPresent, false>(host, parent), project_manager(mgr), source(core), view_present(new QTreeView(this)) {
ProjectView::ProjectView(ViewPresent *host, CommandsDispatcher *core, Core::DocumentsManager *mgr, QWidget *parent)
: FnWrap<ProjectView, false>(host, parent), project_manager(mgr), source(core), view_present(new QTreeView(this)) {
auto layout = new QVBoxLayout(this);
layout->addWidget(view_present);
layout->setMargin(1);
@ -22,14 +22,14 @@ ProjectPresent::ProjectPresent(ViewPresent *host, CommandsDispatcher *core, Core
view_present->setContextMenuPolicy(Qt::CustomContextMenu);
connect(view_present, &QTreeView::customContextMenuRequested,
this, &ProjectPresent::menu_popup);
this, &ProjectView::menu_popup);
connect(view_present, &QTreeView::doubleClicked,
this, &ProjectPresent::open_target);
this, &ProjectView::open_target);
}
QModelIndex ProjectPresent::currentIndex() const { return view_present->currentIndex(); }
QModelIndex ProjectView::currentIndex() const { return view_present->currentIndex(); }
void ProjectPresent::menu_popup(const QPoint &p)
void ProjectView::menu_popup(const QPoint &p)
{
QMenu m;
m.addAction("新建路径", [this](){
@ -61,11 +61,11 @@ void ProjectPresent::menu_popup(const QPoint &p)
m.exec(mapToGlobal(p));
}
void ProjectPresent::open_target(const QModelIndex &t)
void ProjectView::open_target(const QModelIndex &t)
{
auto mgr = source->get<DocumentsManager>(NAME(DocumentsManager));
auto path = mgr->convertPath(t);
source->postCommand(OpenFile(path));
}
void ProjectPresent::closeProcess() { project_manager->save(); }
void ProjectView::closeProcess() { project_manager->save(); }

View File

@ -1,5 +1,5 @@
#ifndef PROJECTPRESENT_H
#define PROJECTPRESENT_H
#ifndef PROJECTVIEW_H
#define PROJECTVIEW_H
#include "DocsManager.h"
#include "manager_docs.h"
@ -14,11 +14,11 @@ namespace Components {
/**
* @brief
*/
class ProjectPresent : public SplitFrame::FnWrap<ProjectPresent, false> {
class ProjectView : public SplitFrame::FnWrap<ProjectView, false> {
Q_OBJECT
public:
explicit ProjectPresent(SplitFrame::ViewPresent *host, Schedule::CommandsDispatcher *core, Core::DocumentsManager *mgr,
QWidget *parent = nullptr);
explicit ProjectView(SplitFrame::ViewPresent *host, Schedule::CommandsDispatcher *core, Core::DocumentsManager *mgr,
QWidget *parent = nullptr);
QModelIndex currentIndex() const;
@ -36,5 +36,4 @@ namespace Components {
};
}
#endif // PROJECTPRESENT_H
#endif // PROJECTVIEW_H

View File

@ -8,7 +8,7 @@
#include <QTextStream>
#include <libConfig.h>
using namespace Components;
using namespace Presents;
using namespace Enhancement;
using namespace Core;
using namespace Config;

View File

@ -7,12 +7,12 @@
#include <QFileInfo>
#include <QTextEdit>
namespace Components {
namespace Presents {
/**
* @brief Text默认文本编辑视图
*/
class DefaultTextEdit : public Components::FilePresent {
class DefaultTextEdit : public Presents::FilePresent {
DECL_PRESENT(DefaultTextEdit);
public:
@ -46,7 +46,7 @@ namespace Components {
virtual Core::DocumentsManager *docsManager() const override;
};
class DefaultTextEditFactory : public Components::TypedPresentFactory<DefaultTextEdit> {
class DefaultTextEditFactory : public Presents::TypedPresentFactory<DefaultTextEdit> {
public:
virtual ~DefaultTextEditFactory() = default;
@ -54,6 +54,6 @@ namespace Components {
public:
virtual void create(const QFileInfo &target) override;
};
} // namespace Components
} // namespace Presents
#endif // SRCEDIT_DEFAULTTEXT_H

View File

@ -6,10 +6,10 @@
#include <QTextStream>
#include <QVBoxLayout>
using namespace Components;
using namespace Enhancement;
using namespace Core;
using namespace Config;
using namespace Presents;
QString StorySourceEdit::file_suffix = "storyboard";

View File

@ -5,9 +5,8 @@
#include "keywordshighlighter.h"
#include <QTextEdit>
#include <docsManager.h>
namespace Components {
namespace Presents {
class StorySourceEdit : public FilePresent, public Enhancement::HighlightFeature {
DECL_PRESENT(StorySourceEdit);
@ -45,13 +44,13 @@ namespace Components {
virtual Core::Route accessPath() const override;
};
class StorySourceEditFactory : public TypedPresentFactory<StorySourceEdit> {
class StorySourceEditFactory : public Presents::TypedPresentFactory<StorySourceEdit> {
// PresentFactory interface
public:
virtual void create(const QFileInfo &target) override;
};
} // namespace Components
} // namespace Presents
#endif // SRCEDIT_STORYBOARD_H

View File

@ -1,8 +1,8 @@
#include "viewsession.h"
#include "mainwindow.h"
#include "messagespresent.h"
#include "messageview.h"
#include "presentcontainer.h"
#include "projectpresent.h"
#include "projectview.h"
using namespace Config;
using namespace Core;
@ -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, ProjectPresent *project_present, QStandardItemModel *error_model) {
void ViewSession::initPresentView(PresentContainer *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("项目管理"));
@ -23,7 +23,7 @@ void ViewSession::initPresentView(PresentContainer *center_frame, ProjectPresent
edit_panel = host->appendView(center_frame, QIcon(":/ui/icons/file_icon.jpg"), tr("编辑窗口"));
view_store[edit_panel->title()] = edit_panel;
auto msg_view = MessagesPresent::gen(host, error_model, host->bind());
auto msg_view = MessageView::gen(host, error_model, host->bind());
auto msg_panel = host->appendView(msg_view, QIcon(":/ui/icons/file_icon.jpg"), "信息提示");
host->markFreedom(msg_panel);
view_store[msg_panel->title()] = msg_panel;

View File

@ -1,7 +1,7 @@
#ifndef VIEWSESSION_H
#define VIEWSESSION_H
#include "projectpresent.h"
#include "projectview.h"
#include <QList>
#include <QMainWindow>
@ -18,7 +18,7 @@ namespace Core {
public:
ViewSession(Config::Configration *port, MainWindow *host);
void initPresentView(Components::PresentContainer *center_frame, Components::ProjectPresent *project_present, QStandardItemModel *model);
void initPresentView(Components::PresentContainer *center_frame, Components::ProjectView *project_present, QStandardItemModel *model);
void viewStatesSave(QMainWindow *win, SplitFrame::ViewPresent *root);
void viewStatesRestore(QMainWindow *win, SplitFrame::ViewPresent *root);

View File

@ -2,6 +2,7 @@
using namespace Components;
using namespace Core;
using namespace Presents;
WelcomePanel::WelcomePanel(QWidget *parent) : QWidget(parent) {}

View File

@ -7,7 +7,7 @@
namespace Components {
class WelcomePanel : public QWidget, public Components::FilePresent {
class WelcomePanel : public QWidget, public Presents::FilePresent {
public:
WelcomePanel(QWidget *parent = nullptr);