mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-26 17:03:08 +00:00
60 lines
2 KiB
C++
60 lines
2 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// SPDX-FileCopyrightText: 2026 A-La-Karte Contributors
|
|
|
|
#include <QCommandLineOption>
|
|
#include <QCommandLineParser>
|
|
#include <QCoreApplication>
|
|
|
|
#include <KAboutData>
|
|
#include <KDBusService>
|
|
#include <KSignalHandler>
|
|
|
|
#include "alakarte-version.h"
|
|
#include "gamecenterdaemon.h"
|
|
|
|
#include <signal.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication app(argc, argv);
|
|
app.setOrganizationDomain(QStringLiteral("kde.org"));
|
|
app.setApplicationName(QStringLiteral("GameCenter1"));
|
|
|
|
KAboutData aboutData(QStringLiteral("alakarte-gamecenter"),
|
|
QStringLiteral("A-La-Karte Game Center"),
|
|
QStringLiteral(ALAKARTE_VERSION_STRING),
|
|
QStringLiteral("Game session management daemon for A-La-Karte"),
|
|
KAboutLicense::GPL_V3,
|
|
QStringLiteral("© 2026 A-La-Karte Contributors"));
|
|
aboutData.addAuthor(QStringLiteral("A-La-Karte Contributors"), QStringLiteral("Developer"), QString());
|
|
KAboutData::setApplicationData(aboutData);
|
|
|
|
QCommandLineParser parser;
|
|
aboutData.setupCommandLine(&parser);
|
|
parser.process(app);
|
|
aboutData.processCommandLine(&parser);
|
|
|
|
GameCenterDaemon daemon;
|
|
if (!daemon.init()) {
|
|
qWarning() << "GameCenter daemon initialization failed";
|
|
return 1;
|
|
}
|
|
|
|
app.setOrganizationDomain(QStringLiteral("kde.org"));
|
|
app.setApplicationName(QStringLiteral("GameCenter1"));
|
|
|
|
KDBusService service(KDBusService::Unique | KDBusService::NoExitOnFailure);
|
|
if (!service.isRegistered()) {
|
|
qWarning() << "Failed to register D-Bus service" << service.serviceName() << service.errorMessage();
|
|
return 1;
|
|
}
|
|
|
|
KSignalHandler::self()->watchSignal(SIGTERM);
|
|
KSignalHandler::self()->watchSignal(SIGINT);
|
|
QObject::connect(KSignalHandler::self(), &KSignalHandler::signalReceived, &app, [&app](int signal) {
|
|
Q_UNUSED(signal);
|
|
app.quit();
|
|
});
|
|
|
|
return app.exec();
|
|
}
|