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
083dcf0a
Unverified
Commit
083dcf0a
authored
Jun 13, 2019
by
Gus Grubba
Committed by
GitHub
Jun 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7518 from mavlink/audioLocalization
Handle text to speech locale
parents
eee967c5
a9ff4d8d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
33 deletions
+42
-33
AudioOutput.cc
src/Audio/AudioOutput.cc
+5
-0
QGCApplication.cc
src/QGCApplication.cc
+30
-30
QGCApplication.h
src/QGCApplication.h
+7
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+0
-1
UAS.cc
src/uas/UAS.cc
+0
-1
No files found.
src/Audio/AudioOutput.cc
View file @
083dcf0a
...
...
@@ -20,6 +20,11 @@ AudioOutput::AudioOutput(QGCApplication* app, QGCToolbox* toolbox)
:
QGCTool
(
app
,
toolbox
)
,
_tts
(
new
QTextToSpeech
(
this
))
{
//-- Force TTS engine to English as all incoming messages from the autopilot
// are in English and not localized.
#ifdef Q_OS_LINUX
_tts
->
setLocale
(
QLocale
(
"en_US"
));
#endif
connect
(
_tts
,
&
QTextToSpeech
::
stateChanged
,
this
,
&
AudioOutput
::
_stateChanged
);
}
...
...
src/QGCApplication.cc
View file @
083dcf0a
...
...
@@ -42,7 +42,6 @@
#include "QGC.h"
#include "QGCApplication.h"
#include "AudioOutput.h"
#include "CmdLineOptParser.h"
#include "UDPLink.h"
#include "LinkManager.h"
...
...
@@ -351,74 +350,74 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
void
QGCApplication
::
setLanguage
()
{
QLocale
locale
=
QLocale
::
system
();
qDebug
()
<<
"System reported locale:"
<<
locale
<<
locale
.
name
();
_
locale
=
QLocale
::
system
();
qDebug
()
<<
"System reported locale:"
<<
_locale
<<
_
locale
.
name
();
int
langID
=
toolbox
()
->
settingsManager
()
->
appSettings
()
->
language
()
->
rawValue
().
toInt
();
//-- See App.SettinsGroup.json for index
if
(
langID
)
{
switch
(
langID
)
{
case
1
:
locale
=
QLocale
(
QLocale
::
Bulgarian
);
_
locale
=
QLocale
(
QLocale
::
Bulgarian
);
break
;
case
2
:
locale
=
QLocale
(
QLocale
::
Chinese
);
_
locale
=
QLocale
(
QLocale
::
Chinese
);
break
;
case
3
:
locale
=
QLocale
(
QLocale
::
Dutch
);
_
locale
=
QLocale
(
QLocale
::
Dutch
);
break
;
case
4
:
locale
=
QLocale
(
QLocale
::
English
);
_
locale
=
QLocale
(
QLocale
::
English
);
break
;
case
5
:
locale
=
QLocale
(
QLocale
::
Finnish
);
_
locale
=
QLocale
(
QLocale
::
Finnish
);
break
;
case
6
:
locale
=
QLocale
(
QLocale
::
French
);
_
locale
=
QLocale
(
QLocale
::
French
);
break
;
case
7
:
locale
=
QLocale
(
QLocale
::
German
);
_
locale
=
QLocale
(
QLocale
::
German
);
break
;
case
8
:
locale
=
QLocale
(
QLocale
::
Greek
);
_
locale
=
QLocale
(
QLocale
::
Greek
);
break
;
case
9
:
locale
=
QLocale
(
QLocale
::
Hebrew
);
_
locale
=
QLocale
(
QLocale
::
Hebrew
);
break
;
case
10
:
locale
=
QLocale
(
QLocale
::
Italian
);
_
locale
=
QLocale
(
QLocale
::
Italian
);
break
;
case
11
:
locale
=
QLocale
(
QLocale
::
Japanese
);
_
locale
=
QLocale
(
QLocale
::
Japanese
);
break
;
case
12
:
locale
=
QLocale
(
QLocale
::
Korean
);
_
locale
=
QLocale
(
QLocale
::
Korean
);
break
;
case
13
:
locale
=
QLocale
(
QLocale
::
Norwegian
);
_
locale
=
QLocale
(
QLocale
::
Norwegian
);
break
;
case
14
:
locale
=
QLocale
(
QLocale
::
Polish
);
_
locale
=
QLocale
(
QLocale
::
Polish
);
break
;
case
15
:
locale
=
QLocale
(
QLocale
::
Portuguese
);
_
locale
=
QLocale
(
QLocale
::
Portuguese
);
break
;
case
16
:
locale
=
QLocale
(
QLocale
::
Russian
);
_
locale
=
QLocale
(
QLocale
::
Russian
);
break
;
case
17
:
locale
=
QLocale
(
QLocale
::
Spanish
);
_
locale
=
QLocale
(
QLocale
::
Spanish
);
break
;
case
18
:
locale
=
QLocale
(
QLocale
::
Swedish
);
_
locale
=
QLocale
(
QLocale
::
Swedish
);
break
;
case
19
:
locale
=
QLocale
(
QLocale
::
Turkish
);
_
locale
=
QLocale
(
QLocale
::
Turkish
);
break
;
}
}
//-- We have specific fonts for Korean
if
(
locale
==
QLocale
::
Korean
)
{
qDebug
()
<<
"Loading Korean fonts"
<<
locale
.
name
();
if
(
_
locale
==
QLocale
::
Korean
)
{
qDebug
()
<<
"Loading Korean fonts"
<<
_
locale
.
name
();
if
(
QFontDatabase
::
addApplicationFont
(
":/fonts/NanumGothic-Regular"
)
<
0
)
{
qWarning
()
<<
"Could not load /fonts/NanumGothic-Regular font"
;
}
...
...
@@ -426,22 +425,23 @@ void QGCApplication::setLanguage()
qWarning
()
<<
"Could not load /fonts/NanumGothic-Bold font"
;
}
}
qDebug
()
<<
"Loading localization for"
<<
locale
.
name
();
qDebug
()
<<
"Loading localization for"
<<
_
locale
.
name
();
_app
->
removeTranslator
(
&
_QGCTranslator
);
_app
->
removeTranslator
(
&
_QGCTranslatorQt
);
if
(
_QGCTranslatorQt
.
load
(
"qt_"
+
locale
.
name
(),
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
)))
{
if
(
_QGCTranslatorQt
.
load
(
"qt_"
+
_
locale
.
name
(),
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
)))
{
_app
->
installTranslator
(
&
_QGCTranslatorQt
);
}
else
{
qDebug
()
<<
"Error loading Qt localization for"
<<
locale
.
name
();
qDebug
()
<<
"Error loading Qt localization for"
<<
_
locale
.
name
();
}
if
(
_QGCTranslator
.
load
(
locale
,
QLatin1String
(
"qgc_"
),
""
,
":/i18n"
))
{
QLocale
::
setDefault
(
locale
);
if
(
_QGCTranslator
.
load
(
_
locale
,
QLatin1String
(
"qgc_"
),
""
,
":/i18n"
))
{
QLocale
::
setDefault
(
_
locale
);
_app
->
installTranslator
(
&
_QGCTranslator
);
}
else
{
qDebug
()
<<
"Error loading application localization for"
<<
locale
.
name
();
qDebug
()
<<
"Error loading application localization for"
<<
_
locale
.
name
();
}
if
(
_qmlAppEngine
)
_qmlAppEngine
->
retranslate
();
emit
languageChanged
(
_locale
);
}
void
QGCApplication
::
_shutdown
()
...
...
src/QGCApplication.h
View file @
083dcf0a
...
...
@@ -118,10 +118,15 @@ public slots:
/// Check that the telemetry save path is set correctly
void
checkTelemetrySavePathOnMainThread
();
/// Get current language
const
QLocale
getCurrentLanguage
()
{
return
_locale
;
}
signals:
/// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot
/// on the MAVLinkProtocol thread;
void
checkForLostLogFiles
();
void
checkForLostLogFiles
();
void
languageChanged
(
const
QLocale
locale
);
public:
// Although public, these methods are internal and should only be called by UnitTest code
...
...
@@ -184,6 +189,7 @@ private:
bool
_bluetoothAvailable
=
false
;
QTranslator
_QGCTranslator
;
QTranslator
_QGCTranslatorQt
;
QLocale
_locale
;
static
const
char
*
_settingsVersionKey
;
///< Settings key which hold settings version
static
const
char
*
_deleteAllSettingsKey
;
///< If this settings key is set on boot, all settings will be deleted
...
...
src/Vehicle/Vehicle.cc
View file @
083dcf0a
...
...
@@ -28,7 +28,6 @@
#include "ParameterManager.h"
#include "QGCApplication.h"
#include "QGCImageProvider.h"
#include "AudioOutput.h"
#include "FollowMe.h"
#include "MissionCommandTree.h"
#include "QGroundControlQmlGlobal.h"
...
...
src/uas/UAS.cc
View file @
083dcf0a
...
...
@@ -26,7 +26,6 @@
#include "UAS.h"
#include "LinkInterface.h"
#include "QGC.h"
#include "AudioOutput.h"
#include "MAVLinkProtocol.h"
#include "QGCMAVLink.h"
#include "LinkManager.h"
...
...
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