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
14fc6e93
Commit
14fc6e93
authored
Mar 12, 2010
by
Lasse Holmstedt
Browse files
Fixed icons in plugin manager
parent
d13dfe44
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/extensionsystem/pluginview.cpp
View file @
14fc6e93
...
...
@@ -151,9 +151,9 @@ void PluginView::updateList()
m_items
.
append
(
collectionItem
);
Qt
::
CheckState
groupState
=
Qt
::
Unchecked
;
bool
hasErrors
=
parsePluginSpecs
(
collectionItem
,
groupState
,
collection
->
plugins
());
int
state
=
parsePluginSpecs
(
collectionItem
,
groupState
,
collection
->
plugins
());
collectionItem
->
setIcon
(
0
,
hasErrors
?
m_errorIcon
:
m_okIcon
);
collectionItem
->
setIcon
(
0
,
iconForState
(
state
)
);
collectionItem
->
setData
(
C_LOAD
,
Qt
::
CheckStateRole
,
QVariant
(
groupState
));
collectionItem
->
setToolTip
(
C_LOAD
,
tr
(
"Load on Startup"
));
collectionItem
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
collection
));
...
...
@@ -170,14 +170,13 @@ void PluginView::updateList()
m_items
.
append
(
defaultCollectionItem
);
Qt
::
CheckState
groupState
=
Qt
::
Unchecked
;
bool
hasErrors
=
parsePluginSpecs
(
defaultCollectionItem
,
groupState
,
defaultCollection
->
plugins
());
int
state
=
parsePluginSpecs
(
defaultCollectionItem
,
groupState
,
defaultCollection
->
plugins
());
defaultCollectionItem
->
setIcon
(
0
,
hasErrors
?
m_errorIcon
:
m_okIcon
);
defaultCollectionItem
->
setIcon
(
0
,
iconForState
(
state
)
);
defaultCollectionItem
->
setData
(
C_LOAD
,
Qt
::
CheckStateRole
,
QVariant
(
groupState
));
defaultCollectionItem
->
setToolTip
(
C_LOAD
,
tr
(
"Load on Startup"
));
defaultCollectionItem
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
defaultCollection
));
foreach
(
PluginSpec
*
spec
,
m_specToItem
.
keys
())
toggleRelatedPlugins
(
spec
,
spec
->
loadOnStartup
()
&&
!
spec
->
ignoreOnStartup
());
...
...
@@ -192,14 +191,15 @@ void PluginView::updateList()
m_ui
->
categoryWidget
->
setCurrentItem
(
m_ui
->
categoryWidget
->
topLevelItem
(
0
));
}
bool
PluginView
::
parsePluginSpecs
(
QTreeWidgetItem
*
parentItem
,
Qt
::
CheckState
&
groupState
,
QList
<
PluginSpec
*>
plugins
)
int
PluginView
::
parsePluginSpecs
(
QTreeWidgetItem
*
parentItem
,
Qt
::
CheckState
&
groupState
,
QList
<
PluginSpec
*>
plugins
)
{
bool
hasErrors
=
false
;
int
ret
=
0
;
int
loadCount
=
0
;
for
(
int
i
=
0
;
i
<
plugins
.
length
();
++
i
)
{
PluginSpec
*
spec
=
plugins
[
i
];
if
(
spec
->
hasError
())
hasErrors
=
true
;
ret
|=
ParsedWithErrors
;
QTreeWidgetItem
*
pluginItem
=
new
QTreeWidgetItem
(
QStringList
()
<<
spec
->
name
()
...
...
@@ -209,7 +209,7 @@ bool PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &g
pluginItem
->
setToolTip
(
0
,
QDir
::
toNativeSeparators
(
spec
->
filePath
()));
bool
ok
=
!
spec
->
hasError
();
QIcon
&
icon
=
ok
?
m_okIcon
:
m_errorIcon
;
QIcon
icon
=
ok
?
m_okIcon
:
m_errorIcon
;
if
(
ok
&&
(
spec
->
state
()
!=
PluginSpec
::
Running
))
icon
=
m_notLoadedIcon
;
...
...
@@ -219,10 +219,8 @@ bool PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &g
Qt
::
CheckState
state
=
Qt
::
Unchecked
;
if
(
spec
->
loadOnStartup
())
{
state
=
Qt
::
Checked
;
//if (!spec->ignoreOnStartup())
++
loadCount
;
}
else
hasErrors
=
true
;
++
loadCount
;
}
if
(
!
m_whitelist
.
contains
(
spec
->
name
()))
pluginItem
->
setData
(
C_LOAD
,
Qt
::
CheckStateRole
,
state
);
...
...
@@ -245,14 +243,28 @@ bool PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &g
}
if
(
loadCount
==
plugins
.
length
())
if
(
loadCount
==
plugins
.
length
())
{
groupState
=
Qt
::
Checked
;
else
if
(
loadCount
==
0
)
ret
|=
ParsedAll
;
}
else
if
(
loadCount
==
0
)
{
groupState
=
Qt
::
Unchecked
;
else
ret
|=
ParsedNone
;
}
else
{
groupState
=
Qt
::
PartiallyChecked
;
ret
=
ret
|
ParsedPartial
;
}
return
ret
;
}
QIcon
PluginView
::
iconForState
(
int
state
)
{
if
(
state
&
ParsedWithErrors
)
return
m_errorIcon
;
if
(
state
&
ParsedNone
||
state
&
ParsedPartial
)
return
m_notLoadedIcon
;
return
hasErrors
;
return
m_okIcon
;
}
void
PluginView
::
selectPlugin
(
QTreeWidgetItem
*
current
)
...
...
src/libs/extensionsystem/pluginview.h
View file @
14fc6e93
...
...
@@ -75,8 +75,10 @@ private slots:
void
activatePlugin
(
QTreeWidgetItem
*
item
);
private:
enum
ParsedState
{
ParsedNone
=
1
,
ParsedPartial
=
2
,
ParsedAll
=
4
,
ParsedWithErrors
=
8
};
QIcon
iconForState
(
int
state
);
void
toggleRelatedPlugins
(
PluginSpec
*
spec
,
bool
isPluginEnabled
=
true
);
bool
parsePluginSpecs
(
QTreeWidgetItem
*
parentItem
,
Qt
::
CheckState
&
groupState
,
QList
<
PluginSpec
*>
plugins
);
int
parsePluginSpecs
(
QTreeWidgetItem
*
parentItem
,
Qt
::
CheckState
&
groupState
,
QList
<
PluginSpec
*>
plugins
);
Internal
::
Ui
::
PluginView
*
m_ui
;
Internal
::
PluginViewPrivate
*
p
;
...
...
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