You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Software_Architecture/src/Client/include/ui/main/MainWindow.h

367 lines
8.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* @file MainWindow.h
* @brief 战场探索系统主控制界面定义
* @author CasualtySightPlus Team
* @date 2024-01-01
* @version 2.0
*
* 主控制界面类,提供战场探索系统的核心功能,包括:
* - 统一设备管理(无人机+地面机器人)
* - 地图显示控制
* - 探索任务管理
* - 实时状态监控
* - 智能导航系统
*
* @note 依赖Qt GUI模块和快速控件模块
* @since 2.0
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
// Qt核心头文件
#include <QMainWindow>
#include <QDialog>
#include <QStackedWidget>
#include <QFormLayout>
#include <QSplitter>
// Qt控件头文件
#include <QPushButton>
#include <QLabel>
#include <QLineEdit>
#include <QTableWidget>
#include <QQuickItem>
// Qt其他模块
#include <QProcess>
#include <QVector>
#include <QPair>
// 自定义模块头文件
#include "AudioModule/IntelligenceUI.h"
#include "FaceLightModule/FaceLightControl.h"
#include "ui/components/DeviceListPanel.h"
#include "ui/components/SystemLogPanel.h"
#include "ui/components/RightFunctionPanel.h"
// #include "ui/dialogs/DroneControlDialog.h"
// #include "ui/dialogs/RobotDogControlDialog.h"
// 标准库头文件
#include <string>
#include <cstring>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
/**
* @class MainWindow
* @brief 战场探索系统主控制界面
*
* 战场探索系统的主界面类继承自QMainWindow。
* 提供完整的战场探索和管理功能,包括:
*
* 主要功能:
* - UAV无人机设备管理和控制
* - 地面机器人设备管理和控制
* - 实时地图显示和位置标记
* - 人脸识别和自动跟踪
* - 智能导航和路径规划
* - 设备状态监控和管理
*
* 界面特点:
* - 军用风格的现代化界面设计
* - 支持多设备同时管理
* - 实时数据显示和更新
* - 直观的操作控制面板
*
* @note 这是应用程序的主要用户界面
* @warning 使用前需要确保数据库连接正常
* @see UAVDatabase, DogDatabase
* @since 2.0
*/
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
/**
* @brief 构造函数
* @param parent 父窗口指针默认为nullptr
*/
explicit MainWindow(QWidget *parent = nullptr);
/**
* @brief 析构函数
*/
~MainWindow();
/**
* @brief 设置地图显示
*/
void setupMapDisplay();
/**
* @brief 添加设备到数据库
* @param deviceId 设备ID
* @param name 设备名称
* @param type 设备类型 ("uav" 或 "dog")
* @param ip IP地址
* @param port 端口号
* @param state 状态 (默认为0)
* @param longitude 经度 (默认为0.0)
* @param latitude 纬度 (默认为0.0)
* @return 是否成功
*/
bool addDeviceToDatabase(const QString &deviceId, const QString &name, const QString &type, const QString &ip, int port, int state = 0, double longitude = 0.0, double latitude = 0.0);
/**
* @brief 地图显示控制
* @param button 控制按钮指针
* @param widget 显示控件指针
* @param layout 布局指针
*/
void mapDisplayControl(QPushButton *button, QWidget *widget, QGridLayout *layout);
/**
* @brief 添加机器人按钮控制
* @param button 控制按钮指针
*/
void addRobotControl(QPushButton *button);
/**
* @brief 显示已配置机器人列表按钮控制
* @param button 控制按钮指针
*/
void robotsInfosControl(QPushButton *button);
public slots:
/**
* @brief 添加机器人按钮点击槽函数
*/
void onAddRobotClicked();
/**
* @brief 机器人列表显示按钮点击槽函数
*/
void onRobotTabClicked();
/**
* @brief 切换到指定机器人页面槽函数
*/
void onSpecifiedRobotTabClicked();
private slots:
/**
* @brief 添加无人机按钮点击槽函数
*/
void onAddUAVClicked();
/**
* @brief 无人机标签页点击槽函数
*/
void onUAVTabClicked();
/**
* @brief 机器人位置按钮点击槽函数
*/
void onRobotLocationClicked();
/**
* @brief 无人机视图按钮点击槽函数
*/
void onUAVViewClicked();
/**
* @brief 机器人视图按钮点击槽函数
*/
void onRobotViewClicked();
/**
* @brief 机器人地图绘制按钮点击槽函数
*/
void onRobotMappingClicked();
/**
* @brief 智能导航按钮点击槽函数
*/
void onSmartNavigationClicked();
/**
* @brief 情报传达按钮点击槽函数
*/
void onIntelligenceClicked();
/**
* @brief FaceLight控制按钮点击槽函数
*/
void onFaceLightClicked();
/**
* @brief 设备选中槽函数
* @param deviceId 设备ID
*/
void onDeviceSelected(const QString &deviceId);
/**
* @brief 设备控制请求槽函数
* @param deviceId 设备ID
*/
void onDeviceControlRequested(const QString &deviceId);
/**
* @brief 设备定位请求槽函数
* @param deviceId 设备ID
*/
void onDeviceLocationRequested(const QString &deviceId);
/**
* @brief 设备详情请求槽函数
* @param deviceId 设备ID
*/
void onDeviceDetailsRequested(const QString &deviceId);
/**
* @brief 添加设备请求槽函数
* @param deviceType 设备类型
*/
void onAddDeviceRequested(const QString &deviceType);
private slots:
// 战场探索模块控制槽函数
/**
* @brief 无人机控制请求槽函数
*/
void onDroneControlRequested();
/**
* @brief 机器狗控制请求槽函数
*/
void onRobotDogControlRequested();
// 右侧功能面板信号处理槽函数
/**
* @brief 开始自主建图槽函数
*/
void onStartMapping();
/**
* @brief 停止自主建图槽函数
*/
void onStopMapping();
/**
* @brief 开始导航避障槽函数
*/
void onStartNavigation();
/**
* @brief 停止导航避障槽函数
*/
void onStopNavigation();
/**
* @brief 开始照片传输槽函数
*/
void onStartPhotoTransmission();
/**
* @brief 停止照片传输槽函数
*/
void onStopPhotoTransmission();
/**
* @brief 开始人物识别槽函数
*/
void onStartPersonRecognition();
/**
* @brief 停止人物识别槽函数
*/
void onStopPersonRecognition();
/**
* @brief 刷新敌情统计槽函数
*/
void onRefreshEnemyStats();
/**
* @brief 请求AI分析槽函数
*/
void onRequestAIAnalysis();
/**
* @brief 导出报告槽函数
*/
void onExportReport();
private:
/**
* @brief 初始化UI界面
*/
void setupUI();
/**
* @brief 设置设备列表面板
*/
void setupDeviceListPanel();
/**
* @brief 设置系统日志面板和左侧面板分割器
*/
void setupSystemLogPanel();
/**
* @brief 设置右侧功能面板
*/
void setupRightFunctionPanel();
/**
* @brief 连接信号和槽
*/
void connectSignals();
/**
* @brief 设置窗口样式
*/
void setupStyle();
/**
* @brief 初始化地图上的设备标记
*/
void initializeDeviceMarkersOnMap();
/**
* @brief 修复主要功能按钮布局
*/
void fixMainButtonLayout();
/**
* @brief 初始化现代样式管理器
*/
void initializeModernStyles();
private:
Ui::MainWindow *m_ui; ///< UI界面指针
IntelligenceUI *m_intelligenceUI; ///< 情报传达界面指针
FaceLightControl *m_faceLightControl; ///< 面部灯光控制界面指针
DeviceListPanel *m_deviceListPanel; ///< 设备列表面板组件
SystemLogPanel *m_systemLogPanel; ///< 系统日志面板组件
RightFunctionPanel *m_rightFunctionPanel; ///< 右侧功能面板组件
QSplitter *m_leftPanelSplitter; ///< 左侧面板分割器
QVector<QPair<QString, QString>> m_robotList; ///< 机器人列表(名称-IP地址对
QVector<QPair<QString, QString>> m_uavList; ///< 无人机列表(名称-IP地址对
// 控制对话框(暂时注释掉以避免编译问题)
// DroneControlDialog *m_droneControlDialog; ///< 无人机控制对话框
// RobotDogControlDialog *m_robotDogControlDialog; ///< 机器狗控制对话框
// 人脸识别相关成员变量已移除(功能暂未实现)
};
#endif // MAINWINDOW_H