Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
Konversation
Commits
c2493e6f
Commit
c2493e6f
authored
Jan 08, 2021
by
Peter Simonsson
Browse files
Speed up saveOptions
Don't look up servergroup IDs in a QList use a QHash instead.
parent
f66e3b16
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/application.cpp
View file @
c2493e6f
...
...
@@ -817,14 +817,14 @@ void Application::saveOptions(bool updateGUI)
QStringList
servers
;
QStringList
channels
;
QStringList
channelHistory
;
Q
List
<
int
>
sgKeys
;
Q
Hash
<
int
,
int
>
sgKeys
;
for
(
const
auto
&
serverGroup
:
qAsConst
(
sortedServerGroupMap
))
{
const
Konversation
::
ServerList
serverList
=
serverGroup
->
serverList
();
servers
.
clear
();
servers
.
reserve
(
serverList
.
size
());
sgKeys
.
append
(
serverGroup
->
id
());
sgKeys
.
insert
(
serverGroup
->
id
()
,
index
);
for
(
const
auto
&
server
:
serverList
)
{
const
QString
groupName
=
QStringLiteral
(
"Server %1"
).
arg
(
index2
);
...
...
@@ -909,7 +909,7 @@ void Application::saveOptions(bool updateGUI)
QString
enc
=
Preferences
::
channelEncoding
(
encServer
,
encChannel
);
QString
key
=
QLatin1Char
(
' '
)
+
encChannel
;
if
(
sgKeys
.
contains
(
encServer
))
key
.
prepend
(
QStringLiteral
(
"ServerGroup "
)
+
QString
::
number
(
sgKeys
.
indexOf
(
encServer
)));
key
.
prepend
(
QStringLiteral
(
"ServerGroup "
)
+
QString
::
number
(
sgKeys
.
value
(
encServer
)));
else
key
.
prepend
(
sgsp
->
name
());
cgEncoding
.
writeEntry
(
key
,
enc
);
...
...
@@ -933,10 +933,8 @@ void Application::saveOptions(bool updateGUI)
{
i2
.
next
();
int
serverGroupIndex
=
sgKeys
.
indexOf
(
i
.
key
()
->
id
());
if
(
serverGroupIndex
!=
-
1
)
cgSpellCheckingLanguages
.
writeEntry
(
QStringLiteral
(
"ServerGroup "
)
+
QString
::
number
(
serverGroupIndex
)
+
QLatin1Char
(
' '
)
+
i2
.
key
(),
i2
.
value
());
if
(
sgKeys
.
contains
(
i
.
key
()
->
id
()))
cgSpellCheckingLanguages
.
writeEntry
(
QStringLiteral
(
"ServerGroup "
)
+
QString
::
number
(
sgKeys
.
value
(
i
.
key
()
->
id
()))
+
QLatin1Char
(
' '
)
+
i2
.
key
(),
i2
.
value
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment