Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
sqlitebrowser/src/Settings.cpp at master · javalover/sqlitebrowser · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
javalover
sqlitebrowser
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
sqlitebrowser
/
src
/
Settings.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
238 lines (198 loc) · 7.06 KB
master
Breadcrumbs
sqlitebrowser
/
src
/
Settings.cpp
Copy path
Top
File metadata and controls
Code
Blame
238 lines (198 loc) · 7.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#
include
"
Settings.h
"
#
include
<
QDir
>
#
include
<
QSettings
>
#
include
<
QColor
>
#
include
<
QFontInfo
>
#
include
<
QLocale
>
QHash<QString, QVariant> Settings::m_hCache;
QVariant
Settings::getSettingsValue
(
const
QString& group,
const
QString& name)
{
//
Have a look in the cache first
QHash<QString, QVariant>::iterator cacheIndex = m_hCache.
find
(group + name);
if
(cacheIndex != m_hCache.
end
())
{
return
cacheIndex.
value
();
}
else
{
//
Nothing found in the cache, so get the value from the settings file or get the default value if there is no value set yet
QSettings
settings
(
QApplication::organizationName
(),
QApplication::organizationName
());
QVariant value = settings.
value
(group +
"
/
"
+ name,
getSettingsDefaultValue
(group, name));
//
Store this value in the cache for further usage and return it afterwards
m_hCache.
insert
(group + name, value);
return
value;
}
}
void
Settings::setSettingsValue
(
const
QString& group,
const
QString& name,
const
QVariant& value,
bool
dont_save_to_disk)
{
//
Sometime the value has to be saved for the current session only but get discarded when the application exits.
//
In order to achieve this this flag can be set which disables the save to disk mechanism and only leaves the save to cache part active.
if
(dont_save_to_disk ==
false
)
{
//
Set the group and save the given value
QSettings
settings
(
QApplication::organizationName
(),
QApplication::organizationName
());
settings.
beginGroup
(group);
settings.
setValue
(name, value);
settings.
endGroup
();
}
//
Also change it in the cache
m_hCache[group + name] = value;
}
QVariant
Settings::getSettingsDefaultValue
(
const
QString& group,
const
QString& name)
{
//
db/defaultencoding?
if
(group ==
"
db
"
&& name ==
"
defaultencoding
"
)
return
"
UTF-8
"
;
//
db/savedefaultlocation?
if
(group ==
"
db
"
&& name ==
"
savedefaultlocation
"
)
return
2
;
//
db/defaultlocation?
if
(group ==
"
db
"
&& name ==
"
defaultlocation
"
)
return
QDir::homePath
();
//
db/lastlocation?
if
(group ==
"
db
"
&& name ==
"
lastlocation
"
)
return
getSettingsValue
(
"
db
"
,
"
defaultlocation
"
);
//
db/hideschemalinebreaks?
if
(group ==
"
db
"
&& name ==
"
hideschemalinebreaks
"
)
return
true
;
//
db/foreignkeys?
if
(group ==
"
db
"
&& name ==
"
foreignkeys
"
)
return
true
;
//
db/prefetchsize?
if
(group ==
"
db
"
&& name ==
"
prefetchsize
"
)
return
50000
;
//
db/defaultsqltext?
if
(group ==
"
db
"
&& name ==
"
defaultsqltext
"
)
return
"
"
;
//
exportcsv/firstrowheader?
if
(group ==
"
exportcsv
"
&& name ==
"
firstrowheader
"
)
return
true
;
//
exportcsv/separator?
if
(group ==
"
exportcsv
"
&& name ==
"
separator
"
)
return
'
,
'
;
//
exportcsv/quotecharacter?
if
(group ==
"
exportcsv
"
&& name ==
"
quotecharacter
"
)
return
'
"
'
;
//
exportjson/prettyprint?
if
(group ==
"
exportjson
"
&& name ==
"
prettyprint
"
)
return
true
;
//
MainWindow/geometry?
if
(group ==
"
MainWindow
"
&& name ==
"
geometry
"
)
return
"
"
;
//
MainWindow/windowState?
if
(group ==
"
MainWindow
"
&& name ==
"
windowState
"
)
return
"
"
;
//
SQLLogDock/Log?
if
(group ==
"
SQLLogDock
"
&& name ==
"
Log
"
)
return
"
Application
"
;
//
General/recentFileList?
if
(group ==
"
General
"
&& name ==
"
recentFileList
"
)
return
QStringList
();
//
General/language?
if
(group ==
"
General
"
&& name ==
"
language
"
)
return
QLocale::system
().
name
();
//
checkversion/enabled
if
(group ==
"
checkversion
"
&& name ==
"
enabled
"
)
return
true
;
//
Data Browser/NULL Fields
if
(group ==
"
databrowser
"
)
{
if
(name ==
"
font
"
)
return
QFont
().
defaultFamily
();
if
(name ==
"
fontsize
"
)
return
10
;
if
(name ==
"
symbol_limit
"
)
return
5000
;
if
(name ==
"
null_text
"
)
return
"
NULL
"
;
if
(name ==
"
filter_escape
"
)
return
"
\\
"
;
if
(name ==
"
filter_delay
"
)
return
200
;
if
(name ==
"
null_fg_colour
"
)
return
QColor
(Qt::lightGray).
name
();
if
(name ==
"
null_bg_colour
"
)
return
QColor
(Qt::white).
name
();
if
(name ==
"
reg_fg_colour
"
)
return
QColor
(Qt::black).
name
();
if
(name ==
"
reg_bg_colour
"
)
return
QColor
(Qt::white).
name
();
if
(name ==
"
bin_fg_colour
"
)
return
QColor
(Qt::lightGray).
name
();
if
(name ==
"
bin_bg_colour
"
)
return
QColor
(Qt::white).
name
();
}
//
syntaxhighlighter?
if
(group ==
"
syntaxhighlighter
"
)
{
//
Bold? Only tables, functions and keywords are bold by default
if
(name.
right
(
4
) ==
"
bold
"
)
return
name ==
"
keyword_bold
"
|| name ==
"
table_bold
"
|| name ==
"
function_bold
"
;
//
Italic? Nothing by default
if
(name.
right
(
6
) ==
"
italic
"
)
return
false
;
//
Underline? Nothing by default
if
(name.
right
(
9
) ==
"
underline
"
)
return
false
;
//
Colour?
if
(name.
right
(
6
) ==
"
colour
"
)
{
if
(name ==
"
keyword_colour
"
)
return
QColor
(Qt::darkBlue).
name
();
else
if
(name ==
"
function_colour
"
)
return
QColor
(Qt::blue).
name
();
else
if
(name ==
"
table_colour
"
)
return
QColor
(Qt::darkCyan).
name
();
else
if
(name ==
"
comment_colour
"
)
return
QColor
(Qt::darkGreen).
name
();
else
if
(name ==
"
identifier_colour
"
)
return
QColor
(Qt::darkMagenta).
name
();
else
if
(name ==
"
string_colour
"
)
return
QColor
(Qt::red).
name
();
else
if
(name ==
"
currentline_colour
"
)
return
QColor
(
236
,
236
,
245
).
name
();
}
}
//
editor/font?
if
(group ==
"
editor
"
&& name ==
"
font
"
)
{
QFont
font
(
"
Monospace
"
);
font.
setStyleHint
(QFont::TypeWriter);
return
QFontInfo
(font).
family
();
}
//
editor/fontsize or log/fontsize?
if
((group ==
"
editor
"
|| group ==
"
log
"
) && name ==
"
fontsize
"
)
return
9
;
if
(group ==
"
editor
"
)
{
if
(name ==
"
tabsize
"
)
{
return
4
;
}
}
//
editor/auto_completion?
if
(group ==
"
editor
"
&& name ==
"
auto_completion
"
)
return
true
;
//
editor/error_indicators?
if
(group ==
"
editor
"
&& name ==
"
error_indicators
"
)
return
true
;
//
editor/horizontal_tiling?
if
(group ==
"
editor
"
&& name ==
"
horizontal_tiling
"
)
return
false
;
//
extensions/list?
if
(group ==
"
extensions
"
&& name ==
"
list
"
)
return
QStringList
();
//
extensions/disableregex?
if
(group ==
"
extension
"
&& name ==
"
disableregex
"
)
return
false
;
//
PlotDock/lineType or pointShape?
if
(group ==
"
PlotDock
"
)
{
//
QCPGraph::lsLine
if
(name ==
"
lineType
"
)
return
1
;
//
QCPScatterStyle::ssDisk
if
(name ==
"
pointShape
"
)
return
4
;
}
//
Unknown combination of group and name? Return an invalid QVariant!
return
QVariant
();
}
You can’t perform that action at this time.