summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger/main.cpp
blob: c9983cd5919475253ed530059a9fec20ac5415d8 (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
#include <QtGui/qapplication.h>

#include "qmldebugger.h"

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

    QStringList args = app.arguments();

    QmlDebugger win;
    if (args.contains("--engine"))
        win.showEngineTab();

    for (int i=0; i<args.count(); i++) {
        if (!args[i].contains(':'))
            continue;
        QStringList hostAndPort = args[i].split(':');
        bool ok = false;
        quint16 port = hostAndPort.value(1).toInt(&ok);
        if (ok) {
            qWarning() << "qmldebugger connecting to"
                    << hostAndPort[0] << port << "...";
            win.setHost(hostAndPort[0]);
            win.setPort(port);
            win.connectToHost();
            break;
        }
    }

    win.show();

    return app.exec();
}