Files
flyLink/skylink_qt_station/src/MainWindow.h

156 lines
4.3 KiB
C
Raw Normal View History

2026-01-19 17:08:49 +08:00
/**
* @file MainWindow.h
* @brief SkyLink Qt -
*
* GPS
*
2026-01-20 10:41:22 +08:00
* @author flowzl
2026-01-19 17:08:49 +08:00
* @date 2026-01-19
*/
#pragma once
#include <QMainWindow>
#include <QLabel>
#include <QPushButton>
#include <QTcpSocket>
#include <QUdpSocket>
#include <QTimer>
#include <QImage>
2026-02-02 17:06:20 +08:00
#include <QNetworkAccessManager>
#include <QNetworkReply>
2026-01-21 13:44:29 +08:00
#include "DeviceInfo.h"
#include "DeviceInfoReceiver.h"
2026-01-19 17:08:49 +08:00
#include <memory>
class GroundReceiver;
class DataLogger;
/**
* @class MainWindow
* @brief
*/
class MainWindow : public QMainWindow {
Q_OBJECT
public:
/**
* @brief
* @param parent
*/
explicit MainWindow(QWidget* parent = nullptr);
/**
* @brief
*/
~MainWindow();
private slots:
/**
* @brief
*/
2026-02-02 17:06:20 +08:00
void on_frame_received(const QImage& img, double lat, double lon, double alt, uint32_t photo_number);
2026-01-19 17:08:49 +08:00
/**
* @brief
*/
void on_stats_updated(int fps, int kbs);
/**
* @brief
*/
void on_save_frame_clicked();
/**
* @brief /
*/
void on_record_toggled(bool checked);
/**
* @brief
*/
void on_settings_clicked();
2026-02-02 17:06:20 +08:00
/**
* @brief
*/
void on_trigger_capture_clicked();
2026-01-19 17:08:49 +08:00
2026-01-21 13:44:29 +08:00
/**
* @brief
*/
void on_device_info_received(const DeviceInfo& info);
2026-01-19 17:08:49 +08:00
private:
// ========================================================================
// UI 组件
// ========================================================================
QLabel* video_label_; ///< 视频显示标签
QLabel* stats_label_; ///< 统计信息标签
QLabel* gps_label_; ///< GPS 信息标签
2026-01-21 13:44:29 +08:00
QLabel* device_info_label_; ///< 设备信息标签
2026-01-19 17:08:49 +08:00
QPushButton* save_frame_btn_; ///< 保存帧按钮
QPushButton* record_btn_; ///< 录制按钮
QPushButton* settings_btn_; ///< 设置按钮
2026-02-02 17:06:20 +08:00
QPushButton* trigger_capture_btn_; ///< 触发拍照按钮
2026-01-19 17:08:49 +08:00
// ========================================================================
// 业务逻辑对象
// ========================================================================
std::shared_ptr<GroundReceiver> receiver_; ///< UDP 接收器
2026-01-21 13:44:29 +08:00
std::shared_ptr<DeviceInfoReceiver> device_info_receiver_; ///< 设备信息接收器
2026-01-19 17:08:49 +08:00
std::shared_ptr<DataLogger> logger_; ///< 数据记录器
2026-02-02 17:06:20 +08:00
QNetworkAccessManager* network_manager_; ///< HTTP 网络管理器
2026-01-19 17:08:49 +08:00
// ========================================================================
// 状态变量
// ========================================================================
QImage current_image_; ///< 当前显示的图像
double current_lat_ = 0.0; ///< 当前纬度
double current_lon_ = 0.0; ///< 当前经度
double current_alt_ = 0.0; ///< 当前海拔
bool is_recording_ = false; ///< 是否正在录制
2026-02-02 17:06:20 +08:00
uint32_t total_photos_received_ = 0; ///< 接收到的总照片数
uint32_t current_photo_number_ = 0; ///< 当前照片编号
QString ros2_node_ip_ = "localhost"; ///< ROS2 节点 IP 地址
int ros2_http_port_ = 8080; ///< ROS2 HTTP API 端口
2026-01-19 17:08:49 +08:00
// ========================================================================
// 初始化函数
// ========================================================================
/**
* @brief UI
*/
void init_ui();
/**
* @brief
*/
void init_connections();
/**
* @brief
*/
void create_menus();
2026-02-02 17:06:20 +08:00
/**
* @brief HTTP
* @param duration
* @param count
* @param interval
* @param mode 0=1=
*/
void triggerCaptureViaHttp(double duration, int count, double interval, int mode);
/**
* @brief HTTP
* @param reply
*/
void onHttpReply(QNetworkReply* reply);
2026-01-19 17:08:49 +08:00
};