File: main.cpp

package info (click to toggle)
libqaccessibilityclient 0.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 612 kB
  • sloc: cpp: 3,632; makefile: 9; sh: 7
file content (40 lines) | stat: -rw-r--r-- 1,033 bytes parent folder | download | duplicates (2)
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
/*
    SPDX-FileCopyrightText: 2018 Frederik Gladhorn <gladhorn@kde.org>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#include <QCoreApplication>
#include <QCommandLineParser>
#include <QTextStream>

#include "dumper.h"

int main(int argc, char** argv)
{
    QCoreApplication app(argc, argv);
    app.setApplicationName(QStringLiteral("Accessibility Tree dumper"));

    QCommandLineParser p;
    p.addPositionalArgument(QStringLiteral("appname"), QStringLiteral("Application name"));
    QCommandLineOption states(QStringLiteral("states"));
    p.addOption(states);

    if (!p.parse(app.arguments())) {
        QTextStream out(stdout);
        out << QStringLiteral("Could not parse command line arguments.");
        out << p.helpText();
        exit(1);
    }

    Dumper d;
    if (p.isSet(states)) {
        d.showStates(true);
    }

    if (p.positionalArguments().size() == 1) {
        d.run(p.positionalArguments().at(0));
    } else {
        d.run(QString());
    }
}