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
ed55e5da
Commit
ed55e5da
authored
Nov 12, 2015
by
Gus Grubba
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2199 from dogmaphobic/iosWork
Adding TTS to iOS
parents
f8bb6c6d
8226db0f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
311 additions
and
218 deletions
+311
-218
QGCApplication.pro
QGCApplication.pro
+5
-3
QGCCommon.pri
QGCCommon.pri
+2
-0
QGCExternalLibs.pri
QGCExternalLibs.pri
+1
-1
QGCApplication.cc
src/QGCApplication.cc
+1
-3
QGCMessageBox.h
src/QGCMessageBox.h
+1
-1
ScreenToolsController.cc
src/QmlControls/ScreenToolsController.cc
+10
-7
SubMenuButton.qml
src/QmlControls/SubMenuButton.qml
+1
-1
OpenPilotMaps.cc
src/QtLocationPlugin/OpenPilotMaps.cc
+1
-1
qgeotilefetcherqgc.cpp
src/QtLocationPlugin/qgeotilefetcherqgc.cpp
+1
-1
VideoStreaming.cc
src/VideoStreaming/VideoStreaming.cc
+1
-3
ViewWidget.qml
src/ViewWidgets/ViewWidget.qml
+52
-52
QGCAudioWorker.cpp
src/audio/QGCAudioWorker.cpp
+8
-2
QGCAudioWorker_iOS.mm
src/audio/QGCAudioWorker_iOS.mm
+84
-0
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+139
-139
MainWindow.cc
src/ui/MainWindow.cc
+2
-2
MainWindow.qml
src/ui/MainWindow.qml
+1
-1
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+1
-1
No files found.
QGCApplication.pro
View file @
ed55e5da
...
...
@@ -90,6 +90,8 @@ iOSBuild {
QMAKE_INFO_PLIST
=
$$
{
BASEDIR
}
/
ios
/
iOS
-
Info
.
plist
ICON
=
$$
{
BASEDIR
}
/
resources
/
icons
/
macx
.
icns
OTHER_FILES
+=
$$
{
BASEDIR
}
/
iOS
-
Info
.
plist
LIBS
+=
-
framework
AVFoundation
OBJECTIVE_SOURCES
+=
src
/
audio
/
QGCAudioWorker_iOS
.
mm
}
LinuxBuild
{
...
...
QGCCommon.pri
View file @
ed55e5da
...
...
@@ -49,6 +49,7 @@ linux {
macx-clang | macx-llvm {
message("Mac build")
CONFIG += MacBuild
DEFINES += __macos__
QMAKE_CXXFLAGS += -fvisibility=hidden
} else {
error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
...
...
@@ -60,6 +61,7 @@ linux {
message("iOS build")
CONFIG += iOSBuild MobileBuild app_bundle
DEFINES += __ios__
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
warning("iOS build is experimental and not yet fully functional")
} else {
error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
...
...
QGCExternalLibs.pri
View file @
ed55e5da
...
...
@@ -260,7 +260,7 @@ contains (DEFINES, DISABLE_SPEECH) {
}
}
# Mac support is built into OS 10.6+.
else:MacBuild {
else:MacBuild
|iOSBuild
{
message("Including support for speech output")
DEFINES += QGC_SPEECH_ENABLED
}
...
...
src/QGCApplication.cc
View file @
ed55e5da
...
...
@@ -140,8 +140,7 @@ static QObject* qgroundcontrolQmlGlobalSingletonFactory(QQmlEngine*, QJSEngine*)
}
#if defined(QGC_GST_STREAMING)
#ifdef Q_OS_MAC
#ifndef __ios__
#if defined(__macos__)
#ifdef QGC_INSTALL_RELEASE
static
void
qgcputenv
(
const
QString
&
key
,
const
QString
&
root
,
const
QString
&
path
)
{
...
...
@@ -151,7 +150,6 @@ static void qgcputenv(const QString& key, const QString& root, const QString& pa
#endif
#endif
#endif
#endif
/**
* @brief Constructor for the main application.
...
...
src/QGCMessageBox.h
View file @
ed55e5da
...
...
@@ -116,7 +116,7 @@ private:
#endif
#endif
{
#ifdef
Q_OS_MAC
#ifdef
__macos__
QString
emptyTitle
;
QMessageBox
box
(
icon
,
emptyTitle
,
title
,
buttons
,
parent
);
box
.
setDefaultButton
(
defaultButton
);
...
...
src/QmlControls/ScreenToolsController.cc
View file @
ed55e5da
...
...
@@ -29,11 +29,14 @@
#ifdef Q_OS_WIN
const
double
ScreenToolsController
::
_defaultFontPixelSizeRatio
=
1.0
;
#elif __
mobile
__
#elif __
android
__
const
double
ScreenToolsController
::
_defaultFontPixelSizeRatio
=
1.0
;
#elif __ios__
const
double
ScreenToolsController
::
_defaultFontPixelSizeRatio
=
0.8
;
#else
const
double
ScreenToolsController
::
_defaultFontPixelSizeRatio
=
0.8
;
#endif
const
double
ScreenToolsController
::
_smallFontPixelSizeRatio
=
0.75
;
const
double
ScreenToolsController
::
_mediumFontPixelSizeRatio
=
1.22
;
const
double
ScreenToolsController
::
_largeFontPixelSizeRatio
=
1.66
;
...
...
src/QmlControls/SubMenuButton.qml
View file @
ed55e5da
...
...
@@ -39,7 +39,7 @@ Button {
verticalAlignment
:
TextEdit
.
AlignVCenter
horizontalAlignment
:
TextEdit
.
AlignHCenter
color
:
showHighlight
?
qgcPal
.
buttonHighlightText
:
qgcPal
.
buttonText
font.pixelSize
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelSize
*
0.
6
5
:
ScreenTools
.
defaultFontPixelSize
font.pixelSize
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelSize
*
0.
7
5
:
ScreenTools
.
defaultFontPixelSize
text
:
control
.
text
Rectangle
{
...
...
src/QtLocationPlugin/OpenPilotMaps.cc
View file @
ed55e5da
...
...
@@ -196,7 +196,7 @@ void UrlFactory::_tryCorrectGoogleVersions()
_network
->
setProxy
(
tProxy
);
QString
url
=
"http://maps.google.com/maps?output=classic"
;
qheader
.
setUrl
(
QUrl
(
url
));
#if defined Q_OS_MAC
X
#if defined Q_OS_MAC
QByteArray
userAgent
=
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
;
#elif defined Q_OS_WIN32
QByteArray
userAgent
=
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"
;
...
...
src/QtLocationPlugin/qgeotilefetcherqgc.cpp
View file @
ed55e5da
...
...
@@ -55,7 +55,7 @@
QGeoTileFetcherQGC
::
QGeoTileFetcherQGC
(
QGeoTiledMappingManagerEngine
*
parent
)
:
QGeoTileFetcher
(
parent
)
,
m_networkManager
(
new
QNetworkAccessManager
(
this
))
#if defined Q_OS_MAC
X
#if defined Q_OS_MAC
,
m_userAgent
(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
)
#elif defined Q_OS_WIN32
,
m_userAgent
(
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"
)
...
...
src/VideoStreaming/VideoStreaming.cc
View file @
ed55e5da
...
...
@@ -75,8 +75,7 @@ void initializeVideoStreaming(int &argc, char* argv[])
GST_PLUGIN_STATIC_REGISTER
(
x264
);
#endif
#ifdef Q_OS_MAC
#ifndef __ios__
#ifdef __macos__
#ifdef QGC_INSTALL_RELEASE
QString
currentDir
=
QCoreApplication
::
applicationDirPath
();
qgcputenv
(
"GST_PLUGIN_SCANNER"
,
currentDir
,
"/gst-plugin-scanner"
);
...
...
@@ -92,7 +91,6 @@ void initializeVideoStreaming(int &argc, char* argv[])
// }
#endif
#endif
#endif
#else
Q_UNUSED
(
argc
);
...
...
src/ViewWidgets/ViewWidget.qml
View file @
ed55e5da
import
QtQuick
2.
2
import
QtQuick
2.
5
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
...
...
src/audio/QGCAudioWorker.cpp
View file @
ed55e5da
...
...
@@ -8,7 +8,7 @@
#include "QGCAudioWorker.h"
#include "GAudioOutput.h"
#if
defined Q_OS_MAC
&& defined QGC_SPEECH_ENABLED
#if
(defined __macos__)
&& defined QGC_SPEECH_ENABLED
#include <ApplicationServices/ApplicationServices.h>
static
SpeechChannel
sc
;
...
...
@@ -53,6 +53,10 @@ MacSpeech macSpeech;
#endif
#if (defined __ios__) && defined QGC_SPEECH_ENABLED
extern
void
iOSSpeak
(
QString
msg
);
#endif
// Speech synthesis is only supported with MSVC compiler
#if defined _MSC_VER && defined QGC_SPEECH_ENABLED
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
...
...
@@ -168,8 +172,10 @@ void QGCAudioWorker::say(QString inText, int severity)
unsigned
int
espeak_size
=
strlen
(
text
.
toStdString
().
c_str
())
+
1
;
espeak_Synth
(
text
.
toStdString
().
c_str
(),
espeak_size
,
0
,
POS_CHARACTER
,
0
,
espeakCHARS_AUTO
,
NULL
,
NULL
);
#elif
defined Q_OS_MAC
&& defined QGC_SPEECH_ENABLED
#elif
(defined __macos__)
&& defined QGC_SPEECH_ENABLED
macSpeech
.
say
(
text
.
toStdString
().
c_str
());
#elif (defined __ios__) && defined QGC_SPEECH_ENABLED
iOSSpeak
(
text
);
#else
// Make sure there isn't an unused variable warning when speech output is disabled
Q_UNUSED
(
inText
);
...
...
src/audio/QGCAudioWorker_iOS.mm
0 → 100644
View file @
ed55e5da
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief TTS for iOS
*
* @author Gus Grubba <mavlink@grubba.com>
*
*/
#include <QString>
#include "QGC.h"
#if (defined __ios__) && defined QGC_SPEECH_ENABLED
#import <AVFoundation/AVSpeechSynthesis.h>
class SpeakIOS
{
public:
SpeakIOS ();
~SpeakIOS ();
void speak (QString msg );
private:
AVSpeechSynthesizer *_synth;
};
SpeakIOS::SpeakIOS()
: _synth([[AVSpeechSynthesizer alloc] init])
{
}
SpeakIOS::~SpeakIOS()
{
[_synth release];
}
void SpeakIOS::speak(QString msg)
{
while ([_synth isSpeaking]) {
QGC::SLEEP::msleep(100);
}
NSString *msg_ns = [NSString stringWithCString:msg.toStdString().c_str() encoding:[NSString defaultCStringEncoding]];
AVSpeechUtterance *utterance = [[[AVSpeechUtterance alloc] initWithString: msg_ns] autorelease];
AVSpeechSynthesisVoice* currentVoice = [AVSpeechSynthesisVoice voiceWithLanguage:[AVSpeechSynthesisVoice currentLanguageCode]];
utterance.voice = currentVoice;
//utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
utterance.rate = 0.5;
[_synth speakUtterance:utterance];
}
//-- The one and only static singleton
SpeakIOS kSpeakIOS;
void iOSSpeak(QString msg)
{
kSpeakIOS.speak(msg);
}
#endif
src/comm/QGCFlightGearLink.cc
View file @
ed55e5da
...
...
@@ -658,7 +658,7 @@ bool QGCFlightGearLink::connectSimulation()
// Now set the FG arguments to the arguments from the UI
_fgArgList
=
uiArgList
;
#if defined
Q_OS_MACX
#if defined
__macos__
// Mac installs will default to the /Applications folder 99% of the time. Anything other than
// that is pretty non-standard so we don't try to get fancy beyond hardcoding that path.
fgAppDir
.
setPath
(
"/Applications"
);
...
...
src/ui/MainWindow.cc
View file @
ed55e5da
...
...
@@ -265,7 +265,7 @@ MainWindow::MainWindow()
connect
(
_ui
.
actionStatusBar
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
showStatusBarCallback
);
// Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui
#ifdef
Q_OS_MACX
#ifdef
__macos__
_ui
.
actionSetup
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+1"
,
0
));
_ui
.
actionPlan
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+2"
,
0
));
_ui
.
actionFlight
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+3"
,
0
));
...
...
@@ -290,7 +290,7 @@ MainWindow::MainWindow()
menuBar
()
->
hide
();
#endif
show
();
#ifdef
Q_OS_MAC
#ifdef
__macos__
// TODO HACK
// This is a really ugly hack. For whatever reason, by having a QQuickWidget inside a
// QDockWidget (MainToolBar above), the main menu is not shown when the app first
...
...
src/ui/MainWindow.qml
View file @
ed55e5da
...
...
@@ -40,7 +40,7 @@ Item {
QGCPalette
{
id
:
__qgcPal
;
colorGroupEnabled
:
true
}
property
real
tbHeight
:
ScreenTools
.
isMobile
?
(
ScreenTools
.
isTinyScreen
?
(
mainWindow
.
width
*
0.0666
)
:
(
mainWindow
.
width
*
0.0
444
))
:
ScreenTools
.
defaultFontPixelSize
*
4
property
real
tbHeight
:
ScreenTools
.
isMobile
?
(
ScreenTools
.
isTinyScreen
?
(
mainWindow
.
width
*
0.0666
)
:
(
mainWindow
.
width
*
0.0
5
))
:
ScreenTools
.
defaultFontPixelSize
*
4
property
int
tbCellHeight
:
tbHeight
*
0.75
property
real
tbSpacing
:
ScreenTools
.
isMobile
?
width
*
0.00824
:
9.54
property
real
tbButtonWidth
:
tbCellHeight
*
1.3
...
...
src/ui/toolbar/MainToolBar.qml
View file @
ed55e5da
...
...
@@ -421,7 +421,7 @@ Rectangle {
id
:
toolBarMessage
width
:
toolBarMessageArea
.
width
-
toolBarMessageCloseButton
.
width
wrapMode
:
Text
.
WordWrap
color
:
qgcPal
.
warningText
color
:
"
#e4e428
"
lineHeightMode
:
Text
.
ProportionalHeight
lineHeight
:
1.15
anchors.margins
:
mainWindow
.
tbSpacing
...
...
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