phoneuis/bubblemanager2/tsrc/bubbletest2/bubbletestview.cpp
changeset 72 c76a0b1755b9
parent 56 5bcb308bd24d
child 76 cfea66083b62
--- a/phoneuis/bubblemanager2/tsrc/bubbletest2/bubbletestview.cpp	Thu Sep 02 20:26:16 2010 +0300
+++ b/phoneuis/bubblemanager2/tsrc/bubbletest2/bubbletestview.cpp	Fri Sep 17 08:29:19 2010 +0300
@@ -17,6 +17,15 @@
 
 #include <QtGui>
 #include <QDebug>
+
+//#define BUBBLETEST_ENABLE_TESTABILITY
+#ifdef BUBBLETEST_ENABLE_TESTABILITY
+    #include <QtPlugin>
+    #include <QPluginLoader>
+    #include <QLibraryInfo>
+    #include "testabilityinterface.h"
+#endif
+
 #include <hbaction.h>
 #include <hbtoolbar.h>
 #include <bubblemanager2.h>
@@ -25,6 +34,7 @@
 #include "bubbletestview.h"
 #include <hbeffect.h>
 
+
 BubbleTestView::BubbleTestView(HbMainWindow& window, QGraphicsItem *parent) :
     HbView (parent), mMainWindow(window), mMuted(0), mConfBubbleId(-1),
     mProvideJoin(false)
@@ -32,6 +42,8 @@
     setFlags (QGraphicsItem::ItemIsFocusable);
     setFocusPolicy (Qt::StrongFocus);
     setTitle("BubbleTest2");
+
+    loadTestabilityPlugin();
     
     // the widget under the test
     mBubbleManager = new BubbleManager (this);
@@ -362,8 +374,34 @@
                 }
             }
         }
+        break;
     }
-    
+
+    case 'C': { // ciphering
+        mCipheringOff->setChecked(!mCipheringOff->isChecked());
+        break;
+    }
+
+    case 'D': { // divert
+        mCallDivert->setChecked(!mCallDivert->isChecked());
+        break;
+    }
+
+    case 'I': { // image
+        mContactPicture->setChecked(!mContactPicture->isChecked());
+        break;
+    }
+
+    case 'N': { // remote name
+        mContactName->setChecked(!mContactName->isChecked());
+        break;
+    }
+
+    case 'T': { // timer
+        mCallTimer->setChecked(!mCallTimer->isChecked());
+        break;
+    }
+
     default:
     break;
     }
@@ -1021,3 +1059,34 @@
     }
 }
 
+void BubbleTestView::loadTestabilityPlugin()
+{
+#ifdef BUBBLETEST_ENABLE_TESTABILITY
+    QString testabilityPlugin = "testability/testability";
+    QString testabilityPluginPostfix = ".dll";
+
+    testabilityPlugin = QLibraryInfo::location(QLibraryInfo::PluginsPath) +
+                                               QObject::tr("/") + testabilityPlugin +
+                                               testabilityPluginPostfix;
+
+    QPluginLoader loader(testabilityPlugin.toLatin1().data());
+
+    QObject *plugin = loader.instance();
+    if (plugin) {
+            qDebug("Testability plugin loaded successfully!");
+            mTestabilityInterface = qobject_cast<TestabilityInterface *>(plugin);
+
+            if (mTestabilityInterface) {
+                    qDebug("Testability interface obtained!");
+                    mTestabilityInterface->Initialize();
+            } else {
+                    qDebug("Failed to get testability interface!");
+            }
+    } else {
+            qDebug("Testability plugin %s load failed with error:%s",
+                   testabilityPlugin.toLatin1().data(),
+                   loader.errorString().toLatin1().data());
+    }
+#endif
+}
+