Remove ATL build dependency for Windows speech recognizer

This commit is contained in:
David Rowe 2014-10-28 11:14:45 -07:00
parent a0a6a5019b
commit adf168b7ea
6 changed files with 14 additions and 25 deletions

View file

@ -52,18 +52,7 @@ endforeach(SUBDIR)
# Add SpeechRecognizer if on Windows or OS X, otherwise remove # Add SpeechRecognizer if on Windows or OS X, otherwise remove
if (WIN32) if (WIN32)
# ATL cannot be used with Visual Studio Express. # Use .cpp and .h files as is.
find_package(ATL)
if (ATL_FOUND)
# Use .cpp and .h files as is.
add_definitions(-DHAVE_ATL)
include_directories(SYSTEM ${ATL_INCLUDE_DIRS})
else ()
get_filename_component(SPEECHRECOGNIZER_H "src/SpeechRecognizer.h" ABSOLUTE)
list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_H})
get_filename_component(SPEECHRECOGNIZER_CPP "src/SpeechRecognizer.cpp" ABSOLUTE)
list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP})
endif ()
elseif (APPLE) elseif (APPLE)
file(GLOB INTERFACE_OBJCPP_SRCS "src/SpeechRecognizer.mm") file(GLOB INTERFACE_OBJCPP_SRCS "src/SpeechRecognizer.mm")
set(INTERFACE_SRCS ${INTERFACE_SRCS} ${INTERFACE_OBJCPP_SRCS}) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${INTERFACE_OBJCPP_SRCS})

View file

@ -3795,7 +3795,7 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser
scriptEngine->registerGlobalObject("Camera", cameraScriptable); scriptEngine->registerGlobalObject("Camera", cameraScriptable);
connect(scriptEngine, SIGNAL(finished(const QString&)), cameraScriptable, SLOT(deleteLater())); connect(scriptEngine, SIGNAL(finished(const QString&)), cameraScriptable, SLOT(deleteLater()));
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
scriptEngine->registerGlobalObject("SpeechRecognizer", Menu::getInstance()->getSpeechRecognizer()); scriptEngine->registerGlobalObject("SpeechRecognizer", Menu::getInstance()->getSpeechRecognizer());
#endif #endif

View file

