dimmer in-prog
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
#include "VideoTabController.h"
|
||||
#include <QQuickWindow>
|
||||
#include <QApplication>
|
||||
#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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user