Showing the changes to interface/src/scripting/PerformanceScriptingInterface.cpp (1 of 8 files). Show all
Unified · Split
| @@ -1,6 +1,7 @@ | |||
| 1 | // | 1 | // |
| 2 | // Created by Bradley Austin Davis on 2019/05/14 | 2 | // Created by Bradley Austin Davis on 2019/05/14 |
| 3 | // Copyright 2013-2019 High Fidelity, Inc. | 3 | // Copyright 2013-2019 High Fidelity, Inc. |
| 4 | // Copyright 2022 Overte e.V. | ||
| 4 | // | 5 | // |
| 5 | // Distributed under the Apache License, Version 2.0. | 6 | // 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 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| @@ -9,15 +10,24 @@ · 2 unmodified lines | |||
| 9 | 10 | ||
| 10 | #include "PerformanceScriptingInterface.h" | 11 | #include "PerformanceScriptingInterface.h" |
| 11 | 12 | ||
| 13 | #include <ScriptEngineCast.h> | ||
| 14 | |||
| 12 | #include "../Application.h" | 15 | #include "../Application.h" |
| 13 | 16 | ||
| 17 | STATIC_SCRIPT_INITIALIZER(+[](ScriptManager* manager){ | ||
| 18 | auto scriptEngine = manager->engine().get(); | ||
| 19 | |||
| 20 | scriptRegisterMetaType(scriptEngine, scriptValueFromEnumClass<PerformanceScriptingInterface::PerformancePreset>, scriptValueToEnumClass<PerformanceScriptingInterface::PerformancePreset>, "PerformancePreset"); | ||
| 21 | scriptRegisterMetaType(scriptEngine, scriptValueFromEnumClass<PerformanceScriptingInterface::RefreshRateProfile>, scriptValueToEnumClass<PerformanceScriptingInterface::RefreshRateProfile>, "RefreshRateProfile"); | ||
| 22 | }); | ||
| 23 | |||
| 14 | std::once_flag PerformanceScriptingInterface::registry_flag; | 24 | std::once_flag PerformanceScriptingInterface::registry_flag; |
| 15 | 25 | ||
| 16 | PerformanceScriptingInterface::PerformanceScriptingInterface() { | 26 | PerformanceScriptingInterface::PerformanceScriptingInterface() { |
| 17 | std::call_once(registry_flag, [] { | 27 | std::call_once(registry_flag, [] { |
| 18 | qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "PerformanceEnums"); | 28 | qmlRegisterType<PerformanceScriptingInterface>("PerformanceEnums", 1, 0, "PerformanceEnums"); |
| 19 | qRegisterMetaType<PerformanceScriptingInterface::PerformancePreset>("PerformanceScriptingInterface::PerformancePreset"); | 29 | //qRegisterMetaType<PerformanceScriptingInterface::PerformancePreset>("PerformanceScriptingInterface::PerformancePreset"); |
| 20 | qRegisterMetaType<PerformanceScriptingInterface::RefreshRateProfile>("PerformanceScriptingInterface::RefreshRateProfile"); | 30 | //qRegisterMetaType<PerformanceScriptingInterface::RefreshRateProfile>("PerformanceScriptingInterface::RefreshRateProfile"); |
| 21 | }); | 31 | }); |
| 22 | } | 32 | } |
| 23 | 33 | ||