homescreenapp/hsapplication/src/hshomescreen.cpp
changeset 77 4b195f3bea29
parent 39 4e8ebe173323
child 92 6727c5d0afc7
--- a/homescreenapp/hsapplication/src/hshomescreen.cpp	Tue Jul 06 14:06:53 2010 +0300
+++ b/homescreenapp/hsapplication/src/hshomescreen.cpp	Wed Aug 18 09:40:07 2010 +0300
@@ -26,6 +26,7 @@
 
 #include "hshomescreen.h"
 #include "hstest_global.h"
+#include "hsstatemachine.h"
 #ifdef Q_OS_SYMBIAN
 #include "hshomescreenclientserviceprovider.h"
 #endif
@@ -35,8 +36,7 @@
     \class HsHomeScreen
     \ingroup group_hsapplication
     \brief Homescreen application main class.
-    Loads a runtime from a runtime provider plugin. Manages
-    the state machine execution.
+    Manages the state machine execution.
 */
 
 /*!
@@ -52,34 +52,17 @@
 {
     HSTEST_FUNC_ENTRY("HS::HsHomeScreen::HsHomeScreen");
 
-    QServiceManager serviceManager;
-
-    registerServicePlugins(serviceManager);
+    registerServicePlugins();
     
-    QServiceFilter filter("com.nokia.symbian.IHomeScreenRuntime");
-    QList<QServiceInterfaceDescriptor> interfaces = serviceManager.findInterfaces(filter);
-
-    if (interfaces.isEmpty()) {
-        emit exit();
-        return;
-    }
+    mRuntime = new HsStateMachine(this);
 
-    QObject *object = serviceManager.loadInterface(interfaces.first().interfaceName());
-    mRuntime = qobject_cast<QStateMachine *>(object);
-
-    if (mRuntime) {
-        mRuntime->setParent(this);
-        connect(mRuntime, SIGNAL(started()), SLOT(onRuntimeStarted()));
-        connect(mRuntime, SIGNAL(stopped()), SLOT(onRuntimeStopped()));
-        hbInstance->allMainWindows().first()->installEventFilter(this);
+    connect(mRuntime, SIGNAL(started()), SLOT(onRuntimeStarted()));
+    connect(mRuntime, SIGNAL(stopped()), SLOT(onRuntimeStopped()));
+    hbInstance->allMainWindows().first()->installEventFilter(this);
 #ifdef Q_OS_SYMBIAN
-        mHomeScreenClientServiceProvider = new HsHomeScreenClientServiceProvider;
-        mHomeScreenClientServiceProvider->setParent(this);
+    mHomeScreenClientServiceProvider = new HsHomeScreenClientServiceProvider;
+    mHomeScreenClientServiceProvider->setParent(this);
 #endif
-    } else {
-        delete object;
-        emit exit();
-    }
 
     HSTEST_FUNC_EXIT("HS::HsHomeScreen::HsHomeScreen");
 }
@@ -97,26 +80,21 @@
 */
 
 /*!
-    Starts the runtime.
+    Starts the state machine.
 */
 void HsHomeScreen::start()
 {
     HSTEST_FUNC_ENTRY("HS::HsHomeScreen::start");
-    if (mRuntime) {
-        mRuntime->start();
-    } else {
-        HSTEST_FUNC_EXIT("HS::HsHomeScreen::start, mRuntime not created, exit application");
-        emit exit();
-    }
+    mRuntime->start();
     HSTEST_FUNC_EXIT("HS::HsHomeScreen::start");
 }
 
 /*!
-    Stops the runtime.
+    Stops the state machine.
 */
 void HsHomeScreen::stop()
 {
-	if (mRuntime && mRuntime->isRunning()) {
+	if (mRuntime->isRunning()) {
         QEventLoop eventLoop;
         connect(mRuntime, SIGNAL(finished()), &eventLoop, SLOT(quit()));
         QMetaObject::invokeMethod(mRuntime, "event_exit", Qt::QueuedConnection);
@@ -137,14 +115,14 @@
 }
 
 /*!
-    Called after the runtime has started.
+    Called after the state machine has started.
 */
 void HsHomeScreen::onRuntimeStarted()
 {
 }
 
 /*!
-    Called after the runtime has stopped.
+    Called after the state machine has stopped.
 */
 void HsHomeScreen::onRuntimeStopped()
 {
@@ -154,13 +132,15 @@
 /*!
     Registers service plugins pre-installed on the device.
 */
-void HsHomeScreen::registerServicePlugins(QServiceManager &serviceManager)
-{
+void HsHomeScreen::registerServicePlugins()
+{    
     HSTEST_FUNC_ENTRY("HS::HsHomeScreen::registerServicePlugins()");
+    
+    QServiceManager serviceManager;
+    
     QStringList pluginPaths;
     
-    pluginPaths << "private/20022F35";    
-    pluginPaths << "hsresources/plugins";
+    pluginPaths << "private/20022F35";
 
     QFileInfoList drives = QDir::drives();
     foreach(const QString pluginPath, pluginPaths) {
@@ -182,6 +162,12 @@
     HSTEST_FUNC_EXIT("HS::HsHomeScreen::registerServicePlugins()");
 }
 
+#ifdef COVERAGE_MEASUREMENT 
+#ifndef Q_OS_SYMBIAN 
+#pragma CTC SKIP
+#endif // Q_OS_SYMBIAN
+#endif //COVERAGE_MEASUREMENT
+
 /*!
     Recursively registers service plugins starting from given /a root
     directory. All directories containing plugins are added to
@@ -214,3 +200,9 @@
     }
     HSTEST_FUNC_EXIT("HS::HsHomeScreen::registerServicePlugins(const QString &)");
 }
+
+#ifdef COVERAGE_MEASUREMENT
+#ifndef Q_OS_SYMBIAN 
+#pragma CTC ENDSKIP
+#endif // Q_OS_SYMBIAN
+#endif //COVERAGE_MEASUREMENT
\ No newline at end of file