Commit a4199731 authored by pixhawk's avatar pixhawk

Added patch from Hugo which fixes some OS X issues

parent 8486386a
*Makefile* *Makefile*
./build build
Info.plist Info.plist
obj obj
*.log *.log
...@@ -16,3 +16,5 @@ qrc_*.cpp ...@@ -16,3 +16,5 @@ qrc_*.cpp
tmp tmp
debug debug
release release
opengroundcontrol.xcodeproj/**
[submodule "MAVLink"]
path = MAVLink
url = git://github.com/pixhawk/mavlink.git
...@@ -61,25 +61,19 @@ macx { ...@@ -61,25 +61,19 @@ macx {
message(Building for Mac OS X) message(Building for Mac OS X)
QT += phonon CONFIG += x86_64 cocoa
CONFIG -= static
DESTDIR = $$BASEDIR/bin/mac DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += /opt/local/include/boost \ INCLUDEPATH += -framework SDL \
/opt/local/include/SDL /Users/hugo/Projects/PixHawkGroundControl/MAVLink/src
LIBS += -framework IOKit \ LIBS += -framework IOKit \
-L/opt/local/lib \ -framework SDL \
-L$$BASEDIR/lib/flite/mac32 \ -framework CoreFoundation \
-lm \ -framework ApplicationServices \
-lflite_cmu_us_awb \ -lm
-lflite_cmu_us_rms \
-lflite_cmu_us_slt \
-lflite_usenglish \
-lflite_cmulex \
-lflite \
-L/opt/local/lib/SDL \
-lSDL \
-lSDLmain
DEFINES += _TTY_POSIX_ DEFINES += _TTY_POSIX_
#ICON = $$BASEDIR/img/icons/empty.png #ICON = $$BASEDIR/img/icons/empty.png
......
...@@ -99,13 +99,7 @@ HEADERS += src/MG.h \ ...@@ -99,13 +99,7 @@ HEADERS += src/MG.h \
src/ui/MAVLinkSettingsWidget.h \ src/ui/MAVLinkSettingsWidget.h \
src/ui/AudioOutputWidget.h \ src/ui/AudioOutputWidget.h \
src/AudioOutput.h \ src/AudioOutput.h \
src/LogCompressor.h \ src/LogCompressor.h
src/comm/ViconTarsusProtocol.h \
src/comm/TarsusField.h \
src/comm/TarsusFieldDescriptor.h \
src/comm/TarsusFieldTriplet.h \
src/comm/TarsusRigidBody.h \
src/comm/TarsusStream.h
SOURCES += src/main.cc \ SOURCES += src/main.cc \
src/Core.cc \ src/Core.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
...@@ -150,6 +144,5 @@ SOURCES += src/main.cc \ ...@@ -150,6 +144,5 @@ SOURCES += src/main.cc \
src/ui/MAVLinkSettingsWidget.cc \ src/ui/MAVLinkSettingsWidget.cc \
src/ui/AudioOutputWidget.cc \ src/ui/AudioOutputWidget.cc \
src/AudioOutput.cc \ src/AudioOutput.cc \
src/LogCompressor.cc \ src/LogCompressor.cc
src/comm/ViconTarsusProtocol.cc
RESOURCES = mavground.qrc RESOURCES = mavground.qrc
#include "AudioOutput.h" #include "AudioOutput.h"
#include <flite.h>
#include <phonon/mediaobject.h> #ifndef Q_OS_MAC
#include <QTemporaryFile> #include <flite.h>
#include <phonon/mediaobject.h>
#include <QTemporaryFile>
#else
#include <ApplicationServices/ApplicationServices.h>
#endif
#include <QDebug> #include <QDebug>
#ifndef Q_OS_MAC
extern "C" { extern "C" {
#include <cmu_us_awb/voxdefs.h> #include <cmu_us_awb/voxdefs.h>
//#include <cmu_us_slt/voxdefs.h> //#include <cmu_us_slt/voxdefs.h>
...@@ -18,12 +23,13 @@ extern "C" { ...@@ -18,12 +23,13 @@ extern "C" {
cst_voice *register_cmu_us_rms(const char *voxdir); cst_voice *register_cmu_us_rms(const char *voxdir);
void unregister_cmu_us_rms(cst_voice *vox); void unregister_cmu_us_rms(cst_voice *vox);
}; };
#endif
AudioOutput::AudioOutput(QString voice, QObject* parent) : QObject(parent), AudioOutput::AudioOutput(QString voice, QObject* parent) : QObject(parent),
voice(NULL), voice(NULL),
voiceIndex(0) voiceIndex(0)
{ {
#ifndef _WIN32 #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
flite_init(); flite_init();
#endif #endif
...@@ -63,7 +69,12 @@ voiceIndex(0) ...@@ -63,7 +69,12 @@ voiceIndex(0)
bool AudioOutput::say(QString text, int severity) bool AudioOutput::say(QString text, int severity)
{ {
// Only give speech output on Linux and MacOS // Only give speech output on Linux and MacOS
#ifndef _WIN32 #if defined(Q_OS_WIN32)
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!";
#elif defined(Q_OS_MAC)
SpeakString((const unsigned char*)text.toAscii().data());
qDebug() << "Synthesized: " << text;
#else
QTemporaryFile file; QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav"); file.setFileTemplate("XXXXXX.wav");
if (file.open()) if (file.open())
...@@ -77,8 +88,6 @@ bool AudioOutput::say(QString text, int severity) ...@@ -77,8 +88,6 @@ bool AudioOutput::say(QString text, int severity)
music->play(); music->play();
qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str(); qDebug() << "Synthesized: " << text << ", tmp file:" << file.fileName().toStdString().c_str();
} }
#else
qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!";
#endif #endif
return true; return true;
} }
...@@ -103,14 +112,14 @@ bool AudioOutput::stopEmergency() ...@@ -103,14 +112,14 @@ bool AudioOutput::stopEmergency()
void AudioOutput::selectFemaleVoice() void AudioOutput::selectFemaleVoice()
{ {
#ifndef _WIN32 #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_slt(NULL); this->voice = register_cmu_us_slt(NULL);
#endif #endif
} }
void AudioOutput::selectMaleVoice() void AudioOutput::selectMaleVoice()
{ {
#ifndef _WIN32 #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_rms(NULL); this->voice = register_cmu_us_rms(NULL);
#endif #endif
} }
...@@ -118,7 +127,7 @@ void AudioOutput::selectMaleVoice() ...@@ -118,7 +127,7 @@ void AudioOutput::selectMaleVoice()
void AudioOutput::selectNeutralVoice() void AudioOutput::selectNeutralVoice()
{ {
#ifndef _WIN32 #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
this->voice = register_cmu_us_awb(NULL); this->voice = register_cmu_us_awb(NULL);
#endif #endif
} }
...@@ -134,7 +143,7 @@ extern "C" { ...@@ -134,7 +143,7 @@ extern "C" {
const cst_val *v; const cst_val *v;
QStringList l; QStringList l;
#ifndef _WIN32 #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC)
/* /*
printf("Voices available: "); printf("Voices available: ");
for (v=flite_voice_list; v; v=val_cdr(v)) for (v=flite_voice_list; v; v=val_cdr(v))
......
...@@ -69,7 +69,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -69,7 +69,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
QFontDatabase fontDatabase = QFontDatabase(); QFontDatabase fontDatabase = QFontDatabase();
const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app
const QString fontFamilyName = "Bitstream Vera Sans"; const QString fontFamilyName = "Bitstream Vera Sans";
if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!", fontFileName); if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toAscii().data());
fontDatabase.addApplicationFont(fontFileName); fontDatabase.addApplicationFont(fontFileName);
setFont(fontDatabase.font(fontFamilyName, "Roman", 12)); setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
...@@ -90,9 +90,6 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -90,9 +90,6 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv)
AudioOutput* audio = new AudioOutput(); AudioOutput* audio = new AudioOutput();
audio->say("Ground Control Station started", 1); audio->say("Ground Control Station started", 1);
tarsus = new ViconTarsusProtocol();
tarsus->start();
// Start the user interface // Start the user interface
splashScreen->showMessage(tr("Starting User Interface")); splashScreen->showMessage(tr("Starting User Interface"));
startUI(); startUI();
......
...@@ -38,7 +38,6 @@ This file is part of the PIXHAWK project ...@@ -38,7 +38,6 @@ This file is part of the PIXHAWK project
#include "MainWindow.h" #include "MainWindow.h"
#include "UASManager.h" #include "UASManager.h"
#include "LinkManager.h" #include "LinkManager.h"
#include "ViconTarsusProtocol.h"
/** /**
* @brief The main application and management class. * @brief The main application and management class.
...@@ -69,8 +68,6 @@ protected: ...@@ -69,8 +68,6 @@ protected:
private: private:
MGMainWindow* mainWindow; MGMainWindow* mainWindow;
ViconTarsusProtocol* tarsus;
}; };
#endif // _MGCORE_H_ #endif // _MGCORE_H_
...@@ -35,7 +35,7 @@ This file is part of the PIXHAWK project ...@@ -35,7 +35,7 @@ This file is part of the PIXHAWK project
#include <QThread> #include <QThread>
#include <QList> #include <QList>
#include <SDL.h> #include <SDL/SDL.h>
#include "UASInterface.h" #include "UASInterface.h"
......
...@@ -33,6 +33,11 @@ This file is part of the PIXHAWK project ...@@ -33,6 +33,11 @@ This file is part of the PIXHAWK project
#include "MainWindow.h" #include "MainWindow.h"
#include "configuration.h" #include "configuration.h"
/* SDL does ugly things to main() */
#ifdef main
# undef main
#endif
/** /**
* @brief Starts the application * @brief Starts the application
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment