From ab0da0017dc6243d5aa27c3ca9933ae3408030aa Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Mon, 3 Jul 2023 10:11:51 +0200 Subject: [PATCH] modified the way to generate styles-example documentation again --- doc/CMakeLists.txt | 4 +- doc/dox/jkqtplotter_styling.dox | 50 ++++++++++++- doc/htmlinclude/styles.dox | 46 ------------ .../jkqtplotter_doc_imagegenerator.cpp | 73 ++++++++++++------- 4 files changed, 99 insertions(+), 74 deletions(-) delete mode 100644 doc/htmlinclude/styles.dox diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 56f64d1cb2..7cdbf6d2da 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -88,7 +88,7 @@ if(JKQtPlotter_BUILD_TOOLS) set(JKQTPlotter_GenerateDocImages_COMMAND $ ${JKQTPlotter_GenerateDocImages_DefaultOptions}) set(JKQTPlotter_GenerateDocImages_OutputDir "${CMAKE_CURRENT_LIST_DIR}/images/") - set(JKQTPlotter_GenerateDocImages_DocOutputDir "${CMAKE_CURRENT_LIST_DIR}/htmlinclude/") + set(JKQTPlotter_GenerateDocImages_dox "${CMAKE_CURRENT_LIST_DIR}/dox/") add_custom_target(JKQTPlotter_GenerateDocImages_listplotsymbols @@ -125,7 +125,7 @@ if(JKQtPlotter_BUILD_TOOLS) add_custom_target(JKQTPlotter_GenerateDocImages_liststyles COMMENT "Building JKQTPlotter Documentation Images: liststyles" - COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --liststyles --iconsize=500 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/styles/" --docoutputdir="${JKQTPlotter_GenerateDocImages_DocOutputDir}" + COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --liststyles --iconsize=500 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/styles/" --doctomodify="${JKQTPlotter_GenerateDocImages_dox}/jkqtplotter_styling.dox" WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR} DEPENDS jkqtplotter_doc_imagegenerator ) diff --git a/doc/dox/jkqtplotter_styling.dox b/doc/dox/jkqtplotter_styling.dox index 5240db6b61..6ca6eb26c1 100644 --- a/doc/dox/jkqtplotter_styling.dox +++ b/doc/dox/jkqtplotter_styling.dox @@ -40,7 +40,55 @@ These are also linked into the JKQTPlotter library as Qt ressource into the subd \endcode Here is a table with all available ready-made styles: -\include{doc} styles.dox + + + + + + + + + + + + + + +
Style-file + Screenshot + Symbols +
:/JKQTPlotter/styles/blackandwhite.ini + \image html blackandwhite.ini.png + \image html blackandwhite.ini.symbols.png +
:/JKQTPlotter/styles/blueprint.ini + \image html blueprint.ini.png + \image html blueprint.ini.symbols.png +
:/JKQTPlotter/styles/dark.ini + \image html dark.ini.png + \image html dark.ini.symbols.png +
:/JKQTPlotter/styles/default.ini + \image html default.ini.png + \image html default.ini.symbols.png +
:/JKQTPlotter/styles/legacy_default_style.ini + \image html legacy_default_style.ini.png + \image html legacy_default_style.ini.symbols.png +
:/JKQTPlotter/styles/seaborn.ini + \image html seaborn.ini.png + \image html seaborn.ini.symbols.png +
:/JKQTPlotter/styles/simple_arrowsaxes.ini + \image html simple_arrowsaxes.ini.png + \image html simple_arrowsaxes.ini.symbols.png +
:/JKQTPlotter/styles/simple_axesoffset.ini + \image html simple_axesoffset.ini.png + \image html simple_axesoffset.ini.symbols.png +
:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini + \image html simple_axesoffset_plotbox.ini.png + \image html simple_axesoffset_plotbox.ini.symbols.png +
:/JKQTPlotter/styles/simple_gridandticks.ini + \image html simple_gridandticks.ini.png + \image html simple_gridandticks.ini.symbols.png +
+ \see Classes are documented in \ref jkqtpplotter_styling_classes .
See \ref JKQTPlotterStyling for a detailed example. diff --git a/doc/htmlinclude/styles.dox b/doc/htmlinclude/styles.dox deleted file mode 100644 index 0ea49dbc47..0000000000 --- a/doc/htmlinclude/styles.dox +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - -
Style-file - Screenshot - Symbols -
:/JKQTPlotter/styles/blackandwhite.ini - \image html blackandwhite.ini.png - \image html blackandwhite.ini.symbols.png -
:/JKQTPlotter/styles/blueprint.ini - \image html blueprint.ini.png - \image html blueprint.ini.symbols.png -
:/JKQTPlotter/styles/dark.ini - \image html dark.ini.png - \image html dark.ini.symbols.png -
:/JKQTPlotter/styles/default.ini - \image html default.ini.png - \image html default.ini.symbols.png -
:/JKQTPlotter/styles/legacy_default_style.ini - \image html legacy_default_style.ini.png - \image html legacy_default_style.ini.symbols.png -
:/JKQTPlotter/styles/seaborn.ini - \image html seaborn.ini.png - \image html seaborn.ini.symbols.png -
:/JKQTPlotter/styles/simple_arrowsaxes.ini - \image html simple_arrowsaxes.ini.png - \image html simple_arrowsaxes.ini.symbols.png -
:/JKQTPlotter/styles/simple_axesoffset.ini - \image html simple_axesoffset.ini.png - \image html simple_axesoffset.ini.symbols.png -
:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini - \image html simple_axesoffset_plotbox.ini.png - \image html simple_axesoffset_plotbox.ini.symbols.png -
:/JKQTPlotter/styles/simple_gridandticks.ini - \image html simple_gridandticks.ini.png - \image html simple_gridandticks.ini.symbols.png -
\ No newline at end of file diff --git a/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp b/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp index d5b3e23249..6aaad040ef 100644 --- a/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp +++ b/tools/jkqtplotter_doc_imagegenerator/jkqtplotter_doc_imagegenerator.cpp @@ -606,32 +606,55 @@ void plotStyleSymbols(JKQTBasePlotter& plotExtra, const JKQTBasePlotter& plot) { } -void doListStyles(const QDir& outputDir, const QDir& docoutputDir, int iconsize, QColor backgroundColor) { +void doListStyles(const QDir& outputDir, const QStringList& doctomodify, int iconsize, QColor backgroundColor) { QDir dir(":/JKQTPlotter/styles/", "*.ini"); - QFile fhtml(docoutputDir.absoluteFilePath("styles.dox")); - fhtml.open(QFile::WriteOnly|QFile::Text); - QTextStream shtml(&fhtml); - shtml<<"\n \n \n
Style-file\n Screenshot\n Symbols\n"; - for (auto& f: dir.entryList()) { - qDebug()<<"plotting example for style "<\n
Style-file\n Screenshot\n Symbols\n"; + for (auto& f: dir.entryList()) { + qDebug()<<"plotting example for style "<\n" - <<" "<\n" - <<" \\image html "<\\image html "<\n" + <<" "<\n" + <<" \\image html "<\\image html "<"; + } + const QString delim1=""; + const QString delim2=""; + for (auto& docf: doctomodify) { + QFile f(docf); + if (f.open(QFile::ReadOnly|QFile::Text)) { + const QString old=f.readAll(); + QString replold; + const int idx1=old.indexOf(delim1)+delim1.size(); + const int idx2=old.indexOf(delim2); + if (idx1>=0 && idx2>=0 && idx2>idx1) { + replold=old.mid(0, idx1+1); + replold+="\n"+doc+"\n"; + replold+=old.mid(idx2); + f.close(); + f.remove(); + QFile fo(docf); + if (fo.open(QFile::WriteOnly|QFile::Text)) { + fo.write(replold.toUtf8()); + } + } + } } - shtml<<"
"; } int main(int argc, char* argv[]) @@ -644,8 +667,8 @@ int main(int argc, char* argv[]) parser.addVersionOption(); QCommandLineOption outputDirectoryOption("outputdir", "write results into this directory.", "outputdir", app.applicationDirPath()); parser.addOption(outputDirectoryOption); - QCommandLineOption docoutputDirectoryOption("docoutputdir", "write doc-file results into this directory.", "docoutputdir", app.applicationDirPath()); - parser.addOption(docoutputDirectoryOption); + QCommandLineOption doctomodifyectoryOption("doctomodify", "doc-files into which to write results: tag ... is replaced by doc.", "doctomodify", app.applicationDirPath()); + parser.addOption(doctomodifyectoryOption); QCommandLineOption listsymbolsOption("listsymbols", "generate example images for all symbols."); parser.addOption(listsymbolsOption); QCommandLineOption listlinedecoratorsOption("listlinedecorators", "generate example images for all line-decorators."); @@ -663,7 +686,7 @@ int main(int argc, char* argv[]) parser.process(app); const QDir outputDir(parser.value(outputDirectoryOption)); - const QDir docoutputDir(parser.value(docoutputDirectoryOption)); + const QStringList doctomodify(parser.value(doctomodifyectoryOption).split(",")); const bool listsymbols=parser.isSet(listsymbolsOption); const bool listlinedecorators=parser.isSet(listlinedecoratorsOption); const bool listerrorindicators=parser.isSet(listerrorindicatorsOption); @@ -678,7 +701,7 @@ int main(int argc, char* argv[]) if (listlinedecorators) doListLineDecorators(outputDir, iconsize, backgroundColor); if (listerrorindicators) doListErrorIndicators(outputDir, iconsize, backgroundColor); if (listaxisstyleprops) doListAxisStyling(outputDir, iconsize, backgroundColor); - if (liststyles) doListStyles(outputDir, docoutputDir, iconsize, backgroundColor); + if (liststyles) doListStyles(outputDir, doctomodify, iconsize, backgroundColor); return EXIT_SUCCESS; }