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
+47 -165
View File
@@ -407,43 +407,58 @@ void PttController::addPttProfile( QString name )
savePttProfiles();
OverlayController::appSettings()->sync();
emit pttProfilesUpdated();
emit pttProfileAdded();
}
emit pttProfileAdded();
}
void PttController::applyPttProfile(unsigned index) {
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
if (index < pttProfiles.size()) {
auto& profile = pttProfiles[index];
setPttShowNotification(profile.showNotification);
setPttLeftControllerEnabled(profile.leftControllerEnabled);
setPttRightControllerEnabled(profile.rightControllerEnabled);
m_pttControllerConfigs[0].digitalButtons = profile.controllerConfigs[0].digitalButtons;
m_pttControllerConfigs[0].digitalButtonMask = profile.controllerConfigs[0].digitalButtonMask;
m_pttControllerConfigs[0].triggerMode = profile.controllerConfigs[0].triggerMode;
m_pttControllerConfigs[0].touchpadMode = 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::applyPttProfile( unsigned index )
{
std::lock_guard<std::recursive_mutex> lock( eventLoopMutex );
if ( index < pttProfiles.size() )
{
auto& profile = pttProfiles[index];
setPttShowNotification( profile.showNotification );
setPttLeftControllerEnabled( profile.leftControllerEnabled );
setPttRightControllerEnabled( profile.rightControllerEnabled );
m_pttControllerConfigs[0].digitalButtons
= profile.controllerConfigs[0].digitalButtons;
m_pttControllerConfigs[0].digitalButtonMask
= profile.controllerConfigs[0].digitalButtonMask;
m_pttControllerConfigs[0].triggerMode
= profile.controllerConfigs[0].triggerMode;
m_pttControllerConfigs[0].touchpadMode
= 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) {
if (index < pttProfiles.size()) {
auto pos = pttProfiles.begin() + index;
pttProfiles.erase(pos);
savePttProfiles();
OverlayController::appSettings()->sync();
emit pttProfilesUpdated();
void PttController::deletePttProfile( unsigned index )
{
if ( index < pttProfiles.size() )
{
auto pos = pttProfiles.begin() + index;
pttProfiles.erase( pos );
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();
}
@@ -496,138 +511,6 @@ QString PttController::getPttProfileName( unsigned index )
return QString::fromStdString( pttProfiles[index].profileName );
}
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 )
@@ -652,7 +535,6 @@ void PttController::setPttEnabled( bool value, bool notify, bool save )
{
savePttConfig();
}
>>>>>>> cfde8ada6350ef771b110ba9f12b8b54daa7e07b
}
}