File indexing completed on 2023-05-30 10:39:35
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 0032 int main(int argc, char *argv[]) 0033 { 0034 0035 QApplication app(argc, argv); 0036 KLocalizedString::setApplicationDomain("kmouth"); 0037 0038 KAboutData aboutData(QStringLiteral("kmouth"), 0039 i18n("KMouth"), 0040 QStringLiteral(KMOUTH_VERSION_STRING), 0041 i18n("A type-and-say front end for speech synthesizers"), 0042 KAboutLicense::GPL, 0043 i18n("(c) 2002/2003, Gunnar Schmi Dt"), 0044 QString(), 0045 QStringLiteral("https://apps.kde.org/kmouth"), 0046 QStringLiteral("kmouth@schmi-dt.de")); 0047 aboutData.addAuthor(i18n("Gunnar Schmi Dt"), i18n("Original Author"), QStringLiteral("kmouth@schmi-dt.de")); 0048 aboutData.addAuthor(i18n("Jeremy Whiting"), i18n("Current Maintainer"), QStringLiteral("jpwhiting@kde.org")); 0049 aboutData.addCredit(i18n("Olaf Schmidt"), i18n("Tips, extended phrase books")); 0050 0051 QCommandLineParser parser; 0052 KAboutData::setApplicationData(aboutData); 0053 parser.addPositionalArgument(QStringLiteral("[File]"), i18n("History file to open")); 0054 aboutData.setupCommandLine(&parser); 0055 parser.process(app); 0056 aboutData.processCommandLine(&parser); 0057 0058 0059 if (app.isSessionRestored()) { 0060 kRestoreMainWindows<KMouthApp>(); 0061 } else { 0062 KMouthApp *kmouth = new KMouthApp(); 0063 if (!kmouth->configured()) 0064 return 0; 0065 0066 kmouth->show(); 0067 0068 0069 if (!parser.positionalArguments().isEmpty()) { 0070 const QUrl url = QUrl::fromUserInput(parser.positionalArguments().at(0), QDir::currentPath()); 0071 kmouth->openDocumentFile(url); 0072 } 0073 0074 } 0075 return app.exec(); 0076 }