1
/*************************************************************************************
2
* Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> *
4
* This program is free software; you can redistribute it and/or *
5
* modify it under the terms of the GNU General Public License *
6
* as published by the Free Software Foundation; either version 2 *
7
* of the License, or (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the Free Software *
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17
*************************************************************************************/
19
#include <analitzagui/operatorsmodel.h>
20
#include <QApplication>
21
#include <QStringList>
23
#include <QTextDocument>
24
#include <QtCore/QTextStream>
26
int main(int argc, char** argv)
28
QApplication app(argc, argv);
31
QFile f(app.arguments().last());
32
bool fileopened = f.open(QFile::WriteOnly);
37
str << "<!-- this file is autogenerated, if any change has to be done, please "
38
"fix kdeedu/kalgebra/utils/main.cpp and its dependencies. "
39
"Thank you, Aleix Pol -->";
40
str << "<chapter id='commands'>\n"
41
"<title>Commands supported by KAlgebra</title>\n";
43
int rows = m.rowCount(), cols = m.columnCount();
44
QStringList colHeaders;
45
for(int i=0; i<cols; i++)
46
colHeaders += m.headerData(i, Qt::Horizontal).toString();
48
for(int i=0; i<rows; i++) {
49
QString id = m.index(i,0).data().toString();
50
str << "\t<sect1 id='" << id << "'><title>" << id << "</title><itemizedlist>\n";
51
for(int c=0; c<cols; c++)
52
str << qPrintable(QString("\t\t<listitem><para>%1: %2</para></listitem>").arg(colHeaders[c]).arg(Qt::escape(m.index(i,c).data().toString()))) << '\n';
54
str << "\t</itemizedlist></sect1>\n";
56
str << "</chapter>\n";