PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/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
23void loadStyleSheet(QApplication& app);
24
25int main(int argc, char *argv[])
26{
27    QApplication a(argc, argv);
28    loadStyleSheet(a);
29
30    QString locale(QString("soccer_") + QLocale::system().name());
31    QTranslator appTranslator;
32
33    appTranslator.load(locale, ":/translations/");
34    a.installTranslator(&appTranslator);
35
36    MWindow window;
37#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
38#if defined(SOCCER_VGA)
39    window.setOrientation(MWindow::ScreenOrientationLockLandscape);
40#endif // defined(SOCCER_VGA)
41    window.showFullScreen();
42#else
43    window.show();
44#endif
45
46    return a.exec();
47}
48
49void loadStyleSheet(QApplication& app)
50{
51#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
52#if defined(SOCCER_VGA)
53    QFile f(":/mobileVGA.qss");
54#else
55    QFile f(":/mobileQVGA.qss");
56#endif
57#else
58    QFile f(":/desktop.qss");
59#endif
60    f.open(QIODevice::ReadOnly | QIODevice::Text);
61    QByteArray data = f.readAll();
62    f.close();
63
64    app.setStyleSheet(QString(data));
65}