Skip to content

Commit 8f0b951

Browse files
committed
Merge branch 'albert-github-feature/bug_dw_cond_include'
2 parents e478a01 + 31f1321 commit 8f0b951

4 files changed

Lines changed: 161 additions & 187 deletions

File tree

addon/doxywizard/expert.cpp

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ static void translateEnumDescription(QDomElement &valueElem,const QDomElement &t
107107
}
108108
}
109109

110-
static void translateOption(QDomElement &configRoot,const QDomElement &translationRoot)
110+
static bool getFilter(QDomElement docsVal, const QString &mode)
111+
{
112+
QString attr = docsVal.attribute(SA("filter"));
113+
return attr.isEmpty() || attr.contains(mode);
114+
}
115+
116+
static void translateOption(QDomElement &configRoot,const QDomElement &translationRoot, const QString &mode)
111117
{
112118
QDomElement docsVal = configRoot.firstChildElement();
113119
QDomElement trDocsVal = translationRoot.firstChildElement();
@@ -123,9 +129,11 @@ static void translateOption(QDomElement &configRoot,const QDomElement &translati
123129
while (!docsVal.isNull())
124130
{
125131
//qDebug() << "tagName" << docsVal.tagName();
126-
if (docsVal.tagName()==SA("docs") && docsVal.attribute(SA("doxywizard"))!=SA("0"))
132+
if (docsVal.tagName()==SA("docs") && getFilter(docsVal, mode))
127133
{
128-
docsVal.setAttribute(SA("doxywizard"),SA("0"));
134+
docsVal.removeAttribute(SA("filter"));
135+
// we just need a value so we don't have an empty filter (and thus potential a match on doxywizard later on).
136+
docsVal.setAttribute(SA("filter"),SA("dummy"));
129137
}
130138
else if (docsVal.tagName()==SA("value") && docsVal.hasAttribute(SA("desc")))
131139
{
@@ -136,7 +144,7 @@ static void translateOption(QDomElement &configRoot,const QDomElement &translati
136144
}
137145
}
138146

139-
static void translateTopics(QDomElement &configRoot,const QDomElement &translationRoot)
147+
static void translateTopics(QDomElement &configRoot,const QDomElement &translationRoot, const QString &mode)
140148
{
141149
struct GroupInfo
142150
{
@@ -196,7 +204,7 @@ static void translateTopics(QDomElement &configRoot,const QDomElement &translati
196204
QString id = optionElem.attribute(SA("id"));
197205
if (groupMap[name].options.contains(id))
198206
{
199-
translateOption(groupMap[name].options[id],optionElem);
207+
translateOption(groupMap[name].options[id],optionElem,mode);
200208
}
201209
else
202210
{
@@ -287,6 +295,8 @@ Expert::Expert()
287295
mainLayout->addWidget(m_searchBox);
288296
mainLayout->addWidget(m_splitter);
289297

298+
QString mode = SA("doxywizard");
299+
290300
QFile file(SA(":/config.xml"));
291301
QString err = tr("Error");
292302
int errLine=0,errCol=0;
@@ -330,7 +340,7 @@ Expert::Expert()
330340
childElem = childElem.nextSiblingElement();
331341
}
332342
// overrule english text with translations
333-
translateTopics(m_rootElement,trConfigXml.documentElement());
343+
translateTopics(m_rootElement,trConfigXml.documentElement(),mode);
334344
}
335345
else
336346
{
@@ -342,7 +352,7 @@ Expert::Expert()
342352
// createGroups() activates group 0 (lazy), but the Wizard needs all m_options
343353
// populated before it is constructed, so we create all cards eagerly here.
344354
createGroups(m_rootElement);
345-
ensureAllGroupsCreated();
355+
ensureAllGroupsCreated(mode);
346356

347357
// --- Wire up signals ---
348358
m_filterTimer = new QTimer(this);
@@ -436,14 +446,14 @@ void Expert::createGroups(const QDomElement &rootElem)
436446
}
437447
}
438448

439-
void Expert::createOptionCard(GroupEntry &group, const QDomElement &child)
449+
void Expert::createOptionCard(GroupEntry &group, const QDomElement &child, const QString &mode)
440450
{
441451
QString setting = child.attribute(SA("setting"));
442452
if (!setting.isEmpty() && !IS_SUPPORTED(setting.toLatin1())) return;
443453

444454
QString type = child.attribute(SA("type"));
445455
QString id = child.attribute(SA("id"));
446-
QString docs = getDocsForNode(child);
456+
QString docs = getDocsForNode(child, mode);
447457

448458
// Each option gets its own control layout
449459
QWidget *ctrlWidget = new QWidget;
@@ -658,7 +668,7 @@ void Expert::wireDependencies()
658668
}
659669

660670
// Create option cards for 'group' if they haven't been created yet.
661-
void Expert::ensureGroupCardsCreated(GroupEntry &group)
671+
void Expert::ensureGroupCardsCreated(GroupEntry &group, const QString &mode)
662672
{
663673
if (group.cardsCreated) return;
664674
group.cardsCreated = true;
@@ -668,7 +678,7 @@ void Expert::ensureGroupCardsCreated(GroupEntry &group)
668678
{
669679
if (optElem.tagName() == SA("option"))
670680
{
671-
createOptionCard(group, optElem);
681+
createOptionCard(group, optElem, mode);
672682
}
673683
optElem = optElem.nextSiblingElement();
674684
}
@@ -720,11 +730,11 @@ void Expert::setDocumentationVisibility(bool hidden)
720730

721731
// Create cards for every group that hasn't been created yet, then do a full
722732
// dependency update (needed when cross-group deps span newly-created groups).
723-
void Expert::ensureAllGroupsCreated()
733+
void Expert::ensureAllGroupsCreated(const QString &mode)
724734
{
725735
for (GroupEntry &group : m_groups)
726736
{
727-
ensureGroupCardsCreated(group);
737+
ensureGroupCardsCreated(group, mode);
728738
}
729739

730740
// Re-run update so cross-group dependencies are fully applied
@@ -773,7 +783,7 @@ void Expert::nextGroup()
773783
}
774784

775785

776-
QString Expert::getDocsForNode(const QDomElement &child) const
786+
QString Expert::getDocsForNode(const QDomElement &child, const QString &mode) const
777787
{
778788
QString type = child.attribute(SA("type"));
779789
QString docs = SA("");
@@ -782,8 +792,7 @@ QString Expert::getDocsForNode(const QDomElement &child) const
782792
bool first = true;
783793
while (!docsVal.isNull())
784794
{
785-
if (docsVal.tagName()==SA("docs") &&
786-
docsVal.attribute(SA("doxywizard")) != SA("0"))
795+
if (docsVal.tagName()==SA("docs") && getFilter(docsVal, mode))
787796
{
788797
if (!first) docs += SA("<br/>");
789798
first = false;

addon/doxywizard/expert.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ class Expert : public QWidget, public DocIntf
104104
};
105105

106106
void createGroups(const QDomElement &rootElem);
107-
void createOptionCard(GroupEntry &group, const QDomElement &child);
108-
void ensureGroupCardsCreated(GroupEntry &group);
109-
void ensureAllGroupsCreated();
107+
void createOptionCard(GroupEntry &group, const QDomElement &child, const QString &mode);
108+
void ensureGroupCardsCreated(GroupEntry &group, const QString &mode);
109+
void ensureAllGroupsCreated(const QString &mode);
110110
void wireDependencies();
111111
void activateGroup(int index);
112112
void saveTopic(QTextStream &t, QDomElement &elem, TextCodecAdapter *codec,
113113
bool brief, bool condensed, bool convert);
114-
QString getDocsForNode(const QDomElement &child) const;
114+
QString getDocsForNode(const QDomElement &child, const QString &mode) const;
115115

116116
QSplitter *m_splitter;
117117
QTreeWidget *m_treeWidget;

src/config.xml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<doxygenconfig>
22
<header>
3-
<docs doxywizard='0' doxyfile='0'>
3+
<docs filter="documentation">
44
<![CDATA[
55
/*
66
*
@@ -69,7 +69,7 @@ Below is an alphabetical index of the tags that are recognized
6969
followed by the descriptions of the tags grouped by category.
7070
]]>
7171
</docs>
72-
<docs doxywizard='0' documentation='0'>
72+
<docs filter="doxywizard,doxyfile">
7373
<![CDATA[
7474
This file describes the settings to be used by the documentation system
7575
Doxygen (www.doxygen.org) for a project.
@@ -101,7 +101,7 @@ without replacing the environment variables or CMake type replacement variables:
101101
</docs>
102102
</header>
103103
<footer>
104-
<docs doxywizard='0' doxyfile='0'>
104+
<docs filter="documentation">
105105
<![CDATA[
106106
\section config_examples Examples
107107
@@ -593,23 +593,15 @@ Go to the <a href="commands.html">next</a> section or return to the
593593
a physical newline was in the original file.
594594
]]>
595595
</docs>
596-
<docs doxyfile='0' documentation='0'>
596+
<docs filter="doxywizard,doxyfile">
597597
<![CDATA[
598598
When you need a literal `{` or `}` or `,` in the value part of an alias you have to
599599
escape them by means of a backslash (\c \\), this can lead to conflicts with the
600600
commands \c \\{ and \c \\} for these it is advised to use the version \c @{ and \c @} or
601601
use a double escape (\c \\\\{ and \c \\\\})
602602
]]>
603603
</docs>
604-
<docs doxywizard='0' documentation='0'>
605-
<![CDATA[
606-
When you need a literal `{` or `}` or `,` in the value part of an alias you have to
607-
escape them by means of a backslash (\c \\), this can lead to conflicts with the
608-
commands \c \\{ and \c \\} for these it is advised to use the version \c @{ and \c @} or
609-
use a double escape (\c \\\\{ and \c \\\\})
610-
]]>
611-
</docs>
612-
<docs doxyfile='0' doxywizard='0'>
604+
<docs filter="documentation">
613605
<![CDATA[
614606
When you need a literal `{` or `}` or `,` in the value part of an alias you have to
615607
escape them by means of a backslash (\c \\), this can lead to conflicts with the
@@ -1344,7 +1336,7 @@ Go to the <a href="commands.html">next</a> section or return to the
13441336
Whatever the program writes to standard output is used as the file version.
13451337
]]>
13461338
</docs>
1347-
<docs doxywizard='0' doxyfile='0'>
1339+
<docs filter="documentation">
13481340
<![CDATA[
13491341
<br>
13501342
<br>
@@ -1371,7 +1363,7 @@ FILE_VERSION_FILTER = "cleartool desc -fmt \%Vn"
13711363
\endverbatim
13721364
]]>
13731365
</docs>
1374-
<docs documentation='0'>
1366+
<docs filter="doxyfile,doxywizard">
13751367
<![CDATA[
13761368
For an example see the documentation.
13771369
]]>
@@ -2102,7 +2094,7 @@ doxygen -w html new_header.html new_footer.html new_stylesheet.css YourConfigFil
21022094
Doxygen.
21032095
]]>
21042096
</docs>
2105-
<docs doxywizard='0' doxyfile='0'>
2097+
<docs filter="documentation">
21062098
<![CDATA[
21072099
The following markers have a special meaning inside the header and footer:
21082100
<dl>
@@ -2202,7 +2194,7 @@ doxygen -w html new_header.html new_footer.html new_stylesheet.css YourConfigFil
22022194
</dl>
22032195
]]>
22042196
</docs>
2205-
<docs documentation='0'>
2197+
<docs filter="doxyfile,doxywizard">
22062198
<![CDATA[
22072199
For a description of the possible markers and block names see the documentation.
22082200
]]>
@@ -2261,7 +2253,7 @@ doxygen -w html new_header.html new_footer.html new_stylesheet.css YourConfigFil
22612253
So if scrollbar customization is desired it has to be added explicitly.
22622254
]]>
22632255
</docs>
2264-
<docs doxywizard='0' doxyfile='0'>
2256+
<docs filter="documentation">
22652257
<![CDATA[
22662258
Here is an example style sheet that gives the contents area a fixed width:
22672259
\verbatim
@@ -2295,7 +2287,7 @@ hr.footer {
22952287
\endverbatim
22962288
]]>
22972289
</docs>
2298-
<docs documentation='0'>
2290+
<docs filter="doxyfile,doxywizard">
22992291
<![CDATA[
23002292
For an example see the documentation.
23012293
]]>
@@ -2918,7 +2910,7 @@ a package in Mathjax version 4 one can use the package name prepended with a min
29182910
- <a href="https://docs.mathjax.org/en/v4.0/">MathJax version 4</a>
29192911
]]>
29202912
</docs>
2921-
<docs doxywizard='0' doxyfile='0'>
2913+
<docs filter="documentation">
29222914
<![CDATA[
29232915
As an example to disable the "Math Renderer" menu item in the "Math
29242916
Settings" menu of MathJax:
@@ -2935,7 +2927,7 @@ MATHJAX_CODEFILE = disableRenderer.js
29352927
\endverbatim
29362928
]]>
29372929
</docs>
2938-
<docs documentation='0'>
2930+
<docs filter="doxyfile,doxywizard">
29392931
<![CDATA[
29402932
For an example see the documentation.
29412933
]]>
@@ -3172,7 +3164,7 @@ doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
31723164
The following commands have a special meaning inside the header (and footer):
31733165
]]>
31743166
</docs>
3175-
<docs doxywizard='0' doxyfile='0'>
3167+
<docs filter="documentation">
31763168
<![CDATA[
31773169
<dl>
31783170
<dt><code>$title</code><dd>will be replaced with the project name.
@@ -3293,7 +3285,7 @@ The following block name is set based on whether or not a feature is used in the
32933285
</dl>
32943286
]]>
32953287
</docs>
3296-
<docs documentation='0'>
3288+
<docs filter="doxyfile,doxywizard">
32973289
<![CDATA[
32983290
For a description of the possible markers and block names see the documentation.
32993291
]]>

0 commit comments

Comments
 (0)