|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
5 ** |
|
6 ** This file is part of the examples of the Qt Toolkit. |
|
7 ** |
|
8 ** $QT_BEGIN_LICENSE:LGPL$ |
|
9 ** No Commercial Usage |
|
10 ** This file contains pre-release code and may not be distributed. |
|
11 ** You may use this file in accordance with the terms and conditions |
|
12 ** contained in the either Technology Preview License Agreement or the |
|
13 ** Beta Release License Agreement. |
|
14 ** |
|
15 ** GNU Lesser General Public License Usage |
|
16 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
17 ** General Public License version 2.1 as published by the Free Software |
|
18 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
19 ** packaging of this file. Please review the following information to |
|
20 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
21 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
22 ** |
|
23 ** In addition, as a special exception, Nokia gives you certain |
|
24 ** additional rights. These rights are described in the Nokia Qt LGPL |
|
25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this |
|
26 ** package. |
|
27 ** |
|
28 ** GNU General Public License Usage |
|
29 ** Alternatively, this file may be used under the terms of the GNU |
|
30 ** General Public License version 3.0 as published by the Free Software |
|
31 ** Foundation and appearing in the file LICENSE.GPL included in the |
|
32 ** packaging of this file. Please review the following information to |
|
33 ** ensure the GNU General Public License version 3.0 requirements will be |
|
34 ** met: http://www.gnu.org/copyleft/gpl.html. |
|
35 ** |
|
36 ** If you are unsure which license is appropriate for your use, please |
|
37 ** contact the sales department at http://qt.nokia.com/contact. |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "benchmark.h" |
|
43 |
|
44 Benchmark::Benchmark() |
|
45 : QObject(), |
|
46 m_tag(""), |
|
47 m_value(0), |
|
48 m_listType(ListTypeNone), |
|
49 m_listSize(0), |
|
50 m_theme(""), |
|
51 m_imageBasedRendering(false), |
|
52 m_useListItemCache(false), |
|
53 m_width(0), |
|
54 m_height(0), |
|
55 m_angle(0) |
|
56 { |
|
57 } |
|
58 |
|
59 Benchmark::~Benchmark() |
|
60 { |
|
61 } |
|
62 |
|
63 void Benchmark::setTag(const QString &tag) |
|
64 { |
|
65 m_tag = tag; |
|
66 } |
|
67 QString Benchmark::tag() const |
|
68 { |
|
69 return m_tag; |
|
70 } |
|
71 void Benchmark::setValue(const qreal value) |
|
72 { |
|
73 m_value = value; |
|
74 } |
|
75 qreal Benchmark::value() const |
|
76 { |
|
77 return m_value; |
|
78 } |
|
79 |
|
80 int Benchmark::listSize() const |
|
81 { |
|
82 return m_listSize; |
|
83 } |
|
84 |
|
85 void Benchmark::setListSize(const int size) |
|
86 { |
|
87 m_listSize = size; |
|
88 } |
|
89 |
|
90 QString Benchmark::theme() const |
|
91 { |
|
92 return m_theme; |
|
93 } |
|
94 |
|
95 void Benchmark::setTheme(const QString &theme) |
|
96 { |
|
97 m_theme = theme; |
|
98 } |
|
99 |
|
100 bool Benchmark::imageBasedRendering() const |
|
101 { |
|
102 return m_imageBasedRendering; |
|
103 } |
|
104 |
|
105 void Benchmark::setImageBasedRendering(bool imageBasedRendering) |
|
106 { |
|
107 m_imageBasedRendering = imageBasedRendering; |
|
108 } |
|
109 |
|
110 bool Benchmark::useListItemCache() const |
|
111 { |
|
112 return m_useListItemCache; |
|
113 } |
|
114 |
|
115 void Benchmark::setUseListItemCache(bool useListItemCache) |
|
116 { |
|
117 m_useListItemCache = useListItemCache; |
|
118 } |
|
119 |
|
120 QString Benchmark::listTypeStr() |
|
121 { |
|
122 if (m_listType==RecyclingListType) |
|
123 return QString("ItemRecyclingList"); |
|
124 else if(m_listType==SimpleListType) |
|
125 return QString("SimpleList"); |
|
126 return QString("Unkown"); |
|
127 } |
|
128 |
|
129 int Benchmark::listType() const |
|
130 { |
|
131 return int(m_listType); |
|
132 } |
|
133 |
|
134 void Benchmark::setListType(const int type) |
|
135 { |
|
136 m_listType = ListType(type); |
|
137 } |
|
138 |
|
139 void Benchmark::setRotation(const int angle) |
|
140 { |
|
141 m_angle = angle; |
|
142 } |
|
143 |
|
144 int Benchmark::rotation() const |
|
145 { |
|
146 return m_angle; |
|
147 } |
|
148 |
|
149 void Benchmark::setListType(const ListType type) |
|
150 { |
|
151 m_listType = type; |
|
152 } |
|
153 |
|
154 QString Benchmark::benchmarkStr() |
|
155 { |
|
156 QString s = m_tag + QString(" [Type=%1, List size=%2, Theme=%3, ListItemCache=%4, Width=%5, Height=%6, Angle=%7").arg(listTypeStr()).arg(m_listSize).arg(m_theme).arg(m_useListItemCache).arg(m_width).arg(m_height).arg(m_angle); |
|
157 if (imageBasedRendering()) |
|
158 s = s + QString(", Render to non displayed pixmap"); |
|
159 else |
|
160 s = s + QString(", Render to screen"); |
|
161 s = s + "]"; |
|
162 return s; |
|
163 } |
|
164 |
|
165 int Benchmark::width() const |
|
166 { |
|
167 return m_width; |
|
168 } |
|
169 |
|
170 void Benchmark::setWidth(const int size) |
|
171 { |
|
172 m_width = size; |
|
173 } |
|
174 |
|
175 int Benchmark::height() const |
|
176 { |
|
177 return m_height; |
|
178 } |
|
179 |
|
180 void Benchmark::setHeight(const int size) |
|
181 { |
|
182 m_height = size; |
|
183 } |
|
184 |