Tests/DemoGUI/main.cpp
changeset 26 83d6a149c755
child 27 b3e1347ac96a
equal deleted inserted replaced
25:a180113055cb 26:83d6a149c755
       
     1 #include <QtGui/QApplication>
       
     2 #include "mainwindow.h"
       
     3 #include<qfile.h>
       
     4 #include<qtextstream.h>
       
     5 #ifdef Q_OS_SYMBIAN
       
     6 #include <eikenv.h>
       
     7 #include <eikappui.h>
       
     8 #include <aknenv.h>
       
     9 #include <aknappui.h>
       
    10 #endif
       
    11 
       
    12 void debugOutput(QtMsgType type, const char *msg)
       
    13 	{
       
    14 	QFile logFile("c://data//SmfLog.txt");
       
    15 	Q_ASSERT(logFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ));
       
    16 	QTextStream stream(&logFile);
       
    17 	
       
    18 	switch (type)
       
    19 		{
       
    20 		case QtDebugMsg:
       
    21 			stream<<msg<<"\n";
       
    22 			break;
       
    23 
       
    24 		case QtWarningMsg:
       
    25 			stream<<"Warning: ";
       
    26 			stream<<msg<<"\n";
       
    27 			break;
       
    28 			
       
    29 		case QtCriticalMsg:
       
    30 			stream<<"Critical: ";
       
    31 			stream<<msg<<"\n";
       
    32 			break;
       
    33 			
       
    34 		case QtFatalMsg:
       
    35 			stream<<"Fatal: ";
       
    36 			stream<<msg<<"\n";
       
    37 			break;
       
    38 			
       
    39 		default:;
       
    40 		}
       
    41 	}
       
    42 
       
    43 int main(int argc, char *argv[])
       
    44 {
       
    45     qInstallMsgHandler(debugOutput);
       
    46     QApplication a(argc, argv);
       
    47     MainWindow w;
       
    48 #ifdef Q_OS_SYMBIAN    
       
    49 CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); 
       
    50 TRAPD(error,     
       
    51 if (appUi) {        // Lock application orientation into landscape        
       
    52 appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);    
       
    53 }    
       
    54 );    
       
    55 #endif
       
    56   
       
    57     
       
    58     w.showFullScreen();
       
    59     return a.exec();
       
    60 }