21 #include <hbinstance.h> |
21 #include <hbinstance.h> |
22 #include "hbstubs_helper.h" |
22 #include "hbstubs_helper.h" |
23 #include <hbmessagebox.h> |
23 #include <hbmessagebox.h> |
24 #include <hbapplication.h> |
24 #include <hbapplication.h> |
25 #include <hbcolorscheme.h> |
25 #include <hbcolorscheme.h> |
|
26 #include <hbview.h> |
|
27 #include <hbactivitymanager.h> |
26 #include <QCoreApplication> |
28 #include <QCoreApplication> |
|
29 #include <QApplication> |
27 #include <QTimer> |
30 #include <QTimer> |
28 #include <QGesture> |
31 #include <QGesture> |
29 |
32 |
30 int actionCount = 0; |
33 int actionCount = 0; |
31 Qt::Orientation windowOrientation = Qt::Vertical; |
34 Qt::Orientation windowOrientation = Qt::Vertical; |
40 bool testQuitCalled = false; |
43 bool testQuitCalled = false; |
41 Qt::GestureState testState = Qt::NoGesture; |
44 Qt::GestureState testState = Qt::NoGesture; |
42 bool testIsWidgetOpen = false; |
45 bool testIsWidgetOpen = false; |
43 bool testIsWidgetRaised = false; |
46 bool testIsWidgetRaised = false; |
44 QColor testColor = Qt::white; |
47 QColor testColor = Qt::white; |
|
48 QList<HbView *> testViews; |
|
49 QList<QVariantHash> testActivities; |
|
50 HbActivityManager testActivityManager; |
|
51 Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal; |
|
52 QString testActivityId = "LogsViewMatches"; |
45 |
53 |
46 void HbStubHelper::reset() |
54 void HbStubHelper::reset() |
47 { |
55 { |
48 actionCount = 0; |
56 actionCount = 0; |
49 testMenuShown = false; |
57 testMenuShown = false; |
50 testSingleShotTimer = false; |
58 testSingleShotTimer = false; |
51 testQuitCalled = false; |
59 testQuitCalled = false; |
52 testIsWidgetRaised = false; |
60 testIsWidgetRaised = false; |
53 testDialogShown = false; |
61 testDialogShown = false; |
54 testColor = Qt::white; |
62 testColor = Qt::white; |
|
63 testActivationReason = Hb::ActivationReasonNormal; |
|
64 testActivityId = "LogsViewMatches"; |
|
65 testActivities.clear(); |
55 } |
66 } |
56 |
67 |
57 |
68 |
58 |
69 |
59 int HbStubHelper::widgetActionsCount() |
70 int HbStubHelper::widgetActionsCount() |
112 void HbStubHelper::setColorScheme(QColor col) |
123 void HbStubHelper::setColorScheme(QColor col) |
113 { |
124 { |
114 testColor = col; |
125 testColor = col; |
115 } |
126 } |
116 |
127 |
|
128 void HbStubHelper::setActivityReason(Hb::ActivationReason reason) |
|
129 { |
|
130 testActivationReason = reason; |
|
131 } |
|
132 |
|
133 void HbStubHelper::setActivityId(QString activityId) |
|
134 { |
|
135 testActivityId = activityId; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 QCoreApplication::QCoreApplication(int &argc, char **argv) |
|
143 { |
|
144 |
|
145 } |
|
146 |
|
147 |
|
148 void QCoreApplication::quit() |
|
149 { |
|
150 testQuitCalled = true; |
|
151 } |
|
152 |
|
153 QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int version) |
|
154 : QCoreApplication(argc, argv) |
|
155 { |
|
156 |
|
157 } |
|
158 |
|
159 QApplication::~QApplication() |
|
160 { |
|
161 |
|
162 } |
117 |
163 |
118 bool QGraphicsWidget::close() |
164 bool QGraphicsWidget::close() |
119 { |
165 { |
120 testIsWidgetOpen = false; |
166 testIsWidgetOpen = false; |
121 } |
167 } |
128 void QWidget::raise() |
174 void QWidget::raise() |
129 { |
175 { |
130 testIsWidgetRaised = true; |
176 testIsWidgetRaised = true; |
131 } |
177 } |
132 |
178 |
133 // ----------------------------------------------------------------------------- |
179 QPixmap QPixmap::grabWidget(QWidget *widget, const QRect &rect) |
134 // |
180 { |
135 // ----------------------------------------------------------------------------- |
181 Q_UNUSED(widget); |
136 // |
182 Q_UNUSED(rect); |
137 HbApplication::HbApplication(int &/*argc*/, char */*argv*/[]) |
183 return QPixmap(); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 HbActivityManager::HbActivityManager(QObject *parent) : QObject(parent) |
|
191 { |
|
192 |
|
193 } |
|
194 HbActivityManager::~HbActivityManager() |
|
195 { |
|
196 |
|
197 } |
|
198 |
|
199 bool HbActivityManager::addActivity(const QString &activityId, const QVariant &data, const QVariantHash ¶meters) |
|
200 { |
|
201 testActivities.append(parameters); |
|
202 } |
|
203 bool HbActivityManager::removeActivity(const QString &activityId) |
|
204 { |
|
205 if ( !testActivities.isEmpty() ){ |
|
206 testActivities.takeFirst(); |
|
207 } |
|
208 } |
|
209 QList<QVariantHash> HbActivityManager::activities() const |
|
210 { |
|
211 return testActivities; |
|
212 } |
|
213 |
|
214 bool HbActivityManager::waitActivity() |
|
215 { |
|
216 return true; |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 HbApplication::HbApplication(int &argc, char *argv[]) : |
|
224 QApplication(0, argc, argv, 0) |
138 { |
225 { |
139 } |
226 } |
140 |
227 |
141 HbApplication::~HbApplication() |
228 HbApplication::~HbApplication() |
142 { |
229 { |
145 void HbApplication::quit() |
232 void HbApplication::quit() |
146 { |
233 { |
147 testQuitCalled = true; |
234 testQuitCalled = true; |
148 } |
235 } |
149 |
236 |
150 void QCoreApplication::quit() |
237 HbActivityManager *HbApplication::activityManager() |
151 { |
238 { |
152 testQuitCalled = true; |
239 return &testActivityManager; |
|
240 } |
|
241 |
|
242 Hb::ActivationReason HbApplication::activateReason() const |
|
243 { |
|
244 return testActivationReason; |
|
245 } |
|
246 QVariantHash HbApplication::activateParams() const |
|
247 { |
|
248 return QVariantHash(); |
|
249 } |
|
250 QString HbApplication::activateId() const |
|
251 { |
|
252 return testActivityId; |
|
253 } |
|
254 QVariant HbApplication::activateData() |
|
255 { |
|
256 return QVariant(); |
153 } |
257 } |
154 |
258 |
155 // ----------------------------------------------------------------------------- |
259 // ----------------------------------------------------------------------------- |
156 // |
260 // |
157 // ----------------------------------------------------------------------------- |
261 // ----------------------------------------------------------------------------- |
209 return windowOrientation; |
314 return windowOrientation; |
210 } |
315 } |
211 |
316 |
212 QRectF HbMainWindow::layoutRect() const |
317 QRectF HbMainWindow::layoutRect() const |
213 { |
318 { |
214 return QRectF(0, 0, 100,100); |
319 if (windowOrientation == Qt::Vertical) { |
|
320 return QRectF(0, 0, 360, 640); |
|
321 } else { |
|
322 return QRectF(0, 0, 640, 360); |
|
323 } |
215 } |
324 } |
216 |
325 |
217 HbView *HbMainWindow::addView(QGraphicsWidget *widget) |
326 HbView *HbMainWindow::addView(QGraphicsWidget *widget) |
218 { |
327 { |
219 Q_UNUSED(widget) |
|
220 testViewCount++; |
328 testViewCount++; |
|
329 testViews.append( static_cast<HbView*>(widget) ); |
221 } |
330 } |
222 |
331 |
223 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags) |
332 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags) |
224 { |
333 { |
225 Q_UNUSED(animate) |
334 Q_UNUSED(animate) |
226 Q_UNUSED(flags) |
335 Q_UNUSED(flags) |
227 testView = view; |
336 testView = view; |
228 } |
337 } |
229 |
338 |
230 int HbMainWindow::viewCount() const |
339 QList<HbView *> HbMainWindow::views() const |
231 { |
340 { |
232 return testViewCount; |
341 return testViews; |
233 } |
342 } |
|
343 |
234 HbView *HbMainWindow::currentView() const |
344 HbView *HbMainWindow::currentView() const |
235 { |
345 { |
236 return testView; |
346 return testView; |
237 } |
347 } |
238 |
348 |
270 } else if (string == "Cancel") { |
380 } else if (string == "Cancel") { |
271 selectedActionString = "secondary"; |
381 selectedActionString = "secondary"; |
272 } |
382 } |
273 } |
383 } |
274 |
384 |
275 |
|
276 HbAction *HbDialog::exec() |
|
277 { |
|
278 if (selectedActionString == "primary") { |
|
279 return primaryAction(); |
|
280 } else { |
|
281 return 0; |
|
282 } |
|
283 } |
|
284 |
|
285 void QTimer::singleShot(int msec, QObject *receiver, const char *member) |
385 void QTimer::singleShot(int msec, QObject *receiver, const char *member) |
286 { |
386 { |
287 testSingleShotTimer = true; |
387 testSingleShotTimer = true; |
288 } |
388 } |
289 |
389 |