mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 14:14:28 +02:00
More switches to new Settings
This commit is contained in:
parent
cdb0c22207
commit
6a00dcbf0a
19 changed files with 152 additions and 134 deletions
|
@ -1921,10 +1921,8 @@ Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileR
|
||||||
_cookieSessionHash.insert(cookieUUID, sessionData);
|
_cookieSessionHash.insert(cookieUUID, sessionData);
|
||||||
|
|
||||||
// persist the cookie to settings file so we can get it back on DS relaunch
|
// persist the cookie to settings file so we can get it back on DS relaunch
|
||||||
QSettings localSettings;
|
QStringList path = QStringList() << DS_SETTINGS_SESSIONS_GROUP << cookieUUID.toString();
|
||||||
localSettings.beginGroup(DS_SETTINGS_SESSIONS_GROUP);
|
SettingHandles::SettingHandle<QVariant>(path).set(QVariant::fromValue(sessionData));
|
||||||
QVariant sessionVariant = QVariant::fromValue(sessionData);
|
|
||||||
localSettings.setValue(cookieUUID.toString(), QVariant::fromValue(sessionData));
|
|
||||||
|
|
||||||
// setup expiry for cookie to 1 month from today
|
// setup expiry for cookie to 1 month from today
|
||||||
QDateTime cookieExpiry = QDateTime::currentDateTimeUtc().addMonths(1);
|
QDateTime cookieExpiry = QDateTime::currentDateTimeUtc().addMonths(1);
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QSettings>
|
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
@ -146,6 +145,12 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D
|
||||||
|
|
||||||
const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
|
const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<bool> firstRun("firstRun", true);
|
||||||
|
const SettingHandle<QString> lastScriptLocation("LastScriptLocation");
|
||||||
|
const SettingHandle<QString> scriptsLocation("scriptsLocation");
|
||||||
|
}
|
||||||
|
|
||||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
|
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
|
||||||
QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);
|
QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);
|
||||||
|
|
||||||
|
@ -428,21 +433,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
|
connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
|
||||||
|
|
||||||
// check first run...
|
// check first run...
|
||||||
Settings settings;
|
bool firstRun = SettingHandles::firstRun.get();
|
||||||
QString firstRunKey = "firstRun";
|
if (firstRun) {
|
||||||
QVariant firstRunValue = settings.value(firstRunKey, true);
|
|
||||||
if (firstRunValue.isValid() && firstRunValue.toBool()) {
|
|
||||||
qDebug() << "This is a first run...";
|
qDebug() << "This is a first run...";
|
||||||
// clear the scripts, and set out script to our default scripts
|
// clear the scripts, and set out script to our default scripts
|
||||||
clearScriptsBeforeRunning();
|
clearScriptsBeforeRunning();
|
||||||
loadScript(DEFAULT_SCRIPTS_JS_URL);
|
loadScript(DEFAULT_SCRIPTS_JS_URL);
|
||||||
|
|
||||||
settings.setValue(firstRunKey, false);
|
SettingHandles::firstRun.set(false);
|
||||||
} else {
|
} else {
|
||||||
// do this as late as possible so that all required subsystems are initialized
|
// do this as late as possible so that all required subsystems are initialized
|
||||||
loadScripts();
|
loadScripts();
|
||||||
|
|
||||||
_previousScriptLocation = settings.value("LastScriptLocation", "").toString();
|
_previousScriptLocation = SettingHandles::lastScriptLocation.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
_trayIcon->show();
|
_trayIcon->show();
|
||||||
|
@ -2968,7 +2971,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) {
|
||||||
_mirrorCamera.setPosition(_myAvatar->getPosition() +
|
_mirrorCamera.setPosition(_myAvatar->getPosition() +
|
||||||
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
|
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale());
|
||||||
|
|
||||||
} else if (_rearMirrorTools->getZoomLevel() == BODY) {
|
} else if (SettingHandles::rearViewZoomLevel.get() == BODY) {
|
||||||
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
_mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees
|
||||||
_mirrorCamera.setPosition(_myAvatar->getChestPosition() +
|
_mirrorCamera.setPosition(_myAvatar->getChestPosition() +
|
||||||
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
|
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale());
|
||||||
|
@ -3365,10 +3368,12 @@ void Application::packetSent(quint64 length) {
|
||||||
_bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(length);
|
_bandwidthMeter.outputStream(BandwidthMeter::OCTREE).updateValue(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString SETTINGS_KEY = "Settings";
|
||||||
|
|
||||||
void Application::loadScripts() {
|
void Application::loadScripts() {
|
||||||
// loads all saved scripts
|
// loads all saved scripts
|
||||||
Settings settings;
|
Settings settings;
|
||||||
int size = settings.beginReadArray("Settings");
|
int size = settings.beginReadArray(SETTINGS_KEY);
|
||||||
for (int i = 0; i < size; ++i){
|
for (int i = 0; i < size; ++i){
|
||||||
settings.setArrayIndex(i);
|
settings.setArrayIndex(i);
|
||||||
QString string = settings.value("script").toString();
|
QString string = settings.value("script").toString();
|
||||||
|
@ -3381,7 +3386,7 @@ void Application::loadScripts() {
|
||||||
|
|
||||||
void Application::clearScriptsBeforeRunning() {
|
void Application::clearScriptsBeforeRunning() {
|
||||||
// clears all scripts from the settings
|
// clears all scripts from the settings
|
||||||
Settings().remove("Settings");
|
SettingHandles::SettingHandle<QVariant>(SETTINGS_KEY).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveScripts() {
|
void Application::saveScripts() {
|
||||||
|
@ -3392,7 +3397,7 @@ void Application::saveScripts() {
|
||||||
|
|
||||||
// Saves all currently running user-loaded scripts
|
// Saves all currently running user-loaded scripts
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginWriteArray("Settings");
|
settings.beginWriteArray(SETTINGS_KEY);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto it = runningScripts.begin(); it != runningScripts.end(); ++it) {
|
for (auto it = runningScripts.begin(); it != runningScripts.end(); ++it) {
|
||||||
if (getScriptEngine(*it)->isUserLoaded()) {
|
if (getScriptEngine(*it)->isUserLoaded()) {
|
||||||
|
@ -3708,7 +3713,7 @@ QString Application::getPreviousScriptLocation() {
|
||||||
|
|
||||||
void Application::setPreviousScriptLocation(const QString& previousScriptLocation) {
|
void Application::setPreviousScriptLocation(const QString& previousScriptLocation) {
|
||||||
_previousScriptLocation = previousScriptLocation;
|
_previousScriptLocation = previousScriptLocation;
|
||||||
Settings().setValue("LastScriptLocation", _previousScriptLocation);
|
SettingHandles::lastScriptLocation.set(_previousScriptLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::loadDialog() {
|
void Application::loadDialog() {
|
||||||
|
@ -3744,11 +3749,11 @@ void Application::loadScriptURLDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Application::getScriptsLocation() const {
|
QString Application::getScriptsLocation() const {
|
||||||
return Settings().value("scriptsLocation", QString()).toString();
|
return SettingHandles::scriptsLocation.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setScriptsLocation(const QString& scriptsLocation) {
|
void Application::setScriptsLocation(const QString& scriptsLocation) {
|
||||||
Settings().setValue("scriptsLocation", scriptsLocation);
|
SettingHandles::scriptsLocation.set(scriptsLocation);
|
||||||
emit scriptLocationChanged(scriptsLocation);
|
emit scriptLocationChanged(scriptsLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,37 +24,20 @@
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QRect> windowGeometry("WindowGeometry", qApp->desktop()->availableGeometry());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
|
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::restoreGeometry() {
|
void MainWindow::restoreGeometry() {
|
||||||
QRect available = qApp->desktop()->availableGeometry();
|
setGeometry(SettingHandles::windowGeometry.get(qApp->desktop()->availableGeometry()));
|
||||||
|
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup("Window");
|
|
||||||
|
|
||||||
int x = (int)loadSetting(&settings, "x", 0);
|
|
||||||
int y = (int)loadSetting(&settings, "y", 0);
|
|
||||||
move(x, y);
|
|
||||||
|
|
||||||
int width = (int)loadSetting(&settings, "width", available.width());
|
|
||||||
int height = (int)loadSetting(&settings, "height", available.height());
|
|
||||||
resize(width, height);
|
|
||||||
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveGeometry() {
|
void MainWindow::saveGeometry() {
|
||||||
Settings settings;
|
SettingHandles::windowGeometry.set(geometry());
|
||||||
settings.beginGroup("Window");
|
|
||||||
|
|
||||||
settings.setValue("width", rect().width());
|
|
||||||
settings.setValue("height", rect().height());
|
|
||||||
|
|
||||||
settings.setValue("x", pos().x());
|
|
||||||
settings.setValue("y", pos().y());
|
|
||||||
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::moveEvent(QMoveEvent* event) {
|
void MainWindow::moveEvent(QMoveEvent* event) {
|
||||||
|
|
|
@ -60,8 +60,6 @@ static const QString BLENDSHAPE_FIELD = "bs";
|
||||||
static const QString S3_URL = "http://public.highfidelity.io";
|
static const QString S3_URL = "http://public.highfidelity.io";
|
||||||
static const QString MODEL_URL = "/api/v1/models";
|
static const QString MODEL_URL = "/api/v1/models";
|
||||||
|
|
||||||
static const QString SETTING_NAME = "LastModelUploadLocation";
|
|
||||||
|
|
||||||
static const unsigned long long MAX_SIZE = 50 * 1024 * BYTES_PER_MEGABYTES; // 50 GB (Virtually remove limit)
|
static const unsigned long long MAX_SIZE = 50 * 1024 * BYTES_PER_MEGABYTES; // 50 GB (Virtually remove limit)
|
||||||
static const int MAX_TEXTURE_SIZE = 1024;
|
static const int MAX_TEXTURE_SIZE = 1024;
|
||||||
static const int TIMEOUT = 1000;
|
static const int TIMEOUT = 1000;
|
||||||
|
@ -70,6 +68,11 @@ static const int MAX_CHECK = 30;
|
||||||
static const int QCOMPRESS_HEADER_POSITION = 0;
|
static const int QCOMPRESS_HEADER_POSITION = 0;
|
||||||
static const int QCOMPRESS_HEADER_SIZE = 4;
|
static const int QCOMPRESS_HEADER_SIZE = 4;
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QString> lastModelUploadLocation("LastModelUploadLocation",
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
|
}
|
||||||
|
|
||||||
void ModelUploader::uploadModel(ModelType modelType) {
|
void ModelUploader::uploadModel(ModelType modelType) {
|
||||||
ModelUploader* uploader = new ModelUploader(modelType);
|
ModelUploader* uploader = new ModelUploader(modelType);
|
||||||
QThread* thread = new QThread();
|
QThread* thread = new QThread();
|
||||||
|
@ -114,8 +117,7 @@ ModelUploader::~ModelUploader() {
|
||||||
|
|
||||||
bool ModelUploader::zip() {
|
bool ModelUploader::zip() {
|
||||||
// File Dialog
|
// File Dialog
|
||||||
Settings settings;
|
QString lastLocation = SettingHandles::lastModelUploadLocation.get();
|
||||||
QString lastLocation = settings.value(SETTING_NAME).toString();
|
|
||||||
|
|
||||||
if (lastLocation.isEmpty()) {
|
if (lastLocation.isEmpty()) {
|
||||||
lastLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
lastLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
@ -132,7 +134,7 @@ bool ModelUploader::zip() {
|
||||||
// If the user canceled we return.
|
// If the user canceled we return.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
settings.setValue(SETTING_NAME, filename);
|
SettingHandles::lastModelUploadLocation.set(filename);
|
||||||
|
|
||||||
// First we check the FST file (if any)
|
// First we check the FST file (if any)
|
||||||
QFile* fst;
|
QFile* fst;
|
||||||
|
|
|
@ -238,14 +238,6 @@ void runTimingTests() {
|
||||||
qDebug("vec3 assign and dot() usecs: %f, last result:%f", elapsedUsecs / (float) numTests, result);
|
qDebug("vec3 assign and dot() usecs: %f, last result:%f", elapsedUsecs / (float) numTests, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
|
||||||
float value = settings->value(name, defaultValue).toFloat();
|
|
||||||
if (glm::isnan(value)) {
|
|
||||||
value = defaultValue;
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rayIntersectsSphere(const glm::vec3& rayStarting, const glm::vec3& rayNormalizedDirection,
|
bool rayIntersectsSphere(const glm::vec3& rayStarting, const glm::vec3& rayNormalizedDirection,
|
||||||
const glm::vec3& sphereCenter, float sphereRadius, float& distance) {
|
const glm::vec3& sphereCenter, float sphereRadius, float& distance) {
|
||||||
glm::vec3 relativeOrigin = rayStarting - sphereCenter;
|
glm::vec3 relativeOrigin = rayStarting - sphereCenter;
|
||||||
|
|
|
@ -31,8 +31,6 @@ void renderBevelCornersRect(int x, int y, int width, int height, int bevelDistan
|
||||||
|
|
||||||
void runTimingTests();
|
void runTimingTests();
|
||||||
|
|
||||||
float loadSetting(QSettings* settings, const char* name, float defaultValue);
|
|
||||||
|
|
||||||
bool rayIntersectsSphere(const glm::vec3& rayStarting, const glm::vec3& rayNormalizedDirection,
|
bool rayIntersectsSphere(const glm::vec3& rayStarting, const glm::vec3& rayNormalizedDirection,
|
||||||
const glm::vec3& sphereCenter, float sphereRadius, float& distance);
|
const glm::vec3& sphereCenter, float sphereRadius, float& distance);
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ glm::quat Avatar::getWorldAlignedOrientation () const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float Avatar::getLODDistance() const {
|
float Avatar::getLODDistance() const {
|
||||||
return DependencyManager::get<LODManager>()->getAvatarLODDistanceMultiplier() *
|
return SettingHandles::avatarLODDistanceMultiplier.get() *
|
||||||
glm::distance(Application::getInstance()->getCamera()->getPosition(), _position) / _scale;
|
glm::distance(qApp->getCamera()->getPosition(), _position) / _scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::simulate(float deltaTime) {
|
void Avatar::simulate(float deltaTime) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ SettingsScriptingInterface* SettingsScriptingInterface::getInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SettingsScriptingInterface::getValue(const QString& setting) {
|
QVariant SettingsScriptingInterface::getValue(const QString& setting) {
|
||||||
QVariant value = Settings().value(setting);
|
QVariant value = SettingHandles::SettingHandle<QVariant>(setting).get();
|
||||||
if (!value.isValid()) {
|
if (!value.isValid()) {
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVariant& defaultValue) {
|
QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVariant& defaultValue) {
|
||||||
QVariant value = Settings().value(setting, defaultValue);
|
QVariant value = SettingHandles::SettingHandle<QVariant>(setting, defaultValue).get();
|
||||||
if (!value.isValid()) {
|
if (!value.isValid()) {
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,5 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVar
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsScriptingInterface::setValue(const QString& setting, const QVariant& value) {
|
void SettingsScriptingInterface::setValue(const QString& setting, const QVariant& value) {
|
||||||
Settings().setValue(setting, value);
|
SettingHandles::SettingHandle<QVariant>(setting).set(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QString> animationDirectory("animation_directory", QString());
|
||||||
|
}
|
||||||
|
|
||||||
AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
||||||
QDialog(parent) {
|
QDialog(parent) {
|
||||||
|
|
||||||
|
@ -159,13 +163,12 @@ AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePo
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationPanel::chooseURL() {
|
void AnimationPanel::chooseURL() {
|
||||||
Settings settings;
|
QString directory = SettingHandles::animationDirectory.get();
|
||||||
QString directory = settings.value("animation_directory").toString();
|
|
||||||
QString filename = QFileDialog::getOpenFileName(this, "Choose Animation", directory, "Animation files (*.fbx)");
|
QString filename = QFileDialog::getOpenFileName(this, "Choose Animation", directory, "Animation files (*.fbx)");
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.setValue("animation_directory", QFileInfo(filename).path());
|
SettingHandles::animationDirectory.set(QFileInfo(filename).path());
|
||||||
_url->setText(QUrl::fromLocalFile(filename).toString());
|
_url->setText(QUrl::fromLocalFile(filename).toString());
|
||||||
emit _url->returnPressed();
|
emit _url->returnPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ const QRegularExpression regexHifiLinks("([#@]\\S+)");
|
||||||
const QString mentionSoundsPath("/mention-sounds/");
|
const QString mentionSoundsPath("/mention-sounds/");
|
||||||
const QString mentionRegex("@(\\b%1\\b)");
|
const QString mentionRegex("@(\\b%1\\b)");
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QDateTime> usernameMentionTimestamp("MentionTimestamp", QDateTime());
|
||||||
|
}
|
||||||
|
|
||||||
ChatWindow::ChatWindow(QWidget* parent) :
|
ChatWindow::ChatWindow(QWidget* parent) :
|
||||||
QWidget(parent, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint |
|
QWidget(parent, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint |
|
||||||
Qt::WindowCloseButtonHint),
|
Qt::WindowCloseButtonHint),
|
||||||
|
@ -378,10 +382,9 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
|
||||||
if (message.body().contains(usernameMention)) {
|
if (message.body().contains(usernameMention)) {
|
||||||
|
|
||||||
// Don't show messages already seen in icon tray at start-up.
|
// Don't show messages already seen in icon tray at start-up.
|
||||||
Settings settings;
|
bool showMessage = SettingHandles::usernameMentionTimestamp.get() < _lastMessageStamp;
|
||||||
bool showMessage = settings.value("usernameMentionTimestamp").toDateTime() < _lastMessageStamp;
|
|
||||||
if (showMessage) {
|
if (showMessage) {
|
||||||
settings.setValue("usernameMentionTimestamp", _lastMessageStamp);
|
SettingHandles::usernameMentionTimestamp.set(_lastMessageStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHidden() && showMessage) {
|
if (isHidden() && showMessage) {
|
||||||
|
|
|
@ -20,8 +20,11 @@
|
||||||
|
|
||||||
#include "InfoView.h"
|
#include "InfoView.h"
|
||||||
|
|
||||||
#define SETTINGS_VERSION_KEY "info-version"
|
static const float MAX_DIALOG_HEIGHT_RATIO = 0.9f;
|
||||||
#define MAX_DIALOG_HEIGHT_RATIO 0.9
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QString> infoVersion("info-version", QString());
|
||||||
|
}
|
||||||
|
|
||||||
InfoView::InfoView(bool forced, QString path) :
|
InfoView::InfoView(bool forced, QString path) :
|
||||||
_forced(forced)
|
_forced(forced)
|
||||||
|
@ -49,15 +52,13 @@ bool InfoView::shouldShow() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings settings;
|
QString lastVersion = SettingHandles::infoVersion.get();
|
||||||
|
|
||||||
QString lastVersion = settings.value(SETTINGS_VERSION_KEY).toString();
|
|
||||||
|
|
||||||
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
|
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
|
||||||
QString version = versionTag.attribute("value");
|
QString version = versionTag.attribute("value");
|
||||||
|
|
||||||
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
|
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
|
||||||
settings.setValue(SETTINGS_VERSION_KEY, version);
|
SettingHandles::infoVersion.set(version);
|
||||||
shouldShow = true;
|
shouldShow = true;
|
||||||
} else {
|
} else {
|
||||||
shouldShow = false;
|
shouldShow = false;
|
||||||
|
|
|
@ -14,16 +14,12 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <Settings.h>
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "RearMirrorTools.h"
|
#include "RearMirrorTools.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
|
||||||
const char SETTINGS_GROUP_NAME[] = "Rear View Tools";
|
|
||||||
const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel";
|
|
||||||
const int ICON_SIZE = 24;
|
const int ICON_SIZE = 24;
|
||||||
const int ICON_PADDING = 5;
|
const int ICON_PADDING = 5;
|
||||||
|
|
||||||
|
@ -56,8 +52,9 @@ void RearMirrorTools::render(bool fullScreen) {
|
||||||
if (_windowed) {
|
if (_windowed) {
|
||||||
displayIcon(_bounds, _closeIconRect, _closeTextureId);
|
displayIcon(_bounds, _closeIconRect, _closeTextureId);
|
||||||
|
|
||||||
displayIcon(_bounds, _headZoomIconRect, _zoomHeadTextureId, getZoomLevel() == HEAD);
|
ZoomLevel zoomLevel = (ZoomLevel)SettingHandles::rearViewZoomLevel.get();
|
||||||
displayIcon(_bounds, _bodyZoomIconRect, _zoomBodyTextureId, getZoomLevel() == BODY);
|
displayIcon(_bounds, _headZoomIconRect, _zoomHeadTextureId, zoomLevel == HEAD);
|
||||||
|
displayIcon(_bounds, _bodyZoomIconRect, _zoomBodyTextureId, zoomLevel == BODY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,12 +68,12 @@ bool RearMirrorTools::mousePressEvent(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_headZoomIconRect.contains(x, y)) {
|
if (_headZoomIconRect.contains(x, y)) {
|
||||||
setZoomLevel(HEAD);
|
SettingHandles::rearViewZoomLevel.set(HEAD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_bodyZoomIconRect.contains(x, y)) {
|
if (_bodyZoomIconRect.contains(x, y)) {
|
||||||
setZoomLevel(BODY);
|
SettingHandles::rearViewZoomLevel.set(BODY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,22 +94,6 @@ bool RearMirrorTools::mousePressEvent(int x, int y) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoomLevel RearMirrorTools::getZoomLevel() {
|
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup(SETTINGS_GROUP_NAME);
|
|
||||||
ZoomLevel zoomLevel = (ZoomLevel)settings.value(ZOOM_LEVEL_SETTINGS, HEAD).toInt();
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
return zoomLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RearMirrorTools::setZoomLevel(ZoomLevel zoomLevel) {
|
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup(SETTINGS_GROUP_NAME);
|
|
||||||
settings.setValue(ZOOM_LEVEL_SETTINGS, zoomLevel);
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RearMirrorTools::displayIcon(QRect bounds, QRect iconBounds, GLuint textureId, bool selected) {
|
void RearMirrorTools::displayIcon(QRect bounds, QRect iconBounds, GLuint textureId, bool selected) {
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
|
|
@ -16,11 +16,20 @@
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
|
#include <Settings.h>
|
||||||
|
|
||||||
enum ZoomLevel {
|
enum ZoomLevel {
|
||||||
HEAD,
|
HEAD = 0,
|
||||||
BODY
|
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 {
|
class RearMirrorTools : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -28,9 +37,6 @@ public:
|
||||||
void render(bool fullScreen);
|
void render(bool fullScreen);
|
||||||
bool mousePressEvent(int x, int y);
|
bool mousePressEvent(int x, int y);
|
||||||
|
|
||||||
ZoomLevel getZoomLevel();
|
|
||||||
void setZoomLevel(ZoomLevel zoomLevel);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closeView();
|
void closeView();
|
||||||
void shrinkView();
|
void shrinkView();
|
||||||
|
|
|
@ -485,6 +485,10 @@ void QColorEditor::selectColor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QStringList> editorURLs("editorURLs");
|
||||||
|
}
|
||||||
|
|
||||||
QUrlEditor::QUrlEditor(QWidget* parent) :
|
QUrlEditor::QUrlEditor(QWidget* parent) :
|
||||||
QComboBox(parent) {
|
QComboBox(parent) {
|
||||||
|
|
||||||
|
@ -492,7 +496,7 @@ QUrlEditor::QUrlEditor(QWidget* parent) :
|
||||||
setInsertPolicy(InsertAtTop);
|
setInsertPolicy(InsertAtTop);
|
||||||
|
|
||||||
// populate initial URL list from settings
|
// populate initial URL list from settings
|
||||||
addItems(Settings().value("editorURLs").toStringList());
|
addItems(SettingHandles::editorURLs.get());
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(const QString&)), SLOT(updateURL(const QString&)));
|
connect(this, SIGNAL(activated(const QString&)), SLOT(updateURL(const QString&)));
|
||||||
connect(model(), SIGNAL(rowsInserted(const QModelIndex&,int,int)), SLOT(updateSettings()));
|
connect(model(), SIGNAL(rowsInserted(const QModelIndex&,int,int)), SLOT(updateSettings()));
|
||||||
|
@ -512,7 +516,7 @@ void QUrlEditor::updateSettings() {
|
||||||
for (int i = 0, size = qMin(MAX_STORED_URLS, count()); i < size; i++) {
|
for (int i = 0, size = qMin(MAX_STORED_URLS, count()); i < size; i++) {
|
||||||
urls.append(itemText(i));
|
urls.append(itemText(i));
|
||||||
}
|
}
|
||||||
Settings().setValue("editorURLs", urls);
|
SettingHandles::editorURLs.set(urls);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseVec3Editor::BaseVec3Editor(QWidget* parent) : QWidget(parent) {
|
BaseVec3Editor::BaseVec3Editor(QWidget* parent) : QWidget(parent) {
|
||||||
|
|
|
@ -58,6 +58,10 @@ static QItemEditorCreatorBase* heightfieldColorEditorCreator = createHeightfield
|
||||||
const float DEFAULT_PLACEMENT_GRANULARITY = 0.01f;
|
const float DEFAULT_PLACEMENT_GRANULARITY = 0.01f;
|
||||||
const float DEFAULT_VOXELIZATION_GRANULARITY = powf(2.0f, -3.0f);
|
const float DEFAULT_VOXELIZATION_GRANULARITY = powf(2.0f, -3.0f);
|
||||||
|
|
||||||
|
namespace SettingHandles {
|
||||||
|
const SettingHandle<QString> heightfieldDir("heightDir", QString());
|
||||||
|
}
|
||||||
|
|
||||||
Spanner::Spanner() :
|
Spanner::Spanner() :
|
||||||
_renderer(NULL),
|
_renderer(NULL),
|
||||||
_placementGranularity(DEFAULT_PLACEMENT_GRANULARITY),
|
_placementGranularity(DEFAULT_PLACEMENT_GRANULARITY),
|
||||||
|
@ -610,13 +614,13 @@ static int getHeightfieldSize(int size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeightfieldHeightEditor::select() {
|
void HeightfieldHeightEditor::select() {
|
||||||
Settings settings;
|
QString result = QFileDialog::getOpenFileName(this, "Select Height Image",
|
||||||
QString result = QFileDialog::getOpenFileName(this, "Select Height Image", settings.value("heightDir").toString(),
|
SettingHandles::heightfieldDir.get(),
|
||||||
"Images (*.png *.jpg *.bmp *.raw *.mdr)");
|
"Images (*.png *.jpg *.bmp *.raw *.mdr)");
|
||||||
if (result.isNull()) {
|
if (result.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.setValue("heightDir", QFileInfo(result).path());
|
SettingHandles::heightfieldDir.set(QFileInfo(result).path());
|
||||||
const quint16 CONVERSION_OFFSET = 1;
|
const quint16 CONVERSION_OFFSET = 1;
|
||||||
QString lowerResult = result.toLower();
|
QString lowerResult = result.toLower();
|
||||||
bool isMDR = lowerResult.endsWith(".mdr");
|
bool isMDR = lowerResult.endsWith(".mdr");
|
||||||
|
@ -920,13 +924,13 @@ void HeightfieldColorEditor::setColor(const HeightfieldColorPointer& color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeightfieldColorEditor::select() {
|
void HeightfieldColorEditor::select() {
|
||||||
Settings settings;
|
QString result = QFileDialog::getOpenFileName(this, "Select Color Image",
|
||||||
QString result = QFileDialog::getOpenFileName(this, "Select Color Image", settings.value("heightDir").toString(),
|
SettingHandles::heightfieldDir.get(),
|
||||||
"Images (*.png *.jpg *.bmp)");
|
"Images (*.png *.jpg *.bmp)");
|
||||||
if (result.isNull()) {
|
if (result.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.setValue("heightDir", QFileInfo(result).path());
|
SettingHandles::heightfieldDir.get(QFileInfo(result).path());
|
||||||
QImage image;
|
QImage image;
|
||||||
if (!image.load(result)) {
|
if (!image.load(result)) {
|
||||||
QMessageBox::warning(this, "Invalid Image", "The selected image could not be read.");
|
QMessageBox::warning(this, "Invalid Image", "The selected image could not be read.");
|
||||||
|
|
|
@ -90,11 +90,9 @@ void AccountManager::logout() {
|
||||||
connect(&_accountInfo, &DataServerAccountInfo::balanceChanged, this, &AccountManager::accountInfoBalanceChanged);
|
connect(&_accountInfo, &DataServerAccountInfo::balanceChanged, this, &AccountManager::accountInfoBalanceChanged);
|
||||||
|
|
||||||
if (_shouldPersistToSettingsFile) {
|
if (_shouldPersistToSettingsFile) {
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup(ACCOUNTS_GROUP);
|
|
||||||
|
|
||||||
QString keyURLString(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE));
|
QString keyURLString(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE));
|
||||||
settings.remove(keyURLString);
|
QStringList path = QStringList() << ACCOUNTS_GROUP << keyURLString;
|
||||||
|
SettingHandles::SettingHandle<DataServerAccountInfo>(path).remove();
|
||||||
|
|
||||||
qDebug() << "Removed account info for" << _authURL << "from in-memory accounts and .ini file";
|
qDebug() << "Removed account info for" << _authURL << "from in-memory accounts and .ini file";
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,7 +133,7 @@ void AccountManager::setAuthURL(const QUrl& authURL) {
|
||||||
foreach(const QString& key, settings.allKeys()) {
|
foreach(const QString& key, settings.allKeys()) {
|
||||||
// take a key copy to perform the double slash replacement
|
// take a key copy to perform the double slash replacement
|
||||||
QString keyCopy(key);
|
QString keyCopy(key);
|
||||||
QUrl keyURL(keyCopy.replace("slashslash", "//"));
|
QUrl keyURL(keyCopy.replace(DOUBLE_SLASH_SUBSTITUTE, "//"));
|
||||||
|
|
||||||
if (keyURL == _authURL) {
|
if (keyURL == _authURL) {
|
||||||
// pull out the stored access token and store it in memory
|
// pull out the stored access token and store it in memory
|
||||||
|
@ -324,10 +322,9 @@ void AccountManager::passErrorToCallback(QNetworkReply* requestReply) {
|
||||||
void AccountManager::persistAccountToSettings() {
|
void AccountManager::persistAccountToSettings() {
|
||||||
if (_shouldPersistToSettingsFile) {
|
if (_shouldPersistToSettingsFile) {
|
||||||
// store this access token into the local settings
|
// store this access token into the local settings
|
||||||
Settings localSettings;
|
QString keyURLString(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE));
|
||||||
localSettings.beginGroup(ACCOUNTS_GROUP);
|
QStringList path = QStringList() << ACCOUNTS_GROUP << keyURLString;
|
||||||
localSettings.setValue(_authURL.toString().replace("//", DOUBLE_SLASH_SUBSTITUTE),
|
SettingHandles::SettingHandle<QVariant>(path).set(QVariant::fromValue(_accountInfo));
|
||||||
QVariant::fromValue(_accountInfo));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,14 @@
|
||||||
|
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
AddressManager::AddressManager() :
|
AddressManager::AddressManager() :
|
||||||
_rootPlaceName(),
|
_rootPlaceName(),
|
||||||
_rootPlaceID(),
|
_rootPlaceID(),
|
||||||
|
@ -47,25 +55,16 @@ const QUrl AddressManager::currentAddress() const {
|
||||||
return hifiURL;
|
return hifiURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
|
||||||
const QString SETTINGS_CURRENT_ADDRESS_KEY = "address";
|
|
||||||
|
|
||||||
void AddressManager::loadSettings(const QString& lookupString) {
|
void AddressManager::loadSettings(const QString& lookupString) {
|
||||||
if (lookupString.isEmpty()) {
|
if (lookupString.isEmpty()) {
|
||||||
Settings settings;
|
handleLookupString(SettingHandles::currentAddress.get().toString());
|
||||||
settings.beginGroup(ADDRESS_MANAGER_SETTINGS_GROUP);
|
|
||||||
handleLookupString(settings.value(SETTINGS_CURRENT_ADDRESS_KEY).toString());
|
|
||||||
} else {
|
} else {
|
||||||
handleLookupString(lookupString);
|
handleLookupString(lookupString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressManager::storeCurrentAddress() {
|
void AddressManager::storeCurrentAddress() {
|
||||||
Settings settings;
|
SettingHandles::currentAddress.set(currentAddress());
|
||||||
|
|
||||||
settings.beginGroup(ADDRESS_MANAGER_SETTINGS_GROUP);
|
|
||||||
settings.setValue(SETTINGS_CURRENT_ADDRESS_KEY, currentAddress());
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AddressManager::currentPath(bool withOrientation) const {
|
const QString AddressManager::currentPath(bool withOrientation) const {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
|
@ -22,4 +23,8 @@ void SettingsBridge::setInSettings(const QString& key, const QVariant& value) {
|
||||||
QSettings().setValue(key, value);
|
QSettings().setValue(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsBridge::removeFromSettings(const QString& key) {
|
||||||
|
QSettings().remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,16 +17,28 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
|
#include <glm/glm.hpp>
|
||||||
class Settings : public QSettings {
|
class Settings : public QSettings {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
float loadSetting(QSettings* settings, const char* name, float defaultValue) {
|
||||||
|
float value = settings->value(name, defaultValue).toFloat();
|
||||||
|
if (glm::isnan(value)) {
|
||||||
|
value = defaultValue;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
////
|
||||||
|
|
||||||
namespace SettingHandles {
|
namespace SettingHandles {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class SettingHandle {
|
class SettingHandle {
|
||||||
public:
|
public:
|
||||||
|
SettingHandle(const QString& key);
|
||||||
|
SettingHandle(const QStringList& path);
|
||||||
SettingHandle(const QString& key, const T& defaultValue);
|
SettingHandle(const QString& key, const T& defaultValue);
|
||||||
|
SettingHandle(const QStringList& path, const T& defaultValue);
|
||||||
|
|
||||||
T get() const; // Returns setting value, returns its default value if not found
|
T get() const; // Returns setting value, returns its default value if not found
|
||||||
T get(const T& other) const; // Returns setting value, returns other if not found
|
T get(const T& other) const; // Returns setting value, returns other if not found
|
||||||
|
@ -35,6 +47,8 @@ public:
|
||||||
void set(const T& value) const;
|
void set(const T& value) const;
|
||||||
void reset() const;
|
void reset() const;
|
||||||
|
|
||||||
|
void remove() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString _key;
|
const QString _key;
|
||||||
const QVariant _defaultValue;
|
const QVariant _defaultValue;
|
||||||
|
@ -44,13 +58,31 @@ class SettingsBridge {
|
||||||
private:
|
private:
|
||||||
static QVariant getFromSettings(const QString& key, const QVariant& defaultValue);
|
static QVariant getFromSettings(const QString& key, const QVariant& defaultValue);
|
||||||
static void setInSettings(const QString& key, const QVariant& value);
|
static void setInSettings(const QString& key, const QVariant& value);
|
||||||
|
static void removeFromSettings(const QString& key);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
friend class SettingHandle;
|
friend class SettingHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
SettingHandle<T>::SettingHandle(const QString& key, const T& defaultValue) : _key(key), _defaultValue(defaultValue) {
|
SettingHandle<T>::SettingHandle(const QString& key) : _key(key) {
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
SettingHandle<T>::SettingHandle(const QStringList& path) : _key(path.join("/")) {
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
SettingHandle<T>::SettingHandle(const QString& key, const T& defaultValue) :
|
||||||
|
_key(key),
|
||||||
|
_defaultValue(defaultValue) {
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
SettingHandle<T>::SettingHandle(const QStringList& path, const T& defaultValue) :
|
||||||
|
_key(path.join("/")),
|
||||||
|
_defaultValue(defaultValue) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -83,7 +115,12 @@ void SettingHandle<T>::set(const T& value) const {
|
||||||
|
|
||||||
template <typename T> inline
|
template <typename T> inline
|
||||||
void SettingHandle<T>::reset() const {
|
void SettingHandle<T>::reset() const {
|
||||||
setInSettings(_key, _defaultValue);
|
SettingsBridge::setInSettings(_key, _defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> inline
|
||||||
|
void SettingHandle<T>::remove() const {
|
||||||
|
SettingsBridge::removeFromSettings(_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue