1 #include <QtGui/QApplication>
2 #include <QDeclarativeContext>
3 #include <QtDeclarative>
5 #include <QtGui/QDirModel>
7 #include "qmlapplicationviewer.h"
9 #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
11 Q_DECL_EXPORT int main(int argc, char *argv[])
13 QScopedPointer<QApplication> app(createApplication(argc, argv));
15 QmlApplicationViewer viewer;
16 QSettings settings("MK","Ubi");
17 Utils utils(&viewer,&settings);
19 QString locale = settings.value("locale").toString();
20 if(locale!="pl_PL" && locale!="en_US" && locale!="it_IT") {
21 locale = QLocale::system().name();
22 if(locale!="pl_PL" && locale!="it_IT") {
25 settings.setValue("locale",locale);
27 QTranslator translator;
28 QString dir = "translations";
29 dir = ":/translations";
30 #if defined(MEEGO_EDITION_HARMATTAN)
31 dir = ":/translations";
33 #if defined(Q_WS_MAEMO_5)
34 //dir = "/opt/ubi/translations";
35 dir = ":/translations";
37 if (translator.load(QString("ubi.")+locale,dir)) {
38 app->installTranslator(&translator);
41 settings.setValue("locale",locale);
44 QDeclarativeContext *context = viewer.rootContext();
45 context->setContextProperty("Utils", &utils);
47 #if defined(MEEGO_EDITION_HARMATTAN)
48 //viewer.setMainQmlFile(QLatin1String("qml/ubi/meego_main.qml"));
49 viewer.setSource(QUrl("qrc:///qml/ubi/meego_main.qml"));
50 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
53 #if defined(Q_WS_MAEMO_5)
54 qputenv("N900_PORTRAIT_SENSORS", "1");
55 //viewer.setMainQmlFile(QLatin1String("qml/ubi/meego_main.qml"));
56 viewer.setSource(QUrl("qrc:///qml/ubi/main.qml"));
57 //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
58 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
59 viewer.setGeometry(QRect(0,0,800,480));
62 #if !defined(MEEGO_EDITION_HARMATTAN) && !defined(Q_WS_MAEMO_5)
63 //viewer.setMainQmlFile(QLatin1String("qml/ubi/main.qml"));
64 viewer.setSource(QUrl("qrc:///qml/ubi/main.qml"));
65 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
68 viewer.setWindowTitle(QString("Ubi"));
69 viewer.showExpanded();
72 #if defined(Q_WS_MAEMO_5)
73 viewer.setGeometry(QRect(0,0,800,480));
74 viewer.showFullScreen();
76 viewer.showExpanded();