diff --git a/src/res/img/video/dimmer.png b/src/res/img/video/dimmer.png new file mode 100644 index 0000000..7c2f6a1 Binary files /dev/null and b/src/res/img/video/dimmer.png differ diff --git a/src/tabcontrollers/VideoTabController.cpp b/src/tabcontrollers/VideoTabController.cpp new file mode 100644 index 0000000..b833ef6 --- /dev/null +++ b/src/tabcontrollers/VideoTabController.cpp @@ -0,0 +1,89 @@ +#include "VideoTabController.h" +#include +#include +#include "../overlaycontroller.h" + +namespace advsettings +{ + void VideoTabController::initStage1() + { + reloadVideoConfig(); + } + +//TODO args + void VideoTabController::initStage2(OverlayController* var_parent, + QQuickWindow* var_widget) + { + this->parent = var_parent; + this->widget = var_widget; + + std::string notifKey = std::string(application_strings::applicationKey) + + ".dimnotification"; + + vr::VROverlayError overlayError = vr::VROverlay()->CreateOverlay( + notifKey.c_str(), notifKey.c_str(), &m_brightnessNotificationOverlayHandle); + if (overlayError == vr::VROverlayError_None) + { + constexpr auto notificationIconFilename + = "/res/img/video/dimmer.png"; + const auto notifIconPath + = paths::binaryDirectoryFindFile(notificationIconFilename); + if (notifIconPath.has_value()) + { + vr::VROverlay()->SetOverlayFromFile(m_brightnessNotificationOverlayHandle, + notifIconPath->c_str()); + vr::VROverlay()->SetOverlayWidthInMeters( + m_ulNotificationOverlayHandle, 1.0f); + vr::HmdMatrix34_t notificationTransform + = { { { 1.0f, 0.0f, 0.0f, 0.00f }, + { 0.0f, 1.0f, 0.0f, 0.00f }, + { 0.0f, 0.0f, 1.0f, -0.3f } } }; + vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative( + m_brightnessNotificationOverlayHandle, + vr::k_unTrackedDeviceIndex_Hmd, + ¬ificationTransform); + } + else + { + LOG(ERROR) << "Could not find notification icon \"" + << notificationIconFilename << "\""; + } + } + else + { + LOG(ERROR) << "Could not create ptt notification overlay: " + << vr::VROverlay()->GetOverlayErrorNameFromEnum( + overlayError); + } + emit defaultProfileDisplay(); + */ + } + + void VideoTabController::eventLoopTick() + { + + } + + void VideoTabController::reloadVideoConfig() { + //Others Use Mutex needed? + auto settings = OverlayController::appSettings(); + settings->beginGroup(getSettingsName()); + + //TODO might need emit params + setBrightnessEnabled(settings->value("brightnessEnabled", false).toBool()); + setBrightnessLevel(settings->value("brightnessValue", 100).toFloat()); + settings->endGroup(); + + } + + void VideoTabController::saveVideoConfig() { + auto settings = OverlayController::appSettings(); + settings->beginGroup(getSettingsName()); + + settings->setValue("brightnessEnabled", brightnessEnabled()); + settings->setValue("brightnessValue", brightnessValue()); + } + void VideoTabController::saveVideoConfig() { + + } +} \ No newline at end of file diff --git a/src/tabcontrollers/VideoTabController.h b/src/tabcontrollers/VideoTabController.h new file mode 100644 index 0000000..46cc99e --- /dev/null +++ b/src/tabcontrollers/VideoTabController.h @@ -0,0 +1,41 @@ +#pragma once + +namespace advsettings { + + Q_OBJECT + Q_PROPERTY(int playbackDeviceIndex READ playbackDeviceIndex WRITE + setPlaybackDeviceIndex NOTIFY playbackDeviceIndexChanged) + Q_PROPERTY(int mirrorDeviceIndex READ mirrorDeviceIndex WRITE + setMirrorDeviceIndex NOTIFY mirrorDeviceIndexChanged) + +private: + //TODO + constexpr auto notificationBrightnessFilename + = "todo"; + vr::VROverlayHandle_t m_brightnessNotificationOverlayHandle + = vr::k_ulOverlayHandleInvalid; + float m_brightnessValue = 1.0; + bool m_brightnessEnabled = false; + + void reloadVideoConfig(); + void saveVideoConfig(); + + + QString getSettingsName() override + { + return "videoSettings"; + } + + vr::VROverlayHandle_t getBrightnessOverlayHandle() + { + return m_brightnessNotificationOverlayHandle; + } + + +public: + + void initStage1(); + //TODO ?? on args + void initStage2(OverlayController* var_parent, QQuickWindow* var_widget); + +} \ No newline at end of file