default audio profile and view added

Update logging dependency from 9.84 to 9.89

This is the newest version that doesn't lead to compile errors. It has
also reduced the amount of "-Wexpansion-to-defined" errors on clang-msvc
by about 80 (from ~400 to 320).

Update easylogging license file

Originally came as LICENCE.txt (notice C instead of S in LICENSE),
renamed to better fit into the git history.

Move logging defines to QMAKE instead of logging.h

Defines done outside of easylogging++.h does not work according to
official documentation
(https://github.com/zuhd-org/easyloggingpp/blob/master/README.md#configuration-macros)

"NOTE: All the macros can be defined in one of the following ways:

1. Define macros using -D option of compiler, for example in case of
g++ you will do g++ source.cpp ... -DELPP_SYSLOG -DELPP_THREAD_SAFE
... (recommended way)

2. Define macros inside "easylogging++.h" (defining macros in other
files won't work)"

Linking to this issue:
https://github.com/zuhd-org/easyloggingpp/issues/590#issuecomment-346753951

We are using the developer recommended way of defining them by command
line.

What is assumed to be the intention of enabling debug logs before
including easylogging++ never actually did anything, hence this define
is dropped. Newer versions of easylogging++ uses the macro
ELPP_DISABLE_DEBUG_LOGS to _disable_ debug logs. Leaving that macro
undefined satisfies the original intent.

Move easylogging++ include into necessary files

logging.h previously had logic to enable debug logging even on release
builds. This logic was moved to the QMAKE file, hence the logging.h file
is no longer necessary.

Update easylogging++ to 9.96.7, turn on /WX for clang-msvc

Updating from easylogging++ 9.89 to 9.96.7 turns it from a header only
library to one requiring a source file. It has been added to sources
near the other third party includes in the QMAKE to signify that it
isn't a first party file.

Updating easylogging++ also means that clang-msvc can compile without
any warnings, hence turning on warnings as errors for that compiler as
well, to avoid any regressions.

updated to current

fixed formatting

fixed ptt add bug/compilerwarnings/c++14 target

cleaned up .pro file

fixed casting back to c++ style

added default profile and ptt profile view

fixed c++ casts

fixed logic error on getDevice functions
This commit is contained in:
ykeara
2019-01-03 15:37:20 -06:00
parent 75b7b5df0b
commit b883d2cffd
16 changed files with 7669 additions and 6600 deletions
+7 -6
View File
@@ -5,7 +5,9 @@
#------------------------------------------------- #-------------------------------------------------
QT += core gui qml quick multimedia widgets QT += core gui qml quick multimedia widgets
CONFIG += c++11 CONFIG += c++14
DEFINES += ELPP_THREAD_SAFE ELPP_QT_LOGGING ELPP_NO_DEFAULT_LOG_FILE
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.6 or higher") lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5.6 or higher")
lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6 or higher") lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6 or higher")
@@ -18,11 +20,10 @@ TEMPLATE = app
#D9025: overriding '/W4' with '/W3' #D9025: overriding '/W4' with '/W3'
QMAKE_CFLAGS_WARN_ON -= -W3 QMAKE_CFLAGS_WARN_ON -= -W3
QMAKE_CXXFLAGS_WARN_ON -= -W3 QMAKE_CXXFLAGS_WARN_ON -= -W3
#C4127 was in a third party file with no way to turn off.
QMAKE_CXXFLAGS += /W4 /wd4127 QMAKE_CXXFLAGS += /W4 /wd4127
QMAKE_CXXFLAGS += /WX
!*clang-msvc{
QMAKE_CXXFLAGS += /WX
}
} }
*g++* { *g++* {
@@ -54,7 +55,6 @@ SOURCES += src/main.cpp\
src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp src/tabcontrollers/keyboardinput/KeyboardInputDummy.cpp
HEADERS += src/overlaycontroller.h \ HEADERS += src/overlaycontroller.h \
src/logging.h \
src/tabcontrollers/AudioTabController.h \ src/tabcontrollers/AudioTabController.h \
src/tabcontrollers/ChaperoneTabController.h \ src/tabcontrollers/ChaperoneTabController.h \
src/tabcontrollers/FixFloorTabController.h \ src/tabcontrollers/FixFloorTabController.h \
@@ -83,7 +83,8 @@ win32 {
INCLUDEPATH += third-party/openvr/headers \ INCLUDEPATH += third-party/openvr/headers \
third-party/easylogging++ third-party/easylogging++
#easylogging++ used to be a header only lib. Now requires easylogging++.cc
SOURCES += third-party/easylogging++/easylogging++.cc
win32:LIBS += -L"$$PWD/third-party/openvr/lib/win64" -luser32 -lole32 win32:LIBS += -L"$$PWD/third-party/openvr/lib/win64" -luser32 -lole32
unix:LIBS += -L"$$PWD/third-party/openvr/lib/linux64" unix:LIBS += -L"$$PWD/third-party/openvr/lib/linux64"
LIBS += -lopenvr_api LIBS += -lopenvr_api
+3
View File
@@ -23,9 +23,12 @@ For pushing changes to the repo:
2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html). 2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html).
Additionally, for fully building portable and installer release versions: Additionally, for fully building portable and installer release versions:
3. [7zip](https://www.7-zip.org/download.html) 3. [7zip](https://www.7-zip.org/download.html)
4. [Nullsoft Scriptable Install System (NSIS)](https://sourceforge.net/projects/nsis/) 4. [Nullsoft Scriptable Install System (NSIS)](https://sourceforge.net/projects/nsis/)
<a name="locs_and_envs"></a> <a name="locs_and_envs"></a>
## Locations and Environment Variables ## Locations and Environment Variables
-16
View File
@@ -1,16 +0,0 @@
#pragma once
// easylogging includes
#ifndef _DEBUG
# define _DEBUG
# define ELPP_THREAD_SAFE
# define ELPP_QT_LOGGING
# define ELPP_NO_DEFAULT_LOG_FILE
# include <easylogging++.h>
# undef _DEBUG
#else
# define ELPP_THREAD_SAFE
# define ELPP_QT_LOGGING
# define ELPP_NO_DEFAULT_LOG_FILE
# include <easylogging++.h>
#endif
+1 -1
View File
@@ -8,7 +8,7 @@
#include <QStandardPaths> #include <QStandardPaths>
#include <openvr.h> #include <openvr.h>
#include <iostream> #include <iostream>
#include "logging.h" #include <easylogging++.h>
INITIALIZE_EASYLOGGINGPP INITIALIZE_EASYLOGGINGPP
+1 -1
View File
@@ -18,7 +18,7 @@
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#include <openvr.h> #include <openvr.h>
#include "logging.h" #include <easylogging++.h>
#include "utils/Matrix.h" #include "utils/Matrix.h"
// application namespace // application namespace
+1 -1
View File
@@ -22,7 +22,7 @@
#include <QQuickRenderControl> #include <QQuickRenderControl>
#include <QSoundEffect> #include <QSoundEffect>
#include <memory> #include <memory>
#include "logging.h" #include <easylogging++.h>
#include "utils/ChaperoneUtils.h" #include "utils/ChaperoneUtils.h"
#include "tabcontrollers/SteamVRTabController.h" #include "tabcontrollers/SteamVRTabController.h"
+1 -1
View File
@@ -663,7 +663,7 @@ MyStackViewPage {
//audioProfileComboBox.currentIndex = AudioTabController.audioProfileDefaultIndex+1 //audioProfileComboBox.currentIndex = AudioTabController.audioProfileDefaultIndex+1
} }
onPttProfileAdded:{ onPttProfileAdded:{
pttProfileComboBox.currentIndex = AudioTabController.getpttProfileCount() pttProfileComboBox.currentIndex = AudioTabController.getPttProfileCount()
} }
//onAudioProfileDefaultIndexChanged: { //onAudioProfileDefaultIndexChanged: {
File diff suppressed because it is too large Load Diff
+144 -150
View File
@@ -3,192 +3,186 @@
#include "AudioManager.h" #include "AudioManager.h"
#include "PttController.h" #include "PttController.h"
//#include "AudioProfileController.h"
#include <memory> #include <memory>
class QQuickWindow; class QQuickWindow;
// application namespace // application namespace
namespace advsettings { namespace advsettings
{
// forward declaration
class OverlayController;
// forward declaration struct AudioProfile
class OverlayController; {
std::string profileName;
std::string playbackName;
std::string mirrorName;
std::string micName;
float mirrorVol = 0.0;
float micVol = 0.0;
bool micMute = false;
bool mirrorMute = false;
bool defaultProfile = false;
};
struct AudioProfile { class AudioTabController : public PttController
std::string profileName; {
std::string playbackName; Q_OBJECT
std::string mirrorName; Q_PROPERTY( int playbackDeviceIndex READ playbackDeviceIndex WRITE
std::string micName; setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged )
float mirrorVol = 0.0; Q_PROPERTY( int mirrorDeviceIndex READ mirrorDeviceIndex WRITE
float micVol = 0.0; setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged )
bool micMute = false; Q_PROPERTY( float mirrorVolume READ mirrorVolume WRITE setMirrorVolume
bool mirrorMute = false; NOTIFY mirrorVolumeChanged )
bool defaultProfile = false; Q_PROPERTY( bool mirrorMuted READ mirrorMuted WRITE setMirrorMuted NOTIFY
}; mirrorMutedChanged )
Q_PROPERTY( int micDeviceIndex READ micDeviceIndex WRITE setMicDeviceIndex
NOTIFY micDeviceIndexChanged )
Q_PROPERTY( float micVolume READ micVolume WRITE setMicVolume NOTIFY
micVolumeChanged )
Q_PROPERTY(
bool micMuted READ micMuted WRITE setMicMuted NOTIFY micMutedChanged )
Q_PROPERTY( bool micProximitySensorCanMute READ micProximitySensorCanMute
WRITE setMicProximitySensorCanMute NOTIFY
micProximitySensorCanMuteChanged )
Q_PROPERTY( bool micReversePtt READ micReversePtt WRITE setMicReversePtt
NOTIFY micReversePttChanged )
Q_PROPERTY( bool audioProfileDefault READ audioProfileDefault WRITE
setAudioProfileDefault NOTIFY audioProfileDefaultChanged )
private:
OverlayController* parent;
QQuickWindow* widget;
class AudioTabController : public PttController { vr::VROverlayHandle_t m_ulNotificationOverlayHandle
Q_OBJECT = vr::k_ulOverlayHandleInvalid;
Q_PROPERTY(int playbackDeviceIndex READ playbackDeviceIndex WRITE setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged)
Q_PROPERTY(int mirrorDeviceIndex READ mirrorDeviceIndex WRITE setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged)
//Q_PROPERTY(bool mirrorPresent READ mirrorPresent NOTIFY mirrorPresentChanged)
//Q_PROPERTY(QString mirrorDevName READ mirrorDevName NOTIFY mirrorDevNameChanged)
Q_PROPERTY(float mirrorVolume READ mirrorVolume WRITE setMirrorVolume NOTIFY mirrorVolumeChanged)
Q_PROPERTY(bool mirrorMuted READ mirrorMuted WRITE setMirrorMuted NOTIFY mirrorMutedChanged)
Q_PROPERTY(int micDeviceIndex READ micDeviceIndex WRITE setMicDeviceIndex NOTIFY micDeviceIndexChanged)
//Q_PROPERTY(bool micPresent READ micPresent NOTIFY micPresentChanged)
//Q_PROPERTY(QString micDevName READ micDevName NOTIFY micDevNameChanged)
Q_PROPERTY(float micVolume READ micVolume WRITE setMicVolume NOTIFY micVolumeChanged)
Q_PROPERTY(bool micMuted READ micMuted WRITE setMicMuted NOTIFY micMutedChanged)
Q_PROPERTY(bool micProximitySensorCanMute READ micProximitySensorCanMute WRITE setMicProximitySensorCanMute NOTIFY micProximitySensorCanMuteChanged)
Q_PROPERTY(bool micReversePtt READ micReversePtt WRITE setMicReversePtt NOTIFY micReversePttChanged)
Q_PROPERTY(bool audioProfileDefault READ audioProfileDefault WRITE setAudioProfileDefault NOTIFY audioProfileDefaultChanged) int m_playbackDeviceIndex = -1;
//To display default profile int m_mirrorDeviceIndex = -1;
//Q_PROPERTY(bool audioProfileDefaultIndex READ audioProfileDefaultIndex NOTIFY audioProfileDefaultIndexChanged) float m_mirrorVolume = 1.0;
bool m_mirrorMuted = false;
int m_recordingDeviceIndex = -1;
float m_micVolume = 1.0;
bool m_micMuted = false;
bool m_micProximitySensorCanMute = false;
bool m_micReversePtt = false;
bool m_isDefaultAudioProfile = false;
// int m_defaultAudioProfileIndex = 2;
std::string m_defaultProfileName;
unsigned settingsUpdateCounter = 0;
std::unique_ptr<AudioManager> audioManager;
std::vector<std::pair<std::string, std::string>> m_recordingDevices;
std::vector<std::pair<std::string, std::string>> m_playbackDevices;
std::string lastMirrorDevId;
private: QString getSettingsName() override
OverlayController* parent; {
QQuickWindow* widget; return "audioSettings";
}
void onPttStart() override;
void onPttStop() override;
void onPttEnabled() override;
void onPttDisabled() override;
bool pttChangeValid() override;
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override
{
return m_ulNotificationOverlayHandle;
}
vr::VROverlayHandle_t m_ulNotificationOverlayHandle = vr::k_ulOverlayHandleInvalid; void findPlaybackDeviceIndex( std::string id, bool notify = true );
void findMirrorDeviceIndex( std::string id, bool notify = true );
void findMicDeviceIndex( std::string id, bool notify = true );
int m_playbackDeviceIndex = -1; int getPlaybackIndex( std::string str );
int getRecordingIndex( std::string str );
int getMirrorIndex( std::string str );
int m_mirrorDeviceIndex = -1; void removeDefaultProfile( QString name );
float m_mirrorVolume = 1.0;
bool m_mirrorMuted = false;
int m_recordingDeviceIndex = -1; std::vector<AudioProfile> audioProfiles;
float m_micVolume = 1.0;
bool m_micMuted = false;
bool m_micProximitySensorCanMute = false;
bool m_micReversePtt = false;
bool m_isDefaultAudioProfile = false;
//int m_defaultAudioProfileIndex = 2;
std::string m_defaultProfileName;
unsigned settingsUpdateCounter = 0; public:
void initStage1();
void initStage2( OverlayController* parent1, QQuickWindow* widget1 );
std::unique_ptr<AudioManager> audioManager; void reloadAudioSettings();
std::vector<std::pair<std::string, std::string>> m_recordingDevices; void saveAudioSettings();
std::vector<std::pair<std::string, std::string>> m_playbackDevices;
std::string lastMirrorDevId;
QString getSettingsName() override { return "audioSettings"; } void eventLoopTick();
//QString getSettingsNameAudio() override { return "audioSettingsTest"; }
void onPttStart() override;
void onPttStop() override;
void onPttEnabled() override;
void onPttDisabled() override;
bool pttChangeValid() override;
virtual vr::VROverlayHandle_t getNotificationOverlayHandle() override { return m_ulNotificationOverlayHandle; }
void findPlaybackDeviceIndex(std::string id, bool notify = true); int playbackDeviceIndex() const;
void findMirrorDeviceIndex(std::string id, bool notify = true);
void findMicDeviceIndex(std::string id, bool notify = true);
int getPlaybackIndex(std::string str); int mirrorDeviceIndex() const;
int getRecordingIndex(std::string str); float mirrorVolume() const;
int getMirrorIndex(std::string str); bool mirrorMuted() const;
//void setPlaybackDeviceControl(int index, bool notify = true);
void removeDefaultProfile(QString name); int micDeviceIndex() const;
//void setAudioProfileDefaultIndex(int index); float micVolume() const;
//void setDefaultAudioProfileName(int index); bool micMuted() const;
bool micProximitySensorCanMute() const;
bool micReversePtt() const;
bool audioProfileDefault() const;
// int audioProfileDefaultIndex() const;
std::vector<AudioProfile> audioProfiles; void reloadAudioProfiles();
//std::recursive_mutex eventLoopMutexAudio; void saveAudioProfiles();
Q_INVOKABLE void applyDefaultProfile();
public: Q_INVOKABLE int getPlaybackDeviceCount();
Q_INVOKABLE QString getPlaybackDeviceName( int index );
Q_INVOKABLE int getRecordingDeviceCount();
Q_INVOKABLE QString getRecordingDeviceName( int index );
void initStage1(); Q_INVOKABLE unsigned getAudioProfileCount();
void initStage2(OverlayController* parent, QQuickWindow* widget); Q_INVOKABLE QString getAudioProfileName( unsigned index );
void reloadAudioSettings(); void onNewRecordingDevice();
void saveAudioSettings(); void onNewPlaybackDevice();
void onNewMirrorDevice();
void onDeviceStateChanged();
void eventLoopTick(); public slots:
void setMirrorVolume( float value, bool notify = true );
void setMirrorMuted( bool value, bool notify = true );
int playbackDeviceIndex() const; void setMicVolume( float value, bool notify = true );
void setMicMuted( bool value, bool notify = true );
void setMicProximitySensorCanMute( bool value, bool notify = true );
void setMicReversePtt( bool value, bool notify = true );
int mirrorDeviceIndex() const; void setPlaybackDeviceIndex( int value, bool notify = true );
float mirrorVolume() const; void setMirrorDeviceIndex( int value, bool notify = true );
bool mirrorMuted() const; void setMicDeviceIndex( int value, bool notify = true );
int micDeviceIndex() const; void addAudioProfile( QString name );
float micVolume() const; void applyAudioProfile( unsigned index );
bool micMuted() const; void deleteAudioProfile( unsigned index );
bool micProximitySensorCanMute() const;
bool micReversePtt() const;
bool audioProfileDefault() const;
//int audioProfileDefaultIndex() const;
void reloadAudioProfiles(); void setAudioProfileDefault( bool value, bool notify = true );
void saveAudioProfiles();
Q_INVOKABLE void applyDefaultProfile();
Q_INVOKABLE int getPlaybackDeviceCount(); signals:
Q_INVOKABLE QString getPlaybackDeviceName(int index); void playbackDeviceIndexChanged( int index );
Q_INVOKABLE int getRecordingDeviceCount(); void mirrorDeviceIndexChanged( int index );
Q_INVOKABLE QString getRecordingDeviceName(int index); void mirrorVolumeChanged( float value );
void mirrorMutedChanged( bool value );
//TODO check if needed? void micDeviceIndexChanged( int index );
Q_INVOKABLE unsigned getAudioProfileCount(); void micVolumeChanged( float value );
Q_INVOKABLE QString getAudioProfileName(unsigned index); void micMutedChanged( bool value );
void micProximitySensorCanMuteChanged( bool value );
void micReversePttChanged( bool value );
void playbackDeviceListChanged();
void recordingDeviceListChanged();
void onNewRecordingDevice(); void audioProfilesUpdated();
void onNewPlaybackDevice(); void audioProfileAdded();
void onNewMirrorDevice(); void audioProfileDefaultChanged( bool value );
void onDeviceStateChanged(); };
} // namespace advsettings
public slots:
void setMirrorVolume(float value, bool notify = true);
void setMirrorMuted(bool value, bool notify = true);
void setMicVolume(float value, bool notify = true);
void setMicMuted(bool value, bool notify = true);
void setMicProximitySensorCanMute(bool value, bool notify = true);
void setMicReversePtt(bool value, bool notify = true);
void setPlaybackDeviceIndex(int value, bool notify = true);
void setMirrorDeviceIndex(int value, bool notify = true);
void setMicDeviceIndex(int value, bool notify = true);
void addAudioProfile(QString name);
void applyAudioProfile(unsigned index);
void deleteAudioProfile(unsigned index);
void setAudioProfileDefault(bool value, bool notify = true);
signals:
void playbackDeviceIndexChanged(int index);
void mirrorDeviceIndexChanged(int index);
void mirrorVolumeChanged(float value);
void mirrorMutedChanged(bool value);
void micDeviceIndexChanged(int index);
void micVolumeChanged(float value);
void micMutedChanged(bool value);
void micProximitySensorCanMuteChanged(bool value);
void micReversePttChanged(bool value);
void playbackDeviceListChanged();
void recordingDeviceListChanged();
void audioProfilesUpdated();
void audioProfileAdded();
//void defaultAudioProfileApplied();
//void audioProfileDefaultIndexChanged();
void audioProfileDefaultChanged(bool value);
};
+47 -165
View File
@@ -407,43 +407,58 @@ void PttController::addPttProfile( QString name )
savePttProfiles(); savePttProfiles();
OverlayController::appSettings()->sync(); OverlayController::appSettings()->sync();
emit pttProfilesUpdated(); emit pttProfilesUpdated();
emit pttProfileAdded(); emit pttProfileAdded();
} }
void PttController::applyPttProfile(unsigned index) { void PttController::applyPttProfile( unsigned index )
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex); {
if (index < pttProfiles.size()) { std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
auto& profile = pttProfiles[index]; if ( index < pttProfiles.size() )
setPttShowNotification(profile.showNotification); {
setPttLeftControllerEnabled(profile.leftControllerEnabled); auto& profile = pttProfiles[index];
setPttRightControllerEnabled(profile.rightControllerEnabled); setPttShowNotification( profile.showNotification );
m_pttControllerConfigs[0].digitalButtons = profile.controllerConfigs[0].digitalButtons; setPttLeftControllerEnabled( profile.leftControllerEnabled );
m_pttControllerConfigs[0].digitalButtonMask = profile.controllerConfigs[0].digitalButtonMask; setPttRightControllerEnabled( profile.rightControllerEnabled );
m_pttControllerConfigs[0].triggerMode = profile.controllerConfigs[0].triggerMode; m_pttControllerConfigs[0].digitalButtons
m_pttControllerConfigs[0].touchpadMode = profile.controllerConfigs[0].touchpadMode; = profile.controllerConfigs[0].digitalButtons;
m_pttControllerConfigs[0].touchpadAreas = profile.controllerConfigs[0].touchpadAreas; m_pttControllerConfigs[0].digitalButtonMask
m_pttControllerConfigs[1].digitalButtons = profile.controllerConfigs[1].digitalButtons; = profile.controllerConfigs[0].digitalButtonMask;
m_pttControllerConfigs[1].digitalButtonMask = profile.controllerConfigs[1].digitalButtonMask; m_pttControllerConfigs[0].triggerMode
m_pttControllerConfigs[1].triggerMode = profile.controllerConfigs[1].triggerMode; = profile.controllerConfigs[0].triggerMode;
m_pttControllerConfigs[1].touchpadMode = profile.controllerConfigs[1].touchpadMode; m_pttControllerConfigs[0].touchpadMode
m_pttControllerConfigs[1].touchpadAreas = profile.controllerConfigs[1].touchpadAreas; = profile.controllerConfigs[0].touchpadMode;
m_pttControllerConfigs[0].touchpadAreas
= profile.controllerConfigs[0].touchpadAreas;
m_pttControllerConfigs[1].digitalButtons
= profile.controllerConfigs[1].digitalButtons;
m_pttControllerConfigs[1].digitalButtonMask
= profile.controllerConfigs[1].digitalButtonMask;
m_pttControllerConfigs[1].triggerMode
= profile.controllerConfigs[1].triggerMode;
m_pttControllerConfigs[1].touchpadMode
= profile.controllerConfigs[1].touchpadMode;
m_pttControllerConfigs[1].touchpadAreas
= profile.controllerConfigs[1].touchpadAreas;
} }
} }
void PttController::deletePttProfile(unsigned index) { void PttController::deletePttProfile( unsigned index )
if (index < pttProfiles.size()) { {
auto pos = pttProfiles.begin() + index; if ( index < pttProfiles.size() )
pttProfiles.erase(pos); {
savePttProfiles(); auto pos = pttProfiles.begin() + index;
OverlayController::appSettings()->sync(); pttProfiles.erase( pos );
emit pttProfilesUpdated(); savePttProfiles();
OverlayController::appSettings()->sync();
emit pttProfilesUpdated();
} }
} }
QVariantList PttController::pttDigitalButtons(unsigned controller) {
if (controller < 2) {
return m_pttControllerConfigs[controller].digitalButtons;
QVariantList PttController::pttDigitalButtons( unsigned controller )
{
if ( controller < 2 )
{
return m_pttControllerConfigs[controller].digitalButtons;
} }
return QVariantList(); return QVariantList();
} }
@@ -496,138 +511,6 @@ QString PttController::getPttProfileName( unsigned index )
return QString::fromStdString( pttProfiles[index].profileName ); return QString::fromStdString( pttProfiles[index].profileName );
} }
return ""; return "";
<<<<<<< HEAD
}
void PttController::setPttEnabled(bool value, bool notify, bool save) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
if (value != m_pttEnabled) {
m_pttEnabled = value;
if (value) {
onPttEnabled();
} else {
onPttDisabled();
}
if (notify) {
emit pttEnabledChanged(value);
}
if (save) {
savePttConfig();
}
}
}
void PttController::setPttShowNotification(bool value, bool notify, bool save) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
if (value != m_pttShowNotification) {
m_pttShowNotification = value;
if (notify) {
emit pttShowNotificationChanged(value);
}
if (save) {
savePttConfig();
}
}
}
void PttController::setPttLeftControllerEnabled(bool value, bool notify, bool save) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
if (value != m_pttLeftControllerEnabled) {
m_pttLeftControllerEnabled = value;
if (notify) {
emit pttLeftControllerEnabledChanged(value);
}
if (save) {
savePttConfig();
}
}
}
void PttController::setPttRightControllerEnabled(bool value, bool notify, bool save) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
if (value != m_pttRightControllerEnabled) {
m_pttRightControllerEnabled = value;
if (notify) {
emit pttRightControllerEnabledChanged(value);
}
if (save) {
savePttConfig();
}
}
}
void logControllerState(const vr::VRControllerState_t& state, const std::string& prefix) {
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_ApplicationMenu)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_ApplicationMenu) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_ApplicationMenu)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_ApplicationMenu) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Grip) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_Grip)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Grip) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_DPad_Left)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Left) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_DPad_Left)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Left) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_DPad_Up)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Up) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_DPad_Up)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Up) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_DPad_Right)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Right) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_DPad_Right)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Right) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_DPad_Down)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Down) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_DPad_Down)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_DPad_Down) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_A)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_A) << " pressed";
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_A)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_A) << " touched";
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Axis0)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis0) << " pressed";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis0) << " x: " << state.rAxis[0].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_Axis0)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis0) << " touched";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis0) << " x: " << state.rAxis[0].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Axis1)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis1) << " pressed";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis1) << " x: " << state.rAxis[1].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_Axis1)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis1) << " touched";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis1) << " x: " << state.rAxis[1].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Axis2)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis2) << " pressed";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis2) << " x: " << state.rAxis[2].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonTouched & vr::ButtonMaskFromId(vr::k_EButton_Axis2)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis2) << " touched";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis2) << " x: " << state.rAxis[2].x << " y: " << state.rAxis[0].y;
}
if (state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Axis3)) {
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis3) << " pressed";
LOG(INFO) << prefix << vr::VRSystem()->GetButtonIdNameFromEnum(vr::k_EButton_Axis3) << " x: " << state.rAxis[3].x << " y: " << state.rAxis[0].y;
=======
} }
void PttController::setPttEnabled( bool value, bool notify, bool save ) void PttController::setPttEnabled( bool value, bool notify, bool save )
@@ -652,7 +535,6 @@ void PttController::setPttEnabled( bool value, bool notify, bool save )
{ {
savePttConfig(); savePttConfig();
} }
>>>>>>> cfde8ada6350ef771b110ba9f12b8b54daa7e07b
} }
} }
+2 -2
View File
@@ -139,7 +139,7 @@ signals:
void pttRightControllerEnabledChanged( bool value ); void pttRightControllerEnabledChanged( bool value );
void pttProfilesUpdated(); void pttProfilesUpdated();
void pttProfileAdded(); void pttProfileAdded();
}; };
} // namespace advsettings } // namespace advsettings
@@ -1,6 +1,6 @@
#include "audiomanagerwindows.h" #include "AudioManagerWindows.h"
#include <exception> #include <exception>
#include "../../logging.h" #include "easylogging++.h"
#include "../AudioTabController.h" #include "../AudioTabController.h"
#include <locale> #include <locale>
@@ -1,6 +1,6 @@
#include "KeyboardInputWindows.h" #include "KeyboardInputWindows.h"
#include <Windows.h> #include <Windows.h>
#include "../../logging.h" #include "easylogging++.h"
namespace advsettings namespace advsettings
{ {
+5 -4
View File
@@ -1,10 +1,11 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015 muflihun.com Copyright (c) 2012-2018 Zuhd Web Services
Copyright (c) 2012-2018 @abumusamq
http://github.com/easylogging/ https://github.com/zuhd-org/
http://easylogging.muflihun.com https://zuhd.org
http://muflihun.com https://muflihun.com
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in
File diff suppressed because it is too large Load Diff
+3290 -5416
View File
File diff suppressed because it is too large Load Diff