File: main.cpp

package info (click to toggle)
plasma-workspace 4%3A6.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 99,452 kB
  • sloc: cpp: 125,486; python: 4,246; xml: 2,449; perl: 572; sh: 230; javascript: 75; ruby: 39; ansic: 13; makefile: 9
file content (37 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download
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
/*
    SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org>
    SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "interactiveconsole.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>

int main(int argc, char **argv)
{
    QApplication::setDesktopFileName(QStringLiteral("org.kde.plasma-interactiveconsole"));
    QApplication app(argc, argv);
    InteractiveConsole::ConsoleMode mode = InteractiveConsole::PlasmaConsole;

    QCommandLineParser parser;
    QCommandLineOption plasmaOpt(QStringLiteral("plasma"));
    QCommandLineOption kwinOpt(QStringLiteral("kwin"));
    parser.addOption(plasmaOpt);
    parser.addOption(kwinOpt);
    parser.addHelpOption();
    parser.process(app);
    if (parser.isSet(plasmaOpt) && parser.isSet(kwinOpt)) {
        qWarning() << "Only one mode can be specified when launching the interactive console";
        exit(1);
    } else if (parser.isSet(kwinOpt)) {
        mode = InteractiveConsole::KWinConsole;
    } else if (parser.isSet(plasmaOpt)) {
        mode = InteractiveConsole::PlasmaConsole;
    }
    // set to delete on close
    auto console = new InteractiveConsole(mode);
    console->show();
    return app.exec();
}