Changeset View
Changeset View
Standalone View
Standalone View
tests/osd/main.cpp
- This file was added.
1 | /************************************************************************************* | ||||
---|---|---|---|---|---|
2 | * Copyright 2014-2016 by Sebastian Kügler <sebas@kde.org> * | ||||
3 | * * | ||||
4 | * This program is free software; you can redistribute it and/or * | ||||
5 | * modify it under the terms of the GNU General Public License * | ||||
6 | * as published by the Free Software Foundation; either version 2 * | ||||
7 | * of the License, or (at your option) any later version. * | ||||
8 | * * | ||||
9 | * This program is distributed in the hope that it will be useful, * | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||||
12 | * GNU General Public License for more details. * | ||||
13 | * * | ||||
14 | * You should have received a copy of the GNU General Public License * | ||||
15 | * along with this program; if not, write to the Free Software * | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * | ||||
17 | *************************************************************************************/ | ||||
18 | | ||||
19 | #include "osdtest.h" | ||||
20 | | ||||
21 | #include <QGuiApplication> | ||||
22 | #include <QCommandLineParser> | ||||
23 | | ||||
24 | int main(int argc, char **argv) | ||||
25 | { | ||||
26 | QGuiApplication app(argc, argv); | ||||
27 | | ||||
28 | QCommandLineOption dbus = QCommandLineOption(QStringList() << QStringLiteral("d") << "dbus", | ||||
29 | QStringLiteral("Call over dbus")); | ||||
30 | QCommandLineOption outputid = QCommandLineOption(QStringList() << QStringLiteral("o") << "outputidentifiers", | ||||
31 | QStringLiteral("Show output identifier")); | ||||
32 | QCommandLineOption icon = QCommandLineOption(QStringList() << QStringLiteral("i") << "icon", | ||||
33 | QStringLiteral("Icon to use for OSD"), QStringLiteral("preferences-desktop-display-randr")); | ||||
34 | QCommandLineOption message = QCommandLineOption(QStringList() << QStringLiteral("m") << "message", | ||||
35 | QStringLiteral("Icon to use for OSD"), QStringLiteral("OSD Test")); | ||||
36 | KScreen::OsdTest osdtest; | ||||
37 | QCommandLineParser parser; | ||||
38 | parser.addHelpOption(); | ||||
39 | parser.addOption(dbus); | ||||
40 | parser.addOption(outputid); | ||||
41 | parser.addOption(icon); | ||||
42 | parser.addOption(message); | ||||
43 | parser.process(app); | ||||
44 | | ||||
45 | | ||||
46 | | ||||
47 | if (parser.isSet(dbus)) { | ||||
48 | osdtest.setUseDBus(true); | ||||
49 | } | ||||
50 | if (parser.isSet(outputid)) { | ||||
51 | | ||||
52 | osdtest.showOutputIdentifiers(); | ||||
53 | } else { | ||||
54 | osdtest.showGenericOsd(parser.value(icon), parser.value(message)); | ||||
55 | } | ||||
56 | if (parser.isSet(outputid)) { | ||||
57 | } | ||||
58 | | ||||
59 | return app.exec(); | ||||
60 | } |