29 #include <QTextBrowser>
44 QFile stylesheetFile(
":/help/styles.css");
45 if (stylesheetFile.open(QIODevice::ReadOnly | QIODevice::Text))
48 qWarning() <<
"Stylesheet could not be loaded.";
49 stylesheetFile.close();
53 QFile footerFile(
":/help/footer.txt");
54 if (footerFile.open(QIODevice::ReadOnly | QIODevice::Text))
57 qWarning() <<
"Footer file could not be loaded.";
61 DocGenerator::~DocGenerator() {
76 QFile docPage(fileName);
77 if (docPage.open(QIODevice::ReadOnly | QIODevice::Text)) {
80 "<meta name=\"qrichtext\" content=\"1\"/>"
81 "<style type=\"text/css\">%1</style>"
82 "</head><body>%2\n%3</body></html>")
84 .arg(QString::fromUtf8(docPage.readAll()))
88 qWarning() << tr(
"DocPage file %1 could not be loaded.")
100 QString html = QString(
102 "<meta name=\"qrichtext\" content=\"1\"/>"
103 "<style type=\"text/css\">%1</style>"
104 "</head><body><div><p>%2</p></div>\n%3</body></html>")
118 QString className, QString slotType)
const {
120 QStringList::const_iterator parIter;
124 for(parIter=parList.begin(); parIter!=parList.end(); parIter++) {
128 ret +=
"<td class=\"leftcol\"></td>";
130 if (parType.contains(QRegExp(
"^\\s*\\{\\s*\\w.*\\}\\s*$")))
131 parType =
"Selection";
132 parType.replace(
"<",
"<").replace(
">",
">");
133 ret += QString(
"<td class=\"dtype firstrow\">%1</td>")
135 ret += QString(
"<td class=\"firstrow\"><span class=\"parname\">"
141 ret +=
"<td class=\"firstrow\">";
144 ret +=
"<em>("+tr(
"default: \"%1\"").arg(def)+
")</em>";
148 if (slotType ==
"in") {
150 flags +=
"MultiSlot";
158 if (slotType ==
"out") {
160 flags +=
"SingleSlot";
168 ret += QString(
"<em>(%1)</em>").arg(flags);
173 ret +=
"<tr><td class=\"leftcol\"></td><td></td>";
174 ret += QString(
"<td colspan=\"2\">%1</td></tr><tr></tr>")
179 ret +=
"<tr><td class=\"leftcol\"></td>"
180 "<td colspan=\"3\">" + tr(
"(none)") +
"</td></tr>\n";
186 "<h1>"+tr(
"ClassDocumentation: %1").arg(className)+
"</h1>\n<h2>"
188 + QString(
"</h2>\n<p>%1</p>\n")
193 if(!docFileName.isEmpty()) {
196 .configDir().absoluteFilePath(docFileName)));
197 if (docFile.open(QIODevice::ReadOnly | QIODevice::Text))
198 page += docFile.readAll();
200 qWarning() << tr(
"Documentation file %1 could not be loaded.")
207 page +=
"<table class=\"parlist\">";
211 page +=
"<tr><td colspan=\"5\"><h2>" + tr(
"input slots")
212 +
"</h2></td></tr>\n";
213 page +=
_docList(parList, className,
"in");
217 page +=
"<tr><td colspan=\"5\"><h2>" + tr(
"output slots")
218 +
"</h2></td></tr>\n";
219 page +=
_docList(parList, className,
"out");
223 page +=
"<tr><td colspan=\"5\"><h2>"+tr(
"parameters")+
"</h2></td></tr>\n";
224 page +=
_docList(parList, className);
Declaration of class FileManager.
Declaration of class ParameterFileModel.
void showDocString(const QString &doc)
Show the given html-formatted string.
static const FileManager & instance()
get a reference to the file Manager instance
QString _docList(QStringList parList, QString className, QString slotType="") const
Generate documentation for the given list of parameters.
Declaration of class DocGenerator.
QString _footer
footer for doc pages
QString _helpDoc
current docstring in help browser
void showHelp()
show help page in help browser
QTextBrowser * _viewer
pointer to used viewer instance
void showIntro()
show introduction message in help browser
DocGenerator(QTextBrowser *viewer, QObject *parent=0)
Default constructor.
void showClassDoc(const QString &className)
show documentation page
QString _stylesheet
stylesheet for help doc
void updateMetaData()
update internal MetaData Object, call when plugins are updated
MetaData * _meta
MetaData of all loaded Plugins.
void showDocPage(const QString &fileName)
Show documentation page.