diff options
-rw-r--r-- | tests/manual/scenegraph_lancelot/scenegrabber/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp index 23c678380c..55dc86b9fd 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp +++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp @@ -58,8 +58,10 @@ class GrabbingView : public QQuickView public: GrabbingView(const QString &outputFile) - : ofile(outputFile), grabNo(0), isGrabbing(false), initDone(false) + : ofile(outputFile), grabNo(0), isGrabbing(false), initDone(false), justShow(outputFile.isEmpty()) { + if (justShow) + return; grabTimer = new QTimer(this); grabTimer->setSingleShot(true); grabTimer->setInterval(SCENE_STABLE_TIME); @@ -136,11 +138,12 @@ private slots: private: QImage lastGrab; - QTimer *grabTimer; + QTimer *grabTimer = nullptr; QString ofile; int grabNo; bool isGrabbing; bool initDone; + bool justShow; }; @@ -153,6 +156,7 @@ int main(int argc, char *argv[]) // Parse command line QString ifile, ofile; bool noText = false; + bool justShow = false; QStringList args = a.arguments(); int i = 0; bool argError = false; @@ -167,6 +171,9 @@ int main(int argc, char *argv[]) else if (arg == "--cache-distance-fields") { ; } + else if (arg == "-viewonly") { + justShow = true; + } else if (ifile.isEmpty()) { ifile = arg; } @@ -175,8 +182,8 @@ int main(int argc, char *argv[]) break; } } - if (argError || ifile.isEmpty() || ofile.isEmpty()) { - qWarning() << "Usage:" << args.at(0).toLatin1().constData() << "[-notext] <qml-infile> -o <outfile or - for ppm on stdout>"; + if (argError || ifile.isEmpty() || (ofile.isEmpty() && !justShow)) { + qWarning() << "Usage:" << args.at(0).toLatin1().constData() << "[-notext] <qml-infile> {-o <outfile or - for ppm on stdout>|-viewonly}"; return 1; } |