summaryrefslogtreecommitdiff
path: root/src/backend/config/cbtconfig.h
blob: f3fa0426a1f0243150b09b561376e93a2d8eceae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2011 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef CBTCONFIG_H
#define CBTCONFIG_H

#include <QString>
#include <QFont>
#include <QList>
#include <QMap>
#include "backend/managers/cswordbackend.h"

class QSettings;
class BtActionCollection;

/**
 * This class is the interface to the config object of BibleTime
 * @author The BibleTime team
 */
namespace CBTConfig {

typedef QMap<QString, QString> StringMap;
typedef std::pair<bool, QFont> FontSettingsPair;

enum strings {
    bibletimeVersion,
    language,
    displayStyle,
    bookshelfCurrentItem
};
enum modules {
    standardBible = 0, // Just to make sure, default is IMHO 0, so that's redundant here
    standardCommentary,
    standardLexicon,
    standardDailyDevotional,
    standardHebrewStrongsLexicon,
    standardGreekStrongsLexicon,
    standardHebrewMorphLexicon,
    standardGreekMorphLexicon,
    lastModuleType = standardGreekMorphLexicon
};
enum bools {
    firstSearchDialog,
    readOldBookmarks,

    showMainWindowToolbar,
    mainIndex,
    infoDisplay,

    autoTileVertical,
    autoTileHorizontal,
    autoTile,
    autoTabbed,
    autoCascade,

    lineBreaks,
    verseNumbers,

    logo,
    autoDeleteOrphanedIndices,
    crashedLastTime,
    crashedTwoTimes,

    bookshelfShowHidden,

    allowNetworkConnection,

    showTextWindowHeaders,
    showTextWindowNavigator,
    showTextWindowToolButtons,
    showTextWindowModuleSelectorButtons,
    showFormatToolbarButtons,
    showToolbarsInEachWindow,
    showTipAtStartup
};
enum ints {
    footnotes,
    strongNumbers,
    headings,
    morphTags,
    lemmas,
    hebrewPoints,
    hebrewCantillation,
    greekAccents,
    textualVariants,
    scriptureReferences,
    morphSegmentation,

    bookshelfContentsX,
    bookshelfContentsY,
    magDelay, /* The delay until a mouse move makes the content appear in the mag */
    bookshelfGrouping,
    mainindexActiveTab,

    searchDialogWidth,
    searchDialogHeight,
    searchDialogX,
    searchDialogY,
    searchType,

    installPathIndex,

    bookshelfPosX,
    bookshelfPosY,
    bookshelfHeight,
    bookshelfWidth,

    configDialogPosX,
    configDialogPosY,
    configDialogHeight,
    configDialogWidth,
    tipNumber
};
enum intLists {
    leftPaneSplitterSizes,
    mainSplitterSizes,
    searchMainSplitterSizes,
    searchResultSplitterSizes
};
enum stringLists {
    searchCompletionTexts,
    searchTexts,
    searchModulesHistory,
    bookshelfOpenGroups,
    hiddenModules
};
enum keys {
    allWindows,
    readWindow,
    writeWindow,
    bookWindow,
    bibleWindow,
    commentaryWindow,
    lexiconWindow,
    application
};
enum stringMaps {
    searchScopes
};

QString IntListToString(const QList<int> &intList);
QList<int> StringToIntList(const QString &intListString,
                           bool *ok = 0,
                           QString::SplitBehavior splitBehavior = QString::KeepEmptyParts);

QString     getDefault(const strings);
QString     getDefault(const modules);
bool        getDefault(const bools);
int         getDefault(const ints);
QList<int>  getDefault(const intLists);
QStringList getDefault(const stringLists);
StringMap   getDefault(const stringMaps);
QFont      &getDefault(const CLanguageMgr::Language * const);

QString           get(const strings);
CSwordModuleInfo *get(const modules);
bool              get(const bools);
int               get(const ints);
QList<int>        get(const intLists);
QStringList       get(const stringLists);
StringMap         get(const stringMaps);
FontSettingsPair  get(const CLanguageMgr::Language * const);

void set(const strings,     const QString           &value);
void set(const modules,     CSwordModuleInfo * const module);
void set(const modules,     const QString           &moduleName);
void set(const bools,       const bool               value);
void set(const ints,        const int                value);
void set(const intLists,    const QList<int>        &value);
void set(const stringLists, const QStringList       &value);
void set(const stringMaps,  const StringMap         &value);
void set(const CLanguageMgr::Language * const language,
         const FontSettingsPair &fontSettings);

FilterOptions  getFilterOptionDefaults();
DisplayOptions getDisplayOptionDefaults();

void setupAccelSettings(const keys type,
                        BtActionCollection * const actionCollection);
void saveAccelSettings (const keys type,
                        BtActionCollection * const actionCollection);

QString getModuleEncryptionKey(const QString &name);
void    setModuleEncryptionKey(const QString &name, const QString &key);

/**
  Re-reads the config from disk.
*/
void syncConfig();

/**
  Returns the config object.
*/
QSettings* getConfig();

} // namespace CBTConfig

#endif