main.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/BuyAndDownloadExample.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. // NOTE: having debug output to console slows down the app run
  33. // as out-of-sync result IAP client hungs after getUserAndDeviceId call
  34. // that is IAP client issue that is not going to be fixed
  35. // https://support.preminetsolution.com/jira/browse/JUNIPERQA-20973
  36. //qInstallMsgHandler(myMessageHandler);
  37. MainWindow w;
  38. w.listPurchases();
  39. #if defined(Q_WS_S60)// || defined (Q_WS_SIMULATOR)
  40. w.showFullScreen();
  41. #else
  42. w.show();
  43. #endif
  44. return a.exec();
  45. }