DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DAUIInterface.h
1#ifndef DAUIINTERFACE_H
2#define DAUIINTERFACE_H
3#include "DAInterfaceAPI.h"
4#include "DAGlobals.h"
5#include <QObject>
6#include <QJsonObject>
7#include "DAColorTheme.h"
8#include "DABaseInterface.h"
9class SARibbonMainWindow;
10class QMainWindow;
11namespace DA
12{
13class DACoreInterface;
14class DAUIExtendInterface;
15class DAActionsInterface;
16class DACommandInterface;
17class DADockingAreaInterface;
18class DARibbonAreaInterface;
19class DAStatusBarInterface;
25class DAINTERFACE_API DAUIInterface : public DABaseInterface
26{
27 Q_OBJECT
28 DA_DECLARE_PRIVATE(DAUIInterface)
29public:
30 DAUIInterface(SARibbonMainWindow* m, DACoreInterface* c);
32
33 // 获取主窗口
34 SARibbonMainWindow* mainWindow() const;
35
36 // 发生语言变更时会调用此函数,此函数将调用所有扩展的retranslateUi函数
37 virtual void retranslateUi();
38
39 // 注册action管理器
40 void registeAction(DAActionsInterface* ac);
41
42 // 注册扩展
43 void registeExtend(DAUIExtendInterface* ex);
44
45 // 注册命令接口
46 void registeCommand(DACommandInterface* cmd);
47
48 // 获取扩展数量
49 int getExtendCount() const;
50
51 // 获取扩展
52 DAUIExtendInterface* getExtend(int index);
53
54 // 获取命令接口,如果没有注册命令接口,返回nullptr,当前设计为一个命令接口
55 DACommandInterface* getCommandInterface() const;
56
57 // 获取action管理器
58 DAActionsInterface* getActionInterface() const;
59
60 // 添加信息在程序的日志窗口里显示
61 virtual void addInfoLogMessage(const QString& msg, bool showInStatusBar = true) = 0;
62
63 // 添加信息在程序的日志窗口里显示
64 virtual void addWarningLogMessage(const QString& msg, bool showInStatusBar = true) = 0;
65
66 // 添加信息在程序的日志窗口里显示
67 virtual void addCriticalLogMessage(const QString& msg, bool showInStatusBar = true) = 0;
68
69 // QApplication::processEvents();的wrapper
70 void processEvents() const;
71
72 // 选择文件夹
73 QString getExistingDirectory(const QString& title = QString(), const QString& dir = QString());
74
75public:
76 // 下面是默认的extend
77 // 获取主程序,此函数和getRibbonArea()->app()是一样的返回结果
78 virtual QMainWindow* getMainWindow() const = 0;
79
80 // 获取界面的docking区域
81 virtual DADockingAreaInterface* getDockingArea() = 0;
82
83 // 获取界面的ribbon区域
84 virtual DARibbonAreaInterface* getRibbonArea() = 0;
85
86 // 获取界面的StatusBar区域
87 virtual DAStatusBarInterface* getStatusBar() = 0;
88
89 // 执行一个通用的设置窗口,来获取设置信息,传入内容为构建窗口的设置信息,具体json的设置见DACommonPropertySettingDialog
90 virtual QJsonObject getConfigValues(const QString& jsonConfig,
91 QWidget* parent = nullptr,
92 const QString& cacheKey = QString() // 缓存关键字,如果存在缓存关键字,这个设置窗口会缓存起来,下次调用会直接exec,不会创建
93 ) = 0;
94 // 设置脏标志
95 virtual void setDirty(bool on = true) = 0;
96 // 获取/设置程序的主题
97 void setColorTheme(const DAColorTheme& th);
98 virtual DAColorTheme getColorTheme() const;
99
100protected:
101 bool eventFilter(QObject* watched, QEvent* event) override;
102};
103} // namespace DA
104#endif // DAUIINTERFACE_H
这是app所有action的管理器
Definition DAActionsInterface.h:15
Definition DABaseInterface.h:9
颜色主题
Definition DAColorTheme.h:15
命令接口
Definition DACommandInterface.h:22
APP的核心接口
Definition DACoreInterface.h:24
此接口负责整个app的dock区域
Definition DADockingAreaInterface.h:38
这个接口管理了AppRibbon区域的相关操作
Definition DARibbonAreaInterface.h:24
Definition DAStatusBarInterface.h:8
DAAppUIInterface下面的扩展模块
Definition DAUIExtendInterface.h:15
界面相关的接口
Definition DAUIInterface.h:26
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44