default profile + display ptt/audio profile
This commit is contained in:
@@ -19,9 +19,9 @@ void AccessibilityTabController::initStage1() {
|
||||
reloadPttConfig();
|
||||
}
|
||||
|
||||
void AccessibilityTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void AccessibilityTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void AccessibilityTabController::setTrackingUniverse(int value) {
|
||||
|
||||
@@ -47,9 +47,9 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
|
||||
void AudioTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void AudioTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
|
||||
std::string notifKey = std::string(OverlayController::applicationKey) + ".pptnotification";
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace advsettings {
|
||||
std::string notifIconPath = QApplication::applicationDirPath().toStdString() + "/res/qml/ptt_notification.png";
|
||||
if (QFile::exists(QString::fromStdString(notifIconPath))) {
|
||||
vr::VROverlay()->SetOverlayFromFile(m_ulNotificationOverlayHandle, notifIconPath.c_str());
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
|
||||
vr::HmdMatrix34_t notificationTransform = {
|
||||
1.0f, 0.0f, 0.0f, 0.12f,
|
||||
0.0f, 1.0f, 0.0f, 0.08f,
|
||||
0.0f, 0.0f, 1.0f, -0.3f
|
||||
};
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(m_ulNotificationOverlayHandle, 0.02f);
|
||||
vr::HmdMatrix34_t notificationTransform = {{
|
||||
{1.0f, 0.0f, 0.0f, 0.12f},
|
||||
{0.0f, 1.0f, 0.0f, 0.08f},
|
||||
{0.0f, 0.0f, 1.0f, -0.3f}
|
||||
}};
|
||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(m_ulNotificationOverlayHandle, vr::k_unTrackedDeviceIndex_Hmd, ¬ificationTransform);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not find notification icon \"" << notifIconPath << "\"";
|
||||
@@ -327,25 +327,25 @@ namespace advsettings {
|
||||
emit recordingDeviceListChanged();
|
||||
}
|
||||
|
||||
int AudioTabController::getPlaybackDeviceCount() {
|
||||
return (int)m_playbackDevices.size();
|
||||
int AudioTabController::getPlaybackDeviceCount() {
|
||||
return static_cast<int>(m_playbackDevices.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getPlaybackDeviceName(int index) {
|
||||
if (index < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_playbackDevices[index].second);
|
||||
QString AudioTabController::getPlaybackDeviceName(int index) {
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_playbackDevices[static_cast<size_t>(index)].second);
|
||||
} else {
|
||||
return "<ERROR>";
|
||||
}
|
||||
}
|
||||
|
||||
int AudioTabController::getRecordingDeviceCount() {
|
||||
return (int)m_recordingDevices.size();
|
||||
int AudioTabController::getRecordingDeviceCount() {
|
||||
return static_cast<int>(m_recordingDevices.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getRecordingDeviceName(int index) {
|
||||
if (index < m_recordingDevices.size()) {
|
||||
return QString::fromStdString(m_recordingDevices[index].second);
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size()) {
|
||||
return QString::fromStdString(m_recordingDevices[static_cast<size_t>(index)].second);
|
||||
} else {
|
||||
return "<ERROR>";
|
||||
}
|
||||
@@ -366,12 +366,16 @@ namespace advsettings {
|
||||
|
||||
void AudioTabController::setPlaybackDeviceIndex(int index, bool notify) {
|
||||
if (index != m_playbackDeviceIndex) {
|
||||
if (index < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
|
||||
if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size() && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
//Applys Audio Switch IN VR
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section,
|
||||
vr::k_pch_audio_OnPlaybackDevice_String,
|
||||
m_playbackDevices[static_cast<size_t>(index)].first.c_str(),
|
||||
&vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
|
||||
}
|
||||
else {
|
||||
vr::VRSettings()->Sync();
|
||||
@@ -395,14 +399,17 @@ namespace advsettings {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMirrorDevice("", notify);
|
||||
}
|
||||
} else if (index < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnPlaybackMirrorDevice_String, m_playbackDevices[index].first.c_str(), &vrSettingsError);
|
||||
} else if (index > 0 && static_cast<size_t>(index) < m_playbackDevices.size() && index != m_playbackDeviceIndex && index != m_mirrorDeviceIndex) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section,
|
||||
vr::k_pch_audio_OnPlaybackMirrorDevice_String,
|
||||
m_playbackDevices[static_cast<size_t>(index)].first.c_str(),
|
||||
&vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnPlaybackMirrorDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
} else {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMirrorDevice(m_playbackDevices[index].first, notify);
|
||||
audioManager->setMirrorDevice(m_playbackDevices[static_cast<size_t>(index)].first, notify);
|
||||
}
|
||||
} else if (notify) {
|
||||
emit mirrorDeviceIndexChanged(m_mirrorDeviceIndex);
|
||||
@@ -412,14 +419,14 @@ namespace advsettings {
|
||||
|
||||
void AudioTabController::setMicDeviceIndex(int index, bool notify) {
|
||||
if (index != m_recordingDeviceIndex) {
|
||||
if (index < m_recordingDevices.size()) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[index].first.c_str(), &vrSettingsError);
|
||||
if (index > 0 && static_cast<size_t>(index) < m_recordingDevices.size()) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
vr::VRSettings()->SetString(vr::k_pch_audio_Section, vr::k_pch_audio_OnRecordDevice_String, m_recordingDevices[static_cast<size_t>(index)].first.c_str(), &vrSettingsError);
|
||||
if (vrSettingsError != vr::VRSettingsError_None) {
|
||||
LOG(WARNING) << "Could not write \"" << vr::k_pch_audio_OnRecordDevice_String << "\" setting: " << vr::VRSettings()->GetSettingsErrorNameFromEnum(vrSettingsError);
|
||||
} else {
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMicDevice(m_recordingDevices[index].first, notify);
|
||||
vr::VRSettings()->Sync();
|
||||
audioManager->setMicDevice(m_recordingDevices[static_cast<size_t>(index)].first, notify);
|
||||
}
|
||||
} else if (notify) {
|
||||
emit micDeviceIndexChanged(m_recordingDeviceIndex);
|
||||
@@ -518,8 +525,8 @@ namespace advsettings {
|
||||
auto profileCount = settings->beginReadArray("audioProfiles");
|
||||
for (int i = 0; i < profileCount; i++) {
|
||||
settings->setArrayIndex(i);
|
||||
audioProfiles.emplace_back();
|
||||
auto& entry = audioProfiles[i];
|
||||
audioProfiles.emplace_back();
|
||||
auto& entry = audioProfiles[static_cast<size_t>(i)];
|
||||
entry.profileName = settings->value("profileName").toString().toStdString();
|
||||
entry.playbackName = settings->value("playbackName").toString().toStdString();
|
||||
entry.micName = settings->value("micName").toString().toStdString();
|
||||
@@ -551,9 +558,9 @@ namespace advsettings {
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup(getSettingsName());
|
||||
settings->beginWriteArray("audioProfiles");
|
||||
unsigned i = 0;
|
||||
for (auto& p : audioProfiles) {
|
||||
settings->setArrayIndex(i);
|
||||
int i = 0;
|
||||
for (auto& p : audioProfiles) {
|
||||
settings->setArrayIndex(i);
|
||||
settings->setValue("profileName", QString::fromStdString(p.profileName));
|
||||
settings->setValue("playbackName", QString::fromStdString(p.playbackName));
|
||||
settings->setValue("micName", QString::fromStdString(p.micName));
|
||||
@@ -693,9 +700,9 @@ namespace advsettings {
|
||||
}
|
||||
|
||||
|
||||
unsigned AudioTabController::getAudioProfileCount() {
|
||||
return (unsigned)audioProfiles.size();
|
||||
}
|
||||
unsigned AudioTabController::getAudioProfileCount() {
|
||||
return static_cast<unsigned int>(audioProfiles.size());
|
||||
}
|
||||
|
||||
QString AudioTabController::getAudioProfileName(unsigned index) {
|
||||
if (index < audioProfiles.size()) {
|
||||
@@ -712,29 +719,31 @@ namespace advsettings {
|
||||
|
||||
description: Gets proper index value for selecting specific devices.
|
||||
*/
|
||||
int AudioTabController::getPlaybackIndex(std::string str) {
|
||||
for (int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second)==0) {
|
||||
return i;
|
||||
int AudioTabController::getPlaybackIndex(std::string str) {
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second)==0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return m_playbackDeviceIndex;
|
||||
}
|
||||
|
||||
int AudioTabController::getRecordingIndex(std::string str) {
|
||||
std::lock_guard<std::recursive_mutex> lock(eventLoopMutex);
|
||||
for (int i = 0; i < m_recordingDevices.size(); i++) {
|
||||
if (str.compare(m_recordingDevices[i].second) == 0) {
|
||||
return i;
|
||||
int AudioTabController::getRecordingIndex(std::string str) {
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_recordingDevices.size(); i++) {
|
||||
if (str.compare(m_recordingDevices[i].second) == 0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return m_recordingDeviceIndex;
|
||||
}
|
||||
|
||||
int AudioTabController::getMirrorIndex(std::string str) {
|
||||
for (int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second) == 0) {
|
||||
return i;
|
||||
//Unsigned to avoid two casts. i won't be negative because we only increment it.
|
||||
for (unsigned int i = 0; i < m_playbackDevices.size(); i++) {
|
||||
if (str.compare(m_playbackDevices[i].second) == 0) {
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ChaperoneTabController.h"
|
||||
#include <QQuickWindow>
|
||||
#include "../overlaycontroller.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
// application namespace
|
||||
namespace advsettings {
|
||||
@@ -32,9 +32,9 @@ void ChaperoneTabController::initStage1() {
|
||||
}
|
||||
|
||||
|
||||
void ChaperoneTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void ChaperoneTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
|
||||
poseHmd.mDeviceToAbsoluteTracking.m[1][3],
|
||||
poseHmd.mDeviceToAbsoluteTracking.m[2][3]
|
||||
});
|
||||
if (!isnan(distanceHmd)) {
|
||||
if (!std::isnan(distanceHmd)) {
|
||||
minDistance = distanceHmd;
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
|
||||
poseLeft.mDeviceToAbsoluteTracking.m[1][3],
|
||||
poseLeft.mDeviceToAbsoluteTracking.m[2][3]
|
||||
});
|
||||
if (!isnan(distanceLeft) && (isnan(minDistance) || distanceLeft < minDistance)) {
|
||||
if (!std::isnan(distanceLeft) && (std::isnan(minDistance) || distanceLeft < minDistance)) {
|
||||
minDistance = distanceLeft;
|
||||
}
|
||||
}
|
||||
@@ -388,12 +388,12 @@ void ChaperoneTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses,
|
||||
poseRight.mDeviceToAbsoluteTracking.m[1][3],
|
||||
poseRight.mDeviceToAbsoluteTracking.m[2][3]
|
||||
});
|
||||
if (!isnan(distanceRight) && (isnan(minDistance) || distanceRight < minDistance)) {
|
||||
if (!std::isnan(distanceRight) && (std::isnan(minDistance) || distanceRight < minDistance)) {
|
||||
minDistance = distanceRight;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnan(minDistance)) {
|
||||
if (!std::isnan(minDistance)) {
|
||||
handleChaperoneWarnings(minDistance);
|
||||
}
|
||||
}
|
||||
@@ -486,7 +486,7 @@ void ChaperoneTabController::setHeight(float value, bool notify) {
|
||||
}
|
||||
vr::VRChaperoneSetup()->SetWorkingCollisionBoundsInfo(collisionBounds, collisionBoundsCount);
|
||||
vr::VRChaperoneSetup()->CommitWorkingCopy(vr::EChaperoneConfigFile_Live);
|
||||
delete collisionBounds;
|
||||
delete[] collisionBounds;
|
||||
}
|
||||
if (notify) {
|
||||
emit heightChanged(m_fadeDistance);
|
||||
@@ -1002,11 +1002,11 @@ float ChaperoneTabController::getBoundsMaxY() {
|
||||
} else {
|
||||
ci = 2;
|
||||
}
|
||||
if (isnan(result) || result < collisionBounds[b].vCorners[ci].v[1]) {
|
||||
if (std::isnan(result) || result < collisionBounds[b].vCorners[ci].v[1]) {
|
||||
result = collisionBounds[b].vCorners[ci].v[1];
|
||||
}
|
||||
}
|
||||
delete collisionBounds;
|
||||
delete[] collisionBounds;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace advsettings {
|
||||
void FixFloorTabController::initStage1() {
|
||||
}
|
||||
|
||||
void FixFloorTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void FixFloorTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses) {
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
virtual void sendKeyboardInput(QString input) = 0;
|
||||
virtual void sendKeyboardEnter() = 0;
|
||||
virtual void sendKeyboardBackspace(int count) = 0;
|
||||
virtual void sendKeyboardAltTab() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -54,12 +54,12 @@ void MoveCenterTabController::initStage1() {
|
||||
m_lockZToggle = value.toBool();
|
||||
}
|
||||
settings->endGroup();
|
||||
lastMoveButtonClick[0] = lastMoveButtonClick[0] = clock::now();
|
||||
lastMoveButtonClick[0] = lastMoveButtonClick[1] = clock::now();
|
||||
}
|
||||
|
||||
void MoveCenterTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void MoveCenterTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ namespace advsettings {
|
||||
}
|
||||
}
|
||||
|
||||
void ReviveTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void ReviveTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void ReviveTabController::eventLoopTick() {
|
||||
|
||||
@@ -17,9 +17,9 @@ void SettingsTabController::initStage1() {
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void SettingsTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void SettingsTabController::eventLoopTick() {
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace advsettings {
|
||||
void StatisticsTabController::initStage1() {
|
||||
}
|
||||
|
||||
void StatisticsTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void StatisticsTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void StatisticsTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses, float leftSpeed, float rightSpeed) {
|
||||
|
||||
@@ -10,6 +10,13 @@ namespace vr {
|
||||
// application namespace
|
||||
namespace advsettings {
|
||||
|
||||
// openvr's github repo hasn't been updated yet to reflect changes in beta 1477423729.
|
||||
//static const char* vrsettings_steamvr_allowAsyncReprojection = "allowAsyncReprojection";
|
||||
//static const char* vrsettings_steamvr_allowInterleavedReprojection = "allowInterleavedReprojection";
|
||||
|
||||
static const char* vrsettings_steamvr_supersampleScale = "supersampleScale";
|
||||
static const char* vrsettings_steamvr_allowSupersampleFiltering = "allowSupersampleFiltering";
|
||||
static const char* vrsettings_compositor_category = "compositor";
|
||||
|
||||
void SteamVRTabController::initStage1() {
|
||||
eventLoopTick();
|
||||
@@ -17,9 +24,9 @@ void SteamVRTabController::initStage1() {
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void SteamVRTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
// openvr's github repo hasn't been updated yet to reflect changes in beta 1477423729.
|
||||
//static const char* vrsettings_steamvr_allowAsyncReprojection = "allowAsyncReprojection";
|
||||
//static const char* vrsettings_steamvr_allowInterleavedReprojection = "allowInterleavedReprojection";
|
||||
static const char* vrsettings_compositor_category = "compositor";
|
||||
static const char* vrsettings_steamvr_supersampleScale = "supersampleScale";
|
||||
static const char* vrsettings_steamvr_allowSupersampleFiltering = "allowSupersampleFiltering";
|
||||
|
||||
|
||||
class QQuickWindow;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace advsettings {
|
||||
|
||||
}
|
||||
|
||||
void UtilitiesTabController::initStage2(OverlayController * parent, QQuickWindow * widget) {
|
||||
this->parent = parent;
|
||||
this->widget = widget;
|
||||
void UtilitiesTabController::initStage2(OverlayController * var_parent, QQuickWindow * var_widget) {
|
||||
this->parent = var_parent;
|
||||
this->widget = var_widget;
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardInput(QString input) {
|
||||
@@ -61,6 +61,10 @@ namespace advsettings {
|
||||
keyboardInput->sendKeyboardEnter();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardAltTab() {
|
||||
keyboardInput->sendKeyboardAltTab();
|
||||
}
|
||||
|
||||
void UtilitiesTabController::sendKeyboardBackspace(int count) {
|
||||
keyboardInput->sendKeyboardBackspace(count);
|
||||
}
|
||||
@@ -206,11 +210,11 @@ namespace advsettings {
|
||||
if (QFile::exists(QString::fromStdString(batteryIconPath))) {
|
||||
vr::VROverlay()->SetOverlayFromFile(handle, batteryIconPath.c_str());
|
||||
vr::VROverlay()->SetOverlayWidthInMeters(handle, 0.05f);
|
||||
vr::HmdMatrix34_t notificationTransform = {
|
||||
1.0f, 0.0f, 0.0f, 0.00f,
|
||||
0.0f, -1.0f, 0.0f, 0.01f,
|
||||
0.0f, 0.0f, -1.0f, -0.013f
|
||||
};
|
||||
vr::HmdMatrix34_t notificationTransform = {{
|
||||
{1.0f, 0.0f, 0.0f, 0.00f},
|
||||
{0.0f, -1.0f, 0.0f, 0.01f},
|
||||
{0.0f, 0.0f, -1.0f, -0.013f}
|
||||
}};
|
||||
vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(handle, index, ¬ificationTransform);
|
||||
LOG(INFO) << "Created battery overlay for device " << index;
|
||||
} else {
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace advsettings {
|
||||
public slots:
|
||||
void sendKeyboardInput(QString input);
|
||||
void sendKeyboardEnter();
|
||||
void sendKeyboardAltTab();
|
||||
void sendKeyboardBackspace(int count);
|
||||
|
||||
void setAlarmEnabled(bool enabled, bool notify = true);
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
#include "AudioManagerDummy.h"
|
||||
|
||||
// Used to get the compiler to shut up about C4100: unreferenced formal parameter.
|
||||
// The cast is to get GCC to shut up about it.
|
||||
#define UNREFERENCED_PARAMETER(P) static_cast<void>((P))
|
||||
|
||||
// application namespace
|
||||
namespace advsettings {
|
||||
|
||||
void AudioManagerDummy::init(AudioTabController *controller)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(controller);
|
||||
}
|
||||
|
||||
void AudioManagerDummy::setPlaybackDevice(const std::string &id, bool notify)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(id);
|
||||
UNREFERENCED_PARAMETER(notify);
|
||||
}
|
||||
|
||||
std::string AudioManagerDummy::getPlaybackDevName()
|
||||
@@ -26,6 +33,8 @@ std::string AudioManagerDummy::getPlaybackDevId()
|
||||
void AudioManagerDummy::setMirrorDevice(const std::string &id, bool notify)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(id);
|
||||
UNREFERENCED_PARAMETER(notify);
|
||||
}
|
||||
|
||||
bool AudioManagerDummy::isMirrorValid()
|
||||
@@ -50,6 +59,7 @@ float AudioManagerDummy::getMirrorVolume()
|
||||
|
||||
bool AudioManagerDummy::setMirrorVolume(float value)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -60,6 +70,7 @@ bool AudioManagerDummy::getMirrorMuted()
|
||||
|
||||
bool AudioManagerDummy::setMirrorMuted(bool value)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,6 +82,8 @@ bool AudioManagerDummy::isMicValid()
|
||||
void AudioManagerDummy::setMicDevice(const std::string &id, bool notify)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(id);
|
||||
UNREFERENCED_PARAMETER(notify);
|
||||
}
|
||||
|
||||
std::string AudioManagerDummy::getMicDevName()
|
||||
@@ -90,6 +103,7 @@ float AudioManagerDummy::getMicVolume()
|
||||
|
||||
bool AudioManagerDummy::setMicVolume(float value)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,6 +114,7 @@ bool AudioManagerDummy::getMicMuted()
|
||||
|
||||
bool AudioManagerDummy::setMicMuted(bool value)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ AudioManagerWindows::~AudioManagerWindows() {
|
||||
audioDeviceEnumerator->Release();
|
||||
}
|
||||
|
||||
void AudioManagerWindows::init(AudioTabController* controller) {
|
||||
void AudioManagerWindows::init(AudioTabController* var_controller) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
audioDeviceEnumerator = getAudioDeviceEnumerator();
|
||||
if (!audioDeviceEnumerator) {
|
||||
@@ -47,7 +47,7 @@ void AudioManagerWindows::init(AudioTabController* controller) {
|
||||
} else {
|
||||
LOG(WARNING) << "Could not find a default recording device.";
|
||||
}
|
||||
this->controller = controller;
|
||||
this->controller = var_controller;
|
||||
audioDeviceEnumerator->RegisterEndpointNotificationCallback((IMMNotificationClient*)this);
|
||||
policyConfig = getPolicyConfig();
|
||||
if (!policyConfig) {
|
||||
@@ -277,20 +277,20 @@ IMMDeviceEnumerator* AudioManagerWindows::getAudioDeviceEnumerator() {
|
||||
}
|
||||
|
||||
IPolicyConfig * AudioManagerWindows::getPolicyConfig() {
|
||||
IPolicyConfig* policyConfig = nullptr;
|
||||
IPolicyConfig* var_policyConfig = nullptr;
|
||||
// for Win 10
|
||||
auto hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig2, (LPVOID *)&policyConfig);
|
||||
auto hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig2, (LPVOID *)&var_policyConfig);
|
||||
if (hr != S_OK) {
|
||||
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig1, (LPVOID *)&policyConfig);
|
||||
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig1, (LPVOID *)&var_policyConfig);
|
||||
}
|
||||
// for Win Vista, 7, 8, 8.1
|
||||
if (hr != S_OK) {
|
||||
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig0, (LPVOID *)&policyConfig);
|
||||
hr = CoCreateInstance(__uuidof(CPolicyConfigClient), NULL, CLSCTX_INPROC, IID_IPolicyConfig0, (LPVOID *)&var_policyConfig);
|
||||
}
|
||||
if (hr != S_OK) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return policyConfig;
|
||||
return var_policyConfig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#include "KeyboardInputDummy.h"
|
||||
|
||||
// Used to get the compiler to shut up about C4100: unreferenced formal parameter.
|
||||
// The cast is to get GCC to shut up about it.
|
||||
#define UNREFERENCED_PARAMETER(P) static_cast<void>((P))
|
||||
|
||||
namespace advsettings {
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardInput(QString input)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(input);
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardEnter()
|
||||
@@ -13,6 +18,12 @@ void KeyboardInputDummy::sendKeyboardEnter()
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardBackspace(int count)
|
||||
{
|
||||
// noop
|
||||
UNREFERENCED_PARAMETER(count);
|
||||
}
|
||||
|
||||
void KeyboardInputDummy::sendKeyboardAltTab()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
virtual void sendKeyboardInput(QString input) override;
|
||||
virtual void sendKeyboardEnter() override;
|
||||
virtual void sendKeyboardBackspace(int count) override;
|
||||
virtual void sendKeyboardAltTab() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,30 @@ void fillKiStruct(INPUT& ip, WORD scanCode, bool keyup) {
|
||||
ip.ki.time = 0;
|
||||
};
|
||||
|
||||
void sendKeyboardInputRaw(int inputCount, LPINPUT input) {
|
||||
if ((inputCount > 0) && !SendInput(static_cast<UINT>(inputCount), input, sizeof(INPUT))) {
|
||||
char *err;
|
||||
auto errCode = GetLastError();
|
||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
nullptr,
|
||||
errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
|
||||
reinterpret_cast<LPTSTR>(&err),
|
||||
0,
|
||||
nullptr)){
|
||||
LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
|
||||
} else {
|
||||
LOG(ERROR) << "Error calling SendInput(): " << err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardInputWindows::sendKeyboardInput(QString input)
|
||||
{
|
||||
int len = input.length();
|
||||
if (len > 0) {
|
||||
LPINPUT ips = new INPUT[len * 5 + 3];
|
||||
unsigned ii = 0;
|
||||
LPINPUT ips = new INPUT[static_cast<unsigned int>(len) * 5 + 3];
|
||||
int ii = 0;
|
||||
bool shiftPressed = false;
|
||||
bool ctrlPressed = false;
|
||||
bool altPressed = false;
|
||||
@@ -69,22 +87,9 @@ void KeyboardInputWindows::sendKeyboardInput(QString input)
|
||||
fillKiStruct(ips[ii++], VK_MENU, true);
|
||||
altPressed = false;
|
||||
}
|
||||
if (!SendInput(ii, ips, sizeof(INPUT))) {
|
||||
char *err;
|
||||
auto errCode = GetLastError();
|
||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
|
||||
(LPTSTR)&err,
|
||||
0,
|
||||
NULL)){
|
||||
LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
|
||||
} else {
|
||||
LOG(ERROR) << "Error calling SendInput(): " << err;
|
||||
}
|
||||
}
|
||||
delete ips;
|
||||
|
||||
sendKeyboardInputRaw(ii, ips);
|
||||
delete[] ips;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,49 +98,37 @@ void KeyboardInputWindows::sendKeyboardEnter()
|
||||
LPINPUT ips = new INPUT[2];
|
||||
fillKiStruct(ips[0], VK_RETURN, false);
|
||||
fillKiStruct(ips[1], VK_RETURN, true);
|
||||
if (!SendInput(2, ips, sizeof(INPUT))) {
|
||||
char *err;
|
||||
auto errCode = GetLastError();
|
||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
|
||||
(LPTSTR)&err,
|
||||
0,
|
||||
NULL)) {
|
||||
LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
|
||||
} else {
|
||||
LOG(ERROR) << "Error calling SendInput(): " << err;
|
||||
}
|
||||
}
|
||||
delete ips;
|
||||
|
||||
sendKeyboardInputRaw(2, ips);
|
||||
delete[] ips;
|
||||
}
|
||||
|
||||
void KeyboardInputWindows::sendKeyboardBackspace(int count)
|
||||
{
|
||||
if (count > 0) {
|
||||
LPINPUT ips = new INPUT[count * 2];
|
||||
// We ensure that count is nonnegative, therefore safe cast.
|
||||
LPINPUT ips = new INPUT[static_cast<unsigned int>(count) * 2];
|
||||
for (int i = 0; i < count; i++) {
|
||||
fillKiStruct(ips[2 * i], VK_BACK, false);
|
||||
fillKiStruct(ips[2 * i + 1], VK_BACK, true);
|
||||
}
|
||||
if (!SendInput(2 * count, ips, sizeof(INPUT))) {
|
||||
char *err;
|
||||
auto errCode = GetLastError();
|
||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
errCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
|
||||
(LPTSTR)&err,
|
||||
0,
|
||||
NULL)) {
|
||||
LOG(ERROR) << "Error calling SendInput(): Could not get error message (" << errCode << ")";
|
||||
} else {
|
||||
LOG(ERROR) << "Error calling SendInput(): " << err;
|
||||
}
|
||||
}
|
||||
delete ips;
|
||||
|
||||
sendKeyboardInputRaw(count * 2, ips);
|
||||
delete[] ips;
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardInputWindows::sendKeyboardAltTab()
|
||||
{
|
||||
LPINPUT ips = new INPUT[4];
|
||||
// VK_MENU is alt
|
||||
fillKiStruct(ips[0], VK_MENU, false);
|
||||
fillKiStruct(ips[1], VK_TAB, false);
|
||||
fillKiStruct(ips[2], VK_TAB, true);
|
||||
fillKiStruct(ips[3], VK_MENU, true);
|
||||
|
||||
sendKeyboardInputRaw(4, ips);
|
||||
delete[] ips;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
virtual void sendKeyboardInput(QString input) override;
|
||||
virtual void sendKeyboardEnter() override;
|
||||
virtual void sendKeyboardBackspace(int count) override;
|
||||
virtual void sendKeyboardAltTab() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user