mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
modified the way to generate styles-example documentation again
This commit is contained in:
parent
55912ad931
commit
ab0da0017d
@ -88,7 +88,7 @@ if(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
set(JKQTPlotter_GenerateDocImages_COMMAND $<TARGET_FILE:jkqtplotter_doc_imagegenerator> ${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
|
||||
)
|
||||
|
@ -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
|
||||
<!--include:styles.dox-->
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Style-file
|
||||
<th>Screenshot
|
||||
<th>Symbols
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blackandwhite.ini"><code>:/JKQTPlotter/styles/blackandwhite.ini</code></a>
|
||||
<td>\image html blackandwhite.ini.png
|
||||
<td>\image html blackandwhite.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blueprint.ini"><code>:/JKQTPlotter/styles/blueprint.ini</code></a>
|
||||
<td>\image html blueprint.ini.png
|
||||
<td>\image html blueprint.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/dark.ini"><code>:/JKQTPlotter/styles/dark.ini</code></a>
|
||||
<td>\image html dark.ini.png
|
||||
<td>\image html dark.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/default.ini"><code>:/JKQTPlotter/styles/default.ini</code></a>
|
||||
<td>\image html default.ini.png
|
||||
<td>\image html default.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/legacy_default_style.ini"><code>:/JKQTPlotter/styles/legacy_default_style.ini</code></a>
|
||||
<td>\image html legacy_default_style.ini.png
|
||||
<td>\image html legacy_default_style.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/seaborn.ini"><code>:/JKQTPlotter/styles/seaborn.ini</code></a>
|
||||
<td>\image html seaborn.ini.png
|
||||
<td>\image html seaborn.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_arrowsaxes.ini"><code>:/JKQTPlotter/styles/simple_arrowsaxes.ini</code></a>
|
||||
<td>\image html simple_arrowsaxes.ini.png
|
||||
<td>\image html simple_arrowsaxes.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset.ini"><code>:/JKQTPlotter/styles/simple_axesoffset.ini</code></a>
|
||||
<td>\image html simple_axesoffset.ini.png
|
||||
<td>\image html simple_axesoffset.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset_plotbox.ini"><code>:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</code></a>
|
||||
<td>\image html simple_axesoffset_plotbox.ini.png
|
||||
<td>\image html simple_axesoffset_plotbox.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_gridandticks.ini"><code>:/JKQTPlotter/styles/simple_gridandticks.ini</code></a>
|
||||
<td>\image html simple_gridandticks.ini.png
|
||||
<td>\image html simple_gridandticks.ini.symbols.png
|
||||
</table>
|
||||
<!--/include:styles.dox-->
|
||||
|
||||
\see Classes are documented in \ref jkqtpplotter_styling_classes .
|
||||
<br>See \ref JKQTPlotterStyling for a detailed example.
|
||||
|
@ -1,46 +0,0 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>Style-file
|
||||
<th>Screenshot
|
||||
<th>Symbols
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blackandwhite.ini"><code>:/JKQTPlotter/styles/blackandwhite.ini</code></a>
|
||||
<td>\image html blackandwhite.ini.png
|
||||
<td>\image html blackandwhite.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blueprint.ini"><code>:/JKQTPlotter/styles/blueprint.ini</code></a>
|
||||
<td>\image html blueprint.ini.png
|
||||
<td>\image html blueprint.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/dark.ini"><code>:/JKQTPlotter/styles/dark.ini</code></a>
|
||||
<td>\image html dark.ini.png
|
||||
<td>\image html dark.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/default.ini"><code>:/JKQTPlotter/styles/default.ini</code></a>
|
||||
<td>\image html default.ini.png
|
||||
<td>\image html default.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/legacy_default_style.ini"><code>:/JKQTPlotter/styles/legacy_default_style.ini</code></a>
|
||||
<td>\image html legacy_default_style.ini.png
|
||||
<td>\image html legacy_default_style.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/seaborn.ini"><code>:/JKQTPlotter/styles/seaborn.ini</code></a>
|
||||
<td>\image html seaborn.ini.png
|
||||
<td>\image html seaborn.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_arrowsaxes.ini"><code>:/JKQTPlotter/styles/simple_arrowsaxes.ini</code></a>
|
||||
<td>\image html simple_arrowsaxes.ini.png
|
||||
<td>\image html simple_arrowsaxes.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset.ini"><code>:/JKQTPlotter/styles/simple_axesoffset.ini</code></a>
|
||||
<td>\image html simple_axesoffset.ini.png
|
||||
<td>\image html simple_axesoffset.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset_plotbox.ini"><code>:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</code></a>
|
||||
<td>\image html simple_axesoffset_plotbox.ini.png
|
||||
<td>\image html simple_axesoffset_plotbox.ini.symbols.png
|
||||
<tr>
|
||||
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_gridandticks.ini"><code>:/JKQTPlotter/styles/simple_gridandticks.ini</code></a>
|
||||
<td>\image html simple_gridandticks.ini.png
|
||||
<td>\image html simple_gridandticks.ini.symbols.png
|
||||
</table>
|
@ -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<<"<table>\n <tr>\n <th>Style-file\n <th>Screenshot\n <th>Symbols\n";
|
||||
for (auto& f: dir.entryList()) {
|
||||
qDebug()<<"plotting example for style "<<f;
|
||||
QString doc;
|
||||
{
|
||||
QTextStream shtml(&doc);
|
||||
shtml<<"<table>\n <tr>\n <th>Style-file\n <th>Screenshot\n <th>Symbols\n";
|
||||
for (auto& f: dir.entryList()) {
|
||||
qDebug()<<"plotting example for style "<<f;
|
||||
|
||||
JKQTBasePlotter plot(true);
|
||||
plot.setWidgetSize(iconsize,iconsize);
|
||||
plot.loadCurrentPlotterStyle(QSettings(dir.absoluteFilePath(f), QSettings::IniFormat));
|
||||
plotStyle(plot);
|
||||
plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath(f+".png"), "png");
|
||||
JKQTBasePlotter plot(true);
|
||||
plot.setWidgetSize(iconsize,iconsize);
|
||||
plot.loadCurrentPlotterStyle(QSettings(dir.absoluteFilePath(f), QSettings::IniFormat));
|
||||
plotStyle(plot);
|
||||
plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath(f+".png"), "png");
|
||||
|
||||
JKQTBasePlotter plotExtra(true);
|
||||
plotExtra.setWidgetSize(iconsize*2, iconsize/3);
|
||||
plotStyleSymbols(plotExtra, plot);
|
||||
plotExtra.grabPixelImage(QSize(plotExtra.getWidth(),plotExtra.getHeight()), false).copy(0,0,plotExtra.getWidth(),plotExtra.getHeight()).save(outputDir.absoluteFilePath(f+".symbols.png"), "png");
|
||||
JKQTBasePlotter plotExtra(true);
|
||||
plotExtra.setWidgetSize(iconsize*2, iconsize/3);
|
||||
plotStyleSymbols(plotExtra, plot);
|
||||
plotExtra.grabPixelImage(QSize(plotExtra.getWidth(),plotExtra.getHeight()), false).copy(0,0,plotExtra.getWidth(),plotExtra.getHeight()).save(outputDir.absoluteFilePath(f+".symbols.png"), "png");
|
||||
|
||||
shtml<<" <tr>\n"
|
||||
<<" <td><a href=\"https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/"<<f<<"\"><code>"<<dir.absoluteFilePath(f)<<"</code></a>\n"
|
||||
<<" <td>\\image html "<<f<<".png\n"
|
||||
<<" <td>\\image html "<<f<<".symbols.png\n";
|
||||
shtml<<" <tr>\n"
|
||||
<<" <td><a href=\"https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/"<<f<<"\"><code>"<<dir.absoluteFilePath(f)<<"</code></a>\n"
|
||||
<<" <td>\\image html "<<f<<".png\n"
|
||||
<<" <td>\\image html "<<f<<".symbols.png\n";
|
||||
}
|
||||
shtml<<"</table>";
|
||||
}
|
||||
const QString delim1="<!--include:styles.dox-->";
|
||||
const QString delim2="<!--/include:styles.dox-->";
|
||||
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<<"</table>";
|
||||
}
|
||||
|
||||
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 <include:NAME>...</include:NAME> 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user