mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 03:06:39 +02:00
tell desktop about preference changes
This commit is contained in:
parent
6aad78c8e8
commit
3a072b5bf9
4 changed files with 19 additions and 5 deletions
|
@ -51,19 +51,24 @@ OriginalDesktop.Desktop {
|
||||||
Toolbar {
|
Toolbar {
|
||||||
id: sysToolbar;
|
id: sysToolbar;
|
||||||
objectName: "com.highfidelity.interface.toolbar.system";
|
objectName: "com.highfidelity.interface.toolbar.system";
|
||||||
anchors.horizontalCenter: settings.systemToolbarHorizontalConstraint ? desktop.horizontalCenter : undefined;
|
anchors.horizontalCenter: settings.constrainToolbarToCenterX ? desktop.horizontalCenter : undefined;
|
||||||
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
|
// Literal 50 is overwritten by settings from previous session, and sysToolbar.x comes from settings when not constrained.
|
||||||
x: sysToolbar.x
|
x: sysToolbar.x
|
||||||
y: 50
|
y: 50
|
||||||
}
|
}
|
||||||
|
Settings {
|
||||||
|
id: settings;
|
||||||
|
category: "toolbar";
|
||||||
|
property bool constrainToolbarToCenterX: true;
|
||||||
|
}
|
||||||
|
function setConstrainToolbarToCenterX(constrain) { // Learn about c++ preference change.
|
||||||
|
settings.constrainToolbarToCenterX = constrain;
|
||||||
|
}
|
||||||
property var toolbars: (function (map) { // answer dictionary preloaded with sysToolbar
|
property var toolbars: (function (map) { // answer dictionary preloaded with sysToolbar
|
||||||
map[sysToolbar.objectName] = sysToolbar;
|
map[sysToolbar.objectName] = sysToolbar;
|
||||||
return map; })({});
|
return map; })({});
|
||||||
|
|
||||||
Settings {
|
|
||||||
id: settings
|
|
||||||
property bool systemToolbarHorizontalConstraint: true
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
WebEngine.settings.javascriptCanOpenWindows = true;
|
WebEngine.settings.javascriptCanOpenWindows = true;
|
||||||
WebEngine.settings.javascriptCanAccessClipboard = false;
|
WebEngine.settings.javascriptCanAccessClipboard = false;
|
||||||
|
|
|
@ -2153,6 +2153,7 @@ void Application::setFieldOfView(float fov) {
|
||||||
|
|
||||||
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
void Application::setSettingConstrainToolbarPosition(bool setting) {
|
||||||
_constrainToolbarPosition.set(setting);
|
_constrainToolbarPosition.set(setting);
|
||||||
|
DependencyManager::get<OffscreenUi>()->setConstrainToolbarToCenterX(setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::aboutApp() {
|
void Application::aboutApp() {
|
||||||
|
|
|
@ -371,6 +371,13 @@ void OffscreenUi::setPinned(bool pinned) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffscreenUi::setConstrainToolbarToCenterX(bool constrained) {
|
||||||
|
bool invokeResult = QMetaObject::invokeMethod(_desktop, "setConstrainToolbarToCenterX", Q_ARG(QVariant, constrained));
|
||||||
|
if (!invokeResult) {
|
||||||
|
qWarning() << "Failed to set toolbar constraint";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OffscreenUi::addMenuInitializer(std::function<void(VrMenu*)> f) {
|
void OffscreenUi::addMenuInitializer(std::function<void(VrMenu*)> f) {
|
||||||
if (!_vrMenu) {
|
if (!_vrMenu) {
|
||||||
_queuedMenuInitializers.push_back(f);
|
_queuedMenuInitializers.push_back(f);
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
void setPinned(bool pinned = true);
|
void setPinned(bool pinned = true);
|
||||||
|
|
||||||
void togglePinned();
|
void togglePinned();
|
||||||
|
void setConstrainToolbarToCenterX(bool constrained);
|
||||||
|
|
||||||
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||||
void addMenuInitializer(std::function<void(VrMenu*)> f);
|
void addMenuInitializer(std::function<void(VrMenu*)> f);
|
||||||
|
|
Loading…
Reference in a new issue