Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9d5bed48
Commit
9d5bed48
authored
Oct 21, 2017
by
Don Gagne
Committed by
GitHub
Oct 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5767 from DonLakeFlyer/AudioOutput
AudioOuput class restructuring
parents
97c51871
f2c1e9b2
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
65 additions
and
43 deletions
+65
-43
qgroundcontrol.pro
qgroundcontrol.pro
+5
-3
AudioOutput.cc
src/Audio/AudioOutput.cc
+34
-7
AudioOutput.h
src/Audio/AudioOutput.h
+2
-2
AudioOutputTest.cc
src/Audio/AudioOutputTest.cc
+10
-10
AudioOutputTest.h
src/Audio/AudioOutputTest.h
+2
-2
QGCApplication.cc
src/QGCApplication.cc
+1
-1
QGCApplication.h
src/QGCApplication.h
+1
-1
QGCToolbox.cc
src/QGCToolbox.cc
+2
-2
QGCToolbox.h
src/QGCToolbox.h
+3
-3
Vehicle.cc
src/Vehicle/Vehicle.cc
+1
-1
UnitTestList.cc
src/qgcunittest/UnitTestList.cc
+2
-9
UAS.cc
src/uas/UAS.cc
+1
-1
MainWindow.cc
src/ui/MainWindow.cc
+1
-1
No files found.
qgroundcontrol.pro
View file @
9d5bed48
...
...
@@ -351,7 +351,7 @@ INCLUDEPATH += \
src
/
Settings
\
src
/
VehicleSetup
\
src
/
ViewWidgets
\
src
/
a
udio
\
src
/
A
udio
\
src
/
comm
\
src
/
input
\
src
/
lib
/
qmapcontrol
\
...
...
@@ -413,6 +413,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
HEADERS
+=
\
src
/
AnalyzeView
/
LogDownloadTest
.
h
\
src
/
Audio
/
AudioOutputTest
.
h
\
src
/
FactSystem
/
FactSystemTestBase
.
h
\
src
/
FactSystem
/
FactSystemTestGeneric
.
h
\
src
/
FactSystem
/
FactSystemTestPX4
.
h
\
...
...
@@ -448,6 +449,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
SOURCES
+=
\
src
/
AnalyzeView
/
LogDownloadTest
.
cc
\
src
/
Audio
/
AudioOutputTest
.
cc
\
src
/
FactSystem
/
FactSystemTestBase
.
cc
\
src
/
FactSystem
/
FactSystemTestGeneric
.
cc
\
src
/
FactSystem
/
FactSystemTestPX4
.
cc
\
...
...
@@ -489,6 +491,7 @@ HEADERS += \
src
/
AnalyzeView
/
ExifParser
.
h
\
src
/
AnalyzeView
/
ULogParser
.
h
\
src
/
AnalyzeView
/
PX4LogParser
.
h
\
src
/
Audio
/
AudioOutput
.
h
\
src
/
Camera
/
QGCCameraControl
.
h
\
src
/
Camera
/
QGCCameraIO
.
h
\
src
/
Camera
/
QGCCameraManager
.
h
\
...
...
@@ -497,7 +500,6 @@ HEADERS += \
src
/
FlightDisplay
/
VideoManager
.
h
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
h
\
src
/
FollowMe
/
FollowMe
.
h
\
src
/
GAudioOutput
.
h
\
src
/
Joystick
/
Joystick
.
h
\
src
/
Joystick
/
JoystickManager
.
h
\
src
/
JsonHelper
.
h
\
...
...
@@ -679,6 +681,7 @@ SOURCES += \
src
/
AnalyzeView
/
ExifParser
.
cc
\
src
/
AnalyzeView
/
ULogParser
.
cc
\
src
/
AnalyzeView
/
PX4LogParser
.
cc
\
src
/
Audio
/
AudioOutput
.
cc
\
src
/
Camera
/
QGCCameraControl
.
cc
\
src
/
Camera
/
QGCCameraIO
.
cc
\
src
/
Camera
/
QGCCameraManager
.
cc
\
...
...
@@ -686,7 +689,6 @@ SOURCES += \
src
/
FlightDisplay
/
VideoManager
.
cc
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
cc
\
src
/
FollowMe
/
FollowMe
.
cc
\
src
/
GAudioOutput
.
cc
\
src
/
Joystick
/
Joystick
.
cc
\
src
/
Joystick
/
JoystickManager
.
cc
\
src
/
JsonHelper
.
cc
\
...
...
src/
G
AudioOutput.cc
→
src/
Audio/
AudioOutput.cc
View file @
9d5bed48
...
...
@@ -11,19 +11,19 @@
#include <QDebug>
#include <QRegularExpression>
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#include "QGCApplication.h"
#include "QGC.h"
#include "SettingsManager.h"
GAudioOutput
::
G
AudioOutput
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
)
AudioOutput
::
AudioOutput
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
)
:
QGCTool
(
app
,
toolbox
)
{
_tts
=
new
QTextToSpeech
(
this
);
connect
(
_tts
,
&
QTextToSpeech
::
stateChanged
,
this
,
&
G
AudioOutput
::
_stateChanged
);
connect
(
_tts
,
&
QTextToSpeech
::
stateChanged
,
this
,
&
AudioOutput
::
_stateChanged
);
}
bool
G
AudioOutput
::
say
(
const
QString
&
inText
)
bool
AudioOutput
::
say
(
const
QString
&
inText
)
{
bool
muted
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
audioMuted
()
->
rawValue
().
toBool
();
muted
|=
qgcApp
()
->
runningUnitTests
();
...
...
@@ -44,7 +44,7 @@ bool GAudioOutput::say(const QString& inText)
return
true
;
}
void
G
AudioOutput
::
_stateChanged
(
QTextToSpeech
::
State
state
)
void
AudioOutput
::
_stateChanged
(
QTextToSpeech
::
State
state
)
{
if
(
state
==
QTextToSpeech
::
Ready
)
{
if
(
_texts
.
size
())
{
...
...
@@ -55,7 +55,7 @@ void GAudioOutput::_stateChanged(QTextToSpeech::State state)
}
}
bool
G
AudioOutput
::
getMillisecondString
(
const
QString
&
string
,
QString
&
match
,
int
&
number
)
{
bool
AudioOutput
::
getMillisecondString
(
const
QString
&
string
,
QString
&
match
,
int
&
number
)
{
static
QRegularExpression
re
(
"([0-9]+ms)"
);
QRegularExpressionMatchIterator
i
=
re
.
globalMatch
(
string
);
while
(
i
.
hasNext
())
{
...
...
@@ -69,7 +69,7 @@ bool GAudioOutput::getMillisecondString(const QString& string, QString& match, i
return
false
;
}
QString
G
AudioOutput
::
fixTextMessageForAudio
(
const
QString
&
string
)
{
QString
AudioOutput
::
fixTextMessageForAudio
(
const
QString
&
string
)
{
QString
match
;
QString
newNumber
;
QString
result
=
string
;
...
...
@@ -118,6 +118,33 @@ QString GAudioOutput::fixTextMessageForAudio(const QString& string) {
if
(
result
.
contains
(
" ADSB "
,
Qt
::
CaseInsensitive
))
{
result
.
replace
(
" ADSB "
,
" Hey Dee Ess Bee "
,
Qt
::
CaseInsensitive
);
}
// Convert negative numbers
QRegularExpression
re
(
QStringLiteral
(
"(-)[0-9]*
\\
.?[0-9]"
));
QRegularExpressionMatch
reMatch
=
re
.
match
(
result
);
while
(
reMatch
.
hasMatch
())
{
if
(
!
reMatch
.
captured
(
1
).
isNull
())
{
// There is a negative prefix
qDebug
()
<<
"negative"
<<
reMatch
.
captured
(
1
)
<<
reMatch
.
capturedStart
(
1
)
<<
reMatch
.
capturedEnd
(
1
);
result
.
replace
(
reMatch
.
capturedStart
(
1
),
reMatch
.
capturedEnd
(
1
)
-
reMatch
.
capturedStart
(
1
),
tr
(
" negative "
));
qDebug
()
<<
result
;
}
reMatch
=
re
.
match
(
result
);
}
// Convert meter postfix after real number
re
.
setPattern
(
QStringLiteral
(
"[0-9]*
\\
.?[0-9]
\\
s?(m)([^A-Za-z]|$)"
));
reMatch
=
re
.
match
(
result
);
while
(
reMatch
.
hasMatch
())
{
if
(
!
reMatch
.
captured
(
1
).
isNull
())
{
// There is a meter postfix
qDebug
()
<<
"meters"
<<
reMatch
.
captured
(
1
)
<<
reMatch
.
capturedStart
(
1
)
<<
reMatch
.
capturedEnd
(
1
);
result
.
replace
(
reMatch
.
capturedStart
(
1
),
reMatch
.
capturedEnd
(
1
)
-
reMatch
.
capturedStart
(
1
),
tr
(
" meters"
));
qDebug
()
<<
result
;
}
reMatch
=
re
.
match
(
result
);
}
int
number
;
if
(
getMillisecondString
(
string
,
match
,
number
)
&&
number
>
1000
)
{
if
(
number
<
60000
)
{
...
...
src/
G
AudioOutput.h
→
src/
Audio/
AudioOutput.h
View file @
9d5bed48
...
...
@@ -19,11 +19,11 @@
class
QGCApplication
;
class
G
AudioOutput
:
public
QGCTool
class
AudioOutput
:
public
QGCTool
{
Q_OBJECT
public:
G
AudioOutput
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
);
AudioOutput
(
QGCApplication
*
app
,
QGCToolbox
*
toolbox
);
static
bool
getMillisecondString
(
const
QString
&
string
,
QString
&
match
,
int
&
number
);
static
QString
fixTextMessageForAudio
(
const
QString
&
string
);
...
...
src/
audio/QGCAudioWorker
Test.cc
→
src/
Audio/AudioOutput
Test.cc
View file @
9d5bed48
...
...
@@ -7,26 +7,26 @@
*
****************************************************************************/
#include "
QGCAudioWorker
Test.h"
#include "
QGCAudioWorker
.h"
#include "
AudioOutput
Test.h"
#include "
AudioOutput
.h"
QGCAudioWorkerTest
::
QGCAudioWorker
Test
(
void
)
AudioOutputTest
::
AudioOutput
Test
(
void
)
{
}
void
QGCAudioWorker
Test
::
_testSpokenReplacements
(
void
)
void
AudioOutput
Test
::
_testSpokenReplacements
(
void
)
{
QString
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"-10.5m, -10.5m. -10.5 m"
));
QString
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"-10.5m, -10.5m. -10.5 m"
));
QCOMPARE
(
result
,
QStringLiteral
(
" negative 10.5 meters, negative 10.5 meters. negative 10.5 meters"
));
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"-10m -10 m"
));
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"-10m -10 m"
));
QCOMPARE
(
result
,
QStringLiteral
(
" negative 10 meters negative 10 meters"
));
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"foo -10m -10 m bar"
));
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"foo -10m -10 m bar"
));
QCOMPARE
(
result
,
QStringLiteral
(
"foo negative 10 meters negative 10 meters bar"
));
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"-foom"
));
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"-foom"
));
QCOMPARE
(
result
,
QStringLiteral
(
"-foom"
));
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"10 moo"
));
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"10 moo"
));
QCOMPARE
(
result
,
QStringLiteral
(
"10 moo"
));
result
=
QGCAudioWorker
::
fixTextMessageForAudio
(
QStringLiteral
(
"10moo"
));
result
=
AudioOutput
::
fixTextMessageForAudio
(
QStringLiteral
(
"10moo"
));
QCOMPARE
(
result
,
QStringLiteral
(
"10moo"
));
}
src/
audio/QGCAudioWorker
Test.h
→
src/
Audio/AudioOutput
Test.h
View file @
9d5bed48
...
...
@@ -11,12 +11,12 @@
#include "UnitTest.h"
class
QGCAudioWorker
Test
:
public
UnitTest
class
AudioOutput
Test
:
public
UnitTest
{
Q_OBJECT
public:
QGCAudioWorker
Test
(
void
);
AudioOutput
Test
(
void
);
private
slots
:
void
_testSpokenReplacements
(
void
);
...
...
src/QGCApplication.cc
View file @
9d5bed48
...
...
@@ -35,7 +35,7 @@
#include "QGC.h"
#include "QGCApplication.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#include "CmdLineOptParser.h"
#include "UDPLink.h"
#include "LinkManager.h"
...
...
src/QGCApplication.h
View file @
9d5bed48
...
...
@@ -30,7 +30,7 @@
#include "FirmwarePluginManager.h"
#include "MultiVehicleManager.h"
#include "JoystickManager.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#include "UASMessageHandler.h"
#include "FactSystem.h"
...
...
src/QGCToolbox.cc
View file @
9d5bed48
...
...
@@ -10,7 +10,7 @@
#include "FactSystem.h"
#include "FirmwarePluginManager.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#ifndef __mobile__
#include "GPSManager.h"
#endif
...
...
@@ -62,7 +62,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
//-- Scan and load plugins
_scanAndLoadPlugins
(
app
);
_audioOutput
=
new
GAudioOutput
(
app
,
this
);
_audioOutput
=
new
AudioOutput
(
app
,
this
);
_factSystem
=
new
FactSystem
(
app
,
this
);
_firmwarePluginManager
=
new
FirmwarePluginManager
(
app
,
this
);
#ifndef __mobile__
...
...
src/QGCToolbox.h
View file @
9d5bed48
...
...
@@ -15,7 +15,7 @@
class
FactSystem
;
class
FirmwarePluginManager
;
class
G
AudioOutput
;
class
AudioOutput
;
class
GPSManager
;
class
JoystickManager
;
class
FollowMe
;
...
...
@@ -41,7 +41,7 @@ public:
QGCToolbox
(
QGCApplication
*
app
);
FirmwarePluginManager
*
firmwarePluginManager
(
void
)
{
return
_firmwarePluginManager
;
}
GAudioOutput
*
audioOutput
(
void
)
{
return
_audioOutput
;
}
AudioOutput
*
audioOutput
(
void
)
{
return
_audioOutput
;
}
JoystickManager
*
joystickManager
(
void
)
{
return
_joystickManager
;
}
LinkManager
*
linkManager
(
void
)
{
return
_linkManager
;
}
MAVLinkProtocol
*
mavlinkProtocol
(
void
)
{
return
_mavlinkProtocol
;
}
...
...
@@ -66,7 +66,7 @@ private:
void
_scanAndLoadPlugins
(
QGCApplication
*
app
);
GAudioOutput
*
_audioOutput
;
AudioOutput
*
_audioOutput
;
FactSystem
*
_factSystem
;
FirmwarePluginManager
*
_firmwarePluginManager
;
#ifndef __mobile__
...
...
src/Vehicle/Vehicle.cc
View file @
9d5bed48
...
...
@@ -24,7 +24,7 @@
#include "ParameterManager.h"
#include "QGCApplication.h"
#include "QGCImageProvider.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#include "FollowMe.h"
#include "MissionCommandTree.h"
#include "QGroundControlQmlGlobal.h"
...
...
src/qgcunittest/UnitTestList.cc
View file @
9d5bed48
...
...
@@ -38,11 +38,7 @@
#include "PlanMasterControllerTest.h"
#include "MissionSettingsTest.h"
#include "QGCMapPolygonTest.h"
#if 0
// Temporarily disabled until I move some stuff from Stable to master
#include "QGCAudioWorkerTest.h"
#endif
#include "AudioOutputTest.h"
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
...
...
@@ -68,10 +64,7 @@ UT_REGISTER_TEST(SpeedSectionTest)
UT_REGISTER_TEST
(
PlanMasterControllerTest
)
UT_REGISTER_TEST
(
MissionSettingsTest
)
UT_REGISTER_TEST
(
QGCMapPolygonTest
)
#if 0
// Temporarily disabled until I move some stuff from Stable to master
UT_REGISTER_TEST(QGCAudioWorkerTest)
#endif
UT_REGISTER_TEST
(
AudioOutputTest
)
// List of unit test which are currently disabled.
// If disabling a new test, include reason in comment.
...
...
src/uas/UAS.cc
View file @
9d5bed48
...
...
@@ -26,7 +26,7 @@
#include "UAS.h"
#include "LinkInterface.h"
#include "QGC.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#include "MAVLinkProtocol.h"
#include "QGCMAVLink.h"
#include "LinkManager.h"
...
...
src/ui/MainWindow.cc
View file @
9d5bed48
...
...
@@ -30,7 +30,7 @@
#include "QGC.h"
#include "MAVLinkProtocol.h"
#include "MainWindow.h"
#include "
G
AudioOutput.h"
#include "AudioOutput.h"
#ifndef __mobile__
#include "QGCMAVLinkLogPlayer.h"
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment