File indexing completed on 2025-04-20 03:28:58
0001 /************************************************************************************* 0002 * Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License * 0006 * as published by the Free Software Foundation; either version 2 * 0007 * of the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the Free Software * 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0017 *************************************************************************************/ 0018 0019 #include <QApplication> 0020 #include <QFile> 0021 #include <QStringList> 0022 #include <QTextStream> 0023 #include <analitzagui/operatorsmodel.h> 0024 0025 int main(int argc, char **argv) 0026 { 0027 QApplication app(argc, argv); 0028 OperatorsModel m; 0029 0030 QFile f(app.arguments().constLast()); 0031 bool fileopened = f.open(QFile::WriteOnly); 0032 Q_ASSERT(fileopened); 0033 0034 QTextStream str(&f); 0035 0036 str << "<!-- this file is autogenerated, if any change has to be done, please " 0037 "fix kdeedu/kalgebra/utils/main.cpp and its dependencies. " 0038 "Thank you, Aleix Pol -->"; 0039 str << "<chapter id='commands'>\n" 0040 "<title>Commands supported by KAlgebra</title>\n"; 0041 0042 int rows = m.rowCount(), cols = m.columnCount(); 0043 QStringList colHeaders; 0044 for (int i = 0; i < cols; i++) 0045 colHeaders += m.headerData(i, Qt::Horizontal).toString(); 0046 0047 for (int i = 0; i < rows; i++) { 0048 QString id = m.index(i, 0).data().toString(); 0049 str << "\t<sect1 id='" << id << "'><title>" << id << "</title><itemizedlist>\n"; 0050 for (int c = 0; c < cols; c++) 0051 str << QStringLiteral("\t\t<listitem><para>%1: %2</para></listitem>").arg(colHeaders[c], m.index(i, c).data().toString().toHtmlEscaped()) << '\n'; 0052 0053 str << "\t</itemizedlist></sect1>\n"; 0054 } 0055 str << "</chapter>\n"; 0056 0057 return 0; 0058 }