File indexing completed on 2022-08-04 15:34:40

0001 /**
0002  * Copyright (C) 2002-2007 Scott Wheeler <wheeler@kde.org>
0003  * Copyright (C) 2004-2021 Michael Pyne  <mpyne@kde.org>
0004  *
0005  * This program is free software; you can redistribute it and/or modify it under
0006  * the terms of the GNU General Public License as published by the Free Software
0007  * Foundation; either version 2 of the License, or (at your option) any later
0008  * version.
0009  *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License along with
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #include <KAboutData>
0019 #include <KConfigBase>
0020 #include <KConfig>
0021 #include <KConfigGroup>
0022 #include <KCrash>
0023 #include <KDBusService>
0024 #include <KNotification>
0025 #include <KSharedConfig>
0026 #include <KLocalizedString>
0027 
0028 #include <QCommandLineParser>
0029 #include <QCommandLineOption>
0030 #include <QApplication>
0031 
0032 #include "juk.h"
0033 #include <config-juk.h>
0034 
0035 int main(int argc, char *argv[])
0036 {
0037     QApplication a(argc, argv);
0038     KLocalizedString::setApplicationDomain("juk");
0039 
0040     KAboutData aboutData(QStringLiteral("juk"), i18n("JuK"),
0041                          QStringLiteral(JUK_VERSION), i18n("Jukebox and music manager by the KDE community"), KAboutLicense::GPL,
0042                          i18n("Copyright © 2002–2021, Scott Wheeler, Michael Pyne, and others"),
0043                          QLatin1String(""),
0044                          QStringLiteral("https://juk.kde.org/"));
0045 
0046     aboutData.addAuthor(i18n("Scott Wheeler"), i18n("Author, chief dork and keeper of the funk"), "wheeler@kde.org");
0047     aboutData.addAuthor(i18n("Michael Pyne"), i18n("Assistant superhero, fixer of many things"), "mpyne@kde.org");
0048     aboutData.addCredit(i18n("Kacper Kasper"), i18n("Porting to KDE Frameworks 5 when no one else was around"), "kacperkasper@gmail.com", "http://kacperkasper.pl/");
0049     aboutData.addCredit(i18n("Eike Hein"), i18n("MPRIS2 Interface implementation."), "hein@kde.org");
0050     aboutData.addCredit(i18n("Martin Sandsmark"), i18n("Last.fm scrobbling support, lyrics, prepping for KDE Frameworks 5."), "martin.sandsmark@kde.org");
0051     aboutData.addCredit(i18n("Γιώργος Κυλάφας (Giorgos Kylafas)"), i18n("Badly-needed tag editor bugfixes."), "gekylafas@gmail.com");
0052     aboutData.addCredit(i18n("Georg Grabler"), i18n("More KDE Platform 4 porting efforts"), "georg@grabler.net");
0053     aboutData.addCredit(i18n("Laurent Montel"), i18n("Porting to KDE Platform 4 when no one else was around"), "montel@kde.org");
0054     aboutData.addCredit(i18n("Nathan Toone"), i18n("Album cover manager"), "nathan@toonetown.com");
0055     aboutData.addCredit(i18n("Matthias Kretz"), i18n("Friendly, neighborhood aRts guru"), "kretz@kde.org");
0056     aboutData.addCredit(i18n("Daniel Molkentin"), i18n("System tray docking, \"inline\" tag editing,\nbug fixes, evangelism, moral support"), "molkentin@kde.org");
0057     aboutData.addCredit(i18n("Tim Jansen"), i18n("GStreamer port"), "tim@tjansen.de");
0058     aboutData.addCredit(i18n("Stefan Asserhäll"), i18n("Global keybindings support"), "stefan.asserhall@telia.com");
0059     aboutData.addCredit(i18n("Stephen Douglas"), i18n("Track announcement popups"), "stephen_douglas@yahoo.com");
0060     aboutData.addCredit(i18n("Frerich Raabe"), i18n("Automagic track data guessing, bugfixes"), "raabe@kde.org");
0061     aboutData.addCredit(i18n("Zack Rusin"), i18n("More automagical things, now using MusicBrainz"), "zack@kde.org");
0062     aboutData.addCredit(i18n("Adam Treat"), i18n("Co-conspirator in MusicBrainz wizardry"), "manyoso@yahoo.com");
0063     aboutData.addCredit(i18n("Maks Orlovich"), i18n("Making JuK friendlier to people with terabytes of music"), "maksim@kde.org");
0064     aboutData.addCredit(i18n("Antonio Larrosa Jimenez"), i18n("DCOP interface"), "larrosa@kde.org");
0065     aboutData.addCredit(i18n("Allan Sandfeld Jensen"), i18n("FLAC and MPC support"), "kde@carewolf.com");
0066     aboutData.addCredit(i18n("Pascal Klein"), i18n("Gimper of splash screen"), "4pascal@tpg.com.au");
0067     KAboutData::setApplicationData(aboutData);
0068 
0069     QCommandLineParser parser;
0070     aboutData.setupCommandLine(&parser);
0071     parser.addPositionalArgument(QLatin1String("[file(s)]"), i18n("File(s) to open"));
0072     parser.process(a);
0073     aboutData.processCommandLine(&parser);
0074 
0075     KCrash::initialize();
0076 
0077     // Create the main window and such
0078     JuK *juk = new JuK(parser.positionalArguments());
0079 
0080     if(a.isSessionRestored() && KMainWindow::canBeRestored(1))
0081         juk->restore(1, false /* don't show */);
0082 
0083     KConfigGroup config(KSharedConfig::openConfig(), "Settings");
0084     if(!config.readEntry("StartDocked", false) || !config.readEntry("DockInSystemTray", false)) {
0085         juk->show();
0086     }
0087     else if(!a.isSessionRestored()) {
0088         QString message = i18n("JuK running in docked mode\nUse context menu in system tray to restore.");
0089         KNotification::event("dock_mode",i18n("JuK Docked"), message);
0090     }
0091 
0092     a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0093 
0094     a.setApplicationName("juk");
0095     a.setOrganizationDomain("kde.org");
0096     // Limit to only one instance
0097     KDBusService service(KDBusService::Unique);
0098 
0099     return a.exec();
0100 }
0101 
0102 // vim: set et sw=4 tw=0 sta fileencoding=utf8: