diff options
author | Armin Berres <armin.berres@basyskom.de> | 2010-04-28 11:34:29 +0200 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@nokia.com> | 2010-05-04 16:57:41 +0300 |
commit | f0ee376bc601f555bd72bcb7445d0058b9cbbe62 (patch) | |
tree | 0aabb99d59c72e4648fd6d0683bc16512878a90b | |
parent | bd8f75f9f5ba325180fee192d5db08e234bac85b (diff) |
Changes: just change orientation angle when really needed in the timedemo
RevBy: Kuisma Salonen
Details:
So far every benchmark was saving the former orientation angle, rotated the
scene to the angle the benchmark needed and rotated the scene back
to the former angle. If two following benchmarks need the same angle
it does not make sense to always rotate back. Additionally the rotations
somehow messed things up.
-rw-r--r-- | demos/widgetsgallery/panningbenchmark.cpp | 23 | ||||
-rw-r--r-- | demos/widgetsgallery/panningbenchmark.h | 5 | ||||
-rw-r--r-- | demos/widgetsgallery/staticpagebenchmark.cpp | 11 | ||||
-rw-r--r-- | demos/widgetsgallery/staticpagebenchmark.h | 1 | ||||
-rw-r--r-- | demos/widgetsgallery/timedemo.h | 5 |
5 files changed, 7 insertions, 38 deletions
diff --git a/demos/widgetsgallery/panningbenchmark.cpp b/demos/widgetsgallery/panningbenchmark.cpp index cf3594f4..498166be 100644 --- a/demos/widgetsgallery/panningbenchmark.cpp +++ b/demos/widgetsgallery/panningbenchmark.cpp @@ -42,6 +42,8 @@ QString PanningBenchmark::name() { void PanningBenchmark::start() { + MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle); + MApplication::activeWindow()->setOrientationAngleLocked(true); if (!applicationPage->isActiveWindow()) { connect(applicationPage, SIGNAL(appeared()), this, SLOT(waitBeforePanning())); applicationPage->appear(); @@ -54,7 +56,6 @@ void PanningBenchmark::start() // the widgets are not completely set up yet void PanningBenchmark::waitBeforePanning() { - setAngle(); QTimer::singleShot(2500, this, SLOT(panDown())); } @@ -83,25 +84,5 @@ void PanningBenchmark::terminateBenchmark() { timedemo->stopTiming(); pannableViewport->physics()->setPosition(formerPosition); - resetAngle(); - - qDebug() << "end" << pannableViewport->widget()->pos() << pannableViewport->physics()->range(); - emit finished(); } - -void PanningBenchmark::setAngle() -{ - formerOrientationAngle = MApplication::activeWindow()->orientationAngle(); - MApplication::activeWindow()->setOrientationAngleLocked(false); - MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle); - MApplication::activeWindow()->setOrientationAngleLocked(true); -} - -void PanningBenchmark::resetAngle() -{ - MApplication::activeWindow()->setOrientationAngleLocked(false); - MApplication::activeWindow()->setOrientationAngle(formerOrientationAngle); - MApplication::activeWindow()->setOrientationAngleLocked(true); -} - diff --git a/demos/widgetsgallery/panningbenchmark.h b/demos/widgetsgallery/panningbenchmark.h index f94517f5..5e04a693 100644 --- a/demos/widgetsgallery/panningbenchmark.h +++ b/demos/widgetsgallery/panningbenchmark.h @@ -26,9 +26,6 @@ private slots: void panDown(); void terminateBenchmark(); - void setAngle(); - void resetAngle(); - private: MPannableViewport *pannableViewport; @@ -40,8 +37,6 @@ private: private: M::OrientationAngle targetOrientationAngle; - M::OrientationAngle formerOrientationAngle; - }; #endif // PANNINGBENCHMARK_H diff --git a/demos/widgetsgallery/staticpagebenchmark.cpp b/demos/widgetsgallery/staticpagebenchmark.cpp index b115402b..ba312f6e 100644 --- a/demos/widgetsgallery/staticpagebenchmark.cpp +++ b/demos/widgetsgallery/staticpagebenchmark.cpp @@ -24,6 +24,8 @@ QString StaticPageBenchmark::name() void StaticPageBenchmark::start() { + MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle); + MApplication::activeWindow()->setOrientationAngleLocked(true); if (!applicationPage->isActiveWindow()) { connect(applicationPage, SIGNAL(appeared()), this, SLOT(stabilizeFps())); applicationPage->appear(); @@ -38,11 +40,6 @@ void StaticPageBenchmark::stabilizeFps() { void StaticPageBenchmark::waitPageDuration() { - formerOrientationAngle = MApplication::activeWindow()->orientationAngle(); - MApplication::activeWindow()->setOrientationAngleLocked(false); - MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle); - MApplication::activeWindow()->setOrientationAngleLocked(true); - timedemo->startTiming(); QTimer::singleShot(pageDuration, this, SLOT(terminateBenchmark())); } @@ -50,9 +47,5 @@ void StaticPageBenchmark::waitPageDuration() void StaticPageBenchmark::terminateBenchmark() { timedemo->stopTiming(); - - MApplication::activeWindow()->setOrientationAngleLocked(false); - MApplication::activeWindow()->setOrientationAngle(formerOrientationAngle); - MApplication::activeWindow()->setOrientationAngleLocked(true); emit finished(); } diff --git a/demos/widgetsgallery/staticpagebenchmark.h b/demos/widgetsgallery/staticpagebenchmark.h index 9e734b22..21393816 100644 --- a/demos/widgetsgallery/staticpagebenchmark.h +++ b/demos/widgetsgallery/staticpagebenchmark.h @@ -25,7 +25,6 @@ private slots: private: M::OrientationAngle targetOrientationAngle; - M::OrientationAngle formerOrientationAngle; }; #endif // STATICPAGEBENCHMARK_H diff --git a/demos/widgetsgallery/timedemo.h b/demos/widgetsgallery/timedemo.h index cd0a8bd6..4c81cfcb 100644 --- a/demos/widgetsgallery/timedemo.h +++ b/demos/widgetsgallery/timedemo.h @@ -41,8 +41,9 @@ struct BenchmarkResult { }; /** - * Timedemo shows all the pages stored by the ListPage and shows them one after another. - * FPS are measured and printed in the end. + * Every TimedemoBenchmark must call this method once the benchmarking phase starts. + * Make sure to set the orientation angle of the application to the one you need. No + * guarantee is made about the current angle when startTiming() is called. */ class Timedemo : public QObject { |