Settings update

This commit is contained in:
Atlante45 2015-02-03 12:27:30 -08:00
parent aacf61609f
commit 27459ba861
19 changed files with 117 additions and 153 deletions

View file

@ -9,7 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <Settings.h>
#include <SettingHandle.h>
#include "SettingsScriptingInterface.h"
@ -20,7 +20,7 @@ SettingsScriptingInterface* SettingsScriptingInterface::getInstance() {
}
QVariant SettingsScriptingInterface::getValue(const QString& setting) {
QVariant value = SettingHandles::SettingHandle<QVariant>(setting).get();
QVariant value = Setting::Handle<QVariant>(setting).get();
if (!value.isValid()) {
value = "";
}
@ -28,7 +28,7 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting) {
}
QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVariant& defaultValue) {
QVariant value = SettingHandles::SettingHandle<QVariant>(setting, defaultValue).get();
QVariant value = Setting::Handle<QVariant>(setting, defaultValue).get();
if (!value.isValid()) {
value = "";
}
@ -36,5 +36,5 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVar
}
void SettingsScriptingInterface::setValue(const QString& setting, const QVariant& value) {
SettingHandles::SettingHandle<QVariant>(setting).set(value);
Setting::Handle<QVariant>(setting).set(value);
}

View file

@ -20,16 +20,10 @@
#include <QScrollArea>
#include <QVBoxLayout>
#include <Settings.h>
#include "AnimationsDialog.h"
#include "Application.h"
#include "MainWindow.h"
namespace SettingHandles {
const SettingHandle<QString> animationDirectory("animation_directory", QString());
}
AnimationsDialog::AnimationsDialog(QWidget* parent) :
QDialog(parent) {
@ -78,6 +72,8 @@ void AnimationsDialog::addAnimation() {
this, Application::getInstance()->getAvatar()->addAnimationHandle()));
}
Setting::Handle<QString> AnimationPanel::_animationDirectory("animation_directory", QString());
AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePointer& handle) :
_dialog(dialog),
_handle(handle),
@ -163,12 +159,12 @@ AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePo
}
void AnimationPanel::chooseURL() {
QString directory = SettingHandles::animationDirectory.get();
QString filename = QFileDialog::getOpenFileName(this, "Choose Animation", directory, "Animation files (*.fbx)");
QString filename = QFileDialog::getOpenFileName(this, "Choose Animation",
_animationDirectory.get(), "Animation files (*.fbx)");
if (filename.isEmpty()) {
return;
}
SettingHandles::animationDirectory.set(QFileInfo(filename).path());
_animationDirectory.set(QFileInfo(filename).path());
_url->setText(QUrl::fromLocalFile(filename).toString());
emit _url->returnPressed();
}

View file

@ -16,6 +16,8 @@
#include <QDoubleSpinBox>
#include <QFrame>
#include <SettingHandle.h>
#include "avatar/MyAvatar.h"
class QCheckBox;
@ -41,8 +43,8 @@ private slots:
private:
QVBoxLayout* _animations;
QPushButton* _ok;
QVBoxLayout* _animations = nullptr;
QPushButton* _ok = nullptr;
};
/// A panel controlling a single animation.
@ -62,22 +64,24 @@ private slots:
private:
AnimationsDialog* _dialog;
AnimationsDialog* _dialog = nullptr;
AnimationHandlePointer _handle;
QComboBox* _role;
QLineEdit* _url;
QDoubleSpinBox* _fps;
QDoubleSpinBox* _priority;
QCheckBox* _loop;
QCheckBox* _hold;
QCheckBox* _startAutomatically;
QDoubleSpinBox* _firstFrame;
QDoubleSpinBox* _lastFrame;
QLineEdit* _maskedJoints;
QPushButton* _chooseMaskedJoints;
QPushButton* _start;
QPushButton* _stop;
QComboBox* _role = nullptr;
QLineEdit* _url = nullptr;
QDoubleSpinBox* _fps = nullptr;
QDoubleSpinBox* _priority = nullptr;
QCheckBox* _loop = nullptr;
QCheckBox* _hold = nullptr;
QCheckBox* _startAutomatically = nullptr;
QDoubleSpinBox* _firstFrame = nullptr;
QDoubleSpinBox* _lastFrame = nullptr;
QLineEdit* _maskedJoints = nullptr;
QPushButton* _chooseMaskedJoints = nullptr;
QPushButton* _start = nullptr;
QPushButton* _stop = nullptr;
bool _applying;
static Setting::Handle<QString> _animationDirectory;
};
#endif // hifi_AnimationsDialog_h

