-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmjcalc.cpp
37 lines (29 loc) · 1.07 KB
/
mjcalc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QTranslator>
#include <QtCore/QString>
#include <QtCore/QLocale>
#include <QtGui/QApplication>
#include <QtDeclarative/QDeclarativeContext>
#include <mjcalc/game.h>
#include <mjcalc/mjcalcview.h>
#include <mjcalc/persistantstore.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTranslator tr;
if (tr.load(MjCalcView::getResource(QString("mjcalc-%1").arg(QLocale::system().name())).toLocalFile()))
app.installTranslator(&tr);
mjcalc::PersistantStore store;
Game game(&store);
MjCalcView wnd;
wnd.rootContext()->setContextProperty("game", &game);
QObject::connect(&game, SIGNAL(showAddScores()), &wnd, SLOT(showAddScores()), Qt::QueuedConnection);
QObject::connect(&game, SIGNAL(showNewPage()), &wnd, SLOT(showNewPage()), Qt::QueuedConnection);
QObject::connect(&game, SIGNAL(showMainPage()), &wnd, SLOT(showMainPage()), Qt::QueuedConnection);
if (game.isEmpty())
wnd.showNewPage();
else
wnd.showMainPage();
return app.exec();
}