@ -99,7 +99,7 @@ Menu::Menu() :
_lodToolsDialog(NULL), _lodToolsDialog(NULL),
_newLocationDialog(NULL), _newLocationDialog(NULL),
_userLocationsDialog(NULL), _userLocationsDialog(NULL),
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
_speechRecognizer(), _speechRecognizer(),
#endif #endif
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
@ -224,7 +224,7 @@ Menu::Menu() :
addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));
addActionToQMenuAndActionHash(toolsMenu, MenuOption::ScriptEditor, Qt::ALT | Qt::Key_S, this, SLOT(showScriptEditor())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::ScriptEditor, Qt::ALT | Qt::Key_S, this, SLOT(showScriptEditor()));
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::ControlWithSpeech, QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::ControlWithSpeech,
Qt::CTRL | Qt::SHIFT | Qt::Key_C, _speechRecognizer.getEnabled(), &_speechRecognizer, SLOT(setEnabled(bool))); Qt::CTRL | Qt::SHIFT | Qt::Key_C, _speechRecognizer.getEnabled(), &_speechRecognizer, SLOT(setEnabled(bool)));
connect(&_speechRecognizer, SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool))); connect(&_speechRecognizer, SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
@ -768,7 +768,7 @@ void Menu::loadSettings(QSettings* settings) {
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).toString(); QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).toString();
setScriptsLocation(settings->value("scriptsLocation", QString()).toString()); setScriptsLocation(settings->value("scriptsLocation", QString()).toString());
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
_speechRecognizer.setEnabled(settings->value("speechRecognitionEnabled", false).toBool()); _speechRecognizer.setEnabled(settings->value("speechRecognitionEnabled", false).toBool());
#endif #endif
@ -832,7 +832,7 @@ void Menu::saveSettings(QSettings* settings) {
settings->setValue("boundaryLevelAdjust", _boundaryLevelAdjust); settings->setValue("boundaryLevelAdjust", _boundaryLevelAdjust);
settings->setValue("snapshotsLocation", _snapshotsLocation); settings->setValue("snapshotsLocation", _snapshotsLocation);
settings->setValue("scriptsLocation", _scriptsLocation); settings->setValue("scriptsLocation", _scriptsLocation);
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
settings->setValue("speechRecognitionEnabled", _speechRecognizer.getEnabled()); settings->setValue("speechRecognitionEnabled", _speechRecognizer.getEnabled());
#endif #endif
settings->beginGroup("View Frustum Offset Camera"); settings->beginGroup("View Frustum Offset Camera");

View file

@ -23,7 +23,7 @@
#include <MenuItemProperties.h> #include <MenuItemProperties.h>
#include <OctreeConstants.h> #include <OctreeConstants.h>
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
#include "SpeechRecognizer.h" #include "SpeechRecognizer.h"
#endif #endif
@ -146,7 +146,7 @@ public:
bool shouldRenderMesh(float largestDimension, float distanceToCamera); bool shouldRenderMesh(float largestDimension, float distanceToCamera);
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
SpeechRecognizer* getSpeechRecognizer() { return &_speechRecognizer; } SpeechRecognizer* getSpeechRecognizer() { return &_speechRecognizer; }
#endif #endif
@ -286,7 +286,7 @@ private:
LodToolsDialog* _lodToolsDialog; LodToolsDialog* _lodToolsDialog;
QPointer<DataWebDialog> _newLocationDialog; QPointer<DataWebDialog> _newLocationDialog;
QPointer<DataWebDialog> _userLocationsDialog; QPointer<DataWebDialog> _userLocationsDialog;
#if defined(Q_OS_MAC) || (defined(Q_OS_WIN) && defined(HAVE_ATL)) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
SpeechRecognizer _speechRecognizer; SpeechRecognizer _speechRecognizer;
#endif #endif
int _maxVoxels; int _maxVoxels;

View file

@ -16,7 +16,7 @@
#include "SpeechRecognizer.h" #include "SpeechRecognizer.h"
#if defined(Q_OS_WIN) && defined(HAVE_ATL) #if defined(Q_OS_WIN)
#include <sapi.h> #include <sapi.h>
@ -219,4 +219,4 @@ void SpeechRecognizer::notifyCommandRecognized(void* handle) {
} }
} }
#endif // defined(Q_OS_WIN) && defined(HAVE_ATL) #endif // defined(Q_OS_WIN)

View file

@ -16,7 +16,7 @@
#include <QSet> #include <QSet>
#include <QString> #include <QString>
#if defined(Q_OS_WIN) && defined(HAVE_ATL) #if defined(Q_OS_WIN)
#include <QWinEventNotifier> #include <QWinEventNotifier>
//#include <atlbase.h> //#include <atlbase.h>
@ -50,7 +50,7 @@ private:
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
void* _speechRecognizerDelegate; void* _speechRecognizerDelegate;
void* _speechRecognizer; void* _speechRecognizer;
#elif defined(Q_OS_WIN) && defined(HAVE_ATL) #elif defined(Q_OS_WIN)
bool _comInitialized; bool _comInitialized;
// Use void* instead of ATL CComPtr<> for speech recognizer in order to avoid linker errors with Visual Studio Express. // Use void* instead of ATL CComPtr<> for speech recognizer in order to avoid linker errors with Visual Studio Express.
void* _speechRecognizer; void* _speechRecognizer;
@ -60,7 +60,7 @@ private:
QWinEventNotifier* _commandRecognizedNotifier; QWinEventNotifier* _commandRecognizedNotifier;
#endif #endif
#if defined(Q_OS_WIN) && defined(HAVE_ATL) #if defined(Q_OS_WIN)
private slots: private slots:
void notifyCommandRecognized(void* handle); void notifyCommandRecognized(void* handle);
#endif #endif