History

Fixes to problems with meta-types

ksuprynowicz committed 4 years ago

Commit 50a6a631 parent 33c86078 files · +43 −15Browse files

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

Unified · Split

interface/src/scripting/PerformanceScriptingInterface.cpp+12−2
@@ -1,6 +1,7 @@
1//1//
2// Created by Bradley Austin Davis on 2019/05/142// 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.html7// 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
17STATIC_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
14std::once_flag PerformanceScriptingInterface::registry_flag;24std::once_flag PerformanceScriptingInterface::registry_flag;
15 25
16PerformanceScriptingInterface::PerformanceScriptingInterface() {26PerformanceScriptingInterface::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