mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Break up preferences dialogs
This commit is contained in:
parent
e3f861b20a
commit
bbefafcb07
19 changed files with 123 additions and 47 deletions
|
@ -3,19 +3,19 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import "../../controls" as HifiControls
|
import "../controls" as HifiControls
|
||||||
import "../../windows"
|
import "../windows"
|
||||||
import "./preferences"
|
import "preferences"
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
objectName: "PreferencesDialog"
|
|
||||||
title: "Preferences"
|
title: "Preferences"
|
||||||
resizable: true
|
resizable: true
|
||||||
destroyOnInvisible: true
|
destroyOnInvisible: true
|
||||||
width: 500
|
width: 500
|
||||||
height: 577
|
height: 577
|
||||||
property var sections: []
|
property var sections: []
|
||||||
|
property var showCategories: []
|
||||||
|
|
||||||
function saveAll() {
|
function saveAll() {
|
||||||
for (var i = 0; i < sections.length; ++i) {
|
for (var i = 0; i < sections.length; ++i) {
|
||||||
|
@ -38,12 +38,6 @@ Window {
|
||||||
clip: true
|
clip: true
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
Settings {
|
|
||||||
category: "Overlay.Preferences"
|
|
||||||
property alias x: root.x
|
|
||||||
property alias y: root.y
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: sectionBuilder
|
id: sectionBuilder
|
||||||
Section { }
|
Section { }
|
||||||
|
@ -51,8 +45,21 @@ Window {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var categories = Preferences.categories;
|
var categories = Preferences.categories;
|
||||||
for (var i = 0; i < categories.length; ++i) {
|
var categoryMap;
|
||||||
|
var i;
|
||||||
|
if (showCategories && showCategories.length) {
|
||||||
|
categoryMap = {};
|
||||||
|
for (i = 0; i < showCategories.length; ++i) {
|
||||||
|
categoryMap[showCategories[i]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < categories.length; ++i) {
|
||||||
var category = categories[i];
|
var category = categories[i];
|
||||||
|
if (categoryMap && !categoryMap[category]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sections.push(sectionBuilder.createObject(prefControls, { name: category }));
|
sections.push(sectionBuilder.createObject(prefControls, { name: category }));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,9 +2,9 @@ import QtQuick 2.3
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
import QtWebEngine 1.1
|
import QtWebEngine 1.1
|
||||||
|
|
||||||
import "../../../windows" as Windows
|
import "../../windows" as Windows
|
||||||
import "../../../controls" as Controls
|
import "../../controls" as Controls
|
||||||
import "../../../styles"
|
import "../../styles"
|
||||||
|
|
||||||
Windows.Window {
|
Windows.Window {
|
||||||
id: root
|
id: root
|
|
@ -1,8 +1,6 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
|
||||||
import "../../../dialogs"
|
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
property alias buttonText: button.text
|
property alias buttonText: button.text
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
|
||||||
import "../../../dialogs"
|
import "../../dialogs"
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
|
@ -1,9 +1,6 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4 as Original
|
||||||
|
|
||||||
import "."
|
|
||||||
import "../../../dialogs"
|
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
height: button.height
|
height: button.height
|
|
@ -1,6 +1,5 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4
|
||||||
import "."
|
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
|
@ -16,7 +15,7 @@ Preference {
|
||||||
preference.save();
|
preference.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
Original.CheckBox {
|
CheckBox {
|
||||||
id: checkBox
|
id: checkBox
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: root.label
|
text: root.label
|
|
@ -2,7 +2,7 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
|
|
||||||
import "../../../controls" as VrControls
|
import "../../controls" as VrControls
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
Preference {
|
Preference {
|
|
@ -1,7 +1,5 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4
|
||||||
|
|
||||||
import "."
|
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
|
@ -17,14 +15,13 @@ Preference {
|
||||||
preference.save();
|
preference.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: root.label
|
text: root.label
|
||||||
color: enabled ? "black" : "gray"
|
color: enabled ? "black" : "gray"
|
||||||
anchors.verticalCenter: slider.verticalCenter
|
anchors.verticalCenter: slider.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Original.Slider {
|
Slider {
|
||||||
id: slider
|
id: slider
|
||||||
value: preference.value
|
value: preference.value
|
||||||
width: 130
|
width: 130
|
|
@ -1,13 +1,11 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4 as Original
|
import QtQuick.Controls 1.4
|
||||||
import "."
|
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
property alias spinner: spinner
|
property alias spinner: spinner
|
||||||
height: spinner.height
|
height: spinner.height
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
spinner.value = preference.value;
|
spinner.value = preference.value;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +21,7 @@ Preference {
|
||||||
anchors.verticalCenter: spinner.verticalCenter
|
anchors.verticalCenter: spinner.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Original.SpinBox {
|
SpinBox {
|
||||||
id: spinner
|
id: spinner
|
||||||
decimals: preference.decimals
|
decimals: preference.decimals
|
||||||
minimumValue: preference.min
|
minimumValue: preference.min
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
|
import "../../dialogs"
|
||||||
|
|
||||||
|
PreferencesDialog {
|
||||||
|
id: root
|
||||||
|
objectName: "AudioPreferencesDialog"
|
||||||
|
title: "Audio Preferences"
|
||||||
|
showCategories: ["Audio"]
|
||||||
|
property var settings: Settings {
|
||||||
|
category: root.objectName
|
||||||
|
property alias x: root.x
|
||||||
|
property alias y: root.y
|
||||||
|
property alias width: root.width
|
||||||
|
property alias height: root.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
|
import "../../dialogs"
|
||||||
|
|
||||||
|
PreferencesDialog {
|
||||||
|
id: root
|
||||||
|
objectName: "AvatarPreferencesDialog"
|
||||||
|
title: "Avatar Preferences"
|
||||||
|
showCategories: [ "Avatar Basics", "Avatar Tuning" ]
|
||||||
|
property var settings: Settings {
|
||||||
|
category: root.objectName
|
||||||
|
property alias x: root.x
|
||||||
|
property alias y: root.y
|
||||||
|
property alias width: root.width
|
||||||
|
property alias height: root.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
|
import "../../dialogs"
|
||||||
|
|
||||||
|
PreferencesDialog {
|
||||||
|
id: root
|
||||||
|
objectName: "GeneralPreferencesDialog"
|
||||||
|
title: "General Preferences"
|
||||||
|
showCategories: ["Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers"]
|
||||||
|
property var settings: Settings {
|
||||||
|
category: root.objectName
|
||||||
|
property alias x: root.x
|
||||||
|
property alias y: root.y
|
||||||
|
property alias width: root.width
|
||||||
|
property alias height: root.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
|
import "../../dialogs"
|
||||||
|
|
||||||
|
PreferencesDialog {
|
||||||
|
id: root
|
||||||
|
objectName: "LodPreferencesDialog"
|
||||||
|
title: "Level of Detail preferences"
|
||||||
|
showCategories: ["Level of Detail Tuning"]
|
||||||
|
property var settings: Settings {
|
||||||
|
category: root.objectName
|
||||||
|
property alias x: root.x
|
||||||
|
property alias y: root.y
|
||||||
|
property alias width: root.width
|
||||||
|
property alias height: root.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -285,20 +285,29 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menus", 0, false, this, SLOT(toggleDeveloperMenus()));
|
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menus", 0, false, this, SLOT(toggleDeveloperMenus()));
|
||||||
|
|
||||||
// Settings > General...
|
// Settings > General...
|
||||||
addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_Comma,
|
auto action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_Comma, nullptr, nullptr, QAction::PreferencesRole);
|
||||||
dialogsManager.data(), SLOT(editPreferences()), QAction::PreferencesRole);
|
connect(action, &QAction::triggered, [] {
|
||||||
|
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/GeneralPreferencesDialog.qml"), "GeneralPreferencesDialog");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Settings > Avatar...-- FIXME: needs implementation
|
// Settings > Avatar...-- FIXME: needs implementation
|
||||||
auto avatarAction = addActionToQMenuAndActionHash(settingsMenu, "Avatar...");
|
action = addActionToQMenuAndActionHash(settingsMenu, "Avatar...");
|
||||||
avatarAction->setDisabled(true);
|
connect(action, &QAction::triggered, [] {
|
||||||
|
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AvatarPreferencesDialog.qml"), "AvatarPreferencesDialog");
|
||||||
|
});
|
||||||
|
|
||||||
// Settings > Audio...-- FIXME: needs implementation
|
// Settings > Audio...-- FIXME: needs implementation
|
||||||
auto audioAction = addActionToQMenuAndActionHash(settingsMenu, "Audio...");
|
action = addActionToQMenuAndActionHash(settingsMenu, "Audio...");
|
||||||
audioAction->setDisabled(true);
|
connect(action, &QAction::triggered, [] {
|
||||||
|
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AudioPreferencesDialog.qml"), "AudioPreferencesDialog");
|
||||||
|
});
|
||||||
|
|
||||||
// Settings > LOD...-- FIXME: needs implementation
|
// Settings > LOD...-- FIXME: needs implementation
|
||||||
auto lodAction = addActionToQMenuAndActionHash(settingsMenu, "LOD...");
|
action = addActionToQMenuAndActionHash(settingsMenu, "LOD...");
|
||||||
lodAction->setDisabled(true);
|
connect(action, &QAction::triggered, [] {
|
||||||
|
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/LodPreferencesDialog.qml"), "LodPreferencesDialog");
|
||||||
|
});
|
||||||
|
|
||||||
// Settings > Control with Speech [advanced]
|
// Settings > Control with Speech [advanced]
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
|
|
|
@ -91,10 +91,6 @@ void DialogsManager::cachesSizeDialog() {
|
||||||
_cachesSizeDialog->raise();
|
_cachesSizeDialog->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsManager::editPreferences() {
|
|
||||||
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/PreferencesDialog.qml"), "PreferencesDialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogsManager::editAttachments() {
|
void DialogsManager::editAttachments() {
|
||||||
if (!_attachmentsDialog) {
|
if (!_attachmentsDialog) {
|
||||||
maybeCreateDialog(_attachmentsDialog);
|
maybeCreateDialog(_attachmentsDialog);
|
||||||
|
|
|
@ -48,7 +48,6 @@ public slots:
|
||||||
void showLoginDialog();
|
void showLoginDialog();
|
||||||
void octreeStatsDetails();
|
void octreeStatsDetails();
|
||||||
void cachesSizeDialog();
|
void cachesSizeDialog();
|
||||||
void editPreferences();
|
|
||||||
void editAttachments();
|
void editAttachments();
|
||||||
void audioStatsDetails();
|
void audioStatsDetails();
|
||||||
void bandwidthDetails();
|
void bandwidthDetails();
|
||||||
|
|
|
@ -131,7 +131,7 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
|
|
||||||
load(url, f);
|
load(url, f);
|
||||||
item = getRootItem()->findChild<QQuickItem*>(name);
|
item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
if (!item->isVisible()) {
|
if (item && !item->isVisible()) {
|
||||||
item->setVisible(true);
|
item->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue