diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ea9c05..8eadc46a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,364 +1,359 @@ cmake_minimum_required(VERSION 2.8.12) project(kmix) set(PROJECT_VERSION "5.13.80") set(PROJECT_VERSION_MAJOR 5) add_definitions( -DTRANSLATION_DOMAIN=\"kmix\" ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # TODO: When ECM 5.41.0 is released (https://phabricator.kde.org/D7823), # ECM_MIN_VERSION should be updated to "5.41.0" and FindGLIB2.cmake and # FindPulseAudio.cmake be removed from cmake/modules. set (QT_MIN_VERSION "5.4.0") set (KF5_MIN_VERSION "5.14.0") set (ECM_MIN_VERSION "5.14.0") set (PA_MIN_VERSION "0.9.16") find_package(ECM ${ECM_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMPackageConfigHelpers) include(ECMInstallIcons) include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core DBus Gui Widgets Xml ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Completion Config ConfigWidgets Crash DBusAddons DocTools GlobalAccel I18n IconThemes - Init Notifications Plasma Solid WidgetsAddons WindowSystem XmlGui ) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) # PulseAudio is an optional dependency # # Note that if the CMake module to find PulseAudio is accepted into ECM, # then in accordance with ECM conventions its output variables match the # case of the package (therefore PulseAudio_FOUND etc). The variables used # in this file therefore need to be updated to suit. find_package(PulseAudio "${PA_MIN_VERSION}") # PulseAudio requires GLib2 if (PulseAudio_FOUND) find_package(GLIB2 REQUIRED) endif(PulseAudio_FOUND) # Canberra is an optional dependency find_package(Canberra) find_package(ALSA) include(CheckCXXSourceCompiles) check_cxx_source_compiles(" #include int main() { std::shared_ptr p; return 0; } " HAVE_STD_SHARED_PTR) check_cxx_source_compiles(" #include int main() { std::tr1::shared_ptr p; return 0; } " HAVE_STD_TR1_SHARED_PTR) configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) #################################################################################################### ########### compile definitions #################################################################### #################################################################################################### include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) # TODO: is the next line needed now? include_directories("/usr/lib/oss/include") # TODO: is the next line really needed? Nothing seems to use anything to do with tagging. if (MSVC) include_directories(${TAGLIB_INCLUDES}) endif (MSVC) if (ALSA_FOUND) set(HAVE_LIBASOUND2 TRUE) add_definitions(-DHAVE_LIBASOUND2) endif (ALSA_FOUND) if (PulseAudio_FOUND) add_definitions(-DHAVE_PULSE) include_directories(${PulseAudio_INCLUDE_DIRS}) include_directories(${GLIB2_INCLUDE_DIR}) endif (PulseAudio_FOUND) if (CANBERRA_FOUND) add_definitions(-DHAVE_CANBERRA) include_directories(${CANBERRA_INCLUDE_DIRS}) endif (CANBERRA_FOUND) #################################################################################################### ########### subdirectories ######################################################################### #################################################################################################### add_subdirectory(doc) add_subdirectory(pics) add_subdirectory(profiles) #add_subdirectory(tests) add_subdirectory(plasma) #################################################################################################### ########### definitions: logging ################################################################### #################################################################################################### ecm_qt_declare_logging_category(kmix_debug_SRCS HEADER kmix_debug.h IDENTIFIER KMIX_LOG CATEGORY_NAME org.kde.kmix) #################################################################################################### ########### definitions: DBus adaptor ############################################################## #################################################################################################### set(kmix_adaptor_SRCS dbus/dbusmixerwrapper.cpp dbus/dbusmixsetwrapper.cpp dbus/dbuscontrolwrapper.cpp ) qt5_add_dbus_adaptor( kmix_adaptor_SRCS dbus/org.kde.kmix.control.xml dbus/dbuscontrolwrapper.h DBusControlWrapper ) qt5_add_dbus_adaptor( kmix_adaptor_SRCS dbus/org.kde.kmix.mixer.xml dbus/dbusmixerwrapper.h DBusMixerWrapper ) qt5_add_dbus_adaptor( kmix_adaptor_SRCS dbus/org.kde.kmix.mixset.xml dbus/dbusmixsetwrapper.h DBusMixSetWrapper ) install(FILES dbus/org.kde.kmix.control.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) install(FILES dbus/org.kde.kmix.mixer.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) install(FILES dbus/org.kde.kmix.mixset.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) #################################################################################################### ########### definitions: backends ################################################################## #################################################################################################### set(kmix_backend_SRCS backends/mixer_backend.cpp backends/mixer_mpris2.cpp ) if (HAVE_LIBASOUND2) set(kmix_backend_SRCS ${kmix_backend_SRCS} backends/mixer_alsa9.cpp ) endif (HAVE_LIBASOUND2) if (PulseAudio_FOUND) set(kmix_backend_SRCS ${kmix_backend_SRCS} backends/mixer_pulse.cpp ) endif (PulseAudio_FOUND) #################################################################################################### ########### target: kmixcore library ############################################################### #################################################################################################### set(kmixcore_SRCS core/MediaController.cpp core/mixertoolbox.cpp core/kmixdevicemanager.cpp core/ControlManager.cpp core/GlobalConfig.cpp core/MasterControl.cpp core/mixer.cpp core/mixset.cpp core/mixdevice.cpp core/mixdevicecomposite.cpp core/volume.cpp ) add_library(kmixcore SHARED ${kmixcore_SRCS} ${kmix_adaptor_SRCS} ${kmix_backend_SRCS} ${kmix_debug_SRCS} ) target_link_libraries(kmixcore PUBLIC Qt5::Core Qt5::Widgets PRIVATE Qt5::DBus KF5::I18n PUBLIC KF5::ConfigCore KF5::ConfigGui ) set_target_properties(kmixcore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) generate_export_header(kmixcore BASE_NAME kmixcore EXPORT_FILE_NAME kmixcore_export.h) if (HAVE_LIBASOUND2) target_link_libraries(kmixcore PRIVATE ${ALSA_LIBRARIES}) endif (HAVE_LIBASOUND2) if (PulseAudio_FOUND) target_link_libraries(kmixcore PRIVATE ${PulseAudio_LIBRARIES} ${PulseAudio_MAINLOOP_LIBRARY} ${GLIB2_LIBRARIES}) endif (PulseAudio_FOUND) if (CANBERRA_FOUND) target_link_libraries(kmixcore PRIVATE ${CANBERRA_LIBRARIES}) endif (CANBERRA_FOUND) install(TARGETS kmixcore DESTINATION ${KDE_INSTALL_LIBDIR} LIBRARY NAMELINK_SKIP) #################################################################################################### ########### target: kmixgui library ################################################################ #################################################################################################### set(kmixgui_SRCS gui/dialogbase.cpp gui/dialogstatesaver.cpp gui/kmixdockwidget.cpp gui/kmixprefdlg.cpp gui/viewbase.cpp gui/viewdockareapopup.cpp gui/viewsliders.cpp gui/mixdevicewidget.cpp gui/mdwmoveaction.cpp gui/mdwslider.cpp gui/mdwenum.cpp gui/kmixerwidget.cpp gui/ksmallslider.cpp gui/verticaltext.cpp gui/volumeslider.cpp gui/kmixtoolbox.cpp gui/dialogaddview.cpp gui/dialogviewconfiguration.cpp gui/dialogselectmaster.cpp gui/dialogchoosebackends.cpp gui/guiprofile.cpp ) add_library(kmixgui STATIC ${kmixgui_SRCS} ${kmix_debug_SRCS} ) target_link_libraries(kmixgui kmixcore Qt5::Core Qt5::Widgets KF5::I18n KF5::ConfigCore KF5::ConfigGui KF5::IconThemes KF5::GlobalAccel KF5::Notifications KF5::XmlGui KF5::WindowSystem ) #################################################################################################### ########### target: kmix ########################################################################### #################################################################################################### set(kmix_SRCS apps/main.cpp apps/kmix.cpp apps/KMixApp.cpp ${kmix_debug_SRCS} ) -kf5_add_kdeinit_executable(kmix ${kmix_SRCS}) -target_link_libraries(kdeinit_kmix +add_executable(kmix ${kmix_SRCS}) +target_link_libraries(kmix kmixcore kmixgui KF5::I18n KF5::IconThemes KF5::DBusAddons KF5::GlobalAccel KF5::XmlGui KF5::Notifications KF5::WindowSystem ) -install(TARGETS kdeinit_kmix DESTINATION ${KDE_INSTALL_LIBDIR}) -target_link_libraries( kmix kdeinit_kmix) install(TARGETS kmix ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES desktop/kmixui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kmix) install(PROGRAMS desktop/org.kde.kmix.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES desktop/org.kde.kmix.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) install(FILES desktop/kmix_autostart.desktop DESTINATION ${KDE_INSTALL_AUTOSTARTDIR}) install(FILES desktop/kmix.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} ) #################################################################################################### ########### target: kded_kmixd ##################################################################### #################################################################################################### set(kmixd_SRCS apps/kmixd.cpp ${kmix_debug_SRCS} ) add_library(kded_kmixd MODULE ${kmixd_SRCS}) set_target_properties(kded_kmixd PROPERTIES OUTPUT_NAME kmixd) kcoreaddons_desktop_to_json(kded_kmixd desktop/kmixd.desktop) target_link_libraries(kded_kmixd kmixcore KF5::I18n KF5::CoreAddons KF5::DBusAddons ) install(TARGETS kded_kmixd DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) #################################################################################################### ########### target: kmixctrl ####################################################################### #################################################################################################### set(kmixctrl_SRCS apps/kmixctrl.cpp ${kmix_debug_SRCS} ) -kf5_add_kdeinit_executable(kmixctrl ${kmixctrl_SRCS}) -target_link_libraries(kdeinit_kmixctrl +add_executable(kmixctrl ${kmixctrl_SRCS}) +target_link_libraries(kmixctrl kmixcore KF5::I18n KF5::CoreAddons ) -install(TARGETS kdeinit_kmixctrl DESTINATION ${KDE_INSTALL_LIBDIR}) -target_link_libraries(kmixctrl kdeinit_kmixctrl) install(TARGETS kmixctrl ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES desktop/kmixctrl_restore.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) #################################################################################################### ########### other installs ######################################################################### #################################################################################################### install(PROGRAMS apps/kmixremote DESTINATION ${KDE_INSTALL_BINDIR}) install(FILES desktop/restore_kmix_volumes.desktop DESTINATION ${KDE_INSTALL_AUTOSTARTDIR}) #################################################################################################### ########### end #################################################################################### #################################################################################################### feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/apps/kmixctrl.cpp b/apps/kmixctrl.cpp index 779aef5c..ec98953e 100644 --- a/apps/kmixctrl.cpp +++ b/apps/kmixctrl.cpp @@ -1,92 +1,90 @@ /* * kmixctrl - kmix volume save/restore utility * * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "core/mixertoolbox.h" #include #include #include #include #include #include "gui/kmixtoolbox.h" #include "core/GlobalConfig.h" #include "core/mixer.h" #include "core/version.h" static const char description[] = I18N_NOOP("kmixctrl - kmix volume save/restore utility"); -extern "C" int -Q_DECL_EXPORT -kdemain(int argc, char *argv[]) +int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); KLocalizedString::setApplicationDomain("kmix"); KAboutData aboutData("kmixctrl", i18n("KMixCtrl"), APP_VERSION, i18n(description), KAboutLicense::GPL, i18n("(c) 2000 by Stefan Schimanski")); aboutData.addAuthor(i18n("Stefan Schimanski"), QString(), "1Stein@gmx.de"); KAboutData::setApplicationData(aboutData); QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.addOption(QCommandLineOption((QStringList() << "s" << "save"), i18n("Save current volumes as default"))); parser.addOption(QCommandLineOption((QStringList() << "r" << "restore"), i18n("Restore default volumes"))); parser.process(app); GlobalConfig::init(); // create mixers QString dummyStringHwinfo; MixerToolBox::instance()->initMixer(false, QList(), dummyStringHwinfo, false); // load volumes if ( parser.isSet("restore") ) { for (int i=0; ivolumeLoad(KSharedConfig::openConfig().data()); } } // save volumes if (parser.isSet("save")) { for (int i = 0; i < Mixer::mixers().count(); ++i) { Mixer *mixer = (Mixer::mixers())[i]; KSharedConfig::Ptr cfg = KSharedConfig::openConfig(); qCDebug(KMIX_LOG) << "save " << cfg->name(); mixer->volumeSave(cfg.data()); } } MixerToolBox::instance()->deinitMixer(); return 0; } diff --git a/apps/main.cpp b/apps/main.cpp index fd2b5e82..a84d0146 100644 --- a/apps/main.cpp +++ b/apps/main.cpp @@ -1,88 +1,86 @@ /* * KMix -- KDE's full featured mini mixer * * * Copyright (C) 2000 Stefan Schimanski * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include "KMixApp.h" #include "core/version.h" #include "kmix_debug.h" static const char description[] = I18N_NOOP("KMix - KDE's full featured mini mixer"); -extern "C" int -Q_DECL_EXPORT -kdemain(int argc, char *argv[]) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); KLocalizedString::setApplicationDomain("kmix"); KAboutData aboutData("kmix", i18n("KMix"), APP_VERSION, i18n(description), KAboutLicense::GPL, i18n("(c) 1996-2013 The KMix Authors")); // Author Policy: Long-term maintainers and backend writers/maintainers go in the Authors list. aboutData.addAuthor(i18n("Christian Esken") , i18n("Original author and current maintainer"), "esken@kde.org"); aboutData.addAuthor(i18n("Colin Guthrie") , i18n("PulseAudio support"), "colin@mageia.org"); aboutData.addAuthor(i18n("Helio Chissini de Castro"), i18n("ALSA 0.9x port"), "helio@kde.org" ); aboutData.addAuthor(i18n("Brian Hanson") , i18n("Solaris support"), "bhanson@hotmail.com"); // The HP/UX port is not maintained anymore, and no official part of KMix anymore // aboutData.addAuthor(i18n("Helge Deller") , i18n("HP/UX port"), "deller@gmx.de"); // The initial support was for ALSA 0.5. The new code is not based on it IIRC. // aboutData.addAuthor(i18n("Nick Lopez") , i18n("Initial ALSA port"), "kimo_sabe@usa.net"); // Credit Policy: Authors who did a discrete part, like the Dataengine, OSD, help on specific platforms or soundcards. aboutData.addCredit(i18n("Igor Poboiko") , i18n("Plasma Dataengine"), "igor.poboiko@gmail.com"); aboutData.addCredit(i18n("Stefan Schimanski") , i18n("Temporary maintainer"), "schimmi@kde.org"); aboutData.addCredit(i18n("Sebestyen Zoltan") , i18n("*BSD fixes"), "szoli@digo.inf.elte.hu"); aboutData.addCredit(i18n("Lennart Augustsson"), i18n("*BSD fixes"), "augustss@cs.chalmers.se"); aboutData.addCredit(i18n("Nadeem Hasan") , i18n("Mute and volume preview, other fixes"), "nhasan@kde.org"); aboutData.addCredit(i18n("Erwin Mascher") , i18n("Improving support for emu10k1 based soundcards")); aboutData.addCredit(i18n("Valentin Rusu") , i18n("TerraTec DMX6Fire support"), "kde@rusu.info"); aboutData.setOrganizationDomain(QByteArray("kde.org")); aboutData.setDesktopFileName(QStringLiteral("org.kde.kmix")); KAboutData::setApplicationData(aboutData); // Implement running as a unique application KDBusService service(KDBusService::Unique); KMixApp kmapp; // continues here if unique QObject::connect(&service, &KDBusService::activateRequested, &kmapp, &KMixApp::newInstance); // Now known to be the first or only instance of the application QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.addOption(QCommandLineOption("keepvisibility", i18n("Inhibits the unhiding of the KMix main window, if KMix is already running."))); parser.addOption(QCommandLineOption("failsafe", i18n("Starts KMix in failsafe mode."))); parser.process(qapp); kmapp.parseOptions(parser); // pass options for startup kmapp.newInstance(); int ret = qapp.exec(); qCDebug(KMIX_LOG) << "KMix is now exiting, status=" << ret; return ret; }