File indexing completed on 2024-04-28 05:52:07
0001 /* 0002 SPDX-FileCopyrightText: 1998-1999 Matthias Hölzer-Klüpfel <matthias@hoelzer-kluepfel.de> 0003 SPDX-FileCopyrightText: 2002-2003 Martin Willers <willers@xm-arts.de> 0004 SPDX-FileCopyrightText: 2007-2009 Stefan Böhmann <kde@hilefoks.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 #include "toplevel.h" 0009 0010 #include <QApplication> 0011 #include <QCommandLineParser> 0012 0013 #include <KAboutData> 0014 #include <KCrash> 0015 #include <KLocalizedString> 0016 0017 0018 int main (int argc, char *argv[]) 0019 { 0020 /** 0021 * Create application first 0022 */ 0023 QApplication app(argc, argv); 0024 /** 0025 * construct about data for KTeaTime 0026 */ 0027 KAboutData aboutData( QStringLiteral("kteatime"), i18n("KTeaTime"), QStringLiteral(KTEATIME_VERSION), 0028 i18n( "KDE utility for making a fine cup of tea." ), 0029 KAboutLicense::GPL, 0030 i18n( "© 1998-1999, Matthias Hölzer-Klüpfel\n" 0031 "© 2002-2003, Martin Willers\n" 0032 "© 2007-2010, Stefan Böhmann" 0033 ) 0034 ); 0035 0036 KCrash::initialize(); 0037 0038 aboutData.addAuthor(i18n("Stefan Böhmann"), i18n("Current maintainer"), QStringLiteral("kde@hilefoks.org"), QStringLiteral("http://www.hilefoks.org"), QStringLiteral("hilefoks")); 0039 aboutData.addAuthor(i18n("Matthias Hölzer-Klüpfel"), QString(), QStringLiteral("matthias@hoelzer-kluepfel.de")); 0040 aboutData.addAuthor(i18n("Martin Willers"), QString(), QStringLiteral("willers@xm-arts.de")); 0041 0042 aboutData.addCredit(i18n("Daniel Teske"), i18n("Many patches"), QStringLiteral("teske@bigfoot.com")); 0043 0044 aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails")); 0045 0046 /** 0047 * right dbus prefix == org.kde. 0048 */ 0049 aboutData.setOrganizationDomain("kde.org"); 0050 0051 /** 0052 * register about data 0053 */ 0054 KAboutData::setApplicationData(aboutData); 0055 0056 /** 0057 * take component name and org. name from KAboutData 0058 */ 0059 app.setApplicationName(aboutData.componentName()); 0060 app.setApplicationDisplayName(aboutData.displayName()); 0061 app.setOrganizationDomain(aboutData.organizationDomain()); 0062 app.setApplicationVersion(aboutData.version()); 0063 app.setQuitOnLastWindowClosed(false); 0064 0065 /** 0066 * Create command line parser and feed it with known options 0067 */ 0068 QCommandLineParser parser; 0069 aboutData.setupCommandLine(&parser); 0070 parser.setApplicationDescription(aboutData.shortDescription()); 0071 0072 QCommandLineOption timeOption(QStringList() << QStringLiteral("t") << QStringLiteral("time"), i18n("Start a new tea with this time."), i18n("seconds")); 0073 parser.addOption(timeOption); 0074 QCommandLineOption nameOption(QStringList() << QStringLiteral("n") << QStringLiteral("tea-name"), i18n("Use this name for the tea started with --time."), i18n("name")); 0075 parser.addOption(nameOption); 0076 0077 parser.process(app); 0078 aboutData.processCommandLine(&parser); 0079 0080 TopLevel *toplevel=new TopLevel( &aboutData ); 0081 0082 const int time=parser.value(timeOption).toInt(); 0083 if( time > 0 ) { 0084 const QString name = parser.value(nameOption); 0085 const Tea tea( name.isEmpty() ? i18n( "Custom Tea" ) : name, time ); 0086 toplevel->runTea( tea ); 0087 } 0088 0089 int ret = app.exec(); 0090 0091 delete toplevel; 0092 return ret; 0093 } 0094 0095 0096 // kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; replace-tabs on; space-indent on; 0097 // vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1: