--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtGui>
+#include <QDebug>
+#include "facebookservice/facebookcommon.h"
+#include "settingsdialog.h"
+
+const QString AUTOMATIC_LOCATION_UPDATE("Automatic_location_update");
+
+SettingsDialog::SettingsDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ setWindowTitle(tr("Settings"));
+
+ QScrollArea *scrollArea = new QScrollArea(this);
+ QGridLayout *gridLayout = new QGridLayout(this);
+ QGroupBox *groupBox = new QGroupBox(scrollArea);
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+
+ m_automaticLocationUpdate = new QCheckBox(tr("Use automatic location update"));
+ m_automaticLocationUpdate->setChecked(settings.value(AUTOMATIC_LOCATION_UPDATE).toBool());
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
+ QPushButton *saveButton = buttonBox->addButton(QDialogButtonBox::Save);
+ QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);
+ connect(saveButton, SIGNAL(clicked()), this, SLOT(saveValues()));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+
+ connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
+
+ QFormLayout *form = new QFormLayout();
+ form->addWidget(m_automaticLocationUpdate);
+
+ groupBox->setLayout(form);
+ scrollArea->setWidget(groupBox);
+ scrollArea->setWidgetResizable(true);
+ gridLayout->addWidget(scrollArea, 0, 0, 2, 1);
+ gridLayout->addWidget(buttonBox, 0, 1, 1, 1);
+ setLayout(gridLayout);
+
+ scrollArea->show();
+}
+
+SettingsDialog::~SettingsDialog()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ delete m_automaticLocationUpdate;
+}
+
+void SettingsDialog::dialogFinished(int /* reason */)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ deleteLater();
+}
+
+void SettingsDialog::saveValues()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ settings.setValue(AUTOMATIC_LOCATION_UPDATE, m_automaticLocationUpdate->isChecked());
+ accept();
+
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+
+class QCheckBox;
+
+/**
+* @brief Settings Dialog NOTE: dialog deletes itself after saving or closing settings
+*
+* @class SettingsDialog settingsdialog.h "ui/settingsdialog.h"
+*/
+class SettingsDialog : public QDialog
+ {
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Default constructor
+ *
+ * @param parent Parent
+ */
+ SettingsDialog(QWidget *parent = 0);
+
+ /**
+ * @brief Destructor
+ */
+ ~SettingsDialog();
+
+/*******************************************************************************
+* MEMBER FUNCTIONS AND SLOTS
+******************************************************************************/
+private slots:
+ /**
+ * @brief is called when dialog is closed
+ *
+ * @param reason why dialog was closed
+ */
+ void dialogFinished(int reason);
+
+ /**
+ * @brief Saves settings to file
+ */
+ void saveValues();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ QCheckBox *m_automaticLocationUpdate; ///< Pointer to CheckBox
+};
+
+#endif // SETTINGSDIALOG_H