From 93de7f375842c0afb72db8796c45bfda5f1a6f13 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 25 Mar 2011 14:54:32 +0000 Subject: Finished documenting the last widgets. Also some changes in the docgen app. --- client/docgen/docgen.cc | 3 ++- client/docgen/generate.cc | 44 ++++++++++++++++++++++++++++++++++++++++++-- client/docgen/genimage.cc | 17 +++++++++++++++++ client/docgen/parse.cc | 2 +- client/docgen/style.css | 15 ++++++++++++++- 5 files changed, 76 insertions(+), 5 deletions(-) (limited to 'client/docgen') diff --git a/client/docgen/docgen.cc b/client/docgen/docgen.cc index e5a8bff..ee5b8f4 100644 --- a/client/docgen/docgen.cc +++ b/client/docgen/docgen.cc @@ -145,7 +145,8 @@ int main(int argc, char *argv[]) QStringList l = dir.entryList(QDir::Files); foreach(QString file, l) { Doc doc = parse(QString(INPUT) + "/" + file); - docs[doc.name] = doc; + if(doc.title != "" || doc.tag != "") + docs[doc.name] = doc; } writeIndex(docs); diff --git a/client/docgen/generate.cc b/client/docgen/generate.cc index 73734a5..5cff6b7 100644 --- a/client/docgen/generate.cc +++ b/client/docgen/generate.cc @@ -29,9 +29,47 @@ #include #include +#include #include "genimage.h" +static QString function(QString f) +{ + QString out; + + if(f.indexOf(" ") > f.indexOf("(") || f.indexOf(" ") == -1) { + printf("MISSING return type in \"%s\".\n", f.toStdString().c_str()); + return f; + } + + QString ret = f.left(f.indexOf(" ")); + QString name = f.mid(f.indexOf(" ") + 1, f.indexOf("(") - f.indexOf(" ") - 1); + QString ps = f.mid(f.indexOf("(") + 1, + f.indexOf(")") - f.indexOf("(") - 1); + + QStringList parms = ps.split(","); + + out += "" + ret + " "; + out += "" + name + ""; + out += "("; + for(int i = 0; i < parms.size(); i++) { + QStringList l = parms.at(i).split(" ", QString::SkipEmptyParts); + if(l.length() != 2) { + out += parms.at(i); + continue; + } + QString type = l.at(0); + QString name = l.at(1); + if(i != 0) out += ", "; + out += "" + type + ""; + out += " " + name + ""; + } + out += ")"; + + + return out; +} + static QString generateMethods(QVector meths) { QString out; @@ -39,7 +77,7 @@ static QString generateMethods(QVector meths) foreach(Method meth, meths) { out += "
\n"; out += "
" + meth.name + "
\n"; + "\">
" + function(meth.name) + "
\n"; out += "
" + meth.description + "
\n"; @@ -189,7 +227,9 @@ QString generate(Doc &doc, QMap > &meths, out += "
\n"; out += "
This documentation is generated for" - " Pracro version "VERSION" at "+QDate::currentDate().toString()+"
\n"; + " Pracro" + " version "VERSION" at "+QDate::currentDate().toString()+"\n"; + return out; } diff --git a/client/docgen/genimage.cc b/client/docgen/genimage.cc index 332887c..f598553 100644 --- a/client/docgen/genimage.cc +++ b/client/docgen/genimage.cc @@ -64,6 +64,15 @@ void genImage(QString widget) } if(widget == "combobox" || widget == "listbox") { + + if(widget == "listbox") { + QDomElement e = node.createElement("item"); + e.setAttribute("type", "header"); + e.setAttribute("caption", "Header 1"); + e.setAttribute("value", "Header 1"); + elem.appendChild(e); + } + { QDomElement e = node.createElement("item"); e.setAttribute("caption", "List item 1"); @@ -77,6 +86,14 @@ void genImage(QString widget) elem.appendChild(e); } + if(widget == "listbox") { + QDomElement e = node.createElement("item"); + e.setAttribute("type", "separator"); + e.setAttribute("caption", "sep 1"); + e.setAttribute("value", "sep 1"); + elem.appendChild(e); + } + { QDomElement e = node.createElement("item"); e.setAttribute("caption", "List item 3"); diff --git a/client/docgen/parse.cc b/client/docgen/parse.cc index bcf137b..d1631c1 100644 --- a/client/docgen/parse.cc +++ b/client/docgen/parse.cc @@ -69,7 +69,7 @@ Doc parse(QString filename) if(running) { line.remove(QRegExp("^[ \t*]*")); - printf("line [%s]\n", line.toStdString().c_str()); + // printf("line [%s]\n", line.toStdString().c_str()); if(state == indesc && line.left(1) == "@") state = none; if(state == inatt && line.left(1) == "@") state = none; diff --git a/client/docgen/style.css b/client/docgen/style.css index 778c69d..9ef9a68 100644 --- a/client/docgen/style.css +++ b/client/docgen/style.css @@ -85,7 +85,6 @@ a:hover { background-color: #D5E1E8; width: *; border: solid #84B0C7 1px; - font-weight: bold; padding: 4px; border-radius: 8px 8px 8px 8px; } @@ -106,3 +105,17 @@ a:hover { .parameter .description { display: inline; } + +.method .luamethod { + font-weight: bold; +} + +.method .luatype { + font-style: italic; + color: blue; +} + +.method .luaparms { + font-style: italic; + color: green; +} \ No newline at end of file -- cgit v1.2.3