From 208d7c3cfcc77430f4db22fa7a58d0bb061262dc Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 22 Jan 2016 19:20:43 -0800 Subject: [PATCH] Killing the old preferences dialog --- .../qml/hifi/dialogs/PreferencesDialog.qml | 2 +- interface/src/Application.cpp | 4 +- interface/src/ui/DialogsManager.cpp | 7 +- interface/src/ui/DialogsManager.h | 3 - interface/src/ui/PreferencesDialog.cpp | 311 +- interface/src/ui/PreferencesDialog.h | 49 +- interface/ui/preferencesDialog.ui | 3063 ----------------- libraries/ui/src/OffscreenUi.cpp | 13 +- 8 files changed, 17 insertions(+), 3435 deletions(-) delete mode 100644 interface/ui/preferencesDialog.ui diff --git a/interface/resources/qml/hifi/dialogs/PreferencesDialog.qml b/interface/resources/qml/hifi/dialogs/PreferencesDialog.qml index 8dc057d585..042d116511 100644 --- a/interface/resources/qml/hifi/dialogs/PreferencesDialog.qml +++ b/interface/resources/qml/hifi/dialogs/PreferencesDialog.qml @@ -9,7 +9,7 @@ import "./preferences" Window { id: root - objectName: "Preferences" + objectName: "PreferencesDialog" title: "Preferences" resizable: true destroyOnInvisible: true diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 22bc4effcb..a7bac40033 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1841,9 +1841,7 @@ void Application::keyPressEvent(QKeyEvent* event) { case Qt::Key_X: if (isShifted && isMeta) { - auto offscreenUi = DependencyManager::get(); - offscreenUi->getRootContext()->engine()->clearComponentCache(); - offscreenUi->show(QString("hifi/dialogs/PreferencesDialog.qml"), "PreferencesDialog"); + // placeholder for dialogs being converted to QML. } break; diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp index 0755ab7d25..bd83b0c64e 100644 --- a/interface/src/ui/DialogsManager.cpp +++ b/interface/src/ui/DialogsManager.cpp @@ -92,12 +92,7 @@ void DialogsManager::cachesSizeDialog() { } void DialogsManager::editPreferences() { - if (!_preferencesDialog) { - maybeCreateDialog(_preferencesDialog); - _preferencesDialog->show(); - } else { - _preferencesDialog->close(); - } + DependencyManager::get()->toggle(QString("hifi/dialogs/PreferencesDialog.qml"), "PreferencesDialog"); } void DialogsManager::editAttachments() { diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h index 46926a694b..1b1337731b 100644 --- a/interface/src/ui/DialogsManager.h +++ b/interface/src/ui/DialogsManager.h @@ -26,7 +26,6 @@ class CachesSizeDialog; class DiskCacheEditor; class LodToolsDialog; class OctreeStatsDialog; -class PreferencesDialog; class ScriptEditorWindow; class QMessageBox; class DomainConnectionDialog; @@ -41,7 +40,6 @@ public: QPointer getHMDToolsDialog() const { return _hmdToolsDialog; } QPointer getLodToolsDialog() const { return _lodToolsDialog; } QPointer getOctreeStatsDialog() const { return _octreeStatsDialog; } - QPointer getPreferencesDialog() const { return _preferencesDialog; } public slots: void toggleAddressBar(); @@ -84,7 +82,6 @@ private: QPointer _hmdToolsDialog; QPointer _lodToolsDialog; QPointer _octreeStatsDialog; - QPointer _preferencesDialog; QPointer _scriptEditor; QPointer _domainConnectionDialog; }; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 0194e41bc3..7609939676 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -1,16 +1,12 @@ // -// PreferencesDialog.cpp -// interface/src/ui -// -// Created by Stojce Slavkovski on 2/20/14. -// Copyright 2014 High Fidelity, Inc. +// Re-created Bradley Austin Davis on 2016/01/22 +// Copyright 2016 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 -#include +#include "PreferencesDialog.h" #include #include @@ -19,19 +15,14 @@ #include #include #include -#include #include #include "Application.h" #include "DialogsManager.h" -#include "MainWindow.h" #include "LODManager.h" #include "Menu.h" -#include "PreferencesDialog.h" #include "Snapshot.h" #include "UserActivityLogger.h" -#include "UIUtil.h" -#include "scripting/WebWindowClass.h" void setupPreferences() { auto preferences = DependencyManager::get(); @@ -320,299 +311,3 @@ void setupPreferences() { preferences->addPreference(preference); } } - -const int PREFERENCES_HEIGHT_PADDING = 20; - -PreferencesDialog::PreferencesDialog(QWidget* parent) : - QDialog(parent) -{ - setAttribute(Qt::WA_DeleteOnClose); - - ui.setupUi(this); - loadPreferences(); - - ui.outputBufferSizeSpinner->setMinimum(MIN_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES); - ui.outputBufferSizeSpinner->setMaximum(MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES); - - connect(ui.buttonBrowseLocation, &QPushButton::clicked, this, &PreferencesDialog::openSnapshotLocationBrowser); - connect(ui.buttonBrowseScriptsLocation, &QPushButton::clicked, this, &PreferencesDialog::openScriptsLocationBrowser); - connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked, [] { - DependencyManager::get()->loadDefaultScripts(); - }); - - connect(ui.buttonChangeAppearance, &QPushButton::clicked, this, &PreferencesDialog::openFullAvatarModelBrowser); - connect(ui.appearanceDescription, &QLineEdit::editingFinished, this, &PreferencesDialog::changeFullAvatarURL); - connect(ui.useAcuityCheckBox, &QCheckBox::clicked, this, &PreferencesDialog::changeUseAcuity); - - connect(qApp, &Application::fullAvatarURLChanged, this, &PreferencesDialog::fullAvatarURLChanged); - - // move dialog to left side - move(parentWidget()->geometry().topLeft()); - resize(sizeHint().width(), parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); - - UIUtil::scaleWidgetFontSizes(this); -} - -void PreferencesDialog::changeUseAcuity() { - bool useAcuity = ui.useAcuityCheckBox->isChecked(); - ui.label_desktopMinimumFPSSpin->setEnabled(useAcuity); - ui.desktopMinimumFPSSpin->setEnabled(useAcuity); - ui.label_hmdMinimumFPSSpin->setEnabled(useAcuity); - ui.hmdMinimumFPSSpin->setEnabled(useAcuity); - ui.label_smallestReasonableRenderHorizon->setEnabled(!useAcuity); - ui.smallestReasonableRenderHorizon->setEnabled(!useAcuity); - Menu::getInstance()->getActionForOption(MenuOption::LodTools)->setEnabled(useAcuity); - Menu::getInstance()->getSubMenuFromName(MenuOption::RenderResolution, Menu::getInstance()->getSubMenuFromName("Render", Menu::getInstance()->getMenu("Developer")))->setEnabled(useAcuity); -} -void PreferencesDialog::changeFullAvatarURL() { - DependencyManager::get()->getMyAvatar()->useFullAvatarURL(ui.appearanceDescription->text(), ""); - this->fullAvatarURLChanged(ui.appearanceDescription->text(), ""); -} - -void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QString& modelName) { - ui.appearanceDescription->setText(newValue); - const QString APPEARANCE_LABEL_TEXT("Appearance: "); - ui.appearanceLabel->setText(APPEARANCE_LABEL_TEXT + modelName); -} - -void PreferencesDialog::accept() { - MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); - - // if there is an attempted change to the full avatar URL, apply it now - if (QUrl(ui.appearanceDescription->text()) != myAvatar->getFullAvatarURLFromPreferences()) { - changeFullAvatarURL(); - } - - _lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences(); - _lastGoodAvatarName = myAvatar->getFullAvatarModelName(); - - savePreferences(); - - close(); - delete _marketplaceWindow; - _marketplaceWindow = NULL; -} - -void PreferencesDialog::restoreLastGoodAvatar() { - const QString& url = _lastGoodAvatarURL.toString(); - fullAvatarURLChanged(url, _lastGoodAvatarName); - DependencyManager::get()->getMyAvatar()->useFullAvatarURL(url, _lastGoodAvatarName); -} - -void PreferencesDialog::reject() { - restoreLastGoodAvatar(); - QDialog::reject(); -} - -void PreferencesDialog::openSnapshotLocationBrowser() { - QString dir = QFileDialog::getExistingDirectory(this, tr("Snapshots Location"), - QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - if (!dir.isNull() && !dir.isEmpty()) { - ui.snapshotLocationEdit->setText(dir); - } -} - -void PreferencesDialog::openScriptsLocationBrowser() { - QString dir = QFileDialog::getExistingDirectory(this, tr("Scripts Location"), - ui.scriptsLocationEdit->text(), - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - if (!dir.isNull() && !dir.isEmpty()) { - ui.scriptsLocationEdit->setText(dir); - } -} -void PreferencesDialog::openFullAvatarModelBrowser() { - const auto MARKETPLACE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace?category=avatars"; - const auto WIDTH = 900; - const auto HEIGHT = 700; - if (!_marketplaceWindow) { - _marketplaceWindow = new WebWindowClass("Marketplace", MARKETPLACE_URL, WIDTH, HEIGHT); - } - _marketplaceWindow->setVisible(true); - -} - -void PreferencesDialog::resizeEvent(QResizeEvent *resizeEvent) { - - // keep buttons panel at the bottom - ui.buttonsPanel->setGeometry(0, - size().height() - ui.buttonsPanel->height(), - size().width(), - ui.buttonsPanel->height()); - - // set width and height of srcollarea to match bottom panel and width - ui.scrollArea->setGeometry(ui.scrollArea->geometry().x(), ui.scrollArea->geometry().y(), - size().width(), - size().height() - ui.buttonsPanel->height() - ui.scrollArea->geometry().y()); - -} - -void PreferencesDialog::loadPreferences() { - - MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); - Menu* menuInstance = Menu::getInstance(); - - _displayNameString = myAvatar->getDisplayName(); - ui.displayNameEdit->setText(_displayNameString); - - ui.collisionSoundURLEdit->setText(myAvatar->getCollisionSoundURL()); - - _lastGoodAvatarURL = myAvatar->getFullAvatarURLFromPreferences(); - _lastGoodAvatarName = myAvatar->getFullAvatarModelName(); - fullAvatarURLChanged(_lastGoodAvatarURL.toString(), _lastGoodAvatarName); - - ui.sendDataCheckBox->setChecked(!menuInstance->isOptionChecked(MenuOption::DisableActivityLogger)); - - ui.snapshotLocationEdit->setText(Snapshot::snapshotsLocation.get()); - - ui.scriptsLocationEdit->setText(DependencyManager::get()->getScriptsLocation()); - - ui.pupilDilationSlider->setValue(myAvatar->getHead()->getPupilDilation() * - ui.pupilDilationSlider->maximum()); - - auto dde = DependencyManager::get(); - ui.ddeEyeClosingThresholdSlider->setValue(dde->getEyeClosingThreshold() * - ui.ddeEyeClosingThresholdSlider->maximum()); - - ui.faceTrackerEyeDeflectionSider->setValue(FaceTracker::getEyeDeflection() * - ui.faceTrackerEyeDeflectionSider->maximum()); - - auto faceshift = DependencyManager::get(); - ui.faceshiftHostnameEdit->setText(faceshift->getHostname()); - - auto audio = DependencyManager::get(); - MixedProcessedAudioStream& stream = audio->getReceivedAudioStream(); - - ui.dynamicJitterBuffersCheckBox->setChecked(stream.getDynamicJitterBuffers()); - ui.staticDesiredJitterBufferFramesSpin->setValue(stream.getDesiredJitterBufferFrames()); - ui.maxFramesOverDesiredSpin->setValue(stream.getMaxFramesOverDesired()); - ui.useStdevForJitterCalcCheckBox->setChecked(stream.getUseStDevForJitterCalc()); - ui.windowStarveThresholdSpin->setValue(stream.getWindowStarveThreshold()); - ui.windowSecondsForDesiredCalcOnTooManyStarvesSpin->setValue( - stream.getWindowSecondsForDesiredCalcOnTooManyStarves()); - ui.windowSecondsForDesiredReductionSpin->setValue(stream.getWindowSecondsForDesiredReduction()); - ui.repetitionWithFadeCheckBox->setChecked(stream.getRepetitionWithFade()); - - ui.outputBufferSizeSpinner->setValue(audio->getOutputBufferSize()); - - ui.outputStarveDetectionCheckBox->setChecked(audio->getOutputStarveDetectionEnabled()); - ui.outputStarveDetectionThresholdSpinner->setValue(audio->getOutputStarveDetectionThreshold()); - ui.outputStarveDetectionPeriodSpinner->setValue(audio->getOutputStarveDetectionPeriod()); - - ui.realWorldFieldOfViewSpin->setValue(myAvatar->getRealWorldFieldOfView()); - - ui.fieldOfViewSpin->setValue(qApp->getFieldOfView()); - - ui.leanScaleSpin->setValue(myAvatar->getLeanScale()); - - ui.avatarScaleSpin->setValue(myAvatar->getUniformScale()); - ui.avatarAnimationEdit->setText(myAvatar->getAnimGraphUrl().toString()); - - ui.maxOctreePPSSpin->setValue(qApp->getMaxOctreePacketsPerSecond()); - -#if 0 - ui.oculusUIAngularSizeSpin->setValue(qApp->getApplicationCompositor().getHmdUIAngularSize()); -#endif - - ui.sixenseReticleMoveSpeedSpin->setValue(controller::InputDevice::getReticleMoveSpeed()); - - // LOD items - auto lodManager = DependencyManager::get(); - ui.useAcuityCheckBox->setChecked(lodManager->getUseAcuity()); - ui.desktopMinimumFPSSpin->setValue(lodManager->getDesktopLODDecreaseFPS()); - ui.hmdMinimumFPSSpin->setValue(lodManager->getHMDLODDecreaseFPS()); - ui.smallestReasonableRenderHorizon->setValue(1.0f / lodManager->getRenderDistanceInverseHighLimit()); - changeUseAcuity(); -} - -void PreferencesDialog::savePreferences() { - - MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); - - bool shouldDispatchIdentityPacket = false; - - QString displayNameStr(ui.displayNameEdit->text()); - if (displayNameStr != _displayNameString) { - myAvatar->setDisplayName(displayNameStr); - UserActivityLogger::getInstance().changedDisplayName(displayNameStr); - shouldDispatchIdentityPacket = true; - } - - if (shouldDispatchIdentityPacket) { - myAvatar->sendIdentityPacket(); - } - - myAvatar->setCollisionSoundURL(ui.collisionSoundURLEdit->text()); - - // MyAvatar persists its own data. If it doesn't agree with what the user has explicitly accepted, set it back to old values. - if (_lastGoodAvatarURL != myAvatar->getFullAvatarURLFromPreferences()) { - restoreLastGoodAvatar(); - } - - if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger) - != ui.sendDataCheckBox->isChecked()) { - Menu::getInstance()->triggerOption(MenuOption::DisableActivityLogger); - } - - if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) { - Snapshot::snapshotsLocation.set(ui.snapshotLocationEdit->text()); - } - - if (!ui.scriptsLocationEdit->text().isEmpty() && QDir(ui.scriptsLocationEdit->text()).exists()) { - DependencyManager::get()->setScriptsLocation(ui.scriptsLocationEdit->text()); - } - - myAvatar->getHead()->setPupilDilation(ui.pupilDilationSlider->value() / (float)ui.pupilDilationSlider->maximum()); - myAvatar->setLeanScale(ui.leanScaleSpin->value()); - myAvatar->setTargetScaleVerbose(ui.avatarScaleSpin->value()); - if (myAvatar->getAnimGraphUrl() != ui.avatarAnimationEdit->text()) { // If changed, destroy the old and start with the new - myAvatar->setAnimGraphUrl(ui.avatarAnimationEdit->text()); - } - - myAvatar->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value()); - - qApp->setFieldOfView(ui.fieldOfViewSpin->value()); - - auto dde = DependencyManager::get(); - dde->setEyeClosingThreshold(ui.ddeEyeClosingThresholdSlider->value() / - (float)ui.ddeEyeClosingThresholdSlider->maximum()); - - FaceTracker::setEyeDeflection(ui.faceTrackerEyeDeflectionSider->value() / - (float)ui.faceTrackerEyeDeflectionSider->maximum()); - - auto faceshift = DependencyManager::get(); - faceshift->setHostname(ui.faceshiftHostnameEdit->text()); - - qApp->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); - - qApp->getApplicationCompositor().setHmdUIAngularSize(ui.oculusUIAngularSizeSpin->value()); - - controller::InputDevice::setReticleMoveSpeed(ui.sixenseReticleMoveSpeedSpin->value()); - - auto audio = DependencyManager::get(); - MixedProcessedAudioStream& stream = audio->getReceivedAudioStream(); - - stream.setDynamicJitterBuffers(ui.dynamicJitterBuffersCheckBox->isChecked()); - stream.setStaticDesiredJitterBufferFrames(ui.staticDesiredJitterBufferFramesSpin->value()); - stream.setMaxFramesOverDesired(ui.maxFramesOverDesiredSpin->value()); - stream.setUseStDevForJitterCalc(ui.useStdevForJitterCalcCheckBox->isChecked()); - stream.setWindowStarveThreshold(ui.windowStarveThresholdSpin->value()); - stream.setWindowSecondsForDesiredCalcOnTooManyStarves(ui.windowSecondsForDesiredCalcOnTooManyStarvesSpin->value()); - stream.setWindowSecondsForDesiredReduction(ui.windowSecondsForDesiredReductionSpin->value()); - stream.setRepetitionWithFade(ui.repetitionWithFadeCheckBox->isChecked()); - - QMetaObject::invokeMethod(audio.data(), "setOutputBufferSize", Q_ARG(int, ui.outputBufferSizeSpinner->value())); - - audio->setOutputStarveDetectionEnabled(ui.outputStarveDetectionCheckBox->isChecked()); - audio->setOutputStarveDetectionThreshold(ui.outputStarveDetectionThresholdSpinner->value()); - audio->setOutputStarveDetectionPeriod(ui.outputStarveDetectionPeriodSpinner->value()); - - qApp->resizeGL(); - - // LOD items - auto lodManager = DependencyManager::get(); - lodManager->setUseAcuity(ui.useAcuityCheckBox->isChecked()); - lodManager->setDesktopLODDecreaseFPS(ui.desktopMinimumFPSSpin->value()); - lodManager->setHMDLODDecreaseFPS(ui.hmdMinimumFPSSpin->value()); - lodManager->setRenderDistanceInverseHighLimit(1.0f / ui.smallestReasonableRenderHorizon->value()); -} diff --git a/interface/src/ui/PreferencesDialog.h b/interface/src/ui/PreferencesDialog.h index 77c203b57f..788f3a8cf8 100644 --- a/interface/src/ui/PreferencesDialog.h +++ b/interface/src/ui/PreferencesDialog.h @@ -1,9 +1,6 @@ // -// PreferencesDialog.h -// interface/src/ui -// -// Created by Stojce Slavkovski on 2/20/14. -// Copyright 2014 High Fidelity, Inc. +// Re-created Bradley Austin Davis on 2016/01/22 +// Copyright 2016 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 @@ -12,46 +9,6 @@ #ifndef hifi_PreferencesDialog_h #define hifi_PreferencesDialog_h -#include "ui_preferencesDialog.h" - -#include -#include - -class WebWindowClass; - -class PreferencesDialog : public QDialog { - Q_OBJECT - -public: - PreferencesDialog(QWidget* parent = nullptr); - - void avatarDescriptionChanged(); - -protected: - void resizeEvent(QResizeEvent* resizeEvent); - -private: - void loadPreferences(); - void savePreferences(); - QUrl _lastGoodAvatarURL; - QString _lastGoodAvatarName; - void restoreLastGoodAvatar(); - - Ui_PreferencesDialog ui; - - QString _displayNameString; - - WebWindowClass* _marketplaceWindow { nullptr }; - -private slots: - void accept(); - void reject(); - void openFullAvatarModelBrowser(); - void openSnapshotLocationBrowser(); - void openScriptsLocationBrowser(); - void changeFullAvatarURL(); - void fullAvatarURLChanged(const QString& newValue, const QString& modelName); - void changeUseAcuity(); -}; +void setupPreferences(); #endif // hifi_PreferencesDialog_h diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui deleted file mode 100644 index 06ce0bd154..0000000000 --- a/interface/ui/preferencesDialog.ui +++ /dev/null @@ -1,3063 +0,0 @@ - - - PreferencesDialog - - - - 0 - 0 - 500 - 554 - - - - - 0 - 0 - - - - - 500 - 0 - - - - - 500 - 16777215 - - - - - 13 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - true - - - - - 0 - -107 - 485 - 1550 - - - - - 0 - - - 30 - - - 0 - - - 30 - - - 30 - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e; - - - Avatar basics - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 0 - - - 7 - - - 7 - - - - - - Arial - - - - <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - displayNameEdit - - - - - - - 4 - - - 140 - - - 4 - - - - - - Arial - - - - Qt::LeftToRight - - - Not showing a name - - - - - - - - - - - - 0 - - - 7 - - - 7 - - - - - - Arial - - - - <html><head/><body><p>Avatar collision sound URL <span style=" color:#909090;">(optional)</span></p></body></html> - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - collisionSoundURLEdit - - - - - - - 4 - - - 5 - - - 4 - - - - - - Arial - - - - Qt::LeftToRight - - - Enter the URL of a sound to play when you bump into something - - - - - - - - - - - - 0 - - - 7 - - - 7 - - - - - - Arial - - - - <html><head/><body><p>Appearance</p></body></html> - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - appearanceDescription - - - - - - - - - - 0 - - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Change - - - - 0 - 0 - - - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Snapshots - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - - - - Arial - - - - Place my Snapshots here: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - 0 - - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Scripts - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - - - - Arial - - - - Load scripts from this directory: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - 0 - - - - - - 0 - 0 - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - - 300 - 0 - - - - - Arial - - - - Load Default Scripts - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Privacy - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - 0 - 0 - - - - - 32 - 28 - - - - - 0 - 0 - - - - - Arial - - - - Send data - - - - 0 - 0 - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Level of Detail Tuning - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - - 0 - 0 - - - - - 32 - 28 - - - - - 0 - 0 - - - - - Arial - - - - Render based on visual acuity - - - - 0 - 0 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Minimum Desktop FPS - - - 0 - - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 0 - - - 120 - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Minimum HMD FPS - - - 0 - - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 0 - - - 120 - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Minimum Display Distance - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 5 - - - 32768 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Avatar tuning - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Real world vertical field of view (angular size of monitor) - - - 0 - - - fieldOfViewSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Vertical field of view - - - 0 - - - fieldOfViewSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - 0 - - - 8 - - - 8 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 25 - - - - - Arial - - - - Lean scale (applies to Faceshift users) - - - 0 - - - leanScaleSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 10 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - Arial - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Avatar scale <span style=" color:#909090;">(default is 1.0)</span> - - - 0 - - - avatarScaleSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Pupil dilation - - - 0 - - - pupilDilationSlider - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 130 - 0 - - - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Camera binary eyelid threshold - - - 0 - - - ddeEyeClosingThresholdSlider - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 130 - 0 - - - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Face tracker eye deflection - - - 0 - - - faceTrackerEyeDeflectionSider - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 130 - 0 - - - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Faceshift hostname - - - 0 - - - faceshiftHostnameEdit - - - - - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - Arial - - - - Qt::LeftToRight - - - - - - localhost - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Avatar Animation JSON - - - avatarAnimationEdit - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Qt::LeftToRight - - - - - - default - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Audio - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 7 - - - 7 - - - - - - 0 - 40 - - - - - Arial - - - - Enable Dynamic Jitter Buffers - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Static Jitter Buffer Frames - - - 0 - - - staticDesiredJitterBufferFramesSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - Arial - - - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Max Frames Over Desired - - - 0 - - - maxFramesOverDesiredSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 0 - - - 10000 - - - 1 - - - - - - - - - 7 - - - 7 - - - - - - 0 - 32 - - - - - Arial - - - - Use Stdev for Dynamic Jitter Calc - - - - 32 - 32 - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Window A Starve Threshold - - - 0 - - - windowStarveThresholdSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Window A (raise desired on N starves) Seconds - - - 0 - - - windowSecondsForDesiredCalcOnTooManyStarvesSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Window B (desired ceiling) Seconds - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 0 - - - 10000 - - - 1 - - - - - - - - - 7 - - - 7 - - - - - - 0 - 0 - - - - - Arial - - - - Repetition with Fade - - - - 32 - 32 - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Buffer Size (Frames) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 20 - - - 1 - - - - - - - - - 7 - - - 7 - - - - - - 0 - 0 - - - - - Arial - - - - Output Starve Detection (Automatic Buffer Size Increase) - - - - 32 - 32 - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Threshold - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 500 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Period (ms) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 999999999 - - - 1 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Octree - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Max packets sent each second - - - 0 - - - maxOctreePPSSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 60 - - - 6000 - - - 10 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Oculus Rift - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - User Interface Angular Size - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 30 - - - 160 - - - 1 - - - 72 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Sixense Controllers - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Reticle Movement Speed - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 100 - - - 1 - - - 50 - - - - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Arial - - - - Cancel - - - false - - - - - - - - Arial - - - - Save all changes - - - true - - - false - - - - - - - - - - - - - - cancelButton - clicked() - PreferencesDialog - close() - - - 20 - 20 - - - 20 - 20 - - - - - defaultButton - clicked() - PreferencesDialog - accept() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 4f7336e599..0fdcf1fda2 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -123,13 +123,16 @@ void OffscreenUi::show(const QUrl& url, const QString& name, std::function f) { QQuickItem* item = getRootItem()->findChild(name); - // First load? - if (!item) { - load(url, f); - item = getRootItem()->findChild(name); - } + // Already loaded? if (item) { item->setVisible(!item->isVisible()); + return; + } + + load(url, f); + item = getRootItem()->findChild(name); + if (!item->isVisible()) { + item->setVisible(true); } }