remoed no more used LOD dialogs. Fixed Slider properties min and max settings

This commit is contained in:
vladest 2018-05-12 16:01:43 +02:00
parent 0a67fc3b36
commit f8ebe7e669
13 changed files with 213 additions and 418 deletions

View file

@ -53,6 +53,8 @@ Preference {
Slider { Slider {
id: slider id: slider
value: preference.value value: preference.value
minimumValue: preference.min
maximumValue: preference.max
width: 130 width: 130
anchors { anchors {
right: parent.right right: parent.right

View file

@ -14,6 +14,24 @@ import "../../styles-uit"
import "../../controls" import "../../controls"
import "../../controls-uit" as HifiControls import "../../controls-uit" as HifiControls
import "../../dialogs" import "../../dialogs"
import "../../dialogs/preferences"
PreferencesDialog {
id: root
objectName: "ControlSettings"
title: "Control Settings"
showCategories: ["VR Movement", inputConfigurationComponents]
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
}
Component {
id: inputConfigurationComponents
Preference {
StackView { StackView {
id: stack id: stack
@ -58,7 +76,6 @@ StackView {
anchors.topMargin: 20 anchors.topMargin: 20
} }
Separator { Separator {
id: headerSeparator id: headerSeparator
width: inputConfiguration.width width: inputConfiguration.width
@ -229,3 +246,6 @@ StackView {
timer.start(); timer.start();
} }
} }
}
}
}

View file

@ -3690,8 +3690,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
Menu::getInstance()->triggerOption(MenuOption::Log); Menu::getInstance()->triggerOption(MenuOption::Log);
} else if (isMeta) { } else if (isMeta) {
Menu::getInstance()->triggerOption(MenuOption::AddressBar); Menu::getInstance()->triggerOption(MenuOption::AddressBar);
} else if (isShifted) {
Menu::getInstance()->triggerOption(MenuOption::LodTools);
} }
break; break;
@ -7509,18 +7507,6 @@ SharedSoundPointer Application::getSampleSound() const {
return _sampleSound; return _sampleSound;
} }
void Application::loadLODToolsDialog() {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
if (tablet->getToolbarMode() || (!tablet->getTabletRoot() && !isHMDMode())) {
auto dialogsManager = DependencyManager::get<DialogsManager>();
dialogsManager->lodTools();
} else {
tablet->pushOntoStack("hifi/dialogs/TabletLODTools.qml");
}
}
void Application::loadEntityStatisticsDialog() { void Application::loadEntityStatisticsDialog() {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET)); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));

View file

@ -65,7 +65,6 @@
#include "scripting/DialogsManagerScriptingInterface.h" #include "scripting/DialogsManagerScriptingInterface.h"
#include "ui/ApplicationOverlay.h" #include "ui/ApplicationOverlay.h"
#include "ui/EntityScriptServerLogDialog.h" #include "ui/EntityScriptServerLogDialog.h"
#include "ui/LodToolsDialog.h"
#include "ui/LogDialog.h" #include "ui/LogDialog.h"
#include "ui/OctreeStatsDialog.h" #include "ui/OctreeStatsDialog.h"
#include "ui/OverlayConductor.h" #include "ui/OverlayConductor.h"
@ -403,7 +402,6 @@ public slots:
void addAssetToWorldMessageClose(); void addAssetToWorldMessageClose();
void loadLODToolsDialog();
void loadEntityStatisticsDialog(); void loadEntityStatisticsDialog();
void loadDomainConnectionDialog(); void loadDomainConnectionDialog();
void showScriptLogs(); void showScriptLogs();

View file

@ -122,10 +122,7 @@ void LODManager::autoAdjustLOD(float realTimeDelta) {
} }
if (oldOctreeSizeScale != _octreeSizeScale) { if (oldOctreeSizeScale != _octreeSizeScale) {
auto lodToolsDialog = DependencyManager::get<DialogsManager>()->getLodToolsDialog(); //TODO: check Preferences dialog
if (lodToolsDialog) {
lodToolsDialog->reloadSliders();
}
} }
} }

