1234567891011121314151617181920212223242526272829303132333435 |
- #include <QtGui/QApplication>
- #include <QDesktopServices>
- #include <qDebug>
- #include <QDeclarativeContext>
- #include <QDesktopServices>
- #include <QTranslator>
- #include "qmlapplicationviewer.h"
- Q_DECL_EXPORT int main(int argc, char *argv[])
- {
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QmlApplicationViewer viewer;
- QTranslator translator;
- if (translator.load(QLatin1String("i18n/thekarmaway_" )+QLocale::system().name(), ":/"))
- app->installTranslator(&translator);
- else
- qDebug()<< "can't find translation "+QLatin1String("i18n/thekarmaway_" )+QLocale::system().name();
- QDeclarativeContext *context = viewer.rootContext();
- //This is a trick to detect if the app is running in the simulator
- if (QDesktopServices::storageLocation(QDesktopServices::PicturesLocation).startsWith("/home/"))
- context->setContextProperty("isSimulator", false);
- else
- context->setContextProperty("isSimulator", true);
- viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer.setMainQmlFile(QLatin1String("qml/TheKarmaWay/main.qml"));
- viewer.showExpanded();
- return app->exec();
- }
|