File indexing completed on 2024-04-21 04:47:51

0001 /****************************************************************************************
0002  * Copyright (c) 2002 Mark Kretschmann <kretschmann@kde.org>                            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "core/support/Amarok.h"
0018 #include "core/support/Debug.h"
0019 #include "App.h"
0020 #include "aboutdialog/OcsData.h"
0021 
0022 #include <KAboutData>
0023 #include <KCrash>
0024 #include <KDBusService>
0025 #include <Kdelibs4ConfigMigrator>
0026 #include <Kdelibs4Migration>
0027 
0028 #include <KLocalizedString>
0029 
0030 #include <QCommandLineParser>
0031 #include <QStandardPaths>
0032 #include <QtGlobal>
0033 
0034 #ifdef WITH_QT_WEBENGINE
0035 #include <QtWebEngine>
0036 #endif
0037 
0038 #ifdef Q_WS_X11
0039 #include <X11/Xlib.h>
0040 #endif
0041 
0042 #include <csignal>
0043 
0044 #ifdef Q_OS_WIN
0045 AMAROK_EXPORT OcsData ocsData;
0046 #endif
0047 
0048 int main( int argc, char *argv[] )
0049 {
0050     QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
0051     QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
0052 
0053     App app(argc, argv);
0054 
0055     app.setApplicationDisplayName(i18n("Amarok"));
0056 
0057     QCoreApplication::setApplicationName("amarok");
0058     QCoreApplication::setOrganizationDomain("kde.org");
0059     QCoreApplication::setApplicationVersion(AMAROK_VERSION);
0060 
0061     KCrash::initialize();
0062 
0063     Kdelibs4ConfigMigrator configMigrator(QStringLiteral("amarok"));
0064     configMigrator.setConfigFiles(QStringList()
0065                                   << QStringLiteral("amarokrc")
0066                                   << QStringLiteral("amarok_homerc")
0067                                   << QStringLiteral("amarok-appletsrc")
0068                                   );
0069     configMigrator.migrate();
0070 
0071     if (configMigrator.migrate()) {
0072         Kdelibs4Migration dataMigrator;
0073         const QString sourceBasePath = dataMigrator.saveLocation("data", QStringLiteral("amarok"));
0074         const QString targetBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/amarok/");
0075         QString targetFilePath;
0076 
0077         QDir sourceDir(sourceBasePath);
0078         QDir targetDir(targetBasePath);
0079 
0080         if (sourceDir.exists()) {
0081             if (!targetDir.exists()) {
0082                 QDir().mkpath(targetBasePath);
0083             }
0084             QStringList fileNames = sourceDir.entryList(
0085                         QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
0086             foreach (const QString &fileName, fileNames) {
0087                 targetFilePath = targetBasePath + fileName;
0088                 if (!QFile::exists(targetFilePath)) {
0089                     QFile::copy(sourceBasePath + fileName, targetFilePath);
0090                 }
0091             }
0092         }
0093     }
0094 
0095     KAboutData aboutData( "amarok",
0096                           i18n( "Amarok" ),
0097                           AMAROK_VERSION,
0098                           i18n( "The audio player by KDE" ),
0099                           KAboutLicense::GPL,
0100                           i18n( "(C) 2002-2003, Mark Kretschmann\n(C) 2003-2013, The Amarok Development Squad" ),
0101                           ki18n( "IRC:\nirc.libera.chat - #amarok, #amarok-de, #amarok-es, #amarok-fr\n\nFeedback:\namarok@kde.org\n\n(Build Date: %1)" ).subs( __DATE__ ).toString(),
0102                           ( "http://amarok.kde.org" ) );
0103 
0104     //------------ About data ----------------------
0105     //Currently active Authors
0106     extern OcsData ocsData;
0107     aboutData.addAuthor( i18n("Bart 'Where are my toothpicks' Cerneels"),
0108                          i18n("Developer (Stecchino)"), "bart.cerneels@kde.org", "http://commonideas.blogspot.com" );
0109     ocsData.addAuthor( "Stecchino", aboutData.authors().last() );
0110 
0111     aboutData.addAuthor( i18n("Edward \"Hades\" Toroshchin"),
0112                          i18n("Developer (dr_lepper)"), "edward.hades@gmail.com" );
0113     ocsData.addAuthor( "hadeschief", aboutData.authors().last() );
0114 
0115     aboutData.addAuthor( i18n("Mark Kretschmann" ),
0116                          i18n("Project founder (markey)"), "kretschmann@kde.org", "https://plus.google.com/102602725322221030250/posts" );
0117     ocsData.addAuthor( "MarkKretschmann", aboutData.authors().last() );
0118 
0119     aboutData.addAuthor( i18n("Matěj Laitl"),
0120                          i18n("iPod collection rewrite & more (strohel)"), "matej@laitl.cz", "http://strohel.blogspot.com/" );
0121     ocsData.addAuthor( "strohel", aboutData.authors().last() );
0122 
0123     aboutData.addAuthor( i18n("Myriam Schweingruber"), i18n("Rokymoter, Bug triaging (Mamarok)"), "myriam@kde.org", "http://blogs.fsfe.org/myriam" );
0124     ocsData.addAuthor( "Mamarok", aboutData.authors().last() );
0125 
0126     aboutData.addAuthor( i18n("Ralf 'SalsaMaster' Engels"),
0127                          i18n("Developer (rengels)"), "ralf.engels@nokia.com" );
0128     ocsData.addAuthor( QString(), aboutData.authors().last() );
0129 
0130     aboutData.addAuthor( i18n("Patrick von Reth"), i18n("Windows build (TheOneRing)"),
0131                          "patrick.vonreth@gmail.com" );
0132     ocsData.addAuthor( QString(), aboutData.authors().last() );
0133 
0134     aboutData.addAuthor( i18n("Rick W. Chen"),
0135                          i18n("Developer (stuffcorpse)"), "stuffcorpse@archlinux.us" );
0136     ocsData.addAuthor( "stuffcorpse", aboutData.authors().last() );
0137 
0138     aboutData.addAuthor( i18n("Sam Lade"), i18n("Developer (Sentynel)"),
0139                          "sam@sentynel.com" );
0140     ocsData.addAuthor( "Sentynel", aboutData.authors().last() );
0141 
0142     aboutData.addAuthor( i18n("Sven Krohlas"), i18n("Rokymoter, Developer (sven423)"), "sven@asbest-online.de" );
0143     ocsData.addAuthor( "krohlas", aboutData.authors().last() );
0144 
0145     aboutData.addAuthor( i18n("Téo Mrnjavac"),
0146                          i18n("Developer (Teo`)"), "teo@kde.org", "http://teom.wordpress.com/" );
0147     ocsData.addAuthor( "teom", aboutData.authors().last() );
0148 
0149     aboutData.addAuthor( i18n("Valorie Zimmerman"),
0150                          i18n("Rokymoter, Handbook (valorie)"), "valorie@kde.org" );
0151     ocsData.addAuthor( "valorie", aboutData.authors().last() );
0152 
0153     //Inactive authors
0154     /* This list should contain people who still hold major copyright on the current code
0155      * For instance: does not include authors of 1.4 who have not contributed to 2.x */
0156     aboutData.addAuthor( i18n("<i>Inactive authors</i>"),
0157                          i18n("Amarok authorship is not a hobby, it's a lifestyle. "
0158                                "But when people move on we want to keep respecting "
0159                                "them by mentioning them here:"), "" );
0160     ocsData.addAuthor( "%%category%%", aboutData.authors().last() );
0161 
0162     aboutData.addAuthor( i18n("Ian 'The Beard' Monroe"), i18n("Developer (eean)"), "ian@monroe.nu" );
0163     ocsData.addAuthor( "eean", aboutData.authors().last() );
0164 
0165     aboutData.addAuthor( i18n("Jeff 'IROKSOHARD' Mitchell"), i18n("Developer (jefferai)"), "mitchell@kde.org" );
0166     ocsData.addAuthor( "jefferai", aboutData.authors().last() );
0167 
0168     aboutData.addAuthor( i18n("Leo Franchi"), i18n("Developer (lfranchi)"), "lfranchi@kde.org" );
0169     ocsData.addAuthor( "lfranchi", aboutData.authors().last() );
0170 
0171     aboutData.addAuthor( i18n("Lydia 'is wrong(TM)' Pintscher"), i18n("Release Vixen (Nightrose)"), "lydia@kde.org" );
0172     ocsData.addAuthor( "nightrose", aboutData.authors().last() );
0173 
0174     aboutData.addCredit( i18n("Max Howell"), i18n("Developer, Vision"), "max.howell@methylblue.com" );
0175     ocsData.addCredit( QString(), aboutData.credits().last() );
0176 
0177     aboutData.addAuthor( i18n("Maximilian Kossick"), i18n("Developer (maxx_k)"), "maximilian.kossick@gmail.com" );
0178     ocsData.addAuthor( QString(), aboutData.authors().last() );
0179 
0180     aboutData.addAuthor( i18n("Nikolaj Hald 'Also very hot' Nielsen"), i18n("Developer (nhn)"), "nhn@kde.org" );
0181     ocsData.addAuthor( "nhnFreespirit", aboutData.authors().last() );
0182 
0183     aboutData.addCredit( i18n("Seb 'Surfin' down under' Ruiz"), i18n("Developer (sebr)"), "ruiz@kde.org" );
0184     ocsData.addCredit( "seb", aboutData.credits().last() );
0185 
0186 
0187     //Contributors
0188     aboutData.addCredit( i18n("Alejandro Wainzinger"), i18n("Developer (xevix)"), "aikawarazuni@gmail.com" );
0189     ocsData.addCredit( "xevix", aboutData.credits().last() );
0190     aboutData.addCredit( i18n("Alex Merry"), i18n("Developer, Replay Gain support"), "kde@randomguy3.me.uk" );
0191     ocsData.addCredit( "randomguy3", aboutData.credits().last() );
0192     aboutData.addCredit( i18n("Casey Link"), i18n("MP3tunes integration"), "unnamedrambler@gmail.com" );
0193     ocsData.addCredit( "Ramblurr", aboutData.credits().last() );
0194     aboutData.addCredit( i18n("Casper van Donderen"), i18n("Windows porting"), "casper.vandonderen@gmail.com" );
0195     ocsData.addCredit( "cvandonderen", aboutData.credits().last() );
0196     aboutData.addCredit( i18n("Christie Harris"), i18n("Rokymoter (dangle)"), "dangle.baby@gmail.com" );
0197     ocsData.addCredit( "dangle", aboutData.credits().last() );
0198     aboutData.addCredit( i18n("Dan Leinir Turthra Jensen"), i18n("Usability"), "admin@leinir.dk" );
0199     ocsData.addCredit( "leinir", aboutData.credits().last() );
0200     aboutData.addCredit( i18n("Dan 'Hey, it compiled...' Meltzer"), i18n("Developer (hydrogen)"), "parallelgrapefruit@gmail.com" );
0201     ocsData.addCredit( QString(), aboutData.credits().last() );
0202     aboutData.addCredit( i18n("Daniel Caleb Jones"), i18n("Biased playlists"), "danielcjones@gmail.com" );
0203     ocsData.addCredit( QString(), aboutData.credits().last() );
0204     aboutData.addCredit( i18n("Daniel Dewald"), i18n("Tag Guesser, Labels, Spectrum Analyzer"), "Daniel.Dewald@time-shift.de" );
0205     ocsData.addCredit( "TheCrasher", aboutData.credits().last() );
0206     aboutData.addCredit( i18n("Daniel Winter"), i18n("Nepomuk integration"), "dw@danielwinter.de" );
0207     ocsData.addCredit( QString(), aboutData.credits().last() );
0208     aboutData.addCredit( i18n("Frank Meerkötter"), i18n("Podcast improvements"), "frank@meerkoetter.org" );
0209     ocsData.addCredit( QString(), aboutData.credits().last() );
0210     aboutData.addCredit( i18n("Greg Meyer"), i18n("Live CD, Bug squashing (oggb4mp3)"), "greg@gkmweb.com" );
0211     ocsData.addCredit( "oggb4mp3", aboutData.credits().last() );
0212     aboutData.addCredit( i18n("Harald Sitter"), i18n("Phonon, Lord-President of KDE Multimedia (apachelogger)"), "harald.sitter@kdemail.net" );
0213     ocsData.addCredit( "apachelogger", aboutData.credits().last() );
0214     aboutData.addCredit( i18n("John Atkinson"), i18n("Assorted patches"), "john@fauxnetic.co.uk" );
0215     ocsData.addCredit( "fauxnetic", aboutData.credits().last() );
0216     aboutData.addCredit( i18n("Kenneth Wesley Wimer II"), i18n("Icons"), "kwwii@bootsplash.org" );
0217     ocsData.addCredit( "kwwii", aboutData.credits().last() );
0218     aboutData.addCredit( i18n("Kevin Funk"), i18n("Developer, Website theme (KRF)"), "krf@electrostorm.net" );
0219     ocsData.addCredit( "krf", aboutData.credits().last() );
0220     aboutData.addCredit( i18n("Kuba Serafinowski"), i18n("Rokymoter"), "zizzfizzix@gmail.com" );
0221     ocsData.addCredit( "zizzfizzix", aboutData.credits().last() );
0222     aboutData.addCredit( i18n("Lee Olson"), i18n("Artwork"), "leetolson@gmail.com" );
0223     ocsData.addCredit( QString(), aboutData.credits().last() );
0224     aboutData.addCredit( i18n("Ljubomir Simin"), i18n("Rokymoter (ljubomir)"), "ljubomir.simin@gmail.com" );
0225     ocsData.addCredit( "ljubomir", aboutData.credits().last() );
0226     aboutData.addCredit( i18n("Lucas Gomes"), i18n("Developer (MaskMaster)"), "x8lucas8x@gmail.com" );
0227     ocsData.addCredit( "x8lucas8x", aboutData.credits().last() );
0228     aboutData.addCredit( i18n("Mathias Panzenböck"), i18n("Podcast improvements"), "grosser.meister.morti@gmx.net" );
0229     ocsData.addCredit( "panzi", aboutData.credits().last() );
0230     aboutData.addCredit( i18n("Mikko Caldara"), i18n("Bug triaging and sanitizing"), "mikko.cal@gmail.com" );
0231     ocsData.addCredit( QString(), aboutData.credits().last() );
0232     aboutData.addCredit( i18n("Nikhil Marathe"), i18n("UPnP support and patches (nsm)"), "nsm.nikhil@gmail.com" );
0233     ocsData.addCredit( "nikhilm", aboutData.credits().last() );
0234     aboutData.addCredit( i18n("Nuno Pinheiro"), i18n("Artwork"), "nuno@oxygen-icons.org" );
0235     ocsData.addCredit( "nunopinheirokde", aboutData.credits().last() );
0236     aboutData.addCredit( i18n("Olivier Bédard"), i18n("Website hosting"), "paleo@pwsp.net" );
0237     ocsData.addCredit( QString(), aboutData.credits().last() );
0238     aboutData.addCredit( i18n("Pasi Lalinaho"), i18n("Rokymoter (emunkki)"), "pasi@getamarok.com" );
0239     ocsData.addCredit( QString(), aboutData.credits().last() );
0240     aboutData.addCredit( i18n("Peter Zhou Lei"), i18n("Scripting interface"), "peterzhoulei@gmail.com" );
0241     ocsData.addCredit( "peterzl", aboutData.credits().last() );
0242     aboutData.addCredit( i18n("Phalgun Guduthur"), i18n("Nepomuk Collection (phalgun)"), "me@phalgun.in" );
0243     ocsData.addCredit( "phalgun", aboutData.credits().last() );
0244     aboutData.addCredit( i18n("Scott Wheeler"), i18n("TagLib & ktrm code"), "wheeler@kde.org" );
0245     ocsData.addCredit( "wheels", aboutData.credits().last() );
0246     aboutData.addCredit( i18n("Shane King"), i18n("Patches & Windows porting (shakes)"), "kde@dontletsstart.com" );
0247     ocsData.addCredit( QString(), aboutData.credits().last() );
0248     aboutData.addCredit( i18n("Simon Esneault"), i18n("Photos & Videos applets, Context View"), "simon.esneault@gmail.com" );
0249     ocsData.addCredit( "Takahani", aboutData.credits().last() );
0250     aboutData.addCredit( i18n("Soren Harward"), i18n("Developer, Automated Playlist Generator"), "stharward@gmail.com" );
0251     ocsData.addCredit( QString(), aboutData.credits().last() );
0252     aboutData.addCredit( i18n("Thomas Lübking"), i18n("Developer"), "thomas.luebking@web.de" );
0253     ocsData.addCredit( "thomas12777", aboutData.credits().last() );
0254     aboutData.addCredit( i18n("Valentin Rouet"), i18n("Developer"), "v.rouet@gmail.com" );
0255     ocsData.addCredit( QString(), aboutData.credits().last() );
0256     aboutData.addCredit( i18n("Wade Olson"), i18n("Splash screen artist"), "wade@corefunction.com" );
0257     ocsData.addCredit( QString(), aboutData.credits().last() );
0258     aboutData.addCredit( i18n("William Viana Soares"), i18n("Context view"), "vianasw@gmail.com" );
0259     ocsData.addCredit( QString(), aboutData.credits().last() );
0260 
0261     //Former Contributors
0262     aboutData.addCredit( i18n("Former contributors"), i18n("People listed below have contributed to Amarok in the past. Thank you!"), "" );
0263     ocsData.addCredit( "%%category%%", aboutData.credits().last() );
0264     aboutData.addCredit( i18n("Adam Pigg"), i18n("Analyzers, patches, shoutcast"), "adam@piggz.co.uk" );
0265     ocsData.addCredit( QString(), aboutData.credits().last() );
0266     aboutData.addCredit( i18n("Adeodato Simó"), i18n("Patches"), "asp16@alu.ua.es" );
0267     ocsData.addCredit( QString(), aboutData.credits().last() );
0268     aboutData.addCredit( i18n("Alexandre Oliveira"), i18n("Developer"), "aleprj@gmail.com" );
0269     ocsData.addCredit( QString(), aboutData.credits().last() );
0270     aboutData.addCredit( i18n("Andreas Mair"), i18n("MySQL support"), "am_ml@linogate.com" );
0271     ocsData.addCredit( QString(), aboutData.credits().last() );
0272     aboutData.addCredit( i18n("Andrew de Quincey"), i18n("Postgresql support"), "adq_dvb@lidskialf.net" );
0273     ocsData.addCredit( QString(), aboutData.credits().last() );
0274     aboutData.addCredit( i18n("Andrew Turner"), i18n("Patches"), "andrewturner512@googlemail.com" );
0275     ocsData.addCredit( QString(), aboutData.credits().last() );
0276     aboutData.addCredit( i18n("Andy Kelk"), i18n("MTP and Rio Karma media devices, patches"), "andy@mopoke.co.uk" );
0277     ocsData.addCredit( QString(), aboutData.credits().last() );
0278     aboutData.addCredit( i18n("Christian Muehlhaeuser"), i18n("Developer"), "chris@chris.de" );
0279     ocsData.addCredit( QString(), aboutData.credits().last() );
0280     aboutData.addCredit( i18n("Derek Nelson"), i18n("Graphics, splash-screen"), "admrla@gmail.com" );
0281     ocsData.addCredit( QString(), aboutData.credits().last() );
0282     aboutData.addCredit( i18n("Enrico Ros"), i18n("Analyzers, Context Browser and systray eye-candy"), "eros.kde@email.it" );
0283     ocsData.addCredit( QString(), aboutData.credits().last() );
0284     aboutData.addCredit( i18n("Frederik Holljen"), i18n("Developer"), "fh@ez.no" );
0285     ocsData.addCredit( QString(), aboutData.credits().last() );
0286     aboutData.addCredit( i18n("Gábor Lehel"), i18n("Developer"), "illissius@gmail.com" );
0287     ocsData.addCredit( QString(), aboutData.credits().last() );
0288     aboutData.addCredit( i18n("Gérard Dürrmeyer"), i18n("Icons and image work"), "gerard@randomtree.com" );
0289     ocsData.addCredit( QString(), aboutData.credits().last() );
0290     aboutData.addCredit( i18n("Giovanni Venturi"), i18n("Dialog to filter the collection titles"), "giovanni@ksniffer.org" );
0291     ocsData.addCredit( QString(), aboutData.credits().last() );
0292     aboutData.addCredit( i18n("Jarkko Lehti"), i18n("Tester, IRC channel operator, whipping"), "grue@iki.fi" );
0293     ocsData.addCredit( QString(), aboutData.credits().last() );
0294     aboutData.addCredit( i18n("Jocke Andersson"), i18n("Rokymoter, bug fixer (Firetech)"), "ajocke@gmail.com" );
0295     ocsData.addCredit( QString(), aboutData.credits().last() );
0296     aboutData.addCredit( i18n("Marco Gulino"), i18n("Konqueror Sidebar, some DCOP methods"), "marco@kmobiletools.org" );
0297     ocsData.addCredit( QString(), aboutData.credits().last() );
0298     aboutData.addCredit( i18n("Martin Aumueller"), i18n("Developer"), "aumuell@reserv.at" );
0299     ocsData.addCredit( QString(), aboutData.credits().last() );
0300     aboutData.addCredit( i18n("Melchior Franz"), i18n("FHT routine, bugfixes"), "mfranz@kde.org" );
0301     ocsData.addCredit( QString(), aboutData.credits().last() );
0302     aboutData.addCredit( i18n("Michael Pyne"), i18n("K3b export code"), "michael.pyne@kdemail.net" );
0303     ocsData.addCredit( QString(), aboutData.credits().last() );
0304     aboutData.addCredit( i18n("Mike Diehl"), i18n("Developer"), "madpenguin8@yahoo.com" );
0305     ocsData.addCredit( QString(), aboutData.credits().last() );
0306     aboutData.addCredit( i18n("Paul Cifarelli"), i18n("Developer"), "paul@cifarelli.net" );
0307     ocsData.addCredit( QString(), aboutData.credits().last() );
0308     aboutData.addCredit( i18n("Peter C. Ndikuwera"), i18n("Bugfixes, PostgreSQL support"), "pndiku@gmail.com" );
0309     ocsData.addCredit( QString(), aboutData.credits().last() );
0310     aboutData.addCredit( i18n("Pierpaolo Panfilo"), i18n("Developer"), "pippo_dp@libero.it" );
0311     ocsData.addCredit( QString(), aboutData.credits().last() );
0312     aboutData.addCredit( i18n("Reigo Reinmets"), i18n("Wikipedia support, patches"), "xatax@hot.ee" );
0313     ocsData.addCredit( QString(), aboutData.credits().last() );
0314     aboutData.addCredit( i18n("Roman Becker"), i18n("Former Amarok logo, former splash screen, former icons"), "roman@formmorf.de" );
0315     ocsData.addCredit( QString(), aboutData.credits().last() );
0316     aboutData.addCredit( i18n("Sami Nieminen"), i18n("Audioscrobbler support"), "sami.nieminen@iki.fi" );
0317     ocsData.addCredit( QString(), aboutData.credits().last() );
0318     aboutData.addCredit( i18n("Stanislav Karchebny"), i18n("Developer"), "berkus@madfire.net" );
0319     ocsData.addCredit( QString(), aboutData.credits().last() );
0320     aboutData.addCredit( i18n("Stefan Bogner"), i18n("Loads of stuff"), "bochi@online.ms" );
0321     ocsData.addCredit( QString(), aboutData.credits().last() );
0322     aboutData.addCredit( i18n("Tomasz Dudzik"), i18n("Splash screen"), "madsheytan@gmail.com" );
0323     ocsData.addCredit( QString(), aboutData.credits().last() );
0324 
0325     //Donors:
0326     //Last update: 2012/11/07, post Roktober 2012
0327     ocsData.addDonor( "ayleph", KAboutPerson( i18n( "Andrew Browning" ) ) );
0328     ocsData.addDonor( QString(), KAboutPerson( i18n( "Chris Wales" ) ) );
0329     ocsData.addDonor( QString(), KAboutPerson( i18n( "ZImin Stanislav" ) ) );
0330 
0331     KAboutData::setApplicationData(aboutData);
0332 
0333     // Command line parser
0334     QCommandLineParser parser;
0335 
0336     aboutData.setupCommandLine(&parser);
0337     app.initCliArgs(&parser);
0338     parser.process(app);
0339     aboutData.processCommandLine(&parser);
0340 
0341     KDBusService::StartupOptions startOptions = parser.isSet( "multipleinstances" ) ? KDBusService::Multiple
0342                                                                                     : KDBusService::Unique ;
0343     // register  the app  to dbus
0344     KDBusService dbusService( startOptions );
0345 
0346     QObject::connect(&dbusService, &KDBusService::activateRequested,
0347                      &app, &App::activateRequested);
0348 
0349     const bool debugColorsEnabled = !parser.isSet( "coloroff" );
0350     const bool debugEnabled = parser.isSet( "debug" );
0351 
0352     Debug::setDebugEnabled( debugEnabled );
0353     Debug::setColoredDebug( debugColorsEnabled );
0354 
0355     if ( parser.isSet( "debug-audio" ) ) {
0356         qputenv( "PHONON_DEBUG", QByteArray( "3" ) );
0357         qputenv( "PHONON_BACKEND_DEBUG", QByteArray( "3" ) );
0358         qputenv( "PHONON_PULSEAUDIO_DEBUG", QByteArray( "3" ) );
0359     }
0360 
0361 #pragma message("PORT KF5: This *if* should be moved to activateRequested() slot")
0362     if( !dbusService.isRegistered() ) {
0363         QList<QByteArray> instanceOptions;
0364         instanceOptions << "previous" << "play" << "play-pause" << "stop" << "next"
0365                         << "append" << "queue" << "load";
0366         // Check if an option for a running instance is set
0367         bool isSet = false;
0368         for( int i = 0; i < instanceOptions.size(); ++i )
0369             if( parser.isSet( instanceOptions[ i ] ) )
0370                 isSet = true;
0371 
0372         if ( !isSet )
0373             fprintf( stderr, "Amarok is already running!\n" );
0374         return 0;
0375     }
0376 
0377     // Rewrite default SIGINT and SIGTERM handlers
0378     // to make amarok save current playlists during forced
0379     // application termination (logout, Ctr+C in console etc.)
0380     signal( SIGINT, &QCoreApplication::exit );
0381     signal( SIGTERM, &QCoreApplication::exit );
0382 
0383     // This call is needed to prevent a crash on exit with Phonon-VLC and LibPulse
0384 #ifdef Q_WS_X11
0385     XInitThreads();
0386 #endif
0387 
0388     app.continueInit();
0389     return app.exec();
0390 }
0391