kdemain.cpp 17.9 KB
Newer Older
Inge Wallin's avatar
Inge Wallin committed
1
//
2
// This file is part of the Marble Virtual Globe.
Inge Wallin's avatar
Inge Wallin committed
3 4 5 6 7
//
// 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.
//
8 9
// Copyright 2007      Torsten Rahn <tackat@kde.org>
// Copyright 2007      Inge Wallin  <ingwa@kde.org>
10
// Copyright 2009      Jens-Michael Hoffmann <jensmh@gmx.de>
Inge Wallin's avatar
Inge Wallin committed
11 12
//

Dennis Nienhüser's avatar
Dennis Nienhüser committed
13 14 15
#include <kaboutdata.h>
#include <KConfig>
#include <KConfigGroup>
16
#include <kcrash.h>
Dennis Nienhüser's avatar
Dennis Nienhüser committed
17 18
#include <klocalizedstring.h>
#include <KSharedConfig>
19

20
#include <QFile>
Dennis Nienhüser's avatar
Dennis Nienhüser committed
21 22
#include <QCommandLineParser>
#include <QApplication>
23

Tobias Koenig's avatar
Tobias Koenig committed
24
#include "ControlView.h"
Torsten Rahn's avatar
Torsten Rahn committed
25
#include "KdeMainWindow.h"
Levente Kurusa's avatar
Levente Kurusa committed
26
#include "GeoUriParser.h"
27
#include "MarbleDebug.h"
28
#include "MapThemeManager.h"
29

30 31
#include "MarbleTest.h"

Laurent Montel's avatar
Laurent Montel committed
32
#ifdef STATIC_BUILD
33
 #include <QtPlugin>
34 35 36
 Q_IMPORT_PLUGIN(qjpeg)
 Q_IMPORT_PLUGIN(qsvg)
#endif
37 38 39

using namespace Marble;

