diff options
author | xerus2000 <27jf@pm.me> | 2020-11-13 21:35:08 +0100 |
---|---|---|
committer | xerus2000 <27jf@pm.me> | 2020-11-13 21:35:08 +0100 |
commit | 8e18c532f3bb04177093581f2ec1bc993225079e (patch) | |
tree | 56b4492feeaa7ca036de3b9cd91bc0e566c78d36 | |
parent | 2d9dcff9256b8b092af0d6d89f94b797e441c95a (diff) | |
parent | 3a9048073bf045c40ae015d61634bf6248540ce2 (diff) |
Merge remote-tracking branch 'upstream/2.3' into cleanup-headers
91 files changed, 677 insertions, 522 deletions
diff --git a/.github/workflows/clazy.yml b/.github/workflows/clazy.yml new file mode 100644 index 0000000000..3b07644b6f --- /dev/null +++ b/.github/workflows/clazy.yml @@ -0,0 +1,25 @@ +name: clazy + +on: + push: + pull_request: + +jobs: + clazy: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install build dependencies + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libavformat-dev libchromaprint-dev libebur128-dev libfftw3-dev libflac-dev libid3tag0-dev liblilv-dev libmad0-dev libmodplug-dev libmp3lame-dev libopus-dev libopusfile-dev libportmidi-dev libprotobuf-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev librubberband-dev libshout3-dev libsndfile1-dev libsoundtouch-dev libsqlite3-dev libtag1-dev libupower-glib-dev libusb-1.0-0-dev libwavpack-dev portaudio19-dev protobuf-compiler qt5-default qtscript5-dev qt5keychain-dev clazy cmake + - name: Build + run: | + mkdir cmake_build + cd cmake_build + # Disable optimizations as workaround for Clang 9 bug: https://bugs.llvm.org/show_bug.cgi?id=45034 + cmake -DCMAKE_BUILD_TYPE=Debug -DWARNINGS_FATAL=ON -DOPTIMIZE=off -DBATTERY=ON -DBROADCAST=ON -DBULK=ON -DHID=ON -DLILV=ON -DOPUS=ON -DQTKEYCHAIN=ON -DVINYLCONTROL=ON -DFFMPEG=ON -DKEYFINDER=ON -DLOCALECOMPARE=ON -DMAD=ON -DMODPLUG=ON -DWAVPACK=ON .. + cmake --build . -j $(nproc) + env: + LD: clang++ + CC: clang + CXX: clazy + CLAZY_CHECKS: range-loop diff --git a/.travis.yml b/.travis.yml index 8328ef8d68..ebbc68a195 100644 --- a/.travis.yml +++ b/.travis.yml @@ -149,7 +149,7 @@ jobs: - ccache env: >- MIXXX_ENVPATH="${HOME}/buildenv" - CMAKEFLAGS_EXTRA="-DCOREAUDIO=ON -DHSS1394=ON -DMACOS_BUNDLE=ON" + CMAKEFLAGS_EXTRA="-DCOREAUDIO=ON -DHSS1394=ON" PATH="/usr/local/opt/ccache/bin:$PATH" CMAKE_BUILD_PARALLEL_LEVEL=4 CTEST_PARALLEL_LEVEL=1 @@ -182,7 +182,7 @@ jobs: install: - mkdir cmake_build - cd cmake_build - - cmake -L $CMAKEFLAGS $CMAKEFLAGS_EXTRA -DCMAKE_PREFIX_PATH=${MIXXX_ENVPATH} -DQt5_DIR=${QT_DIR} -DAPPLE_CODESIGN_IDENTITY=${APPLE_CODESIGN_IDENTITY} .. + - cmake -L $CMAKEFLAGS $CMAKEFLAGS_EXTRA -DMACOS_BUNDLE=ON -DCMAKE_PREFIX_PATH=${MIXXX_ENVPATH} -DQt5_DIR=${QT_DIR} -DAPPLE_CODESIGN_IDENTITY=${APPLE_CODESIGN_IDENTITY} .. - cmake --build . - cpack -G DragNDrop -V # cpack codesigns the Mixxx.app inside the DMG package, but the DMG package also needs to be signed diff --git a/CMakeLists.txt b/CMakeLists.txt index bd74736d06..2c7aa95671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -979,6 +979,15 @@ target_compile_definitions(mixxx-lib PUBLIC $<$<NOT:$<CONFIG:Debug>>:NDEBUG> ) +# Mac-specific options +if(APPLE) + option(MACOS_BUNDLE "Install files to proper locations to make an .app bundle" OFF) + option(MACAPPSTORE "Build for Mac App Store" OFF) + if(MACAPPSTORE) + target_compile_definitions(mixxx-lib PUBLIC __MACAPPSTORE__) + endif() +endif() + # # Installation directories # @@ -1038,8 +1047,10 @@ elseif(UNIX) target_compile_definitions(mixxx-lib PUBLIC __APPLE__) else() target_compile_definitions(mixxx-lib PRIVATE __UNIX__) + # UNIX_SHARE_PATH must be set to the absolute path + # including the install prefix! target_compile_definitions( - mixxx-lib PUBLIC UNIX_SHARE_PATH="${MIXXX_INSTALL_DATADIR}") + mixxx-lib PUBLIC UNIX_SHARE_PATH="${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}") if(CMAKE_SYSTEM_NAME STREQUAL Linux) target_compile_definitions(mixxx-lib PUBLIC __LINUX__) elseif(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$") @@ -1062,7 +1073,7 @@ if (APPLE) set(MACOS_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}") set(MACOS_BUNDLE_SHORTVERSION "${CMAKE_PROJECT_VERSION}") set(MACOS_BUNDLE_MINOSVERSION "10.11.0") - + set_target_properties(mixxx PROPERTIES MACOSX_BUNDLE true MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos_bundle.plist.in" @@ -2246,15 +2257,6 @@ if(MAD) target_link_libraries(mixxx-lib PUBLIC MAD::MAD ID3Tag::ID3Tag) endif() -# Mac App Store -if(APPLE) - option(MACAPPSTORE "Build for Mac App Store" OFF) - if(MACAPPSTORE) - target_compile_definitions(mixxx-lib PUBLIC __MACAPPSTORE__) - endif() - option(MACOS_BUNDLE "Install files to proper locations to make an .app bundle" OFF) -endif() - # Media Foundation AAC Decoder Plugin find_package(MediaFoundation) cmake_dependent_option(MEDIAFOUNDATION "Media Foundation AAC decoder plugin (Windows Vista with KB2117917 or Windows 7 required)" ON "MediaFoundation_FOUND" OFF) @@ -2411,7 +2413,7 @@ set(CPACK_PACKAGE_VENDOR "Mixxx Project") set(CPACK_PACKAGE_CONTACT "RJ Skerry-Ryan <rryan@mixxx.org>") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack_package_description.txt") set(CPACK_PACKAGE_INSTALL_DIRECTORY "Mixxx") -set(CPACK_PACKAGE_EXECUTABLES "mixxx") +set(CPACK_PACKAGE_EXECUTABLES "mixxx;Mixxx") set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/res/images/mixxx_install_logo.bmp") set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.mixxx.org/") set(CPACK_PACKAGE_FILE_NAME "Mixxx-${GIT_BRANCH}-r${GIT_COMMIT_COUNT}-${GIT_COMMIT_HASH}") diff --git a/src/analyzer/analyzerbeats.cpp b/src/analyzer/analyzerbeats.cpp index 953e7af77f..62b98115cb 100644 --- a/src/analyzer/analyzerbeats.cpp +++ b/src/analyzer/analyzerbeats.cpp @@ -25,8 +25,9 @@ QList<mixxx::AnalyzerPluginInfo> AnalyzerBeats::availablePlugins() { // static mixxx::AnalyzerPluginInfo AnalyzerBeats::defaultPlugin() { - DEBUG_ASSERT(availablePlugins().size() > 0); - return availablePlugins().at(0); + const auto plugins = availablePlugins(); + DEBUG_ASSERT(!plugins.isEmpty()); + return plugins.at(0); } AnalyzerBeats::AnalyzerBeats(UserSettingsPointer pConfig, bool enforceBpmDetection) @@ -72,10 +73,11 @@ bool AnalyzerBeats::initialize(TrackPointer tio, int sampleRate, int totalSample m_bPreferencesReanalyzeImported = m_bpmSettings.getReanalyzeImported(); m_bPreferencesFastAnalysis = m_bpmSettings.getFastAnalysis(); - if (availablePlugins().size() > 0) { + const auto plugins = availablePlugins(); + if (!plugins.isEmpty()) { m_pluginId = defaultPlugin().id; QString pluginId = m_bpmSettings.getBeatPluginId(); - for (const auto& info : availablePlugins()) { + for (const auto& info : plugins) { if (info.id == pluginId) { m_pluginId = pluginId; // configured Plug-In available break; diff --git a/src/analyzer/analyzerkey.cpp b/src/analyzer/analyzerkey.cpp index 38e3bc2c89..fc9bb3ee09 100644 --- a/src/analyzer/analyzerkey.cpp +++ b/src/analyzer/analyzerkey.cpp @@ -25,8 +25,9 @@ QList<mixxx::AnalyzerPluginInfo> AnalyzerKey::availablePlugins() { // static mixxx::AnalyzerPluginInfo AnalyzerKey::defaultPlugin() { - DEBUG_ASSERT(availablePlugins().size() > 0); - return availablePlugins().at(0); + const auto plugins = availablePlugins(); + DEBUG_ASSERT(!plugins.isEmpty()); + return plugins.at(0); } AnalyzerKey::AnalyzerKey(KeyDetectionSettings keySettings) @@ -54,10 +55,11 @@ bool AnalyzerKey::initialize(TrackPointer tio, int sampleRate, int totalSamples) m_bPreferencesFastAnalysisEnabled = m_keySettings.getFastAnalysis(); m_bPreferencesReanalyzeEnabled = m_keySettings.getReanalyzeWhenSettingsChange(); - if (availablePlugins().size() > 0) { + const auto plugins = availablePlugins(); + if (!plugins.isEmpty()) { m_pluginId = defaultPlugin().id; QString pluginId = m_keySettings.getKeyPluginId(); - for (const auto& info : availablePlugins()) { + for (const auto& info : plugins) { if (info.id == pluginId) { m_pluginId = pluginId; // configured Plug-In available break; diff --git a/src/broadcast/broadcastmanager.cpp b/src/broadcast/broadcastmanager.cpp index 71958f08c3..0831d806cf 100644 --- a/src/broadcast/broadcastmanager.cpp +++ b/src/broadcast/broadcastmanager.cpp @@ -43,7 +43,7 @@ BroadcastManager::BroadcastManager(SettingsManager* pSettingsManager, // Initialize connections list from the current state of BroadcastSettings QList<BroadcastProfilePtr> profiles = m_pBroadcastSettings->profiles(); - for(BroadcastProfilePtr profile : profiles) { + for (const BroadcastProfilePtr& profile : profiles) { addConnection(profile); } @@ -99,7 +99,7 @@ void BroadcastManager::slotControlEnabled(double v) { if (v > 0.0) { bool atLeastOneEnabled = false; QList<BroadcastProfilePtr> profiles = m_pBroadcastSettings->profiles(); - for(BroadcastProfilePtr profile : profiles) { + for (const BroadcastProfilePtr& profile : profiles) { if (profile->getEnabled()) { atLeastOneEnabled = true; break; @@ -138,7 +138,7 @@ void BroadcastManager::slotProfileRemoved(BroadcastProfilePtr profile) { void BroadcastManager::slotProfilesChanged() { QVector<NetworkOutputStreamWorkerPtr> workers = m_pNetworkStream->outputWorkers(); - for(NetworkOutputStreamWorkerPtr pWorker : workers) { + for (const NetworkOutputStreamWorkerPtr& pWorker : workers) { ShoutConnectionPtr connection = qSharedPointerCast<ShoutConnection>(pWorker); if (connection) { BroadcastProfilePtr profile = connection->profile(); @@ -197,7 +197,7 @@ bool BroadcastManager::removeConnection(BroadcastProfilePtr profile) { ShoutConnectionPtr BroadcastManager::findConnectionForProfile(BroadcastProfilePtr profile) { QVector<NetworkOutputStreamWorkerPtr> workers = m_pNetworkStream->outputWorkers(); - for(NetworkOutputStreamWorkerPtr pWorker : workers) { + for (const NetworkOutputStreamWorkerPtr& pWorker : workers) { ShoutConnectionPtr connection = qSharedPointerCast<ShoutConnection>(pWorker); if (connection.isNull()) continue; diff --git a/src/control/controlobjectscript.cpp b/src/control/controlobjectscript.cpp index d95d0c0176..429a4d0230 100644 --- a/src/control/controlobjectscript.cpp +++ b/src/control/controlobjectscript.cpp @@ -22,7 +22,7 @@ bool ControlObjectScript::addScriptConnection(const ScriptConnection& conn) { Qt::QueuedConnection); } - for (const auto& priorConnection: m_scriptConnections) { + for (const auto& priorConnection : qAsConst(m_scriptConnections)) { if (conn == priorConnection) { qWarning() << "Connection " + conn.id.toString() + " already connected to (" + diff --git a/src/controllers/controllerinputmappingtablemodel.cpp b/src/controllers/controllerinputmappingtablemodel.cpp index cd143383aa..73db610044 100644 --- a/src/controllers/controllerinputmappingtablemodel.cpp +++ b/src/controllers/controllerinputmappingtablemodel.cpp @@ -19,7 +19,7 @@ void ControllerInputMappingTableModel::apply() { // Clear existing input mappings and insert all the input mappings in // the table into the preset. QMultiHash<uint16_t, MidiInputMapping> mappings; - for (const MidiInputMapping& mapping : m_midiInputMappings) { + for (const MidiInputMapping& mapping : qAsConst(m_midiInputMappings)) { // There can be multiple input mappings for the same input // MidiKey, so we need to use a QMultiHash here. mappings.insert(mapping.key.key, mapping); diff --git a/src/controllers/controllermanager.cpp b/src/controllers/controllermanager.cpp index ef113ce820..bf68c1513d 100644 --- a/src/controllers/controllermanager.cpp +++ b/src/controllers/controllermanager.cpp @@ -347,7 +347,7 @@ void ControllerManager::pollDevices() { } mixxx::Duration start = mixxx::Time::elapsed(); - for (Controller* pDevice : m_controllers) { + for (Controller* pDevice : qAsConst(m_controllers)) { if (pDevice->isOpen() && pDevice->isPolling()) { pDevice->poll(); } diff --git a/src/controllers/controlleroutputmappingtablemodel.cpp b/src/controllers/controlleroutputmappingtablemodel.cpp index 1ae8b1dd73..676442cb1e 100644 --- a/src/controllers/controlleroutputmappingtablemodel.cpp +++ b/src/controllers/controlleroutputmappingtablemodel.cpp @@ -19,7 +19,7 @@ void ControllerOutputMappingTableModel::apply() { // Clear existing output mappings and insert all the output mappings in // the table into the preset. QMultiHash<ConfigKey, MidiOutputMapping> mappings; - for (const MidiOutputMapping& mapping : m_midiOutputMappings) { + for (const MidiOutputMapping& mapping : qAsConst(m_midiOutputMappings)) { // There can be multiple output mappings for the same output // control, so we need to use a QMultiHash here. mappings.insert(mapping.controlKey, |