testing http push
[qwerkisync] / Settings.h
1 /*
2  * Copyright (C) 2011, Jamie Thompson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef SETTINGS_H
20 #define SETTINGS_H
21
22 #include <QString>
23
24 class Settings
25 {
26 public:
27         enum eAppMode
28         {
29                 APPMODE_CONSOLE,
30                 APPMODE_GUI
31         };
32
33         // Options for main mode - importing or exporting content
34         enum eMode
35         {
36                 MODE_IMPORT,
37                 MODE_EXPORT,
38         };
39         static const int kNumModes = MODE_EXPORT + 1;
40
41         // Options for targets - sent or recieved
42         enum eTargets
43         {
44                 TYPE_SENT,
45                 TYPE_RECIEVED,
46         };
47         static const int kNumTargets = TYPE_RECIEVED + 1;
48
49         // Options for supported event types
50         enum eEventTypes
51         {
52                 EVENTTYPE_SMS,
53                 EVENTTYPE_MMS,
54                 EVENTTYPE_CHAT,
55         };
56         static const int kNumEventTypes = EVENTTYPE_CHAT + 1;
57
58 private:
59         // The current UI mode of the application (Console/GUI)
60         eAppMode m_AppMode;
61
62         // Have the settings been confirmed by the user?
63         bool m_Confirmed;
64
65         // The current operation mode of the application (Import/Export)
66         eMode m_Mode;
67
68         // The current targets & event types being processed
69         bool m_ShouldProcess[kNumTargets][kNumEventTypes];
70
71         // The root directory to import or export from
72         QString m_Directory;
73
74         // The ITU code for this country
75         uint m_CountryCode;
76
77         // Is it OK to disable the cellular radio to prevent calls and messages?
78         bool m_DisableCellular;
79
80 public:
81         Settings();
82
83         eAppMode const AppMode() const { return m_AppMode; }
84         eAppMode const setAppMode(const eAppMode appMode) { return m_AppMode = appMode; }
85
86         bool const IsConfirmed() const { return m_Confirmed; }
87         bool const setConfirmed(const bool confirmed) { return m_Confirmed = confirmed; }
88
89         eMode const Mode() const { return m_Mode; }
90         eMode const setMode(const eMode mode) { return m_Mode = mode; }
91
92         bool const ShouldProcess(const eTargets target, const eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; }
93         bool const setShouldProcess(const eTargets target, const eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; }
94         bool const anyToProcess()
95         {
96                 for(int targetIndex = 0; targetIndex < kNumTargets; ++targetIndex)
97                         for(int eventTypeIndex = 0; eventTypeIndex < kNumEventTypes; ++eventTypeIndex)
98                                 if (m_ShouldProcess[targetIndex][eventTypeIndex])
99                                         return true;
100                 return false;
101         }
102
103         QString const Directory() const{ return m_Directory; }
104         QString const setDirectory(const QString& directory){ return m_Directory = directory; }
105
106         uint const CountryCode() const { return m_CountryCode; }
107         uint const setCountryCode(const uint countryCode) { return m_CountryCode = countryCode; }
108
109         bool const DisableCellular() const { return m_DisableCellular; }
110         bool const setDisableCellular(const bool disableCellular) { return m_DisableCellular = disableCellular; }
111 };
112
113 #endif // SETTINGS_H