b
This commit is contained in:
@@ -205,10 +205,20 @@ void CommandBox::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
||||
|
||||
if(string.size() > 0)
|
||||
{
|
||||
QTextToSpeech *tts = new QTextToSpeech();
|
||||
tts->say(string);
|
||||
tts->deleteLater();
|
||||
emit showMessage(string);
|
||||
QVariant flag;
|
||||
Config *cfg = new Config();
|
||||
|
||||
cfg->getTTS(&flag);
|
||||
|
||||
if(flag.toBool())
|
||||
{
|
||||
QTextToSpeech *tts = new QTextToSpeech();
|
||||
tts->say(string);
|
||||
tts->deleteLater();
|
||||
|
||||
}
|
||||
emit showMessage(string);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "CommandEditor.h"
|
||||
#include "QtTextToSpeech/QtTextToSpeech"
|
||||
#include "mavlink.h"
|
||||
|
||||
#include "Config/Config.h"
|
||||
#include "ToolsUI/ToolsWidget.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -656,9 +656,18 @@ void CommandUI::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
||||
{
|
||||
if(string.size() > 0)
|
||||
{
|
||||
QTextToSpeech *tts = new QTextToSpeech();
|
||||
tts->say(string);
|
||||
tts->deleteLater();
|
||||
QVariant flag;
|
||||
Config *cfg = new Config();
|
||||
|
||||
cfg->getTTS(&flag);
|
||||
|
||||
if(flag.toBool())
|
||||
{
|
||||
QTextToSpeech *tts = new QTextToSpeech();
|
||||
tts->say(string);
|
||||
tts->deleteLater();
|
||||
|
||||
}
|
||||
|
||||
emit showMessage(string);
|
||||
}
|
||||
|
||||
@@ -257,3 +257,19 @@ void Config::setBeep(QVariant value)
|
||||
|
||||
setJsonObject("Warnning",obj);
|
||||
}
|
||||
|
||||
void Config::getTTS(QVariant *value)
|
||||
{
|
||||
QJsonObject obj = getJsonObject("Sound");
|
||||
|
||||
*value = obj.value("tts").toBool();
|
||||
}
|
||||
|
||||
void Config::setTTS(QVariant value)
|
||||
{
|
||||
QJsonObject obj;
|
||||
|
||||
obj["tts"] = value.toBool();
|
||||
|
||||
setJsonObject("Sound",obj);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,9 @@ public slots:
|
||||
void getBeep(QVariant *value);
|
||||
void setBeep(QVariant value);
|
||||
|
||||
void getTTS(QVariant *value);
|
||||
void setTTS(QVariant value);
|
||||
|
||||
private slots:
|
||||
|
||||
void loadJson(const QString& jsonFilename);
|
||||
|
||||
@@ -17,6 +17,9 @@ GlobalSetting::GlobalSetting(QWidget *parent) :
|
||||
ui->comboBox_Beep->addItem(tr("开"),true);
|
||||
ui->comboBox_Beep->addItem(tr("关"),false);
|
||||
|
||||
ui->comboBox_TTS->addItem(tr("开"),true);
|
||||
ui->comboBox_TTS->addItem(tr("关"),false);
|
||||
|
||||
|
||||
Config *cfg = new Config();
|
||||
|
||||
@@ -29,6 +32,9 @@ GlobalSetting::GlobalSetting(QWidget *parent) :
|
||||
ui->comboBox_Beep->setCurrentIndex(ui->comboBox_Beep->findData(beep.toBool()));
|
||||
|
||||
|
||||
QVariant tts;
|
||||
cfg->getTTS(&tts);
|
||||
ui->comboBox_TTS->setCurrentIndex(ui->comboBox_TTS->findData(beep.toBool()));
|
||||
|
||||
emit setGCSID(id.toInt());//设置全局ID
|
||||
|
||||
@@ -222,5 +228,24 @@ void GlobalSetting::on_pushButton_Beep_clicked()
|
||||
delete cfg;
|
||||
|
||||
|
||||
emit showMessage((state.toBool())?(tr("声音开启")):(tr("声音关闭")));
|
||||
emit showMessage((state.toBool())?(tr("心跳声音开启")):(tr("心跳声音关闭")));
|
||||
}
|
||||
|
||||
void GlobalSetting::on_pushButton_TTS_clicked()
|
||||
{
|
||||
QVariant state;
|
||||
|
||||
state = ui->comboBox_TTS->currentData();
|
||||
|
||||
emit setTTS(state.toBool());
|
||||
|
||||
Config *cfg = new Config();
|
||||
|
||||
cfg->setTTS(state);
|
||||
|
||||
cfg->deleteLater();
|
||||
delete cfg;
|
||||
|
||||
|
||||
emit showMessage((state.toBool())?(tr("语音提示开启")):(tr("语音提示关闭")));
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ private slots:
|
||||
|
||||
void on_pushButton_Beep_clicked();
|
||||
|
||||
void on_pushButton_TTS_clicked();
|
||||
|
||||
signals:
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
@@ -50,6 +52,8 @@ signals:
|
||||
|
||||
void setBeep(QVariant beep);
|
||||
|
||||
void setTTS(QVariant flag);
|
||||
|
||||
private:
|
||||
Ui::GlobalSetting *ui;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>533</width>
|
||||
<height>454</height>
|
||||
<width>738</width>
|
||||
<height>472</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -139,10 +139,10 @@
|
||||
<string>ID设置</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>设置地面站ID号</string>
|
||||
<string>心跳声</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -156,6 +156,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Beep"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>地面站ID号</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_Beep">
|
||||
<property name="text">
|
||||
@@ -163,13 +173,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Beep"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_TTS">
|
||||
<property name="text">
|
||||
<string>心跳声开关</string>
|
||||
<string>Set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_TTS"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>提示声</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -219,8 +236,27 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QQuickWidget" name="quickWidget">
|
||||
<property name="resizeMode">
|
||||
<enum>QQuickWidget::SizeRootObjectToView</enum>
|
||||
</property>
|
||||
<property name="source">
|
||||
<url>
|
||||
<string>qrc:/App/qml/base.qml</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QQuickWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtQuickWidgets/QQuickWidget</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -274,6 +274,7 @@ void ParameterInspector::clearview(void)
|
||||
for (vehicle_ite=vehicles.begin(); vehicle_ite!=vehicles.end();++vehicle_ite)
|
||||
{
|
||||
|
||||
|
||||
vehicle_ite.value().clear();
|
||||
//delete vehicle_ite.value();
|
||||
//vehicle_ite.value() = NULL;
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ParameterInspector</class>
|
||||
<widget class="QWidget" name="ParameterInspector">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>768</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="CancelpushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton_id">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Save">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="WriteButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>write</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="pushButton_Load">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_system">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ReadButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>read</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerMinimumSectionSize">
|
||||
<number>50</number>
|
||||
</attribute>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<attribute name="headerHighlightSections">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textDirection">
|
||||
<enum>QProgressBar::BottomToTop</enum>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+39
-5
@@ -541,12 +541,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(setting->index0->globalsetting,&GlobalSetting::setBeep,
|
||||
this,&MainWindow::setBeep,Qt::DirectConnection);
|
||||
|
||||
connect(setting->index0->globalsetting,&GlobalSetting::setTTS,
|
||||
this,&MainWindow::setTTS,Qt::DirectConnection);
|
||||
|
||||
//设置地面站ID
|
||||
setting->index0->globalsetting->getGCSID();
|
||||
setting->index0->globalsetting->getServo();
|
||||
|
||||
setting->index0->globalsetting->getHeartBeat();
|
||||
|
||||
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -583,10 +587,15 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::setBeep(QVariant state)
|
||||
{
|
||||
isEnableBeep = state.toBool();
|
||||
qDebug() << state;
|
||||
}
|
||||
|
||||
void MainWindow::setTTS(QVariant state)
|
||||
{
|
||||
isEnableTTS = state.toBool();
|
||||
|
||||
qDebug() << isEnableTTS;
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
@@ -949,7 +958,14 @@ void MainWindow::setCommunicationLostState(bool flag)
|
||||
if(last != flag)
|
||||
{
|
||||
showMessage(tr("Communication Lost"),3000);
|
||||
tts->say(tr("Communication Lost"));
|
||||
|
||||
if(isEnableTTS)
|
||||
{
|
||||
if(tts)
|
||||
{
|
||||
tts->say(tr("Communication Lost"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
healthui->setFailure();
|
||||
@@ -960,7 +976,13 @@ void MainWindow::setCommunicationLostState(bool flag)
|
||||
if(last != flag)
|
||||
{
|
||||
showMessage(tr("Communication Regain"),3000);
|
||||
tts->say(tr("Communication Regain"));
|
||||
if(isEnableTTS)
|
||||
{
|
||||
if(tts)
|
||||
{
|
||||
tts->say(tr("Communication Regain"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1306,13 +1328,25 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
//这里会一直生成一个,导致无法释放
|
||||
if(isStateChanged == true)
|
||||
{
|
||||
tts->say(arm_str);
|
||||
if(isEnableTTS)
|
||||
{
|
||||
if(tts)
|
||||
{
|
||||
tts->say(arm_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isCustomChanged == true)
|
||||
{
|
||||
mode_str.append(tr("flight mode"));
|
||||
tts->say(mode_str);
|
||||
if(isEnableTTS)
|
||||
{
|
||||
if(tts)
|
||||
{
|
||||
tts->say(mode_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//经纬度大于正常值,将舍弃
|
||||
|
||||
@@ -77,6 +77,8 @@ public slots:
|
||||
void setBeep(QVariant state);
|
||||
void beep(int sysid);
|
||||
|
||||
void setTTS(QVariant state);
|
||||
|
||||
|
||||
void setServoOffset(QVariant la,QVariant ra,
|
||||
QVariant le,QVariant re,
|
||||
@@ -157,6 +159,7 @@ protected:
|
||||
bool isEngineStartUp = false;
|
||||
|
||||
bool isEnableBeep = true;
|
||||
bool isEnableTTS = true;
|
||||
|
||||
float m_la = 0;
|
||||
float m_ra = 0;
|
||||
|
||||
Reference in New Issue
Block a user