summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
Diffstat (limited to 'addon')
-rw-r--r--addon/configgen/config_templ.l106
-rw-r--r--addon/configgen/configgen.cpp15
-rw-r--r--addon/doxywizard/pagewidget.cpp2
3 files changed, 71 insertions, 52 deletions
diff --git a/addon/configgen/config_templ.l b/addon/configgen/config_templ.l
index a86156c..3588a42 100644
--- a/addon/configgen/config_templ.l
+++ b/addon/configgen/config_templ.l
@@ -335,65 +335,79 @@ static void substEnvVarsInStrList(QStrList &sl)
while (s)
{
QCString result(s);
+ bool wasQuoted = (result.find(' ')!=-1) || (result.find('\t')!=-1);
substEnvVarsInString(result);
-
- int l=result.length();
- int i,p=0;
- // skip spaces
- // search for a "word"
- for (i=0;i<l;i++)
+
+ if (!wasQuoted) /* as a result of the expansion, a single string
+ may have expanded into a list, which we'll
+ add to sl. If the orginal string already
+ contained multiple elements no splitting is done! */
{
- char c;
- // skip until start of new word
- for (;i<l && ((c=result.at(i))==' ' || c=='\t');i++)
- p=i; // p marks the start index of the word
- // skip until end of a word
- for (;i<l && ((c=result.at(i))!=' ' && c!='\t' && c!='"');i++);
- if (i<l) // not at the end of the string
+
+
+
+ int l=result.length();
+ int i,p=0;
+ // skip spaces
+ // search for a "word"
+ for (i=0;i<l;i++)
{
- if (c=='"') // word within quotes
+ char c;
+ // skip until start of new word
+ for (;i<l && ((c=result.at(i))==' ' || c=='\t');i++)
+ p=i; // p marks the start index of the word
+ // skip until end of a word
+ for (;i<l && ((c=result.at(i))!=' ' && c!='\t' && c!='"');i++);
+ if (i<l) // not at the end of the string
{
- p=i+1;
- for (i++;i<l;i++)
+ if (c=='"') // word within quotes
{
- c=result.at(i);
- if (c=='"') // end quote
+ p=i+1;
+ for (i++;i<l;i++)
{
- // replace the string in the list and go to the next item.
- sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
- sl.next(); // current item is now the old item
- p=i+1;
- break;
- }
- else if (c=='\\') // skip escaped stuff
- {
- i++;
+ c=result.at(i);
+ if (c=='"') // end quote
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ p=i+1;
+ break;
+ }
+ else if (c=='\\') // skip escaped stuff
+ {
+ i++;
+ }
}
}
- }
- else if (c==' ' || c=='\t') // separator
- {
- // replace the string in the list and go to the next item.
- sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
- sl.next(); // current item is now the old item
- p=i+1;
+ else if (c==' ' || c=='\t') // separator
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ p=i+1;
+ }
}
}
+ if (p!=l) // add the leftover as a string
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.right(l-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ }
+
+ // remove the old unexpanded string from the list
+ i=sl.at();
+ sl.remove(); // current item index changes if the last element is removed.
+ if (sl.at()==i) // not last item
+ s = sl.current();
+ else // just removed last item
+ s = 0;
}
- if (p!=l) // add the leftover as a string
+ else // just goto the next element in the list
{
- // replace the string in the list and go to the next item.
- sl.insert(sl.at(),result.right(l-p)); // insert new item before current item.
- sl.next(); // current item is now the old item
+ s=sl.next();
}
-
- // remove the old unexpanded string from the list
- i=sl.at();
- sl.remove(); // current item index changes if the last element is removed.
- if (sl.at()==i) // not last item
- s = sl.current();
- else // just removed last item
- s = 0;
}
}
diff --git a/addon/configgen/configgen.cpp b/addon/configgen/configgen.cpp
index 553db76..e4f9806 100644
--- a/addon/configgen/configgen.cpp
+++ b/addon/configgen/configgen.cpp
@@ -21,9 +21,10 @@
#include <qfile.h>
#include <qlist.h>
#include <qdict.h>
-#include <qstringlist.h>
+#include <qstrlist.h>
#include <stdio.h>
+#include <stdlib.h>
static QString spaces=" ";
@@ -122,7 +123,9 @@ class ConfigOption
stringToC(t,longDesc," t << \"# ","\\n\";");
t << " t << \"\\n\";" << endl;
t << " }" << endl;
- t << " t << \"" << cfgName << " = \";" << endl;
+ t << " t << \"" << cfgName;
+ t << spaces.left(22-cfgName.length());
+ t << "= \";" << endl;
t << " " << writeFunc << "(t,Config::" << varName << ");" << endl;
t << " t << \"\\n\";" << endl;
}
@@ -406,9 +409,11 @@ class ConfigString : public ConfigOption
<< ",SIGNAL(changed()),this,SIGNAL(changed()));" << endl;
if (m_values.count()>0)
{
- for ( QStringList::Iterator it = m_values.begin(); it != m_values.end(); ++it )
+ char *s = m_values.first();
+ while (s)
{
- t << " " << varName << "->addValue(\"" << (*it) << "\");" << endl;
+ t << " " << varName << "->addValue(\"" << s << "\");" << endl;
+ s = m_values.next();
}
}
}
@@ -434,7 +439,7 @@ class ConfigString : public ConfigOption
private:
ConfigInfo *m_parent;
WidgetType m_widgetType;
- QStringList m_values;
+ QStrList m_values;
};
class ConfigInt : public ConfigOption
diff --git a/addon/doxywizard/pagewidget.cpp b/addon/doxywizard/pagewidget.cpp
index 48ab092..8323029 100644
--- a/addon/doxywizard/pagewidget.cpp
+++ b/addon/doxywizard/pagewidget.cpp
@@ -51,7 +51,7 @@ PageWidget::PageWidget( QTabWidget *parent, const char *name )
m_parent->addTab( this, name );
}
-void PageWidget::addStretch(int stretch=0)
+void PageWidget::addStretch(int stretch)
{
lay->addStretch(stretch);
//printf("Viewport SizeHint %d,%d\n",viewport()->sizeHint().width(),viewport()->sizeHint().height());