aboutsummaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorArmin Berres <armin.berres@basyskom.de>2010-12-06 16:51:23 +0100
committerStanislav Ionascu <stanislav.ionascu@nokia.com>2010-12-07 10:57:44 +0200
commite35209c6a31e8c7de01143466ceb458b4cb002cf (patch)
tree0d3e7f4b946d2ad4194a119873a4ec0b3afe5524 /demos
parent7fbc010f992fbe15bcea2c1b8a0006b090f9644e (diff)
Changes: Add benchmark to measure FPS during rotation.
RevBy: Stanislav Ionascu Details: The timedemo also measures the fps when animation from landscape to portrait and portrait to landscape. Merged with minor code layout fixes.
Diffstat (limited to 'demos')
-rw-r--r--demos/widgetsgallery/panningbenchmark.cpp19
-rw-r--r--demos/widgetsgallery/panningbenchmark.h19
-rw-r--r--demos/widgetsgallery/rotationbenchmark.cpp68
-rw-r--r--demos/widgetsgallery/rotationbenchmark.h49
-rw-r--r--demos/widgetsgallery/staticpagebenchmark.cpp19
-rw-r--r--demos/widgetsgallery/staticpagebenchmark.h19
-rw-r--r--demos/widgetsgallery/timedemopage.cpp7
-rw-r--r--demos/widgetsgallery/widgetsgallery.pro2
8 files changed, 202 insertions, 0 deletions
diff --git a/demos/widgetsgallery/panningbenchmark.cpp b/demos/widgetsgallery/panningbenchmark.cpp
index db297694..d3985614 100644
--- a/demos/widgetsgallery/panningbenchmark.cpp
+++ b/demos/widgetsgallery/panningbenchmark.cpp
@@ -1,3 +1,22 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
#include "panningbenchmark.h"
#include "timedemo.h"
diff --git a/demos/widgetsgallery/panningbenchmark.h b/demos/widgetsgallery/panningbenchmark.h
index 5e04a693..2acb9934 100644
--- a/demos/widgetsgallery/panningbenchmark.h
+++ b/demos/widgetsgallery/panningbenchmark.h
@@ -1,3 +1,22 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
#ifndef PANNINGBENCHMARK_H
#define PANNINGBENCHMARK_H
diff --git a/demos/widgetsgallery/rotationbenchmark.cpp b/demos/widgetsgallery/rotationbenchmark.cpp
new file mode 100644
index 00000000..dcb6fafd
--- /dev/null
+++ b/demos/widgetsgallery/rotationbenchmark.cpp
@@ -0,0 +1,68 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "rotationbenchmark.h"
+#include "timedemo.h"
+
+#include <MApplication>
+#include <MApplicationPage>
+
+#include <QTimer>
+
+RotationBenchmark::RotationBenchmark(MApplicationPage *applicationPage, Timedemo *timedemo, M::OrientationAngle targetOrientationAngle)
+ : TimedemoBenchmark(applicationPage, timedemo)
+ , targetOrientationAngle(targetOrientationAngle)
+{
+}
+
+QString RotationBenchmark::name()
+{
+ return QString("RotationBenchmark (%1)").arg(QString::number(targetOrientationAngle));
+}
+
+void RotationBenchmark::start()
+{
+ if (!applicationPage->isOnDisplay()) {
+ connect(applicationPage, SIGNAL(appeared()), this, SLOT(stabilizeFps()));
+ applicationPage->appear(MApplication::activeWindow());
+ verifyAppearanceTimer->start(5000);
+ } else {
+ QTimer::singleShot(0, this, SLOT(stabilizeFps()));
+ }
+}
+
+void RotationBenchmark::stabilizeFps() {
+ verifyAppearanceTimer->stop();
+ QTimer::singleShot(1000, this, SLOT(rotate()));
+}
+
+void RotationBenchmark::rotate()
+{
+ timedemo->startTiming(this);
+ MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle);
+ MApplication::activeWindow()->setOrientationAngleLocked(true);
+ connect(MApplication::activeWindow(), SIGNAL(orientationChangeFinished(M::Orientation)), this, SLOT(terminateBenchmark()));
+}
+
+void RotationBenchmark::terminateBenchmark()
+{
+ timedemo->stopTiming(this);
+ disconnect(MApplication::activeWindow(), SIGNAL(orientationChangeFinished(M::Orientation)), this, SLOT(terminateBenchmark()));
+ emit finished();
+}
diff --git a/demos/widgetsgallery/rotationbenchmark.h b/demos/widgetsgallery/rotationbenchmark.h
new file mode 100644
index 00000000..00ad02b6
--- /dev/null
+++ b/demos/widgetsgallery/rotationbenchmark.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef ROTATIONBENCHMARK_H
+#define ROTATIONBENCHMARK_H
+
+#include "timedemobenchmark.h"
+
+#include <MNamespace>
+
+/**
+ * Rotate from the current angle to the given one and measures
+ * the FPS while doing the rotation.
+ */
+class RotationBenchmark : public TimedemoBenchmark
+{
+ Q_OBJECT
+public:
+ RotationBenchmark(MApplicationPage *applicationPage, Timedemo *timedemo, M::OrientationAngle targetOrientationAngle);
+
+ QString name();
+ void start();
+
+private slots:
+ void stabilizeFps();
+ void rotate();
+ void terminateBenchmark();
+
+private:
+ M::OrientationAngle targetOrientationAngle;
+};
+
+#endif // ROTATIONBENCHMARK_H
diff --git a/demos/widgetsgallery/staticpagebenchmark.cpp b/demos/widgetsgallery/staticpagebenchmark.cpp
index 9bd81988..399af427 100644
--- a/demos/widgetsgallery/staticpagebenchmark.cpp
+++ b/demos/widgetsgallery/staticpagebenchmark.cpp
@@ -1,3 +1,22 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
#include "staticpagebenchmark.h"
#include "timedemo.h"
diff --git a/demos/widgetsgallery/staticpagebenchmark.h b/demos/widgetsgallery/staticpagebenchmark.h
index 21393816..82a1aa3b 100644
--- a/demos/widgetsgallery/staticpagebenchmark.h
+++ b/demos/widgetsgallery/staticpagebenchmark.h
@@ -1,3 +1,22 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
#ifndef STATICPAGEBENCHMARK_H
#define STATICPAGEBENCHMARK_H
diff --git a/demos/widgetsgallery/timedemopage.cpp b/demos/widgetsgallery/timedemopage.cpp
index 6fda3288..6f224f58 100644
--- a/demos/widgetsgallery/timedemopage.cpp
+++ b/demos/widgetsgallery/timedemopage.cpp
@@ -3,6 +3,7 @@
#include "staticpagebenchmark.h"
#include "panningbenchmark.h"
+#include "rotationbenchmark.h"
TimedemoPage::TimedemoPage(QGraphicsItem *parent)
: MApplicationPage(parent),
@@ -20,11 +21,17 @@ void TimedemoPage::createBenchmarks(Timedemo *timedemo)
benchmark = QSharedPointer<TimedemoBenchmark>(new PanningBenchmark(this, timedemo));
m_benchmarks.append(benchmark);
+ benchmark = QSharedPointer<TimedemoBenchmark>(new RotationBenchmark(this, timedemo, M::Angle90));
+ m_benchmarks.append(benchmark);
+
benchmark = QSharedPointer<TimedemoBenchmark>(new StaticPageBenchmark(this, timedemo, M::Angle90));
m_benchmarks.append(benchmark);
benchmark = QSharedPointer<TimedemoBenchmark>(new PanningBenchmark(this, timedemo, M::Angle90));
m_benchmarks.append(benchmark);
+
+ benchmark = QSharedPointer<TimedemoBenchmark>(new RotationBenchmark(this, timedemo, M::Angle0));
+ m_benchmarks.append(benchmark);
}
QVector<QSharedPointer<TimedemoBenchmark> > TimedemoPage::benchmarks()
diff --git a/demos/widgetsgallery/widgetsgallery.pro b/demos/widgetsgallery/widgetsgallery.pro
index a8b7c71e..dea0fac3 100644
--- a/demos/widgetsgallery/widgetsgallery.pro
+++ b/demos/widgetsgallery/widgetsgallery.pro
@@ -77,6 +77,7 @@ SOURCES += main.cpp \
drilldownlistitem.cpp \
customnavigationbarpage.cpp \
mynavbarcontent.cpp \
+ rotationbenchmark.cpp \
HEADERS += templatepage.h \
mainpage.h \
@@ -126,6 +127,7 @@ HEADERS += templatepage.h \
drilldownlistitem.h \
customnavigationbarpage.h \
mynavbarcontent.h \
+ rotationbenchmark.h \
# theme
include(theme/theme.pri)