2020-10-22 09:14:33 +08:00
|
|
|
#include "CommandUI.h"
|
2020-04-30 14:33:57 +08:00
|
|
|
#include "ui_CommandUI.h"
|
|
|
|
|
|
2020-08-04 17:19:40 +08:00
|
|
|
#include "QtTextToSpeech/QtTextToSpeech"
|
|
|
|
|
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-04-30 14:33:57 +08:00
|
|
|
CommandUI::CommandUI(QWidget *parent) :
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
ui(new Ui::CommandUI)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
2020-04-30 17:29:57 +08:00
|
|
|
|
2021-07-07 09:16:44 +08:00
|
|
|
this->setAcceptDrops(true);
|
|
|
|
|
|
2020-10-10 12:12:30 +08:00
|
|
|
m_parent = parent;
|
2020-08-26 22:10:44 +08:00
|
|
|
//检测文件夹,如果不存在,那么就新建一个,这里存着所有的qml文件
|
2020-06-09 18:11:28 +08:00
|
|
|
QDir *Dir = new QDir;
|
|
|
|
|
if(!Dir->exists("./commands"))
|
|
|
|
|
Dir->mkdir("./commands");//如果文件夹不存在就新建
|
|
|
|
|
|
|
|
|
|
|
2020-05-12 18:05:47 +08:00
|
|
|
//load qss
|
|
|
|
|
QFile file(":/qss/CommandUI.qss");
|
|
|
|
|
file.open(QFile::ReadOnly);
|
|
|
|
|
QTextStream filetext(&file);
|
|
|
|
|
QString stylesheet = filetext.readAll();
|
|
|
|
|
this->setStyleSheet(stylesheet);
|
|
|
|
|
file.close();
|
2020-04-30 17:29:57 +08:00
|
|
|
|
|
|
|
|
|
2020-09-29 15:14:56 +08:00
|
|
|
//查找默认的值
|
2020-10-08 09:43:05 +08:00
|
|
|
Config *config = new Config();
|
|
|
|
|
if(config->getCommandFile().size() >0)
|
|
|
|
|
{
|
|
|
|
|
CommandFile = config->getCommandFile();
|
|
|
|
|
}
|
|
|
|
|
delete config;
|
2020-09-29 15:14:56 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
setCommandFile(CommandFile);
|
2020-08-22 23:05:13 +08:00
|
|
|
|
|
|
|
|
DoubleClickTimer = new QTimer(this);
|
|
|
|
|
DoubleClickTimer->setInterval(200);//0.2s之内再点击,那就相当于双击
|
|
|
|
|
connect(DoubleClickTimer,SIGNAL(timeout()),
|
|
|
|
|
this,SLOT(DoubleClickTimeout()));
|
|
|
|
|
|
2021-07-07 09:16:44 +08:00
|
|
|
|
|
|
|
|
ui->comboBox_seq->hide();
|
|
|
|
|
ui->label_seq->hide();
|
|
|
|
|
ui->pushButton_setSeq->hide();
|
|
|
|
|
|
|
|
|
|
ui->comboBox_uav->hide();
|
|
|
|
|
ui->label_uav->hide();
|
|
|
|
|
ui->pushButton_setUAV->hide();
|
|
|
|
|
|
2020-04-30 14:33:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommandUI::~CommandUI()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2021-07-07 09:16:44 +08:00
|
|
|
void CommandUI::wheelEvent(QWheelEvent *event)
|
|
|
|
|
{
|
|
|
|
|
int max = ui->tabWidget_Command->count();
|
|
|
|
|
int current = ui->tabWidget_Command->currentIndex();
|
|
|
|
|
|
|
|
|
|
if(event->delta() < 0)
|
|
|
|
|
{
|
|
|
|
|
if(current < (max - 1))
|
|
|
|
|
{
|
|
|
|
|
current++;
|
|
|
|
|
ui->tabWidget_Command->setCurrentIndex(current);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(event->delta() > 0)
|
|
|
|
|
{
|
|
|
|
|
if(current > 0)
|
|
|
|
|
{
|
|
|
|
|
current--;
|
|
|
|
|
ui->tabWidget_Command->setCurrentIndex(current);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandUI::dragEnterEvent(QDragEnterEvent *event)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(!event->mimeData()->urls()[0].fileName().right(5).compare(tr(".json")))
|
|
|
|
|
{
|
|
|
|
|
event->acceptProposedAction();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
event->ignore();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandUI::dropEvent(QDropEvent *event)
|
2020-08-17 21:10:24 +08:00
|
|
|
{
|
2021-07-07 09:16:44 +08:00
|
|
|
const QMimeData *qm = event->mimeData();
|
|
|
|
|
|
|
|
|
|
QString fileName = qm->urls()[0].toLocalFile();
|
|
|
|
|
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2021-07-07 09:16:44 +08:00
|
|
|
|
|
|
|
|
if(fileName.right(5) == ".json")
|
|
|
|
|
{
|
|
|
|
|
setCommandFile(fileName);
|
|
|
|
|
}
|
2020-08-17 21:10:24 +08:00
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-10-22 09:14:33 +08:00
|
|
|
void CommandUI::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
|
|
|
|
{
|
|
|
|
|
switch(event->key())
|
|
|
|
|
{
|
|
|
|
|
case Qt::Key_Space :
|
|
|
|
|
{
|
|
|
|
|
qInfo() << "command key" << event;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
void CommandUI::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::MiddleButton)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (event->button() == Qt::RightButton)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(event->modifiers() == Qt::ControlModifier)
|
|
|
|
|
{
|
|
|
|
|
QFileDialog *dlg = new QFileDialog();
|
|
|
|
|
|
2021-10-11 09:42:42 +08:00
|
|
|
//dlg->show();
|
2021-08-29 17:55:50 +08:00
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
QString fileName = dlg->getOpenFileName(this, tr("Selete Command File..."),
|
|
|
|
|
"./commands/",
|
|
|
|
|
tr("command file (*.json)"));
|
|
|
|
|
if(!fileName.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
setCommandFile(fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(event->modifiers() == Qt::AltModifier)
|
|
|
|
|
{
|
2020-11-15 09:11:18 +08:00
|
|
|
//CommandEditor *edit = new CommandEditor();
|
|
|
|
|
//edit->show();
|
2020-08-22 23:05:13 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-15 09:11:18 +08:00
|
|
|
void CommandUI::updateUI(void)
|
2020-10-10 12:12:30 +08:00
|
|
|
{
|
2020-11-15 18:37:21 +08:00
|
|
|
loadCommandJson(CommandFile);
|
|
|
|
|
|
2020-11-15 09:11:18 +08:00
|
|
|
for(QJsonValue info: CMD_infoArray) {
|
|
|
|
|
if (!info.isObject()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
if(!ui->tabWidget_Command->widget(info.toObject().find(_PageJsonKey).value().toInt()))
|
|
|
|
|
{
|
|
|
|
|
QWidget *w = new QWidget();
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
qInfo() << "Command Can't find index of " << info.toObject().find(_PageJsonKey).value().toInt();
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
if(info.toObject().find(_PageJsonKey).value().toInt() == 0)
|
|
|
|
|
{
|
|
|
|
|
ui->tabWidget_Command->insertTab(info.toObject().find(_PageJsonKey).value().toInt(),
|
|
|
|
|
w,
|
|
|
|
|
info.toObject().find(_TitleJsonKey).value().toString());
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
qInfo() << "Command Create Base Command Page";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ui->tabWidget_Command->insertTab(info.toObject().find(_PageJsonKey).value().toInt(),
|
|
|
|
|
w,
|
|
|
|
|
info.toObject().find(_TitleJsonKey).value().toString());
|
|
|
|
|
qInfo() << "Command Create Advance Command "
|
|
|
|
|
<< info.toObject().find(_TitleJsonKey).value().toString()
|
|
|
|
|
<< "Page";
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
QJsonArray BtnArray = info.toObject().find(_CommandsJsonKey).value().toArray();
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
for(QJsonValue binfo: BtnArray) {
|
|
|
|
|
if (!binfo.isObject()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
CommandButton *btn = new CommandButton(ui->tabWidget_Command->widget(info.toObject().find(_PageJsonKey).value().toInt()));
|
2020-10-10 12:12:30 +08:00
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
|
2020-12-08 00:03:40 +08:00
|
|
|
btn->setParameters(binfo.toObject().find(_rowJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_colunmJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_noticeJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_commandJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_confirmJsonKey).value().toVariant(),
|
|
|
|
|
info.toObject().find(_PageJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_dialogJsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param1JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param2JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param3JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param4JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param5JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param6JsonKey).value().toVariant(),
|
|
|
|
|
binfo.toObject().find(_param7JsonKey).value().toVariant());
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
|
|
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
btn->show();
|
|
|
|
|
btn->raise();
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
btn->setText(binfo.toObject().find(_TextJsonKey).value().toString());
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
btn->resize(m_width,m_height);
|
|
|
|
|
btn->move(binfo.toObject().find(_colunmJsonKey).value().toInt() * (m_width + m_spacing) + m_spacing,
|
|
|
|
|
binfo.toObject().find(_rowJsonKey).value().toInt() * (m_height + m_spacing)+ m_spacing);
|
2020-08-22 23:05:13 +08:00
|
|
|
|
|
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
btn->setProperty("state",state::success);
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
connect(btn,&CommandButton::clicked,
|
|
|
|
|
this,&CommandUI::on_commandClicked);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
}
|
2020-08-22 23:05:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
void CommandUI::setCommandFile(QString File)
|
|
|
|
|
{
|
|
|
|
|
Config *config = new Config();
|
|
|
|
|
config->setCommandFile(File);
|
|
|
|
|
delete config;
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
CommandFile = File;
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
for(int i = 0;i < ui->tabWidget_Command->count();i++)
|
|
|
|
|
{
|
|
|
|
|
QObjectList wlist = ui->tabWidget_Command->widget(i)->children();
|
|
|
|
|
foreach (QObject *b, wlist) {
|
|
|
|
|
CommandButton *btn = qobject_cast<CommandButton *>(b);
|
|
|
|
|
if(btn)
|
|
|
|
|
{
|
|
|
|
|
disconnect(btn,SIGNAL(clicked(bool)),
|
|
|
|
|
this,SLOT(on_commandClicked()));
|
|
|
|
|
delete btn;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-22 23:05:13 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
delete ui->tabWidget_Command->widget(i);
|
2020-08-22 23:05:13 +08:00
|
|
|
}
|
|
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
|
|
|
|
|
ui->tabWidget_Command->clear();
|
|
|
|
|
|
|
|
|
|
updateUI();
|
|
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
}
|
|
|
|
|
|
2020-05-29 19:30:33 +08:00
|
|
|
void CommandUI::loadCommandJson(const QString& jsonFilename)
|
|
|
|
|
{
|
|
|
|
|
if (jsonFilename.isEmpty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Loading " << jsonFilename;
|
|
|
|
|
|
|
|
|
|
QFile jsonFile(jsonFilename);
|
|
|
|
|
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
|
|
|
qWarning() << "Unable to open file" << jsonFilename << jsonFile.errorString();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QByteArray bytes = jsonFile.readAll();
|
|
|
|
|
|
|
|
|
|
jsonFile.close();
|
|
|
|
|
QJsonParseError jsonParseError;
|
|
|
|
|
QJsonDocument doc = QJsonDocument::fromJson(bytes, &jsonParseError);
|
|
|
|
|
if (jsonParseError.error != QJsonParseError::NoError) {
|
|
|
|
|
qWarning() << jsonFilename << "Unable to open json document" << jsonParseError.errorString();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QJsonObject json = doc.object();
|
2020-11-15 18:37:21 +08:00
|
|
|
m_version = json.value(_versionJsonKey).toString();
|
|
|
|
|
qDebug() << "command version :" << m_version;
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-11-15 09:11:18 +08:00
|
|
|
m_width = json.value(_WidthJsonKey).toInt();
|
|
|
|
|
m_height = json.value(_HeightJsonKey).toInt();
|
|
|
|
|
m_spacing = json.value(_spacingJsonKey).toInt();
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-11-15 18:37:21 +08:00
|
|
|
QJsonValue jsonValue = json.value(_ButtonsJsonKey);
|
2020-05-29 19:30:33 +08:00
|
|
|
|
|
|
|
|
if (!jsonValue.isArray()) {
|
|
|
|
|
qWarning() << jsonFilename << "_CommandButtonJsonKey not array";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMD_infoArray = jsonValue.toArray();
|
|
|
|
|
|
|
|
|
|
for(QJsonValue info: CMD_infoArray) {
|
|
|
|
|
if (!info.isObject()) {
|
|
|
|
|
qWarning() << jsonFilename << "mavCmdArray should contain objects";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-20 18:06:14 +08:00
|
|
|
|
|
|
|
|
void CommandUI::setSecondConfirm(QVariant value)
|
|
|
|
|
{
|
|
|
|
|
if(value.toBool() == true)
|
|
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
for(int i = 0;i < ui->tabWidget_Command->count();i++)
|
|
|
|
|
{
|
|
|
|
|
QObjectList list = ui->tabWidget_Command->widget(i)->children();
|
|
|
|
|
|
|
|
|
|
foreach (QObject *obj, list) {
|
|
|
|
|
CommandButton *btn = qobject_cast<CommandButton *>(obj);
|
|
|
|
|
if(btn)
|
|
|
|
|
{
|
|
|
|
|
if((btn->text() == m_name)
|
|
|
|
|
&&(btn->Command() == m_command)
|
|
|
|
|
&&(btn->Confirm() == m_confirm)
|
|
|
|
|
&&(btn->Param1() == m_param1)
|
|
|
|
|
&&(btn->Param2() == m_param2)
|
|
|
|
|
&&(btn->Param3() == m_param3)
|
|
|
|
|
&&(btn->Param4() == m_param4)
|
|
|
|
|
&&(btn->Param5() == m_param5)
|
|
|
|
|
&&(btn->Param6() == m_param6)
|
|
|
|
|
&&(btn->Param7() == m_param7))
|
|
|
|
|
{
|
|
|
|
|
btn->setProperty("state",state::failure);
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
2020-12-15 13:47:14 +08:00
|
|
|
|
|
|
|
|
emit showMessage(tr("发送指令 %1 %2").arg(btn->Command().toString()).arg(btn->text()));
|
2020-11-16 16:13:27 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-20 18:06:14 +08:00
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
emit cmd_long(m_param1.toDouble(),
|
|
|
|
|
m_param2.toDouble(),
|
|
|
|
|
m_param3.toDouble(),
|
|
|
|
|
m_param4.toDouble(),
|
|
|
|
|
m_param5.toDouble(),
|
|
|
|
|
m_param6.toDouble(),
|
|
|
|
|
m_param7.toDouble(),
|
2020-11-07 10:54:30 +08:00
|
|
|
m_command,m_confirm);
|
2020-11-16 16:13:27 +08:00
|
|
|
|
2020-07-20 18:06:14 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-08-19 22:21:48 +08:00
|
|
|
m_param1 = 0;
|
|
|
|
|
m_param2 = 0;
|
|
|
|
|
m_param3 = 0;
|
|
|
|
|
m_param4 = 0;
|
|
|
|
|
m_param5 = 0;
|
|
|
|
|
m_param6 = 0;
|
|
|
|
|
m_param7 = 0;
|
|
|
|
|
m_command = 0;
|
|
|
|
|
m_confirm = 0;
|
2020-07-20 18:06:14 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-15 22:21:38 +08:00
|
|
|
void CommandUI::setSecondValue(QVariant value)
|
|
|
|
|
{
|
|
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
for(int i = 0;i < ui->tabWidget_Command->count();i++)
|
|
|
|
|
{
|
|
|
|
|
QObjectList list = ui->tabWidget_Command->widget(i)->children();
|
2020-10-15 22:21:38 +08:00
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
foreach (QObject *obj, list) {
|
|
|
|
|
CommandButton *btn = qobject_cast<CommandButton *>(obj);
|
|
|
|
|
if(btn)
|
|
|
|
|
{
|
|
|
|
|
if((btn->text() == m_name)
|
|
|
|
|
&&(btn->Command() == m_command)
|
|
|
|
|
&&(btn->Confirm() == m_confirm)
|
|
|
|
|
&&(btn->Param1() == m_param1)
|
|
|
|
|
&&(btn->Param2() == m_param2)
|
|
|
|
|
&&(btn->Param3() == m_param3)
|
|
|
|
|
&&(btn->Param4() == m_param4)
|
|
|
|
|
&&(btn->Param5() == m_param5)
|
|
|
|
|
&&(btn->Param6() == m_param6)
|
|
|
|
|
&&(btn->Param7() == m_param7))
|
|
|
|
|
{
|
|
|
|
|
btn->setProperty("state",state::failure);
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
2020-12-15 13:47:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
emit showMessage(tr("发送指令 %1 %2").arg(btn->Command().toString()).arg(btn->text()));
|
2020-11-16 16:13:27 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-11-07 10:54:30 +08:00
|
|
|
}
|
2020-11-16 16:13:27 +08:00
|
|
|
}
|
2020-11-07 10:54:30 +08:00
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
//找到要编辑的,然后把数字赋值过去
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param1.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param1 = value;
|
2020-11-07 10:54:30 +08:00
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param2.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param2 = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param3.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param3 = value;
|
2020-10-15 22:21:38 +08:00
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param4.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param4 = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param5.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param5 = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param6.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param6 = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
m_param7.toDouble(&flag);
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param7 = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
emit cmd_long(m_param1.toDouble(),
|
|
|
|
|
m_param2.toDouble(),
|
|
|
|
|
m_param3.toDouble(),
|
|
|
|
|
m_param4.toDouble(),
|
|
|
|
|
m_param5.toDouble(),
|
|
|
|
|
m_param6.toDouble(),
|
|
|
|
|
m_param7.toDouble(),
|
2020-11-07 10:54:30 +08:00
|
|
|
m_command,m_confirm);
|
2020-10-15 22:21:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
void CommandUI::setParamValue(QVariant value)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
emit showMessage(tr("无人机 %1 %2 %3 %4")
|
|
|
|
|
.arg(QString::number(m_currentSys))
|
|
|
|
|
.arg(m_name)
|
|
|
|
|
.arg(m_param1.toString())
|
|
|
|
|
.arg(value.toString()));
|
|
|
|
|
|
|
|
|
|
//找到要编辑的,然后把数字赋值过去
|
|
|
|
|
/*
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
|
|
|
|
m_param3.toDouble(&flag);
|
|
|
|
|
if(!flag)
|
|
|
|
|
{
|
|
|
|
|
m_param3 = value;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
m_param3 = value;
|
|
|
|
|
|
|
|
|
|
emit WriteParam(m_currentSys,1,m_param1,m_param2,m_param3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-07-20 18:06:14 +08:00
|
|
|
void CommandUI::on_commandClicked()
|
|
|
|
|
{
|
2021-07-03 12:14:31 +08:00
|
|
|
|
2020-05-29 19:30:33 +08:00
|
|
|
//找到消息的发送者
|
2020-10-22 21:52:01 +08:00
|
|
|
CommandButton *btn = qobject_cast<CommandButton *>(sender());
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
m_name = btn->text();
|
|
|
|
|
|
|
|
|
|
m_command = btn->Command().toInt();
|
|
|
|
|
m_confirm = btn->Confirm().toInt();
|
|
|
|
|
|
|
|
|
|
m_param1 = btn->Param1();
|
|
|
|
|
m_param2 = btn->Param2();
|
|
|
|
|
m_param3 = btn->Param3();
|
|
|
|
|
m_param4 = btn->Param4();
|
|
|
|
|
m_param5 = btn->Param5();
|
|
|
|
|
m_param6 = btn->Param6();
|
|
|
|
|
m_param7 = btn->Param7();
|
|
|
|
|
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
int32_t dialogValue = btn->Dialog().toInt();
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
switch (dialogValue) {
|
|
|
|
|
case -1://param
|
|
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
//value 确定要输入的参数
|
|
|
|
|
Inputter *inputter = new Inputter(this);
|
|
|
|
|
inputter->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
2021-07-03 12:14:31 +08:00
|
|
|
QString str;
|
|
|
|
|
|
|
|
|
|
str.append(tr("set parameter \n"));
|
|
|
|
|
str.append(m_param1.toString());
|
|
|
|
|
str.append(" ");
|
|
|
|
|
str.append(m_param2.toString());
|
|
|
|
|
str.append("\n");
|
|
|
|
|
str.append(btn->Notice().toString());
|
|
|
|
|
|
|
|
|
|
inputter->setLabel(str);
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
connect(inputter,SIGNAL(confirmValue(QVariant)),
|
2021-07-03 12:14:31 +08:00
|
|
|
this,SLOT(setParamValue(QVariant)));
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
inputter->show();
|
|
|
|
|
|
2020-12-08 00:03:40 +08:00
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
}break;
|
|
|
|
|
case 0:{
|
|
|
|
|
btn->setProperty("state",state::failure);
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
2020-12-08 00:03:40 +08:00
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
emit cmd_long(m_param1.toDouble(),
|
|
|
|
|
m_param2.toDouble(),
|
|
|
|
|
m_param3.toDouble(),
|
|
|
|
|
m_param4.toDouble(),
|
|
|
|
|
m_param5.toDouble(),
|
|
|
|
|
m_param6.toDouble(),
|
|
|
|
|
m_param7.toDouble(),
|
|
|
|
|
m_command,m_confirm);
|
|
|
|
|
}break;
|
|
|
|
|
case 1:{
|
|
|
|
|
//根据这个comfirm 确定要输入的参数
|
|
|
|
|
Confirm *confirmor = new Confirm(this);
|
|
|
|
|
confirmor->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
|
|
|
|
confirmor->setNotice(btn->Notice().toString());
|
|
|
|
|
|
|
|
|
|
connect(confirmor,SIGNAL(confirmValue(QVariant)),
|
|
|
|
|
this,SLOT(setSecondConfirm(QVariant)));
|
|
|
|
|
|
|
|
|
|
confirmor->show();
|
|
|
|
|
}break;
|
|
|
|
|
case 2:{
|
|
|
|
|
//value 确定要输入的参数
|
|
|
|
|
Inputter *inputter = new Inputter(this);
|
|
|
|
|
inputter->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
|
|
|
|
inputter->setLabel(btn->Notice());
|
|
|
|
|
|
|
|
|
|
connect(inputter,SIGNAL(confirmValue(QVariant)),
|
|
|
|
|
this,SLOT(setSecondValue(QVariant)));
|
|
|
|
|
|
|
|
|
|
inputter->show();
|
|
|
|
|
}break;
|
|
|
|
|
default:{
|
2020-11-16 16:13:27 +08:00
|
|
|
btn->setProperty("state",state::failure);
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
|
|
|
|
|
2020-12-14 11:09:41 +08:00
|
|
|
emit cmd_long(m_param1.toDouble(),
|
|
|
|
|
m_param2.toDouble(),
|
|
|
|
|
m_param3.toDouble(),
|
|
|
|
|
m_param4.toDouble(),
|
|
|
|
|
m_param5.toDouble(),
|
|
|
|
|
m_param6.toDouble(),
|
|
|
|
|
m_param7.toDouble(),
|
2020-11-16 16:13:27 +08:00
|
|
|
m_command,m_confirm);
|
2021-07-03 12:14:31 +08:00
|
|
|
}break;
|
2020-11-16 16:13:27 +08:00
|
|
|
}
|
|
|
|
|
|
2020-05-29 19:30:33 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-07-09 18:00:23 +08:00
|
|
|
|
2020-06-24 17:04:15 +08:00
|
|
|
void CommandUI::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
|
|
|
|
{
|
2020-08-10 22:42:59 +08:00
|
|
|
bool isFundSender = false;
|
|
|
|
|
QString string;
|
2020-06-24 17:04:15 +08:00
|
|
|
//找到消息的发送者
|
|
|
|
|
|
2020-12-06 09:13:42 +08:00
|
|
|
qDebug() << "command accepte" << command;
|
|
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
for(int i = 0;i < ui->tabWidget_Command->count();i++)
|
2020-08-19 22:21:48 +08:00
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
if(!ui->tabWidget_Command->widget(i))
|
2020-08-19 22:21:48 +08:00
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-06 09:13:42 +08:00
|
|
|
qDebug() << "tab index" << i;
|
|
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
QObjectList list = ui->tabWidget_Command->widget(i)->children();
|
|
|
|
|
|
|
|
|
|
if(command == m_command)
|
|
|
|
|
{
|
|
|
|
|
foreach (QObject *obj, list)
|
2020-06-24 17:04:15 +08:00
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
CommandButton *btn = qobject_cast<CommandButton *>(obj);
|
|
|
|
|
if(btn)
|
2020-06-24 17:04:15 +08:00
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
QString btn_name = btn->text();
|
|
|
|
|
if(btn_name == m_name)//查到正在等待回复的按键
|
2020-06-24 17:04:15 +08:00
|
|
|
{
|
2020-11-16 16:13:27 +08:00
|
|
|
isFundSender = true;
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
if(flag)
|
|
|
|
|
{
|
|
|
|
|
btn->setProperty("state",state::success);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
btn->setProperty("state",state::failure);
|
|
|
|
|
}
|
2020-11-16 16:13:27 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
|
case MAV_RESULT_ACCEPTED:
|
|
|
|
|
string.append(tr("%1,%2 accepted and executed").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case MAV_RESULT_TEMPORARILY_REJECTED:
|
|
|
|
|
string.append(tr("%1,%2 rejected").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case MAV_RESULT_DENIED:
|
|
|
|
|
string.append(tr("%1,%2 permanently denied").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case MAV_RESULT_UNSUPPORTED:
|
|
|
|
|
string.append(tr("%1,%2 unsupported").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case MAV_RESULT_FAILED:
|
|
|
|
|
string.append(tr("%1,%2 failed").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case MAV_RESULT_IN_PROGRESS:
|
|
|
|
|
string.append(tr("%1,%2 being executed").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
2020-12-15 13:47:14 +08:00
|
|
|
case 0xFE:
|
|
|
|
|
string.append(tr("%1,%2 time out").arg(command).arg(btn_name));
|
|
|
|
|
break;
|
|
|
|
|
case 0xFF:
|
|
|
|
|
string.append(tr("Please do not operate too fast, the last instruction has not been sent"));
|
|
|
|
|
break;
|
2020-11-16 16:13:27 +08:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
btn->style()->unpolish(btn);
|
|
|
|
|
btn->style()->polish(btn);
|
2020-12-06 09:13:42 +08:00
|
|
|
|
|
|
|
|
m_command = 0;
|
|
|
|
|
m_name.clear();
|
2020-08-19 22:21:48 +08:00
|
|
|
}
|
2020-06-24 17:04:15 +08:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-19 22:21:48 +08:00
|
|
|
|
2020-12-06 09:13:42 +08:00
|
|
|
|
2020-11-16 16:13:27 +08:00
|
|
|
}
|
2020-06-24 17:04:15 +08:00
|
|
|
}
|
2020-08-10 22:42:59 +08:00
|
|
|
|
2020-11-17 15:30:22 +08:00
|
|
|
if(isFundSender == false)
|
2020-08-10 22:42:59 +08:00
|
|
|
{
|
2020-11-17 15:30:22 +08:00
|
|
|
emit Accepted(flag,command,result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(string.size() > 0)
|
|
|
|
|
{
|
2021-07-07 09:16:44 +08:00
|
|
|
|
2021-10-11 09:42:42 +08:00
|
|
|
/*
|
2021-07-07 09:16:44 +08:00
|
|
|
QVariant flag;
|
|
|
|
|
Config *cfg = new Config();
|
|
|
|
|
|
|
|
|
|
cfg->getTTS(&flag);
|
|
|
|
|
|
|
|
|
|
if(flag.toBool())
|
|
|
|
|
{
|
|
|
|
|
QTextToSpeech *tts = new QTextToSpeech();
|
|
|
|
|
tts->say(string);
|
|
|
|
|
tts->deleteLater();
|
|
|
|
|
|
|
|
|
|
}
|
2021-10-11 09:42:42 +08:00
|
|
|
*/
|
2020-08-10 22:42:59 +08:00
|
|
|
|
2021-10-11 09:42:42 +08:00
|
|
|
say(string);
|
2020-11-17 15:30:22 +08:00
|
|
|
emit showMessage(string);
|
|
|
|
|
}
|
2020-10-15 22:21:38 +08:00
|
|
|
}
|
2020-06-24 17:04:15 +08:00
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
|
|
|
|
|
2020-08-17 21:10:24 +08:00
|
|
|
//专门为航点设计的一个确认窗口
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-08-17 21:10:24 +08:00
|
|
|
void CommandUI::setCurrent(QVariant value)
|
|
|
|
|
{
|
|
|
|
|
if(value.toBool() == true)
|
|
|
|
|
{
|
2020-11-20 18:57:45 +08:00
|
|
|
emit showMessage(tr("设置航点 %1").arg(m_currentSeq));
|
|
|
|
|
|
2020-08-19 22:21:48 +08:00
|
|
|
emit SetCurrentPoint(m_currentSeq);
|
2020-08-17 21:10:24 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-06 18:39:19 +08:00
|
|
|
void CommandUI::missionConfirm(int group, int seq)
|
2020-08-17 21:10:24 +08:00
|
|
|
{
|
2020-08-19 22:21:48 +08:00
|
|
|
m_currentSeq = seq;
|
2020-08-17 21:10:24 +08:00
|
|
|
|
|
|
|
|
//根据这个comfirm 确定要输入的参数
|
|
|
|
|
Confirm *confirmor = new Confirm(this);
|
|
|
|
|
confirmor->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
|
|
|
|
confirmor->setNotice(tr("click confirm to set Point %1 as current point").arg(seq));
|
|
|
|
|
|
|
|
|
|
connect(confirmor,SIGNAL(confirmValue(QVariant)),
|
|
|
|
|
this,SLOT(setCurrent(QVariant)));
|
|
|
|
|
|
|
|
|
|
confirmor->show();
|
2022-09-06 18:39:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//输入 1~4
|
|
|
|
|
/*
|
|
|
|
|
if(isCofirmShow == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_currentSeq = seq;
|
|
|
|
|
|
|
|
|
|
//根据这个comfirm 确定要输入的参数
|
|
|
|
|
Confirm *confirmor = new Confirm(this);
|
|
|
|
|
confirmor->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
|
|
|
|
confirmor->setNotice(tr("click confirm to set group %1 Point %2 as current point").arg(group).arg(seq));
|
|
|
|
|
|
|
|
|
|
connect(confirmor,&Confirm::confirmValue,[=](QVariant value){
|
|
|
|
|
if(value.toBool() == true)
|
|
|
|
|
{
|
|
|
|
|
emit showMessage(tr("set mission :group %1,point %2").arg(group).arg(seq));
|
|
|
|
|
//emit SetCurrentPoint(seq);
|
|
|
|
|
|
|
|
|
|
//发送修改航线的指令
|
|
|
|
|
emit cmd_long(group,
|
|
|
|
|
seq,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
20011,
|
|
|
|
|
0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
isCofirmShow = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(confirmor,&Confirm::destroyed,[=](){
|
|
|
|
|
isCofirmShow = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
confirmor->show();
|
|
|
|
|
isCofirmShow = true;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-17 21:10:24 +08:00
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
|
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
void CommandUI::DoubleClickTimeout()
|
|
|
|
|
{
|
|
|
|
|
DoubleClickTimer->stop();
|
|
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-10-24 20:07:28 +08:00
|
|
|
void CommandUI::addVehicles(int sysid, int compid)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(compid)
|
|
|
|
|
|
|
|
|
|
if(ui->comboBox_uav->findData(sysid) == -1)
|
|
|
|
|
{
|
|
|
|
|
ui->comboBox_uav->addItem(QString::number(sysid),sysid);
|
|
|
|
|
ui->comboBox_uav->setCurrentIndex(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-03 12:14:31 +08:00
|
|
|
void CommandUI::CurrentUAV(int id,int comp)
|
|
|
|
|
{
|
|
|
|
|
m_currentSys = id;
|
|
|
|
|
m_currentComp = comp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-12-06 20:29:25 +08:00
|
|
|
void CommandUI::setPointCount(QList<int> nums)
|
2020-10-24 20:07:28 +08:00
|
|
|
{
|
|
|
|
|
ui->comboBox_seq->clear();
|
|
|
|
|
|
2020-12-06 20:29:25 +08:00
|
|
|
foreach (int i, nums)
|
2020-10-24 20:07:28 +08:00
|
|
|
{
|
|
|
|
|
ui->comboBox_seq->addItem(QString::number(i),i);
|
|
|
|
|
}
|
|
|
|
|
ui->comboBox_seq->setCurrentIndex(0);
|
|
|
|
|
|
|
|
|
|
}
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
void CommandUI::on_groupBox_Command_clicked()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "clicked";
|
2020-05-29 19:30:33 +08:00
|
|
|
|
2020-08-22 23:05:13 +08:00
|
|
|
if(DoubleClickTimer)
|
|
|
|
|
{
|
|
|
|
|
if(DoubleClickTimer->isActive())
|
|
|
|
|
{
|
|
|
|
|
//双击后的效果
|
|
|
|
|
qDebug() << "double";
|
|
|
|
|
DoubleClickTimer->stop();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
qDebug() << "clicked";
|
|
|
|
|
DoubleClickTimer->start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-24 20:07:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CommandUI::on_pushButton_setSeq_clicked()
|
|
|
|
|
{
|
|
|
|
|
if(ui->comboBox_seq->currentIndex() != -1)
|
|
|
|
|
{
|
2022-09-06 18:39:19 +08:00
|
|
|
int group = 1;//ui->comboBox_group->currentData().toInt() - 2;
|
2020-10-24 20:07:28 +08:00
|
|
|
int seq = ui->comboBox_seq->currentData(Qt::UserRole).toInt();
|
|
|
|
|
|
2022-09-06 18:39:19 +08:00
|
|
|
missionConfirm(group,seq);
|
2020-10-24 20:07:28 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandUI::on_pushButton_setUAV_clicked()
|
|
|
|
|
{
|
|
|
|
|
if(ui->comboBox_uav->currentIndex() != -1)
|
|
|
|
|
{
|
|
|
|
|
int seq = ui->comboBox_uav->currentData(Qt::UserRole).toInt();
|
|
|
|
|
|
|
|
|
|
//根据这个comfirm 确定要输入的参数
|
|
|
|
|
Confirm *confirmor = new Confirm(this);
|
|
|
|
|
confirmor->setGeometry(0,0,this->width(),this->height());
|
|
|
|
|
|
|
|
|
|
//设置警告界面
|
|
|
|
|
confirmor->setNotice(tr("click confirm to set uav %1 as current").arg(seq));
|
|
|
|
|
|
|
|
|
|
connect(confirmor,SIGNAL(confirmValue(QVariant)),
|
|
|
|
|
this,SLOT(setCurrent(QVariant)));
|
|
|
|
|
|
|
|
|
|
confirmor->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|