File indexing completed on 2022-09-27 14:35:05

0001 /*
0002  * KMix -- KDE's full featured mini mixer
0003  *
0004  *
0005  * Copyright (C) 2000 Stefan Schimanski <schimmi@kde.org>
0006  *
0007  * This program is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Library General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2 of the License, or (at your option) any later version.
0011  *
0012  * This program is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Library General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Library General Public
0018  * License along with this program; if not, write to the Free
0019  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0020  */
0021 
0022 #include <qcommandlineparser.h>
0023 #include <qapplication.h>
0024 
0025 #include <kaboutdata.h>
0026 #include <klocalizedstring.h>
0027 #include <kdbusservice.h>
0028 
0029 #include "kmixapp.h"
0030 #include "kmix_debug.h"
0031 
0032 int main(int argc, char *argv[])
0033 {
0034     QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
0035 
0036     QApplication qapp(argc, argv);
0037 
0038     KLocalizedString::setApplicationDomain("kmix");
0039 
0040     KAboutData aboutData("kmix", i18n("KMix"),
0041                          KMIX_VERSION, i18n("KMix - KDE's full featured mini mixer"), KAboutLicense::GPL,
0042                          i18n("(c) 1996-2013 The KMix Authors"));
0043 
0044    // Author Policy: Long-term maintainers and backend writers/maintainers go in the Authors list.
0045    aboutData.addAuthor(i18n("Christian Esken")   , i18n("Original author and current maintainer"), "esken@kde.org");
0046    aboutData.addAuthor(i18n("Colin Guthrie")     , i18n("PulseAudio support"), "colin@mageia.org");
0047    aboutData.addAuthor(i18n("Helio Chissini de Castro"), i18n("ALSA 0.9x port"), "helio@kde.org" );
0048    aboutData.addAuthor(i18n("Brian Hanson")      , i18n("Solaris support"), "bhanson@hotmail.com");
0049 // The HP/UX port is not maintained anymore, and no official part of KMix anymore
0050 // aboutData.addAuthor(i18n("Helge Deller")      , i18n("HP/UX port"), "deller@gmx.de");
0051 // The initial support was for ALSA 0.5. The new code is not based on it IIRC.
0052 // aboutData.addAuthor(i18n("Nick Lopez")        , i18n("Initial ALSA port"), "kimo_sabe@usa.net");
0053 
0054    // Credit Policy: Authors who did a discrete part, like the Dataengine, OSD, help on specific platforms or soundcards.
0055    aboutData.addCredit(i18n("Igor Poboiko")      , i18n("Plasma Dataengine"), "igor.poboiko@gmail.com");
0056    aboutData.addCredit(i18n("Stefan Schimanski") , i18n("Temporary maintainer"), "schimmi@kde.org");
0057    aboutData.addCredit(i18n("Sebestyen Zoltan")  , i18n("*BSD fixes"), "szoli@digo.inf.elte.hu");
0058    aboutData.addCredit(i18n("Lennart Augustsson"), i18n("*BSD fixes"), "augustss@cs.chalmers.se");
0059    aboutData.addCredit(i18n("Nadeem Hasan")      , i18n("Mute and volume preview, other fixes"), "nhasan@kde.org");
0060    aboutData.addCredit(i18n("Erwin Mascher")     , i18n("Improving support for emu10k1 based soundcards"));
0061    aboutData.addCredit(i18n("Valentin Rusu")     , i18n("TerraTec DMX6Fire support"), "kde@rusu.info");
0062 
0063    aboutData.setOrganizationDomain(QByteArray("kde.org"));
0064    aboutData.setDesktopFileName(QStringLiteral("org.kde.kmix"));
0065 
0066    KAboutData::setApplicationData(aboutData);
0067    // Implement running as a unique application
0068    KDBusService service(KDBusService::Unique);
0069    KMixApp kmapp;                   // continues here if unique
0070    QObject::connect(&service, &KDBusService::activateRequested, &kmapp, &KMixApp::newInstance);
0071 
0072    // Now known to be the first or only instance of the application
0073    QCommandLineParser parser;
0074    aboutData.setupCommandLine(&parser);
0075    parser.addOption(QCommandLineOption("keepvisibility", i18n("Inhibits the unhiding of the KMix main window, if KMix is already running.")));
0076    parser.addOption(QCommandLineOption("failsafe", i18n("Starts KMix in failsafe mode.")));
0077    parser.process(qapp);
0078    kmapp.parseOptions(parser);              // pass options for startup
0079 
0080    kmapp.newInstance();
0081    int ret = qapp.exec();
0082    qCDebug(KMIX_LOG) << "KMix is now exiting, status=" << ret;
0083    return ret;
0084 }