mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Settings update: Add UpdateManagerSettings to SettingsObjectWrapper
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4f2057cd30
commit
5c8b87b5fd
3 changed files with 89 additions and 4 deletions
|
@ -2,10 +2,60 @@
|
|||
#include <QSettings>
|
||||
#include <QApplication>
|
||||
#include <QFont>
|
||||
#include <QDate>
|
||||
|
||||
#include "../dive.h" // TODO: remove copy_string from dive.h
|
||||
|
||||
|
||||
UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent), group("UpdateManager")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool UpdateManagerSettings::dontCheckForUpdates() const
|
||||
{
|
||||
return prefs.update_manager.dont_check_for_updates;
|
||||
}
|
||||
|
||||
QString UpdateManagerSettings::lastVersionUsed() const
|
||||
{
|
||||
return prefs.update_manager.last_version_used;
|
||||
}
|
||||
|
||||
QDate UpdateManagerSettings::nextCheck() const
|
||||
{
|
||||
return QDate::fromString(QString(prefs.update_manager.next_check));
|
||||
}
|
||||
|
||||
void UpdateManagerSettings::setDontCheckForUpdates(bool value)
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup(group);
|
||||
s.setValue("DontCheckForUpdates", value);
|
||||
prefs.update_manager.dont_check_for_updates = value;
|
||||
emit dontCheckForUpdatesChanged(value);
|
||||
}
|
||||
|
||||
void UpdateManagerSettings::setLastVersionUsed(const QString& value)\
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup(group);
|
||||
s.setValue("LastVersionUsed", value);
|
||||
free (prefs.update_manager.last_version_used);
|
||||
prefs.update_manager.last_version_used = copy_string(qPrintable(value));
|
||||
emit lastVersionUsedChanged(value);
|
||||
}
|
||||
|
||||
void UpdateManagerSettings::setNextCheck(const QDate& date)
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup(group);
|
||||
s.setValue("NextCheck", date);
|
||||
free (prefs.update_manager.next_check);
|
||||
prefs.update_manager.next_check = copy_string(qPrintable(date.toString()));
|
||||
emit nextCheckChanged(date);
|
||||
}
|
||||
|
||||
static QString tecDetails = QStringLiteral("TecDetails");
|
||||
|
||||
PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent):
|
||||
|
@ -1628,7 +1678,8 @@ QObject(parent),
|
|||
display_settings(new DisplaySettingsObjectWrapper(this)),
|
||||
language_settings(new LanguageSettingsObjectWrapper(this)),
|
||||
animation_settings(new AnimationsSettingsObjectWrapper(this)),
|
||||
location_settings(new LocationServiceSettingsObjectWrapper(this))
|
||||
location_settings(new LocationServiceSettingsObjectWrapper(this)),
|
||||
update_manager_settings(new UpdateManagerSettings(this))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue