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
fd6f1b69
Commit
fd6f1b69
authored
Aug 03, 2010
by
kh1
Browse files
Show user defined filters only, some more of information about the filter.
Reviewed-by: ck
parent
1bcdb33f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/help/filtersettingspage.cpp
View file @
fd6f1b69
...
...
@@ -110,22 +110,24 @@ void FilterSettingsPage::updateFilterPage()
manager
->
customValue
(
Help
::
Constants
::
PreviousFilterNameKey
).
toString
();
}
QSet
<
QString
>
attributes
;
const
Core
::
HelpManager
::
Filters
&
filters
=
manager
->
filters
();
Core
::
HelpManager
::
Filters
filters
=
manager
->
userDefinedFilters
();
Core
::
HelpManager
::
Filters
::
const_iterator
it
;
for
(
it
=
filters
.
constBegin
();
it
!=
filters
.
constEnd
();
++
it
)
{
const
QString
&
filter
=
it
.
key
();
if
(
filter
==
trUnfiltered
||
filter
==
lastTrUnfiltered
)
continue
;
attributes
+=
it
.
value
().
toSet
();
m_filterMapBackup
.
insert
(
filter
,
it
.
value
());
if
(
!
m_filterMap
.
contains
(
filter
))
m_filterMap
.
insert
(
filter
,
it
.
value
());
}
m_ui
.
filterWidget
->
addItems
(
m_filterMap
.
keys
());
QSet
<
QString
>
attributes
;
filters
=
manager
->
filters
();
for
(
it
=
filters
.
constBegin
();
it
!=
filters
.
constEnd
();
++
it
)
attributes
+=
it
.
value
().
toSet
();
foreach
(
const
QString
&
attribute
,
attributes
)
new
QTreeWidgetItem
(
m_ui
.
attributeWidget
,
QStringList
(
attribute
));
...
...
@@ -148,6 +150,8 @@ void FilterSettingsPage::updateAttributes(QListWidgetItem *item)
else
itm
->
setCheckState
(
0
,
Qt
::
Unchecked
);
}
updateFilterDescription
(
item
?
item
->
text
()
:
QString
());
}
void
FilterSettingsPage
::
updateFilterMap
()
...
...
@@ -166,6 +170,7 @@ void FilterSettingsPage::updateFilterMap()
newAtts
.
append
(
itm
->
text
(
0
));
}
m_filterMap
[
filter
]
=
newAtts
;
updateFilterDescription
(
filter
);
}
void
FilterSettingsPage
::
addFilter
()
...
...
@@ -197,6 +202,9 @@ void FilterSettingsPage::removeFilter()
delete
item
;
if
(
m_ui
.
filterWidget
->
count
())
m_ui
.
filterWidget
->
setCurrentRow
(
0
);
item
=
m_ui
.
filterWidget
->
item
(
m_ui
.
filterWidget
->
currentRow
());
updateFilterDescription
(
item
?
item
->
text
()
:
QString
());
}
void
FilterSettingsPage
::
apply
()
...
...
@@ -243,3 +251,24 @@ bool FilterSettingsPage::matches(const QString &s) const
{
return
m_searchKeywords
.
contains
(
s
,
Qt
::
CaseInsensitive
);
}
void
FilterSettingsPage
::
updateFilterDescription
(
const
QString
&
filter
)
{
const
QStringList
&
checkedList
=
m_filterMap
.
value
(
filter
);
if
(
!
m_filterMap
.
keys
().
isEmpty
())
{
const
QString
prefix
=
tr
(
"The filter
\"
%1
\"
will"
).
arg
(
filter
);
if
(
checkedList
.
isEmpty
())
{
m_ui
.
label
->
setText
(
prefix
+
tr
(
" show every documentation file "
"available, as no attributes are specified."
));
}
else
if
(
checkedList
.
count
()
==
1
)
{
m_ui
.
label
->
setText
(
prefix
+
tr
(
" only show documentation files that"
" have the attribute %2 specified."
).
arg
(
checkedList
.
first
()));
}
else
{
m_ui
.
label
->
setText
(
prefix
+
tr
(
" only show documentation files that"
" have the attributes %2 specified."
).
arg
(
checkedList
.
join
(
", "
)));
}
}
else
{
m_ui
.
label
->
setText
(
tr
(
"No user defined filters available or no filter "
"selected."
));
}
}
src/plugins/help/filtersettingspage.h
View file @
fd6f1b69
...
...
@@ -65,6 +65,9 @@ private slots:
void
addFilter
();
void
removeFilter
();
private:
void
updateFilterDescription
(
const
QString
&
filter
);
private:
Ui
::
FilterSettingsPage
m_ui
;
...
...
src/plugins/help/filtersettingspage.ui
View file @
fd6f1b69
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
4
00
</width>
<height>
3
00
</height>
<width>
4
19
</width>
<height>
3
13
</height>
</rect>
</property>
<property
name=
"toolTip"
>
...
...
@@ -27,6 +27,18 @@ Add, modify, and remove document filters, which determine the documentation set
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QListWidget"
name=
"filterWidget"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Expanding"
>
<horstretch>
10
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
150
</height>
</size>
</property>
<property
name=
"uniformItemSizes"
>
<bool>
true
</bool>
</property>
...
...
@@ -43,6 +55,18 @@ Add, modify, and remove document filters, which determine the documentation set
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QTreeWidget"
name=
"attributeWidget"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
150
</height>
</size>
</property>
<property
name=
"showDropIndicator"
stdset=
"0"
>
<bool>
false
</bool>
</property>
...
...
@@ -55,9 +79,6 @@ Add, modify, and remove document filters, which determine the documentation set
<attribute
name=
"headerVisible"
>
<bool>
false
</bool>
</attribute>
<attribute
name=
"headerVisible"
>
<bool>
false
</bool>
</attribute>
<column>
<property
name=
"text"
>
<string>
1
</string>
...
...
@@ -70,6 +91,25 @@ Add, modify, and remove document filters, which determine the documentation set
</item>
</layout>
</item>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
50
</height>
</size>
</property>
<property
name=
"text"
>
<string>
No user defined filters available or no filter selected.
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
</set>
</property>
<property
name=
"wordWrap"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
...
...
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