File indexing completed on 2023-05-30 11:30:47

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