Settings update: Add "Dive Computer" settings to SettingsObjectWrapper

For some reason, the dive computer settings weren't in the
settings prefs. This moves it, makes the boilerplate on Settings
ObjectWrapper and make things compile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-08-10 18:10:15 -03:00 committed by Dirk Hohndel
parent b264c3e367
commit db8e8957ab
9 changed files with 134 additions and 97 deletions

View file

@ -1305,33 +1305,17 @@ void MainWindow::initialUiSetup()
show();
}
const char *getSetting(const QSettings &s,const QString& name)
{
QVariant v;
v = s.value(name);
if (v.isValid()) {
return strdup(v.toString().toUtf8().data());
}
return NULL;
}
void MainWindow::readSettings()
{
static bool firstRun = true;
QSettings s; //WARNING: Why those prefs are not on the prefs struct?
s.beginGroup("DiveComputer");
default_dive_computer_vendor = getSetting(s, "dive_computer_vendor");
default_dive_computer_product = getSetting(s, "dive_computer_product");
default_dive_computer_device = getSetting(s, "dive_computer_device");
default_dive_computer_download_mode = s.value("dive_computer_download_mode").toInt();
s.endGroup();
init_proxy();
// now make sure that the cloud menu items are enabled IFF cloud account is verified
enableDisableCloudActions();
#if !defined(SUBSURFACE_MOBILE)
QSettings s; //TODO: this 's' exists only for the loadRecentFiles, remove it.
loadRecentFiles(&s);
if (firstRun) {
checkSurvey(&s);