summaryrefslogtreecommitdiff
path: root/tests/systemtests/map3d/main.cpp
blob: 4c9d0b8505a34636319f440d4606e2d182ad6b6a (plain)
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
38
39
40
41
42
43
44
45
#include <QApplication>

#include <QUrl>
#include <QSettings>
#include <QProcessEnvironment>
#include <QNetworkProxyFactory>

#include "mainwidget.h"

int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    // not in the tutorial text: set up a proxy server from
    // a QSettings file if necessary (useful on Linux)

    QApplication::setOrganizationName("Nokia");
    QApplication::setApplicationName("Maps3D");

    QSettings settings;

    QVariant value = settings.value("http.proxy");
    if (value.isValid()) {
        QUrl url(value.toString(), QUrl::TolerantMode);
        QNetworkProxy proxy;
        proxy.setType(QNetworkProxy::HttpProxy);
        proxy.setHostName(url.host());
        proxy.setPort(url.port(8080));
        QNetworkProxy::setApplicationProxy(proxy);
    }

    int bm = 0;

    if (argc == 2) {
        bool ok = false;
        bm = QString(QLatin1String(argv[1])).toInt(&ok);
        if (!ok)
            bm = 0;
    }

    MainWidget *w = new MainWidget(0, bm);
    w->show();

    return app.exec();
}