Files
gcs-nf/App/CommandUI/CommandUI.h
T

171 lines
3.4 KiB
C++
Raw Permalink Normal View History

2020-10-22 09:14:33 +08:00
#ifndef COMMANDUI_H
2020-04-30 14:33:57 +08:00
#define COMMANDUI_H
#include <QWidget>
2020-05-12 18:05:47 +08:00
#include "QFile"
#include "QDebug"
2020-04-30 14:33:57 +08:00
#include "QPushButton"
2020-10-22 11:27:45 +08:00
#include "CommandButton.h"
#include "QJsonArray"
#include "QJsonDocument"
#include "QJsonObject"
#include "QJsonParseError"
2020-06-09 18:11:28 +08:00
#include "QDir"
#include "QFileDialog"
2020-06-20 16:51:11 +08:00
#include <QCommonStyle>
#include "QStyle"
2020-07-09 18:00:23 +08:00
#include "multiselector.h"
#include "Selector.h"
#include "Inputter.h"
#include "CharInputter.h"
#include "Confirm.h"
#include "CommandEditor.h"
2020-07-09 18:00:23 +08:00
#include "QMouseEvent"
2020-06-20 16:51:11 +08:00
2020-08-07 17:15:58 +08:00
#include "mavlink.h"
2020-10-10 12:12:30 +08:00
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
#include "Config/Config.h"
2020-04-30 14:33:57 +08:00
namespace Ui {
class CommandUI;
}
class CommandUI : public QWidget
{
Q_OBJECT
public:
2020-06-20 16:51:11 +08:00
enum state{
success = 0,
failure,
twinkle,
};
2020-04-30 14:33:57 +08:00
explicit CommandUI(QWidget *parent = nullptr);
~CommandUI();
protected:
2020-10-10 12:12:30 +08:00
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void wheelEvent(QWheelEvent *e);
void mousePressEvent(QMouseEvent *event);
2020-10-22 09:14:33 +08:00
void keyPressEvent(QKeyEvent *event);
void loadCommandJson(const QString& jsonFilename);
2020-06-24 17:04:15 +08:00
public slots:
2020-10-10 12:12:30 +08:00
void setFloat(void);
void setFloatFlag(bool flag);
2020-06-24 17:04:15 +08:00
void commandAccepted(bool flag,uint16_t command,uint8_t result);
void missionConfirm(int seq);
void setCommandFile(QString File);
2020-10-24 20:07:28 +08:00
void addVehicles(int sysid, int compid);
signals:
2020-10-14 21:28:47 +08:00
void showMessage(const QString &message,int TimeOut = 0);
void SetCurrentPoint(int seq);
2020-10-24 20:07:28 +08:00
void SetCurrentUAV(int seq);
void cmd_int(float param1, float param2, float param3, float param4, int x, int y, float z);
2020-06-03 18:09:41 +08:00
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
2020-10-24 20:07:28 +08:00
/*
void searchallPoint(void);
void searchallUav(void);
*/
private slots:
void on_commandClicked();
void DoubleClickTimeout();
2020-07-20 18:06:14 +08:00
void setSecondConfirm(QVariant value);
2020-10-15 22:21:38 +08:00
void setSecondValue(QVariant value);
2020-07-20 18:06:14 +08:00
void setCurrent(QVariant value);
2020-10-24 20:07:28 +08:00
void setPointCount(int num);
void on_groupBox_Command_clicked();
2020-04-30 14:33:57 +08:00
private:
static const char* _versionJsonKey;
static const char* _commentJsonKey;
static const char* _CommandButtonJsonKey;
2020-06-03 18:09:41 +08:00
static const char* _WidthJsonKey;
static const char* _HeightJsonKey;
static const char* _dialogJsonKey;
2020-06-03 18:09:41 +08:00
static const char* _TextJsonKey;
static const char* _rowJsonKey;
static const char* _columnJsonKey;
2020-06-03 18:09:41 +08:00
2020-07-20 18:06:14 +08:00
static const char* _noticeJsonKey;
static const char* _param1JsonKey;
static const char* _param2JsonKey;
static const char* _param3JsonKey;
static const char* _param4JsonKey;
static const char* _param5JsonKey;
static const char* _param6JsonKey;
static const char* _param7JsonKey;
2020-06-03 18:09:41 +08:00
static const char* _commandJsonKey;
static const char* _confirmJsonKey;
QJsonArray CMD_infoArray;
2020-06-03 18:09:41 +08:00
int CMDwidth = 60;
int CMDheight = 60;
2020-08-11 23:08:08 +08:00
int CMD_version = 0;
2020-10-10 12:12:30 +08:00
QWidget *m_parent;
2020-10-10 12:12:30 +08:00
bool floatflag = false;
2020-04-30 14:33:57 +08:00
Ui::CommandUI *ui;
QTimer *DoubleClickTimer = nullptr;
QString CommandFile = "./commands/Command.json";
2020-08-19 22:21:48 +08:00
QString m_name = 0;
2020-08-11 23:08:08 +08:00
2020-08-19 22:21:48 +08:00
float m_param1 = 0;
float m_param2 = 0;
float m_param3 = 0;
float m_param4 = 0;
float m_param5 = 0;
float m_param6 = 0;
float m_param7 = 0;
uint16_t m_command = 10;
uint8_t m_confirm = 10;
2020-08-19 22:21:48 +08:00
int m_currentSeq = 0;
2020-04-30 14:33:57 +08:00
};
#endif // COMMANDUI_H