File indexing completed on 2024-04-28 04:48:37
0001 /* 0002 SPDX-FileCopyrightText: 2004 Max Howell <max.howell@methylblue.com> 0003 SPDX-FileCopyrightText: 2007 Ian Monroe <ian@monroe.nu> 0004 SPDX-FileCopyrightText: 2014 Lukáš Tinkl <lukas@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 #include "codeine.h" 0010 #include "playerApplication.h" 0011 0012 #include <QApplication> 0013 #include <QCommandLineOption> 0014 #include <QCommandLineParser> 0015 #include <QDebug> 0016 #include <QDir> 0017 #include <QIcon> 0018 #include <QUrl> 0019 0020 #include <KAboutData> 0021 #include <KConfigGroup> 0022 #include <KCrash> 0023 #include <KDBusService> 0024 #include <KLocalizedString> 0025 #include <KSharedConfig> 0026 0027 int main(int argc, char **argv) 0028 { 0029 Dragon::PlayerApplication app(argc, argv); 0030 KCrash::initialize(); 0031 0032 KLocalizedString::setApplicationDomain("dragonplayer"); 0033 0034 KAboutData aboutData(QStringLiteral(APP_NAME), 0035 i18n("Dragon Player"), 0036 QStringLiteral(APP_VERSION), 0037 i18n("A video player that has a usability focus"), 0038 KAboutLicense::GPL_V2, 0039 i18n("Copyright 2006, Max Howell\nCopyright 2007, Ian Monroe"), 0040 QString(), 0041 QStringLiteral("https://commits.kde.org/dragon")); 0042 aboutData.setDesktopFileName(QStringLiteral("org.kde.dragonplayer")); 0043 aboutData.addCredit(QStringLiteral("David Edmundson"), i18n("Improvements and polish")); 0044 aboutData.addCredit(QStringLiteral("Matthias Kretz"), i18n("Creator of Phonon")); 0045 aboutData.addCredit(QStringLiteral("Eugene Trounev"), i18n("Dragon Player icon")); 0046 aboutData.addCredit(QStringLiteral("Mike Diehl"), i18n("Handbook")); 0047 aboutData.addCredit(QStringLiteral("The Kaffeine Developers"), i18n("Great reference code")); 0048 aboutData.addCredit(QStringLiteral("Greenleaf"), i18n("Yatta happened to be the only video on my laptop to test with. :)")); 0049 aboutData.addCredit(QStringLiteral("Eike Hein"), i18n("MPRIS v2 support")); 0050 aboutData.addCredit(QStringLiteral("Lukáš Tinkl"), i18n("Port to KF5/Plasma 5"), QStringLiteral("lukas@kde.org")); 0051 0052 KAboutData::setApplicationData(aboutData); 0053 0054 QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("dragonplayer"))); 0055 0056 QCommandLineParser parser; 0057 aboutData.setupCommandLine(&parser); 0058 0059 const QCommandLineOption playDvDOption(QStringLiteral("play-dvd"), i18n("Play DVD Video")); 0060 parser.addOption(playDvDOption); 0061 parser.addPositionalArgument(QStringLiteral("url"), i18n("Play 'URL'"), QStringLiteral("+[URL]")); 0062 0063 parser.process(app); 0064 aboutData.processCommandLine(&parser); 0065 0066 const bool multiple = KSharedConfig::openConfig()->group(QStringLiteral("KDE")).readEntry("MultipleInstances", QVariant(false)).toBool(); 0067 KDBusService service(multiple ? KDBusService::Multiple : KDBusService::Unique); 0068 QObject::connect(&service, &KDBusService::activateRequested, &app, &Dragon::PlayerApplication::slotActivateRequested); 0069 QObject::connect(&service, &KDBusService::openRequested, &app, &Dragon::PlayerApplication::slotOpenRequested); 0070 0071 QList<QUrl> urls; 0072 const QStringList args = parser.positionalArguments(); 0073 if (!args.isEmpty()) { 0074 urls.append(QUrl::fromUserInput(args.first(), QDir::currentPath(), QUrl::AssumeLocalFile)); 0075 } 0076 0077 app.newInstance(parser.isSet(playDvDOption), urls); 0078 0079 return app.exec(); 0080 }