2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Katri Kaikkonen - katri.kaikkonen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #include "facebookservice/facebookcommon.h"
25 #include "settingsdialog.h"
27 const QString AUTOMATIC_LOCATION_UPDATE("Automatic_location_update");
29 SettingsDialog::SettingsDialog(QWidget *parent)
32 qDebug() << __PRETTY_FUNCTION__;
33 setWindowTitle(tr("Settings"));
35 QScrollArea *scrollArea = new QScrollArea(this);
36 QGridLayout *gridLayout = new QGridLayout(this);
37 QGroupBox *groupBox = new QGroupBox(scrollArea);
38 QSettings settings(DIRECTORY_NAME, FILE_NAME);
40 m_automaticLocationUpdate = new QCheckBox(tr("Use automatic location update"));
41 m_automaticLocationUpdate->setChecked(settings.value(AUTOMATIC_LOCATION_UPDATE).toBool());
43 QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
44 QPushButton *saveButton = buttonBox->addButton(QDialogButtonBox::Save);
45 QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);
46 connect(saveButton, SIGNAL(clicked()), this, SLOT(saveValues()));
47 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
49 connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
51 QFormLayout *form = new QFormLayout();
52 form->addWidget(m_automaticLocationUpdate);
54 groupBox->setLayout(form);
55 scrollArea->setWidget(groupBox);
56 scrollArea->setWidgetResizable(true);
57 gridLayout->addWidget(scrollArea, 0, 0, 2, 1);
58 gridLayout->addWidget(buttonBox, 0, 1, 1, 1);
59 setLayout(gridLayout);
64 SettingsDialog::~SettingsDialog()
66 qDebug() << __PRETTY_FUNCTION__;
67 delete m_automaticLocationUpdate;
70 void SettingsDialog::dialogFinished(int /* reason */)
72 qDebug() << __PRETTY_FUNCTION__;
76 void SettingsDialog::saveValues()
78 qDebug() << __PRETTY_FUNCTION__;
79 QSettings settings(DIRECTORY_NAME, FILE_NAME);
80 settings.setValue(AUTOMATIC_LOCATION_UPDATE, m_automaticLocationUpdate->isChecked());