From bd6ac7a39e3332cc5878db42fa4aac1b730edf4d Mon Sep 17 00:00:00 2001 From: Vladyslav Stelmakhovskyi Date: Thu, 11 May 2017 20:38:09 +0200 Subject: [PATCH] Code style fixes --- interface/resources/qml/hifi/Audio.qml | 2 +- .../scripting/AudioDeviceScriptingInterface.cpp | 17 +++++++++-------- .../scripting/AudioDeviceScriptingInterface.h | 14 +++++++------- .../script-engine/src/AudioScriptingInterface.h | 2 +- scripts/system/selectAudioDevice.js | 4 ++-- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/hifi/Audio.qml b/interface/resources/qml/hifi/Audio.qml index 09075e6fb5..66760ff290 100644 --- a/interface/resources/qml/hifi/Audio.qml +++ b/interface/resources/qml/hifi/Audio.qml @@ -204,7 +204,7 @@ Rectangle { delegate: Item { width: parent.width visible: devicemode === 1 - height: visible ? 36 : 0 + height: visible ? 36 : 0 AudioCheckbox { id: cbout width: parent.width diff --git a/interface/src/scripting/AudioDeviceScriptingInterface.cpp b/interface/src/scripting/AudioDeviceScriptingInterface.cpp index d76a37dbe0..05168b0d4c 100644 --- a/interface/src/scripting/AudioDeviceScriptingInterface.cpp +++ b/interface/src/scripting/AudioDeviceScriptingInterface.cpp @@ -43,7 +43,7 @@ AudioDeviceScriptingInterface::AudioDeviceScriptingInterface(): QAbstractListMod //fill up model onDeviceChanged(); //set up previously saved device - SettingsScriptingInterface *settings = SettingsScriptingInterface::getInstance(); + SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance(); const QString inDevice = settings->getValue("audio_input_device").toString(); if (inDevice != _currentInputDevice) { setInputDeviceAsync(inDevice); @@ -72,7 +72,7 @@ bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) { return result; } -bool AudioDeviceScriptingInterface::setDeviceFromMenu(const QString &deviceMenuName) { +bool AudioDeviceScriptingInterface::setDeviceFromMenu(const QString& deviceMenuName) { QAudio::Mode mode; if (deviceMenuName.indexOf("for Output") != -1) { @@ -229,33 +229,34 @@ void AudioDeviceScriptingInterface::onDeviceChanged() emit deviceChanged(); } -void AudioDeviceScriptingInterface::onCurrentInputDeviceChanged(const QString &name) +void AudioDeviceScriptingInterface::onCurrentInputDeviceChanged(const QString& name) { currentDeviceUpdate(name, QAudio::AudioInput); //we got a signal that device changed. Save it now - SettingsScriptingInterface *settings = SettingsScriptingInterface::getInstance(); + SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance(); settings->setValue("audio_input_device", name); emit currentInputDeviceChanged(name); } -void AudioDeviceScriptingInterface::onCurrentOutputDeviceChanged(const QString &name) +void AudioDeviceScriptingInterface::onCurrentOutputDeviceChanged(const QString& name) { currentDeviceUpdate(name, QAudio::AudioOutput); //we got a signal that device changed. Save it now - SettingsScriptingInterface *settings = SettingsScriptingInterface::getInstance(); + SettingsScriptingInterface* settings = SettingsScriptingInterface::getInstance(); settings->setValue("audio_output_device", name); emit currentOutputDeviceChanged(name); } -void AudioDeviceScriptingInterface::currentDeviceUpdate(const QString &name, QAudio::Mode mode) +void AudioDeviceScriptingInterface::currentDeviceUpdate(const QString& name, QAudio::Mode mode) { QVector role; role.append(SelectedRole); for (int i = 0; i < _devices.size(); i++) { ScriptingAudioDeviceInfo di = _devices.at(i); - if (di.mode != mode) + if (di.mode != mode) { continue; + } if (di.selected && di.name != name ) { di.selected = false; _devices[i] = di; diff --git a/interface/src/scripting/AudioDeviceScriptingInterface.h b/interface/src/scripting/AudioDeviceScriptingInterface.h index 133069d6f3..f912c35288 100644 --- a/interface/src/scripting/AudioDeviceScriptingInterface.h +++ b/interface/src/scripting/AudioDeviceScriptingInterface.h @@ -52,9 +52,9 @@ public: private slots: void onDeviceChanged(); - void onCurrentInputDeviceChanged(const QString &name); - void onCurrentOutputDeviceChanged(const QString &name); - void currentDeviceUpdate(const QString &name, QAudio::Mode mode); + void onCurrentInputDeviceChanged(const QString& name); + void onCurrentOutputDeviceChanged(const QString& name); + void currentDeviceUpdate(const QString& name, QAudio::Mode mode); public slots: bool setInputDevice(const QString& deviceName); @@ -80,16 +80,16 @@ public slots: void setMuted(bool muted); - void setInputDeviceAsync(const QString &deviceName); - void setOutputDeviceAsync(const QString &deviceName); + void setInputDeviceAsync(const QString& deviceName); + void setOutputDeviceAsync(const QString& deviceName); private: AudioDeviceScriptingInterface(); signals: void muteToggled(); void deviceChanged(); - void currentInputDeviceChanged(const QString &name); - void currentOutputDeviceChanged(const QString &name); + void currentInputDeviceChanged(const QString& name); + void currentOutputDeviceChanged(const QString& name); void mutedChanged(bool muted); void inputAudioDevicesChanged(QStringList inputAudioDevices); void outputAudioDevicesChanged(QStringList outputAudioDevices); diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h index cfc149f59e..5ec8ce4b12 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.h +++ b/libraries/script-engine/src/AudioScriptingInterface.h @@ -24,7 +24,7 @@ class AudioScriptingInterface : public QObject, public Dependency { SINGLETON_DEPENDENCY public: - virtual ~AudioScriptingInterface() {} + virtual ~AudioScriptingInterface() {} void setLocalAudioInterface(AbstractAudioInterface* audioInterface) { _localAudioInterface = audioInterface; } protected: diff --git a/scripts/system/selectAudioDevice.js b/scripts/system/selectAudioDevice.js index 1ecd5d23ed..2d40795692 100644 --- a/scripts/system/selectAudioDevice.js +++ b/scripts/system/selectAudioDevice.js @@ -17,7 +17,7 @@ const INPUT = "Input"; const OUTPUT = "Output"; - +const SELECT_AUDIO_SCRIPT_STARTUP_TIMEOUT = 300; // // VAR DEFINITIONS // @@ -195,7 +195,7 @@ Script.setTimeout(function () { setupAudioMenus(); debug("Checking HMD audio status...") checkHMDAudio(); -}, 300); +}, SELECT_AUDIO_SCRIPT_STARTUP_TIMEOUT); debug("Connecting scriptEnding()"); Script.scriptEnding.connect(function () {