main.cpp 1.66 KB
Newer Older
Gábor Péterffy's avatar
Gábor Péterffy committed
1 2 3 4 5 6 7
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
Gábor Péterffy's avatar
Gábor Péterffy committed
8
// Copyright 2015      Gábor Péterffy <peterffy95@gmail.com>
Gábor Péterffy's avatar
Gábor Péterffy committed
9 10
//

Gábor Péterffy's avatar
Gábor Péterffy committed
11
#include <QApplication>
12
#include <QQmlApplicationEngine>
13
#include <QtQuick>
Gábor Péterffy's avatar
Gábor Péterffy committed
14

15
#include "declarative/MarbleDeclarativePlugin.h"
16
#include <MarbleGlobal.h>
17
#include "MarbleMaps.h"
18
#include "TextToSpeechClient.h"
Gábor Péterffy's avatar
Gábor Péterffy committed
19

20 21
using namespace Marble;

22 23 24 25 26 27
#ifdef Q_OS_ANDROID
// Declare symbol of main method as exported as needed by Qt-on-Android,
// where the Dalvik-native QtActivity class needs to find and invoke it
// on loading the "app" module
extern "C" Q_DECL_EXPORT
#endif
Gábor Péterffy's avatar
Gábor Péterffy committed
28 29 30
int main(int argc, char ** argv)
{
    QApplication app(argc, argv);
31 32 33
    app.setApplicationName( "Marble Maps" );
    app.setOrganizationName( "KDE" );
    app.setOrganizationDomain( "kde.org" );
34

35 36 37 38 39
#ifdef Q_OS_ANDROID
    MarbleGlobal::Profiles profiles = MarbleGlobal::SmallScreen | MarbleGlobal::HighResolution;
    MarbleGlobal::getInstance()->setProfiles( profiles );
#endif

40
    MarbleDeclarativePlugin declarativePlugin;
41
    const char uri[] = "org.kde.marble";
42
    declarativePlugin.registerTypes(uri);
43
    qmlRegisterType<MarbleMaps>(uri, 0, 20, "MarbleMaps");
44

45 46 47 48 49 50
    QQmlApplicationEngine engine;
    TextToSpeechClient * tts = new TextToSpeechClient(&engine);
    engine.rootContext()->setContextProperty("textToSpeechClient", tts);
    engine.load(QUrl("qrc:/MainScreen.qml"));
    // @todo Ship translations and only fall back to english if no translations for the system locale are installed
    tts->setLocale("en");
Gábor Péterffy's avatar
Gábor Péterffy committed
51 52 53

    return app.exec();
}