Bastian Holst's avatar
Bastian Holst committed
40
int main ( int argc, char *argv[] )
Torsten Rahn's avatar
Torsten Rahn committed
41
{
Dennis Nienhüser's avatar
Dennis Nienhüser committed
42 43 44 45 46
    KAboutData aboutData( "marble",
                          i18n( "Marble Virtual Globe" ),
                          ControlView::applicationVersion(),
                          i18n( "A World Atlas." ),
                          KAboutLicense::LGPL_V2,
47
                          i18n( "(c) 2007-%1", QLatin1String("2015") ),
Dennis Nienhüser's avatar
Dennis Nienhüser committed
48 49
                          QString(),
                          "http://marble.kde.org/" );
50

51
    // Active Development Team of Marble
Dennis Nienhüser's avatar
Dennis Nienhüser committed
52 53
    aboutData.addAuthor( i18n( "Torsten Rahn" ),
                         i18n( "Developer and Original Author" ),
54
                         "rahn@kde.org" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
55 56
    aboutData.addAuthor( i18n( "Bernhard Beschow" ),
                         i18n( "WMS Support, Mobile, Performance" ),
57
                         "bbeschow@cs.tu-berlin.de" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
58 59
    aboutData.addAuthor( i18n( "Thibaut Gridel" ),
                         i18n( "Geodata" ),
60
                         "tgridel@free.fr" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
61 62
    aboutData.addAuthor( i18n( "Jens-Michael Hoffmann" ),
                         i18n( "OpenStreetMap Integration, OSM Namefinder, Download Management" ),
63
                         "jmho@c-xx.com", "http://www.c-xx.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
64 65
    aboutData.addAuthor( i18n( "Florian E&szlig;er" ),
                         i18n( "Elevation Profile" ),
66
                         "f.esser@rwth-aachen.de" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
67 68
    aboutData.addAuthor( i18n( "Wes Hardaker" ),
                         i18n( "APRS Plugin" ),
69
                         "marble@hardakers.net" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
70 71
    aboutData.addAuthor( i18n( "Bastian Holst" ),
                         i18n( "Online Services support" ),
Torsten Rahn's avatar
 
Torsten Rahn committed
72
                         "bastianholst@gmx.de" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
73 74
    aboutData.addAuthor( i18n( "Guillaume Martres" ),
                         i18n( "Satellites" ),
75
                         "smarter@ubuntu.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
76 77
    aboutData.addAuthor( i18n( "Rene Kuettner" ),
                         i18n( "Satellites, Eclipses" ),
78
                         "rene@bitkanal.net" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
79 80
    aboutData.addAuthor( i18n( "Friedrich W. H. Kossebau" ),
                         i18n( "Plasma Integration, Bugfixes" ),
81
                         "kossebau@kde.org" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
82 83
    aboutData.addAuthor( i18n( "Dennis Nienhüser" ),
                         i18n( "Routing, Navigation, Mobile" ),
Dennis Nienhüser's avatar
Dennis Nienhüser committed
84
                         "nienhueser@kde.org" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
85 86
    aboutData.addAuthor( i18n( "Niko Sams" ),
                         i18n( "Routing, Elevation Profile" ),
87
                         "niko.sams@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
88 89
    aboutData.addAuthor( i18n( "Patrick Spendrin" ),
                         i18n( "Core Developer: KML and Windows support" ),
90
                         "pspendrin@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
91 92
    aboutData.addAuthor( i18n( "Eckhart Wörner" ),
                         i18n( "Bugfixes" ),
93 94 95 96
                         "kde@ewsoftware.de" );
    
    // Developers:    
    
Dennis Nienhüser's avatar
Dennis Nienhüser committed
97 98
    aboutData.addAuthor( i18n( "Inge Wallin" ),
                         i18n( "Core Developer and Co-Maintainer" ),
99
                         "inge@lysator.liu.se" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
100 101
    aboutData.addAuthor( i18n( "Henry de Valence" ),
                         i18n( "Core Developer: Marble Runners, World-Clock Plasmoid" ),
102
                         "hdevalence@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
103 104
    aboutData.addAuthor( i18n( "Pino Toscano" ),
                         i18n( "Network plugins" ),
105
                         "pino@kde.org" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
106 107
    aboutData.addAuthor( i18n( "Harshit Jain" ),
                         i18n( "Planet filter" ),
Torsten Rahn's avatar
 
Torsten Rahn committed
108
                         "sonu.itbhu@googlemail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
109 110
    aboutData.addAuthor( i18n( "Simon Edwards" ),
                         i18n( "Marble Python Bindings" ),
111
                         "simon@simonzone.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
112 113
    aboutData.addAuthor( i18n( "Magnus Valle" ),
                         i18n( "Historical Maps" ),
114
                         "" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
115 116
    aboutData.addAuthor( i18n( "Médéric Boquien" ),
                         i18n( "Astronomical Observatories" ),
Torsten Rahn's avatar
 
Torsten Rahn committed
117
                         "mboquien@free.fr" );
118

119
    // ESA Summer of Code in Space
Dennis Nienhüser's avatar
Dennis Nienhüser committed
120 121
    aboutData.addAuthor( i18n( "Rene Kuettner" ),
                         i18n( "ESA Summer of Code in Space 2012 Project:"
122 123
                                " Visualization of planetary satellites" ),
                         "rene@bitkanal.net" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
124 125
    aboutData.addAuthor( i18n( "Guillaume Martres" ),
                         i18n( "ESA Summer of Code in Space 2011 Project:"
Danny Rim's avatar
Danny Rim committed
126 127 128
                                " Visualization of Satellite Orbits" ),
                         "smarter@ubuntu.com" );

129
    // Google Summer of Code
Dennis Nienhüser's avatar
Dennis Nienhüser committed
130 131
    aboutData.addAuthor( i18n( "Konstantin Oblaukhov" ),
                         i18n( "Google Summer of Code 2011 Project:"
Dennis Nienhüser's avatar
Dennis Nienhüser committed
132 133
                                " OpenStreetMap Vector Rendering" ),
                         "oblaukhov.konstantin@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
134 135
    aboutData.addAuthor( i18n( "Daniel Marth" ),
                         i18n( "Google Summer of Code 2011 Project:"
Dennis Nienhüser's avatar
Dennis Nienhüser committed
136 137
                                " Marble Touch on MeeGo" ),
                         "danielmarth@gmx.at" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
138 139
    aboutData.addAuthor( i18n( "Gaurav Gupta" ),
                         i18n( "Google Summer of Code 2010 Project:"
140 141
                                " Bookmarks" ),
                         "1989.gaurav@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
142 143
    aboutData.addAuthor( i18n( "Harshit Jain " ),
                         i18n( "Google Summer of Code 2010 Project:"
144 145
                                " Time Support" ),
                         "hjain.itbhu@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
146 147
    aboutData.addAuthor( i18n( "Siddharth Srivastava" ),
                         i18n( "Google Summer of Code 2010 Project:"
148 149
                                " Turn-by-turn Navigation" ),
                         "akssps011@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
150 151
    aboutData.addAuthor( i18n( "Andrew Manson" ),
                         i18n( "Google Summer of Code 2009 Project:"
Jens-Michael Hoffmann's avatar
Jens-Michael Hoffmann committed
152
                                " OSM Annotation" ),
153
                         "g.real.ate@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
154 155
    aboutData.addAuthor( i18n( "Bastian Holst" ),
                         i18n( "Google Summer of Code 2009 Project:"
156 157
                                " Online Services" ),
                         "bastianholst@gmx.de" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
158 159
    aboutData.addAuthor( i18n( "Patrick Spendrin" ),
                         i18n( "Google Summer of Code 2008 Project:"
160 161
                                " Vector Tiles for Marble" ),
                         "pspendrin@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
162 163
    aboutData.addAuthor( i18n( "Shashank Singh" ),
                         i18n( "Google Summer of Code 2008 Project:"
164 165
                                " Panoramio / Wikipedia -photo support for Marble" ),
                         "shashank.personal@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
166 167
    aboutData.addAuthor( i18n( "Carlos Licea" ),
                         i18n( "Google Summer of Code 2007 Project:"
168 169
                                " Equirectangular Projection (\"Flat Map\")" ),
                         "carlos.licea@kdemail.net" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
170 171
    aboutData.addAuthor( i18n( "Andrew Manson" ),
                         i18n( "Google Summer of Code 2007 Project:"
172 173
                                " GPS Support for Marble" ),
                         "g.real.ate@gmail.com" );
Dennis Nienhüser's avatar
Dennis Nienhüser committed
174 175
    aboutData.addAuthor( i18n( "Murad Tagirov" ),
                         i18n( "Google Summer of Code 2007 Project:"
176 177 178 179
                                " KML Support for Marble" ),
                         "tmurad@gmail.com" );

    // Developers
Dennis Nienhüser's avatar
Dennis Nienhüser committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
    aboutData.addAuthor( i18n( "Simon Schmeisser" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Claudiu Covaci" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "David Roberts" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Nikolas Zimmermann" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Jan Becker" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Stefan Asserhäll" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Laurent Montel" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Mayank Madan" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Prashanth Udupa" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Anne-Marie Mahfouf" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Josef Spillner" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Frerich Raabe" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Frederik Gladhorn" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Fredrik Höglund" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Albert Astals Cid" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Thomas Zander" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Joseph Wenninger" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Kris Thomsen" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Daniel Molkentin" ),
                         i18n( "Development & Patches" ));
    aboutData.addAuthor( i18n( "Christophe Leske" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Sebastian Wiedenroth" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Tim Sutton" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Christian Ehrlicher" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Ralf Habacker" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Steffen Joeris" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Marcus Czeslinski" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Marcus D. Hanwell" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Chitlesh Goorah" ),
                         i18n( "Platforms & Distributions" ));
    aboutData.addAuthor( i18n( "Nuno Pinheiro" ),
                         i18n( "Artwork" ));
    aboutData.addAuthor( i18n( "Torsten Rahn" ),
                         i18n( "Artwork" ));
240 241

    // Credits
Dennis Nienhüser's avatar
Dennis Nienhüser committed
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
    aboutData.addCredit( i18n( "Luis Silva" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Stefan Jordan" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Robert Scott" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Lubos Petrovic" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Benoit Sigoure" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Martin Konold" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Matthias Welwarsky" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Rainer Endres" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Ralf Gesellensetter" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "Tim Alder" ),
                         i18n( "Various Suggestions & Testing" ));
    aboutData.addCredit( i18n( "John Layt" ),
                         i18n( "Special thanks for providing an"
264 265
                                " important source of inspiration by creating"
                                " Marble's predecessor \"Kartographer\"." ));
Dennis Nienhüser's avatar
Dennis Nienhüser committed
266
    KAboutData::setApplicationData(aboutData);
267

268 269 270
    KCrash::setCrashHandler( KCrash::defaultCrashHandler );
    KCrash::setDrKonqiEnabled( true );

Dennis Nienhüser's avatar
Dennis Nienhüser committed
271 272 273 274
    QApplication app( argc, argv );
    QCommandLineParser parser;
    parser.addHelpOption();
    parser.addVersionOption();
275

Bastian Holst's avatar
Bastian Holst committed
276 277 278
    // Autodetect profiles
    MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles();

Dennis Nienhüser's avatar
Dennis Nienhüser committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
    QCommandLineOption debugOption( "debug-info", i18n( "Enable debug output" ) );
    parser.addOption( debugOption );
    QCommandLineOption timeOption( "timedemo", i18n( "Make a time measurement to check performance" ) );
    parser.addOption( timeOption );
    QCommandLineOption fpsOption( "fps", i18n( "Show frame rate" ) );
    parser.addOption( fpsOption );
    QCommandLineOption tileOption( "tile-id", i18n( "Show tile IDs" ) );
    parser.addOption( tileOption );
    QCommandLineOption traceOption( "runtimeTrace", i18n( "Show time spent in each layer" ) );
    parser.addOption( traceOption );
    QCommandLineOption dataPathOption("marbledatapath", i18n("Use a different directory <directory> which contains map data."), "directory");
    parser.addOption( dataPathOption );
    QCommandLineOption noSmallScreenOption( "nosmallscreen", i18n( "Do not use the interface optimized for small screens" ) );
    QCommandLineOption smallScreenOption( "smallscreen", i18n( "Use the interface optimized for small screens" ) );
    parser.addOption( (profiles & MarbleGlobal::SmallScreen) ? noSmallScreenOption : smallScreenOption );
    QCommandLineOption noHighResOption( "nohighresolution", i18n( "Do not use the interface optimized for high resolutions" ) );
    QCommandLineOption highResOption( "highresolution", i18n( "Use the interface optimized for high resolutions" ) );
    parser.addOption( (profiles & MarbleGlobal::HighResolution) ? noHighResOption : highResOption );
    QCommandLineOption coordinatesOption("latlon", "coordinates", i18n("Show map at given lat lon <coordinates>"), "coordinates");
    parser.addOption( coordinatesOption );
    QCommandLineOption geoUriOption("geo-uri", i18n("Show map at given geo <uri>"), "uri");
    parser.addOption( geoUriOption );
    QCommandLineOption distanceOption("distance", i18n("Set the distance of the observer to the globe (in km)"), "distance");
    parser.addOption( distanceOption );
    QCommandLineOption mapIdOption("map", i18n("Use map <id> (e.g. \"earth/openstreetmap/openstreetmap.dgml\")"), "id");
    parser.addOption( mapIdOption );
    parser.addPositionalArgument("file", i18n( "One or more placemark files to be opened") );

    parser.process( app );

309 310 311 312
    KLocalizedString::setApplicationDomain("marble");

    // use ecm_create_qm_loader(marblewidget_SRCS marble_qt)
    // in the library src/lib/marble/CMakeList.txt to load the second catalog
Dennis Nienhüser's avatar
Dennis Nienhüser committed
313 314 315 316

    MarbleDebug::setEnabled( parser.isSet( debugOption ) );

    if ( parser.isSet( smallScreenOption ) ) {
Bastian Holst's avatar
Bastian Holst committed
317 318 319 320 321 322
        profiles |= MarbleGlobal::SmallScreen;
    }
    else {
        profiles &= ~MarbleGlobal::SmallScreen;
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
323
    if ( parser.isSet( highResOption ) ) {
Bastian Holst's avatar
Bastian Holst committed
324 325 326 327 328 329 330 331
        profiles |= MarbleGlobal::HighResolution;
    }
    else {
        profiles &= ~MarbleGlobal::HighResolution;
    }

    MarbleGlobal::getInstance()->setProfiles( profiles );

Dennis Nienhüser's avatar
Dennis Nienhüser committed
332
    QString marbleDataPath = parser.value( dataPathOption );
Bastian Holst's avatar
Bastian Holst committed
333
    MainWindow *window = new MainWindow( marbleDataPath );
334
    window->setAttribute( Qt::WA_DeleteOnClose, true );
Torsten Rahn's avatar
Torsten Rahn committed
335
    window->show();
336

Dennis Nienhüser's avatar
Dennis Nienhüser committed
337
    if ( parser.isSet( timeOption ) ) {
338
        window->resize(900, 640);
339 340
        MarbleTest test( window->marbleWidget() );
        test.timeDemo();
341 342
        return 0;
    }
343

Dennis Nienhüser's avatar
Dennis Nienhüser committed
344
    if ( parser.isSet( fpsOption ) ) {
Torsten Rahn's avatar
 
Torsten Rahn committed
345 346 347
        window->marbleControl()->marbleWidget()->setShowFrameRate( true );
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
348
    if ( parser.isSet( tileOption ) ) {
Levente Kurusa's avatar
Levente Kurusa committed
349
        window->marbleControl()->marbleWidget()->setShowTileId( true );
Torsten Rahn's avatar
 
Torsten Rahn committed
350 351
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
352
    const QString map = parser.value( mapIdOption );
353 354 355 356
    if ( !map.isEmpty() ) {
        window->marbleWidget()->setMapThemeId(map);
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
357
    const QString coordinatesString = parser.value( coordinatesOption );
358 359 360 361 362 363 364 365 366 367
    if ( !coordinatesString.isEmpty() ) {
        bool success = false;
        const GeoDataCoordinates coordinates = GeoDataCoordinates::fromString(coordinatesString, success);
        if ( success ) {
            const qreal longitude = coordinates.longitude(GeoDataCoordinates::Degree);
            const qreal latitude = coordinates.latitude(GeoDataCoordinates::Degree);
            window->marbleWidget()->centerOn(longitude, latitude);
        }
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
368
    const QString geoUriString = parser.value( geoUriOption );
369 370
    if ( !geoUriString.isEmpty() ) {
        window->marbleControl()->openGeoUri( geoUriString );
Levente Kurusa's avatar
Levente Kurusa committed
371 372
    }

Dennis Nienhüser's avatar
Dennis Nienhüser committed
373
    const QString distance = parser.value( distanceOption );
374 375 376 377 378 379 380
    if ( !distance.isEmpty() ) {
        bool success = false;
        const qreal distanceValue = distance.toDouble(&success);
        if ( success )
            window->marbleWidget()->setDistance(distanceValue);
    }

381
    // Read the files that are given on the command line.
Gilbert Assaf's avatar
Gilbert Assaf committed
382
    foreach( const QString &file, parser.positionalArguments() ) {
Bastian Holst's avatar
Bastian Holst committed
383
        // FIXME: Use openUrl( args->url(i) ) instead?
Dennis Nienhüser's avatar
Dennis Nienhüser committed
384 385 386
        if ( QFile::exists( file ) ) {
            window->marbleControl()->addGeoDataFile( file );
        }
387 388
    }

Torsten Rahn's avatar
Torsten Rahn committed
389
    return app.exec();
390
}