summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/cbtconfig.h
blob: c949593300d6f4e88e848eae3c798606c4340686 (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
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 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 "backend/cswordbackend.h"
#include "backend/clanguagemgr.h"

//Qt includes
#include <tqstring.h>
#include <tqfont.h>
#include <tqvaluelist.h>
#include <tqmap.h>

//Forward declarations
class KAccel;
class KActionCollection;
class KConfig;

/**
 * This class is the interface to the config object of BibleTime
 * @author The BibleTime team
 */
class CBTConfig {
public:
	typedef TQMap<TQString, TQString> StringMap;

	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,

		toolbar,
		mainIndex,
		infoDisplay,

		autoTileVertical,
		autoTileHorizontal,
		autoCascade,

		lineBreaks,
		verseNumbers,

		tips,
		logo,
		autoDeleteOrphanedIndices,
		crashedLastTime,
		crashedTwoTimes
	};
	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 */
	};
	enum intLists {
		leftPaneSplitterSizes,
		mainSplitterSizes
	};
	enum stringLists {
		searchCompletionTexts,
		searchTexts,
		bookshelfOpenGroups
	};
	enum keys {
		allWindows,
		readWindow,
		writeWindow,
		bookWindow,
		bibleWindow,
		commentaryWindow,
		lexiconWindow,
		application
	};
	enum stringMaps {
		searchScopes
	};
	typedef std::pair<bool, TQFont> FontSettingsPair;
	typedef TQMap<const CLanguageMgr::Language*, CBTConfig::FontSettingsPair> FontCache;

	static const TQString   get
		( const CBTConfig::strings );
	static CSwordModuleInfo* const get
		( const CBTConfig::modules );
	static const bool    get
		( const CBTConfig::bools );
	static const int      get
		( const CBTConfig::ints );
	static const TQValueList<int> get
		( const CBTConfig::intLists );
	static const TQStringList get
		( const CBTConfig::stringLists );
	static const CBTConfig::StringMap get
		( const CBTConfig::stringMaps );

	static const FontSettingsPair get
		( const CLanguageMgr::Language* const );

	static const TQString getDefault( const CBTConfig::strings );
	static const TQString getDefault( const CBTConfig::modules );
	static const bool getDefault( const CBTConfig::bools );
	static const int getDefault( const CBTConfig::ints );
	static const TQValueList<int> getDefault( const CBTConfig::intLists );
	static const TQStringList getDefault( const CBTConfig::stringLists );
	static const CBTConfig::StringMap getDefault( const CBTConfig::stringMaps );
	static const TQFont& getDefault( const CLanguageMgr::Language* const );

	static void set
		( const CBTConfig::strings,  const TQString value );
	static void set
		( const CBTConfig::modules, CSwordModuleInfo* const module );
	static void set
		( const CBTConfig::modules, const TQString& moduleName );
	static void set
		( const CBTConfig::bools,   const bool value );
	static void set
		( const CBTConfig::ints,   const int value );
	static void set
		( const CBTConfig::intLists, const TQValueList<int> value );
	static void set
		( const CBTConfig::stringLists, const TQStringList value);
	static void set
		( const CBTConfig::stringMaps, const CBTConfig::StringMap value);
	static void set
		( const CLanguageMgr::Language* const language, const FontSettingsPair& fontSettings );

	static const CSwordBackend::FilterOptions getFilterOptionDefaults();
	static const CSwordBackend::DisplayOptions getDisplayOptionDefaults();

	static void setupAccelSettings(const CBTConfig::keys type, KActionCollection* const actionCollection);
	static void saveAccelSettings(const CBTConfig::keys type, KActionCollection* const actionCollection);

	static const TQString getModuleEncryptionKey( const TQString& name );
	static void setModuleEncryptionKey( const TQString& name, const TQString& key );

	/** The config object.
	* @return A config object which is used currently, may be the global config or the session config
	*/
	static KConfig* const getConfig();

private:
	static const TQString getKey( const CBTConfig::strings );
	static const TQString getKey( const CBTConfig::modules );
	static const TQString getKey( const CBTConfig::bools );
	static const TQString getKey( const CBTConfig::ints );
	static const TQString getKey( const CBTConfig::intLists );
	static const TQString getKey( const CBTConfig::stringLists );
	static const TQString getKey( const CBTConfig::stringMaps );
	static const TQString getKey( const CLanguageMgr::Language* const );

	//static caches
	static TQFont* m_defaultFont;

	static FontCache* fontConfigMap;
};


#endif