~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/frontend/cbtconfig.h

  • Committer: mgruner
  • Date: 2007-05-08 15:51:07 UTC
  • Revision ID: vcs-imports@canonical.com-20070508155107-0rj7jdmm5ivf8685
-imported source and data files to new svn module
-this is where KDE4-based development will take place

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********
 
2
*
 
3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
 
4
*
 
5
* Copyright 1999-2006 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
 
 
11
 
 
12
#ifndef CBTCONFIG_H
 
13
#define CBTCONFIG_H
 
14
 
 
15
#include "backend/cswordbackend.h"
 
16
#include "backend/clanguagemgr.h"
 
17
 
 
18
//Qt includes
 
19
#include <qstring.h>
 
20
#include <qfont.h>
 
21
#include <qvaluelist.h>
 
22
#include <qmap.h>
 
23
 
 
24
//Forward declarations
 
25
class KAccel;
 
26
class KActionCollection;
 
27
class KConfig;
 
28
 
 
29
/**
 
30
 * This class is the interface to the config object of BibleTime
 
31
 * @author The BibleTime team
 
32
 */
 
33
class CBTConfig {
 
34
public:
 
35
        typedef QMap<QString, QString> StringMap;
 
36
 
 
37
        enum strings {
 
38
                bibletimeVersion,
 
39
                language,
 
40
                displayStyle,
 
41
                bookshelfCurrentItem
 
42
        };
 
43
        enum modules {
 
44
                standardBible = 0, //just to make sure, default is IMHO 0, so that's redundant here
 
45
                standardCommentary,
 
46
                standardLexicon,
 
47
                standardDailyDevotional,
 
48
                standardHebrewStrongsLexicon,
 
49
                standardGreekStrongsLexicon,
 
50
                standardHebrewMorphLexicon,
 
51
                standardGreekMorphLexicon,
 
52
                lastModuleType = standardGreekMorphLexicon
 
53
        };
 
54
        enum bools {
 
55
                firstSearchDialog,
 
56
                readOldBookmarks,
 
57
 
 
58
                toolbar,
 
59
                mainIndex,
 
60
                infoDisplay,
 
61
 
 
62
                autoTileVertical,
 
63
                autoTileHorizontal,
 
64
                autoCascade,
 
65
 
 
66
                lineBreaks,
 
67
                verseNumbers,
 
68
 
 
69
                tips,
 
70
                logo,
 
71
                autoDeleteOrphanedIndices,
 
72
                crashedLastTime,
 
73
                crashedTwoTimes
 
74
        };
 
75
        enum ints {
 
76
                footnotes,
 
77
                strongNumbers,
 
78
                headings,
 
79
                morphTags,
 
80
                lemmas,
 
81
                hebrewPoints,
 
82
                hebrewCantillation,
 
83
                greekAccents,
 
84
                textualVariants,
 
85
                scriptureReferences,
 
86
                morphSegmentation,
 
87
                bookshelfContentsX,
 
88
                bookshelfContentsY,
 
89
                magDelay /* The delay until a mouse move makes the content appear in the mag */
 
90
        };
 
91
        enum intLists {
 
92
                leftPaneSplitterSizes,
 
93
                mainSplitterSizes
 
94
        };
 
95
        enum stringLists {
 
96
                searchCompletionTexts,
 
97
                searchTexts,
 
98
                bookshelfOpenGroups
 
99
        };
 
100
        enum keys {
 
101
                allWindows,
 
102
                readWindow,
 
103
                writeWindow,
 
104
                bookWindow,
 
105
                bibleWindow,
 
106
                commentaryWindow,
 
107
                lexiconWindow,
 
108
                application
 
109
        };
 
110
        enum stringMaps {
 
111
                searchScopes
 
112
        };
 
113
        typedef std::pair<bool, QFont> FontSettingsPair;
 
114
        typedef QMap<const CLanguageMgr::Language*, CBTConfig::FontSettingsPair> FontCache;
 
115
 
 
116
        static const QString   get
 
117
                ( const CBTConfig::strings );
 
118
        static CSwordModuleInfo* const get
 
119
                ( const CBTConfig::modules );
 
120
        static const bool    get
 
121
                ( const CBTConfig::bools );
 
122
        static const int      get
 
123
                ( const CBTConfig::ints );
 
124
        static const QValueList<int> get
 
125
                ( const CBTConfig::intLists );
 
126
        static const QStringList get
 
127
                ( const CBTConfig::stringLists );
 
128
        static const CBTConfig::StringMap get
 
129
                ( const CBTConfig::stringMaps );
 
130
 
 
131
        static const FontSettingsPair get
 
132
                ( const CLanguageMgr::Language* const );
 
133
 
 
134
        static const QString getDefault( const CBTConfig::strings );
 
135
        static const QString getDefault( const CBTConfig::modules );
 
136
        static const bool getDefault( const CBTConfig::bools );
 
137
        static const int getDefault( const CBTConfig::ints );
 
138
        static const QValueList<int> getDefault( const CBTConfig::intLists );
 
139
        static const QStringList getDefault( const CBTConfig::stringLists );
 
140
        static const CBTConfig::StringMap getDefault( const CBTConfig::stringMaps );
 
141
        static const QFont& getDefault( const CLanguageMgr::Language* const );
 
142
 
 
143
        static void set
 
144
                ( const CBTConfig::strings,  const QString value );
 
145
        static void set
 
146
                ( const CBTConfig::modules, CSwordModuleInfo* const module );
 
147
        static void set
 
148
                ( const CBTConfig::modules, const QString& moduleName );
 
149
        static void set
 
150
                ( const CBTConfig::bools,   const bool value );
 
151
        static void set
 
152
                ( const CBTConfig::ints,   const int value );
 
153
        static void set
 
154
                ( const CBTConfig::intLists, const QValueList<int> value );
 
155
        static void set
 
156
                ( const CBTConfig::stringLists, const QStringList value);
 
157
        static void set
 
158
                ( const CBTConfig::stringMaps, const CBTConfig::StringMap value);
 
159
        static void set
 
160
                ( const CLanguageMgr::Language* const language, const FontSettingsPair& fontSettings );
 
161
 
 
162
        static const CSwordBackend::FilterOptions getFilterOptionDefaults();
 
163
        static const CSwordBackend::DisplayOptions getDisplayOptionDefaults();
 
164
 
 
165
        static void setupAccelSettings(const CBTConfig::keys type, KActionCollection* const actionCollection);
 
166
        static void saveAccelSettings(const CBTConfig::keys type, KActionCollection* const actionCollection);
 
167
 
 
168
        static const QString getModuleEncryptionKey( const QString& name );
 
169
        static void setModuleEncryptionKey( const QString& name, const QString& key );
 
170
 
 
171
        /** The config object.
 
172
        * @return A config object which is used currently, may be the global config or the session config
 
173
        */
 
174
        static KConfig* const getConfig();
 
175
 
 
176
private:
 
177
        static const QString getKey( const CBTConfig::strings );
 
178
        static const QString getKey( const CBTConfig::modules );
 
179
        static const QString getKey( const CBTConfig::bools );
 
180
        static const QString getKey( const CBTConfig::ints );
 
181
        static const QString getKey( const CBTConfig::intLists );
 
182
        static const QString getKey( const CBTConfig::stringLists );
 
183
        static const QString getKey( const CBTConfig::stringMaps );
 
184
        static const QString getKey( const CLanguageMgr::Language* const );
 
185
 
 
186
        //static caches
 
187
        static QFont* m_defaultFont;
 
188
 
 
189
        static FontCache* fontConfigMap;
 
190
};
 
191
 
 
192
 
 
193
#endif