Add slow animations mode to qmlscene
authorAaron Kennedy <aaron.kennedy@nokia.com>
Tue, 7 Feb 2012 12:29:45 +0000 (12:29 +0000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 14 Feb 2012 17:20:59 +0000 (18:20 +0100)
Change-Id: I0f850258e2cf5363bca2fa1c8b098aa5982eb232
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
tools/qmlscene/main.cpp
tools/qmlscene/qmlscene.pro

index 115dace..d586131 100644 (file)
@@ -55,6 +55,8 @@
 #include <QtQuick/qquickitem.h>
 #include <QtQuick/qquickview.h>
 
+#include <private/qabstractanimation_p.h>
+
 #ifdef QT_WIDGETS_LIB
 #include <QtWidgets/QApplication>
 #include <QtWidgets/QFileDialog>
@@ -153,6 +155,7 @@ struct Options
         , fullscreen(false)
         , clip(false)
         , versionDetection(true)
+        , slowAnimations(false)
     {
     }
 
@@ -164,6 +167,7 @@ struct Options
     bool scenegraphOnGraphicsview;
     bool clip;
     bool versionDetection;
+    bool slowAnimations;
 };
 
 #if defined(QMLSCENE_BUNDLE)
@@ -342,6 +346,7 @@ static void usage()
     qWarning("  --fullscreen .............................. run fullscreen");
     qWarning("  --no-multisample .......................... Disable multisampling (anti-aliasing)");
     qWarning("  --no-version-detection .................... Do not try to detect the version of the .qml file");
+    qWarning("  --slow-animations ......................... Run all animations in slow motion");
 
     qWarning(" ");
     exit(1);
@@ -365,6 +370,8 @@ int main(int argc, char ** argv)
                 options.clip = true;
             else if (lowerArgument == QLatin1String("--no-version-detection"))
                 options.versionDetection = false;
+            else if (lowerArgument == QLatin1String("--slow-animations"))
+                options.slowAnimations = true;
             else if (lowerArgument == QLatin1String("-i") && i + 1 < argc)
                 imports.append(QString::fromLatin1(argv[++i]));
             else if (lowerArgument == QLatin1String("--help")
@@ -384,6 +391,8 @@ int main(int argc, char ** argv)
     app.setOrganizationName("Nokia");
     app.setOrganizationDomain("nokia.com");
 
+    QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations);
+
     if (options.file.isEmpty())
 #if defined(QMLSCENE_BUNDLE)
         displayOptionsDialog(&options);
index dfc91ce..5e4d792 100644 (file)
@@ -2,7 +2,7 @@ TEMPLATE = app
 TARGET = qmlscene
 DESTDIR= $$QT.declarative.bins
 
-QT += declarative quick
+QT += declarative quick core-private
 !isEmpty(QT.widgets.name): QT += widgets
 
 target.path = $$[QT_INSTALL_BINS]