interface/ui uses new settings

This commit is contained in:
Atlante45 2015-01-19 22:49:27 -08:00
parent 27390e6c99
commit cdb0c22207
5 changed files with 27 additions and 38 deletions

View file

@ -1947,7 +1947,7 @@ void DomainServer::loadExistingSessionsFromSettings() {
Settings domainServerSettings;
domainServerSettings.beginGroup(DS_SETTINGS_SESSIONS_GROUP);
foreach(const QString& uuidKey, domainServerSettings.childKeys())
foreach(const QString& uuidKey, domainServerSettings.childKeys()) {
_cookieSessionHash.insert(QUuid(uuidKey),
domainServerSettings.value(uuidKey).value<DomainServerWebSessionData>());
qDebug() << "Pulled web session from settings - cookie UUID is" << uuidKey;

View file

@ -80,16 +80,16 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) :
form->addRow("You can see... ", _feedback);
form->addRow("Automatic Avatar LOD Adjustment:", _automaticAvatarLOD = new QCheckBox(this));
_automaticAvatarLOD->setChecked(lodManager->getAutomaticAvatarLOD());
_automaticAvatarLOD->setChecked(SettingHandles::automaticAvatarLOD.get());
connect(_automaticAvatarLOD, SIGNAL(toggled(bool)), SLOT(updateAvatarLODControls()));
form->addRow("Decrease Avatar LOD Below FPS:", _avatarLODDecreaseFPS = new QDoubleSpinBox(this));
_avatarLODDecreaseFPS->setValue(lodManager->getAvatarLODDecreaseFPS());
_avatarLODDecreaseFPS->setValue(SettingHandles::avatarLODDecreaseFPS.get());
_avatarLODDecreaseFPS->setDecimals(0);
connect(_avatarLODDecreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateAvatarLODValues()));
form->addRow("Increase Avatar LOD Above FPS:", _avatarLODIncreaseFPS = new QDoubleSpinBox(this));
_avatarLODIncreaseFPS->setValue(lodManager->getAvatarLODIncreaseFPS());
_avatarLODIncreaseFPS->setValue(SettingHandles::avatarLODIncreaseFPS.get());
_avatarLODIncreaseFPS->setDecimals(0);
connect(_avatarLODIncreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateAvatarLODValues()));
@ -97,7 +97,7 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) :
_avatarLOD->setDecimals(3);
_avatarLOD->setRange(1.0 / MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER, 1.0 / MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER);
_avatarLOD->setSingleStep(0.001);
_avatarLOD->setValue(1.0 / lodManager->getAvatarLODDistanceMultiplier());
_avatarLOD->setValue(1.0 / SettingHandles::avatarLODDistanceMultiplier.get());
connect(_avatarLOD, SIGNAL(valueChanged(double)), SLOT(updateAvatarLODValues()));
// Add a button to reset
@ -120,8 +120,7 @@ void LodToolsDialog::reloadSliders() {
void LodToolsDialog::updateAvatarLODControls() {
QFormLayout* form = static_cast<QFormLayout*>(layout());
auto lodManager = DependencyManager::get<LODManager>();
lodManager->setAutomaticAvatarLOD(_automaticAvatarLOD->isChecked());
SettingHandles::automaticAvatarLOD.set(_automaticAvatarLOD->isChecked());
_avatarLODDecreaseFPS->setVisible(_automaticAvatarLOD->isChecked());
form->labelForField(_avatarLODDecreaseFPS)->setVisible(_automaticAvatarLOD->isChecked());
@ -133,7 +132,7 @@ void LodToolsDialog::updateAvatarLODControls() {
form->labelForField(_avatarLOD)->setVisible(!_automaticAvatarLOD->isChecked());
if (!_automaticAvatarLOD->isChecked()) {
_avatarLOD->setValue(1.0 / lodManager->getAvatarLODDistanceMultiplier());
_avatarLOD->setValue(1.0 / SettingHandles::avatarLODDistanceMultiplier.get());
}
if (isVisible()) {
@ -142,13 +141,12 @@ void LodToolsDialog::updateAvatarLODControls() {
}
void LodToolsDialog::updateAvatarLODValues() {
auto lodManager = DependencyManager::get<LODManager>();
if (_automaticAvatarLOD->isChecked()) {
lodManager->setAvatarLODDecreaseFPS(_avatarLODDecreaseFPS->value());
lodManager->setAvatarLODIncreaseFPS(_avatarLODIncreaseFPS->value());
SettingHandles::avatarLODDecreaseFPS.set(_avatarLODDecreaseFPS->value());
SettingHandles::avatarLODIncreaseFPS.set(_avatarLODIncreaseFPS->value());
} else {
lodManager->setAvatarLODDistanceMultiplier(1.0 / _avatarLOD->value());
SettingHandles::avatarLODDistanceMultiplier.set(1.0 / _avatarLOD->value());
}
}

View file

@ -121,7 +121,7 @@ void PreferencesDialog::loadPreferences() {
ui.sendDataCheckBox->setChecked(!menuInstance->isOptionChecked(MenuOption::DisableActivityLogger));
ui.snapshotLocationEdit->setText(Snapshot::getSnapshotsLocation());
ui.snapshotLocationEdit->setText(SettingHandles::snapshotsLocation.get());
ui.scriptsLocationEdit->setText(qApp->getScriptsLocation());
@ -219,7 +219,7 @@ void PreferencesDialog::savePreferences() {
}
if (!ui.snapshotLocationEdit->text().isEmpty() && QDir(ui.snapshotLocationEdit->text()).exists()) {
Snapshot::setSnapshotsLocation(ui.snapshotLocationEdit->text());
SettingHandles::snapshotsLocation.set(ui.snapshotLocationEdit->text());
}
if (!ui.scriptsLocationEdit->text().isEmpty() && QDir(ui.scriptsLocationEdit->text()).exists()) {

View file

@ -11,8 +11,10 @@
#include <QDateTime>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QStandardPaths>
#include <QImage>
#include <QTemporaryFile>
#include <AccountManager.h>
#include <Application.h>
@ -38,8 +40,6 @@ const QString ORIENTATION_W = "orientation-w";
const QString DOMAIN_KEY = "domain";
QString Snapshot::_snapshotsLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) {
if (!QFile(snapshotPath).exists()) {
@ -122,7 +122,7 @@ QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
const int IMAGE_QUALITY = 100;
if (!isTemporary) {
QString snapshotFullPath = getSnapshotsLocation();
QString snapshotFullPath = SettingHandles::snapshotsLocation.get();
if (!snapshotFullPath.endsWith(QDir::separator())) {
snapshotFullPath.append(QDir::separator());
@ -152,13 +152,4 @@ QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
}
}
QString Snapshot::getSnapshotsLocation() {
if (_snapshotsLocation.isNull() ||
_snapshotsLocation.isEmpty() ||
QDir(_snapshotsLocation).exists() == false) {
return QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
}
return _snapshotsLocation;
}

View file

@ -12,15 +12,19 @@
#ifndef hifi_Snapshot_h
#define hifi_Snapshot_h
#include "InterfaceConfig.h"
#include <glm/glm.hpp>
#include <qimage.h>
#include <qfile.h>
#include <qtemporaryfile.h>
#include <QGLWidget>
#include <qstring.h>
#include <QString>
#include "avatar/Avatar.h"
#include <Settings.h>
class QFile;
class QTemporaryFile;
namespace SettingHandles {
const SettingHandle<QString> snapshotsLocation("snapshotsLocation",
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
}
class SnapshotMetaData {
public:
@ -42,16 +46,12 @@ private:
class Snapshot {
public:
static QString getSnapshotsLocation();
static void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; }
static QString saveSnapshot();
static QTemporaryFile* saveTempSnapshot();
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
private:
static QFile* savedFileForSnapshot(bool isTemporary);
static QString _snapshotsLocation;
};
#endif // hifi_Snapshot_h