1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Main Screensaver application class, loads runtime. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "snsrscreensaver.h" |
|
19 |
|
20 #include <hsruntimefactory.h> |
|
21 #include <hsruntime.h> |
|
22 |
|
23 #include "snsrtest_global.h" |
|
24 |
|
25 /*! |
|
26 \class SnsrScreensaver |
|
27 \ingroup group_snsrapplication |
|
28 \brief Main Screensaver application class. |
|
29 |
|
30 Loads and manages the runtime. |
|
31 */ |
|
32 |
|
33 /*! |
|
34 Constructs a new SnsrScreensaver with parent. |
|
35 */ |
|
36 SnsrScreensaver::SnsrScreensaver(QObject *parent): |
|
37 QObject(parent) |
|
38 { |
|
39 SCREENSAVER_TEST_FUNC_ENTRY("SnsrScreensaver::SnsrScreensaver") |
|
40 |
|
41 HsRuntimeFactory factory( |
|
42 "snsrresources/plugins/runtimeproviders", |
|
43 "snsrresources/plugins/runtimeproviders"); |
|
44 |
|
45 HsRuntimeToken token; |
|
46 token.mLibrary = "snsrdefaultruntimeprovider.dll"; |
|
47 token.mUri = "screensaver.nokia.com/runtime/defaultruntime"; |
|
48 |
|
49 mRuntime = factory.createRuntime(token); |
|
50 if (mRuntime) { |
|
51 mRuntime->setParent(this); |
|
52 |
|
53 connect(mRuntime, SIGNAL(started()), SLOT(onRuntimeStarted())); |
|
54 connect(mRuntime, SIGNAL(stopped()), SLOT(onRuntimeStopped())); |
|
55 connect(mRuntime, SIGNAL(faulted()), SLOT(onRuntimeFaulted())); |
|
56 } |
|
57 |
|
58 SCREENSAVER_TEST_FUNC_EXIT("SnsrScreensaver::SnsrScreensaver") |
|
59 } |
|
60 |
|
61 /*! |
|
62 Destructs the class. |
|
63 */ |
|
64 SnsrScreensaver::~SnsrScreensaver() |
|
65 { |
|
66 } |
|
67 |
|
68 /*! |
|
69 \fn void SnsrScreensaver::exit() |
|
70 |
|
71 This signal is emitted when the runtime ends job. |
|
72 */ |
|
73 |
|
74 /*! |
|
75 Starts the runtime. |
|
76 */ |
|
77 void SnsrScreensaver::start() |
|
78 { |
|
79 SCREENSAVER_TEST_FUNC_ENTRY("SnsrScreensaver::start") |
|
80 |
|
81 if (mRuntime) { |
|
82 mRuntime->start(); |
|
83 } |
|
84 else { |
|
85 emit exit(); |
|
86 } |
|
87 |
|
88 SCREENSAVER_TEST_FUNC_EXIT("SnsrScreensaver::start") |
|
89 } |
|
90 |
|
91 /*! |
|
92 Stops the runtime. |
|
93 */ |
|
94 void SnsrScreensaver::stop() |
|
95 { |
|
96 SCREENSAVER_TEST_FUNC_ENTRY("SnsrScreensaver::stop") |
|
97 |
|
98 if (mRuntime) { |
|
99 mRuntime->stop(); |
|
100 } |
|
101 |
|
102 SCREENSAVER_TEST_FUNC_EXIT("SnsrScreensaver::stop") |
|
103 } |
|
104 |
|
105 /*! |
|
106 Called after the runtime has started. |
|
107 */ |
|
108 void SnsrScreensaver::onRuntimeStarted() |
|
109 { |
|
110 } |
|
111 |
|
112 /*! |
|
113 Called after the runtime has stopped. |
|
114 */ |
|
115 void SnsrScreensaver::onRuntimeStopped() |
|
116 { |
|
117 emit exit(); |
|
118 } |
|
119 |
|
120 /*! |
|
121 Called after the runtime has faulted. |
|
122 */ |
|
123 void SnsrScreensaver::onRuntimeFaulted() |
|
124 { |
|
125 emit exit(); |
|
126 } |
|