History

Add scripting to set the refresh rate

Brad Davis committed 7 years ago

Commit 5db78ef1 parent ec11d705 files · +77 −6Browse files

Showing the changes to interface/src/scripting/PerformanceScriptingInterface.cpp (1 of 5 files). Show all

Unified · Split

interface/src/scripting/PerformanceScriptingInterface.cpp+28−0
@@ -0,0 +1,28 @@
1+//
2+// Created by Bradley Austin Davis on 2019/05/14
3+// Copyright 2013-2019 High Fidelity, Inc.
4+//
5+// Distributed under the Apache License, Version 2.0.
6+// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7+//
8+
9+
10+#include "PerformanceScriptingInterface.h"
11+
12+#include "../Application.h"
13+
14+std::once_flag PerformanceScriptingInterface::registry_flag;
15+
16+PerformanceScriptingInterface::PerformanceScriptingInterface() {
17+ std::call_once(registry_flag, [] {
18+ qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "RefreshRate");
19+ });
20+}
21+
22+void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile refreshRateProfile) {
23+ qApp->getRefreshRateManager().setRefreshRateProfile((RefreshRateManager::RefreshRateProfile)refreshRateProfile);
24+}
25+
26+PerformanceScriptingInterface::RefreshRateProfile PerformanceScriptingInterface::getRefreshRateProfile() const {
27+ return (PerformanceScriptingInterface::RefreshRateProfile)qApp->getRefreshRateManager().getRefreshRateProfile();
28+}