File indexing completed on 2024-05-05 17:56:43
0001 /* 0002 Copyright (C) 2014 by Elvis Angelaccio <elvis.angelaccio@kde.org> 0003 0004 This file is part of Kronometer. 0005 0006 Kronometer is free software: you can redistribute it and/or modify 0007 it under the terms of the GNU General Public License as published by 0008 the Free Software Foundation, either version 2 of the License, or 0009 (at your option) any later version. 0010 0011 Kronometer is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 GNU General Public License for more details. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with Kronometer. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "mainwindow.h" 0021 #include "version.h" 0022 0023 #include <KAboutData> 0024 #include <KCrash> 0025 #include <KLocalizedString> 0026 0027 #include <QApplication> 0028 #include <QDir> 0029 #include <QFileInfo> 0030 #include <QStandardPaths> 0031 0032 int main (int argc, char **argv) 0033 { 0034 KLocalizedString::setApplicationDomain("kronometer"); 0035 0036 QApplication app {argc, argv}; 0037 0038 KCrash::initialize(); 0039 0040 auto aboutData = KAboutData { 0041 QStringLiteral("kronometer"), // componentName 0042 i18nc("KAboutData display name", "Kronometer"), 0043 QStringLiteral(KRONOMETER_VERSION_STRING), 0044 i18n("Kronometer is a simple stopwatch application"), // shortDescription 0045 KAboutLicense::GPL_V2, // licenseType 0046 i18n("Copyright (C) 2014-2016 Elvis Angelaccio"), // copyrightStatement 0047 {}, // otherText 0048 QStringLiteral("https://userbase.kde.org/Kronometer") // homePageAddress 0049 }; 0050 0051 aboutData.addAuthor( 0052 i18n("Elvis Angelaccio"), 0053 i18n("Maintainer"), 0054 QStringLiteral("elvis.angelaccio@kde.org"), 0055 QStringLiteral("https://eang.it") 0056 ); 0057 0058 aboutData.addCredit( 0059 i18n("Ken Vermette"), 0060 i18n("Kronometer icon"), 0061 QStringLiteral("vermette@gmail.com") 0062 ); 0063 0064 KAboutData::setApplicationData(aboutData); 0065 0066 app.setApplicationName(aboutData.componentName()); 0067 app.setApplicationDisplayName(aboutData.displayName()); 0068 app.setOrganizationDomain(aboutData.organizationDomain()); 0069 app.setApplicationVersion(aboutData.version()); 0070 app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kronometer"))); 0071 0072 // Make sure that the local data directory is available. 0073 auto appdata = QFileInfo {QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)}; 0074 if (not appdata.exists()) { 0075 auto dir = QDir {appdata.absolutePath()}; 0076 dir.mkdir(appdata.fileName()); 0077 } 0078 0079 auto window = new MainWindow {}; 0080 window->show(); 0081 0082 return app.exec(); 0083 }