History

Moved SpeechRecognizer out of Menu

Added it in the DM

Atlante45 committed 11 years ago

Commit 8933da71 parent 7f702d37 files · +32 −48Browse files

Showing the changes to interface/src/Menu.cpp (1 of 7 files). Show all

Unified · Split

interface/src/Menu.cpp+6−19
@@ -192,9 +192,13 @@ Menu::Menu() { · 191 unmodified lines
192192 dialogsManager.data(), SLOT(showScriptEditor()));
193193
194194 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
195+ auto speechRecognizer = DependencyManager::get<SpeechRecognizer>();
195196 QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::ControlWithSpeech,
196− Qt::CTRL | Qt::SHIFT | Qt::Key_C, _speechRecognizer.getEnabled(), &_speechRecognizer, SLOT(setEnabled(bool)));
197− connect(&_speechRecognizer, SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
197+ Qt::CTRL | Qt::SHIFT | Qt::Key_C,
198+ speechRecognizer->getEnabled(),
199+ speechRecognizer.data(),
200+ SLOT(setEnabled(bool)));
201+ connect(speechRecognizer.data(), SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool)));
198202 #endif
199203
200204 #ifdef HAVE_QXMPP
@@ -590,12 +594,6 @@ void Menu::loadSettings(QSettings* settings) { · 389 unmodified lines
590594 audio->setOutputStarveDetectionPeriod(settings->value("audioOutputStarveDetectionPeriod", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD).toInt());
591595 int bufferSize = settings->value("audioOutputBufferSize", DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES).toInt();
592596 QMetaObject::invokeMethod(audio.data(), "setOutputBufferSize", Q_ARG(int, bufferSize));
593−
594− setScriptsLocation(settings->value("scriptsLocation", QString()).toString());
595−
596−#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
597− _speechRecognizer.setEnabled(settings->value("speechRecognitionEnabled", false).toBool());
598−#endif
599597
600598 scanMenuBar(&loadAction, settings);
601599 Application::getInstance()->getAvatar()->loadData(settings);
@@ -630,11 +628,6 @@ void Menu::saveSettings(QSettings* settings) { · 28 unmodified lines
630628 settings->setValue("audioOutputStarveDetectionPeriod", audio->getOutputStarveDetectionPeriod());
631629 settings->setValue("audioOutputBufferSize", audio->getOutputBufferSize());
632630
633− settings->setValue("scriptsLocation", _scriptsLocation);
634−#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
635− settings->setValue("speechRecognitionEnabled", _speechRecognizer.getEnabled());
636−#endif
637−
638631 scanMenuBar(&saveAction, settings);
639632 Application::getInstance()->getAvatar()->saveData(settings);
640633
@@ -1100,9 +1093,3 @@ void Menu::runTests() { · 459 unmodified lines
11001093 runTimingTests();
11011094 }
11021095
1103−void Menu::setScriptsLocation(const QString& scriptsLocation) {
1104− _scriptsLocation = scriptsLocation;
1105− bumpSettings();
1106− emit scriptLocationChanged(scriptsLocation);
1107−}
1108−