Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
845e9d51
Commit
845e9d51
authored
Feb 10, 2011
by
con
Browse files
Save custom ordering of tools.
This overrides ordering of *all* tools. Which is suboptimal.
parent
c422786b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/externaltool.cpp
View file @
845e9d51
...
...
@@ -694,9 +694,6 @@ void ExternalToolManager::initialize()
&
tools
,
true
);
// adapt overridden names and categories etc
readSettings
(
tools
,
&
categoryPriorityMap
);
QMap
<
QString
,
QList
<
Internal
::
ExternalTool
*>
>
categoryMap
;
QMapIterator
<
QString
,
QMultiMap
<
int
,
ExternalTool
*>
>
it
(
categoryPriorityMap
);
while
(
it
.
hasNext
())
{
...
...
@@ -704,6 +701,8 @@ void ExternalToolManager::initialize()
categoryMap
.
insert
(
it
.
key
(),
it
.
value
().
values
());
}
// read renamed categories and custom order
readSettings
(
tools
,
&
categoryMap
);
setToolsByCategory
(
categoryMap
);
}
...
...
@@ -848,24 +847,29 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
}
void
ExternalToolManager
::
readSettings
(
const
QMap
<
QString
,
ExternalTool
*>
&
tools
,
QMap
<
QString
,
Q
MultiMap
<
int
,
Internal
::
ExternalTool
*>
>
*
category
Priority
Map
)
QMap
<
QString
,
Q
List
<
ExternalTool
*>
>
*
categoryMap
)
{
QSettings
*
settings
=
m_core
->
settings
();
settings
->
beginGroup
(
QLatin1String
(
"ExternalTools"
));
if
(
category
Priority
Map
)
{
if
(
categoryMap
)
{
settings
->
beginGroup
(
QLatin1String
(
"OverrideCategories"
));
foreach
(
const
QString
&
id
,
settings
->
allKeys
())
{
if
(
tools
.
contains
(
id
))
{
const
QString
&
newCategory
=
settings
->
value
(
id
).
toString
();
ExternalTool
*
tool
=
tools
.
value
(
id
);
if
(
tool
->
displayCategory
()
!=
newCategory
)
{
(
*
categoryPriorityMap
)[
tool
->
displayCategory
()].
remove
(
tool
->
order
(),
tool
);
(
*
categoryPriorityMap
)[
newCategory
].
insert
(
tool
->
order
(),
tool
);
if
(
categoryPriorityMap
->
value
(
tool
->
displayCategory
()).
isEmpty
())
categoryPriorityMap
->
remove
(
tool
->
displayCategory
());
foreach
(
const
QString
&
category
,
settings
->
childGroups
())
{
int
count
=
settings
->
beginReadArray
(
category
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
settings
->
setArrayIndex
(
i
);
const
QString
&
toolId
=
settings
->
value
(
QLatin1String
(
"Tool"
)).
toString
();
if
(
tools
.
contains
(
toolId
))
{
ExternalTool
*
tool
=
tools
.
value
(
toolId
);
// remove from old category
(
*
categoryMap
)[
tool
->
displayCategory
()].
removeAll
(
tool
);
if
(
categoryMap
->
value
(
tool
->
displayCategory
()).
isEmpty
())
categoryMap
->
remove
(
tool
->
displayCategory
());
// add to new category
(
*
categoryMap
)[
category
].
append
(
tool
);
}
}
settings
->
endArray
();
}
settings
->
endGroup
();
}
...
...
@@ -884,10 +888,14 @@ void ExternalToolManager::writeSettings()
while
(
it
.
hasNext
())
{
it
.
next
();
const
QString
&
category
=
it
.
key
();
settings
->
beginWriteArray
(
category
,
it
.
value
().
count
());
int
i
=
0
;
foreach
(
ExternalTool
*
tool
,
it
.
value
())
{
if
(
tool
->
displayCategory
()
!=
category
)
settings
->
setValue
(
tool
->
id
(),
category
);
settings
->
setArrayIndex
(
i
);
settings
->
setValue
(
QLatin1String
(
"Tool"
),
tool
->
id
());
++
i
;
}
settings
->
endArray
();
}
settings
->
endGroup
();
...
...
src/plugins/coreplugin/externaltool.h
View file @
845e9d51
...
...
@@ -184,7 +184,7 @@ private:
QMap
<
QString
,
Internal
::
ExternalTool
*>
*
tools
,
bool
isPreset
=
false
);
void
readSettings
(
const
QMap
<
QString
,
Internal
::
ExternalTool
*>
&
tools
,
QMap
<
QString
,
Q
MultiMap
<
int
,
Internal
::
ExternalTool
*>
>
*
categoryPriorityMap
);
QMap
<
QString
,
Q
List
<
Internal
::
ExternalTool
*>
>
*
categoryPriorityMap
);
void
writeSettings
();
static
ExternalToolManager
*
m_instance
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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