Emit error signal when login fails
[situare] / src / ui / settingsdialog.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5       Katri Kaikkonen - katri.kaikkonen@ixonos.com
6       Jussi Laitinen - jussi.laitinen@ixonos.com
7
8    Situare is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License
10    version 2 as published by the Free Software Foundation.
11
12    Situare is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with Situare; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20    USA.
21 */
22
23 #ifndef SETTINGSDIALOG_H
24 #define SETTINGSDIALOG_H
25
26 #include <QDialog>
27 #include <QTime>
28 #include <QStandardItemModel>
29
30 class QCheckBox;
31 class QPushButton;
32
33 #ifdef Q_WS_MAEMO_5
34 #include <QMaemo5ValueButton>
35 #include <QMaemo5ListPickSelector>
36 #else
37 #include <QTimeEdit>
38 #endif
39
40
41 /**
42 * @brief Settings Dialog.
43 *
44 * @class SettingsDialog settingsdialog.h "ui/settingsdialog.h"
45 */
46 class SettingsDialog : public QDialog
47  {
48     Q_OBJECT
49
50 public:
51     /**
52     * @brief Default constructor
53     *
54     * @param parent Parent
55     */
56     SettingsDialog(QWidget *parent = 0);
57
58 /*******************************************************************************
59 * MEMBER FUNCTIONS AND SLOTS
60 ******************************************************************************/
61  public:
62     /**
63     * @brief Enables Situare related settings from settings dialog.
64     *
65     * @param enabled true if enabled, false otherwise
66     */
67     void enableSituareSettings(bool enabled);
68
69 private slots:
70     /**
71     * @brief Saves settings to file.
72     */
73     void saveValues();
74
75     /**
76     * @brief Toggles automatic location update state.
77     *
78     * Enables and disabled automatic location update interval time edit.
79     *
80     * @param enabled true if settings are enabled, false otherwise
81     */
82     void toggleAutomaticLocationUpdate(bool enabled);
83
84  private:
85     /**
86     * @brief Populates update interval list.
87     *
88     * @param model QStandardItemModel
89     */
90     void populateUpdateIntervalList(QStandardItemModel *model);
91
92     /**
93     * @brief Read settings.
94     */
95     void readSettings();
96
97     /**
98     * @brief Sets time.
99     *
100     * @param time time to set
101     */
102     void setTime(const QTime &time);
103
104     /**
105     * @brief Returns current update interval time.
106     *
107     * @return current time
108     */
109     QTime time();
110
111 /*******************************************************************************
112  * DATA MEMBERS
113  ******************************************************************************/
114 private:
115     QCheckBox *m_automaticLocationUpdate;           ///< Pointer to CheckBox
116
117 #ifdef Q_WS_MAEMO_5
118     QMaemo5ValueButton *m_automaticLocationUpdateIntervalButton;    ///< Maemo 5 value button
119     QMaemo5ListPickSelector *m_timePick;                            ///< Maemo 5 time pick selector
120 #else
121     QTimeEdit *m_automaticLocationUpdateInterval;   ///< Pointer to QTimeEdit
122 #endif
123
124     QPushButton *m_saveButton;                      ///< Save button
125 };
126
127 #endif // SETTINGSDIALOG_H