feat: v0.1.0更新
This commit is contained in:
159
src/gui/MainWindow.h
Normal file
159
src/gui/MainWindow.h
Normal file
@@ -0,0 +1,159 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <memory>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
class ConfigManager;
|
||||
class NetworkManager;
|
||||
class DeviceScanner;
|
||||
class GVSPParser;
|
||||
class PointCloudProcessor;
|
||||
class PointCloudWidget;
|
||||
struct DeviceInfo;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
class QLabel;
|
||||
class QImage;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
// 相机控制槽函数
|
||||
void onStartClicked();
|
||||
void onStopClicked();
|
||||
void onOnceClicked();
|
||||
void onExposureChanged(int value);
|
||||
void onCaptureClicked();
|
||||
void onBrowseSavePathClicked();
|
||||
|
||||
// 网络配置槽函数
|
||||
void onConnectClicked();
|
||||
void onIpAddressChanged(const QString &ip);
|
||||
void onControlPortChanged(int port);
|
||||
void onDataPortChanged(int port);
|
||||
void onNetworkConnected();
|
||||
void onNetworkDisconnected();
|
||||
void onDataReceived(const QByteArray &data);
|
||||
|
||||
// GVSP数据处理槽函数
|
||||
void onImageReceived(const QImage &image, uint32_t blockId);
|
||||
void onDepthDataReceived(const QByteArray &depthData, uint32_t blockId);
|
||||
void onPointCloudReady(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, uint32_t blockId);
|
||||
|
||||
// 设备扫描槽函数
|
||||
void onRefreshClicked();
|
||||
void onDeviceFound(const DeviceInfo &device);
|
||||
void onScanProgress(int current, int total);
|
||||
void onScanFinished(int devicesFound);
|
||||
void onDeviceSelected(QListWidgetItem *item);
|
||||
|
||||
// 定时器更新
|
||||
void updateUI();
|
||||
|
||||
// 日志槽函数
|
||||
void onClearLogClicked();
|
||||
void onSaveLogClicked();
|
||||
|
||||
protected:
|
||||
// 重写事件处理函数以监听系统主题变化
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void setupConnections();
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
// 拍照辅助函数
|
||||
bool saveDepthImage(const QString &dir, const QString &baseName, const QString &format);
|
||||
bool savePointCloud(const QString &dir, const QString &baseName, const QString &format);
|
||||
void performBackgroundSave(const QString &saveDir, const QString &baseName,
|
||||
const QString &depthFormat, const QString &pointCloudFormat,
|
||||
const QImage &image, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
|
||||
|
||||
// 日志辅助函数
|
||||
void addLog(const QString &message, const QString &level = "INFO");
|
||||
void updateStatistics();
|
||||
|
||||
private:
|
||||
// 核心管理器
|
||||
std::unique_ptr<ConfigManager> m_configManager;
|
||||
std::unique_ptr<NetworkManager> m_networkManager;
|
||||
std::unique_ptr<DeviceScanner> m_deviceScanner;
|
||||
std::unique_ptr<PointCloudProcessor> m_pointCloudProcessor;
|
||||
|
||||
// UI更新定时器
|
||||
QTimer *m_updateTimer;
|
||||
|
||||
// 状态变量
|
||||
bool m_isConnected;
|
||||
bool m_autoSaveOnNextFrame;
|
||||
|
||||
// 当前帧数据(用于拍照)
|
||||
QImage m_currentImage;
|
||||
pcl::PointCloud<pcl::PointXYZ>::Ptr m_currentPointCloud;
|
||||
uint32_t m_currentFrameId;
|
||||
|
||||
// UI控件指针
|
||||
class QWidget *m_centralWidget;
|
||||
class QSplitter *m_mainSplitter;
|
||||
class QWidget *m_controlPanel;
|
||||
class QLabel *m_imageDisplay;
|
||||
PointCloudWidget *m_pointCloudWidget;
|
||||
|
||||
// 按钮控件
|
||||
QPushButton *m_refreshBtn;
|
||||
QPushButton *m_connectBtn;
|
||||
QPushButton *m_startBtn;
|
||||
QPushButton *m_stopBtn;
|
||||
QPushButton *m_onceBtn;
|
||||
QPushButton *m_captureBtn;
|
||||
|
||||
// 输入控件
|
||||
QSlider *m_exposureSlider;
|
||||
QSpinBox *m_exposureSpinBox;
|
||||
QSpinBox *m_ctrlPortSpinBox;
|
||||
QSpinBox *m_dataPortSpinBox;
|
||||
|
||||
// 拍照参数控件
|
||||
class QLineEdit *m_savePathEdit;
|
||||
QPushButton *m_browseSavePathBtn;
|
||||
class QComboBox *m_depthFormatCombo;
|
||||
class QComboBox *m_pointCloudFormatCombo;
|
||||
|
||||
// 显示控件
|
||||
QLabel *m_statusLabel;
|
||||
QListWidget *m_deviceList;
|
||||
|
||||
// 统计信息控件
|
||||
QLabel *m_fpsLabel;
|
||||
QLabel *m_resolutionLabel;
|
||||
QLabel *m_queueLabel;
|
||||
|
||||
// 日志显示控件
|
||||
class QTextEdit *m_logDisplay;
|
||||
QPushButton *m_clearLogBtn;
|
||||
QPushButton *m_saveLogBtn;
|
||||
|
||||
// 统计数据
|
||||
QDateTime m_lastFrameTime;
|
||||
int m_frameCount;
|
||||
int m_totalFrameCount;
|
||||
double m_currentFps;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
Reference in New Issue
Block a user