41修改,基础班,发布

This commit is contained in:
hm
2020-10-28 15:40:27 +08:00
parent 7b76b6240e
commit 0906e796ab
10 changed files with 88 additions and 286 deletions
+2 -43
View File
@@ -316,7 +316,7 @@ void CommandUI::setCommandFile(QString File)
btn->setFixedSize(CMDwidth,CMDheight);
ui->gridLayout_Command->addWidget(btn,
info.toObject().find(_rowJsonKey_columnJsonKey).value().toInt(),
info.toObject().find(_rowJsonKey).value().toInt(),
info.toObject().find(_columnJsonKey).value().toInt());
btn->setProperty("state",state::success);
@@ -647,23 +647,12 @@ 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);
}
}
void CommandUI::setPointCount(int num)
{
ui->comboBox_seq->clear();
for(int i = 1; i <= num;i++)
{
ui->comboBox_seq->addItem(QString::number(i),i);
}
ui->comboBox_seq->setCurrentIndex(0);
}
@@ -689,33 +678,3 @@ void CommandUI::on_groupBox_Command_clicked()
void CommandUI::on_pushButton_setSeq_clicked()
{
if(ui->comboBox_seq->currentIndex() != -1)
{
int seq = ui->comboBox_seq->currentData(Qt::UserRole).toInt();
missionConfirm(seq);
}
}
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();
}
}
-4
View File
@@ -106,10 +106,6 @@ private slots:
void on_groupBox_Command_clicked();
void on_pushButton_setSeq_clicked();
void on_pushButton_setUAV_clicked();
private:
static const char* _versionJsonKey;
+1 -55
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<width>418</width>
<height>490</height>
</rect>
</property>
@@ -15,60 +15,6 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>无人机#</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_uav"/>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_setUAV">
<property name="text">
<string>切换无人机</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>航点#</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_seq"/>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_setSeq">
<property name="text">
<string>切换航点</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_Command">
<property name="title">
<string>Command</string>
+8 -11
View File
@@ -1,4 +1,4 @@
#include "MenuBarUI.h"
#include "MenuBarUI.h"
#include "ui_MenuBarUI.h"
@@ -75,9 +75,11 @@ void MenuBarUI::setPushButtonState(uint8_t state1,uint8_t state2,uint8_t state3,
ui->pushButton_Info->style()->unpolish(ui->pushButton_Info);
ui->pushButton_Info->style()->polish(ui->pushButton_Info);
/*
ui->pushButton_Base->setProperty("state",state6);
ui->pushButton_Base->style()->unpolish(ui->pushButton_Base);
ui->pushButton_Base->style()->polish(ui->pushButton_Base);
*/
}
@@ -93,7 +95,7 @@ void MenuBarUI::onClicked()
void MenuBarUI::on_pushButton_Setting_clicked()
{
ui->pushButton_Base->hide();
// ui->pushButton_Base->hide();
setPushButtonState(state::Selected,
state::unSelected,
state::unSelected,
@@ -107,7 +109,7 @@ void MenuBarUI::on_pushButton_Setting_clicked()
void MenuBarUI::on_pushButton_SelfTest_clicked()
{
ui->pushButton_Base->hide();
//ui->pushButton_Base->hide();
setPushButtonState(state::unSelected,
state::Selected,
state::unSelected,
@@ -120,7 +122,7 @@ void MenuBarUI::on_pushButton_SelfTest_clicked()
void MenuBarUI::on_pushButton_Mission_clicked()
{
ui->pushButton_Base->hide();
//ui->pushButton_Base->hide();
setPushButtonState(state::unSelected,
state::unSelected,
state::Selected,
@@ -133,7 +135,7 @@ void MenuBarUI::on_pushButton_Mission_clicked()
void MenuBarUI::on_pushButton_Flight_clicked()
{
ui->pushButton_Base->show();
//ui->pushButton_Base->show();
setPushButtonState(state::unSelected,
state::unSelected,
state::unSelected,
@@ -146,7 +148,7 @@ void MenuBarUI::on_pushButton_Flight_clicked()
void MenuBarUI::on_pushButton_Info_clicked()
{
ui->pushButton_Base->hide();
//ui->pushButton_Base->hide();
setPushButtonState(state::unSelected,
state::unSelected,
state::unSelected,
@@ -158,11 +160,6 @@ void MenuBarUI::on_pushButton_Info_clicked()
emit IndexChanged(4);
}
void MenuBarUI::on_pushButton_Base_clicked()
{
update();
emit IndexChanged(5);
}
void MenuBarUI::showMessage(const QString &message, int TimeOut)
{
+1 -2
View File
@@ -1,4 +1,4 @@
#ifndef MENUBARUI_H
#ifndef MENUBARUI_H
#define MENUBARUI_H
#include <QWidget>
@@ -64,7 +64,6 @@ private slots:
void on_pushButton_Info_clicked();
void on_pushButton_Base_clicked();
private:
Ui::MenuBarUI *ui;
+24 -43
View File
@@ -77,25 +77,6 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_SelfTest">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>SelfTest</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_Flight">
<property name="minimumSize">
@@ -115,25 +96,6 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_Info">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Mission">
<property name="minimumSize">
@@ -184,22 +146,41 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton_Base">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_SelfTest">
<property name="minimumSize">
<size>
<width>79</width>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>80</height>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Base</string>
<string>SelfTest</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_Info">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
+14 -85
View File
@@ -311,6 +311,19 @@
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_friendlyName">
<property name="minimumSize">
<size>
<width>80</width>
<height>60</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Seq">
<property name="minimumSize">
<size>
@@ -329,57 +342,6 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_friendlyName">
<property name="minimumSize">
<size>
<width>80</width>
<height>60</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
@@ -583,38 +545,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>pushButton_Previous</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>41</x>
<y>165</y>
</hint>
<hint type="destinationlabel">
<x>187</x>
<y>105</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>pushButton_Next</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>209</x>
<y>169</y>
</hint>
<hint type="destinationlabel">
<x>272</x>
<y>112</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
+9
View File
@@ -95,6 +95,15 @@ ToolsUI::ToolsUI(QWidget *parent) :
setPushButtonState(ui->pushButton_Diagram,
state::unSelected);
ui->pushButton_Servos->hide();
ui->PowerSystem->hide();
ui->ServoSystem->hide();
ui->pushButton_ShowExtern->hide();
ui->pushButton_CommandBox->hide();
ui->pushButton_Diagram->hide();
}
ToolsUI::~ToolsUI()
+29 -41
View File
@@ -76,6 +76,7 @@ MainWindow::MainWindow(QWidget *parent)
this,SLOT(onTabIndexChanged(int)));
qDebug() << "menuBar init";
//---------------
//设置
setting = new Setting(this);
@@ -91,10 +92,10 @@ MainWindow::MainWindow(QWidget *parent)
//状态
statusui = new StatusUI(this);
statusui->hide();
//statusui = new StatusUI(this);
//statusui->hide();
healthui = new HealthUI(this);
//healthui = new HealthUI(this);
//指令
commandUI = new CommandUI(this);
@@ -320,7 +321,7 @@ MainWindow::MainWindow(QWidget *parent)
map,SLOT(WPSetCurrent(int)),Qt::DirectConnection);
//==== showmessage=====
connect(toolsui->command,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
//connect(toolsui->command,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
connect(commandUI,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
connect(copk,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
connect(dlink,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
@@ -390,7 +391,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width() - statusui->width(),this->height() - menuBarUI->height());
this->width()- copk->width(),this->height() - menuBarUI->height());
if(MainIndex == 2)//renwu
{
@@ -400,24 +401,17 @@ void MainWindow::resizeEvent(QResizeEvent *event)
//if(MainIndex == 5)//renwu
{
/*
if(statusui->isHidden())
map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width(),this->height() - menuBarUI->height());
*/
}
copk->setGeometry(this->width() - copk->width(),menuBarUI->height(),
copk->width(),copk->height());
healthui->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height(),
copk->width(),healthui->height());
statusui->setGeometry(map->width(),
menuBarUI->height(),
copk->width() *1.5,
this->height() - menuBarUI->height());
missionUI->setGeometry(this->width() - copk->width(),menuBarUI->height(),
copk->width(),this->height() - menuBarUI->height());
@@ -425,8 +419,8 @@ void MainWindow::resizeEvent(QResizeEvent *event)
commandUI->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height() + healthui->height(),
copk->width(),this->height() - menuBarUI->height() - copk->height() - healthui->height());
commandUI->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height(),
copk->width(),this->height() - menuBarUI->height() - copk->height());
toolsui->setGeometry(0,menuBarUI->height(),
@@ -628,14 +622,14 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
copk->show();
commandUI->show();
//statusui->show();
healthui->show();
//healthui->show();
}
else
{
copk->hide();
commandUI->hide();
//statusui->hide();
healthui->hide();
//healthui->hide();
}
@@ -646,24 +640,16 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
if(index == 5)
{
if(statusui->isHidden())
{
copk->show();
commandUI->show();
statusui->show();
healthui->show();
}
else
{
copk->show();
commandUI->show();
statusui->hide();
healthui->show();
}
//statusui->hide();
//healthui->show();
}
else
{
statusui->hide();
//statusui->hide();
}
@@ -689,7 +675,8 @@ void MainWindow::setCommunicationLostState(bool flag)
isCommunicationLost = flag;
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
//healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
if(flag == true)//通讯丢失
{
@@ -698,7 +685,7 @@ void MainWindow::setCommunicationLostState(bool flag)
showMessage(tr("Communication Lost"),3000);
tts->say(tr("Communication Lost"));
}
/*
healthui->setState(1,HealthUI::state::failure);
healthui->setState(2,HealthUI::state::failure);
healthui->setState(4,HealthUI::state::failure);
@@ -719,7 +706,7 @@ void MainWindow::setCommunicationLostState(bool flag)
healthui->setState(25,HealthUI::state::failure);
healthui->setState(30,HealthUI::state::failure);
*/
}
else
{
@@ -972,7 +959,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
dlink->mavlinknode->vehicle.attitude.yaw * 57.3);
/*
if(MainIndex == 3)//飞行界面
{
//刷新时间1Hz
@@ -988,7 +975,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
showMessage(message);
}
*/
@@ -1017,7 +1004,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
舵机指令
自检 2004
*/
/*
//设置舵机显示
@@ -1097,6 +1084,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
//dlink->mavlinknode->vehicle.servo_output_raw.servo5_raw
uint16_t servoHealt = dlink->mavlinknode->vehicle.servo_output_raw.servo10_raw;
*/
/*
sbus = feedback (ra)
sbus = feedback (re)
@@ -1110,7 +1098,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
//舵机反馈是有符号16b/
//qDebug() << getBit(health,16);
/*
healthui->setState(11,getBit(health,16)?(getBit(servoHealt,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LA
healthui->setState(12,getBit(health,13)?(getBit(servoHealt,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RA
healthui->setState(13,getBit(health,17)?(getBit(servoHealt,4)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LE
@@ -1413,7 +1401,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
toolsui->diagram->setGPS2(7,gpsFix2);
*/
@@ -1424,7 +1412,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
void MainWindow::TotalDistance(double value)
{
/*
if(MainIndex == 2)//任务界面
{
QString message;
@@ -1436,6 +1424,6 @@ void MainWindow::TotalDistance(double value)
showMessage(message);
}
*/
}
-2
View File
@@ -101,8 +101,6 @@ protected:
Config *config = nullptr;
StatusUI *statusui = nullptr;
HealthUI *healthui = nullptr;
MenuBarUI *menuBarUI = nullptr;
CommandUI *commandUI = nullptr;
Cockpit *copk = nullptr;