Artifact 1c9d18e8c6a0683e1c96753424bd71a22d9a8619c2e06e32d6a8031ffa440726:

  • File src/main.cxx — part of check-in [882d3e941a] at 2017-04-27 12:37:54 on branch trunk — Reformat source code with KDE artistic style. (user: fifr size: 2900)

/*
 * Copyright (c) 2017 Frank Fischer
 *
 * This file is part of KraView.
 *
 * KraView is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * KraView is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KraView.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <QApplication>
#include <QCommandLineParser>
#include <QUrl>
#include <QTimer>

#include <KLocalizedString>
#include <KAboutData>

#include "KraView.hxx"


int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    KLocalizedString::setApplicationDomain("kraview");

    KAboutData aboutData(// The program name used internally. (componentName)
        QStringLiteral("kraview"),
        // A displayable program name string. (displayName)
        i18n("KraView"),
        // The program version string. (version)
        QStringLiteral("1.0"),
        // Short description of what the app does. (shortDescription)
        i18n("A simple graph viewer."),
        // The license this code is released under
        KAboutLicense::GPL,
        // Copyright Statement (copyrightStatement = QString())
        i18n("(c) 2017"),
        // Optional text shown in the About box.
        // Can contain any information desired. (otherText)
        i18n("Some text..."),
        // The program homepage string. (homePageAddress = QString())
        QStringLiteral("http://www.mathematik.uni-kassel.de/~fifr/fossils/cpp-kraview"),
        // The bug report email address
        // (bugsEmailAddress = QLatin1String("submit@bugs.kde.org")
        QStringLiteral("frank-fischer@shadow-soft.de"));

    aboutData.addAuthor(i18n("Frank Fischer"), i18n("Developer"), QStringLiteral("frank-fischer@shadow-soft.de"),
                        QStringLiteral("http://www.mathematik.uni-kassel.de/~fifr"), QStringLiteral("fifr"));
    KAboutData::setApplicationData(aboutData);

    QCommandLineParser parser;
    parser.setApplicationDescription(i18n("Simple graph viewer"));
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument(i18n("GRAV-FILE"), i18n("A grav file to be loaded at start."));
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    const QStringList args = parser.positionalArguments();

    KraView* kraview = new KraView();
    kraview->show();

    if (!args.isEmpty()) {
        kraview->loadGraph(QUrl::fromUserInput(args.at(0)));
    }

    return app.exec();
}