159 lines
3.0 KiB
C++
159 lines
3.0 KiB
C++
#ifndef COMMANDUI_H
|
|
#define COMMANDUI_H
|
|
|
|
#include <QWidget>
|
|
#include "QFile"
|
|
#include "QDebug"
|
|
|
|
#include "QPushButton"
|
|
|
|
#include "QJsonArray"
|
|
#include "QJsonDocument"
|
|
#include "QJsonObject"
|
|
#include "QJsonParseError"
|
|
|
|
#include "QDir"
|
|
#include "QFileDialog"
|
|
|
|
#include <QCommonStyle>
|
|
#include "QStyle"
|
|
|
|
#include "multiselector.h"
|
|
#include "Selector.h"
|
|
#include "Inputter.h"
|
|
#include "CharInputter.h"
|
|
#include "Confirm.h"
|
|
#include "CommandEditor.h"
|
|
|
|
#include "QMouseEvent"
|
|
|
|
#include "mavlink.h"
|
|
|
|
#include "QAction"
|
|
#include "QContextMenuEvent"
|
|
#include "QMenu"
|
|
|
|
#include "Config/Config.h"
|
|
|
|
namespace Ui {
|
|
class CommandUI;
|
|
}
|
|
|
|
class CommandUI : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum state{
|
|
success = 0,
|
|
failure,
|
|
twinkle,
|
|
};
|
|
|
|
explicit CommandUI(QWidget *parent = nullptr);
|
|
~CommandUI();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *event);
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
|
void wheelEvent(QWheelEvent *e);
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
public slots:
|
|
void setFloat(void);
|
|
void setFloatFlag(bool flag);
|
|
|
|
void commandAccepted(bool flag,uint16_t command,uint8_t result);
|
|
|
|
void missionConfirm(int seq);
|
|
|
|
void setCommandFile(QString File);
|
|
|
|
signals:
|
|
|
|
void SetCurrentPoint(int seq);
|
|
|
|
void cmd_int(float param1, float param2, float param3, float param4, int x, int y, float z);
|
|
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
|
|
|
private slots:
|
|
|
|
void on_commandClicked();
|
|
|
|
void DoubleClickTimeout();
|
|
|
|
void setSecondConfirm(QVariant value);
|
|
|
|
void setCurrent(QVariant value);
|
|
|
|
void on_groupBox_Command_clicked();
|
|
|
|
protected:
|
|
|
|
void loadCommandJson(const QString& jsonFilename);
|
|
|
|
|
|
private:
|
|
|
|
static const char* _versionJsonKey;
|
|
static const char* _commentJsonKey;
|
|
static const char* _CommandButtonJsonKey;
|
|
|
|
static const char* _WidthJsonKey;
|
|
static const char* _HeightJsonKey;
|
|
static const char* _dialogJsonKey;
|
|
static const char* _TextJsonKey;
|
|
static const char* _rowJsonKey;
|
|
static const char* _columnJsonKey;
|
|
|
|
|
|
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;
|
|
static const char* _commandJsonKey;
|
|
static const char* _confirmJsonKey;
|
|
|
|
QJsonArray CMD_infoArray;
|
|
|
|
int CMDwidth = 60;
|
|
int CMDheight = 60;
|
|
|
|
int CMD_version = 0;
|
|
|
|
QWidget *m_parent;
|
|
|
|
bool floatflag = false;
|
|
|
|
Ui::CommandUI *ui;
|
|
|
|
QTimer *DoubleClickTimer = nullptr;
|
|
|
|
|
|
QString CommandFile = "./commands/Command.json";
|
|
|
|
QString m_name = 0;
|
|
|
|
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;
|
|
|
|
|
|
|
|
int m_currentSeq = 0;
|
|
|
|
};
|
|
|
|
#endif // COMMANDUI_H
|