svgtoqml tool: Improve options order, remove tech preview note

- Remove tech preview note in help
- Add single-letter shorthands for some more common options
- Rearrange order options for increased clarity in help

Pick-to: 6.8
Change-Id: Ibada4e59357f0c15772375336a8445fb664f7ee3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Eirik Aavitsland 2024-08-27 12:31:57 +02:00
parent 4d1fe0d69c
commit ce11e7fae8
2 changed files with 18 additions and 18 deletions

View File

@ -35,11 +35,11 @@ In addition, it supports the following options:
\li --copyright-statement <string> \li --copyright-statement <string>
\li Adds <string> as a comment at the beginning of the generated file. \li Adds <string> as a comment at the beginning of the generated file.
\row \row
\li --curve-renderer \li -c, --curve-renderer
\li Enables the curve renderer backend for \l{Qt Quick Shapes}. This enables smooth, antialiased \li Enables the curve renderer backend for \l{Qt Quick Shapes}. This enables smooth, antialiased
shapes in the scene without multi-sampling, but at some extra cost. shapes in the scene without multi-sampling, but at some extra cost.
\row \row
\li --optimize-paths \li -p, --optimize-paths
\li Enables optimization of paths before committing them to the QML file, potentially making \li Enables optimization of paths before committing them to the QML file, potentially making
them faster to load and render later. them faster to load and render later.
\row \row

View File

@ -22,20 +22,20 @@ int main(int argc, char *argv[])
#endif #endif
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription("SVG to QML converter [tech preview]"); parser.setApplicationDescription("SVG to QML converter");
parser.addHelpOption(); parser.addHelpOption();
parser.addPositionalArgument("input", QCoreApplication::translate("main", "SVG file to read.")); parser.addPositionalArgument("input", QCoreApplication::translate("main", "SVG file to read."));
parser.addPositionalArgument("output", QCoreApplication::translate("main", "QML file to write."), "[output]"); parser.addPositionalArgument("output", QCoreApplication::translate("main", "QML file to write."), "[output]");
QCommandLineOption optimizeOption("optimize-paths", QCommandLineOption curveRendererOption({ "c", "curve-renderer" },
QCoreApplication::translate("main", "Optimize paths for the curve renderer."));
parser.addOption(optimizeOption);
QCommandLineOption curveRendererOption("curve-renderer",
QCoreApplication::translate("main", "Use the curve renderer in generated QML.")); QCoreApplication::translate("main", "Use the curve renderer in generated QML."));
parser.addOption(curveRendererOption); parser.addOption(curveRendererOption);
QCommandLineOption typeNameOption(QStringList() << "t" << "type-name", QCommandLineOption optimizeOption({ "p", "optimize-paths" },
QCoreApplication::translate("main", "Optimize paths for the curve renderer."));
parser.addOption(optimizeOption);
QCommandLineOption typeNameOption({ "t", "type-name" },
QCoreApplication::translate("main", "Use <typename> for Shape."), QCoreApplication::translate("main", "Use <typename> for Shape."),
QCoreApplication::translate("main", "typename")); QCoreApplication::translate("main", "typename"));
parser.addOption(typeNameOption); parser.addOption(typeNameOption);
@ -50,14 +50,6 @@ int main(int argc, char *argv[])
"the original path. Also sets optimize-paths.")); "the original path. Also sets optimize-paths."));
parser.addOption(outlineModeOption); parser.addOption(outlineModeOption);
QCommandLineOption keepPathsOption("keep-external-paths",
QCoreApplication::translate("main", "Any paths to external files will be retained in the QML output. "
"The paths will be reformatted as relative to the output file. If "
"this is not enabled, copies of the file will be saved to the asset output "
"directory. Embedded data will still be saved to files, even if "
"this option is set."));
parser.addOption(keepPathsOption);
QCommandLineOption assetOutputDirectoryOption("asset-output-directory", QCommandLineOption assetOutputDirectoryOption("asset-output-directory",
QCoreApplication::translate("main", "If the SVG refers to external or embedded files, such as images, these " QCoreApplication::translate("main", "If the SVG refers to external or embedded files, such as images, these "
"will be copied into the same directory as the output QML file by default. " "will be copied into the same directory as the output QML file by default. "
@ -72,8 +64,16 @@ int main(int argc, char *argv[])
QCoreApplication::translate("main", "prefix")); QCoreApplication::translate("main", "prefix"));
parser.addOption(assetOutputPrefixOption); parser.addOption(assetOutputPrefixOption);
QCommandLineOption keepPathsOption("keep-external-paths",
QCoreApplication::translate("main", "Any paths to external files will be retained in the QML output. "
"The paths will be reformatted as relative to the output file. If "
"this is not enabled, copies of the file will be saved to the asset output "
"directory. Embedded data will still be saved to files, even if "
"this option is set."));
parser.addOption(keepPathsOption);
#ifdef ENABLE_GUI #ifdef ENABLE_GUI
QCommandLineOption guiOption(QStringList() << "v" << "view", QCommandLineOption guiOption({ "v", "view" },
QCoreApplication::translate("main", "Display the generated QML in a window. This is the default behavior if no " QCoreApplication::translate("main", "Display the generated QML in a window. This is the default behavior if no "
"output file is specified.")); "output file is specified."));
parser.addOption(guiOption); parser.addOption(guiOption);