Files
SatelliteControl/mainwindow.h

109 lines
2.7 KiB
C
Raw Normal View History

2025-02-07 16:51:29 +08:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2025-02-08 17:05:12 +08:00
#include <QUdpSocket>
2025-02-07 16:51:29 +08:00
#include <QMainWindow>
2025-02-08 17:05:12 +08:00
#include <memory>
#include <vector>
2025-02-11 17:32:11 +08:00
#include <QTimer>
#include <QBarSet>
#include <QStackedBarSeries>
2025-02-08 17:05:12 +08:00
#include "RecordQuery.h"
2025-02-08 17:37:51 +08:00
#include "LoggerWidget.h"
2025-02-07 16:51:29 +08:00
2025-02-10 16:22:33 +08:00
#include "spdlog/spdlog.h"
2025-02-07 16:51:29 +08:00
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
2025-02-08 17:05:12 +08:00
enum class CallStatus{
Idle,
Calling,
Incoming,
Talking,
};
class QPolarChart;
class QChart;
class QBarCategoryAxis;
class QValueAxis;
class QTableWidgetItem;
2025-02-07 16:51:29 +08:00
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
void test1();
2025-02-08 17:05:12 +08:00
private slots:
void on_rdbChannelUHF_clicked();
void on_rdbChannelS_clicked();
void on_rdbChannelBeiDou_clicked();
void on_rdbChannelAuto_clicked();
2025-02-07 16:51:29 +08:00
2025-02-08 17:05:12 +08:00
void on_btnCallAnswer_clicked();
void on_btnCallReject_clicked();
void on_btnSendMessage_clicked();
void on_btnRecordQuery_clicked();
2025-02-10 16:22:33 +08:00
void readPendingDatagrams();
2025-02-08 17:05:12 +08:00
void on_tblMessageList_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous);
void handleHovered(bool status, int index, QBarSet *barset);
2025-02-08 17:37:51 +08:00
protected:
void keyPressEvent(QKeyEvent* event) override;
2025-02-08 17:05:12 +08:00
private:
void createBeiDouSignalStrengthChart();
void createAzimuthMapChart();
void setSignalStrengthValues(const QStringList& categories,const QList<qreal> &yValues);
void setAzimuthValues(const QList<QPointF> &points);
//-------------------------------------------------
// 消息列表操作
//-------------------------------------------------
void UpdateMessageList();
//-------------------------------------------------
// 与底层消息交互
//-------------------------------------------------
bool sendUdpMessage(const QByteArray &udpMessage);
bool call(const QString& number);
bool hangUpCall();
bool acceptCall();
bool rejectCall();
bool sendShortMessage(const QString &number,const QString& message);
2025-02-11 17:32:11 +08:00
void StartupTalkingTimer();
void ShutdownTalkingTimer();
2025-02-08 17:05:12 +08:00
void test();
2025-02-07 16:51:29 +08:00
private:
Ui::MainWindow *ui;
2025-02-08 17:05:12 +08:00
CallStatus m_callStatus = CallStatus::Idle;
2025-02-12 09:16:58 +08:00
std::vector<Record> m_msgList;
2025-02-12 10:09:07 +08:00
int m_unReadMsgCount = 0;
2025-02-12 09:16:58 +08:00
int m_callDuration = 0;
std::shared_ptr<QTimer> m_timer;
std::shared_ptr<spdlog::logger> m_logger;
2025-02-08 17:05:12 +08:00
std::shared_ptr<QUdpSocket> m_udpSocket;
2025-02-10 16:22:33 +08:00
std::shared_ptr<QUdpSocket> m_udpServerSocket;
2025-02-08 17:05:12 +08:00
std::shared_ptr<RecordQuery> m_recordQueryWidget;
2025-02-08 17:37:51 +08:00
std::shared_ptr<LoggerWidget> m_loggerWidget;
2025-02-08 17:05:12 +08:00
QChart* m_signalStrengthChart;
QPolarChart* m_azimuthChart;
QBarCategoryAxis* m_signalStrengthChartXAxis;
QValueAxis* m_signalStrengthChartYAxis;
QStackedBarSeries *m_stackedSeries;
2025-02-07 16:51:29 +08:00
};
#endif // MAINWINDOW_H