File indexing completed on 2024-04-28 15:39:06

0001 // SPDX-FileCopyrightText: 2020-2024 Tobias Leupold <tl at stonemx dot de>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 // Local includes
0006 #include "MainWindow.h"
0007 #include "SharedObjects.h"
0008 #include "version.h"
0009 
0010 // KDE includes
0011 #include <KCrash>
0012 #include <KLocalizedString>
0013 #include <KAboutData>
0014 
0015 // Qt includes
0016 #include <QApplication>
0017 #include <QDebug>
0018 #include <QCommandLineParser>
0019 
0020 int main(int argc, char *argv[])
0021 {
0022     QApplication application(argc, argv);
0023     QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0024 
0025     KLocalizedString::setApplicationDomain("kgeotag");
0026     KCrash::initialize();
0027 
0028     // About data
0029 
0030     KAboutData aboutData;
0031 
0032     aboutData.setComponentName(QStringLiteral("kgeotag"));
0033     aboutData.setDisplayName(i18n("KGeoTag"));
0034     aboutData.setVersion(VERSION_STRING);
0035     aboutData.setShortDescription(i18n("Photo geotagging program"));
0036     aboutData.setLicense(KAboutLicense::GPL_V3);
0037     aboutData.setCopyrightStatement(i18n("Copyright (C) 2020-2024 Tobias Leupold"));
0038     aboutData.setHomepage(QStringLiteral("https://kgeotag.kde.org/"));
0039     aboutData.setOrganizationDomain(QStringLiteral("kde.org").toUtf8());
0040 
0041     aboutData.addAuthor(i18n("Tobias Leupold"), i18n("Maintainer"),
0042                         QStringLiteral("tl@stonemx.de"));
0043 
0044     KAboutData::setApplicationData(aboutData);
0045 
0046     // Create the command line parser
0047     QCommandLineParser commandLineParser;
0048     commandLineParser.addPositionalArgument(i18n("Files/Folders"),
0049                                             i18n("Files and/or folders to load at startup"),
0050                                             i18n("[files/folders...]"));
0051     aboutData.setupCommandLine(&commandLineParser);
0052     commandLineParser.process(application);
0053     aboutData.processCommandLine(&commandLineParser);
0054     auto pathsToLoad = commandLineParser.positionalArguments();
0055 
0056     // Setup all shared objects
0057     SharedObjects sharedObjects;
0058 
0059     // Create the main window
0060     auto *mainWindow = new MainWindow(&sharedObjects);
0061     mainWindow->show();
0062 
0063     // Trigger loading of files and/or directories given on the command line
0064     if (! pathsToLoad.isEmpty()) {
0065         mainWindow->addPathsFromCommandLine(pathsToLoad);
0066     }
0067 
0068     // Run the QApplication
0069     return application.exec();
0070 }