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
if (WIN32)
# ATL cannot be used with Visual Studio Express.
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 ()
# Use .cpp and .h files as is.
elseif (APPLE)
file(GLOB INTERFACE_OBJCPP_SRCS "src/SpeechRecognizer.mm")
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);
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());
#endif

View file

@ -99,7 +99,7 @@ Menu::Menu() :
_lodToolsDialog(NULL),
_newLocationDialog(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(),
#endif
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
@ -224,7 +224,7 @@ Menu::Menu() :
addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));
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,
Qt::CTRL | Qt::SHIFT | Qt::Key_C, _speechRecognizer.getEnabled(), &_speechRecognizer, SLOT(setEnabled(bool)));
connect(&_speechRecognizer, SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
@ -768,7 +768,7 @@ void Menu::loadSettings(QSettings* settings) {
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).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());
#endif
@ -832,7 +832,7 @@ void Menu::saveSettings(QSettings* settings) {
settings->setValue("boundaryLevelAdjust", _boundaryLevelAdjust);
settings->setValue("snapshotsLocation", _snapshotsLocation);
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());
#endif
settings->beginGroup("View Frustum Offset Camera");

View file

@ -23,7 +23,7 @@
#include <MenuItemProperties.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"
#endif
@ -146,7 +146,7 @@ public:
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; }
#endif
@ -286,7 +286,7 @@ private:
LodToolsDialog* _lodToolsDialog;
QPointer<DataWebDialog> _newLocationDialog;
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;
#endif
int _maxVoxels;

View file

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