File indexing completed on 2024-04-21 04:05:09

0001 /*
0002     SPDX-FileCopyrightText: 2008 Ian Wadham <iandw.au@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <QApplication>
0008 #include <QCommandLineParser>
0009 
0010 #include <KAboutData>
0011 #include <KCrash>
0012 #include <KDBusService>
0013 #include <KLocalizedString>
0014 
0015 #include "kubrick.h"
0016 #include "kubrick_version.h"
0017 
0018 int main(int argc, char **argv)
0019 {
0020     QApplication app(argc, argv);
0021 
0022     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kubrick"));
0023 
0024     KAboutData about (QStringLiteral("kubrick"), i18n ("Kubrick"),
0025             QStringLiteral(KUBRICK_VERSION_STRING),
0026             i18n ("A game based on Rubik's Cube (TM)"),
0027             KAboutLicense::GPL,
0028             i18n ("&copy; 2008 Ian Wadham"),
0029             QString(),
0030             QStringLiteral("https://apps.kde.org/kubrick") );
0031     about.addAuthor (i18n ("Ian Wadham"), i18n ("Author"),
0032                              QStringLiteral("iandw.au@gmail.com"));
0033 
0034     KAboutData::setApplicationData(about);
0035     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kubrick")));
0036 
0037     KCrash::initialize();
0038 
0039     QCommandLineParser parser;
0040     about.setupCommandLine(&parser);
0041     parser.process(app);
0042     about.processCommandLine(&parser);
0043 
0044     KDBusService service;
0045 
0046     Kubrick * mainWindow = nullptr;
0047 
0048     if (app.isSessionRestored ()) {
0049         kRestoreMainWindows<Kubrick>();
0050     }
0051     else {
0052         // No interrupted session ... just start up normally.
0053 
0054         /// @todo do something with the command line args here
0055 
0056         mainWindow = new Kubrick ();
0057         mainWindow->show ();
0058     }
0059 
0060     // MainWindow has WDestructiveClose flag by default, so
0061     // it will delete itself.
0062     return app.exec ();
0063 }