Addressing some compilation warnings:
[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 "EventTypes/eEventTypes.h"
23
24 #include <QString>
25
26 class Settings
27 {
28 public:
29         enum eAppMode
30         {
31                 APPMODE_CONSOLE,
32                 APPMODE_GUI
33         };
34
35         // Options for main mode - importing or exporting content
36         enum eMode
37         {
38                 MODE_IMPORT,
39                 MODE_EXPORT,
40         };
41         static const int kNumModes = MODE_EXPORT + 1;
42
43         // Options for targets - sent or recieved
44         enum eDirection
45         {
46                 OUTGOING,
47                 INCOMING,
48         };
49         static const int kNumTargets = INCOMING + 1;
50
51 private:
52         // The current UI mode of the application (Console/GUI)
53         eAppMode m_AppMode;
54
55         // Have the settings been confirmed by the user?
56         bool m_Confirmed;
57
58         // The current operation mode of the application (Import/Export)
59         eMode m_Mode;
60
61         // The current targets & event types being processed
62         bool m_ShouldProcess[kNumTargets][EventTypes::kNumEventTypes];
63
64         // The root directory to import or export from
65         QString m_Directory;
66
67         // The ITU code for this country
68         uint m_CountryCode;
69
70         // Is it OK to disable the cellular radio to prevent calls and messages?
71         bool m_DisableCellular;
72
73         // RtcomEventLogger path
74         QString m_DBPath;
75         void DBPath(QString dbPath) { m_DBPath = dbPath; }
76
77 public:
78         Settings();
79
80         eAppMode const AppMode() const { return m_AppMode; }
81         eAppMode const setAppMode(const eAppMode appMode) { return m_AppMode = appMode; }
82
83         bool const IsConfirmed() const { return m_Confirmed; }
84         bool const setConfirmed(const bool confirmed) { return m_Confirmed = confirmed; }
85
86         eMode const Mode() const { return m_Mode; }
87         eMode const setMode(const eMode mode) { return m_Mode = mode; }
88
89         bool const ShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; }
90         bool const setShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; }
91         bool const anyToProcess()
92         {
93                 for(int targetIndex = 0; targetIndex < kNumTargets; ++targetIndex)
94                         for(int eventTypeIndex = 0; eventTypeIndex < EventTypes::kNumEventTypes; ++eventTypeIndex)
95                                 if (m_ShouldProcess[targetIndex][eventTypeIndex])
96                                         return true;
97                 return false;
98         }
99
100         QString const Directory() const{ return m_Directory; }
101         QString const setDirectory(const QString& directory){ return m_Directory = directory; }
102
103         uint const CountryCode() const { return m_CountryCode; }
104         uint const setCountryCode(const uint countryCode) { return m_CountryCode = countryCode; }
105
106         bool const DisableCellular() const { return m_DisableCellular; }
107         bool const setDisableCellular(const bool disableCellular) { return m_DisableCellular = disableCellular; }
108
109         const QString &DBPath() const { return m_DBPath; }
110 };
111
112 #endif // SETTINGS_H