feat: Service Registry + Bridge 解耦架构 + 全工程代码清理
## 架构升级:Service Registry + Bridge 模式 - 新增 PluginSDK/IPluginServices.h:10 个纯虚服务接口(IDataProvider/ILinkProvider/...) - 新增 MavLinkServiceBridge:单 QObject 实现全部服务,隔离 MavLinkNode 依赖 - 升级 PluginManifest:支持 plugin.json 的 provides/consumes 声明式依赖 - 实现 ExtensionHost::autoWire():元对象自省自动连接信号槽 - 集成到 AppController:initModules() 中创建桥接器并注册到 ServiceRegistry - CockpitPlugin 演示服务发现:initialize() 中通过 PluginContext 查找服务 ## 代码清理 - Plugins/opmap:~280 行死代码(waypointsetting 100行注释块/tilematrix 54行/等27个文件) - Plugins/MavLinkNode:~200 行 GBK 乱码注释翻译为 UTF-8 + 12 行注释死代码 - Plugins/ToolsUI:~222 行死代码(ECU.cpp 82行/INS.cpp 113行/Parse/ToolsUI 等) - StatusUI/Setting/MissionUI:~65 行注释死代码 - Cockpit/leftladder.cpp:10 处 GBK 乱码翻译为中文 - 清理头文件注释掉的 #include(19 处)、空 if-else 分支、注释变量声明 ## 编译验证 - [100%] Built target GCS 零错误 - 运行时 timeout 3s 正常退出,无崩溃
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
#ifndef GLOBALSETTING_H
|
||||
#define GLOBALSETTING_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "QDebug"
|
||||
#include "Config/Config.h"
|
||||
#include "rectlatlng.h"
|
||||
#include <QHostAddress>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class GlobalSetting;
|
||||
}
|
||||
|
||||
class GlobalSetting : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QVariant d0;
|
||||
QVariant kd;
|
||||
QVariant len;
|
||||
}_servo;
|
||||
|
||||
public:
|
||||
explicit GlobalSetting(QWidget *parent = nullptr);
|
||||
~GlobalSetting();
|
||||
|
||||
|
||||
Q_INVOKABLE void getGCSID(void);
|
||||
Q_INVOKABLE void getServo(void);
|
||||
Q_INVOKABLE void getHeartBeat(void);
|
||||
Q_INVOKABLE void getTTS(void);
|
||||
Q_INVOKABLE void getExportInfo(void);
|
||||
Q_INVOKABLE void getVirtualMargin(void);
|
||||
Q_INVOKABLE void setVirtualMargin(void);
|
||||
Q_INVOKABLE void setMapSource(QStringList const &sources);
|
||||
Q_INVOKABLE void setDefaultMapSource(QString const &mapName);
|
||||
|
||||
|
||||
|
||||
QMap<int, Config::_latlng> red;
|
||||
QMap<int, Config::_latlng> orange;
|
||||
QMap<int, Config::_latlng> drop1;
|
||||
QMap<int, Config::_latlng> drop2;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief 清空地图下载提示信息
|
||||
*/
|
||||
void cleanDownloadInfo();
|
||||
/**
|
||||
* @brief 显示当前已下载的图片数
|
||||
* @param total 当前级别的图片总数
|
||||
* @param actual 当前下载的图片数
|
||||
* @param id 进度条的id
|
||||
*/
|
||||
void showDownloadImageNum(int total, int actual, quint8 id);
|
||||
/**
|
||||
* @brief 设置需要缓存的经纬度范围
|
||||
* @param lng1 左上角经度
|
||||
* @param lat1 左上角纬度
|
||||
* @param lng2 右下角经度
|
||||
* @param lat2 右下角纬度
|
||||
*/
|
||||
void setLngLatRectRange(double lng1, double lat1, double lng2, double lat2);
|
||||
/**
|
||||
* @brief 设置当前缓存地图级别进度条的值
|
||||
* @param value 当前进度条的值
|
||||
*/
|
||||
void setProgressBarValue(int value);
|
||||
/**
|
||||
* @brief 更改当前正在缓存的地图级别
|
||||
* @param zoom 当前正在缓存的地图级别
|
||||
* @param id 进度条的id
|
||||
*/
|
||||
void setMapSaveGrade(int zoom, quint8 id);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
void on_pushButton_setGCSID_clicked();
|
||||
|
||||
void on_pushButton_getServoOffset_clicked();
|
||||
|
||||
void on_pushButton_setServoOffset_clicked();
|
||||
|
||||
void on_pushButton_getHeartBeat_clicked();
|
||||
|
||||
void on_pushButton_setHeartBeat_clicked();
|
||||
|
||||
void on_pushButton_Beep_clicked();
|
||||
|
||||
void on_pushButton_TTS_clicked();
|
||||
|
||||
void on_pushButton_readVirtualMargin_clicked();
|
||||
|
||||
void on_pushButton_saveVirtualMargin_clicked();
|
||||
|
||||
void on_pushButton_InfoExport_clicked();
|
||||
|
||||
/**
|
||||
* @brief 当用户需要更换地图源的时候,发出信号
|
||||
* @param index是QComboBox当前项索引
|
||||
*/
|
||||
void on_comboMapSource_currentIndexChanged(int index);
|
||||
/**
|
||||
* @brief 发出转到base界面的信号,让用户框选范围
|
||||
*/
|
||||
void on_btnRectRange_clicked();
|
||||
/**
|
||||
* @brief 发出缓存/取消缓存地图的信号
|
||||
*/
|
||||
void on_pushButton_clicked();
|
||||
/**
|
||||
* @brief 设置app代理
|
||||
*/
|
||||
void on_btnLogin_clicked();
|
||||
/**
|
||||
* @brief 当选择的代理类型发生改变时,更改默认值
|
||||
* @param index 当前选择类型的索引值
|
||||
*/
|
||||
void on_chkProxyType_currentIndexChanged(int index);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief 取消缓存地图的信号
|
||||
*/
|
||||
void cancelSaveMap();
|
||||
/**
|
||||
* @brief 切换代理的信号
|
||||
* @param type 代理类型
|
||||
* @param addr 地址
|
||||
* @param port 端口
|
||||
*/
|
||||
void switchProxy(QNetworkProxy::ProxyType type, QHostAddress const &addr, int port);
|
||||
/**
|
||||
* @brief 保存地图的信号
|
||||
* @param area是地图缓存的范围
|
||||
* @param grades是一些缓存地图级别
|
||||
*/
|
||||
void mapSave(internals::RectLatLng const &area, QList<int> const &grades);
|
||||
/**
|
||||
* @brief 转到Base界面的信号
|
||||
*/
|
||||
void goToBase();
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
void setGCSID(int id);
|
||||
|
||||
void setServo(QVariant ch1_d0,QVariant ch1_kd,QVariant ch1_len,
|
||||
QVariant ch2_d0,QVariant ch2_kd,QVariant ch2_len,
|
||||
QVariant ch3_d0,QVariant ch3_kd,QVariant ch3_len,
|
||||
QVariant ch4_d0,QVariant ch4_kd,QVariant ch4_len,
|
||||
QVariant ch5_d0,QVariant ch5_kd,QVariant ch5_len,
|
||||
QVariant ch6_d0,QVariant ch6_kd,QVariant ch6_len,
|
||||
QVariant ch7_d0,QVariant ch7_kd,QVariant ch7_len,
|
||||
QVariant ch8_d0,QVariant ch8_kd,QVariant ch8_len);
|
||||
|
||||
|
||||
void setHeartBeat(QVariant state,QVariant frq);
|
||||
|
||||
void setBeep(QVariant beep);
|
||||
|
||||
void setTTS(QVariant flag);
|
||||
|
||||
void setMargin(int type,QMap<int,Config::_latlng> latlng,QColor color);
|
||||
|
||||
void setExportInfo(QVariant value,QVariant id);
|
||||
|
||||
/**
|
||||
* @brief 更换地图源的信号
|
||||
* @param value是地图源类型
|
||||
*/
|
||||
void setMapTypes(QVariant value);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief 取消选中的地图缓存级别
|
||||
*/
|
||||
void cancelCheckedMapGrade();
|
||||
|
||||
bool isSaveMap = false; //是否缓存地图
|
||||
Ui::GlobalSetting *ui;
|
||||
};
|
||||
|
||||
#endif // GLOBALSETTING_H
|
||||
Reference in New Issue
Block a user