View file

@ -22,7 +22,6 @@
#include <AddressManager.h>
#include <AccountManager.h>
#include <PathUtils.h>
#include <Settings.h>
#include "Application.h"
#include "ChatMessageArea.h"
@ -42,10 +41,6 @@ const QRegularExpression regexHifiLinks("([#@]\\S+)");
const QString mentionSoundsPath("/mention-sounds/");
const QString mentionRegex("@(\\b%1\\b)");
namespace SettingHandles {
const SettingHandle<QDateTime> usernameMentionTimestamp("MentionTimestamp", QDateTime());
}
ChatWindow::ChatWindow(QWidget* parent) :
QWidget(parent, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint |
Qt::WindowCloseButtonHint),
@ -54,7 +49,8 @@ ChatWindow::ChatWindow(QWidget* parent) :
_mousePressed(false),
_mouseStartPosition(),
_trayIcon(parent),
_effectPlayer()
_effectPlayer(),
_usernameMentionTimestamp("MentionTimestamp", QDateTime())
{
setAttribute(Qt::WA_DeleteOnClose, false);
@ -382,9 +378,9 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
if (message.body().contains(usernameMention)) {
// Don't show messages already seen in icon tray at start-up.
bool showMessage = SettingHandles::usernameMentionTimestamp.get() < _lastMessageStamp;
bool showMessage = usernameMentionTimestamp.get() < _lastMessageStamp;
if (showMessage) {
SettingHandles::usernameMentionTimestamp.set(_lastMessageStamp);
usernameMentionTimestamp.set(_lastMessageStamp);
}
if (isHidden() && showMessage) {

View file

@ -19,6 +19,8 @@
#include <QTimer>
#include <Application.h>
#include <SettingHandle.h>
#include "FramelessDialog.h"
#ifdef HAVE_QXMPP
@ -69,6 +71,8 @@ private:
QSystemTrayIcon _trayIcon;
QStringList _mentionSounds;
QMediaPlayer _effectPlayer;
Setting::Handle<QDateTime> _usernameMentionTimestamp;
private slots:
void connected();

View file

@ -16,15 +16,13 @@
#include <QtWebKit/QWebElement>
#include <PathUtils.h>
#include <Settings.h>
#include <SettingHandle.h>
#include "InfoView.h"
static const float MAX_DIALOG_HEIGHT_RATIO = 0.9f;
namespace SettingHandles {
const SettingHandle<QString> infoVersion("info-version", QString());
}
Setting::Handle<QString> infoVersion("info-version", QString());
InfoView::InfoView(bool forced, QString path) :
_forced(forced)
@ -52,13 +50,13 @@ bool InfoView::shouldShow() {
return true;
}
QString lastVersion = SettingHandles::infoVersion.get();
QString lastVersion = infoVersion.get();
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
QString version = versionTag.attribute("value");
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
SettingHandles::infoVersion.set(version);
infoVersion.set(version);
shouldShow = true;
} else {
shouldShow = false;

View file

@ -121,7 +121,7 @@ void PreferencesDialog::loadPreferences() {
ui.sendDataCheckBox->setChecked(!menuInstance->isOptionChecked(MenuOption::DisableActivityLogger));
ui.snapshotLocationEdit->setText(SettingHandles::snapshotsLocation.get());
ui.snapshotLocationEdit->setText(Snapshot::snapshotsLocation.get());
ui.scriptsLocationEdit->setText(qApp->getScriptsLocation());
@ -153,9 +153,9 @@ void PreferencesDialog::loadPreferences() {
ui.outputStarveDetectionThresholdSpinner->setValue(audio->getOutputStarveDetectionThreshold());
ui.outputStarveDetectionPeriodSpinner->setValue(audio->getOutputStarveDetectionPeriod());
ui.realWorldFieldOfViewSpin->setValue(qApp->getViewFrustum()->getRealWorldFieldOfView());
ui.realWorldFieldOfViewSpin->setValue(qApp->getAvatar()->getRealWorldFieldOfView());
ui.fieldOfViewSpin->setValue(qApp->getViewFrustum()->getFieldOfView());
ui.fieldOfViewSpin->setValue(qApp->getFieldOfView());
ui.leanScaleSpin->setValue(myAvatar->getLeanScale());
@ -219,7 +219,7 @@ void PreferencesDialog::savePreferences() {
}
if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) {
SettingHandles::snapshotsLocation.set(ui.snapshotLocationEdit->text());
Snapshot::snapshotsLocation.set(ui.snapshotLocationEdit->text());
}
if (!ui.scriptsLocationEdit->text().isEmpty() && QDir(ui.scriptsLocationEdit->text()).exists()) {
@ -233,9 +233,9 @@ void PreferencesDialog::savePreferences() {
auto glCanvas = DependencyManager::get<GLCanvas>();
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
qApp->getViewFrustum()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
qApp->getAvatar()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
qApp->getViewFrustum()->setFieldOfView(ui.fieldOfViewSpin->value());
qApp->setFieldOfView(ui.fieldOfViewSpin->value());
auto faceshift = DependencyManager::get<Faceshift>();
faceshift->setEyeDeflection(ui.faceshiftEyeDeflectionSider->value() /

View file

@ -23,6 +23,11 @@
const int ICON_SIZE = 24;
const int ICON_PADDING = 5;
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
Setting::Handle<int> RearMirrorTools::rearViewZoomLevel(QStringList() << SETTINGS_GROUP_NAME << ZOOM_LEVEL_SETTINGS,
ZoomLevel::HEAD);
RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds) :
_parent(parent),
_bounds(bounds),
@ -52,7 +57,7 @@ void RearMirrorTools::render(bool fullScreen) {
if (_windowed) {
displayIcon(_bounds, _closeIconRect, _closeTextureId);
ZoomLevel zoomLevel = (ZoomLevel)SettingHandles::rearViewZoomLevel.get();
ZoomLevel zoomLevel = (ZoomLevel)rearViewZoomLevel.get();
displayIcon(_bounds, _headZoomIconRect, _zoomHeadTextureId, zoomLevel == HEAD);
displayIcon(_bounds, _bodyZoomIconRect, _zoomBodyTextureId, zoomLevel == BODY);
}
@ -68,12 +73,12 @@ bool RearMirrorTools::mousePressEvent(int x, int y) {
}
if (_headZoomIconRect.contains(x, y)) {
SettingHandles::rearViewZoomLevel.set(HEAD);
rearViewZoomLevel.set(HEAD);
return true;
}
if (_bodyZoomIconRect.contains(x, y)) {
SettingHandles::rearViewZoomLevel.set(BODY);
rearViewZoomLevel.set(BODY);
return true;
}

View file

@ -16,26 +16,21 @@
#include <QGLWidget>
#include <Settings.h>
#include <SettingHandle.h>
enum ZoomLevel {
HEAD = 0,
BODY = 1
};
namespace SettingHandles {
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
const SettingHandle<int> rearViewZoomLevel(QStringList() << SETTINGS_GROUP_NAME << ZOOM_LEVEL_SETTINGS,
ZoomLevel::HEAD);
}
class RearMirrorTools : public QObject {
Q_OBJECT
public:
RearMirrorTools(QGLWidget* parent, QRect& bounds);
void render(bool fullScreen);
bool mousePressEvent(int x, int y);
static Setting::Handle<int> rearViewZoomLevel;
signals:
void closeView();

View file

@ -40,6 +40,9 @@ const QString ORIENTATION_W = "orientation-w";
const QString DOMAIN_KEY = "domain";
Setting::Handle<QString> Snapshot::snapshotsLocation("snapshotsLocation",
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) {
if (!QFile(snapshotPath).exists()) {
@ -122,7 +125,7 @@ QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
const int IMAGE_QUALITY = 100;
if (!isTemporary) {
QString snapshotFullPath = SettingHandles::snapshotsLocation.get();
QString snapshotFullPath = snapshotsLocation.get();
if (!snapshotFullPath.endsWith(QDir::separator())) {
snapshotFullPath.append(QDir::separator());

View file

@ -16,16 +16,11 @@
#include <QString>
#include <Settings.h>
#include <SettingHandle.h>
class QFile;
class QTemporaryFile;
namespace SettingHandles {
const SettingHandle<QString> snapshotsLocation("snapshotsLocation",
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
}
class SnapshotMetaData {
public:
@ -50,6 +45,7 @@ public:
static QTemporaryFile* saveTempSnapshot();
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
static Setting::Handle<QString> snapshotsLocation;
private:
static QFile* savedFileForSnapshot(bool isTemporary);
};

View file

@ -11,26 +11,25 @@
#include <glm/glm.hpp>
#include <Settings.h>
#include <SettingHandle.h>
#include "InboundAudioStream.h"
#include "PacketHeaders.h"
const int STARVE_HISTORY_CAPACITY = 50;
namespace SettingHandles {
const SettingHandle<bool> dynamicJitterBuffers("dynamicJitterBuffers", DEFAULT_DYNAMIC_JITTER_BUFFERS);
const SettingHandle<int> maxFramesOverDesired("maxFramesOverDesired", DEFAULT_MAX_FRAMES_OVER_DESIRED);
const SettingHandle<int> staticDesiredJitterBufferFrames("staticDesiredJitterBufferFrames",
DEFAULT_STATIC_DESIRED_JITTER_BUFFER_FRAMES);
const SettingHandle<bool> useStDevForJitterCalc("useStDevForJitterCalc", DEFAULT_USE_STDEV_FOR_JITTER_CALC);
const SettingHandle<int> windowStarveThreshold("windowStarveThreshold", DEFAULT_WINDOW_STARVE_THRESHOLD);
const SettingHandle<int> windowSecondsForDesiredCalcOnTooManyStarves("windowSecondsForDesiredCalcOnTooManyStarves",
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_CALC_ON_TOO_MANY_STARVES);
const SettingHandle<int> windowSecondsForDesiredReduction("windowSecondsForDesiredReduction",
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_REDUCTION);
const SettingHandle<bool> repetitionWithFade("repetitionWithFade", DEFAULT_REPETITION_WITH_FADE);
}
Setting::Handle<bool> dynamicJitterBuffers("dynamicJitterBuffers", DEFAULT_DYNAMIC_JITTER_BUFFERS);
Setting::Handle<int> maxFramesOverDesired("maxFramesOverDesired", DEFAULT_MAX_FRAMES_OVER_DESIRED);
Setting::Handle<int> staticDesiredJitterBufferFrames("staticDesiredJitterBufferFrames",
DEFAULT_STATIC_DESIRED_JITTER_BUFFER_FRAMES);
Setting::Handle<bool> useStDevForJitterCalc("useStDevForJitterCalc", DEFAULT_USE_STDEV_FOR_JITTER_CALC);
Setting::Handle<int> windowStarveThreshold("windowStarveThreshold", DEFAULT_WINDOW_STARVE_THRESHOLD);
Setting::Handle<int> windowSecondsForDesiredCalcOnTooManyStarves("windowSecondsForDesiredCalcOnTooManyStarves",
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_CALC_ON_TOO_MANY_STARVES);
Setting::Handle<int> windowSecondsForDesiredReduction("windowSecondsForDesiredReduction",
DEFAULT_WINDOW_SECONDS_FOR_DESIRED_REDUCTION);
Setting::Handle<bool> repetitionWithFade("repetitionWithFade", DEFAULT_REPETITION_WITH_FADE);
InboundAudioStream::InboundAudioStream(int numFrameSamples, int numFramesCapacity, const Settings& settings) :
_ringBuffer(numFrameSamples, false, numFramesCapacity),
@ -518,25 +517,25 @@ float calculateRepeatedFrameFadeFactor(int indexOfRepeat) {
}
void InboundAudioStream::loadSettings() {
setDynamicJitterBuffers(SettingHandles::dynamicJitterBuffers.get());
setMaxFramesOverDesired(SettingHandles::maxFramesOverDesired.get());
setStaticDesiredJitterBufferFrames(SettingHandles::staticDesiredJitterBufferFrames.get());
setUseStDevForJitterCalc(SettingHandles::useStDevForJitterCalc.get());
setWindowStarveThreshold(SettingHandles::windowStarveThreshold.get());
setWindowSecondsForDesiredCalcOnTooManyStarves(SettingHandles::windowSecondsForDesiredCalcOnTooManyStarves.get());
setWindowSecondsForDesiredReduction(SettingHandles::windowSecondsForDesiredReduction.get());
setRepetitionWithFade(SettingHandles::repetitionWithFade.get());
setDynamicJitterBuffers(dynamicJitterBuffers.get());
setMaxFramesOverDesired(maxFramesOverDesired.get());
setStaticDesiredJitterBufferFrames(staticDesiredJitterBufferFrames.get());
setUseStDevForJitterCalc(useStDevForJitterCalc.get());
setWindowStarveThreshold(windowStarveThreshold.get());
setWindowSecondsForDesiredCalcOnTooManyStarves(windowSecondsForDesiredCalcOnTooManyStarves.get());
setWindowSecondsForDesiredReduction(windowSecondsForDesiredReduction.get());
setRepetitionWithFade(repetitionWithFade.get());
}
void InboundAudioStream::saveSettings() {
SettingHandles::dynamicJitterBuffers.set(getDynamicJitterBuffers());
SettingHandles::maxFramesOverDesired.set(getMaxFramesOverDesired());
SettingHandles::staticDesiredJitterBufferFrames.set(getDesiredJitterBufferFrames());
SettingHandles::useStDevForJitterCalc.set(getUseStDevForJitterCalc());
SettingHandles::windowStarveThreshold.set(getWindowStarveThreshold());
SettingHandles::windowSecondsForDesiredCalcOnTooManyStarves.set(getWindowSecondsForDesiredCalcOnTooManyStarves());
SettingHandles::windowSecondsForDesiredReduction.set(getWindowSecondsForDesiredReduction());
SettingHandles::repetitionWithFade.set(getRepetitionWithFade());
dynamicJitterBuffers.set(getDynamicJitterBuffers());
maxFramesOverDesired.set(getMaxFramesOverDesired());
staticDesiredJitterBufferFrames.set(getDesiredJitterBufferFrames());
useStDevForJitterCalc.set(getUseStDevForJitterCalc());
windowStarveThreshold.set(getWindowStarveThreshold());
windowSecondsForDesiredCalcOnTooManyStarves.set(getWindowSecondsForDesiredCalcOnTooManyStarves());
windowSecondsForDesiredReduction.set(getWindowSecondsForDesiredReduction());
repetitionWithFade.set(getRepetitionWithFade());
}

View file

@ -23,7 +23,7 @@
#include <QtDebug>
#include <GLMHelpers.h>
#include <Settings.h>
#include <SettingHandle.h>
#include "MetavoxelUtil.h"
#include "ScriptCache.h"
@ -485,9 +485,7 @@ void QColorEditor::selectColor() {
}
}
namespace SettingHandles {
const SettingHandle<QStringList> editorURLs("editorURLs");
}
Setting::Handle<QStringList> editorURLs("editorURLs");
QUrlEditor::QUrlEditor(QWidget* parent) :
QComboBox(parent) {
@ -496,7 +494,7 @@ QUrlEditor::QUrlEditor(QWidget* parent) :
setInsertPolicy(InsertAtTop);
// populate initial URL list from settings
addItems(SettingHandles::editorURLs.get());
addItems(editorURLs.get());
connect(this, SIGNAL(activated(const QString&)), SLOT(updateURL(const QString&)));
connect(model(), SIGNAL(rowsInserted(const QModelIndex&,int,int)), SLOT(updateSettings()));
@ -516,7 +514,7 @@ void QUrlEditor::updateSettings() {
for (int i = 0, size = qMin(MAX_STORED_URLS, count()); i < size; i++) {
urls.append(itemText(i));
}
SettingHandles::editorURLs.set(urls);
editorURLs.set(urls);
}
BaseVec3Editor::BaseVec3Editor(QWidget* parent) : QWidget(parent) {

View file

@ -22,7 +22,7 @@
#include <glm/gtx/transform.hpp>
#include <GeometryUtil.h>
#include <Settings.h>
#include <SettingHandle.h>
#include "MetavoxelData.h"
#include "Spanner.h"
@ -58,9 +58,7 @@ static QItemEditorCreatorBase* heightfieldColorEditorCreator = createHeightfield
const float DEFAULT_PLACEMENT_GRANULARITY = 0.01f;
const float DEFAULT_VOXELIZATION_GRANULARITY = powf(2.0f, -3.0f);
namespace SettingHandles {
const SettingHandle<QString> heightfieldDir("heightDir", QString());
}
Setting::Handle<QString> heightfieldDir("heightDir");
Spanner::Spanner() :
_renderer(NULL),
@ -615,12 +613,12 @@ static int getHeightfieldSize(int size) {
void HeightfieldHeightEditor::select() {
QString result = QFileDialog::getOpenFileName(this, "Select Height Image",
SettingHandles::heightfieldDir.get(),
heightfieldDir.get(),
"Images (*.png *.jpg *.bmp *.raw *.mdr)");
if (result.isNull()) {
return;
}
SettingHandles::heightfieldDir.set(QFileInfo(result).path());
heightfieldDir.set(QFileInfo(result).path());
const quint16 CONVERSION_OFFSET = 1;
QString lowerResult = result.toLower();
bool isMDR = lowerResult.endsWith(".mdr");
@ -885,12 +883,12 @@ void HeightfieldColorEditor::setColor(const HeightfieldColorPointer& color) {
void HeightfieldColorEditor::select() {
QString result = QFileDialog::getOpenFileName(this, "Select Color Image",
SettingHandles::heightfieldDir.get(),
heightfieldDir.get(),
"Images (*.png *.jpg *.bmp)");
if (result.isNull()) {
return;
}
SettingHandles::heightfieldDir.get(QFileInfo(result).path());
heightfieldDir.get(QFileInfo(result).path());
QImage image;
if (!image.load(result)) {
QMessageBox::warning(this, "Invalid Image", "The selected image could not be read.");

View file

@ -21,7 +21,7 @@
#include <QtNetwork/QNetworkRequest>
#include <qthread.h>
#include <Settings.h>
#include <SettingHandle.h>
#include "NodeList.h"
#include "PacketHeaders.h"
@ -93,7 +93,7 @@ void AccountManager::logout() {
if (_shouldPersistToSettingsFile) {
QString keyURLString(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE));
QStringList path = QStringList() << ACCOUNTS_GROUP << keyURLString;
SettingHandles::SettingHandle<DataServerAccountInfo>(path).remove();
Setting::Handle<DataServerAccountInfo>(path).remove();
qDebug() << "Removed account info for" << _authURL << "from in-memory accounts and .ini file";
} else {
@ -341,7 +341,7 @@ void AccountManager::persistAccountToSettings() {
// store this access token into the local settings
QString keyURLString(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE));
QStringList path = QStringList() << ACCOUNTS_GROUP << keyURLString;
SettingHandles::SettingHandle<QVariant>(path).set(QVariant::fromValue(_accountInfo));
Setting::Handle<QVariant>(path).set(QVariant::fromValue(_accountInfo));
}
}

View file

@ -17,7 +17,7 @@
#include <QStringList>
#include <GLMHelpers.h>
#include <Settings.h>
#include <SettingHandle.h>
#include <UUID.h>
#include "NodeList.h"
@ -26,11 +26,9 @@
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
const QString SETTINGS_CURRENT_ADDRESS_KEY = "address";
namespace SettingHandles {
const SettingHandle<QUrl> currentAddress(QStringList() << ADDRESS_MANAGER_SETTINGS_GROUP
<< "address",
QUrl());
}
Setting::Handle<QUrl> currentAddressHandle(QStringList() << ADDRESS_MANAGER_SETTINGS_GROUP << "address");
AddressManager::AddressManager() :
_rootPlaceName(),
@ -57,14 +55,14 @@ const QUrl AddressManager::currentAddress() const {
void AddressManager::loadSettings(const QString& lookupString) {
if (lookupString.isEmpty()) {
handleLookupString(SettingHandles::currentAddress.get().toString());
handleLookupString(currentAddressHandle.get().toString());
} else {
handleLookupString(lookupString);
}
}
void AddressManager::storeCurrentAddress() {
SettingHandles::currentAddress.set(currentAddress());
currentAddressHandle.set(currentAddress());
}
const QString AddressManager::currentPath(bool withOrientation) const {

View file

@ -11,23 +11,21 @@
#include <GLMHelpers.h>
#include <PacketHeaders.h>
#include <Settings.h>
#include <SettingHandle.h>
#include "OctreeConstants.h"
#include "OctreeQuery.h"
namespace SettingHandles {
const SettingHandle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
}
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
OctreeQuery::OctreeQuery() {
_maxOctreePPS = SettingHandles::maxOctreePacketsPerSecond.get();
_maxOctreePPS = maxOctreePacketsPerSecond.get();
}
void OctreeQuery::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
if (maxOctreePPS != _maxOctreePPS) {
_maxOctreePPS = maxOctreePPS;
SettingHandles::maxOctreePacketsPerSecond.set(_maxOctreePPS);
maxOctreePacketsPerSecond.set(_maxOctreePPS);
}
}

View file

@ -17,8 +17,6 @@
#include <QtCore/QDebug>
#include <Settings.h>
#include "GeometryUtil.h"
#include "SharedUtil.h"
#include "ViewFrustum.h"
@ -26,14 +24,7 @@
using namespace std;
namespace SettingHandles {
const SettingHandle<float> fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES);
const SettingHandle<float> realWorldFieldOfView("realWorldFieldOfView", DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES);
}
ViewFrustum::ViewFrustum() {
_fieldOfView = SettingHandles::fieldOfView.get();
_realWorldFieldOfView = SettingHandles::realWorldFieldOfView.get();
}
void ViewFrustum::setOrientation(const glm::quat& orientationAsQuaternion) {
@ -44,16 +35,7 @@ void ViewFrustum::setOrientation(const glm::quat& orientationAsQuaternion) {
}
void ViewFrustum::setFieldOfView(float f) {
if (f != _fieldOfView) {
_fieldOfView = f;
SettingHandles::fieldOfView.set(f);
}
}
void ViewFrustum::setRealWorldFieldOfView(float realWorldFieldOfView) {
if (realWorldFieldOfView != _realWorldFieldOfView) {
_realWorldFieldOfView = realWorldFieldOfView;
SettingHandles::realWorldFieldOfView.set(realWorldFieldOfView);
}
_fieldOfView = f;
}
// ViewFrustum::calculateViewFrustum()

View file

@ -27,7 +27,6 @@
const float DEFAULT_KEYHOLE_RADIUS = 3.0f;
const float DEFAULT_FIELD_OF_VIEW_DEGREES = 45.0f;
const float DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES = 30.0f;
const float DEFAULT_ASPECT_RATIO = 16.0f/9.0f;
const float DEFAULT_NEAR_CLIP = 0.08f;
const float DEFAULT_FAR_CLIP = TREE_SCALE;
@ -53,7 +52,6 @@ public:
void setWidth(float width) { _width = width; }
void setHeight(float height) { _height = height; }
void setFieldOfView(float f);
void setRealWorldFieldOfView(float realWorldFieldOfView);
void setAspectRatio(float a) { _aspectRatio = a; }
void setNearClip(float n) { _nearClip = n; }
void setFarClip(float f) { _farClip = f; }
@ -66,7 +64,6 @@ public:
float getWidth() const { return _width; }
float getHeight() const { return _height; }
float getFieldOfView() const { return _fieldOfView; }
float getRealWorldFieldOfView() const { return _realWorldFieldOfView; }
float getAspectRatio() const { return _aspectRatio; }
float getNearClip() const { return _nearClip; }
float getFarClip() const { return _farClip; }
@ -158,9 +155,6 @@ private:
// in Degrees, doesn't apply to HMD like Oculus
float _fieldOfView = DEFAULT_FIELD_OF_VIEW_DEGREES;
// The actual FOV set by the user's monitor size and view distance
float _realWorldFieldOfView = DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES;
// keyhole attributes
float _keyholeRadius = DEFAULT_KEYHOLE_RADIUS;