diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-22 16:00:44 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-24 21:26:38 -0800 |
commit | 15fece7da2c8e9c78fe6c61dbcea0c0b0654b6a8 (patch) | |
tree | 07ddf2799a4a8a52b945f6eced0926eb290c2e86 /subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | |
parent | e7412b11b99a67c4beb8841f6bca763519553f9d (diff) | |
download | subsurface-15fece7da2c8e9c78fe6c61dbcea0c0b0654b6a8.tar.gz |
Added Display Settings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r-- | subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index 4684b744a..5d42d1829 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1,5 +1,8 @@ #include "SettingsObjectWrapper.h" #include <QSettings> +#include <QApplication> +#include <QFont> + #include "../dive.h" // TODO: remove copy_string from dive.h @@ -1331,3 +1334,58 @@ void GeneralSettingsObjectWrapper::setPscrRatio(int value) prefs.pscr_ratio = value.; emit pscrRatioChanged(value); } + +DisplaySettingsObjectWrapper::DisplaySettingsObjectWrapper(QObject *parent) : + QObject(parent), + group(QStringLiteral("Display")) +{ +} + +QString DisplaySettingsObjectWrapper::divelistFont() const +{ + return prefs.divelist_font; +} + +double DisplaySettingsObjectWrapper::fontSize() const +{ + return prefs.font_size; +} + +short DisplaySettingsObjectWrapper::displayInvalidDives() const +{ + return prefs.display_invalid_dives; +} + +void DisplaySettingsObjectWrapper::setDivelistFont(const QString& value) +{ + QSettings s; + s.setValue("divelist_font", value); + if (value.contains(",")) + value = value.left(value.indexOf(",")); + + if (!subsurface_ignore_font(value.toUtf8().constData())) { + free((void *)prefs.divelist_font); + prefs.divelist_font = strdup(value.toUtf8().constData()); + qApp->setFont(QFont(value)); + } + emit divelistFontChanged(value); +} + +void DisplaySettingsObjectWrapper::setFontSize(double value) +{ + QSettings s; + s.setValue("font_size", value); + prefs.font_size = value.; + QFont defaultFont = qApp->font(); + defaultFont.setPointSizeF(prefs.font_size); + qApp->setFont(defaultFont); + emit fontSizeChanged(value); +} + +void DisplaySettingsObjectWrapper::setDisplayInvalidDives(short value) +{ + QSettings s; + s.setValue("displayinvalid", value); + prefs.display_invalid_dives = value.; + emit displayInvalidDivesChanged(value); +} |