View file

@ -469,10 +469,6 @@ Menu::Menu() {
}); });
} }
// Developer > Render > LOD Tools
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, 0,
qApp, SLOT(loadLODToolsDialog()));
// HACK enable texture decimation // HACK enable texture decimation
{ {
auto action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, "Decimate Textures"); auto action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, "Decimate Textures");

View file

@ -121,7 +121,6 @@ namespace MenuOption {
const QString ActionMotorControl = "Enable Default Motor Control"; const QString ActionMotorControl = "Enable Default Motor Control";
const QString LoadScript = "Open and Run Script File..."; const QString LoadScript = "Open and Run Script File...";
const QString LoadScriptURL = "Open and Run Script from URL..."; const QString LoadScriptURL = "Open and Run Script from URL...";
const QString LodTools = "LOD Tools";
const QString Login = "Login/Sign Up"; const QString Login = "Login/Sign Up";
const QString Log = "Log"; const QString Log = "Log";
const QString LogExtraTimings = "Log Extra Timing Details"; const QString LogExtraTimings = "Log Extra Timing Details";

View file

@ -23,7 +23,6 @@
#include "ConnectionFailureDialog.h" #include "ConnectionFailureDialog.h"
#include "DomainConnectionDialog.h" #include "DomainConnectionDialog.h"
#include "HMDToolsDialog.h" #include "HMDToolsDialog.h"
#include "LodToolsDialog.h"
#include "LoginDialog.h" #include "LoginDialog.h"
#include "OctreeStatsDialog.h" #include "OctreeStatsDialog.h"
#include "PreferencesDialog.h" #include "PreferencesDialog.h"
@ -126,16 +125,6 @@ void DialogsManager::octreeStatsDetails() {
_octreeStatsDialog->raise(); _octreeStatsDialog->raise();
} }
void DialogsManager::lodTools() {
if (!_lodToolsDialog) {
maybeCreateDialog(_lodToolsDialog);
connect(_lodToolsDialog, SIGNAL(closed()), _lodToolsDialog, SLOT(deleteLater()));
_lodToolsDialog->show();
}
_lodToolsDialog->raise();
}
void DialogsManager::hmdTools(bool showTools) { void DialogsManager::hmdTools(bool showTools) {
if (showTools) { if (showTools) {
if (!_hmdToolsDialog) { if (!_hmdToolsDialog) {

View file

@ -22,7 +22,6 @@
class AnimationsDialog; class AnimationsDialog;
class AttachmentsDialog; class AttachmentsDialog;
class CachesSizeDialog; class CachesSizeDialog;
class LodToolsDialog;
class OctreeStatsDialog; class OctreeStatsDialog;
class ScriptEditorWindow; class ScriptEditorWindow;
class TestingDialog; class TestingDialog;
@ -35,7 +34,6 @@ class DialogsManager : public QObject, public Dependency {
public: public:
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; } QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; } QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; } QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; }
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
@ -49,7 +47,6 @@ public slots:
void toggleLoginDialog(); void toggleLoginDialog();
void showLoginDialog(); void showLoginDialog();
void octreeStatsDetails(); void octreeStatsDetails();
void lodTools();
void hmdTools(bool showTools); void hmdTools(bool showTools);
void showDomainConnectionDialog(); void showDomainConnectionDialog();
void showTestingResults(); void showTestingResults();
@ -76,7 +73,6 @@ private:
QPointer<CachesSizeDialog> _cachesSizeDialog; QPointer<CachesSizeDialog> _cachesSizeDialog;
QPointer<QMessageBox> _ircInfoBox; QPointer<QMessageBox> _ircInfoBox;
QPointer<HMDToolsDialog> _hmdToolsDialog; QPointer<HMDToolsDialog> _hmdToolsDialog;
QPointer<LodToolsDialog> _lodToolsDialog;
QPointer<OctreeStatsDialog> _octreeStatsDialog; QPointer<OctreeStatsDialog> _octreeStatsDialog;
QPointer<TestingDialog> _testingDialog; QPointer<TestingDialog> _testingDialog;
QPointer<DomainConnectionDialog> _domainConnectionDialog; QPointer<DomainConnectionDialog> _domainConnectionDialog;

View file

@ -83,9 +83,6 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
if (dialogsManager->getOctreeStatsDialog()) { if (dialogsManager->getOctreeStatsDialog()) {
watchWindow(dialogsManager->getOctreeStatsDialog()->windowHandle()); watchWindow(dialogsManager->getOctreeStatsDialog()->windowHandle());
} }
if (dialogsManager->getLodToolsDialog()) {
watchWindow(dialogsManager->getLodToolsDialog()->windowHandle());
}
connect(_switchModeButton, &QPushButton::clicked, [this]{ connect(_switchModeButton, &QPushButton::clicked, [this]{
toggleHMDMode(); toggleHMDMode();

View file

@ -1,133 +0,0 @@
//
// LodToolsDialog.cpp
// interface/src/ui
//
// Created by Brad Hefta-Gaub on 7/19/13.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "LodToolsDialog.h"
#include <QCheckBox>
#include <QColor>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QFormLayout>
#include <QLabel>
#include <QPalette>
#include <QPushButton>
#include <QSlider>
#include <QString>
#include <LODManager.h>
#include "Menu.h"
LodToolsDialog::LodToolsDialog(QWidget* parent) :
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
{
this->setWindowTitle("LOD Tools");
auto lodManager = DependencyManager::get<LODManager>();
// Create layouter
QFormLayout* form = new QFormLayout(this);
// Create a label with feedback...
_feedback = new QLabel(this);
QPalette palette = _feedback->palette();
const unsigned redish = 0xfff00000;
palette.setColor(QPalette::WindowText, QColor::fromRgb(redish));
_feedback->setPalette(palette);
_feedback->setText(lodManager->getLODFeedbackText());
const int FEEDBACK_WIDTH = 350;
_feedback->setFixedWidth(FEEDBACK_WIDTH);
form->addRow("You can see... ", _feedback);
form->addRow("Manually Adjust Level of Detail:", _manualLODAdjust = new QCheckBox(this));
_manualLODAdjust->setChecked(!lodManager->getAutomaticLODAdjust());
connect(_manualLODAdjust, SIGNAL(toggled(bool)), SLOT(updateAutomaticLODAdjust()));
_lodSize = new QSlider(Qt::Horizontal, this);
const int MAX_LOD_SIZE = 2000; // ~20:4 vision -- really good.
const int MIN_LOD_SIZE = 5; // ~20:1600 vision -- really bad!
const int STEP_LOD_SIZE = 1;
const int PAGE_STEP_LOD_SIZE = 100;
const int SLIDER_WIDTH = 300;
_lodSize->setMaximum(MAX_LOD_SIZE);
_lodSize->setMinimum(MIN_LOD_SIZE);
_lodSize->setSingleStep(STEP_LOD_SIZE);
_lodSize->setTickInterval(PAGE_STEP_LOD_SIZE);
_lodSize->setTickPosition(QSlider::TicksBelow);
_lodSize->setFixedWidth(SLIDER_WIDTH);
_lodSize->setPageStep(PAGE_STEP_LOD_SIZE);
int sliderValue = lodManager->getOctreeSizeScale() / TREE_SCALE;
_lodSize->setValue(sliderValue);
form->addRow("Level of Detail:", _lodSize);
connect(_lodSize,SIGNAL(valueChanged(int)),this,SLOT(sizeScaleValueChanged(int)));
// Add a button to reset
QPushButton* resetButton = new QPushButton("Reset", this);
form->addRow("", resetButton);
connect(resetButton, SIGNAL(clicked(bool)), this, SLOT(resetClicked(bool)));
this->QDialog::setLayout(form);
updateAutomaticLODAdjust();
}
void LodToolsDialog::reloadSliders() {
auto lodManager = DependencyManager::get<LODManager>();
_lodSize->setValue(lodManager->getOctreeSizeScale() / TREE_SCALE);
_feedback->setText(lodManager->getLODFeedbackText());
}
void LodToolsDialog::updateAutomaticLODAdjust() {
auto lodManager = DependencyManager::get<LODManager>();
lodManager->setAutomaticLODAdjust(!_manualLODAdjust->isChecked());
_lodSize->setEnabled(_manualLODAdjust->isChecked());
}
void LodToolsDialog::sizeScaleValueChanged(int value) {
auto lodManager = DependencyManager::get<LODManager>();
float realValue = value * TREE_SCALE;
lodManager->setOctreeSizeScale(realValue);
_feedback->setText(lodManager->getLODFeedbackText());
}
void LodToolsDialog::resetClicked(bool checked) {
int sliderValue = DEFAULT_OCTREE_SIZE_SCALE / TREE_SCALE;
_lodSize->setValue(sliderValue);
_manualLODAdjust->setChecked(false);
updateAutomaticLODAdjust(); // tell our LOD manager about the reset
}
void LodToolsDialog::reject() {
// Just regularly close upon ESC
this->QDialog::close();
}
void LodToolsDialog::closeEvent(QCloseEvent* event) {
this->QDialog::closeEvent(event);
emit closed();
#if RESET_TO_AUTOMATIC_WHEN_YOU_CLOSE_THE_DIALOG_BOX
auto lodManager = DependencyManager::get<LODManager>();
// always revert back to automatic LOD adjustment when closed
lodManager->setAutomaticLODAdjust(true);
// if the user adjusted the LOD above "normal" then always revert back to default
if (lodManager->getOctreeSizeScale() > DEFAULT_OCTREE_SIZE_SCALE) {
lodManager->setOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE);
}
#endif
}

View file

@ -1,55 +0,0 @@
//
// LodToolsDialog.h
// interface/src/ui
//
// Created by Brad Hefta-Gaub on 7/19/13.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_LodToolsDialog_h
#define hifi_LodToolsDialog_h
#include <QDialog>
class QCheckBox;
class QDoubleSpinBox;
class QLabel;
class QSlider;
class LodToolsDialog : public QDialog {
Q_OBJECT
public:
// Sets up the UI
LodToolsDialog(QWidget* parent);
signals:
void closed();
public slots:
void reject() override;
void sizeScaleValueChanged(int value);
void resetClicked(bool checked);
void reloadSliders();
void updateAutomaticLODAdjust();
protected:
// Emits a 'closed' signal when this dialog is closed.
void closeEvent(QCloseEvent* event) override;
private:
QSlider* _lodSize;
QCheckBox* _manualLODAdjust;
QDoubleSpinBox* _desktopLODDecreaseFPS;
QDoubleSpinBox* _hmdLODDecreaseFPS;
QLabel* _feedback;
};
#endif // hifi_LodToolsDialog_h

View file

@ -73,9 +73,12 @@ void setupPreferences() {
// Graphics quality // Graphics quality
static const QString GRAPHICS_QUALITY { "Graphics Quality" }; static const QString GRAPHICS_QUALITY { "Graphics Quality" };
{ {
auto getter = []()->float { return DependencyManager::get<LODManager>()->getLODLevel(); }; auto getter = []()->float { return DependencyManager::get<LODManager>()->getOctreeSizeScale()/TREE_SCALE; };
auto setter = [](float value) { }; auto setter = [](float value) { DependencyManager::get<LODManager>()->setOctreeSizeScale(value*TREE_SCALE); };
preferences->addPreference(new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter)); auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);
wodSlider->setMin(0);
wodSlider->setMax(2000);
preferences->addPreference(wodSlider);
auto getterSQ = []()->float { return 1.0; }; auto getterSQ = []()->float { return 1.0; };
auto setterSQ = [](float value) { }; auto setterSQ = [](float value) { };
preferences->addPreference(new SliderPreference(GRAPHICS_QUALITY, "Shadow Quality", getterSQ, setterSQ)); preferences->addPreference(new SliderPreference(GRAPHICS_QUALITY, "Shadow Quality", getterSQ, setterSQ));