main.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3. #include "buycatalog.h"
  4. #include <QtGui/QMessageBox>
  5. #include <QFile>
  6. #include <QTextStream>
  7. void myMessageHandler(QtMsgType type, const char *msg)
  8. {
  9. QString txt;
  10. switch (type) {
  11. case QtDebugMsg:
  12. txt = QString("Debug: %1").arg(msg);
  13. break;
  14. case QtWarningMsg:
  15. txt = QString("Warning: %1").arg(msg);
  16. break;
  17. case QtCriticalMsg:
  18. txt = QString("Critical: %1").arg(msg);
  19. break;
  20. case QtFatalMsg:
  21. txt = QString("Fatal: %1").arg(msg);
  22. abort();
  23. }
  24. QFile outFile("c:/data/Game.log");
  25. outFile.open(QIODevice::WriteOnly | QIODevice::Append);
  26. QTextStream ts(&outFile);
  27. ts << txt << endl;
  28. }
  29. int main(int argc, char *argv[])
  30. {
  31. QApplication a(argc, argv);
  32. qInstallMsgHandler(myMessageHandler);
  33. MainWindow w;
  34. w.listLevels(a.applicationDirPath());
  35. //BuyCatalog w;
  36. #if defined(Q_WS_S60)// || defined (Q_WS_SIMULATOR)
  37. w.showFullScreen();
  38. #else
  39. w.show();
  40. #endif
  41. return a.exec();
  42. }