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