securitydialogs/SecUi/SecUiTestQt/main.cpp
changeset 66 67b3e3c1fc87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/SecUi/SecUiTestQt/main.cpp	Wed Oct 20 14:51:23 2010 +0300
@@ -0,0 +1,74 @@
+#include <hbinstance.h>
+#include <hbapplication.h>
+
+#include "contentwidget.h"
+
+//#define DEBUG_TO_FILE
+
+#ifdef DEBUG_TO_FILE
+#include <stdio.h>
+#include <QMutex>
+
+const int maxPathIndex = 1;
+const char *paths[/*maxPathIndex*/] = {"f:\\SecUiTestQt-log.txt"};
+
+FILE* file = 0;
+
+void myMessageOutput(QtMsgType type, const char *msg) {
+    switch (type) {
+        case QtDebugMsg: {
+            fprintf(file, "Debug: %s\n", msg);
+        }
+        break;
+        case QtWarningMsg: {
+            //fprintf(file, "Warning: %s\n", msg);
+        }
+        break;
+        case QtCriticalMsg: {
+            fprintf(file, "Critical: %s\n", msg);
+        }
+        break;
+        case QtFatalMsg: {
+            fprintf(file, "Fatal: %s\n", msg);
+            abort();
+        }
+    }
+}
+#endif
+
+
+int main(int argc, char *argv[])
+{
+#ifdef DEBUG_TO_FILE
+    int pathIndex = 0;
+    while (!file && pathIndex < maxPathIndex) {
+        file = fopen(paths[pathIndex], "a");
+        if (!file) ++pathIndex;
+    }
+    if (file) qInstallMsgHandler(myMessageOutput);
+    qDebug("============================================================"
+        "===========================================================");
+    qDebug("============================================================"
+        "===========================================================");
+#endif
+    HbApplication app(argc, argv);    
+    app.setApplicationName( "SecUiTestQt" );
+
+    QString appDir = app.applicationDirPath(); 
+
+    HbMainWindow* window = new HbMainWindow();
+
+    ContentWidget *view = new ContentWidget(appDir, window);
+    window->addView(view);
+
+    window->show();
+    int closeCode = app.exec();
+    window->deleteLater();
+    
+#ifdef DEBUG_TO_FILE
+    if (file) {
+        fclose(file);
+    }
+#endif
+    return closeCode;
+}