Skip to content

Commit d610c55

Browse files
committed
Incorrect checking between default and used values for strList in doxywizard
In case we use a default doxygen configuration file `doxygen -g` and use this as `doxywizard Doxyfile` we would expect not to see any differences between the used values and the default values, though we see in expert tab that `ABBREVIATE_BRIEF`, `STRIP_FROM_PATH` and `INPUT` don't have the default values (item is "red"). This can also be observed in the run tab when selecting "Condensed" "Show configuration". In the `isDefault()` not only the `strList` itself should be tested but also its values.
1 parent bfe598c commit d610c55

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

addon/doxywizard/inputstrlist.cpp

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Copyright (C) 1997-2019 by Dimitri van Heesch.
44
*
55
* Permission to use, copy, modify, and distribute this software and its
6-
* documentation under the terms of the GNU General Public License is hereby
7-
* granted. No representations are made about the suitability of this software
6+
* documentation under the terms of the GNU General Public License is hereby
7+
* granted. No representations are made about the suitability of this software
88
* for any purpose. It is provided "as is" without express or implied warranty.
99
* See the GNU General Public License for more details.
1010
*
@@ -25,7 +25,7 @@
2525
#include <QTextCodec>
2626

2727
InputStrList::InputStrList( QGridLayout *layout,int &row,
28-
const QString & id,
28+
const QString & id,
2929
const QStringList &sl, ListMode lm,
3030
const QString & docs)
3131
: m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
@@ -50,7 +50,7 @@ InputStrList::InputStrList( QGridLayout *layout,int &row,
5050
m_lb = new QListWidget;
5151
//m_lb->setMinimumSize(400,100);
5252
foreach (QString s, m_strList) m_lb->addItem(s);
53-
53+
5454
m_brFile=0;
5555
m_brDir=0;
5656
if (lm!=ListString)
@@ -60,7 +60,7 @@ InputStrList::InputStrList( QGridLayout *layout,int &row,
6060
m_brFile = toolBar->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(),
6161
this,SLOT(browseFiles()));
6262
m_brFile->setToolTip(tr("Browse to a file"));
63-
}
63+
}
6464
if (lm&ListDir)
6565
{
6666
m_brDir = toolBar->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(),
@@ -78,9 +78,9 @@ InputStrList::InputStrList( QGridLayout *layout,int &row,
7878

7979
m_value = m_strList;
8080

81-
connect(m_le, SIGNAL(returnPressed()),
81+
connect(m_le, SIGNAL(returnPressed()),
8282
this, SLOT(addString()) );
83-
connect(m_lb, SIGNAL(currentTextChanged(const QString &)),
83+
connect(m_lb, SIGNAL(currentTextChanged(const QString &)),
8484
this, SLOT(selectText(const QString &)));
8585
connect( m_lab, SIGNAL(enter()), SLOT(help()) );
8686
connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
@@ -154,7 +154,7 @@ void InputStrList::browseFiles()
154154
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
155155
QStringList fileNames = QFileDialog::getOpenFileNames();
156156

157-
if (!fileNames.isEmpty())
157+
if (!fileNames.isEmpty())
158158
{
159159
QStringList::Iterator it;
160160
for ( it= fileNames.begin(); it != fileNames.end(); ++it )
@@ -184,7 +184,7 @@ void InputStrList::browseDir()
184184
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
185185
QString dirName = QFileDialog::getExistingDirectory();
186186

187-
if (!dirName.isNull())
187+
if (!dirName.isNull())
188188
{
189189
QDir dir(path);
190190
if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
@@ -228,7 +228,7 @@ void InputStrList::update()
228228

229229
void InputStrList::updateDefault()
230230
{
231-
if (m_strList==m_default || !m_lab->isEnabled())
231+
if (isDefault() || !m_lab->isEnabled())
232232
{
233233
m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt"));
234234
}
@@ -246,9 +246,9 @@ void InputStrList::reset()
246246
void InputStrList::writeValue(QTextStream &t,QTextCodec *codec)
247247
{
248248
bool first=true;
249-
foreach (QString s, m_strList)
249+
foreach (QString s, m_strList)
250250
{
251-
if (!first)
251+
if (!first)
252252
{
253253
t << " \\" << endl;
254254
t << " ";
@@ -258,9 +258,48 @@ void InputStrList::writeValue(QTextStream &t,QTextCodec *codec)
258258
}
259259
}
260260

261+
#include <QMessageBox>
261262
bool InputStrList::isDefault()
262263
{
263-
return m_strList==m_default;
264+
bool isEq = m_strList==m_default;
265+
266+
if (!isEq)
267+
{
268+
isEq = true;
269+
270+
auto it1 = m_strList.begin();
271+
auto it2 = m_default.begin();
272+
while (it1!=m_strList.end() && it2!=m_default.end())
273+
{
274+
// skip over empty values
275+
while (it1!=m_strList.end() && (*it1).isEmpty())
276+
{
277+
++it1;
278+
}
279+
while (it2!=m_default.end() && (*it2).isEmpty())
280+
{
281+
++it2;
282+
}
283+
if ((it1!=m_strList.end()) && (it2!=m_default.end()))
284+
{
285+
if ((*it1).trimmed()!= (*it2).trimmed()) // difference so not the default
286+
{
287+
isEq=false;
288+
break;
289+
}
290+
++it1;
291+
++it2;
292+
}
293+
else if ((it1!=m_strList.end()) || (it2!=m_default.end()))
294+
{
295+
// one list empty so cannot be the default
296+
isEq=false;
297+
break;
298+
}
299+
}
300+
}
301+
302+
return isEq;
264303
}
265304

266305
bool InputStrList::isEmpty()

0 commit comments

Comments
 (0)