File indexing completed on 2024-04-14 03:39:03

0001 /***************************************************************************
0002  *   Copyright (C) 2002 by Gunnar Schmi Dt <kmouth@schmi-dt.de             *
0003  *             (C) 2015 by Jeremy Whiting <jpwhiting@kde.org>              *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
0019  ***************************************************************************/
0020 
0021 #include <QApplication>
0022 #include <QCommandLineParser>
0023 #include <QDir>
0024 
0025 #include <KAboutData>
0026 #include <KLocalizedString>
0027 
0028 #include "kmouth.h"
0029 #include "version.h"
0030 
0031 int main(int argc, char *argv[])
0032 {
0033     QApplication app(argc, argv);
0034     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kmouth"));
0035 
0036     KAboutData aboutData(QStringLiteral("kmouth"),
0037                          i18n("KMouth"),
0038                          QStringLiteral(KMOUTH_VERSION_STRING),
0039                          i18n("A type-and-say front end for speech synthesizers"),
0040                          KAboutLicense::GPL,
0041                          i18n("(c) 2002/2003, Gunnar Schmi Dt"),
0042                          QString(),
0043                          QStringLiteral("https://apps.kde.org/kmouth"),
0044                          QStringLiteral("kmouth@schmi-dt.de"));
0045     aboutData.addAuthor(i18n("Gunnar Schmi Dt"), i18n("Original Author"), QStringLiteral("kmouth@schmi-dt.de"));
0046     aboutData.addAuthor(i18n("Jeremy Whiting"), i18n("Current Maintainer"), QStringLiteral("jpwhiting@kde.org"));
0047     aboutData.addCredit(i18n("Olaf Schmidt"), i18n("Tips, extended phrase books"));
0048 
0049     QCommandLineParser parser;
0050     KAboutData::setApplicationData(aboutData);
0051     parser.addPositionalArgument(QStringLiteral("[File]"), i18n("History file to open"));
0052     aboutData.setupCommandLine(&parser);
0053     parser.process(app);
0054     aboutData.processCommandLine(&parser);
0055 
0056     if (app.isSessionRestored()) {
0057         kRestoreMainWindows<KMouthApp>();
0058     } else {
0059         KMouthApp *kmouth = new KMouthApp();
0060         if (!kmouth->configured())
0061             return 0;
0062 
0063         kmouth->show();
0064 
0065         if (!parser.positionalArguments().isEmpty()) {
0066             const QUrl url = QUrl::fromUserInput(parser.positionalArguments().at(0), QDir::currentPath());
0067             kmouth->openDocumentFile(url);
0068         }
0069     }
0070     return app.exec();
0071 }