/main.cpp

http://cutefootball.googlecode.com/ · C++ · 65 lines · 38 code · 8 blank · 19 comment · 2 complexity · 872eebc07b399faf60d198217cd70bd1 MD5 · raw file

  1. /*
  2. * Copyright 2010,2011 Timothy Rochford
  3. *
  4. * This file is part of CuteFootball.
  5. *
  6. * CuteFootball is free software: you can redistribute it and/or modify
  7. * it under the terms of the Lesser GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * CuteFootball is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * Lesser GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the Lesser GNU General Public License
  17. * along with CuteFootball. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #include <QtGui/QApplication>
  21. #include "mainwindow.h"
  22. void loadStyleSheet(QApplication& app);
  23. int main(int argc, char *argv[])
  24. {
  25. QApplication a(argc, argv);
  26. loadStyleSheet(a);
  27. QString locale(QString("soccer_") + QLocale::system().name());
  28. QTranslator appTranslator;
  29. appTranslator.load(locale, ":/translations/");
  30. a.installTranslator(&appTranslator);
  31. MWindow window;
  32. #if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
  33. #if defined(SOCCER_VGA)
  34. window.setOrientation(MWindow::ScreenOrientationLockLandscape);
  35. #endif // defined(SOCCER_VGA)
  36. window.showFullScreen();
  37. #else
  38. window.show();
  39. #endif
  40. return a.exec();
  41. }
  42. void loadStyleSheet(QApplication& app)
  43. {
  44. #if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
  45. #if defined(SOCCER_VGA)
  46. QFile f(":/mobileVGA.qss");
  47. #else
  48. QFile f(":/mobileQVGA.qss");
  49. #endif
  50. #else
  51. QFile f(":/desktop.qss");
  52. #endif
  53. f.open(QIODevice::ReadOnly | QIODevice::Text);
  54. QByteArray data = f.readAll();
  55. f.close();
  56. app.setStyleSheet(QString(data));
  57. }