From 4e1bebf0f5e06ecdd99c41771e7b4ee19c0cdcf3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Nov 2020 20:02:14 +0100 Subject: [PATCH 1/3] Pass non-trivial/large function args by reference Fixes a bunch of `-Wclazy-function-args-by-ref` warnings. See https://github.com/KDE/clazy/blob/master/docs/checks/README-function-args-by-ref.md for details. Most of these changes are automated, using the clazy fixit by setting the `CLAZY_EXPORT_FIXES` before compilation and then running: $ mkdir /tmp/patch $ find ../src -iname "*.yaml" -exec mv {} /tmp/patch \; $ clang-apply-replacements /tmp/patch --- src/analyzer/analyzerbeats.cpp | 2 +- src/analyzer/analyzerbeats.h | 2 +- src/analyzer/analyzerkey.cpp | 4 +- src/analyzer/analyzerkey.h | 4 +- src/analyzer/analyzerwaveform.cpp | 2 +- src/analyzer/analyzerwaveform.h | 2 +- src/analyzer/plugins/buffering_utils.cpp | 4 +- src/analyzer/plugins/buffering_utils.h | 2 +- src/control/control.cpp | 2 +- src/control/control.h | 2 +- src/control/controlaudiotaperpot.cpp | 8 +- src/control/controlaudiotaperpot.h | 2 +- src/control/controleffectknob.cpp | 2 +- src/control/controleffectknob.h | 2 +- src/control/controlencoder.cpp | 2 +- src/control/controlencoder.h | 2 +- src/control/controlindicator.cpp | 2 +- src/control/controlindicator.h | 2 +- src/control/controllinpotmeter.cpp | 10 +- src/control/controllinpotmeter.h | 8 +- src/control/controllogpotmeter.cpp | 4 +- src/control/controllogpotmeter.h | 2 +- src/control/controlobject.cpp | 7 +- src/control/controlobject.h | 8 +- src/control/controlpotmeter.cpp | 14 +- src/control/controlpotmeter.h | 14 +- src/control/controlpushbutton.cpp | 2 +- src/control/controlpushbutton.h | 2 +- src/control/controlttrotary.cpp | 3 +- src/control/controlttrotary.h | 2 +- src/controllers/bulk/bulkcontroller.cpp | 2 +- src/controllers/bulk/bulkcontroller.h | 4 +- src/controllers/colormapper.h | 2 +- src/controllers/colormapperjsproxy.cpp | 3 +- src/controllers/colormapperjsproxy.h | 2 +- src/controllers/controller.cpp | 5 +- src/controllers/controller.h | 10 +- src/controllers/controllerengine.cpp | 61 ++-- src/controllers/controllerengine.h | 73 ++--- src/controllers/controllermanager.cpp | 4 +- src/controllers/controllermanager.h | 2 +- src/controllers/controllerpreset.h | 20 +- .../controllerpresetfilehandler.cpp | 6 +- src/controllers/controllerpresetfilehandler.h | 4 +- src/controllers/controlpickermenu.cpp | 129 ++++---- src/controllers/controlpickermenu.h | 97 ++++-- src/controllers/dlgcontrollerlearning.cpp | 6 +- src/controllers/dlgcontrollerlearning.h | 4 +- src/controllers/dlgprefcontroller.cpp | 2 +- src/controllers/dlgprefcontroller.h | 2 +- src/controllers/hid/hidcontroller.cpp | 2 +- src/controllers/hid/hidcontroller.h | 2 +- src/controllers/midi/hss1394controller.cpp | 10 +- src/controllers/midi/hss1394controller.h | 5 +- src/controllers/midi/midicontroller.cpp | 2 +- src/controllers/midi/midicontroller.h | 4 +- src/controllers/midi/midicontrollerpreset.cpp | 6 +- src/controllers/midi/midicontrollerpreset.h | 6 +- src/controllers/midi/midimessage.h | 2 +- src/controllers/midi/portmidicontroller.cpp | 2 +- src/controllers/midi/portmidicontroller.h | 2 +- src/controllers/midi/portmidienumerator.cpp | 20 +- src/controllers/midi/portmidienumerator.h | 4 +- src/dialog/dlgreplacecuecolor.h | 2 +- src/effects/builtin/echoeffect.h | 6 +- src/effects/effectinstantiator.h | 7 +- src/effects/lv2/lv2effectprocessor.cpp | 16 +- src/effects/lv2/lv2effectprocessor.h | 8 +- src/encoder/encoder.cpp | 7 +- src/encoder/encoder.h | 11 +- src/encoder/encoderflacsettings.cpp | 4 +- src/encoder/encoderflacsettings.h | 4 +- src/encoder/encodermp3.cpp | 2 +- src/encoder/encodermp3.h | 2 +- src/encoder/encodermp3settings.cpp | 6 +- src/encoder/encodermp3settings.h | 4 +- src/encoder/encoderopus.cpp | 2 +- src/encoder/encoderopus.h | 2 +- src/encoder/encoderopussettings.cpp | 4 +- src/encoder/encoderopussettings.h | 4 +- src/encoder/encoderrecordingsettings.h | 2 +- src/encoder/encodersettings.h | 16 +- src/encoder/encodervorbis.cpp | 2 +- src/encoder/encodervorbis.h | 2 +- src/encoder/encoderwave.cpp | 3 +- src/encoder/encoderwave.h | 2 +- src/encoder/encoderwavesettings.cpp | 4 +- src/encoder/encoderwavesettings.h | 4 +- src/engine/cachingreader/cachingreader.cpp | 2 +- src/engine/cachingreader/cachingreader.h | 6 +- .../cachingreader/cachingreaderworker.cpp | 2 +- .../cachingreader/cachingreaderworker.h | 4 +- src/engine/channels/engineaux.cpp | 8 +- src/engine/channels/engineaux.h | 9 +- src/engine/channels/enginedeck.cpp | 7 +- src/engine/channels/enginedeck.h | 9 +- src/engine/channels/enginemicrophone.cpp | 8 +- src/engine/channels/enginemicrophone.h | 9 +- src/engine/controls/bpmcontrol.cpp | 2 +- src/engine/controls/bpmcontrol.h | 2 +- src/engine/controls/clockcontrol.cpp | 2 +- src/engine/controls/clockcontrol.h | 4 +- src/engine/controls/cuecontrol.cpp | 8 +- src/engine/controls/cuecontrol.h | 10 +- src/engine/controls/enginecontrol.cpp | 4 +- src/engine/controls/enginecontrol.h | 4 +- src/engine/controls/keycontrol.cpp | 4 +- src/engine/controls/keycontrol.h | 2 +- src/engine/controls/loopingcontrol.cpp | 12 +- src/engine/controls/loopingcontrol.h | 8 +- src/engine/controls/quantizecontrol.cpp | 4 +- src/engine/controls/quantizecontrol.h | 2 +- src/engine/controls/ratecontrol.cpp | 14 +- src/engine/controls/ratecontrol.h | 282 +++++++++--------- src/engine/controls/vinylcontrolcontrol.cpp | 2 +- src/engine/controls/vinylcontrolcontrol.h | 2 +- src/engine/enginebuffer.cpp | 2 +- src/engine/enginebuffer.h | 4 +- src/engine/enginedelay.cpp | 2 +- src/engine/enginedelay.h | 2 +- src/engine/enginemaster.cpp | 12 +- src/engine/enginemaster.h | 12 +- src/engine/enginepregain.cpp | 2 +- src/engine/enginepregain.h | 2 +- src/engine/enginevumeter.cpp | 2 +- src/engine/enginevumeter.h | 2 +- src/engine/positionscratchcontroller.cpp | 22 +- src/engine/positionscratchcontroller.h | 2 +- src/engine/sidechain/enginesidechain.cpp | 6 +- src/engine/sidechain/enginesidechain.h | 6 +- src/engine/sidechain/shoutconnection.cpp | 4 +- src/engine/sidechain/shoutconnection.h | 4 +- src/errordialoghandler.cpp | 6 +- src/errordialoghandler.h | 7 +- src/library/analysisfeature.cpp | 8 +- src/library/analysisfeature.h | 6 +- src/library/autodj/autodjfeature.cpp | 6 +- src/library/autodj/autodjfeature.h | 6 +- src/library/autodj/autodjprocessor.h | 5 +- src/library/autodj/dlgautodj.cpp | 4 +- src/library/autodj/dlgautodj.h | 6 +- src/library/baseexternallibraryfeature.cpp | 3 +- src/library/baseexternallibraryfeature.h | 4 +- src/library/baseexternalplaylistmodel.cpp | 2 +- src/library/baseexternalplaylistmodel.h | 2 +- src/library/baseplaylistfeature.cpp | 2 +- src/library/baseplaylistfeature.h | 4 +- src/library/basesqltablemodel.cpp | 2 +- src/library/basesqltablemodel.h | 2 +- src/library/basetrackcache.cpp | 12 +- src/library/basetrackcache.h | 14 +- src/library/basetracksetfeature.h | 2 +- src/library/basetracktablemodel.cpp | 6 +- src/library/basetracktablemodel.h | 6 +- src/library/browse/browsefeature.cpp | 4 +- src/library/browse/browsefeature.h | 6 +- src/library/browse/browsetablemodel.cpp | 2 +- src/library/browse/browsetablemodel.h | 2 +- src/library/browse/browsethread.cpp | 6 +- src/library/coverartdelegate.h | 3 +- src/library/crate/cratefeature.cpp | 8 +- src/library/crate/cratefeature.h | 9 +- src/library/crate/cratestorage.cpp | 7 +- src/library/crate/cratestorage.h | 4 +- src/library/crate/cratetablemodel.cpp | 2 +- src/library/crate/cratetablemodel.h | 2 +- src/library/dao/autodjcratesdao.cpp | 8 +- src/library/dao/autodjcratesdao.h | 4 +- src/library/dao/directorydao.cpp | 2 +- src/library/dao/playlistdao.cpp | 7 +- src/library/dao/playlistdao.h | 6 +- src/library/dao/trackdao.cpp | 11 +- src/library/dao/trackdao.h | 14 +- src/library/dlganalysis.cpp | 2 +- src/library/dlganalysis.h | 6 +- src/library/dlgtagfetcher.cpp | 7 +- src/library/dlgtagfetcher.h | 6 +- src/library/dlgtrackinfo.cpp | 2 +- src/library/dlgtrackinfo.h | 2 +- src/library/export/trackexportdlg.cpp | 4 +- src/library/export/trackexportdlg.h | 4 +- src/library/export/trackexportwizard.h | 2 +- src/library/export/trackexportworker.cpp | 2 +- src/library/export/trackexportworker.h | 8 +- src/library/itunes/itunesfeature.cpp | 4 +- src/library/itunes/itunesfeature.h | 4 +- src/library/library.cpp | 10 +- src/library/library.h | 12 +- src/library/librarycontrol.cpp | 2 +- src/library/librarycontrol.h | 4 +- src/library/libraryfeature.h | 13 +- src/library/libraryview.h | 2 +- src/library/mixxxlibraryfeature.cpp | 4 +- src/library/mixxxlibraryfeature.h | 4 +- src/library/parser.cpp | 2 +- src/library/parser.h | 7 +- src/library/parsercsv.cpp | 2 +- src/library/parsercsv.h | 2 +- src/library/parserm3u.cpp | 3 +- src/library/parserm3u.h | 2 +- src/library/parserpls.cpp | 2 +- src/library/parserpls.h | 2 +- src/library/playlistfeature.cpp | 11 +- src/library/playlistfeature.h | 10 +- src/library/playlisttablemodel.cpp | 2 +- src/library/playlisttablemodel.h | 2 +- src/library/proxytrackmodel.cpp | 4 +- src/library/proxytrackmodel.h | 4 +- src/library/recording/dlgrecording.cpp | 4 +- src/library/recording/dlgrecording.h | 8 +- src/library/rekordbox/rekordboxfeature.cpp | 33 +- src/library/rekordbox/rekordboxfeature.h | 2 +- src/library/rhythmbox/rhythmboxfeature.cpp | 4 +- src/library/rhythmbox/rhythmboxfeature.h | 4 +- src/library/scanner/libraryscanner.h | 10 +- src/library/scanner/libraryscannerdlg.cpp | 4 +- src/library/scanner/libraryscannerdlg.h | 6 +- src/library/serato/seratofeature.cpp | 4 +- src/library/serato/seratofeature.h | 2 +- src/library/setlogfeature.cpp | 4 +- src/library/setlogfeature.h | 4 +- src/library/sidebarmodel.cpp | 8 +- src/library/sidebarmodel.h | 6 +- src/library/trackcollection.cpp | 6 +- src/library/trackcollection.h | 12 +- src/library/trackloader.cpp | 4 +- src/library/trackloader.h | 6 +- src/library/trackmodel.h | 8 +- src/library/traktor/traktorfeature.cpp | 10 +- src/library/traktor/traktorfeature.h | 12 +- src/mixer/baseplayer.cpp | 2 +- src/mixer/baseplayer.h | 2 +- src/mixer/basetrackplayer.cpp | 2 +- src/mixer/basetrackplayer.h | 2 +- src/mixer/playerinfo.h | 16 +- src/mixer/playermanager.cpp | 14 +- src/mixer/playermanager.h | 18 +- src/mixer/previewdeck.cpp | 2 +- src/mixer/previewdeck.h | 12 +- src/mixer/sampler.cpp | 2 +- src/mixer/sampler.h | 2 +- src/musicbrainz/tagfetcher.cpp | 20 +- src/musicbrainz/tagfetcher.h | 28 +- src/musicbrainz/web/acoustidlookuptask.h | 2 +- .../web/musicbrainzrecordingstask.h | 6 +- src/network/jsonwebtask.h | 2 +- src/network/webtask.h | 8 +- src/preferences/broadcastprofile.h | 2 +- src/preferences/broadcastsettings.cpp | 2 +- src/preferences/broadcastsettings.h | 4 +- src/preferences/broadcastsettingsmodel.cpp | 2 +- src/preferences/broadcastsettingsmodel.h | 2 +- src/preferences/configobject.cpp | 2 +- src/preferences/configobject.h | 4 +- src/preferences/dialog/dlgprefbroadcast.cpp | 2 +- src/preferences/dialog/dlgprefbroadcast.h | 2 +- src/preferences/dialog/dlgprefeq.h | 2 +- src/preferences/dialog/dlgprefinterface.cpp | 2 +- src/preferences/dialog/dlgprefinterface.h | 2 +- src/preferences/dialog/dlgpreflibrary.h | 6 +- src/preferences/dialog/dlgprefsound.cpp | 8 +- src/preferences/dialog/dlgprefsound.h | 4 +- src/preferences/dialog/dlgprefvinyl.cpp | 13 +- src/preferences/dialog/dlgprefvinyl.h | 13 +- src/recording/recordingmanager.cpp | 2 +- src/recording/recordingmanager.h | 4 +- src/skin/colorschemeparser.cpp | 10 +- src/skin/colorschemeparser.h | 5 +- src/skin/skincontext.h | 4 +- src/skin/skinloader.cpp | 2 +- src/skin/skinloader.h | 2 +- src/skin/tooltips.cpp | 4 +- src/skin/tooltips.h | 4 +- src/soundio/sounddevicenotfound.h | 2 +- src/soundio/soundmanager.cpp | 10 +- src/soundio/soundmanager.h | 14 +- src/soundio/soundmanagerutil.h | 35 ++- src/sources/audiosource.cpp | 6 +- src/sources/audiosource.h | 10 +- src/sources/audiosourceproxy.h | 2 +- src/sources/audiosourcestereoproxy.cpp | 2 +- src/sources/audiosourcestereoproxy.h | 2 +- src/sources/metadatasourcetaglib.cpp | 3 +- src/sources/metadatasourcetaglib.h | 4 +- src/sources/readaheadframebuffer.cpp | 6 +- src/sources/readaheadframebuffer.h | 6 +- src/sources/soundsource.cpp | 4 +- src/sources/soundsource.h | 8 +- src/sources/soundsourceffmpeg.cpp | 13 +- src/sources/soundsourceffmpeg.h | 2 +- src/sources/soundsourceflac.cpp | 2 +- src/sources/soundsourceflac.h | 2 +- src/sources/soundsourcem4a.cpp | 2 +- src/sources/soundsourcem4a.h | 2 +- src/sources/soundsourcemediafoundation.cpp | 2 +- src/sources/soundsourcemediafoundation.h | 2 +- src/sources/soundsourcemodplug.cpp | 4 +- src/sources/soundsourcemodplug.h | 2 +- src/sources/soundsourcemp3.cpp | 2 +- src/sources/soundsourcemp3.h | 2 +- src/sources/soundsourceoggvorbis.cpp | 2 +- src/sources/soundsourceoggvorbis.h | 2 +- src/sources/soundsourceopus.cpp | 2 +- src/sources/soundsourceopus.h | 2 +- src/sources/soundsourcesndfile.cpp | 2 +- src/sources/soundsourcesndfile.h | 2 +- src/sources/soundsourcewv.cpp | 2 +- src/sources/soundsourcewv.h | 2 +- src/sources/urlresource.h | 2 +- src/sources/v1/legacyaudiosourceadapter.cpp | 5 +- src/sources/v1/legacyaudiosourceadapter.h | 2 +- src/test/autodjprocessor_test.cpp | 4 +- .../controller_preset_validation_test.cpp | 6 +- src/test/coverartcache_test.cpp | 6 +- src/test/durationutiltest.cpp | 8 +- src/test/enginesynctest.cpp | 10 +- src/test/metadatatest.cpp | 2 +- src/test/midicontrollertest.cpp | 4 +- src/test/playlisttest.cpp | 2 +- src/test/portmidicontroller_test.cpp | 4 +- src/test/replaygaintest.cpp | 4 +- src/test/seratomarkers2test.cpp | 4 +- src/test/signalpathtest.h | 6 +- src/test/soundsourceproviderregistrytest.cpp | 10 +- src/test/trackexport_test.cpp | 6 +- src/test/trackexport_test.h | 8 +- src/track/beatfactory.cpp | 10 +- src/track/beatfactory.h | 17 +- src/track/beatgrid.cpp | 2 +- src/track/beatgrid.h | 2 +- src/track/beatmap.cpp | 4 +- src/track/beatmap.h | 2 +- src/track/beatutils.cpp | 37 ++- src/track/beatutils.h | 38 ++- src/track/cue.cpp | 4 +- src/track/cue.h | 4 +- src/track/cueinfo.cpp | 4 +- src/track/cueinfo.h | 4 +- src/track/globaltrackcache.cpp | 4 +- src/track/globaltrackcache.h | 2 +- src/track/replaygain.cpp | 4 +- src/track/replaygain.h | 4 +- src/track/serato/beatgrid.h | 4 +- src/track/serato/beatsimporter.cpp | 2 +- src/track/serato/beatsimporter.h | 2 +- src/track/serato/markers.h | 2 +- src/track/serato/markers2.h | 8 +- src/track/track.cpp | 2 +- src/track/track.h | 2 +- src/track/trackmetadata.cpp | 7 +- src/track/trackmetadata.h | 12 +- src/track/tracknumbers.cpp | 2 +- src/track/tracknumbers.h | 2 +- src/util/color/colorpalette.h | 8 +- src/util/db/dbconnection.cpp | 6 +- src/util/db/fwdsqlquery.cpp | 6 +- src/util/db/fwdsqlquery.h | 2 +- src/util/db/sqlqueryfinisher.h | 6 +- src/util/db/sqlstorage.h | 4 +- src/util/debug.h | 4 +- src/util/dnd.cpp | 6 +- src/util/dnd.h | 4 +- src/util/translations.h | 9 +- src/util/valuetransformer.cpp | 4 +- src/util/valuetransformer.h | 4 +- src/vinylcontrol/vinylcontrol.cpp | 5 +- src/vinylcontrol/vinylcontrol.h | 2 +- src/vinylcontrol/vinylcontrolprocessor.cpp | 10 +- src/vinylcontrol/vinylcontrolprocessor.h | 7 +- src/vinylcontrol/vinylcontrolxwax.cpp | 2 +- src/vinylcontrol/vinylcontrolxwax.h | 2 +- src/waveform/renderers/waveformmark.cpp | 2 +- .../renderers/waveformwidgetrenderer.cpp | 2 +- .../renderers/waveformwidgetrenderer.h | 4 +- src/waveform/visualplayposition.cpp | 2 +- src/waveform/visualplayposition.h | 2 +- src/waveform/waveform.cpp | 2 +- src/waveform/waveform.h | 6 +- src/waveform/waveformmarklabel.cpp | 11 +- src/waveform/waveformmarklabel.h | 13 +- src/widget/trackdroptarget.h | 4 +- src/widget/wcoverart.h | 4 +- src/widget/wcoverartlabel.cpp | 2 +- src/widget/wcoverartlabel.h | 2 +- src/widget/wcuemenupopup.cpp | 2 +- src/widget/wcuemenupopup.h | 2 +- src/widget/wdisplay.cpp | 6 +- src/widget/wdisplay.h | 2 +- src/widget/wknobcomposed.cpp | 12 +- src/widget/wknobcomposed.h | 4 +- src/widget/wlibrary.cpp | 2 +- src/widget/wlibrary.h | 2 +- src/widget/wlibrarytableview.cpp | 5 +- src/widget/wlibrarytableview.h | 7 +- src/widget/wmainmenubar.h | 2 +- src/widget/woverview.h | 4 +- src/widget/wpixmapstore.cpp | 6 +- src/widget/wpixmapstore.h | 2 +- src/widget/wpushbutton.cpp | 13 +- src/widget/wpushbutton.h | 9 +- src/widget/wrecordingduration.cpp | 2 +- src/widget/wrecordingduration.h | 2 +- src/widget/wsingletoncontainer.cpp | 4 +- src/widget/wsingletoncontainer.h | 4 +- src/widget/wslidercomposed.cpp | 12 +- src/widget/wslidercomposed.h | 4 +- src/widget/wspinny.h | 4 +- src/widget/wstarrating.cpp | 2 +- src/widget/wstarrating.h | 2 +- src/widget/wstatuslight.cpp | 7 +- src/widget/wstatuslight.h | 6 +- src/widget/wtime.cpp | 2 +- src/widget/wtime.h | 2 +- src/widget/wtrackmenu.cpp | 2 +- src/widget/wtrackmenu.h | 4 +- src/widget/wtrackproperty.h | 40 +-- src/widget/wtracktableview.cpp | 2 +- src/widget/wtracktableview.h | 2 +- src/widget/wtracktext.h | 4 +- src/widget/wtrackwidgetgroup.h | 4 +- src/widget/wvumeter.cpp | 8 +- src/widget/wvumeter.h | 4 +- src/widget/wwaveformviewer.h | 4 +- src/widget/wwidgetgroup.cpp | 4 +- src/widget/wwidgetgroup.h | 4 +- 425 files changed, 1506 insertions(+), 1367 deletions(-) diff --git a/src/analyzer/analyzerbeats.cpp b/src/analyzer/analyzerbeats.cpp index 62b98115cbe..67dd45d17fc 100644 --- a/src/analyzer/analyzerbeats.cpp +++ b/src/analyzer/analyzerbeats.cpp @@ -293,7 +293,7 @@ void AnalyzerBeats::storeResults(TrackPointer tio) { // static QHash AnalyzerBeats::getExtraVersionInfo( - QString pluginId, bool bPreferencesFastAnalysis) { + const QString& pluginId, bool bPreferencesFastAnalysis) { QHash extraVersionInfo; extraVersionInfo["vamp_plugin_id"] = pluginId; if (bPreferencesFastAnalysis) { diff --git a/src/analyzer/analyzerbeats.h b/src/analyzer/analyzerbeats.h index 01b9098f289..e0667149e61 100644 --- a/src/analyzer/analyzerbeats.h +++ b/src/analyzer/analyzerbeats.h @@ -35,7 +35,7 @@ class AnalyzerBeats : public Analyzer { private: bool shouldAnalyze(TrackPointer tio) const; static QHash getExtraVersionInfo( - QString pluginId, bool bPreferencesFastAnalysis); + const QString& pluginId, bool bPreferencesFastAnalysis); BeatDetectionSettings m_bpmSettings; std::unique_ptr m_pPlugin; diff --git a/src/analyzer/analyzerkey.cpp b/src/analyzer/analyzerkey.cpp index fc9bb3ee099..a11f711525e 100644 --- a/src/analyzer/analyzerkey.cpp +++ b/src/analyzer/analyzerkey.cpp @@ -30,7 +30,7 @@ mixxx::AnalyzerPluginInfo AnalyzerKey::defaultPlugin() { return plugins.at(0); } -AnalyzerKey::AnalyzerKey(KeyDetectionSettings keySettings) +AnalyzerKey::AnalyzerKey(const KeyDetectionSettings& keySettings) : m_keySettings(keySettings), m_iSampleRate(0), m_iTotalSamples(0), @@ -185,7 +185,7 @@ void AnalyzerKey::storeResults(TrackPointer tio) { // static QHash AnalyzerKey::getExtraVersionInfo( - QString pluginId, bool bPreferencesFastAnalysis) { + const QString& pluginId, bool bPreferencesFastAnalysis) { QHash extraVersionInfo; extraVersionInfo["vamp_plugin_id"] = pluginId; if (bPreferencesFastAnalysis) { diff --git a/src/analyzer/analyzerkey.h b/src/analyzer/analyzerkey.h index 52ba45b88b0..b25fec8b072 100644 --- a/src/analyzer/analyzerkey.h +++ b/src/analyzer/analyzerkey.h @@ -14,7 +14,7 @@ class AnalyzerKey : public Analyzer { public: - explicit AnalyzerKey(KeyDetectionSettings keySettings); + explicit AnalyzerKey(const KeyDetectionSettings& keySettings); ~AnalyzerKey() override = default; static QList availablePlugins(); @@ -27,7 +27,7 @@ class AnalyzerKey : public Analyzer { private: static QHash getExtraVersionInfo( - QString pluginId, bool bPreferencesFastAnalysis); + const QString& pluginId, bool bPreferencesFastAnalysis); bool shouldAnalyze(TrackPointer tio) const; diff --git a/src/analyzer/analyzerwaveform.cpp b/src/analyzer/analyzerwaveform.cpp index f7dba829fce..ec0a6a1b0f8 100644 --- a/src/analyzer/analyzerwaveform.cpp +++ b/src/analyzer/analyzerwaveform.cpp @@ -16,7 +16,7 @@ mixxx::Logger kLogger("AnalyzerWaveform"); AnalyzerWaveform::AnalyzerWaveform( UserSettingsPointer pConfig, - QSqlDatabase dbConnection) + const QSqlDatabase& dbConnection) : m_analysisDao(pConfig), m_waveformData(nullptr), m_waveformSummaryData(nullptr), diff --git a/src/analyzer/analyzerwaveform.h b/src/analyzer/analyzerwaveform.h index c12ccc37232..86b13f2c262 100644 --- a/src/analyzer/analyzerwaveform.h +++ b/src/analyzer/analyzerwaveform.h @@ -139,7 +139,7 @@ class AnalyzerWaveform : public Analyzer { public: AnalyzerWaveform( UserSettingsPointer pConfig, - QSqlDatabase dbConnection); + const QSqlDatabase& dbConnection); ~AnalyzerWaveform() override; bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override; diff --git a/src/analyzer/plugins/buffering_utils.cpp b/src/analyzer/plugins/buffering_utils.cpp index 6edecb5ca46..680b792831e 100644 --- a/src/analyzer/plugins/buffering_utils.cpp +++ b/src/analyzer/plugins/buffering_utils.cpp @@ -7,7 +7,9 @@ namespace mixxx { -bool DownmixAndOverlapHelper::initialize(size_t windowSize, size_t stepSize, WindowReadyCallback callback) { +bool DownmixAndOverlapHelper::initialize(size_t windowSize, + size_t stepSize, + const WindowReadyCallback& callback) { m_buffer.assign(windowSize, 0.0); m_callback = callback; m_windowSize = windowSize; diff --git a/src/analyzer/plugins/buffering_utils.h b/src/analyzer/plugins/buffering_utils.h index 8e4ade0d4de..46598c3373e 100644 --- a/src/analyzer/plugins/buffering_utils.h +++ b/src/analyzer/plugins/buffering_utils.h @@ -19,7 +19,7 @@ class DownmixAndOverlapHelper { bool initialize( size_t windowSize, size_t stepSize, - WindowReadyCallback callback); + const WindowReadyCallback& callback); bool processStereoSamples( const CSAMPLE* pInput, diff --git a/src/control/control.cpp b/src/control/control.cpp index 9b0ae2f9f96..6f988913f39 100644 --- a/src/control/control.cpp +++ b/src/control/control.cpp @@ -18,7 +18,7 @@ QHash ControlDoublePrivate::s_qCOAliasHash MMutex ControlDoublePrivate::s_qCOHashMutex; ControlDoublePrivate::ControlDoublePrivate( - ConfigKey key, + const ConfigKey& key, ControlObject* pCreatorCO, bool bIgnoreNops, bool bTrack, diff --git a/src/control/control.h b/src/control/control.h index da89fafb06b..9f2f89c395f 100644 --- a/src/control/control.h +++ b/src/control/control.h @@ -160,7 +160,7 @@ class ControlDoublePrivate : public QObject { private: ControlDoublePrivate( - ConfigKey key, + const ConfigKey& key, ControlObject* pCreatorCO, bool bIgnoreNops, bool bTrack, diff --git a/src/control/controlaudiotaperpot.cpp b/src/control/controlaudiotaperpot.cpp index d0e55f4d381..9264b67774c 100644 --- a/src/control/controlaudiotaperpot.cpp +++ b/src/control/controlaudiotaperpot.cpp @@ -1,11 +1,11 @@ #include "control/controlaudiotaperpot.h" -ControlAudioTaperPot::ControlAudioTaperPot(ConfigKey key, - double minDB, double maxDB, - double neutralParameter) +ControlAudioTaperPot::ControlAudioTaperPot(const ConfigKey& key, + double minDB, + double maxDB, + double neutralParameter) : ControlPotmeter(key) { - // Override ControlPotmeters default value of 0.5 setDefaultValue(1.0); set(1.0); diff --git a/src/control/controlaudiotaperpot.h b/src/control/controlaudiotaperpot.h index 8ffc6b16440..8c16262d6fc 100644 --- a/src/control/controlaudiotaperpot.h +++ b/src/control/controlaudiotaperpot.h @@ -12,7 +12,7 @@ class ControlAudioTaperPot : public ControlPotmeter { // minDB is the Start value of the pure db scale it cranked to -Infinity by the linear part of the AudioTaperPot // maxDB is the Upper gain Value // neutralParameter is a knob position between 0 and 1 where the gain is 1 (0dB) - ControlAudioTaperPot(ConfigKey key, double minDB, double maxDB, double neutralParameter); + ControlAudioTaperPot(const ConfigKey& key, double minDB, double maxDB, double neutralParameter); }; #endif // CONTROLAUDIOTAPERPOT_H diff --git a/src/control/controleffectknob.cpp b/src/control/controleffectknob.cpp index 169cade841d..cf01306458b 100644 --- a/src/control/controleffectknob.cpp +++ b/src/control/controleffectknob.cpp @@ -3,7 +3,7 @@ #include "util/math.h" #include "effects/effectmanifestparameter.h" -ControlEffectKnob::ControlEffectKnob(ConfigKey key, double dMinValue, double dMaxValue) +ControlEffectKnob::ControlEffectKnob(const ConfigKey& key, double dMinValue, double dMaxValue) : ControlPotmeter(key, dMinValue, dMaxValue) { } diff --git a/src/control/controleffectknob.h b/src/control/controleffectknob.h index eabb38e07b1..b0a10e2ae80 100644 --- a/src/control/controleffectknob.h +++ b/src/control/controleffectknob.h @@ -7,7 +7,7 @@ class ControlEffectKnob : public ControlPotmeter { Q_OBJECT public: - ControlEffectKnob(ConfigKey key, double dMinValue = 0.0, double dMaxValue = 1.0); + ControlEffectKnob(const ConfigKey& key, double dMinValue = 0.0, double dMaxValue = 1.0); void setBehaviour(EffectManifestParameter::ControlHint type, double dMinValue, double dMaxValue); diff --git a/src/control/controlencoder.cpp b/src/control/controlencoder.cpp index be6778c9158..3dd146a6e96 100644 --- a/src/control/controlencoder.cpp +++ b/src/control/controlencoder.cpp @@ -1,6 +1,6 @@ #include "control/controlencoder.h" -ControlEncoder::ControlEncoder(ConfigKey key, bool bIgnoreNops) +ControlEncoder::ControlEncoder(const ConfigKey& key, bool bIgnoreNops) : ControlObject(key, bIgnoreNops) { if (m_pControl) { m_pControl->setBehavior(new ControlEncoderBehavior()); diff --git a/src/control/controlencoder.h b/src/control/controlencoder.h index 1bbd3c986de..a323ac31335 100644 --- a/src/control/controlencoder.h +++ b/src/control/controlencoder.h @@ -7,7 +7,7 @@ class ControlEncoder : public ControlObject { Q_OBJECT public: - ControlEncoder(ConfigKey key, bool bIgnoreNops=true); + ControlEncoder(const ConfigKey& key, bool bIgnoreNops = true); }; #endif diff --git a/src/control/controlindicator.cpp b/src/control/controlindicator.cpp index 1109f2b9710..2d655b02b03 100644 --- a/src/control/controlindicator.cpp +++ b/src/control/controlindicator.cpp @@ -2,7 +2,7 @@ #include "control/controlproxy.h" #include "util/math.h" -ControlIndicator::ControlIndicator(ConfigKey key) +ControlIndicator::ControlIndicator(const ConfigKey& key) : ControlObject(key, false), m_blinkValue(OFF), m_nextSwitchTime(0.0) { diff --git a/src/control/controlindicator.h b/src/control/controlindicator.h index d723c8b8a1b..62ec95b4523 100644 --- a/src/control/controlindicator.h +++ b/src/control/controlindicator.h @@ -15,7 +15,7 @@ class ControlIndicator : public ControlObject { RATIO1TO1_250MS = 3, // used for Pioneer cue }; - ControlIndicator(ConfigKey key); + ControlIndicator(const ConfigKey& key); virtual ~ControlIndicator(); void setBlinkValue(enum BlinkValue bv); diff --git a/src/control/controllinpotmeter.cpp b/src/control/controllinpotmeter.cpp index c3ab24cca53..deaa65f91af 100644 --- a/src/control/controllinpotmeter.cpp +++ b/src/control/controllinpotmeter.cpp @@ -1,9 +1,11 @@ #include "control/controllinpotmeter.h" -ControlLinPotmeter::ControlLinPotmeter(ConfigKey key, - double dMinValue, double dMaxValue, - double dStep, double dSmallStep, - bool allowOutOfBounds) +ControlLinPotmeter::ControlLinPotmeter(const ConfigKey& key, + double dMinValue, + double dMaxValue, + double dStep, + double dSmallStep, + bool allowOutOfBounds) : ControlPotmeter(key, dMinValue, dMaxValue, allowOutOfBounds) { if (m_pControl) { m_pControl->setBehavior( diff --git a/src/control/controllinpotmeter.h b/src/control/controllinpotmeter.h index b958992425b..98c8e955374 100644 --- a/src/control/controllinpotmeter.h +++ b/src/control/controllinpotmeter.h @@ -7,9 +7,11 @@ class ControlLinPotmeter : public ControlPotmeter { Q_OBJECT public: // dStep = 0 and dSmallStep = 0 defaults to 10 and 100 steps - ControlLinPotmeter(ConfigKey key, - double dMinValue = 0.0, double dMaxValue = 1.0, - double dStep = 0, double dSmallStep = 0, + ControlLinPotmeter(const ConfigKey& key, + double dMinValue = 0.0, + double dMaxValue = 1.0, + double dStep = 0, + double dSmallStep = 0, bool allowOutOfBounds = false); }; diff --git a/src/control/controllogpotmeter.cpp b/src/control/controllogpotmeter.cpp index c92b06152dd..b0c4e401631 100644 --- a/src/control/controllogpotmeter.cpp +++ b/src/control/controllogpotmeter.cpp @@ -17,8 +17,8 @@ #include "control/controllogpotmeter.h" -ControlLogpotmeter::ControlLogpotmeter(ConfigKey key, double dMaxValue, double minDB) - : ControlPotmeter(key, 0, dMaxValue) { +ControlLogpotmeter::ControlLogpotmeter(const ConfigKey& key, double dMaxValue, double minDB) + : ControlPotmeter(key, 0, dMaxValue) { // Override ControlPotmeters default value of 0.5 setDefaultValue(1.0); set(1.0); diff --git a/src/control/controllogpotmeter.h b/src/control/controllogpotmeter.h index 1ec4a93e0f0..05e7d6bd933 100644 --- a/src/control/controllogpotmeter.h +++ b/src/control/controllogpotmeter.h @@ -28,7 +28,7 @@ class ControlLogpotmeter : public ControlPotmeter { Q_OBJECT public: - ControlLogpotmeter(ConfigKey key, double dMaxValue, double minDB); + ControlLogpotmeter(const ConfigKey& key, double dMaxValue, double minDB); }; #endif diff --git a/src/control/controlobject.cpp b/src/control/controlobject.cpp index 543046e576e..5aa71b84ce2 100644 --- a/src/control/controlobject.cpp +++ b/src/control/controlobject.cpp @@ -28,8 +28,11 @@ ControlObject::ControlObject() { } -ControlObject::ControlObject(ConfigKey key, bool bIgnoreNops, bool bTrack, - bool bPersist, double defaultValue) +ControlObject::ControlObject(const ConfigKey& key, + bool bIgnoreNops, + bool bTrack, + bool bPersist, + double defaultValue) : m_key(key) { // Don't bother looking up the control if key is invalid. Prevents log spew. if (m_key.isValid()) { diff --git a/src/control/controlobject.h b/src/control/controlobject.h index 22a6d49b936..b6f3ae5f53a 100644 --- a/src/control/controlobject.h +++ b/src/control/controlobject.h @@ -35,9 +35,11 @@ class ControlObject : public QObject { // bPersist: Store value on exit, load on startup. // defaultValue: default value of CO. If CO is persistent and there is no valid // value found in the config, this is also the initial value. - ControlObject(ConfigKey key, - bool bIgnoreNops = true, bool bTrack = false, - bool bPersist = false, double defaultValue = 0.0); + ControlObject(const ConfigKey& key, + bool bIgnoreNops = true, + bool bTrack = false, + bool bPersist = false, + double defaultValue = 0.0); virtual ~ControlObject(); // Returns a pointer to the ControlObject matching the given ConfigKey diff --git a/src/control/controlpotmeter.cpp b/src/control/controlpotmeter.cpp index 9ac26c01e13..a62b77ef431 100644 --- a/src/control/controlpotmeter.cpp +++ b/src/control/controlpotmeter.cpp @@ -19,12 +19,14 @@ #include "control/controlpotmeter.h" #include "control/controlproxy.h" -ControlPotmeter::ControlPotmeter(ConfigKey key, double dMinValue, double dMaxValue, - bool allowOutOfBounds, - bool bIgnoreNops, - bool bTrack, - bool bPersist, - double defaultValue) +ControlPotmeter::ControlPotmeter(const ConfigKey& key, + double dMinValue, + double dMaxValue, + bool allowOutOfBounds, + bool bIgnoreNops, + bool bTrack, + bool bPersist, + double defaultValue) : ControlObject(key, bIgnoreNops, bTrack, bPersist, defaultValue), m_controls(key) { setRange(dMinValue, dMaxValue, allowOutOfBounds); diff --git a/src/control/controlpotmeter.h b/src/control/controlpotmeter.h index ef56a8eb2a7..a3dee755c73 100644 --- a/src/control/controlpotmeter.h +++ b/src/control/controlpotmeter.h @@ -73,12 +73,14 @@ class PotmeterControls : public QObject { class ControlPotmeter : public ControlObject { Q_OBJECT public: - ControlPotmeter(ConfigKey key, double dMinValue = 0.0, double dMaxValue = 1.0, - bool allowOutOfBounds = false, - bool bIgnoreNops = true, - bool bTrack = false, - bool bPersist = false, - double defaultValue = 0.0); + ControlPotmeter(const ConfigKey& key, + double dMinValue = 0.0, + double dMaxValue = 1.0, + bool allowOutOfBounds = false, + bool bIgnoreNops = true, + bool bTrack = false, + bool bPersist = false, + double defaultValue = 0.0); virtual ~ControlPotmeter(); // Sets the step count of the associated PushButtons. diff --git a/src/control/controlpushbutton.cpp b/src/control/controlpushbutton.cpp index 6fe0486d56b..29c4e9dd9b1 100644 --- a/src/control/controlpushbutton.cpp +++ b/src/control/controlpushbutton.cpp @@ -21,7 +21,7 @@ Purpose: Creates a new simulated latching push-button. Input: key - Key for the configuration file -------- ------------------------------------------------------ */ -ControlPushButton::ControlPushButton(ConfigKey key, bool bPersist, double defaultValue) +ControlPushButton::ControlPushButton(const ConfigKey& key, bool bPersist, double defaultValue) : ControlObject(key, false, false, bPersist, defaultValue), m_buttonMode(PUSH), m_iNoStates(2) { diff --git a/src/control/controlpushbutton.h b/src/control/controlpushbutton.h index 408ee217b55..d523ee53296 100644 --- a/src/control/controlpushbutton.h +++ b/src/control/controlpushbutton.h @@ -52,7 +52,7 @@ class ControlPushButton : public ControlObject { } } - ControlPushButton(ConfigKey key, bool bPersist = false, double defaultValue = 0.0); + ControlPushButton(const ConfigKey& key, bool bPersist = false, double defaultValue = 0.0); virtual ~ControlPushButton(); inline ButtonMode getButtonMode() const { diff --git a/src/control/controlttrotary.cpp b/src/control/controlttrotary.cpp index 93b97bab6aa..930c8c48d6f 100644 --- a/src/control/controlttrotary.cpp +++ b/src/control/controlttrotary.cpp @@ -20,7 +20,8 @@ Purpose: Creates a new rotary encoder Input: key -------- ------------------------------------------------------ */ -ControlTTRotary::ControlTTRotary(ConfigKey key) : ControlObject(key) { +ControlTTRotary::ControlTTRotary(const ConfigKey& key) + : ControlObject(key) { if (m_pControl) { m_pControl->setBehavior( new ControlTTRotaryBehavior()); diff --git a/src/control/controlttrotary.h b/src/control/controlttrotary.h index edef5bd2f9a..59ba41eeb2f 100644 --- a/src/control/controlttrotary.h +++ b/src/control/controlttrotary.h @@ -23,7 +23,7 @@ class ControlTTRotary : public ControlObject { Q_OBJECT public: - ControlTTRotary(ConfigKey key); + ControlTTRotary(const ConfigKey& key); }; #endif diff --git a/src/controllers/bulk/bulkcontroller.cpp b/src/controllers/bulk/bulkcontroller.cpp index 4e956159233..b1b9e0bf0a9 100644 --- a/src/controllers/bulk/bulkcontroller.cpp +++ b/src/controllers/bulk/bulkcontroller.cpp @@ -234,7 +234,7 @@ void BulkController::send(QList data, unsigned int length) { send(temp); } -void BulkController::send(QByteArray data) { +void BulkController::send(const QByteArray& data) { int ret; int transferred; diff --git a/src/controllers/bulk/bulkcontroller.h b/src/controllers/bulk/bulkcontroller.h index 94e32869ba1..018c2cfd640 100644 --- a/src/controllers/bulk/bulkcontroller.h +++ b/src/controllers/bulk/bulkcontroller.h @@ -28,7 +28,7 @@ class BulkReader : public QThread { void stop(); signals: - void incomingData(QByteArray data, mixxx::Duration timestamp); + void incomingData(const QByteArray& data, mixxx::Duration timestamp); protected: void run(); @@ -81,7 +81,7 @@ class BulkController : public Controller { private: // For devices which only support a single report, reportID must be set to // 0x0. - void send(QByteArray data) override; + void send(const QByteArray& data) override; // Returns a pointer to the currently loaded controller preset. For internal // use only. diff --git a/src/controllers/colormapper.h b/src/controllers/colormapper.h index 05e2cb90551..10157ed2570 100644 --- a/src/controllers/colormapper.h +++ b/src/controllers/colormapper.h @@ -13,7 +13,7 @@ class ColorMapper final { public: ColorMapper() = delete; - explicit ColorMapper(QMap availableColors) + explicit ColorMapper(const QMap& availableColors) : m_availableColors(availableColors) { DEBUG_ASSERT(!m_availableColors.isEmpty()); } diff --git a/src/controllers/colormapperjsproxy.cpp b/src/controllers/colormapperjsproxy.cpp index c8d7cf15907..3272bd04945 100644 --- a/src/controllers/colormapperjsproxy.cpp +++ b/src/controllers/colormapperjsproxy.cpp @@ -2,7 +2,8 @@ #include "controllers/colormapperjsproxy.h" -ColorMapperJSProxy::ColorMapperJSProxy(QScriptEngine* pScriptEngine, QMap availableColors) +ColorMapperJSProxy::ColorMapperJSProxy(QScriptEngine* pScriptEngine, + const QMap& availableColors) : m_pScriptEngine(pScriptEngine), m_colorMapper(new ColorMapper(availableColors)) { } diff --git a/src/controllers/colormapperjsproxy.h b/src/controllers/colormapperjsproxy.h index 3a08f062d55..898b5cb0332 100644 --- a/src/controllers/colormapperjsproxy.h +++ b/src/controllers/colormapperjsproxy.h @@ -12,7 +12,7 @@ class ColorMapperJSProxy final : public QObject { Q_OBJECT public: ColorMapperJSProxy() = delete; - ColorMapperJSProxy(QScriptEngine* pScriptEngine, QMap availableColors); + ColorMapperJSProxy(QScriptEngine* pScriptEngine, const QMap& availableColors); ~ColorMapperJSProxy() override { delete m_colorMapper; diff --git a/src/controllers/controller.cpp b/src/controllers/controller.cpp index 1ec78e1ddfa..0b816e01329 100644 --- a/src/controllers/controller.cpp +++ b/src/controllers/controller.cpp @@ -85,7 +85,7 @@ void Controller::stopLearning() { } -void Controller::send(QList data, unsigned int length) { +void Controller::send(const QList& data, unsigned int length) { // If you change this implementation, also change it in HidController (That // function is required due to HID devices having report IDs) @@ -107,8 +107,7 @@ void Controller::triggerActivity() m_userActivityInhibitTimer.start(); } } -void Controller::receive(const QByteArray data, mixxx::Duration timestamp) { - +void Controller::receive(const QByteArray& data, mixxx::Duration timestamp) { if (m_pEngine == NULL) { //qWarning() << "Controller::receive called with no active engine!"; // Don't complain, since this will always show after closing a device as diff --git a/src/controllers/controller.h b/src/controllers/controller.h index 06fed55a482..b98ac4c7963 100644 --- a/src/controllers/controller.h +++ b/src/controllers/controller.h @@ -81,7 +81,7 @@ class Controller : public QObject, ConstControllerPresetVisitor { // Handles packets of raw bytes and passes them to an ".incomingData" script // function that is assumed to exist. (Sub-classes may want to reimplement // this if they have an alternate way of handling such data.) - virtual void receive(const QByteArray data, mixxx::Duration timestamp); + virtual void receive(const QByteArray& data, mixxx::Duration timestamp); /// Apply the preset to the controller. /// @brief Initializes both controller engine and static output mappings. @@ -98,7 +98,7 @@ class Controller : public QObject, ConstControllerPresetVisitor { protected: // The length parameter is here for backwards compatibility for when scripts // were required to specify it. - Q_INVOKABLE void send(QList data, unsigned int length = 0); + Q_INVOKABLE void send(const QList& data, unsigned int length = 0); // To be called in sub-class' open() functions after opening the device but // before starting any input polling/processing. @@ -114,10 +114,10 @@ class Controller : public QObject, ConstControllerPresetVisitor { inline ControllerEngine* getEngine() const { return m_pEngine; } - inline void setDeviceName(QString deviceName) { + inline void setDeviceName(const QString& deviceName) { m_sDeviceName = deviceName; } - inline void setDeviceCategory(QString deviceCategory) { + inline void setDeviceCategory(const QString& deviceCategory) { m_sDeviceCategory = deviceCategory; } inline void setOutputDevice(bool outputDevice) { @@ -148,7 +148,7 @@ class Controller : public QObject, ConstControllerPresetVisitor { private: // This must be reimplemented by sub-classes desiring to send raw bytes to a // controller. - virtual void send(QByteArray data) = 0; + virtual void send(const QByteArray& data) = 0; // Returns a pointer to the currently loaded controller preset. For internal // use only. diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp index 53b6e0085e5..7002f3cb853 100644 --- a/src/controllers/controllerengine.cpp +++ b/src/controllers/controllerengine.cpp @@ -84,8 +84,9 @@ Purpose: Calls the same method on a list of JS Objects Input: - Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::callFunctionOnObjects(QList scriptFunctionPrefixes, - const QString& function, QScriptValueList args) { +void ControllerEngine::callFunctionOnObjects(const QList& scriptFunctionPrefixes, + const QString& function, + const QScriptValueList& args) { VERIFY_OR_DEBUG_ASSERT(m_pEngine) { return; } @@ -421,7 +422,7 @@ Input: 'this' object if applicable, Code string Output: false if an exception -------- ------------------------------------------------------ */ bool ControllerEngine::internalExecute( - QScriptValue thisObject, const QString& scriptCode) { + const QScriptValue& thisObject, const QString& scriptCode) { // A special version of safeExecute since we're evaluating strings, not actual functions // (execute() would print an error that it's not a function every time a timer fires.) if (m_pEngine == nullptr) { @@ -452,9 +453,9 @@ Purpose: Evaluate & run script code Input: 'this' object if applicable, Code string Output: false if an exception -------- ------------------------------------------------------ */ -bool ControllerEngine::internalExecute(QScriptValue thisObject, +bool ControllerEngine::internalExecute(const QScriptValue& thisObject, QScriptValue functionObject, - QScriptValueList args) { + const QScriptValueList& args) { if (m_pEngine == nullptr) { qDebug() << "ControllerEngine::execute: No script engine exists!"; return false; @@ -489,7 +490,7 @@ bool ControllerEngine::internalExecute(QScriptValue thisObject, return !checkException(); } -bool ControllerEngine::execute(QScriptValue functionObject, +bool ControllerEngine::execute(const QScriptValue& functionObject, unsigned char channel, unsigned char control, unsigned char value, @@ -509,8 +510,8 @@ bool ControllerEngine::execute(QScriptValue functionObject, return internalExecute(m_pEngine->globalObject(), functionObject, args); } -bool ControllerEngine::execute(QScriptValue function, - const QByteArray data, +bool ControllerEngine::execute(const QScriptValue& function, + const QByteArray& data, mixxx::Duration timestamp) { Q_UNUSED(timestamp); if (m_pEngine == nullptr) { @@ -686,7 +687,7 @@ ControlObjectScript* ControllerEngine::getControlObjectScript(const QString& gro Input: Control group (e.g. [Channel1]), Key name (e.g. [filterHigh]) Output: The value -------- ------------------------------------------------------ */ -double ControllerEngine::getValue(QString group, QString name) { +double ControllerEngine::getValue(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript == nullptr) { qWarning() << "ControllerEngine: Unknown control" << group << name << ", returning 0.0"; @@ -700,7 +701,7 @@ double ControllerEngine::getValue(QString group, QString name) { Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::setValue(QString group, QString name, double newValue) { +void ControllerEngine::setValue(const QString& group, const QString& name, double newValue) { if (isnan(newValue)) { qWarning() << "ControllerEngine: script setting [" << group << "," << name << "] to NotANumber, ignoring."; @@ -723,7 +724,7 @@ void ControllerEngine::setValue(QString group, QString name, double newValue) { Input: Control group (e.g. [Channel1]), Key name (e.g. [filterHigh]) Output: The value -------- ------------------------------------------------------ */ -double ControllerEngine::getParameter(QString group, QString name) { +double ControllerEngine::getParameter(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript == nullptr) { qWarning() << "ControllerEngine: Unknown control" << group << name << ", returning 0.0"; @@ -737,7 +738,8 @@ double ControllerEngine::getParameter(QString group, QString name) { Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::setParameter(QString group, QString name, double newParameter) { +void ControllerEngine::setParameter( + const QString& group, const QString& name, double newParameter) { if (isnan(newParameter)) { qWarning() << "ControllerEngine: script setting [" << group << "," << name << "] to NotANumber, ignoring."; @@ -760,7 +762,8 @@ void ControllerEngine::setParameter(QString group, QString name, double newParam Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -double ControllerEngine::getParameterForValue(QString group, QString name, double value) { +double ControllerEngine::getParameterForValue( + const QString& group, const QString& name, double value) { if (isnan(value)) { qWarning() << "ControllerEngine: script setting [" << group << "," << name << "] to NotANumber, ignoring."; @@ -782,7 +785,7 @@ double ControllerEngine::getParameterForValue(QString group, QString name, doubl Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::reset(QString group, QString name) { +void ControllerEngine::reset(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript != nullptr) { coScript->reset(); @@ -794,7 +797,7 @@ void ControllerEngine::reset(QString group, QString name) { Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -double ControllerEngine::getDefaultValue(QString group, QString name) { +double ControllerEngine::getDefaultValue(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript == nullptr) { @@ -810,7 +813,7 @@ double ControllerEngine::getDefaultValue(QString group, QString name) { Input: Control group, Key name, new value Output: - -------- ------------------------------------------------------ */ -double ControllerEngine::getDefaultParameter(QString group, QString name) { +double ControllerEngine::getDefaultParameter(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript == nullptr) { @@ -826,7 +829,7 @@ double ControllerEngine::getDefaultParameter(QString group, QString name) { Input: String to log Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::log(QString message) { +void ControllerEngine::log(const QString& message) { controllerDebug(message); } @@ -836,8 +839,9 @@ void ControllerEngine::log(QString message) { // The script should store this object to call its // 'disconnect' and 'trigger' methods as needed. // If unsuccessful, returns undefined. -QScriptValue ControllerEngine::makeConnection(QString group, QString name, - const QScriptValue callback) { +QScriptValue ControllerEngine::makeConnection(const QString& group, + const QString& name, + const QScriptValue& callback) { VERIFY_OR_DEBUG_ASSERT(m_pEngine != nullptr) { qWarning() << "Tried to connect script callback, but there is no script engine!"; return QScriptValue(); @@ -895,7 +899,7 @@ void ScriptConnection::executeCallback(double value) const { Purpose: (Dis)connects a ScriptConnection Input: the ScriptConnection to disconnect -------- ------------------------------------------------------ */ -bool ControllerEngine::removeScriptConnection(const ScriptConnection connection) { +bool ControllerEngine::removeScriptConnection(const ScriptConnection& connection) { ControlObjectScript* coScript = getControlObjectScript(connection.key.group, connection.key.item); @@ -917,7 +921,7 @@ bool ScriptConnectionInvokableWrapper::disconnect() { Purpose: Triggers the callback function of a ScriptConnection Input: the ScriptConnection to trigger -------- ------------------------------------------------------ */ -void ControllerEngine::triggerScriptConnection(const ScriptConnection connection) { +void ControllerEngine::triggerScriptConnection(const ScriptConnection& connection) { if (m_pEngine == nullptr) { return; } @@ -943,8 +947,10 @@ void ScriptConnectionInvokableWrapper::trigger() { // it is disconnected. // WARNING: These behaviors are quirky and confusing, so if you change this function, // be sure to run the ControllerEngineTest suite to make sure you do not break old scripts. -QScriptValue ControllerEngine::connectControl( - QString group, QString name, const QScriptValue passedCallback, bool disconnect) { +QScriptValue ControllerEngine::connectControl(const QString& group, + const QString& name, + const QScriptValue& passedCallback, + bool disconnect) { // The passedCallback may or may not actually be a function, so when // the actual callback function is found, store it in this variable. QScriptValue actualCallbackFunction; @@ -1050,7 +1056,7 @@ QScriptValue ControllerEngine::connectControl( Input: - Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::trigger(QString group, QString name) { +void ControllerEngine::trigger(const QString& group, const QString& name) { ControlObjectScript* coScript = getControlObjectScript(group, name); if (coScript != nullptr) { coScript->emitValueChanged(); @@ -1136,8 +1142,7 @@ bool ControllerEngine::hasErrors(const QString& filename) { whether it should fire just once Output: The timer's ID, 0 if starting it failed -------- ------------------------------------------------------ */ -int ControllerEngine::beginTimer(int interval, QScriptValue timerCallback, - bool oneShot) { +int ControllerEngine::beginTimer(int interval, const QScriptValue& timerCallback, bool oneShot) { if (!timerCallback.isFunction() && !timerCallback.isString()) { qWarning() << "Invalid timer callback provided to beginTimer." << "Valid callbacks are strings and functions."; @@ -1474,7 +1479,7 @@ bool ControllerEngine::isScratching(int deck) { whether to set the soft-takeover status or not Output: - -------- ------------------------------------------------------ */ -void ControllerEngine::softTakeover(QString group, QString name, bool set) { +void ControllerEngine::softTakeover(const QString& group, const QString& name, bool set) { ConfigKey key = ConfigKey(group, name); ControlObject* pControl = ControlObject::getControl(key, onlyAssertOnControllerDebug()); if (!pControl) { @@ -1499,7 +1504,7 @@ void ControllerEngine::softTakeover(QString group, QString name, bool set) { Output: - -------- ------------------------------------------------------ */ void ControllerEngine::softTakeoverIgnoreNextValue( - QString group, const QString name) { + const QString& group, const QString& name) { ConfigKey key = ConfigKey(group, name); ControlObject* pControl = ControlObject::getControl(key, onlyAssertOnControllerDebug()); if (!pControl) { diff --git a/src/controllers/controllerengine.h b/src/controllers/controllerengine.h index dad8c785bc6..9caab019b7e 100644 --- a/src/controllers/controllerengine.h +++ b/src/controllers/controllerengine.h @@ -60,7 +60,7 @@ class ScriptConnectionInvokableWrapper : public QObject { //Q_PROPERTY(QScriptValue function READ function) Q_PROPERTY(bool isConnected READ readIsConnected) public: - ScriptConnectionInvokableWrapper(ScriptConnection conn) { + ScriptConnectionInvokableWrapper(const ScriptConnection& conn) { m_scriptConnection = conn; m_idString = conn.id.toString(); m_isConnected = true; @@ -99,36 +99,39 @@ class ControllerEngine : public QObject { const QList& getScriptFunctionPrefixes() { return m_scriptFunctionPrefixes; }; // Disconnect a ScriptConnection - bool removeScriptConnection(const ScriptConnection conn); - void triggerScriptConnection(const ScriptConnection conn); + bool removeScriptConnection(const ScriptConnection& conn); + void triggerScriptConnection(const ScriptConnection& conn); protected: - Q_INVOKABLE double getValue(QString group, QString name); - Q_INVOKABLE void setValue(QString group, QString name, double newValue); - Q_INVOKABLE double getParameter(QString group, QString name); - Q_INVOKABLE void setParameter(QString group, QString name, double newValue); - Q_INVOKABLE double getParameterForValue(QString group, QString name, double value); - Q_INVOKABLE void reset(QString group, QString name); - Q_INVOKABLE double getDefaultValue(QString group, QString name); - Q_INVOKABLE double getDefaultParameter(QString group, QString name); - Q_INVOKABLE QScriptValue makeConnection(QString group, QString name, - const QScriptValue callback); + Q_INVOKABLE double getValue(const QString& group, const QString& name); + Q_INVOKABLE void setValue(const QString& group, const QString& name, double newValue); + Q_INVOKABLE double getParameter(const QString& group, const QString& name); + Q_INVOKABLE void setParameter(const QString& group, const QString& name, double newValue); + Q_INVOKABLE double getParameterForValue( + const QString& group, const QString& name, double value); + Q_INVOKABLE void reset(const QString& group, const QString& name); + Q_INVOKABLE double getDefaultValue(const QString& group, const QString& name); + Q_INVOKABLE double getDefaultParameter(const QString& group, const QString& name); + Q_INVOKABLE QScriptValue makeConnection(const QString& group, + const QString& name, + const QScriptValue& callback); // DEPRECATED: Use makeConnection instead. - Q_INVOKABLE QScriptValue connectControl(QString group, QString name, - const QScriptValue passedCallback, - bool disconnect = false); + Q_INVOKABLE QScriptValue connectControl(const QString& group, + const QString& name, + const QScriptValue& passedCallback, + bool disconnect = false); // Called indirectly by the objects returned by connectControl - Q_INVOKABLE void trigger(QString group, QString name); - Q_INVOKABLE void log(QString message); - Q_INVOKABLE int beginTimer(int interval, QScriptValue scriptCode, bool oneShot = false); + Q_INVOKABLE void trigger(const QString& group, const QString& name); + Q_INVOKABLE void log(const QString& message); + Q_INVOKABLE int beginTimer(int interval, const QScriptValue& scriptCode, bool oneShot = false); Q_INVOKABLE void stopTimer(int timerId); Q_INVOKABLE void scratchEnable(int deck, int intervalsPerRev, double rpm, double alpha, double beta, bool ramp = true); Q_INVOKABLE void scratchTick(int deck, int interval); Q_INVOKABLE void scratchDisable(int deck, bool ramp = true); Q_INVOKABLE bool isScratching(int deck); - Q_INVOKABLE void softTakeover(QString group, QString name, bool set); - Q_INVOKABLE void softTakeoverIgnoreNextValue(QString group, QString name); + Q_INVOKABLE void softTakeover(const QString& group, const QString& name, bool set); + Q_INVOKABLE void softTakeoverIgnoreNextValue(const QString& group, const QString& name); Q_INVOKABLE void brake(int deck, bool activate, double factor=1.0, double rate=1.0); Q_INVOKABLE void spinback(int deck, bool activate, double factor=1.8, double rate=-10.0); Q_INVOKABLE void softStart(int deck, bool activate, double factor=1.0); @@ -141,17 +144,16 @@ class ControllerEngine : public QObject { bool evaluate(const QString& filepath); // Execute a basic MIDI message callback. - bool execute(QScriptValue function, - unsigned char channel, - unsigned char control, - unsigned char value, - unsigned char status, - const QString& group, - mixxx::Duration timestamp); + bool execute(const QScriptValue& function, + unsigned char channel, + unsigned char control, + unsigned char value, + unsigned char status, + const QString& group, + mixxx::Duration timestamp); // Execute a byte array callback. - bool execute(QScriptValue function, const QByteArray data, - mixxx::Duration timestamp); + bool execute(const QScriptValue& function, const QByteArray& data, mixxx::Duration timestamp); // Evaluates all provided script files and returns true if no script errors // occurred while evaluating them. @@ -169,9 +171,10 @@ class ControllerEngine : public QObject { private: bool syntaxIsValid(const QString& scriptCode, const QString& filename = QString()); bool evaluate(const QFileInfo& scriptFile); - bool internalExecute(QScriptValue thisObject, const QString& scriptCode); - bool internalExecute(QScriptValue thisObject, QScriptValue functionObject, - QScriptValueList arguments); + bool internalExecute(const QScriptValue& thisObject, const QString& scriptCode); + bool internalExecute(const QScriptValue& thisObject, + QScriptValue functionObject, + const QScriptValueList& arguments); void initializeScriptEngine(); void uninitializeScriptEngine(); @@ -180,7 +183,9 @@ class ControllerEngine : public QObject { // Stops and removes all timers (for shutdown). void stopAllTimers(); - void callFunctionOnObjects(QList, const QString&, QScriptValueList args = QScriptValueList()); + void callFunctionOnObjects(const QList&, + const QString&, + const QScriptValueList& args = QScriptValueList()); bool checkException(bool bFatal = false); QScriptEngine *m_pEngine; diff --git a/src/controllers/controllermanager.cpp b/src/controllers/controllermanager.cpp index c70af0d1ccd..f7cee2c94f1 100644 --- a/src/controllers/controllermanager.cpp +++ b/src/controllers/controllermanager.cpp @@ -64,7 +64,7 @@ QFileInfo findPresetFile(const QString& pathOrFilename, const QStringList& paths } // anonymous namespace QString firstAvailableFilename(QSet& filenames, - const QString originalFilename) { + const QString& originalFilename) { QString filename = originalFilename; int i = 1; while (filenames.contains(filename)) { @@ -223,7 +223,7 @@ QList ControllerManager::getControllerList(bool bOutputDevices, boo return filteredDeviceList; } -QString ControllerManager::getConfiguredPresetFileForDevice(QString name) { +QString ControllerManager::getConfiguredPresetFileForDevice(const QString& name) { return m_pConfig->getValueString(ConfigKey("[ControllerPreset]", sanitizeDeviceName(name))); } diff --git a/src/controllers/controllermanager.h b/src/controllers/controllermanager.h index fba7f704624..6a1a4b57d62 100644 --- a/src/controllers/controllermanager.h +++ b/src/controllers/controllermanager.h @@ -41,7 +41,7 @@ class ControllerManager : public QObject { QSharedPointer getMainThreadSystemPresetEnumerator() { return m_pMainThreadSystemPresetEnumerator; } - QString getConfiguredPresetFileForDevice(QString name); + QString getConfiguredPresetFileForDevice(const QString& name); // Prevent other parts of Mixxx from having to manually connect to our slots void setUpDevices() { emit requestSetUpDevices(); }; diff --git a/src/controllers/controllerpreset.h b/src/controllers/controllerpreset.h index 1b222b05fe9..9b2b0c13761 100644 --- a/src/controllers/controllerpreset.h +++ b/src/controllers/controllerpreset.h @@ -67,7 +67,7 @@ class ControllerPreset { return m_bDirty; } - inline void setDeviceId(const QString id) { + inline void setDeviceId(const QString& id) { m_deviceId = id; setDirty(true); } @@ -76,7 +76,7 @@ class ControllerPreset { return m_deviceId; } - inline void setFilePath(const QString filePath) { + inline void setFilePath(const QString& filePath) { m_filePath = filePath; setDirty(true); } @@ -89,7 +89,7 @@ class ControllerPreset { return QFileInfo(filePath()).absoluteDir(); } - inline void setName(const QString name) { + inline void setName(const QString& name) { m_name = name; setDirty(true); } @@ -98,7 +98,7 @@ class ControllerPreset { return m_name; } - inline void setAuthor(const QString author) { + inline void setAuthor(const QString& author) { m_author = author; setDirty(true); } @@ -107,7 +107,7 @@ class ControllerPreset { return m_author; } - inline void setDescription(const QString description) { + inline void setDescription(const QString& description) { m_description = description; setDirty(true); } @@ -116,7 +116,7 @@ class ControllerPreset { return m_description; } - inline void setForumLink(const QString forumlink) { + inline void setForumLink(const QString& forumlink) { m_forumlink = forumlink; setDirty(true); } @@ -143,7 +143,7 @@ class ControllerPreset { return MIXXX_MANUAL_CONTROLLERMANUAL_PREFIX + page + MIXXX_MANUAL_CONTROLLERMANUAL_SUFFIX; } - inline void setWikiLink(const QString wikilink) { + inline void setWikiLink(const QString& wikilink) { m_wikilink = wikilink; setDirty(true); } @@ -152,7 +152,7 @@ class ControllerPreset { return m_wikilink; } - inline void setSchemaVersion(const QString schemaVersion) { + inline void setSchemaVersion(const QString& schemaVersion) { m_schemaVersion = schemaVersion; setDirty(true); } @@ -161,7 +161,7 @@ class ControllerPreset { return m_schemaVersion; } - inline void setMixxxVersion(const QString mixxxVersion) { + inline void setMixxxVersion(const QString& mixxxVersion) { m_mixxxVersion = mixxxVersion; setDirty(true); } @@ -170,7 +170,7 @@ class ControllerPreset { return m_mixxxVersion; } - inline void addProductMatch(QHash match) { + inline void addProductMatch(const QHash& match) { m_productMatches.append(match); setDirty(true); } diff --git a/src/controllers/controllerpresetfilehandler.cpp b/src/controllers/controllerpresetfilehandler.cpp index 7fe2f57392c..122efd2f660 100644 --- a/src/controllers/controllerpresetfilehandler.cpp +++ b/src/controllers/controllerpresetfilehandler.cpp @@ -149,7 +149,7 @@ void ControllerPresetFileHandler::addScriptFilesToPreset( } bool ControllerPresetFileHandler::writeDocument( - QDomDocument root, const QString fileName) const { + const QDomDocument& root, const QString& fileName) const { // Need to do this on Windows QDir directory; if (!directory.mkpath(fileName.left(fileName.lastIndexOf("/")))) { @@ -175,8 +175,8 @@ bool ControllerPresetFileHandler::writeDocument( void addTextTag(QDomDocument& doc, QDomElement& holder, - QString tagName, - QString tagText) { + const QString& tagName, + const QString& tagText) { QDomElement tag = doc.createElement(tagName); QDomText textNode = doc.createTextNode(tagText); tag.appendChild(textNode); diff --git a/src/controllers/controllerpresetfilehandler.h b/src/controllers/controllerpresetfilehandler.h index 2ee8c34e37d..5dba31bcc45 100644 --- a/src/controllers/controllerpresetfilehandler.h +++ b/src/controllers/controllerpresetfilehandler.h @@ -29,7 +29,7 @@ class ControllerPresetFileHandler { // Returns just the name of a given device (everything before the first // space) - QString rootDeviceName(QString deviceName) const { + QString rootDeviceName(const QString& deviceName) const { return deviceName.left(deviceName.indexOf(" ")); } @@ -56,7 +56,7 @@ class ControllerPresetFileHandler { /// loaded. Sub-classes need to call this before adding any other items. QDomDocument buildRootWithScripts(const ControllerPreset& preset) const; - bool writeDocument(QDomDocument root, const QString fileName) const; + bool writeDocument(const QDomDocument& root, const QString& fileName) const; private: // Sub-classes implement this. diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index 170edb0c358..b26e9055b13 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -1139,10 +1139,13 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) ControlPickerMenu::~ControlPickerMenu() { } -void ControlPickerMenu::addSingleControl(QString group, QString control, - QString title, QString description, - QMenu* pMenu, QString prefix, - QString actionTitle) { +void ControlPickerMenu::addSingleControl(const QString& group, + const QString& control, + const QString& title, + const QString& description, + QMenu* pMenu, + const QString& prefix, + const QString& actionTitle) { int controlIndex; if (prefix.isEmpty()) { @@ -1153,21 +1156,19 @@ void ControlPickerMenu::addSingleControl(QString group, QString control, controlIndex = addAvailableControl(ConfigKey(group, control), prefixedTitle, prefixedDescription); } - if (actionTitle.isEmpty()) { - actionTitle = title; - } - - auto pAction = make_parented(actionTitle, pMenu); + auto pAction = make_parented(actionTitle.isEmpty() ? title : actionTitle, pMenu); connect(pAction, &QAction::triggered, this, [this, controlIndex] { controlChosen(controlIndex); }); pMenu->addAction(pAction); } -void ControlPickerMenu::addControl(QString group, QString control, QString title, - QString description, - QMenu* pMenu, - bool addReset, - QString prefix) { +void ControlPickerMenu::addControl(const QString& group, + const QString& control, + const QString& title, + const QString& description, + QMenu* pMenu, + bool addReset, + const QString& prefix) { addSingleControl(group, control, title, description, pMenu, prefix); if (addReset) { @@ -1179,12 +1180,14 @@ void ControlPickerMenu::addControl(QString group, QString control, QString title } } -void ControlPickerMenu::addPlayerControl(QString control, QString controlTitle, - QString controlDescription, - QMenu* pMenu, - bool deckControls, bool samplerControls, - bool previewdeckControls, - bool addReset) { +void ControlPickerMenu::addPlayerControl(const QString& control, + const QString& controlTitle, + const QString& controlDescription, + QMenu* pMenu, + bool deckControls, + bool samplerControls, + bool previewdeckControls, + bool addReset) { const int iNumSamplers = static_cast( ControlObject::get(ConfigKey("[Master]", "num_samplers"))); const int iNumDecks = static_cast(ControlObject::get(ConfigKey("[Master]", "num_decks"))); @@ -1272,13 +1275,13 @@ void ControlPickerMenu::addPlayerControl(QString control, QString controlTitle, } } -void ControlPickerMenu::addMicrophoneAndAuxControl(QString control, - QString controlTitle, - QString controlDescription, - QMenu* pMenu, - bool microphoneControls, - bool auxControls, - bool addReset) { +void ControlPickerMenu::addMicrophoneAndAuxControl(const QString& control, + const QString& controlTitle, + const QString& controlDescription, + QMenu* pMenu, + bool microphoneControls, + bool auxControls, + bool addReset) { parented_ptr controlMenu = make_parented(controlTitle, pMenu); pMenu->addMenu(controlMenu); @@ -1327,51 +1330,51 @@ void ControlPickerMenu::addMicrophoneAndAuxControl(QString control, } } -void ControlPickerMenu::addDeckAndSamplerControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addDeckAndSamplerControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, true, true, false, addReset); } -void ControlPickerMenu::addDeckAndPreviewDeckControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addDeckAndPreviewDeckControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, true, false, true, addReset); } -void ControlPickerMenu::addDeckAndSamplerAndPreviewDeckControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addDeckAndSamplerAndPreviewDeckControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, true, true, true, addReset); } -void ControlPickerMenu::addDeckControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addDeckControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, true, false, false, addReset); } -void ControlPickerMenu::addSamplerControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addSamplerControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, false, true, false, addReset); } -void ControlPickerMenu::addPreviewDeckControl(QString control, - QString title, - QString controlDescription, - QMenu* pMenu, - bool addReset) { +void ControlPickerMenu::addPreviewDeckControl(const QString& control, + const QString& title, + const QString& controlDescription, + QMenu* pMenu, + bool addReset) { addPlayerControl(control, title, controlDescription, pMenu, false, false, true, addReset); } @@ -1391,9 +1394,9 @@ void ControlPickerMenu::controlChosen(int controlIndex) { emit controlPicked(m_controlsAvailable[controlIndex]); } -int ControlPickerMenu::addAvailableControl(ConfigKey key, - QString title, - QString description) { +int ControlPickerMenu::addAvailableControl(const ConfigKey& key, + const QString& title, + const QString& description) { m_controlsAvailable.append(key); m_descriptionsByKey.insert(key, description); m_titlesByKey.insert(key, title); @@ -1402,14 +1405,14 @@ int ControlPickerMenu::addAvailableControl(ConfigKey key, return m_controlsAvailable.size() - 1; } -bool ControlPickerMenu::controlExists(ConfigKey key) const { +bool ControlPickerMenu::controlExists(const ConfigKey& key) const { return m_titlesByKey.contains(key); } -QString ControlPickerMenu::descriptionForConfigKey(ConfigKey key) const { +QString ControlPickerMenu::descriptionForConfigKey(const ConfigKey& key) const { return m_descriptionsByKey.value(key, QString()); } -QString ControlPickerMenu::controlTitleForConfigKey(ConfigKey key) const { +QString ControlPickerMenu::controlTitleForConfigKey(const ConfigKey& key) const { return m_titlesByKey.value(key, QString()); } diff --git a/src/controllers/controlpickermenu.h b/src/controllers/controlpickermenu.h index 934c533a690..9ca64a4dded 100644 --- a/src/controllers/controlpickermenu.h +++ b/src/controllers/controlpickermenu.h @@ -16,13 +16,13 @@ class ControlPickerMenu : public QMenu { return m_controlsAvailable; } - bool controlExists(ConfigKey key) const; - QString descriptionForConfigKey(ConfigKey key) const; - QString controlTitleForConfigKey(ConfigKey key) const; + bool controlExists(const ConfigKey& key) const; + QString descriptionForConfigKey(const ConfigKey& key) const; + QString controlTitleForConfigKey(const ConfigKey& key) const; signals: // Emitted when the user selects a control from the menu. - void controlPicked(ConfigKey control); + void controlPicked(const ConfigKey& control); private slots: // Triggered when user selects a control from the menu. @@ -30,36 +30,67 @@ class ControlPickerMenu : public QMenu { private: QMenu* addSubmenu(QString title, QMenu* pParent=NULL); - void addSingleControl(QString group, QString control, - QString title, QString description, - QMenu* pMenu, - QString prefix=QString(), QString actionTitle=QString()); - void addControl(QString group, QString control, QString title, - QString helpText, QMenu* pMenu, bool addReset=false, QString prefix=QString()); - void addPlayerControl(QString control, QString title, QString helpText, - QMenu* pMenu, bool deckControls, bool samplerControls, - bool previewdeckControls, bool addReset=false); - void addDeckAndSamplerControl(QString control, QString title, - QString helpText, QMenu* pMenu, - bool addReset=false); - void addDeckAndPreviewDeckControl(QString control, QString title, - QString helpText, QMenu* pMenu, - bool addReset=false); - void addDeckAndSamplerAndPreviewDeckControl(QString control, QString title, - QString helpText, QMenu* pMenu, - bool addReset=false); - void addDeckControl(QString control, QString title, QString helpText, - QMenu* pMenu, bool addReset=false); - void addSamplerControl(QString control, QString title, QString helpText, - QMenu* pMenu, bool addReset=false); - void addPreviewDeckControl(QString control, QString title, QString helpText, - QMenu* pMenu, bool addReset=false); - void addMicrophoneAndAuxControl(QString control, QString title, - QString helpText, QMenu* pMenu, - bool microphoneControls, bool auxControls, - bool addReset=false); + void addSingleControl(const QString& group, + const QString& control, + const QString& title, + const QString& description, + QMenu* pMenu, + const QString& prefix = QString(), + const QString& actionTitle = QString()); + void addControl(const QString& group, + const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false, + const QString& prefix = QString()); + void addPlayerControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool deckControls, + bool samplerControls, + bool previewdeckControls, + bool addReset = false); + void addDeckAndSamplerControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addDeckAndPreviewDeckControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addDeckAndSamplerAndPreviewDeckControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addDeckControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addSamplerControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addPreviewDeckControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool addReset = false); + void addMicrophoneAndAuxControl(const QString& control, + const QString& title, + const QString& helpText, + QMenu* pMenu, + bool microphoneControls, + bool auxControls, + bool addReset = false); - int addAvailableControl(ConfigKey key, QString title, QString description); + int addAvailableControl(const ConfigKey& key, const QString& title, const QString& description); QString m_effectMasterOutputStr; QString m_effectHeadphoneOutputStr; diff --git a/src/controllers/dlgcontrollerlearning.cpp b/src/controllers/dlgcontrollerlearning.cpp index b8e36df39c8..589bf5d687c 100644 --- a/src/controllers/dlgcontrollerlearning.cpp +++ b/src/controllers/dlgcontrollerlearning.cpp @@ -467,8 +467,8 @@ void DlgControllerLearning::showControlMenu() { } void DlgControllerLearning::loadControl(const ConfigKey& key, - QString title, - QString description) { + const QString& title, + QString description) { // If we have learned a mapping and the user picked a new control then we // should tell the controller to commit the existing ones. if (m_messagesLearned) { @@ -493,7 +493,7 @@ void DlgControllerLearning::loadControl(const ConfigKey& key, pushButtonStartLearn->setFocus(); } -void DlgControllerLearning::controlPicked(ConfigKey control) { +void DlgControllerLearning::controlPicked(const ConfigKey& control) { QString title = m_controlPickerMenu.controlTitleForConfigKey(control); QString description = m_controlPickerMenu.descriptionForConfigKey(control); loadControl(control, title, description); diff --git a/src/controllers/dlgcontrollerlearning.h b/src/controllers/dlgcontrollerlearning.h index c56575ef3d3..c5f19e99080 100644 --- a/src/controllers/dlgcontrollerlearning.h +++ b/src/controllers/dlgcontrollerlearning.h @@ -58,7 +58,7 @@ class DlgControllerLearning : public QDialog, public slots: // Triggered when the user picks a control from the menu. - void controlPicked(ConfigKey control); + void controlPicked(const ConfigKey& control); // Triggered when user clicks a control from the GUI void controlClicked(ControlObject* pControl); void comboboxIndexChanged(int index); @@ -83,7 +83,7 @@ class DlgControllerLearning : public QDialog, #endif private: - void loadControl(const ConfigKey& key, QString title, QString description); + void loadControl(const ConfigKey& key, const QString& title, QString description); void startListening(); void commitMapping(); void resetWizard(bool keepCurrentControl = false); diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index 20a9a192a5a..84e9e9460bd 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -344,7 +344,7 @@ void DlgPrefController::enumeratePresets(const QString& selectedPresetPath) { } PresetInfo DlgPrefController::enumeratePresetsFromEnumerator( - QSharedPointer pPresetEnumerator, QIcon icon) { + QSharedPointer pPresetEnumerator, const QIcon& icon) { PresetInfo match; // Check if enumerator is ready. Should be rare that it isn't. We will diff --git a/src/controllers/dlgprefcontroller.h b/src/controllers/dlgprefcontroller.h index d3ffada377d..845494d43cb 100644 --- a/src/controllers/dlgprefcontroller.h +++ b/src/controllers/dlgprefcontroller.h @@ -103,7 +103,7 @@ class DlgPrefController : public DlgPreferencePage { void enumeratePresets(const QString& selectedPresetPath); PresetInfo enumeratePresetsFromEnumerator( QSharedPointer pPresetEnumerator, - QIcon icon = QIcon()); + const QIcon& icon = QIcon()); void enableDevice(); void disableDevice(); diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp index b803a745146..b7695c92d4f 100644 --- a/src/controllers/hid/hidcontroller.cpp +++ b/src/controllers/hid/hidcontroller.cpp @@ -303,7 +303,7 @@ void HidController::send(QList data, unsigned int length, unsigned int repo send(temp, reportID); } -void HidController::send(QByteArray data) { +void HidController::send(const QByteArray& data) { send(data, 0); } diff --git a/src/controllers/hid/hidcontroller.h b/src/controllers/hid/hidcontroller.h index a53a268720d..98c76a644fa 100644 --- a/src/controllers/hid/hidcontroller.h +++ b/src/controllers/hid/hidcontroller.h @@ -62,7 +62,7 @@ class HidController final : public Controller { // For devices which only support a single report, reportID must be set to // 0x0. - void send(QByteArray data) override; + void send(const QByteArray& data) override; void virtual send(QByteArray data, unsigned int reportID); // Returns a pointer to the currently loaded controller preset. For internal diff --git a/src/controllers/midi/hss1394controller.cpp b/src/controllers/midi/hss1394controller.cpp index fc1b1b668be..5af00d84b01 100644 --- a/src/controllers/midi/hss1394controller.cpp +++ b/src/controllers/midi/hss1394controller.cpp @@ -121,9 +121,9 @@ int Hss1394Controller::open() { unsigned char, mixxx::Duration>::of(&Hss1394Controller::receive)); connect(m_pChannelListener, - QOverload::of(&DeviceChannelListener::incomingData), + QOverload::of(&DeviceChannelListener::incomingData), this, - QOverload::of(&Hss1394Controller::receive)); + QOverload::of(&Hss1394Controller::receive)); if (!m_pChannel->InstallChannelListener(m_pChannelListener)) { qDebug() << "HSS1394 channel listener could not be installed for device" << getName(); @@ -169,9 +169,9 @@ int Hss1394Controller::close() { unsigned char, mixxx::Duration>::of(&Hss1394Controller::receive)); disconnect(m_pChannelListener, - QOverload::of(&DeviceChannelListener::incomingData), + QOverload::of(&DeviceChannelListener::incomingData), this, - QOverload::of(&Hss1394Controller::receive)); + QOverload::of(&Hss1394Controller::receive)); stopEngine(); MidiController::close(); @@ -207,7 +207,7 @@ void Hss1394Controller::sendShortMsg(unsigned char status, unsigned char byte1, //} } -void Hss1394Controller::send(QByteArray data) { +void Hss1394Controller::send(const QByteArray& data) { int bytesSent = m_pChannel->SendChannelBytes( (unsigned char*)data.constData(), data.size()); diff --git a/src/controllers/midi/hss1394controller.h b/src/controllers/midi/hss1394controller.h index c4a0045c59f..8d275bbbc24 100644 --- a/src/controllers/midi/hss1394controller.h +++ b/src/controllers/midi/hss1394controller.h @@ -35,7 +35,8 @@ class DeviceChannelListener : public QObject, public hss1394::ChannelListener { signals: void incomingData(unsigned char status, unsigned char control, unsigned char value, mixxx::Duration timestamp); - void incomingData(QByteArray data, mixxx::Duration timestamp); + void incomingData(const QByteArray& data, mixxx::Duration timestamp); + private: QString m_sName; }; @@ -60,7 +61,7 @@ class Hss1394Controller : public MidiController { private: // The sysex data must already contain the start byte 0xf0 and the end byte // 0xf7. - void send(QByteArray data) override; + void send(const QByteArray& data) override; hss1394::TNodeInfo m_deviceInfo; int m_iDeviceIndex; diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp index c14c2838b3f..14adcc463e5 100644 --- a/src/controllers/midi/midicontroller.cpp +++ b/src/controllers/midi/midicontroller.cpp @@ -460,7 +460,7 @@ double MidiController::computeValue( return newmidivalue; } -void MidiController::receive(QByteArray data, mixxx::Duration timestamp) { +void MidiController::receive(const QByteArray& data, mixxx::Duration timestamp) { controllerDebug(MidiUtils::formatSysexMessage(getName(), data, timestamp)); MidiKey mappingKey(data.at(0), 0xFF); diff --git a/src/controllers/midi/midicontroller.h b/src/controllers/midi/midicontroller.h index fcaa007aba6..0f8267b3eb8 100644 --- a/src/controllers/midi/midicontroller.h +++ b/src/controllers/midi/midicontroller.h @@ -62,7 +62,7 @@ class MidiController : public Controller { /// Alias for send() /// The length parameter is here for backwards compatibility for when scripts /// were required to specify it. - Q_INVOKABLE inline void sendSysexMsg(QList data, unsigned int length = 0) { + Q_INVOKABLE inline void sendSysexMsg(const QList& data, unsigned int length = 0) { Q_UNUSED(length); send(data); } @@ -71,7 +71,7 @@ class MidiController : public Controller { virtual void receive(unsigned char status, unsigned char control, unsigned char value, mixxx::Duration timestamp); // For receiving System Exclusive messages - void receive(const QByteArray data, mixxx::Duration timestamp) override; + void receive(const QByteArray& data, mixxx::Duration timestamp) override; int close() override; private slots: diff --git a/src/controllers/midi/midicontrollerpreset.cpp b/src/controllers/midi/midicontrollerpreset.cpp index 5f3690b4e4e..844746f50db 100644 --- a/src/controllers/midi/midicontrollerpreset.cpp +++ b/src/controllers/midi/midicontrollerpreset.cpp @@ -32,7 +32,7 @@ bool MidiControllerPreset::isMappable() const { return true; } -void MidiControllerPreset::addInputMapping(uint16_t key, MidiInputMapping mapping) { +void MidiControllerPreset::addInputMapping(uint16_t key, const MidiInputMapping& mapping) { m_inputMappings.insert(key, mapping); setDirty(true); } @@ -56,12 +56,12 @@ void MidiControllerPreset::setInputMappings( } void MidiControllerPreset::addOutputMapping( - ConfigKey key, MidiOutputMapping mapping) { + const ConfigKey& key, const MidiOutputMapping& mapping) { m_outputMappings.insert(key, mapping); setDirty(true); } -void MidiControllerPreset::removeOutputMapping(ConfigKey key) { +void MidiControllerPreset::removeOutputMapping(const ConfigKey& key) { m_outputMappings.remove(key); setDirty(true); } diff --git a/src/controllers/midi/midicontrollerpreset.h b/src/controllers/midi/midicontrollerpreset.h index 0378fb5e670..f077f0f8f33 100644 --- a/src/controllers/midi/midicontrollerpreset.h +++ b/src/controllers/midi/midicontrollerpreset.h @@ -24,14 +24,14 @@ class MidiControllerPreset : public ControllerPreset { virtual bool isMappable() const override; // Input mappings - void addInputMapping(uint16_t key, MidiInputMapping mapping); + void addInputMapping(uint16_t key, const MidiInputMapping& mapping); void removeInputMapping(uint16_t key); const QMultiHash& getInputMappings() const; void setInputMappings(const QMultiHash& mappings); // Output mappings - void addOutputMapping(ConfigKey key, MidiOutputMapping mapping); - void removeOutputMapping(ConfigKey key); + void addOutputMapping(const ConfigKey& key, const MidiOutputMapping& mapping); + void removeOutputMapping(const ConfigKey& key); const QMultiHash& getOutputMappings() const; void setOutputMappings(const QMultiHash& mappings); diff --git a/src/controllers/midi/midimessage.h b/src/controllers/midi/midimessage.h index 8223dea32e8..2587603cb55 100644 --- a/src/controllers/midi/midimessage.h +++ b/src/controllers/midi/midimessage.h @@ -163,7 +163,7 @@ struct MidiInputMapping { MidiInputMapping(MidiKey key, MidiOptions options, const ConfigKey& control, - QString description) + const QString& description) : key(key), options(options), control(control), diff --git a/src/controllers/midi/portmidicontroller.cpp b/src/controllers/midi/portmidicontroller.cpp index 4be78583c78..521ee0dd210 100644 --- a/src/controllers/midi/portmidicontroller.cpp +++ b/src/controllers/midi/portmidicontroller.cpp @@ -229,7 +229,7 @@ void PortMidiController::sendShortMsg(unsigned char status, unsigned char byte1, } } -void PortMidiController::send(QByteArray data) { +void PortMidiController::send(const QByteArray& data) { // PortMidi does not receive a length argument for the buffer we provide to // Pm_WriteSysEx. Instead, it scans for a MIDI_EOX byte to know when the // message is over. If one is not provided, it will overflow the buffer and diff --git a/src/controllers/midi/portmidicontroller.h b/src/controllers/midi/portmidicontroller.h index 92d2954e18f..b1d1aec7695 100644 --- a/src/controllers/midi/portmidicontroller.h +++ b/src/controllers/midi/portmidicontroller.h @@ -79,7 +79,7 @@ class PortMidiController : public MidiController { private: // The sysex data must already contain the start byte 0xf0 and the end byte // 0xf7. - void send(QByteArray data) override; + void send(const QByteArray& data) override; bool isPolling() const override { return true; diff --git a/src/controllers/midi/portmidienumerator.cpp b/src/controllers/midi/portmidienumerator.cpp index 356c111d376..05edd277e52 100644 --- a/src/controllers/midi/portmidienumerator.cpp +++ b/src/controllers/midi/portmidienumerator.cpp @@ -53,8 +53,8 @@ PortMidiEnumerator::~PortMidiEnumerator() { } } -bool namesMatchMidiPattern(const QString input_name, - const QString output_name) { +bool namesMatchMidiPattern(const QString& input_name, + const QString& output_name) { // Some platforms format MIDI device names as "deviceName MIDI ###" where // ### is the instance # of the device. Therefore we want to link two // devices that have an equivalent "deviceName" and ### section. @@ -77,8 +77,8 @@ bool namesMatchMidiPattern(const QString input_name, return false; } -bool namesMatchInOutPattern(const QString input_name, - const QString output_name) { +bool namesMatchInOutPattern(const QString& input_name, + const QString& output_name) { QString basePattern = "^(.*) %1 (\\d+)( .*)?$"; QRegExp inputPattern(basePattern.arg("in")); QRegExp outputPattern(basePattern.arg("out")); @@ -100,8 +100,8 @@ bool namesMatchInOutPattern(const QString input_name, return false; } -bool namesMatchPattern(const QString input_name, - const QString output_name) { +bool namesMatchPattern(const QString& input_name, + const QString& output_name) { // This is a broad pattern that matches a text blob followed by a numeral // potentially followed by non-numeric text. The non-numeric requirement is // meant to avoid corner cases around devices with names like "Hercules RMX @@ -126,8 +126,8 @@ bool namesMatchPattern(const QString input_name, return false; } -bool namesMatchAllowableEdgeCases(const QString input_name, - const QString output_name) { +bool namesMatchAllowableEdgeCases(const QString& input_name, + const QString& output_name) { // Mac OS 10.12 & Korg Kaoss DJ 1.6: // Korg Kaoss DJ has input 'KAOSS DJ CONTROL' and output 'KAOSS DJ SOUND'. // This means it doesn't pass the shouldLinkInputToOutput test. Without an @@ -139,8 +139,8 @@ bool namesMatchAllowableEdgeCases(const QString input_name, return false; } -bool shouldLinkInputToOutput(const QString input_name, - const QString output_name) { +bool shouldLinkInputToOutput(const QString& input_name, + const QString& output_name) { // Early exit. if (input_name == output_name || namesMatchAllowableEdgeCases(input_name, output_name)) { return true; diff --git a/src/controllers/midi/portmidienumerator.h b/src/controllers/midi/portmidienumerator.h index 5169efbfa06..7b467de4903 100644 --- a/src/controllers/midi/portmidienumerator.h +++ b/src/controllers/midi/portmidienumerator.h @@ -24,7 +24,7 @@ class PortMidiEnumerator : public MidiEnumerator { }; // For testing. -bool shouldLinkInputToOutput(const QString input_name, - const QString output_name); +bool shouldLinkInputToOutput(const QString& input_name, + const QString& output_name); #endif diff --git a/src/dialog/dlgreplacecuecolor.h b/src/dialog/dlgreplacecuecolor.h index 9ded791ef23..397595f7292 100644 --- a/src/dialog/dlgreplacecuecolor.h +++ b/src/dialog/dlgreplacecuecolor.h @@ -43,7 +43,7 @@ class DlgReplaceCueColor : public QDialog, public Ui::DlgReplaceCueColor { void setCurrentColor(mixxx::RgbColor color); signals: - void databaseTracksChanged(QSet Trackids); + void databaseTracksChanged(const QSet& Trackids); private slots: void slotApply(); diff --git a/src/effects/builtin/echoeffect.h b/src/effects/builtin/echoeffect.h index c1d9266a5fe..876f623c23a 100644 --- a/src/effects/builtin/echoeffect.h +++ b/src/effects/builtin/echoeffect.h @@ -18,13 +18,13 @@ class EchoGroupState : public EffectState { // 40 BPM. static constexpr int kMaxDelaySeconds = 3; - EchoGroupState(const mixxx::EngineParameters bufferParameters) - : EffectState(bufferParameters) { + EchoGroupState(const mixxx::EngineParameters& bufferParameters) + : EffectState(bufferParameters) { audioParametersChanged(bufferParameters); clear(); } - void audioParametersChanged(const mixxx::EngineParameters bufferParameters) { + void audioParametersChanged(const mixxx::EngineParameters& bufferParameters) { delay_buf = mixxx::SampleBuffer(kMaxDelaySeconds * bufferParameters.sampleRate() * bufferParameters.channelCount()); }; diff --git a/src/effects/effectinstantiator.h b/src/effects/effectinstantiator.h index 483dd4cc2f7..38167a6d593 100644 --- a/src/effects/effectinstantiator.h +++ b/src/effects/effectinstantiator.h @@ -31,11 +31,12 @@ class EffectProcessorInstantiator : public EffectInstantiator { class LV2EffectProcessorInstantiator : public EffectInstantiator { public: LV2EffectProcessorInstantiator(const LilvPlugin* plugin, - QList audioPortIndices, - QList controlPortIndices) + const QList& audioPortIndices, + const QList& controlPortIndices) : m_pPlugin(plugin), m_audioPortIndices(audioPortIndices), - m_controlPortIndices(controlPortIndices) { } + m_controlPortIndices(controlPortIndices) { + } EffectProcessor* instantiate(EngineEffect* pEngineEffect, EffectManifestPointer pManifest) { diff --git a/src/effects/lv2/lv2effectprocessor.cpp b/src/effects/lv2/lv2effectprocessor.cpp index b5f81741102..ad49a4537d8 100644 --- a/src/effects/lv2/lv2effectprocessor.cpp +++ b/src/effects/lv2/lv2effectprocessor.cpp @@ -5,14 +5,14 @@ #include "util/defs.h" LV2EffectProcessor::LV2EffectProcessor(EngineEffect* pEngineEffect, - EffectManifestPointer pManifest, - const LilvPlugin* plugin, - QList audioPortIndices, - QList controlPortIndices) - : m_pPlugin(plugin), - m_audioPortIndices(audioPortIndices), - m_controlPortIndices(controlPortIndices), - m_pEffectsManager(nullptr) { + EffectManifestPointer pManifest, + const LilvPlugin* plugin, + const QList& audioPortIndices, + const QList& controlPortIndices) + : m_pPlugin(plugin), + m_audioPortIndices(audioPortIndices), + m_controlPortIndices(controlPortIndices), + m_pEffectsManager(nullptr) { m_inputL = new float[MAX_BUFFER_LEN]; m_inputR = new float[MAX_BUFFER_LEN]; m_outputL = new float[MAX_BUFFER_LEN]; diff --git a/src/effects/lv2/lv2effectprocessor.h b/src/effects/lv2/lv2effectprocessor.h index 3cebc56d12e..d5944469652 100644 --- a/src/effects/lv2/lv2effectprocessor.h +++ b/src/effects/lv2/lv2effectprocessor.h @@ -29,10 +29,10 @@ class LV2EffectGroupState : public EffectState { class LV2EffectProcessor : public EffectProcessor { public: LV2EffectProcessor(EngineEffect* pEngineEffect, - EffectManifestPointer pManifest, - const LilvPlugin* plugin, - QList audioPortIndices, - QList controlPortIndices); + EffectManifestPointer pManifest, + const LilvPlugin* plugin, + const QList& audioPortIndices, + const QList& controlPortIndices); ~LV2EffectProcessor(); void initialize( diff --git a/src/encoder/encoder.cpp b/src/encoder/encoder.cpp index 7bbef1c4c0a..3a1dc159a56 100644 --- a/src/encoder/encoder.cpp +++ b/src/encoder/encoder.cpp @@ -64,8 +64,7 @@ Encoder::Format EncoderFactory::getSelectedFormat(UserSettingsPointer pConfig) c { return getFormatFor(pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Encoding"))); } -Encoder::Format EncoderFactory::getFormatFor(QString formatText) const -{ +Encoder::Format EncoderFactory::getFormatFor(const QString& formatText) const { for (const auto& format : m_formats) { if (format.internalName == formatText) { return format; @@ -77,8 +76,8 @@ Encoder::Format EncoderFactory::getFormatFor(QString formatText) const } EncoderPointer EncoderFactory::createRecordingEncoder( - Encoder::Format format, - UserSettingsPointer pConfig, + const Encoder::Format& format, + UserSettingsPointer pConfig, EncoderCallback* pCallback) const { EncoderRecordingSettingsPointer pSettings = getEncoderRecordingSettings(format, pConfig); diff --git a/src/encoder/encoder.h b/src/encoder/encoder.h index 7e02757b499..5f918085a0a 100644 --- a/src/encoder/encoder.h +++ b/src/encoder/encoder.h @@ -21,8 +21,9 @@ class Encoder { public: class Format { public: - Format(QString labelIn, QString nameIn, bool losslessIn) : - label(labelIn), internalName(nameIn), lossless(losslessIn) {} + Format(const QString& labelIn, const QString& nameIn, bool losslessIn) + : label(labelIn), internalName(nameIn), lossless(losslessIn) { + } QString label; QString internalName; bool lossless; @@ -31,7 +32,7 @@ class Encoder { Encoder() {} virtual ~Encoder() = default; - virtual int initEncoder(int samplerate, QString errorMessage) = 0; + virtual int initEncoder(int samplerate, QString& errorMessage) = 0; // encodes the provided buffer of audio. virtual void encodeBuffer(const CSAMPLE *samples, const int size) = 0; // Adds metadata to the encoded audio, i.e., the ID3 tag. Currently only used @@ -53,9 +54,9 @@ class EncoderFactory { const QList getFormats() const; Encoder::Format getSelectedFormat(UserSettingsPointer pConfig) const; - Encoder::Format getFormatFor(QString format) const; + Encoder::Format getFormatFor(const QString& format) const; EncoderPointer createRecordingEncoder( - Encoder::Format format, + const Encoder::Format& format, UserSettingsPointer pConfig, EncoderCallback* pCallback) const; EncoderPointer createEncoder( diff --git a/src/encoder/encoderflacsettings.cpp b/src/encoder/encoderflacsettings.cpp index 8e31a429bd2..3900d6cd136 100644 --- a/src/encoder/encoderflacsettings.cpp +++ b/src/encoder/encoderflacsettings.cpp @@ -78,7 +78,7 @@ QList EncoderFlacSettings::getOptionGroups() cons // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. -void EncoderFlacSettings::setGroupOption(QString groupCode, int optionIndex) { +void EncoderFlacSettings::setGroupOption(const QString& groupCode, int optionIndex) { bool found=false; for (const auto& group : qAsConst(m_radioList)) { if (groupCode == group.groupCode) { @@ -98,7 +98,7 @@ void EncoderFlacSettings::setGroupOption(QString groupCode, int optionIndex) { } // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. -int EncoderFlacSettings::getSelectedOption(QString groupCode) const { +int EncoderFlacSettings::getSelectedOption(const QString& groupCode) const { bool found=false; int value = m_pConfig->getValue(ConfigKey(RECORDING_PREF_KEY, groupCode), 0); for (const auto& group : m_radioList) { diff --git a/src/encoder/encoderflacsettings.h b/src/encoder/encoderflacsettings.h index 0e95cc34d34..da2918e97db 100644 --- a/src/encoder/encoderflacsettings.h +++ b/src/encoder/encoderflacsettings.h @@ -29,10 +29,10 @@ class EncoderFlacSettings : public EncoderRecordingSettings { QList getOptionGroups() const override; // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. - void setGroupOption(QString groupCode, int optionIndex) override; + void setGroupOption(const QString& groupCode, int optionIndex) override; // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. - int getSelectedOption(QString groupCode) const override; + int getSelectedOption(const QString& groupCode) const override; // Returns the format of this encoder settings. QString getFormat() const override { diff --git a/src/encoder/encodermp3.cpp b/src/encoder/encodermp3.cpp index ba4b9c212e1..f938bb34114 100644 --- a/src/encoder/encodermp3.cpp +++ b/src/encoder/encodermp3.cpp @@ -164,7 +164,7 @@ void EncoderMp3::initStream() { m_bufferIn[1] = (float *)malloc(m_bufferOutSize * sizeof(float)); } -int EncoderMp3::initEncoder(int samplerate, QString errorMessage) { +int EncoderMp3::initEncoder(int samplerate, QString& errorMessage) { unsigned long samplerate_in = samplerate; // samplerate_out 0 means "let LAME pick the appropriate one" unsigned long samplerate_out = (samplerate_in > 48000 ? 48000 : 0); diff --git a/src/encoder/encodermp3.h b/src/encoder/encodermp3.h index c36a92d5ca7..901eadb5b1c 100644 --- a/src/encoder/encodermp3.h +++ b/src/encoder/encodermp3.h @@ -15,7 +15,7 @@ class EncoderMp3 final : public Encoder { EncoderMp3(EncoderCallback* callback=nullptr); ~EncoderMp3() override; - int initEncoder(int samplerate, QString errorMessage) override; + int initEncoder(int samplerate, QString& errorMessage) override; void encodeBuffer(const CSAMPLE *samples, const int size) override; void updateMetaData(const QString& artist, const QString& title, const QString& album) override; void flush() override; diff --git a/src/encoder/encodermp3settings.cpp b/src/encoder/encodermp3settings.cpp index 6c4178d7b63..b5fef2c15b3 100644 --- a/src/encoder/encodermp3settings.cpp +++ b/src/encoder/encodermp3settings.cpp @@ -94,8 +94,7 @@ QList EncoderMp3Settings::getOptionGroups() const } // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. -void EncoderMp3Settings::setGroupOption(QString groupCode, int optionIndex) -{ +void EncoderMp3Settings::setGroupOption(const QString& groupCode, int optionIndex) { bool found=false; for (const auto& group : qAsConst(m_radioList)) { if (groupCode == group.groupCode) { @@ -115,8 +114,7 @@ void EncoderMp3Settings::setGroupOption(QString groupCode, int optionIndex) } // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. -int EncoderMp3Settings::getSelectedOption(QString groupCode) const -{ +int EncoderMp3Settings::getSelectedOption(const QString& groupCode) const { bool found=false; int value = m_pConfig->getValue( ConfigKey(RECORDING_PREF_KEY, ENCODING_MODE_GROUP), 0); diff --git a/src/encoder/encodermp3settings.h b/src/encoder/encodermp3settings.h index 518b1fd569b..d32245fd14a 100644 --- a/src/encoder/encodermp3settings.h +++ b/src/encoder/encodermp3settings.h @@ -33,10 +33,10 @@ class EncoderMp3Settings : public EncoderRecordingSettings { QList getOptionGroups() const override; // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. - void setGroupOption(QString groupCode, int optionIndex) override; + void setGroupOption(const QString& groupCode, int optionIndex) override; // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. - int getSelectedOption(QString groupCode) const override; + int getSelectedOption(const QString& groupCode) const override; // Returns the format of this encoder settings. QString getFormat() const override { diff --git a/src/encoder/encoderopus.cpp b/src/encoder/encoderopus.cpp index d0b6a9d029d..b2551dd6354 100644 --- a/src/encoder/encoderopus.cpp +++ b/src/encoder/encoderopus.cpp @@ -151,7 +151,7 @@ void EncoderOpus::setEncoderSettings(const EncoderSettings& settings) { } } -int EncoderOpus::initEncoder(int samplerate, QString errorMessage) { +int EncoderOpus::initEncoder(int samplerate, QString& errorMessage) { Q_UNUSED(errorMessage); if (samplerate != kMasterSamplerate) { diff --git a/src/encoder/encoderopus.h b/src/encoder/encoderopus.h index 652269ba114..66bd42e7880 100644 --- a/src/encoder/encoderopus.h +++ b/src/encoder/encoderopus.h @@ -26,7 +26,7 @@ class EncoderOpus: public Encoder { explicit EncoderOpus(EncoderCallback* pCallback = nullptr); ~EncoderOpus() override; - int initEncoder(int samplerate, QString errorMessage) override; + int initEncoder(int samplerate, QString& errorMessage) override; void encodeBuffer(const CSAMPLE *samples, const int size) override; void updateMetaData(const QString& artist, const QString& title, const QString& album) override; void flush() override; diff --git a/src/encoder/encoderopussettings.cpp b/src/encoder/encoderopussettings.cpp index 31e6991c7e9..29fe02c60c2 100644 --- a/src/encoder/encoderopussettings.cpp +++ b/src/encoder/encoderopussettings.cpp @@ -90,7 +90,7 @@ QList EncoderOpusSettings::getOptionGroups() cons return m_radioList; } -void EncoderOpusSettings::setGroupOption(QString groupCode, int optionIndex) { +void EncoderOpusSettings::setGroupOption(const QString& groupCode, int optionIndex) { bool found = false; for (const OptionsGroup& group : qAsConst(m_radioList)) { if (groupCode == group.groupCode) { @@ -113,7 +113,7 @@ void EncoderOpusSettings::setGroupOption(QString groupCode, int optionIndex) { } } -int EncoderOpusSettings::getSelectedOption(QString groupCode) const { +int EncoderOpusSettings::getSelectedOption(const QString& groupCode) const { int value = m_pConfig->getValue( ConfigKey(RECORDING_PREF_KEY, BITRATE_MODE_GROUP), 0); diff --git a/src/encoder/encoderopussettings.h b/src/encoder/encoderopussettings.h index 0d6e46041ba..0b03d909633 100644 --- a/src/encoder/encoderopussettings.h +++ b/src/encoder/encoderopussettings.h @@ -34,10 +34,10 @@ class EncoderOpusSettings: public EncoderRecordingSettings { QList getOptionGroups() const override; // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. - void setGroupOption(QString groupCode, int optionIndex) override; + void setGroupOption(const QString& groupCode, int optionIndex) override; // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. - int getSelectedOption(QString groupCode) const override; + int getSelectedOption(const QString& groupCode) const override; // Returns the format of this encoder settings. QString getFormat() const override { diff --git a/src/encoder/encoderrecordingsettings.h b/src/encoder/encoderrecordingsettings.h index 6038d9e00c2..47e1c38e1fd 100644 --- a/src/encoder/encoderrecordingsettings.h +++ b/src/encoder/encoderrecordingsettings.h @@ -28,7 +28,7 @@ class EncoderRecordingSettings : public EncoderSettings { // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. - virtual void setGroupOption(QString groupCode, int optionIndex) { + virtual void setGroupOption(const QString& groupCode, int optionIndex) { Q_UNUSED(groupCode); Q_UNUSED(optionIndex); DEBUG_ASSERT(!"unimplemented"); diff --git a/src/encoder/encodersettings.h b/src/encoder/encodersettings.h index a12908f70f0..1559743dbe5 100644 --- a/src/encoder/encodersettings.h +++ b/src/encoder/encodersettings.h @@ -16,8 +16,13 @@ class EncoderSettings { public: class OptionsGroup { public: - OptionsGroup(QString gName, QString gCode, QList conNames) : - groupName(gName), groupCode(gCode), controlNames(conNames) {} + OptionsGroup(const QString& gName, + const QString& gCode, + const QList& conNames) + : groupName(gName), + groupCode(gCode), + controlNames(conNames) { + } QString groupName; QString groupCode; QList controlNames; @@ -45,8 +50,11 @@ class EncoderSettings { // index 0 means disabled and 1 enabled. // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. - virtual int getSelectedOption(QString groupCode) const { Q_UNUSED(groupCode); return 0; } - + virtual int getSelectedOption(const QString& groupCode) const { + Q_UNUSED(groupCode); + return 0; + } + virtual ChannelMode getChannelMode() const { return ChannelMode::AUTOMATIC; } // Returns the format subtype of this encoder settings. diff --git a/src/encoder/encodervorbis.cpp b/src/encoder/encodervorbis.cpp index 3241fe29c5d..595897e1b47 100644 --- a/src/encoder/encodervorbis.cpp +++ b/src/encoder/encodervorbis.cpp @@ -217,7 +217,7 @@ void EncoderVorbis::initStream() { m_bStreamInitialized = true; } -int EncoderVorbis::initEncoder(int samplerate, QString errorMessage) { +int EncoderVorbis::initEncoder(int samplerate, QString& errorMessage) { vorbis_info_init(&m_vinfo); // initialize VBR quality based mode diff --git a/src/encoder/encodervorbis.h b/src/encoder/encodervorbis.h index 112e96dce91..6b30068e27e 100644 --- a/src/encoder/encodervorbis.h +++ b/src/encoder/encodervorbis.h @@ -28,7 +28,7 @@ class EncoderVorbis : public Encoder { EncoderVorbis(EncoderCallback* pCallback = nullptr); ~EncoderVorbis() override; - int initEncoder(int samplerate, QString errorMessage) override; + int initEncoder(int samplerate, QString& errorMessage) override; void encodeBuffer(const CSAMPLE *samples, const int size) override; void updateMetaData(const QString& artist, const QString& title, const QString& album) override; void flush() override; diff --git a/src/encoder/encoderwave.cpp b/src/encoder/encoderwave.cpp index df30d3ed96a..96682a467d8 100644 --- a/src/encoder/encoderwave.cpp +++ b/src/encoder/encoderwave.cpp @@ -201,8 +201,7 @@ void EncoderWave::initStream() { } } -int EncoderWave::initEncoder(int samplerate, QString errorMessage) { - +int EncoderWave::initEncoder(int samplerate, QString& errorMessage) { // set sfInfo. // m_sfInfo.format is setup on setEncoderSettings previous to calling initEncoder. m_sfInfo.samplerate = samplerate; diff --git a/src/encoder/encoderwave.h b/src/encoder/encoderwave.h index 0691fd6b3ee..6661662a969 100644 --- a/src/encoder/encoderwave.h +++ b/src/encoder/encoderwave.h @@ -29,7 +29,7 @@ class EncoderWave : public Encoder { EncoderWave(EncoderCallback* pCallback = nullptr); ~EncoderWave() override; - int initEncoder(int samplerate, QString errorMessage) override; + int initEncoder(int samplerate, QString& errorMessage) override; void encodeBuffer(const CSAMPLE *samples, const int size) override; void updateMetaData(const QString& artist, const QString& title, const QString& album) override; void flush() override; diff --git a/src/encoder/encoderwavesettings.cpp b/src/encoder/encoderwavesettings.cpp index fcc0e915cfb..fa0a96cd1a7 100644 --- a/src/encoder/encoderwavesettings.cpp +++ b/src/encoder/encoderwavesettings.cpp @@ -34,7 +34,7 @@ QList EncoderWaveSettings::getOptionGroups() cons // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. -void EncoderWaveSettings::setGroupOption(QString groupCode, int optionIndex) { +void EncoderWaveSettings::setGroupOption(const QString& groupCode, int optionIndex) { bool found=false; for (const auto& group : qAsConst(m_radioList)) { if (groupCode == group.groupCode) { @@ -55,7 +55,7 @@ void EncoderWaveSettings::setGroupOption(QString groupCode, int optionIndex) { } // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. -int EncoderWaveSettings::getSelectedOption(QString groupCode) const { +int EncoderWaveSettings::getSelectedOption(const QString& groupCode) const { bool found=false; int value = m_pConfig->getValue( ConfigKey(RECORDING_PREF_KEY, m_format + "_" + groupCode), 0); diff --git a/src/encoder/encoderwavesettings.h b/src/encoder/encoderwavesettings.h index 6c0d0a38f14..8a1cb56cbf8 100644 --- a/src/encoder/encoderwavesettings.h +++ b/src/encoder/encoderwavesettings.h @@ -21,10 +21,10 @@ class EncoderWaveSettings : public EncoderRecordingSettings { QList getOptionGroups() const override; // Selects the option by its index. If it is a single-element option, // index 0 means disabled and 1 enabled. - void setGroupOption(QString groupCode, int optionIndex) override; + void setGroupOption(const QString& groupCode, int optionIndex) override; // Return the selected option of the group. If it is a single-element option, // 0 means disabled and 1 enabled. - int getSelectedOption(QString groupCode) const override; + int getSelectedOption(const QString& groupCode) const override; // Returns the format subtype of this encoder settings. QString getFormat() const override{ diff --git a/src/engine/cachingreader/cachingreader.cpp b/src/engine/cachingreader/cachingreader.cpp index d7332eb27ce..592371a6863 100644 --- a/src/engine/cachingreader/cachingreader.cpp +++ b/src/engine/cachingreader/cachingreader.cpp @@ -40,7 +40,7 @@ const SINT kNumberOfCachedChunksInMemory = 80; } // anonymous namespace -CachingReader::CachingReader(QString group, +CachingReader::CachingReader(const QString& group, UserSettingsPointer config) : m_pConfig(config), // Limit the number of in-flight requests to the worker. This should diff --git a/src/engine/cachingreader/cachingreader.h b/src/engine/cachingreader/cachingreader.h index 24b039f11e4..01529342ea1 100644 --- a/src/engine/cachingreader/cachingreader.h +++ b/src/engine/cachingreader/cachingreader.h @@ -75,8 +75,8 @@ class CachingReader : public QObject { public: // Construct a CachingReader with the given group. - CachingReader(QString group, - UserSettingsPointer _config); + CachingReader(const QString& group, + UserSettingsPointer _config); ~CachingReader() override; void process(); @@ -115,7 +115,7 @@ class CachingReader : public QObject { // Emitted once a new track is loaded and ready to be read from. void trackLoading(); void trackLoaded(TrackPointer pTrack, int iSampleRate, int iNumSamples); - void trackLoadFailed(TrackPointer pTrack, QString reason); + void trackLoadFailed(TrackPointer pTrack, const QString& reason); private: const UserSettingsPointer m_pConfig; diff --git a/src/engine/cachingreader/cachingreaderworker.cpp b/src/engine/cachingreader/cachingreaderworker.cpp index ae5b9d82563..aefd482d040 100644 --- a/src/engine/cachingreader/cachingreaderworker.cpp +++ b/src/engine/cachingreader/cachingreaderworker.cpp @@ -18,7 +18,7 @@ mixxx::Logger kLogger("CachingReaderWorker"); } // anonymous namespace CachingReaderWorker::CachingReaderWorker( - QString group, + const QString& group, FIFO* pChunkReadRequestFIFO, FIFO* pReaderStatusFIFO) : m_group(group), diff --git a/src/engine/cachingreader/cachingreaderworker.h b/src/engine/cachingreader/cachingreaderworker.h index eb0f68081ca..6118c58c94a 100644 --- a/src/engine/cachingreader/cachingreaderworker.h +++ b/src/engine/cachingreader/cachingreaderworker.h @@ -97,7 +97,7 @@ class CachingReaderWorker : public EngineWorker { public: // Construct a CachingReader with the given group. - CachingReaderWorker(QString group, + CachingReaderWorker(const QString& group, FIFO* pChunkReadRequestFIFO, FIFO* pReaderStatusFIFO); ~CachingReaderWorker() override = default; @@ -115,7 +115,7 @@ class CachingReaderWorker : public EngineWorker { // Emitted once a new track is loaded and ready to be read from. void trackLoading(); void trackLoaded(TrackPointer pTrack, int iSampleRate, int iNumSamples); - void trackLoadFailed(TrackPointer pTrack, QString reason); + void trackLoadFailed(TrackPointer pTrack, const QString& reason); private: const QString m_group; diff --git a/src/engine/channels/engineaux.cpp b/src/engine/channels/engineaux.cpp index eaaef154ae8..9f75ec6d682 100644 --- a/src/engine/channels/engineaux.cpp +++ b/src/engine/channels/engineaux.cpp @@ -46,7 +46,7 @@ bool EngineAux::isActive() { return m_wasActive; } -void EngineAux::onInputConfigured(AudioInput input) { +void EngineAux::onInputConfigured(const AudioInput& input) { if (input.getType() != AudioPath::AUXILIARY) { // This is an error! qDebug() << "WARNING: EngineAux connected to AudioInput for a non-auxiliary type!"; @@ -56,7 +56,7 @@ void EngineAux::onInputConfigured(AudioInput input) { m_pInputConfigured->forceSet(1.0); } -void EngineAux::onInputUnconfigured(AudioInput input) { +void EngineAux::onInputUnconfigured(const AudioInput& input) { if (input.getType() != AudioPath::AUXILIARY) { // This is an error! qDebug() << "WARNING: EngineAux connected to AudioInput for a non-auxiliary type!"; @@ -66,8 +66,8 @@ void EngineAux::onInputUnconfigured(AudioInput input) { m_pInputConfigured->forceSet(0.0); } -void EngineAux::receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int nFrames) { +void EngineAux::receiveBuffer( + const AudioInput& input, const CSAMPLE* pBuffer, unsigned int nFrames) { Q_UNUSED(input); Q_UNUSED(nFrames); m_sampleBuffer = pBuffer; diff --git a/src/engine/channels/engineaux.h b/src/engine/channels/engineaux.h index cf01a5aad33..d12f65ad8b8 100644 --- a/src/engine/channels/engineaux.h +++ b/src/engine/channels/engineaux.h @@ -35,16 +35,17 @@ class EngineAux : public EngineChannel, public AudioDestination { // the soundcard this AudioDestination was registered for! Beware, in the // case of multiple soundcards, this method is not re-entrant but it may be // concurrent with EngineMaster processing. - virtual void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int nFrames); + virtual void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int nFrames); // Called by SoundManager whenever the aux input is connected to a // soundcard input. - virtual void onInputConfigured(AudioInput input); + virtual void onInputConfigured(const AudioInput& input); // Called by SoundManager whenever the aux input is disconnected from // a soundcard input. - virtual void onInputUnconfigured(AudioInput input); + virtual void onInputUnconfigured(const AudioInput& input); private: QScopedPointer m_pInputConfigured; diff --git a/src/engine/channels/enginedeck.cpp b/src/engine/channels/enginedeck.cpp index 27431078c65..8eeb3d1bade 100644 --- a/src/engine/channels/enginedeck.cpp +++ b/src/engine/channels/enginedeck.cpp @@ -131,7 +131,8 @@ bool EngineDeck::isActive() { return active; } -void EngineDeck::receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, unsigned int nFrames) { +void EngineDeck::receiveBuffer( + const AudioInput& input, const CSAMPLE* pBuffer, unsigned int nFrames) { Q_UNUSED(input); Q_UNUSED(nFrames); // Skip receiving audio input if passthrough is not active @@ -143,7 +144,7 @@ void EngineDeck::receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, unsigne } } -void EngineDeck::onInputConfigured(AudioInput input) { +void EngineDeck::onInputConfigured(const AudioInput& input) { if (input.getType() != AudioPath::VINYLCONTROL) { // This is an error! qDebug() << "WARNING: EngineDeck connected to AudioInput for a non-vinylcontrol type!"; @@ -153,7 +154,7 @@ void EngineDeck::onInputConfigured(AudioInput input) { m_sampleBuffer = NULL; } -void EngineDeck::onInputUnconfigured(AudioInput input) { +void EngineDeck::onInputUnconfigured(const AudioInput& input) { if (input.getType() != AudioPath::VINYLCONTROL) { // This is an error! qDebug() << "WARNING: EngineDeck connected to AudioInput for a non-vinylcontrol type!"; diff --git a/src/engine/channels/enginedeck.h b/src/engine/channels/enginedeck.h index f571dadb380..cc0006c9c70 100644 --- a/src/engine/channels/enginedeck.h +++ b/src/engine/channels/enginedeck.h @@ -62,16 +62,17 @@ class EngineDeck : public EngineChannel, public AudioDestination { // the soundcard this AudioDestination was registered for! Beware, in the // case of multiple soundcards, this method is not re-entrant but it may be // concurrent with EngineMaster processing. - virtual void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int nFrames); + virtual void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int nFrames); // Called by SoundManager whenever the passthrough input is connected to a // soundcard input. - virtual void onInputConfigured(AudioInput input); + virtual void onInputConfigured(const AudioInput& input); // Called by SoundManager whenever the passthrough input is disconnected // from a soundcard input. - virtual void onInputUnconfigured(AudioInput input); + virtual void onInputUnconfigured(const AudioInput& input); // Return whether or not passthrough is active bool isPassthroughActive() const; diff --git a/src/engine/channels/enginemicrophone.cpp b/src/engine/channels/enginemicrophone.cpp index be6e8c41744..ceefe6f5b15 100644 --- a/src/engine/channels/enginemicrophone.cpp +++ b/src/engine/channels/enginemicrophone.cpp @@ -43,7 +43,7 @@ bool EngineMicrophone::isActive() { return m_wasActive; } -void EngineMicrophone::onInputConfigured(AudioInput input) { +void EngineMicrophone::onInputConfigured(const AudioInput& input) { if (input.getType() != AudioPath::MICROPHONE) { // This is an error! qWarning() << "EngineMicrophone connected to AudioInput for a non-Microphone type!"; @@ -53,7 +53,7 @@ void EngineMicrophone::onInputConfigured(AudioInput input) { m_pInputConfigured->forceSet(1.0); } -void EngineMicrophone::onInputUnconfigured(AudioInput input) { +void EngineMicrophone::onInputUnconfigured(const AudioInput& input) { if (input.getType() != AudioPath::MICROPHONE) { // This is an error! qWarning() << "EngineMicrophone connected to AudioInput for a non-Microphone type!"; @@ -63,8 +63,8 @@ void EngineMicrophone::onInputUnconfigured(AudioInput input) { m_pInputConfigured->forceSet(0.0); } -void EngineMicrophone::receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int nFrames) { +void EngineMicrophone::receiveBuffer( + const AudioInput& input, const CSAMPLE* pBuffer, unsigned int nFrames) { Q_UNUSED(input); Q_UNUSED(nFrames); m_sampleBuffer = pBuffer; diff --git a/src/engine/channels/enginemicrophone.h b/src/engine/channels/enginemicrophone.h index f3ac6f0b3e4..0cca9c294cd 100644 --- a/src/engine/channels/enginemicrophone.h +++ b/src/engine/channels/enginemicrophone.h @@ -38,16 +38,17 @@ class EngineMicrophone : public EngineChannel, public AudioDestination { // the soundcard this AudioDestination was registered for! Beware, in the // case of multiple soundcards, this method is not re-entrant but it may be // concurrent with EngineMaster processing. - virtual void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int iNumSamples); + virtual void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int iNumSamples); // Called by SoundManager whenever the microphone input is connected to a // soundcard input. - virtual void onInputConfigured(AudioInput input); + virtual void onInputConfigured(const AudioInput& input); // Called by SoundManager whenever the microphone input is disconnected from // a soundcard input. - virtual void onInputUnconfigured(AudioInput input); + virtual void onInputUnconfigured(const AudioInput& input); bool isSolo(); double getSoloDamping(); diff --git a/src/engine/controls/bpmcontrol.cpp b/src/engine/controls/bpmcontrol.cpp index 20285ca89f9..52370da16db 100644 --- a/src/engine/controls/bpmcontrol.cpp +++ b/src/engine/controls/bpmcontrol.cpp @@ -40,7 +40,7 @@ constexpr int kLocalBpmSpan = 4; constexpr SINT kSamplesPerFrame = 2; } -BpmControl::BpmControl(QString group, +BpmControl::BpmControl(const QString& group, UserSettingsPointer pConfig) : EngineControl(group, pConfig), m_tapFilter(this, kBpmTapFilterLength, kBpmTapMaxInterval), diff --git a/src/engine/controls/bpmcontrol.h b/src/engine/controls/bpmcontrol.h index c23716dd1a6..fc753a2e80d 100644 --- a/src/engine/controls/bpmcontrol.h +++ b/src/engine/controls/bpmcontrol.h @@ -23,7 +23,7 @@ class BpmControl : public EngineControl { Q_OBJECT public: - BpmControl(QString group, UserSettingsPointer pConfig); + BpmControl(const QString& group, UserSettingsPointer pConfig); ~BpmControl() override; double getBpm() const; diff --git a/src/engine/controls/clockcontrol.cpp b/src/engine/controls/clockcontrol.cpp index 2a374aa1b45..f48660bb4ce 100644 --- a/src/engine/controls/clockcontrol.cpp +++ b/src/engine/controls/clockcontrol.cpp @@ -6,7 +6,7 @@ #include "preferences/usersettings.h" #include "track/track.h" -ClockControl::ClockControl(QString group, UserSettingsPointer pConfig) +ClockControl::ClockControl(const QString& group, UserSettingsPointer pConfig) : EngineControl(group, pConfig) { m_pCOBeatActive = new ControlObject(ConfigKey(group, "beat_active")); m_pCOBeatActive->set(0.0); diff --git a/src/engine/controls/clockcontrol.h b/src/engine/controls/clockcontrol.h index 719a13bd5d1..5076a5cd9bc 100644 --- a/src/engine/controls/clockcontrol.h +++ b/src/engine/controls/clockcontrol.h @@ -12,8 +12,8 @@ class ControlObject; class ClockControl: public EngineControl { Q_OBJECT public: - ClockControl(QString group, - UserSettingsPointer pConfig); + ClockControl(const QString& group, + UserSettingsPointer pConfig); ~ClockControl() override; diff --git a/src/engine/controls/cuecontrol.cpp b/src/engine/controls/cuecontrol.cpp index ab53d49e464..22a1ef74f9c 100644 --- a/src/engine/controls/cuecontrol.cpp +++ b/src/engine/controls/cuecontrol.cpp @@ -46,7 +46,7 @@ inline mixxx::RgbColor::optional_t doubleToRgbColor(double value) { } // namespace -CueControl::CueControl(QString group, +CueControl::CueControl(const QString& group, UserSettingsPointer pConfig) : EngineControl(group, pConfig), m_pConfig(pConfig), @@ -316,7 +316,7 @@ void CueControl::createControls() { } } -void CueControl::attachCue(CuePointer pCue, HotcueControl* pControl) { +void CueControl::attachCue(const CuePointer& pCue, HotcueControl* pControl) { VERIFY_OR_DEBUG_ASSERT(pControl) { return; } @@ -1825,7 +1825,7 @@ ConfigKey HotcueControl::keyForControl(int hotcue, const char* name) { return key; } -HotcueControl::HotcueControl(QString group, int i) +HotcueControl::HotcueControl(const QString& group, int i) : m_group(group), m_iHotcueNumber(i), m_pCue(NULL), @@ -1960,7 +1960,7 @@ double HotcueControl::getPosition() const { return m_hotcuePosition->get(); } -void HotcueControl::setCue(CuePointer pCue) { +void HotcueControl::setCue(const CuePointer& pCue) { setPosition(pCue->getPosition()); setColor(pCue->getColor()); // set pCue only if all other data is in place diff --git a/src/engine/controls/cuecontrol.h b/src/engine/controls/cuecontrol.h index ee17926cf31..e954b82cda1 100644 --- a/src/engine/controls/cuecontrol.h +++ b/src/engine/controls/cuecontrol.h @@ -43,13 +43,13 @@ inline SeekOnLoadMode seekOnLoadModeFromDouble(double value) { class HotcueControl : public QObject { Q_OBJECT public: - HotcueControl(QString group, int hotcueNumber); + HotcueControl(const QString& group, int hotcueNumber); ~HotcueControl() override; inline int getHotcueNumber() { return m_iHotcueNumber; } inline CuePointer getCue() { return m_pCue; } double getPosition() const; - void setCue(CuePointer pCue); + void setCue(const CuePointer& pCue); void resetCue(); void setPosition(double position); void setColor(mixxx::RgbColor::optional_t newColor); @@ -120,8 +120,8 @@ class HotcueControl : public QObject { class CueControl : public EngineControl { Q_OBJECT public: - CueControl(QString group, - UserSettingsPointer pConfig); + CueControl(const QString& group, + UserSettingsPointer pConfig); ~CueControl() override; void hintReader(HintVector* pHintList) override; @@ -188,7 +188,7 @@ class CueControl : public EngineControl { // These methods are not thread safe, only call them when the lock is held. void createControls(); - void attachCue(CuePointer pCue, HotcueControl* pControl); + void attachCue(const CuePointer& pCue, HotcueControl* pControl); void detachCue(HotcueControl* pControl); void loadCuesFromTrack(); double quantizeCuePoint(double position); diff --git a/src/engine/controls/enginecontrol.cpp b/src/engine/controls/enginecontrol.cpp index a5d0a0555f2..22eaa2ab01b 100644 --- a/src/engine/controls/enginecontrol.cpp +++ b/src/engine/controls/enginecontrol.cpp @@ -7,8 +7,8 @@ #include "engine/sync/enginesync.h" #include "mixer/playermanager.h" -EngineControl::EngineControl(QString group, - UserSettingsPointer pConfig) +EngineControl::EngineControl(const QString& group, + UserSettingsPointer pConfig) : m_group(group), m_pConfig(pConfig), m_pEngineMaster(nullptr), diff --git a/src/engine/controls/enginecontrol.h b/src/engine/controls/enginecontrol.h index d8c4de38b17..e4e00f8b350 100644 --- a/src/engine/controls/enginecontrol.h +++ b/src/engine/controls/enginecontrol.h @@ -38,8 +38,8 @@ const int kNoTrigger = -1; class EngineControl : public QObject { Q_OBJECT public: - EngineControl(QString group, - UserSettingsPointer pConfig); + EngineControl(const QString& group, + UserSettingsPointer pConfig); ~EngineControl() override; // Called by EngineBuffer::process every latency period. See the above diff --git a/src/engine/controls/keycontrol.cpp b/src/engine/controls/keycontrol.cpp index cc32cbcfac9..8fac74c1fd5 100644 --- a/src/engine/controls/keycontrol.cpp +++ b/src/engine/controls/keycontrol.cpp @@ -14,8 +14,8 @@ static const double kLockCurrentKey = 1; static const double kKeepUnlockedKey = 1; -KeyControl::KeyControl(QString group, - UserSettingsPointer pConfig) +KeyControl::KeyControl(const QString& group, + UserSettingsPointer pConfig) : EngineControl(group, pConfig) { m_pitchRateInfo.pitchRatio = 1.0; m_pitchRateInfo.tempoRatio = 1.0; diff --git a/src/engine/controls/keycontrol.h b/src/engine/controls/keycontrol.h index 622ae59f969..7835ce3033f 100644 --- a/src/engine/controls/keycontrol.h +++ b/src/engine/controls/keycontrol.h @@ -26,7 +26,7 @@ class KeyControl : public EngineControl { bool keylock; }; - KeyControl(QString group, UserSettingsPointer pConfig); + KeyControl(const QString& group, UserSettingsPointer pConfig); ~KeyControl() override; // Returns a struct, with the results of the last pitch and tempo calculations diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index 0f3619d0e3b..6888b821b33 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -21,7 +21,7 @@ double LoopingControl::s_dBeatSizes[] = { 0.03125, 0.0625, 0.125, 0.25, 0.5, // Used to generate the beatloop_%SIZE, beatjump_%SIZE, and loop_move_%SIZE CO // ConfigKeys. -ConfigKey keyForControl(QString group, QString ctrlName, double num) { +ConfigKey keyForControl(const QString& group, const QString& ctrlName, double num) { ConfigKey key; key.group = group; key.item = ctrlName.arg(num); @@ -37,8 +37,8 @@ QList LoopingControl::getBeatSizes() { return result; } -LoopingControl::LoopingControl(QString group, - UserSettingsPointer pConfig) +LoopingControl::LoopingControl(const QString& group, + UserSettingsPointer pConfig) : EngineControl(group, pConfig), m_bLoopingEnabled(false), m_bLoopRollActive(false), @@ -1305,7 +1305,7 @@ double LoopingControl::seekInsideAdjustedLoop( } } -BeatJumpControl::BeatJumpControl(QString group, double size) +BeatJumpControl::BeatJumpControl(const QString& group, double size) : m_dBeatJumpSize(size) { m_pJumpForward = new ControlPushButton( keyForControl(group, "beatjump_%1_forward", size)); @@ -1336,7 +1336,7 @@ void BeatJumpControl::slotJumpForward(double pressed) { } } -LoopMoveControl::LoopMoveControl(QString group, double size) +LoopMoveControl::LoopMoveControl(const QString& group, double size) : m_dLoopMoveSize(size) { m_pMoveForward = new ControlPushButton( keyForControl(group, "loop_move_%1_forward", size)); @@ -1367,7 +1367,7 @@ void LoopMoveControl::slotMoveForward(double v) { } } -BeatLoopingControl::BeatLoopingControl(QString group, double size) +BeatLoopingControl::BeatLoopingControl(const QString& group, double size) : m_dBeatLoopSize(size), m_bActive(false) { // This is the original beatloop control which is now deprecated. Its value diff --git a/src/engine/controls/loopingcontrol.h b/src/engine/controls/loopingcontrol.h index 3faaea34ea1..45b20bc0522 100644 --- a/src/engine/controls/loopingcontrol.h +++ b/src/engine/controls/loopingcontrol.h @@ -29,7 +29,7 @@ class LoopingControl : public EngineControl { public: static QList getBeatSizes(); - LoopingControl(QString group, UserSettingsPointer pConfig); + LoopingControl(const QString& group, UserSettingsPointer pConfig); ~LoopingControl() override; // process() updates the internal state of the LoopingControl to reflect the @@ -179,7 +179,7 @@ class LoopingControl : public EngineControl { class LoopMoveControl : public QObject { Q_OBJECT public: - LoopMoveControl(QString group, double size); + LoopMoveControl(const QString& group, double size); virtual ~LoopMoveControl(); signals: @@ -200,7 +200,7 @@ class LoopMoveControl : public QObject { class BeatJumpControl : public QObject { Q_OBJECT public: - BeatJumpControl(QString group, double size); + BeatJumpControl(const QString& group, double size); virtual ~BeatJumpControl(); signals: @@ -221,7 +221,7 @@ class BeatJumpControl : public QObject { class BeatLoopingControl : public QObject { Q_OBJECT public: - BeatLoopingControl(QString group, double size); + BeatLoopingControl(const QString& group, double size); virtual ~BeatLoopingControl(); void activate(); diff --git a/src/engine/controls/quantizecontrol.cpp b/src/engine/controls/quantizecontrol.cpp index e038e46b0a2..28e70e274a7 100644 --- a/src/engine/controls/quantizecontrol.cpp +++ b/src/engine/controls/quantizecontrol.cpp @@ -13,8 +13,8 @@ #include "track/track.h" #include "util/assert.h" -QuantizeControl::QuantizeControl(QString group, - UserSettingsPointer pConfig) +QuantizeControl::QuantizeControl(const QString& group, + UserSettingsPointer pConfig) : EngineControl(group, pConfig) { // Turn quantize OFF by default. See Bug #898213 m_pCOQuantizeEnabled = new ControlPushButton(ConfigKey(group, "quantize"), true); diff --git a/src/engine/controls/quantizecontrol.h b/src/engine/controls/quantizecontrol.h index b3bb56a627a..03aae3fed57 100644 --- a/src/engine/controls/quantizecontrol.h +++ b/src/engine/controls/quantizecontrol.h @@ -14,7 +14,7 @@ class ControlPushButton; class QuantizeControl : public EngineControl { Q_OBJECT public: - QuantizeControl(QString group, UserSettingsPointer pConfig); + QuantizeControl(const QString& group, UserSettingsPointer pConfig); ~QuantizeControl() override; void setCurrentSample(const double dCurrentSample, diff --git a/src/engine/controls/ratecontrol.cpp b/src/engine/controls/ratecontrol.cpp index 221ac7bc584..99333b5b366 100644 --- a/src/engine/controls/ratecontrol.cpp +++ b/src/engine/controls/ratecontrol.cpp @@ -33,13 +33,13 @@ RateControl::RampMode RateControl::m_eRateRampMode; const double RateControl::kWheelMultiplier = 40.0; const double RateControl::kPausedJogMultiplier = 18.0; -RateControl::RateControl(QString group, - UserSettingsPointer pConfig) - : EngineControl(group, pConfig), - m_pBpmControl(NULL), - m_bTempStarted(false), - m_tempRateRatio(0.0), - m_dRateTempRampChange(0.0) { +RateControl::RateControl(const QString& group, + UserSettingsPointer pConfig) + : EngineControl(group, pConfig), + m_pBpmControl(NULL), + m_bTempStarted(false), + m_tempRateRatio(0.0), + m_dRateTempRampChange(0.0) { m_pScratchController = new PositionScratchController(group); // This is the resulting rate ratio that can be used for display or calculations. diff --git a/src/engine/controls/ratecontrol.h b/src/engine/controls/ratecontrol.h index 6740f3b2414..6daa7296ce4 100644 --- a/src/engine/controls/ratecontrol.h +++ b/src/engine/controls/ratecontrol.h @@ -26,147 +26,147 @@ class PositionScratchController; class RateControl : public EngineControl { Q_OBJECT public: - RateControl(QString group, UserSettingsPointer pConfig); - ~RateControl() override; - - // Enumerations which hold the state of the pitchbend buttons. - // These enumerations can be used like a bitmask. - enum class RampDirection { - None, // No buttons are held down - Down, // Down button is being held - Up, // Up button is being held - DownSmall, // DownSmall button is being held - UpSmall, // UpSmall button is being held - }; - - enum class RampMode { - Stepping = 0, // pitch takes a temporary step up/down a certain amount - Linear = 1 // pitch moves up/down in a progressively linear fashion - }; - - void setBpmControl(BpmControl* bpmcontrol); - - // Returns the current engine rate. "reportScratching" is used to tell - // the caller that the user is currently scratching, and this is used to - // disable keylock. - double calculateSpeed( - double baserate, - double speed, - bool paused, - int iSamplesPerBuffer, - bool* pReportScratching, - bool* pReportReverse); - - // Set rate change when temp rate button is pressed - static void setTemporaryRateChangeCoarseAmount(double v); - static double getTemporaryRateChangeCoarseAmount(); - // Set rate change when temp rate small button is pressed - static void setTemporaryRateChangeFineAmount(double v); - static double getTemporaryRateChangeFineAmount(); - // Set rate change when perm rate button is pressed - static void setPermanentRateChangeCoarseAmount(double v); - static double getPermanentRateChangeCoarseAmount(); - // Set rate change when perm rate small button is pressed - static void setPermanentRateChangeFineAmount(double v); - static double getPermanentRateChangeFineAmount(); - // Set Rate Ramp Mode - static void setRateRampMode(RampMode mode); - static RampMode getRateRampMode(); - // Set Rate Ramp Sensitivity - static void setRateRampSensitivity(int); - static int getRateRampSensitivity(); - void notifySeek(double dNewPlaypos) override; - bool isReverseButtonPressed(); - - public slots: - void slotRateRangeChanged(double); - void slotRateSliderChanged(double); - void slotRateRatioChanged(double); - void slotReverseRollActivate(double); - void slotControlRatePermDown(double); - void slotControlRatePermDownSmall(double); - void slotControlRatePermUp(double); - void slotControlRatePermUpSmall(double); - void slotControlFastForward(double); - void slotControlFastBack(double); - - private: - void processTempRate(const int bufferSamples); - double getJogFactor() const; - double getWheelFactor() const; - SyncMode getSyncMode() const; - - // Set rate change of the temporary pitch rate - void setRateTemp(double v); - // Add a value to the temporary pitch rate - void addRateTemp(double v); - // Subtract a value from the temporary pitch rate - void subRateTemp(double v); - // Reset the temporary pitch rate - void resetRateTemp(void); - // Get the 'Raw' Temp Rate - double getTempRate(void); - - // Values used when temp and perm rate buttons are pressed - static ControlValueAtomic m_dTemporaryRateChangeCoarse; - static ControlValueAtomic m_dTemporaryRateChangeFine; - static ControlValueAtomic m_dPermanentRateChangeCoarse; - static ControlValueAtomic m_dPermanentRateChangeFine; - - ControlPushButton* m_pButtonRateTempDown; - ControlPushButton* m_pButtonRateTempDownSmall; - ControlPushButton* m_pButtonRateTempUp; - ControlPushButton* m_pButtonRateTempUpSmall; - - ControlPushButton* m_pButtonRatePermDown; - ControlPushButton* m_pButtonRatePermDownSmall; - ControlPushButton* m_pButtonRatePermUp; - ControlPushButton* m_pButtonRatePermUpSmall; - - ControlObject* m_pRateRatio; - ControlObject* m_pRateDir; - ControlObject* m_pRateRange; - ControlPotmeter* m_pRateSlider; - ControlPotmeter* m_pRateSearch; - ControlPushButton* m_pReverseButton; - ControlPushButton* m_pReverseRollButton; - ControlObject* m_pBackButton; - ControlObject* m_pForwardButton; - - ControlTTRotary* m_pWheel; - ControlObject* m_pScratch2; - PositionScratchController* m_pScratchController; - - ControlPushButton* m_pScratch2Enable; - ControlObject* m_pJog; - ControlObject* m_pVCEnabled; - ControlObject* m_pVCScratching; - ControlObject* m_pVCMode; - ControlObject* m_pScratch2Scratching; - Rotary* m_pJogFilter; - - ControlObject* m_pSampleRate; - - // For Master Sync - BpmControl* m_pBpmControl; - - ControlProxy* m_pSyncMode; - ControlProxy* m_pSlipEnabled; - - // This is true if we've already started to ramp the rate - bool m_bTempStarted; - // Set the Temporary Rate Change Mode - static RampMode m_eRateRampMode; - // The Rate Temp Sensitivity, the higher it is the slower it gets - static int m_iRateRampSensitivity; - // Factor applied to the deprecated "wheel" rate value. - static const double kWheelMultiplier; - // Factor applied to jogwheels when the track is paused to speed up seeking. - static const double kPausedJogMultiplier; - // Temporary pitchrate, added to the permanent rate for calculateRate - double m_tempRateRatio; - // Speed for temporary rate change - double m_dRateTempRampChange; + RateControl(const QString& group, UserSettingsPointer pConfig); + ~RateControl() override; + + // Enumerations which hold the state of the pitchbend buttons. + // These enumerations can be used like a bitmask. + enum class RampDirection { + None, // No buttons are held down + Down, // Down button is being held + Up, // Up button is being held + DownSmall, // DownSmall button is being held + UpSmall, // UpSmall button is being held + }; + + enum class RampMode { + Stepping = 0, // pitch takes a temporary step up/down a certain amount + Linear = 1 // pitch moves up/down in a progressively linear fashion + }; + + void setBpmControl(BpmControl* bpmcontrol); + + // Returns the current engine rate. "reportScratching" is used to tell + // the caller that the user is currently scratching, and this is used to + // disable keylock. + double calculateSpeed( + double baserate, + double speed, + bool paused, + int iSamplesPerBuffer, + bool* pReportScratching, + bool* pReportReverse); + + // Set rate change when temp rate button is pressed + static void setTemporaryRateChangeCoarseAmount(double v); + static double getTemporaryRateChangeCoarseAmount(); + // Set rate change when temp rate small button is pressed + static void setTemporaryRateChangeFineAmount(double v); + static double getTemporaryRateChangeFineAmount(); + // Set rate change when perm rate button is pressed + static void setPermanentRateChangeCoarseAmount(double v); + static double getPermanentRateChangeCoarseAmount(); + // Set rate change when perm rate small button is pressed + static void setPermanentRateChangeFineAmount(double v); + static double getPermanentRateChangeFineAmount(); + // Set Rate Ramp Mode + static void setRateRampMode(RampMode mode); + static RampMode getRateRampMode(); + // Set Rate Ramp Sensitivity + static void setRateRampSensitivity(int); + static int getRateRampSensitivity(); + void notifySeek(double dNewPlaypos) override; + bool isReverseButtonPressed(); + +public slots: + void slotRateRangeChanged(double); + void slotRateSliderChanged(double); + void slotRateRatioChanged(double); + void slotReverseRollActivate(double); + void slotControlRatePermDown(double); + void slotControlRatePermDownSmall(double); + void slotControlRatePermUp(double); + void slotControlRatePermUpSmall(double); + void slotControlFastForward(double); + void slotControlFastBack(double); + +private: + void processTempRate(const int bufferSamples); + double getJogFactor() const; + double getWheelFactor() const; + SyncMode getSyncMode() const; + + // Set rate change of the temporary pitch rate + void setRateTemp(double v); + // Add a value to the temporary pitch rate + void addRateTemp(double v); + // Subtract a value from the temporary pitch rate + void subRateTemp(double v); + // Reset the temporary pitch rate + void resetRateTemp(void); + // Get the 'Raw' Temp Rate + double getTempRate(void); + + // Values used when temp and perm rate buttons are pressed + static ControlValueAtomic m_dTemporaryRateChangeCoarse; + static ControlValueAtomic m_dTemporaryRateChangeFine; + static ControlValueAtomic m_dPermanentRateChangeCoarse; + static ControlValueAtomic m_dPermanentRateChangeFine; + + ControlPushButton* m_pButtonRateTempDown; + ControlPushButton* m_pButtonRateTempDownSmall; + ControlPushButton* m_pButtonRateTempUp; + ControlPushButton* m_pButtonRateTempUpSmall; + + ControlPushButton* m_pButtonRatePermDown; + ControlPushButton* m_pButtonRatePermDownSmall; + ControlPushButton* m_pButtonRatePermUp; + ControlPushButton* m_pButtonRatePermUpSmall; + + ControlObject* m_pRateRatio; + ControlObject* m_pRateDir; + ControlObject* m_pRateRange; + ControlPotmeter* m_pRateSlider; + ControlPotmeter* m_pRateSearch; + ControlPushButton* m_pReverseButton; + ControlPushButton* m_pReverseRollButton; + ControlObject* m_pBackButton; + ControlObject* m_pForwardButton; + + ControlTTRotary* m_pWheel; + ControlObject* m_pScratch2; + PositionScratchController* m_pScratchController; + + ControlPushButton* m_pScratch2Enable; + ControlObject* m_pJog; + ControlObject* m_pVCEnabled; + ControlObject* m_pVCScratching; + ControlObject* m_pVCMode; + ControlObject* m_pScratch2Scratching; + Rotary* m_pJogFilter; + + ControlObject* m_pSampleRate; + + // For Master Sync + BpmControl* m_pBpmControl; + + ControlProxy* m_pSyncMode; + ControlProxy* m_pSlipEnabled; + + // This is true if we've already started to ramp the rate + bool m_bTempStarted; + // Set the Temporary Rate Change Mode + static RampMode m_eRateRampMode; + // The Rate Temp Sensitivity, the higher it is the slower it gets + static int m_iRateRampSensitivity; + // Factor applied to the deprecated "wheel" rate value. + static const double kWheelMultiplier; + // Factor applied to jogwheels when the track is paused to speed up seeking. + static const double kPausedJogMultiplier; + // Temporary pitchrate, added to the permanent rate for calculateRate + double m_tempRateRatio; + // Speed for temporary rate change + double m_dRateTempRampChange; }; #endif /* RATECONTROL_H */ diff --git a/src/engine/controls/vinylcontrolcontrol.cpp b/src/engine/controls/vinylcontrolcontrol.cpp index f0b9ed5de10..951552d44ab 100644 --- a/src/engine/controls/vinylcontrolcontrol.cpp +++ b/src/engine/controls/vinylcontrolcontrol.cpp @@ -4,7 +4,7 @@ #include "util/math.h" #include "vinylcontrol/vinylcontrol.h" -VinylControlControl::VinylControlControl(QString group, UserSettingsPointer pConfig) +VinylControlControl::VinylControlControl(const QString& group, UserSettingsPointer pConfig) : EngineControl(group, pConfig), m_bSeekRequested(false) { m_pControlVinylStatus = new ControlObject(ConfigKey(group, "vinylcontrol_status")); diff --git a/src/engine/controls/vinylcontrolcontrol.h b/src/engine/controls/vinylcontrolcontrol.h index 9129337a132..6e684fa57c9 100644 --- a/src/engine/controls/vinylcontrolcontrol.h +++ b/src/engine/controls/vinylcontrolcontrol.h @@ -11,7 +11,7 @@ class VinylControlControl : public EngineControl { Q_OBJECT public: - VinylControlControl(QString group, UserSettingsPointer pConfig); + VinylControlControl(const QString& group, UserSettingsPointer pConfig); virtual ~VinylControlControl(); // If the engine asks for a seek, we may need to disable absolute mode. diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 5f70a75f68c..36be2816b50 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -533,7 +533,7 @@ void EngineBuffer::slotTrackLoaded(TrackPointer pTrack, // WARNING: Always called from the EngineWorker thread pool void EngineBuffer::slotTrackLoadFailed(TrackPointer pTrack, - QString reason) { + const QString& reason) { m_iTrackLoading = 0; // Loading of a new track failed. // eject the currently loaded track (the old Track) as well diff --git a/src/engine/enginebuffer.h b/src/engine/enginebuffer.h index 3f9242c4fdd..a3c4deda350 100644 --- a/src/engine/enginebuffer.h +++ b/src/engine/enginebuffer.h @@ -199,14 +199,14 @@ class EngineBuffer : public EngineObject { signals: void trackLoaded(TrackPointer pNewTrack, TrackPointer pOldTrack); - void trackLoadFailed(TrackPointer pTrack, QString reason); + void trackLoadFailed(TrackPointer pTrack, const QString& reason); private slots: void slotTrackLoading(); void slotTrackLoaded(TrackPointer pTrack, int iSampleRate, int iNumSamples); void slotTrackLoadFailed(TrackPointer pTrack, - QString reason); + const QString& reason); // Fired when passthrough mode is enabled or disabled. void slotPassthroughChanged(double v); void slotUpdatedTrackBeats(); diff --git a/src/engine/enginedelay.cpp b/src/engine/enginedelay.cpp index 1947dfc14d5..7a44c3bd243 100644 --- a/src/engine/enginedelay.cpp +++ b/src/engine/enginedelay.cpp @@ -28,7 +28,7 @@ const int kiMaxDelay = static_cast((kdMaxDelayPot + 8) / 1000 * mixxx::audio::SampleRate::kValueMax * mixxx::kEngineChannelCount); } // anonymous namespace -EngineDelay::EngineDelay(const QString& group, ConfigKey delayControl, bool bPersist) +EngineDelay::EngineDelay(const QString& group, const ConfigKey& delayControl, bool bPersist) : m_iDelayPos(0), m_iDelay(0) { m_pDelayBuffer = SampleUtil::alloc(kiMaxDelay); diff --git a/src/engine/enginedelay.h b/src/engine/enginedelay.h index 5f2d16f689a..60654cb4caf 100644 --- a/src/engine/enginedelay.h +++ b/src/engine/enginedelay.h @@ -26,7 +26,7 @@ class ControlProxy; class EngineDelay : public EngineObject { Q_OBJECT public: - EngineDelay(const QString& group, ConfigKey delayControl, bool bPersist = true); + EngineDelay(const QString& group, const ConfigKey& delayControl, bool bPersist = true); virtual ~EngineDelay(); void process(CSAMPLE* pInOut, const int iBufferSize); diff --git a/src/engine/enginemaster.cpp b/src/engine/enginemaster.cpp index ee2e5ebb477..9e49dc18de8 100644 --- a/src/engine/enginemaster.cpp +++ b/src/engine/enginemaster.cpp @@ -847,7 +847,7 @@ const CSAMPLE* EngineMaster::getOutputBusBuffer(unsigned int i) const { return NULL; } -const CSAMPLE* EngineMaster::getChannelBuffer(QString group) const { +const CSAMPLE* EngineMaster::getChannelBuffer(const QString& group) const { for (int i = 0; i < m_channels.size(); ++i) { const ChannelInfo* pChannelInfo = m_channels[i]; if (pChannelInfo->m_pChannel->getGroup() == group) { @@ -857,7 +857,7 @@ const CSAMPLE* EngineMaster::getChannelBuffer(QString group) const { return NULL; } -const CSAMPLE* EngineMaster::buffer(AudioOutput output) const { +const CSAMPLE* EngineMaster::buffer(const AudioOutput& output) const { switch (output.getType()) { case AudioOutput::MASTER: return getMasterBuffer(); @@ -882,7 +882,7 @@ const CSAMPLE* EngineMaster::buffer(AudioOutput output) const { } } -void EngineMaster::onOutputConnected(AudioOutput output) { +void EngineMaster::onOutputConnected(const AudioOutput& output) { switch (output.getType()) { case AudioOutput::MASTER: // overwrite config option if a master output is configured @@ -910,7 +910,7 @@ void EngineMaster::onOutputConnected(AudioOutput output) { } } -void EngineMaster::onOutputDisconnected(AudioOutput output) { +void EngineMaster::onOutputDisconnected(const AudioOutput& output) { switch (output.getType()) { case AudioOutput::MASTER: // not used, because we need the master buffer for headphone mix @@ -936,7 +936,7 @@ void EngineMaster::onOutputDisconnected(AudioOutput output) { } } -void EngineMaster::onInputConnected(AudioInput input) { +void EngineMaster::onInputConnected(const AudioInput& input) { switch (input.getType()) { case AudioInput::MICROPHONE: m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() + 1); @@ -955,7 +955,7 @@ void EngineMaster::onInputConnected(AudioInput input) { } } -void EngineMaster::onInputDisconnected(AudioInput input) { +void EngineMaster::onInputDisconnected(const AudioInput& input) { switch (input.getType()) { case AudioInput::MICROPHONE: m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() - 1); diff --git a/src/engine/enginemaster.h b/src/engine/enginemaster.h index 9bcdffc0ea4..20beb816853 100644 --- a/src/engine/enginemaster.h +++ b/src/engine/enginemaster.h @@ -64,7 +64,7 @@ class EngineMaster : public QObject, public AudioSource { // Get access to the sample buffers. None of these are thread safe. Only to // be called by SoundManager. - const CSAMPLE* buffer(AudioOutput output) const; + const CSAMPLE* buffer(const AudioOutput& output) const; ChannelHandleAndGroup registerChannelGroup(const QString& group) { return ChannelHandleAndGroup( @@ -79,10 +79,10 @@ class EngineMaster : public QObject, public AudioSource { // these methods are called the callback is guaranteed to be inactive // (SoundManager closes all devices before calling these). This may change // in the future. - virtual void onOutputConnected(AudioOutput output); - virtual void onOutputDisconnected(AudioOutput output); - void onInputConnected(AudioInput input); - void onInputDisconnected(AudioInput input); + virtual void onOutputConnected(const AudioOutput& output); + virtual void onOutputDisconnected(const AudioOutput& output); + void onInputConnected(const AudioInput& input); + void onInputDisconnected(const AudioInput& input); void process(const int iBufferSize); @@ -116,7 +116,7 @@ class EngineMaster : public QObject, public AudioSource { const CSAMPLE* getHeadphoneBuffer() const; const CSAMPLE* getOutputBusBuffer(unsigned int i) const; const CSAMPLE* getDeckBuffer(unsigned int i) const; - const CSAMPLE* getChannelBuffer(QString name) const; + const CSAMPLE* getChannelBuffer(const QString& name) const; const CSAMPLE* getSidechainBuffer() const; EngineSideChain* getSideChain() const { diff --git a/src/engine/enginepregain.cpp b/src/engine/enginepregain.cpp index 7a256b26d83..443ca048d01 100644 --- a/src/engine/enginepregain.cpp +++ b/src/engine/enginepregain.cpp @@ -24,7 +24,7 @@ ControlPotmeter* EnginePregain::s_pReplayGainBoost = NULL; ControlPotmeter* EnginePregain::s_pDefaultBoost = NULL; ControlObject* EnginePregain::s_pEnableReplayGain = NULL; -EnginePregain::EnginePregain(QString group) +EnginePregain::EnginePregain(const QString& group) : m_dSpeed(1.0), m_dOldSpeed(1.0), m_dNonScratchSpeed(1.0), diff --git a/src/engine/enginepregain.h b/src/engine/enginepregain.h index 6248b402618..2d5b1b50f8b 100644 --- a/src/engine/enginepregain.h +++ b/src/engine/enginepregain.h @@ -13,7 +13,7 @@ class ControlObject; // adjustments in volume relative to playback speed. class EnginePregain : public EngineObject { public: - EnginePregain(QString group); + EnginePregain(const QString& group); ~EnginePregain() override; // If the user is scratching and the record reverses direction, the volume diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp index f0392895481..666ea72f5d7 100644 --- a/src/engine/enginevumeter.cpp +++ b/src/engine/enginevumeter.cpp @@ -18,7 +18,7 @@ constexpr CSAMPLE kDecaySmoothing = 0.1f; //.16//.4 } // namespace -EngineVuMeter::EngineVuMeter(QString group) { +EngineVuMeter::EngineVuMeter(const QString& group) { // The VUmeter widget is controlled via a controlpotmeter, which means // that it should react on the setValue(int) signal. m_ctrlVuMeter = new ControlPotmeter(ConfigKey(group, "VuMeter"), 0., 1.); diff --git a/src/engine/enginevumeter.h b/src/engine/enginevumeter.h index a39da1bcc1e..a1a94b75d1b 100644 --- a/src/engine/enginevumeter.h +++ b/src/engine/enginevumeter.h @@ -8,7 +8,7 @@ class ControlProxy; class EngineVuMeter : public EngineObject { Q_OBJECT public: - EngineVuMeter(QString group); + EngineVuMeter(const QString& group); virtual ~EngineVuMeter(); virtual void process(CSAMPLE* pInOut, const int iBufferSize); diff --git a/src/engine/positionscratchcontroller.cpp b/src/engine/positionscratchcontroller.cpp index cb7a93e61df..cba4a28bbd6 100644 --- a/src/engine/positionscratchcontroller.cpp +++ b/src/engine/positionscratchcontroller.cpp @@ -62,17 +62,17 @@ class RateIIFilter { double m_last_rate; }; -PositionScratchController::PositionScratchController(QString group) - : m_group(group), - m_bScratching(false), - m_bEnableInertia(false), - m_dLastPlaypos(0), - m_dPositionDeltaSum(0), - m_dTargetDelta(0), - m_dStartScratchPosition(0), - m_dRate(0), - m_dMoveDelay(0), - m_dMouseSampeTime(0) { +PositionScratchController::PositionScratchController(const QString& group) + : m_group(group), + m_bScratching(false), + m_bEnableInertia(false), + m_dLastPlaypos(0), + m_dPositionDeltaSum(0), + m_dTargetDelta(0), + m_dStartScratchPosition(0), + m_dRate(0), + m_dMoveDelay(0), + m_dMouseSampeTime(0) { m_pScratchEnable = new ControlObject(ConfigKey(group, "scratch_position_enable")); m_pScratchPosition = new ControlObject(ConfigKey(group, "scratch_position")); m_pMasterSampleRate = ControlObject::getControl(ConfigKey("[Master]", "samplerate")); diff --git a/src/engine/positionscratchcontroller.h b/src/engine/positionscratchcontroller.h index 55ab0d3eda5..ace908d1e7c 100644 --- a/src/engine/positionscratchcontroller.h +++ b/src/engine/positionscratchcontroller.h @@ -11,7 +11,7 @@ class RateIIFilter; class PositionScratchController : public QObject { public: - PositionScratchController(QString group); + PositionScratchController(const QString& group); virtual ~PositionScratchController(); void process(double currentSample, double releaseRate, diff --git a/src/engine/sidechain/enginesidechain.cpp b/src/engine/sidechain/enginesidechain.cpp index fe9c5626410..2e095de3935 100644 --- a/src/engine/sidechain/enginesidechain.cpp +++ b/src/engine/sidechain/enginesidechain.cpp @@ -79,9 +79,9 @@ void EngineSideChain::addSideChainWorker(SideChainWorker* pWorker) { m_workers.append(pWorker); } -void EngineSideChain::receiveBuffer(AudioInput input, - const CSAMPLE* pBuffer, - unsigned int iFrames) { +void EngineSideChain::receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int iFrames) { VERIFY_OR_DEBUG_ASSERT(input.getType() == AudioInput::RECORD_BROADCAST) { qDebug() << "WARNING: AudioInput type is not RECORD_BROADCAST. Ignoring incoming buffer."; return; diff --git a/src/engine/sidechain/enginesidechain.h b/src/engine/sidechain/enginesidechain.h index 91a0cfd8a3b..2278bbf8822 100644 --- a/src/engine/sidechain/enginesidechain.h +++ b/src/engine/sidechain/enginesidechain.h @@ -42,9 +42,9 @@ class EngineSideChain : public QThread, public AudioDestination { // Thin wrapper around writeSamples that is used by SoundManager when receiving // from a sound card input instead of the engine - void receiveBuffer(AudioInput input, - const CSAMPLE* pBuffer, - unsigned int iFrames) override; + void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int iFrames) override; // Thread-safe, blocking. void addSideChainWorker(SideChainWorker* pWorker); diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp index ca436ad17ca..a9f400af351 100644 --- a/src/engine/sidechain/shoutconnection.cpp +++ b/src/engine/sidechain/shoutconnection.cpp @@ -865,7 +865,7 @@ void ShoutConnection::updateMetaData() { } } -void ShoutConnection::errorDialog(QString text, QString detailedError) { +void ShoutConnection::errorDialog(const QString& text, const QString& detailedError) { qWarning() << "Streaming error: " << detailedError; ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties(); props->setType(DLG_WARNING); @@ -881,7 +881,7 @@ void ShoutConnection::errorDialog(QString text, QString detailedError) { setState(NETWORKSTREAMWORKER_STATE_ERROR); } -void ShoutConnection::infoDialog(QString text, QString detailedInfo) { +void ShoutConnection::infoDialog(const QString& text, const QString& detailedInfo) { ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties(); props->setType(DLG_INFO); props->setTitle(tr("Connection message")); diff --git a/src/engine/sidechain/shoutconnection.h b/src/engine/sidechain/shoutconnection.h index 51475156690..7ffa155e3cf 100644 --- a/src/engine/sidechain/shoutconnection.h +++ b/src/engine/sidechain/shoutconnection.h @@ -100,8 +100,8 @@ class ShoutConnection void updateMetaData(); // Common error dialog creation code for run-time exceptions. Notify user // when connected or disconnected and so on - void errorDialog(QString text, QString detailedError); - void infoDialog(QString text, QString detailedError); + void errorDialog(const QString& text, const QString& detailedError); + void infoDialog(const QString& text, const QString& detailedError); void serverWrite(unsigned char *header, unsigned char *body, int headerLen, int bodyLen); diff --git a/src/errordialoghandler.cpp b/src/errordialoghandler.cpp index 3f302bb7b23..650a6f5dbdd 100644 --- a/src/errordialoghandler.cpp +++ b/src/errordialoghandler.cpp @@ -89,8 +89,8 @@ ErrorDialogProperties* ErrorDialogHandler::newDialogProperties() { return new ErrorDialogProperties(); } -bool ErrorDialogHandler::requestErrorDialog(DialogType type, QString message, - bool shouldQuit) { +bool ErrorDialogHandler::requestErrorDialog( + DialogType type, const QString& message, bool shouldQuit) { if (!s_bEnabled) { return false; } @@ -213,7 +213,7 @@ void ErrorDialogHandler::errorDialog(ErrorDialogProperties* pProps) { } } -void ErrorDialogHandler::boxClosed(QString key, QMessageBox* msgBox) { +void ErrorDialogHandler::boxClosed(const QString& key, QMessageBox* msgBox) { QMutexLocker locker(&m_mutex); locker.unlock(); diff --git a/src/errordialoghandler.h b/src/errordialoghandler.h index 6bd26bddd87..285546b0796 100644 --- a/src/errordialoghandler.h +++ b/src/errordialoghandler.h @@ -152,8 +152,7 @@ class ErrorDialogHandler : public QObject { // requested message box. They return false if a dialog with the same key // (or title if no key) is already displayed. If shouldQuit is true, Mixxx // will shut down. - bool requestErrorDialog(DialogType type, QString message, - bool shouldQuit = false); + bool requestErrorDialog(DialogType type, const QString& message, bool shouldQuit = false); bool requestErrorDialog(ErrorDialogProperties* props); // Allows a means for main() to skip exec() if there was a critical or fatal @@ -162,12 +161,12 @@ class ErrorDialogHandler : public QObject { signals: void showErrorDialog(ErrorDialogProperties* props); - void stdButtonClicked(QString key, QMessageBox::StandardButton whichStdButton); + void stdButtonClicked(const QString& key, QMessageBox::StandardButton whichStdButton); private slots: /** Actually displays the box */ void errorDialog(ErrorDialogProperties* props); - void boxClosed(QString key, QMessageBox* msgBox); + void boxClosed(const QString& key, QMessageBox* msgBox); private: // Private constructor diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index c2c609399db..e03220f8e7e 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -85,7 +85,7 @@ void AnalysisFeature::bindLibraryWidget(WLibrary* libraryWidget, connect(m_pAnalysisView, &DlgAnalysis::loadTrackToPlayer, this, - [=](TrackPointer track, QString group) { + [=](TrackPointer track, const QString& group) { emit loadTrackToPlayer(track, group, false); }); connect(m_pAnalysisView, @@ -134,7 +134,7 @@ void AnalysisFeature::activate() { emit enableCoverArtDisplay(true); } -void AnalysisFeature::analyzeTracks(QList trackIds) { +void AnalysisFeature::analyzeTracks(const QList& trackIds) { if (!m_pTrackAnalysisScheduler) { const int numAnalyzerThreads = numberOfAnalyzerThreads(); kLogger.info() @@ -229,13 +229,13 @@ void AnalysisFeature::onTrackAnalysisSchedulerFinished() { emit analysisActive(false); } -bool AnalysisFeature::dropAccept(QList urls, QObject* pSource) { +bool AnalysisFeature::dropAccept(const QList& urls, QObject* pSource) { QList trackIds = m_pLibrary->trackCollection().resolveTrackIdsFromUrls(urls, !pSource); analyzeTracks(trackIds); return trackIds.size() > 0; } -bool AnalysisFeature::dragMoveAccept(QUrl url) { +bool AnalysisFeature::dragMoveAccept(const QUrl& url) { return SoundSourceProxy::isUrlSupported(url); } diff --git a/src/library/analysisfeature.h b/src/library/analysisfeature.h index 50587b046e0..a66086a4e70 100644 --- a/src/library/analysisfeature.h +++ b/src/library/analysisfeature.h @@ -35,8 +35,8 @@ class AnalysisFeature : public LibraryFeature { return m_icon; } - bool dropAccept(QList urls, QObject* pSource) override; - bool dragMoveAccept(QUrl url) override; + bool dropAccept(const QList& urls, QObject* pSource) override; + bool dragMoveAccept(const QUrl& url) override; void bindLibraryWidget(WLibrary* libraryWidget, KeyboardEventFilter* keyboard) override; @@ -48,7 +48,7 @@ class AnalysisFeature : public LibraryFeature { public slots: void activate() override; - void analyzeTracks(QList trackIds); + void analyzeTracks(const QList& trackIds); void suspendAnalysis(); void resumeAnalysis(); diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 1b4f394df8b..16d728fd1c7 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -166,7 +166,7 @@ void AutoDJFeature::activate() { emit enableCoverArtDisplay(true); } -bool AutoDJFeature::dropAccept(QList urls, QObject* pSource) { +bool AutoDJFeature::dropAccept(const QList& urls, QObject* pSource) { // If a track is dropped onto the Auto DJ tree node, but the track isn't in the // library, then add the track to the library before adding it to the // Auto DJ playlist. @@ -182,7 +182,7 @@ bool AutoDJFeature::dropAccept(QList urls, QObject* pSource) { return m_playlistDao.appendTracksToPlaylist(trackIds, m_iAutoDJPlaylistId); } -bool AutoDJFeature::dragMoveAccept(QUrl url) { +bool AutoDJFeature::dragMoveAccept(const QUrl& url) { return SoundSourceProxy::isUrlSupported(url) || Parser::isPlaylistFilenameSupported(url.toLocalFile()); } @@ -289,7 +289,7 @@ void AutoDJFeature::constructCrateChildModel() { } void AutoDJFeature::onRightClickChild(const QPoint& globalPos, - QModelIndex index) { + const QModelIndex& index) { TreeItem* pClickedItem = static_cast(index.internalPointer()); QMenu menu(m_pSidebarWidget); if (m_pCratesTreeItem == pClickedItem) { diff --git a/src/library/autodj/autodjfeature.h b/src/library/autodj/autodjfeature.h index 94f1a986b56..4e0e03a75ec 100644 --- a/src/library/autodj/autodjfeature.h +++ b/src/library/autodj/autodjfeature.h @@ -41,8 +41,8 @@ class AutoDJFeature : public LibraryFeature { QVariant title() override; QIcon getIcon() override; - bool dropAccept(QList urls, QObject* pSource) override; - bool dragMoveAccept(QUrl url) override; + bool dropAccept(const QList& urls, QObject* pSource) override; + bool dragMoveAccept(const QUrl& url) override; void bindLibraryWidget(WLibrary* libraryWidget, KeyboardEventFilter* keyboard) override; @@ -58,7 +58,7 @@ class AutoDJFeature : public LibraryFeature { void activate() override; // Temporary, until WCrateTableView can be written. - void onRightClickChild(const QPoint& globalPos, QModelIndex index) override; + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; private: TrackCollection* const m_pTrackCollection; diff --git a/src/library/autodj/autodjprocessor.h b/src/library/autodj/autodjprocessor.h index da51b6d32c9..af73c612f64 100644 --- a/src/library/autodj/autodjprocessor.h +++ b/src/library/autodj/autodjprocessor.h @@ -203,8 +203,7 @@ class AutoDJProcessor : public QObject { AutoDJError toggleAutoDJ(bool enable); signals: - void loadTrackToPlayer(TrackPointer pTrack, QString group, - bool play); + void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play); void autoDJStateChanged(AutoDJProcessor::AutoDJState state); void transitionTimeChanged(int time); void randomTrackRequested(int tracksToAdd); @@ -229,7 +228,7 @@ class AutoDJProcessor : public QObject { protected: // The following virtual signal wrappers are used for testing - virtual void emitLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play) { + virtual void emitLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play) { emit loadTrackToPlayer(pTrack, group, play); } virtual void emitAutoDJStateChanged(AutoDJProcessor::AutoDJState state) { diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index cf6e7218415..60fb6a6d677 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -222,7 +222,7 @@ DlgAutoDJ::~DlgAutoDJ() { void DlgAutoDJ::setupActionButton(QPushButton* pButton, void (DlgAutoDJ::*pSlot)(bool), - QString fallbackText) { + const QString& fallbackText) { connect(pButton, &QPushButton::clicked, this, pSlot); if (m_bShowButtonText) { pButton->setText(fallbackText); @@ -243,7 +243,7 @@ void DlgAutoDJ::loadSelectedTrack() { m_pTrackTableView->loadSelectedTrack(); } -void DlgAutoDJ::loadSelectedTrackToGroup(QString group, bool play) { +void DlgAutoDJ::loadSelectedTrackToGroup(const QString& group, bool play) { m_pTrackTableView->loadSelectedTrackToGroup(group, play); } diff --git a/src/library/autodj/dlgautodj.h b/src/library/autodj/dlgautodj.h index bbdff9f9888..5239570035b 100644 --- a/src/library/autodj/dlgautodj.h +++ b/src/library/autodj/dlgautodj.h @@ -32,7 +32,7 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { bool hasFocus() const override; void onSearch(const QString& text) override; void loadSelectedTrack() override; - void loadSelectedTrackToGroup(QString group, bool play) override; + void loadSelectedTrackToGroup(const QString& group, bool play) override; void moveSelection(int delta) override; public slots: @@ -50,13 +50,13 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { signals: void addRandomButton(bool buttonChecked); void loadTrack(TrackPointer tio); - void loadTrackToPlayer(TrackPointer tio, QString group, bool); + void loadTrackToPlayer(TrackPointer tio, const QString& group, bool); void trackSelected(TrackPointer pTrack); private: void setupActionButton(QPushButton* pButton, void (DlgAutoDJ::*pSlot)(bool), - QString fallbackText); + const QString& fallbackText); const UserSettingsPointer m_pConfig; diff --git a/src/library/baseexternallibraryfeature.cpp b/src/library/baseexternallibraryfeature.cpp index 4893544fad3..7f4604e0cbc 100644 --- a/src/library/baseexternallibraryfeature.cpp +++ b/src/library/baseexternallibraryfeature.cpp @@ -55,7 +55,8 @@ void BaseExternalLibraryFeature::onRightClick(const QPoint& globalPos) { m_lastRightClickedIndex = QModelIndex(); } -void BaseExternalLibraryFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { +void BaseExternalLibraryFeature::onRightClickChild( + const QPoint& globalPos, const QModelIndex& index) { //Save the model index so we can get it in the action slots... m_lastRightClickedIndex = index; QMenu menu(m_pSidebarWidget); diff --git a/src/library/baseexternallibraryfeature.h b/src/library/baseexternallibraryfeature.h index ee5e1cfbcc7..97ab683c09c 100644 --- a/src/library/baseexternallibraryfeature.h +++ b/src/library/baseexternallibraryfeature.h @@ -22,11 +22,11 @@ class BaseExternalLibraryFeature : public LibraryFeature { public slots: void bindSidebarWidget(WLibrarySidebar* pSidebarWidget) override; void onRightClick(const QPoint& globalPos) override; - void onRightClickChild(const QPoint& globalPos, QModelIndex index) override; + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; protected: // Must be implemented by external Libraries copied to Mixxx DB - virtual BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist) { + virtual BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) { Q_UNUSED(playlist); return nullptr; } diff --git a/src/library/baseexternalplaylistmodel.cpp b/src/library/baseexternalplaylistmodel.cpp index 0985b982ae7..77b39dcf2f8 100644 --- a/src/library/baseexternalplaylistmodel.cpp +++ b/src/library/baseexternalplaylistmodel.cpp @@ -91,7 +91,7 @@ Qt::ItemFlags BaseExternalPlaylistModel::flags(const QModelIndex &index) const { return readOnlyFlags(index); } -void BaseExternalPlaylistModel::setPlaylist(QString playlist_path) { +void BaseExternalPlaylistModel::setPlaylist(const QString& playlist_path) { QSqlQuery finder_query(m_database); finder_query.prepare(QString("SELECT id from %1 where name=:name").arg(m_playlistsTable)); finder_query.bindValue(":name", playlist_path); diff --git a/src/library/baseexternalplaylistmodel.h b/src/library/baseexternalplaylistmodel.h index b1b19e9f005..fccab364868 100644 --- a/src/library/baseexternalplaylistmodel.h +++ b/src/library/baseexternalplaylistmodel.h @@ -22,7 +22,7 @@ class BaseExternalPlaylistModel : public BaseSqlTableModel { ~BaseExternalPlaylistModel() override; - void setPlaylist(QString path_name); + void setPlaylist(const QString& path_name); TrackPointer getTrack(const QModelIndex& index) const override; TrackId getTrackId(const QModelIndex& index) const override; diff --git a/src/library/baseplaylistfeature.cpp b/src/library/baseplaylistfeature.cpp index a38eca1ab61..9f7d897f803 100644 --- a/src/library/baseplaylistfeature.cpp +++ b/src/library/baseplaylistfeature.cpp @@ -136,7 +136,7 @@ void BasePlaylistFeature::initActions() { &BasePlaylistFeature::slotResetSelectedTrack); } -int BasePlaylistFeature::playlistIdFromIndex(QModelIndex index) { +int BasePlaylistFeature::playlistIdFromIndex(const QModelIndex& index) { TreeItem* item = static_cast(index.internalPointer()); if (item == nullptr) { return -1; diff --git a/src/library/baseplaylistfeature.h b/src/library/baseplaylistfeature.h index 9d18623b12a..a1c1ab10382 100644 --- a/src/library/baseplaylistfeature.h +++ b/src/library/baseplaylistfeature.h @@ -39,8 +39,8 @@ class BasePlaylistFeature : public BaseTrackSetFeature { virtual void htmlLinkClicked(const QUrl& link); virtual void slotPlaylistTableChanged(int playlistId) = 0; + virtual void slotPlaylistTableRenamed(int playlistId, const QString& newName) = 0; virtual void slotPlaylistContentChanged(QSet playlistIds) = 0; - virtual void slotPlaylistTableRenamed(int playlistId, QString newName) = 0; void slotCreatePlaylist(); protected slots: @@ -73,7 +73,7 @@ class BasePlaylistFeature : public BaseTrackSetFeature { virtual void decorateChild(TreeItem* pChild, int playlistId) = 0; virtual void addToAutoDJ(PlaylistDAO::AutoDJSendLoc loc); - int playlistIdFromIndex(QModelIndex index); + int playlistIdFromIndex(const QModelIndex& index); // Get the QModelIndex of a playlist based on its id. Returns QModelIndex() // on failure. QModelIndex indexFromPlaylistId(int playlistId); diff --git a/src/library/basesqltablemodel.cpp b/src/library/basesqltablemodel.cpp index cae66719236..bc5e40759a0 100644 --- a/src/library/basesqltablemodel.cpp +++ b/src/library/basesqltablemodel.cpp @@ -792,7 +792,7 @@ CoverInfo BaseSqlTableModel::getCoverInfo(const QModelIndex& index) const { return coverInfo; } -void BaseSqlTableModel::tracksChanged(QSet trackIds) { +void BaseSqlTableModel::tracksChanged(const QSet& trackIds) { if (sDebug) { qDebug() << this << "trackChanged" << trackIds.size(); } diff --git a/src/library/basesqltablemodel.h b/src/library/basesqltablemodel.h index 98e518b6460..82081abbfa1 100644 --- a/src/library/basesqltablemodel.h +++ b/src/library/basesqltablemodel.h @@ -102,7 +102,7 @@ class BaseSqlTableModel : public BaseTrackTableModel { QMap m_sortColumnIdByColumnIndex; private slots: - void tracksChanged(QSet trackIds); + void tracksChanged(const QSet& trackIds); private: void setTrackValueForColumn( diff --git a/src/library/basetrackcache.cpp b/src/library/basetrackcache.cpp index 85f6a3df9fd..e98ee5f535e 100644 --- a/src/library/basetrackcache.cpp +++ b/src/library/basetrackcache.cpp @@ -75,7 +75,7 @@ QString BaseTrackCache::columnSortForFieldIndex(int index) const { return m_columnCache.columnSortForFieldIndex(index); } -void BaseTrackCache::slotTracksAddedOrChanged(QSet trackIds) { +void BaseTrackCache::slotTracksAddedOrChanged(const QSet& trackIds) { if (sDebug) { qDebug() << this << "slotTracksAddedOrChanged" << trackIds.size(); } @@ -89,7 +89,7 @@ void BaseTrackCache::slotScanTrackAdded(TrackPointer pTrack) { updateTrackInIndex(pTrack); } -void BaseTrackCache::slotTracksRemoved(QSet trackIds) { +void BaseTrackCache::slotTracksRemoved(const QSet& trackIds) { if (sDebug) { qDebug() << this << "slotTracksRemoved" << trackIds.size(); } @@ -123,7 +123,7 @@ void BaseTrackCache::ensureCached(TrackId trackId) { updateTrackInIndex(trackId); } -void BaseTrackCache::ensureCached(QSet trackIds) { +void BaseTrackCache::ensureCached(const QSet& trackIds) { updateTracksInIndex(trackIds); } @@ -676,8 +676,10 @@ int BaseTrackCache::findSortInsertionPoint(TrackPointer pTrack, return min; } -int BaseTrackCache::compareColumnValues(int sortColumn, Qt::SortOrder sortOrder, - QVariant val1, QVariant val2) const { +int BaseTrackCache::compareColumnValues(int sortColumn, + Qt::SortOrder sortOrder, + const QVariant& val1, + const QVariant& val2) const { int result = 0; if (sortColumn == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_YEAR) || diff --git a/src/library/basetrackcache.h b/src/library/basetrackcache.h index 64b346312ed..f9bd41ef0de 100644 --- a/src/library/basetrackcache.h +++ b/src/library/basetrackcache.h @@ -72,17 +72,17 @@ class BaseTrackCache : public QObject { QHash* trackToIndex); virtual bool isCached(TrackId trackId) const; virtual void ensureCached(TrackId trackId); - virtual void ensureCached(QSet trackIds); + virtual void ensureCached(const QSet& trackIds); virtual void setSearchColumns(const QStringList& columns); signals: - void tracksChanged(QSet trackIds); + void tracksChanged(const QSet& trackIds); public slots: void slotScanTrackAdded(TrackPointer pTrack); - void slotTracksAddedOrChanged(QSet trackId); - void slotTracksRemoved(QSet trackId); + void slotTracksAddedOrChanged(const QSet& trackId); + void slotTracksRemoved(const QSet& trackId); void slotTrackDirty(TrackId trackId); void slotTrackClean(TrackId trackId); @@ -103,8 +103,10 @@ class BaseTrackCache : public QObject { const QList& sortColumns, const int columnOffset, const QVector& trackIds) const; - int compareColumnValues(int sortColumn, Qt::SortOrder sortOrder, - QVariant val1, QVariant val2) const; + int compareColumnValues(int sortColumn, + Qt::SortOrder sortOrder, + const QVariant& val1, + const QVariant& val2) const; bool trackMatches(const TrackPointer& pTrack, const QRegExp& matcher) const; bool trackMatchesNumeric(const TrackPointer& pTrack, diff --git a/src/library/basetracksetfeature.h b/src/library/basetracksetfeature.h index 07a7b7b28a5..ea155b73e31 100644 --- a/src/library/basetracksetfeature.h +++ b/src/library/basetracksetfeature.h @@ -10,7 +10,7 @@ class BaseTrackSetFeature : public LibraryFeature { const QString& rootViewName); signals: - void analyzeTracks(QList); + void analyzeTracks(const QList&); public slots: void activate() override; diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp index f74acb57742..01b26920e0a 100644 --- a/src/library/basetracktablemodel.cpp +++ b/src/library/basetracktablemodel.cpp @@ -227,7 +227,7 @@ void BaseTrackTableModel::initHeaderProperties() { void BaseTrackTableModel::setHeaderProperties( ColumnCache::Column column, - QString title, + const QString& title, int defaultWidth) { int section = fieldIndex(column); if (section < 0) { @@ -738,7 +738,7 @@ QMimeData* BaseTrackTableModel::mimeData( } void BaseTrackTableModel::slotTrackLoaded( - QString group, + const QString& group, TrackPointer pTrack) { if (group == m_previewDeckGroup) { // If there was a previously loaded track, refresh its rows so the @@ -758,7 +758,7 @@ void BaseTrackTableModel::slotTrackLoaded( } void BaseTrackTableModel::slotRefreshCoverRows( - QList rows) { + const QList& rows) { if (rows.isEmpty()) { return; } diff --git a/src/library/basetracktablemodel.h b/src/library/basetracktablemodel.h index 96e04f81e74..a771213f1ed 100644 --- a/src/library/basetracktablemodel.h +++ b/src/library/basetracktablemodel.h @@ -108,7 +108,7 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel { // its data, not the title string itself. void setHeaderProperties( ColumnCache::Column column, - QString title, + const QString& title, int defaultWidth = 0); ColumnCache::Column mapColumn(int column) const { @@ -173,11 +173,11 @@ class BaseTrackTableModel : public QAbstractTableModel, public TrackModel { private slots: void slotTrackLoaded( - QString group, + const QString& group, TrackPointer pTrack); void slotRefreshCoverRows( - QList rows); + const QList& rows); void slotRefreshAllRows(); diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp index 5215540c96d..3906e03e145 100644 --- a/src/library/browse/browsefeature.cpp +++ b/src/library/browse/browsefeature.cpp @@ -270,7 +270,7 @@ void BrowseFeature::activateChild(const QModelIndex& index) { emit enableCoverArtDisplay(false); } -void BrowseFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { +void BrowseFeature::onRightClickChild(const QPoint& globalPos, const QModelIndex& index) { TreeItem *item = static_cast(index.internalPointer()); m_pLastRightClickedItem = item; @@ -457,7 +457,7 @@ void BrowseFeature::loadQuickLinks() { } } -QString BrowseFeature::extractNameFromPath(QString spath) { +QString BrowseFeature::extractNameFromPath(const QString& spath) { QString path = spath.left(spath.count()-1); int index = path.lastIndexOf("/"); QString name = (spath.count() > 1) ? path.mid(index+1) : spath; diff --git a/src/library/browse/browsefeature.h b/src/library/browse/browsefeature.h index 0665a96b3ce..0cab0654fe2 100644 --- a/src/library/browse/browsefeature.h +++ b/src/library/browse/browsefeature.h @@ -49,19 +49,19 @@ class BrowseFeature : public LibraryFeature { void slotAddToLibrary(); void activate(); void activateChild(const QModelIndex& index); - void onRightClickChild(const QPoint& globalPos, QModelIndex index); + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index); void onLazyChildExpandation(const QModelIndex& index); void slotLibraryScanStarted(); void slotLibraryScanFinished(); signals: void setRootIndex(const QModelIndex&); - void requestAddDir(QString); + void requestAddDir(const QString&); void scanLibrary(); private: QString getRootViewHtml() const; - QString extractNameFromPath(QString spath); + QString extractNameFromPath(const QString& spath); QStringList getDefaultQuickLinks() const; void saveQuickLinks(); void loadQuickLinks(); diff --git a/src/library/browse/browsetablemodel.cpp b/src/library/browse/browsetablemodel.cpp index 91f65fce3ae..67c60c9eedd 100644 --- a/src/library/browse/browsetablemodel.cpp +++ b/src/library/browse/browsetablemodel.cpp @@ -437,7 +437,7 @@ bool BrowseTableModel::setData( return true; } -void BrowseTableModel::trackLoaded(QString group, TrackPointer pTrack) { +void BrowseTableModel::trackLoaded(const QString& group, TrackPointer pTrack) { if (group == m_previewDeckGroup) { for (int row = 0; row < rowCount(); ++row) { QModelIndex i = index(row, COLUMN_PREVIEW); diff --git a/src/library/browse/browsetablemodel.h b/src/library/browse/browsetablemodel.h index 5e959a9d90d..dfb7fa60b1e 100644 --- a/src/library/browse/browsetablemodel.h +++ b/src/library/browse/browsetablemodel.h @@ -77,7 +77,7 @@ class BrowseTableModel final : public QStandardItemModel, public virtual TrackMo public slots: void slotClear(BrowseTableModel*); void slotInsert(const QList< QList >&, BrowseTableModel*); - void trackLoaded(QString group, TrackPointer pTrack); + void trackLoaded(const QString& group, TrackPointer pTrack); private: void addSearchColumn(int index); diff --git a/src/library/browse/browsethread.cpp b/src/library/browse/browsethread.cpp index e3badf5d3d4..ef89873c971 100644 --- a/src/library/browse/browsethread.cpp +++ b/src/library/browse/browsethread.cpp @@ -93,9 +93,9 @@ namespace { class YearItem: public QStandardItem { public: - explicit YearItem(QString year): - QStandardItem(year) { - } + explicit YearItem(const QString& year) + : QStandardItem(year) { + } QVariant data(int role) const { switch (role) { diff --git a/src/library/coverartdelegate.h b/src/library/coverartdelegate.h index 9d9545853f0..761a6b2f8b1 100644 --- a/src/library/coverartdelegate.h +++ b/src/library/coverartdelegate.h @@ -27,8 +27,7 @@ class CoverArtDelegate : public TableItemDelegate { signals: // Sent when rows need to be refreshed - void rowsChanged( - QList rows); + void rowsChanged(const QList& rows); public slots: // Advise the delegate to temporarily inhibit lazy loading diff --git a/src/library/crate/cratefeature.cpp b/src/library/crate/cratefeature.cpp index d15e21c2f8e..bad303891cc 100644 --- a/src/library/crate/cratefeature.cpp +++ b/src/library/crate/cratefeature.cpp @@ -221,8 +221,8 @@ void updateTreeItemForTrackSelection( } // anonymous namespace -bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList urls, - QObject* pSource) { +bool CrateFeature::dropAcceptChild( + const QModelIndex& index, const QList& urls, QObject* pSource) { CrateId crateId(crateIdFromIndex(index)); VERIFY_OR_DEBUG_ASSERT(crateId.isValid()) { return false; @@ -242,7 +242,7 @@ bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList urls, return true; } -bool CrateFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { +bool CrateFeature::dragMoveAcceptChild(const QModelIndex& index, const QUrl& url) { CrateId crateId(crateIdFromIndex(index)); if (!crateId.isValid()) { return false; @@ -328,7 +328,7 @@ void CrateFeature::onRightClick(const QPoint& globalPos) { menu.exec(globalPos); } -void CrateFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { +void CrateFeature::onRightClickChild(const QPoint& globalPos, const QModelIndex& index) { //Save the model index so we can get it in the action slots... m_lastRightClickedIndex = index; CrateId crateId(crateIdFromIndex(index)); diff --git a/src/library/crate/cratefeature.h b/src/library/crate/cratefeature.h index 9461a5dd17c..6b9195259b7 100644 --- a/src/library/crate/cratefeature.h +++ b/src/library/crate/cratefeature.h @@ -31,9 +31,10 @@ class CrateFeature : public BaseTrackSetFeature { QVariant title() override; QIcon getIcon() override; - bool dropAcceptChild(const QModelIndex& index, QList urls, - QObject* pSource) override; - bool dragMoveAcceptChild(const QModelIndex& index, QUrl url) override; + bool dropAcceptChild(const QModelIndex& index, + const QList& urls, + QObject* pSource) override; + bool dragMoveAcceptChild(const QModelIndex& index, const QUrl& url) override; void bindLibraryWidget(WLibrary* libraryWidget, KeyboardEventFilter* keyboard) override; @@ -44,7 +45,7 @@ class CrateFeature : public BaseTrackSetFeature { public slots: void activateChild(const QModelIndex& index) override; void onRightClick(const QPoint& globalPos) override; - void onRightClickChild(const QPoint& globalPos, QModelIndex index) override; + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; void slotCreateCrate(); private slots: diff --git a/src/library/crate/cratestorage.cpp b/src/library/crate/cratestorage.cpp index 3cb1648953d..9e11d7eabd3 100644 --- a/src/library/crate/cratestorage.cpp +++ b/src/library/crate/cratestorage.cpp @@ -147,8 +147,7 @@ void CrateSummaryQueryFields::populateFromQuery( pCrateSummary->setTrackDuration(getTrackDuration(query)); } - -void CrateStorage::repairDatabase(QSqlDatabase database) { +void CrateStorage::repairDatabase(const QSqlDatabase& database) { // NOTE(uklotzde): No transactions // All queries are independent so there is no need to enclose some // or all of them in a transaction. Grouping into transactions would @@ -233,13 +232,11 @@ void CrateStorage::repairDatabase(QSqlDatabase database) { } } - -void CrateStorage::connectDatabase(QSqlDatabase database) { +void CrateStorage::connectDatabase(const QSqlDatabase& database) { m_database = database; createViews(); } - void CrateStorage::disconnectDatabase() { // Ensure that we don't use the current database connection // any longer. diff --git a/src/library/crate/cratestorage.h b/src/library/crate/cratestorage.h index ee3d1b5171f..c7454fafb22 100644 --- a/src/library/crate/cratestorage.h +++ b/src/library/crate/cratestorage.h @@ -219,10 +219,10 @@ class CrateStorage: public virtual /*implements*/ SqlStorage { ~CrateStorage() override = default; void repairDatabase( - QSqlDatabase database) override; + const QSqlDatabase& database) override; void connectDatabase( - QSqlDatabase database) override; + const QSqlDatabase& database) override; void disconnectDatabase() override; ///////////////////////////////////////////////////////////////////////// diff --git a/src/library/crate/cratetablemodel.cpp b/src/library/crate/cratetablemodel.cpp index 4997fa1519f..701728bf449 100644 --- a/src/library/crate/cratetablemodel.cpp +++ b/src/library/crate/cratetablemodel.cpp @@ -59,7 +59,7 @@ void CrateTableModel::selectCrate(CrateId crateId) { setDefaultSort(fieldIndex("artist"), Qt::AscendingOrder); } -bool CrateTableModel::addTrack(const QModelIndex& index, QString location) { +bool CrateTableModel::addTrack(const QModelIndex& index, const QString& location) { Q_UNUSED(index); // This will only succeed if the file actually exist. diff --git a/src/library/crate/cratetablemodel.h b/src/library/crate/cratetablemodel.h index 7afe9d036c8..68d02c0ba9b 100644 --- a/src/library/crate/cratetablemodel.h +++ b/src/library/crate/cratetablemodel.h @@ -19,7 +19,7 @@ class CrateTableModel final : public BaseSqlTableModel { return m_selectedCrate; } - bool addTrack(const QModelIndex &index, QString location); + bool addTrack(const QModelIndex& index, const QString& location); // From TrackModel bool isColumnInternal(int column) final; diff --git a/src/library/dao/autodjcratesdao.cpp b/src/library/dao/autodjcratesdao.cpp index 9ca5b4284b5..90c745f91ca 100644 --- a/src/library/dao/autodjcratesdao.cpp +++ b/src/library/dao/autodjcratesdao.cpp @@ -1072,8 +1072,8 @@ void AutoDJCratesDAO::slotPlaylistTrackRemoved(int playlistId, } // Signaled by the PlayerInfo singleton when a track is loaded to a deck. -void AutoDJCratesDAO::slotPlayerInfoTrackLoaded(QString a_strGroup, - TrackPointer a_pTrack) { +void AutoDJCratesDAO::slotPlayerInfoTrackLoaded(const QString& a_strGroup, + TrackPointer a_pTrack) { // This gets called with a null track during an unload. Filter that out. if (a_pTrack == NULL) { return; @@ -1103,8 +1103,8 @@ void AutoDJCratesDAO::slotPlayerInfoTrackLoaded(QString a_strGroup, } // Signaled by the PlayerInfo singleton when a track is unloaded from a deck. -void AutoDJCratesDAO::slotPlayerInfoTrackUnloaded(QString group, - TrackPointer pTrack) { +void AutoDJCratesDAO::slotPlayerInfoTrackUnloaded(const QString& group, + TrackPointer pTrack) { // This counts as an auto-DJ reference. The idea is to prevent tracks that // are loaded into a deck from being randomly chosen. TrackId trackId(pTrack->getId()); diff --git a/src/library/dao/autodjcratesdao.h b/src/library/dao/autodjcratesdao.h index 35e45678ff2..5b2ae707485 100644 --- a/src/library/dao/autodjcratesdao.h +++ b/src/library/dao/autodjcratesdao.h @@ -92,8 +92,8 @@ class AutoDJCratesDAO : public QObject { // Signaled by the PlayerInfo singleton when a track is loaded to, or // unloaded from, a deck. - void slotPlayerInfoTrackLoaded(QString group, TrackPointer pTrack); - void slotPlayerInfoTrackUnloaded(QString group, TrackPointer pTrack); + void slotPlayerInfoTrackLoaded(const QString& group, TrackPointer pTrack); + void slotPlayerInfoTrackUnloaded(const QString& group, TrackPointer pTrack); private: void updateAutoDjCrate(CrateId crateId); diff --git a/src/library/dao/directorydao.cpp b/src/library/dao/directorydao.cpp index 6594b210571..8ba7acae2b2 100644 --- a/src/library/dao/directorydao.cpp +++ b/src/library/dao/directorydao.cpp @@ -9,7 +9,7 @@ namespace { -bool isChildDir(QString testDir, QString dirStr) { +bool isChildDir(const QString& testDir, const QString& dirStr) { QDir test = QDir(testDir); QDir dir = QDir(dirStr); bool child = dir == test; diff --git a/src/library/dao/playlistdao.cpp b/src/library/dao/playlistdao.cpp index c6650a7c1cf..5665b029a29 100644 --- a/src/library/dao/playlistdao.cpp +++ b/src/library/dao/playlistdao.cpp @@ -456,14 +456,15 @@ void PlaylistDAO::removeTrackFromPlaylist(int playlistId, int position) { emit tracksChanged(QSet{playlistId}); } -void PlaylistDAO::removeTracksFromPlaylist(int playlistId, QList positions) { +void PlaylistDAO::removeTracksFromPlaylist(int playlistId, const QList& positions) { // get positions in reversed order - std::sort(positions.begin(), positions.end(), std::greater()); + QList sortedPositons = positions; + std::sort(sortedPositons.begin(), sortedPositons.end(), std::greater()); //qDebug() << "PlaylistDAO::removeTrackFromPlaylist" // << QThread::currentThread() << m_database.connectionName(); ScopedTransaction transaction(m_database); - for (const auto position : qAsConst(positions)) { + for (const auto position : qAsConst(sortedPositons)) { removeTracksFromPlaylistInner(playlistId, position); } transaction.commit(); diff --git a/src/library/dao/playlistdao.h b/src/library/dao/playlistdao.h index fba4602c3e8..d161706bb1a 100644 --- a/src/library/dao/playlistdao.h +++ b/src/library/dao/playlistdao.h @@ -92,7 +92,7 @@ class PlaylistDAO : public QObject, public virtual DAO { void removeHiddenTracks(const int playlistId); // Remove a track from a playlist void removeTrackFromPlaylist(int playlistId, int position); - void removeTracksFromPlaylist(int playlistId, QList positions); + void removeTracksFromPlaylist(int playlistId, const QList& positions); void removeTracksFromPlaylistById(int playlistId, TrackId trackId); // Insert a track into a specific position in a playlist bool insertTrackIntoPlaylist(TrackId trackId, int playlistId, int position); @@ -123,11 +123,11 @@ class PlaylistDAO : public QObject, public virtual DAO { signals: void added(int playlistId); void deleted(int playlistId); - void renamed(int playlistId, QString newName); + void renamed(int playlistId, const QString& newName); void lockChanged(int playlistId); void trackAdded(int playlistId, TrackId trackId, int position); void trackRemoved(int playlistId, TrackId trackId, int position); - void tracksChanged(QSet playlistIds); // added/removed/reordered + void tracksChanged(const QSet& playlistIds); // added/removed/reordered private: bool removeTracksFromPlaylist(int playlistId, int startIndex); diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp index 4f8ab1dbf66..e51ee5fbfd7 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -45,7 +45,7 @@ mixxx::Logger kLogger("TrackDAO"); enum { UndefinedRecordIndex = -2 }; -void markTrackLocationsAsDeleted(QSqlDatabase database, const QString& directory) { +void markTrackLocationsAsDeleted(const QSqlDatabase& database, const QString& directory) { //qDebug() << "TrackDAO::markTrackLocationsAsDeleted" << QThread::currentThread() << m_database.connectionName(); QSqlQuery query(database); query.prepare("UPDATE track_locations " @@ -290,13 +290,13 @@ void TrackDAO::saveTrack(Track* pTrack) const { } } -void TrackDAO::slotDatabaseTracksChanged(QSet changedTrackIds) { +void TrackDAO::slotDatabaseTracksChanged(const QSet& changedTrackIds) { if (!changedTrackIds.isEmpty()) { emit tracksChanged(changedTrackIds); } } -void TrackDAO::slotDatabaseTracksRelocated(QList relocatedTracks) { +void TrackDAO::slotDatabaseTracksRelocated(const QList& relocatedTracks) { QSet removedTrackIds; QSet changedTrackIds; for (const auto& relocatedTrack : qAsConst(relocatedTracks)) { @@ -493,7 +493,10 @@ namespace { pTrackLibraryQuery->bindValue(":key_id", static_cast(key)); } - bool insertTrackLibrary(QSqlQuery* pTrackLibraryInsert, const Track& track, DbId trackLocationId, QDateTime trackDateAdded) { + bool insertTrackLibrary(QSqlQuery* pTrackLibraryInsert, + const Track& track, + DbId trackLocationId, + const QDateTime& trackDateAdded) { bindTrackLibraryValues(pTrackLibraryInsert, track); if (!track.getDateAdded().isNull()) { diff --git a/src/library/dao/trackdao.h b/src/library/dao/trackdao.h index 19c2e096610..9df042b9772 100644 --- a/src/library/dao/trackdao.h +++ b/src/library/dao/trackdao.h @@ -75,21 +75,21 @@ class TrackDAO : public QObject, public virtual DAO, public virtual GlobalTrackC void trackClean(TrackId trackId); // Multiple tracks - void tracksAdded(QSet trackIds); - void tracksChanged(QSet trackIds); - void tracksRemoved(QSet trackIds); + void tracksAdded(const QSet& trackIds); + void tracksChanged(const QSet& trackIds); + void tracksRemoved(const QSet& trackIds); - void progressVerifyTracksOutside(QString path); - void progressCoverArt(QString file); + void progressVerifyTracksOutside(const QString& path); + void progressCoverArt(const QString& file); void forceModelUpdate(); public slots: // Slots to inform the TrackDAO about changes that // have been applied directly to the database. void slotDatabaseTracksChanged( - QSet changedTrackIds); + const QSet& changedTrackIds); void slotDatabaseTracksRelocated( - QList relocatedTracks); + const QList& relocatedTracks); private: friend class LibraryScanner; diff --git a/src/library/dlganalysis.cpp b/src/library/dlganalysis.cpp index a3f9a1bf34c..a75c41255f3 100644 --- a/src/library/dlganalysis.cpp +++ b/src/library/dlganalysis.cpp @@ -116,7 +116,7 @@ void DlgAnalysis::loadSelectedTrack() { m_pAnalysisLibraryTableView->loadSelectedTrack(); } -void DlgAnalysis::loadSelectedTrackToGroup(QString group, bool play) { +void DlgAnalysis::loadSelectedTrackToGroup(const QString& group, bool play) { m_pAnalysisLibraryTableView->loadSelectedTrackToGroup(group, play); } diff --git a/src/library/dlganalysis.h b/src/library/dlganalysis.h index 1aacad7478b..5e8b7a9cd25 100644 --- a/src/library/dlganalysis.h +++ b/src/library/dlganalysis.h @@ -27,7 +27,7 @@ class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual Libra void onShow() override; bool hasFocus() const override; void loadSelectedTrack() override; - void loadSelectedTrackToGroup(QString group, bool play) override; + void loadSelectedTrackToGroup(const QString& group, bool play) override; void slotAddToAutoDJBottom() override; void slotAddToAutoDJTop() override; void slotAddToAutoDJReplace() override; @@ -50,8 +50,8 @@ class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual Libra signals: void loadTrack(TrackPointer pTrack); - void loadTrackToPlayer(TrackPointer pTrack, QString player); - void analyzeTracks(QList trackIds); + void loadTrackToPlayer(TrackPointer pTrack, const QString& player); + void analyzeTracks(const QList& trackIds); void stopAnalysis(); void trackSelected(TrackPointer pTrack); diff --git a/src/library/dlgtagfetcher.cpp b/src/library/dlgtagfetcher.cpp index c5747401a10..86fe9551f0c 100644 --- a/src/library/dlgtagfetcher.cpp +++ b/src/library/dlgtagfetcher.cpp @@ -234,14 +234,14 @@ void DlgTagFetcher::quit() { accept(); } -void DlgTagFetcher::fetchTagProgress(QString text) { +void DlgTagFetcher::fetchTagProgress(const QString& text) { QString status = tr("Status: %1"); loadingStatus->setText(status.arg(text)); } void DlgTagFetcher::fetchTagFinished( TrackPointer pTrack, - QList guessedTrackReleases) { + const QList& guessedTrackReleases) { VERIFY_OR_DEBUG_ASSERT(pTrack == m_track) { return; } @@ -251,7 +251,8 @@ void DlgTagFetcher::fetchTagFinished( updateStack(); } -void DlgTagFetcher::slotNetworkResult(int httpError, QString app, QString message, int code) { +void DlgTagFetcher::slotNetworkResult( + int httpError, const QString& app, const QString& message, int code) { m_networkResult = httpError == 0 ? NetworkResult::UnknownError : NetworkResult::HttpError; m_data.m_pending = false; QString strError = tr("HTTP Status: %1"); diff --git a/src/library/dlgtagfetcher.h b/src/library/dlgtagfetcher.h index b50c6117811..1b358e2258c 100644 --- a/src/library/dlgtagfetcher.h +++ b/src/library/dlgtagfetcher.h @@ -35,10 +35,10 @@ class DlgTagFetcher : public QDialog, public Ui::DlgTagFetcher { private slots: void fetchTagFinished( TrackPointer pTrack, - QList guessedTrackReleases); + const QList& guessedTrackReleases); void resultSelected(); - void fetchTagProgress(QString); - void slotNetworkResult(int httpStatus, QString app, QString message, int code); + void fetchTagProgress(const QString&); + void slotNetworkResult(int httpStatus, const QString& app, const QString& message, int code); void slotTrackChanged(TrackId trackId); void apply(); void quit(); diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index adf44e43cde..e53722e6c81 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -318,7 +318,7 @@ void DlgTrackInfo::loadTrack(TrackPointer pTrack) { } } -void DlgTrackInfo::loadTrack(QModelIndex index) { +void DlgTrackInfo::loadTrack(const QModelIndex& index) { VERIFY_OR_DEBUG_ASSERT(m_pTrackModel) { return; } diff --git a/src/library/dlgtrackinfo.h b/src/library/dlgtrackinfo.h index 6429fb630aa..0d9348ffc0a 100644 --- a/src/library/dlgtrackinfo.h +++ b/src/library/dlgtrackinfo.h @@ -34,7 +34,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo { // Not thread safe. Only invoke via AutoConnection or QueuedConnection, not // directly! void loadTrack(TrackPointer pTrack); - void loadTrack(QModelIndex index); + void loadTrack(const QModelIndex& index); signals: void next(); diff --git a/src/library/export/trackexportdlg.cpp b/src/library/export/trackexportdlg.cpp index 14f5dbb4036..8efdea6aae5 100644 --- a/src/library/export/trackexportdlg.cpp +++ b/src/library/export/trackexportdlg.cpp @@ -50,7 +50,7 @@ void TrackExportDlg::showEvent(QShowEvent* event) { m_worker->start(); } -void TrackExportDlg::slotProgress(QString filename, int progress, int count) { +void TrackExportDlg::slotProgress(const QString& filename, int progress, int count) { if (progress == count) { statusLabel->setText(tr("Export finished")); finish(); @@ -63,7 +63,7 @@ void TrackExportDlg::slotProgress(QString filename, int progress, int count) { } void TrackExportDlg::slotAskOverwriteMode( - QString filename, + const QString& filename, std::promise* promise) { QMessageBox question_box( QMessageBox::Warning, diff --git a/src/library/export/trackexportdlg.h b/src/library/export/trackexportdlg.h index f565af4faaf..b63956c554d 100644 --- a/src/library/export/trackexportdlg.h +++ b/src/library/export/trackexportdlg.h @@ -29,9 +29,9 @@ class TrackExportDlg : public QDialog, public Ui::DlgTrackExport { virtual ~TrackExportDlg() { } public slots: - void slotProgress(QString filename, int progress, int count); + void slotProgress(const QString& filename, int progress, int count); void slotAskOverwriteMode( - QString filename, + const QString& filename, std::promise* promise); void cancelButtonClicked(); diff --git a/src/library/export/trackexportwizard.h b/src/library/export/trackexportwizard.h index b863e8f0b4b..9c9971e0c25 100644 --- a/src/library/export/trackexportwizard.h +++ b/src/library/export/trackexportwizard.h @@ -21,7 +21,7 @@ class TrackExportWizard : public QObject { Q_OBJECT public: - TrackExportWizard(QWidget* parent, UserSettingsPointer pConfig, TrackPointerList tracks) + TrackExportWizard(QWidget* parent, UserSettingsPointer pConfig, const TrackPointerList& tracks) : m_parent(parent), m_pConfig(pConfig), m_tracks(tracks) { } virtual ~TrackExportWizard() { } diff --git a/src/library/export/trackexportworker.cpp b/src/library/export/trackexportworker.cpp index b84eedd97c1..38406eccdc5 100644 --- a/src/library/export/trackexportworker.cpp +++ b/src/library/export/trackexportworker.cpp @@ -147,7 +147,7 @@ void TrackExportWorker::copyFile(const QFileInfo& source_fileinfo, } TrackExportWorker::OverwriteAnswer TrackExportWorker::makeOverwriteRequest( - QString filename) { + const QString& filename) { // QT's QFuture is not quite right for this type of threaded question-and-answer. // std::future works fine, even with signals and slots. QScopedPointer> mode_promise( diff --git a/src/library/export/trackexportworker.h b/src/library/export/trackexportworker.h index 8e22d98a4fc..0bd2ea36954 100644 --- a/src/library/export/trackexportworker.h +++ b/src/library/export/trackexportworker.h @@ -36,7 +36,7 @@ class TrackExportWorker : public QThread { // Constructor does not validate the destination directory. Calling classes // should do that. - TrackExportWorker(QString destDir, TrackPointerList tracks) + TrackExportWorker(const QString& destDir, const TrackPointerList& tracks) : m_destDir(destDir), m_tracks(tracks) { } virtual ~TrackExportWorker() { }; @@ -61,9 +61,9 @@ class TrackExportWorker : public QThread { // Note that fully qualifying the Answer class name is required for the // signal to connect. void askOverwriteMode( - QString filename, + const QString& filename, std::promise* promise); - void progress(QString filename, int progress, int count); + void progress(const QString& filename, int progress, int count); void canceled(); private: @@ -77,7 +77,7 @@ class TrackExportWorker : public QThread { // Emit a signal requesting overwrite mode, and block until we get an // answer. Updates m_overwriteMode appropriately. - OverwriteAnswer makeOverwriteRequest(QString filename); + OverwriteAnswer makeOverwriteRequest(const QString& filename); QAtomicInt m_bStop = false; QString m_errorMessage; diff --git a/src/library/itunes/itunesfeature.cpp b/src/library/itunes/itunesfeature.cpp index 8e39e1a5f32..524720e7c24 100644 --- a/src/library/itunes/itunesfeature.cpp +++ b/src/library/itunes/itunesfeature.cpp @@ -121,7 +121,7 @@ ITunesFeature::~ITunesFeature() { delete m_pITunesPlaylistModel; } -BaseSqlTableModel* ITunesFeature::getPlaylistModelForPlaylist(QString playlist) { +BaseSqlTableModel* ITunesFeature::getPlaylistModelForPlaylist(const QString& playlist) { BaseExternalPlaylistModel* pModel = new BaseExternalPlaylistModel( this, m_pLibrary->trackCollections(), "mixxx.db.model.itunes_playlist", @@ -789,7 +789,7 @@ void ITunesFeature::parsePlaylist(QXmlStreamReader& xml, QSqlQuery& query_insert } } -void ITunesFeature::clearTable(QString table_name) { +void ITunesFeature::clearTable(const QString& table_name) { QSqlQuery query(m_database); query.prepare("delete from "+table_name); bool success = query.exec(); diff --git a/src/library/itunes/itunesfeature.h b/src/library/itunes/itunesfeature.h index da27b1d79e9..92358e9dcb7 100644 --- a/src/library/itunes/itunesfeature.h +++ b/src/library/itunes/itunesfeature.h @@ -41,7 +41,7 @@ class ITunesFeature : public BaseExternalLibraryFeature { void onTrackCollectionLoaded(); private: - BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist) override; + BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) override; static QString getiTunesMusicPath(); // returns the invisible rootItem for the sidebar model TreeItem* importLibrary(); @@ -51,7 +51,7 @@ class ITunesFeature : public BaseExternalLibraryFeature { TreeItem* parsePlaylists(QXmlStreamReader &xml); void parsePlaylist(QXmlStreamReader& xml, QSqlQuery& query1, QSqlQuery &query2, TreeItem*); - void clearTable(QString table_name); + void clearTable(const QString& table_name); bool readNextStartElement(QXmlStreamReader& xml); BaseExternalTrackModel* m_pITunesTrackModel; diff --git a/src/library/library.cpp b/src/library/library.cpp index 657f7a0fee4..1d8b45e26c3 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -421,7 +421,7 @@ void Library::slotLoadTrack(TrackPointer pTrack) { emit loadTrack(pTrack); } -void Library::slotLoadLocationToPlayer(QString location, QString group) { +void Library::slotLoadLocationToPlayer(const QString& location, const QString& group) { auto trackRef = TrackRef::fromFileInfo(location); TrackPointer pTrack = m_pTrackCollectionManager->getOrAddTrack(trackRef); if (pTrack) { @@ -429,7 +429,7 @@ void Library::slotLoadLocationToPlayer(QString location, QString group) { } } -void Library::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play) { +void Library::slotLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play) { emit loadTrackToPlayer(pTrack, group, play); } @@ -451,7 +451,7 @@ void Library::onSkinLoadFinished() { m_pSidebarModel->activateDefaultSelection(); } -void Library::slotRequestAddDir(QString dir) { +void Library::slotRequestAddDir(const QString& dir) { // We only call this method if the user has picked a new directory via a // file dialog. This means the system sandboxer (if we are sandboxed) has // granted us permission to this folder. Create a security bookmark while we @@ -474,7 +474,7 @@ void Library::slotRequestAddDir(QString dir) { } } -void Library::slotRequestRemoveDir(QString dir, RemovalType removalType) { +void Library::slotRequestRemoveDir(const QString& dir, RemovalType removalType) { switch (removalType) { case RemovalType::KeepTracks: break; @@ -510,7 +510,7 @@ void Library::slotRequestRemoveDir(QString dir, RemovalType removalType) { } } -void Library::slotRequestRelocateDir(QString oldDir, QString newDir) { +void Library::slotRequestRelocateDir(const QString& oldDir, const QString& newDir) { m_pTrackCollectionManager->relocateDirectory(oldDir, newDir); // also update the config file if necessary so that downgrading is still diff --git a/src/library/library.h b/src/library/library.h index 8420c37864c..a1c81fe855f 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -94,21 +94,21 @@ class Library: public QObject { void slotShowTrackModel(QAbstractItemModel* model); void slotSwitchToView(const QString& view); void slotLoadTrack(TrackPointer pTrack); - void slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play); - void slotLoadLocationToPlayer(QString location, QString group); + void slotLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play); + void slotLoadLocationToPlayer(const QString& location, const QString& group); void slotRefreshLibraryModels(); void slotCreatePlaylist(); void slotCreateCrate(); - void slotRequestAddDir(QString directory); - void slotRequestRemoveDir(QString directory, Library::RemovalType removalType); - void slotRequestRelocateDir(QString previousDirectory, QString newDirectory); + void slotRequestAddDir(const QString& directory); + void slotRequestRemoveDir(const QString& directory, Library::RemovalType removalType); + void slotRequestRelocateDir(const QString& previousDirectory, const QString& newDirectory); void onSkinLoadFinished(); signals: void showTrackModel(QAbstractItemModel* model); void switchToView(const QString& view); void loadTrack(TrackPointer pTrack); - void loadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); + void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play = false); void restoreSearch(const QString&); void search(const QString& text); void disableSearch(); diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 4366962e71c..0838628a3f7 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -363,7 +363,7 @@ void LibraryControl::searchboxWidgetDeleted() { m_pSearchbox = nullptr; } -void LibraryControl::slotLoadSelectedTrackToGroup(QString group, bool play) { +void LibraryControl::slotLoadSelectedTrackToGroup(const QString& group, bool play) { if (!m_pLibraryWidget) { return; } diff --git a/src/library/librarycontrol.h b/src/library/librarycontrol.h index dd8046c89ed..ea7d5511e04 100644 --- a/src/library/librarycontrol.h +++ b/src/library/librarycontrol.h @@ -23,7 +23,7 @@ class LoadToGroupController : public QObject { virtual ~LoadToGroupController(); signals: - void loadToGroup(QString group, bool); + void loadToGroup(const QString& group, bool); public slots: void slotLoadToGroup(double v); @@ -50,7 +50,7 @@ class LibraryControl : public QObject { public slots: // Deprecated navigation slots - void slotLoadSelectedTrackToGroup(QString group, bool play); + void slotLoadSelectedTrackToGroup(const QString& group, bool play); private slots: void libraryWidgetDeleted(); diff --git a/src/library/libraryfeature.h b/src/library/libraryfeature.h index 9f375a778fe..c0fd1d3d837 100644 --- a/src/library/libraryfeature.h +++ b/src/library/libraryfeature.h @@ -39,23 +39,24 @@ class LibraryFeature : public QObject { virtual QVariant title() = 0; virtual QIcon getIcon() = 0; - virtual bool dropAccept(QList urls, QObject* pSource) { + virtual bool dropAccept(const QList& urls, QObject* pSource) { Q_UNUSED(urls); Q_UNUSED(pSource); return false; } virtual bool dropAcceptChild(const QModelIndex& index, - QList urls, QObject* pSource) { + const QList& urls, + QObject* pSource) { Q_UNUSED(index); Q_UNUSED(urls); Q_UNUSED(pSource); return false; } - virtual bool dragMoveAccept(QUrl url) { + virtual bool dragMoveAccept(const QUrl& url) { Q_UNUSED(url); return false; } - virtual bool dragMoveAcceptChild(const QModelIndex& index, QUrl url) { + virtual bool dragMoveAcceptChild(const QModelIndex& index, const QUrl& url) { Q_UNUSED(index); Q_UNUSED(url); return false; @@ -100,7 +101,7 @@ class LibraryFeature : public QObject { Q_UNUSED(globalPos); } // called when you right click on a child item, e.g., a concrete playlist or crate - virtual void onRightClickChild(const QPoint& globalPos, QModelIndex index) { + virtual void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) { Q_UNUSED(globalPos); Q_UNUSED(index); } @@ -113,7 +114,7 @@ class LibraryFeature : public QObject { void showTrackModel(QAbstractItemModel* model); void switchToView(const QString& view); void loadTrack(TrackPointer pTrack); - void loadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); + void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play = false); void restoreSearch(const QString&); void disableSearch(); // emit this signal before you parse a large music collection, e.g., iTunes, Traktor. diff --git a/src/library/libraryview.h b/src/library/libraryview.h index 21b20228fe8..3b6ab8897b0 100644 --- a/src/library/libraryview.h +++ b/src/library/libraryview.h @@ -30,7 +30,7 @@ class LibraryView { /// If applicable, requests that the LibraryView load the selected track to /// the specified group. Does nothing otherwise. - virtual void loadSelectedTrackToGroup(QString group, bool play) { + virtual void loadSelectedTrackToGroup(const QString& group, bool play) { Q_UNUSED(group); Q_UNUSED(play); } diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index 6fafa065286..5e20198ab02 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -167,7 +167,7 @@ void MixxxLibraryFeature::activateChild(const QModelIndex& index) { emit enableCoverArtDisplay(true); } -bool MixxxLibraryFeature::dropAccept(QList urls, QObject* pSource) { +bool MixxxLibraryFeature::dropAccept(const QList& urls, QObject* pSource) { if (pSource) { return false; } else { @@ -177,7 +177,7 @@ bool MixxxLibraryFeature::dropAccept(QList urls, QObject* pSource) { } } -bool MixxxLibraryFeature::dragMoveAccept(QUrl url) { +bool MixxxLibraryFeature::dragMoveAccept(const QUrl& url) { return SoundSourceProxy::isUrlSupported(url) || Parser::isPlaylistFilenameSupported(url.toLocalFile()); } diff --git a/src/library/mixxxlibraryfeature.h b/src/library/mixxxlibraryfeature.h index 3dd70bbb7bb..d30dd0c54eb 100644 --- a/src/library/mixxxlibraryfeature.h +++ b/src/library/mixxxlibraryfeature.h @@ -34,8 +34,8 @@ class MixxxLibraryFeature final : public LibraryFeature { QVariant title() override; QIcon getIcon() override; - bool dropAccept(QList urls, QObject* pSource) override; - bool dragMoveAccept(QUrl url) override; + bool dropAccept(const QList& urls, QObject* pSource) override; + bool dragMoveAccept(const QUrl& url) override; TreeItemModel* getChildModel() override; void bindLibraryWidget(WLibrary* pLibrary, KeyboardEventFilter* pKeyboard) override; diff --git a/src/library/parser.cpp b/src/library/parser.cpp index 0a32345f730..f89dd394523 100644 --- a/src/library/parser.cpp +++ b/src/library/parser.cpp @@ -38,7 +38,7 @@ long Parser::countParsed() { return (long)m_sLocations.count(); } -bool Parser::isBinary(QString filename) { +bool Parser::isBinary(const QString& filename) { char firstByte; QFile file(filename); if (file.open(QIODevice::ReadOnly) && file.getChar(&firstByte)) { diff --git a/src/library/parser.h b/src/library/parser.h index 28e565dd2a5..53e617e497a 100644 --- a/src/library/parser.h +++ b/src/library/parser.h @@ -42,10 +42,9 @@ class Parser : public QObject { Note for developers: This function should return an empty PtrList or 0 in order for the trackimporter to function**/ - virtual QList parse(QString) = 0; + virtual QList parse(const QString&) = 0; - -protected: + protected: // Pointer to the parsed Filelocations QList m_sLocations; // Returns the number of parsed locations @@ -53,7 +52,7 @@ class Parser : public QObject { // Clears m_psLocations void clearLocations(); // Checks if the file does contain binary content - bool isBinary(QString); + bool isBinary(const QString&); // check for Utf8 encoding static bool isUtf8(const char* string); // Resolve an absolute or relative file path diff --git a/src/library/parsercsv.cpp b/src/library/parsercsv.cpp index f26ea330151..9e237bcbfde 100644 --- a/src/library/parsercsv.cpp +++ b/src/library/parsercsv.cpp @@ -25,7 +25,7 @@ ParserCsv::ParserCsv() : Parser() { ParserCsv::~ParserCsv() { } -QList ParserCsv::parse(QString sFilename) { +QList ParserCsv::parse(const QString& sFilename) { QFile file(sFilename); QString basepath = sFilename.section('/', 0, -2); diff --git a/src/library/parsercsv.h b/src/library/parsercsv.h index 57f92a5f6c9..ee15981292c 100644 --- a/src/library/parsercsv.h +++ b/src/library/parsercsv.h @@ -28,7 +28,7 @@ class ParserCsv : public Parser ParserCsv(); virtual ~ParserCsv(); /**Overwriting function parse in class Parser**/ - QList parse(QString); + QList parse(const QString&); // Playlist Export static bool writeCSVFile(const QString &file, BaseSqlTableModel* pPlaylistTableModel, bool useRelativePath); // Readable Text export diff --git a/src/library/parserm3u.cpp b/src/library/parserm3u.cpp index 3436829fa55..fbd5dbc6056 100644 --- a/src/library/parserm3u.cpp +++ b/src/library/parserm3u.cpp @@ -47,8 +47,7 @@ ParserM3u::~ParserM3u() } -QList ParserM3u::parse(QString sFilename) -{ +QList ParserM3u::parse(const QString& sFilename) { clearLocations(); QFile file(sFilename); diff --git a/src/library/parserm3u.h b/src/library/parserm3u.h index e958a816197..1ff21494719 100644 --- a/src/library/parserm3u.h +++ b/src/library/parserm3u.h @@ -27,7 +27,7 @@ class ParserM3u : public Parser ParserM3u(); ~ParserM3u(); /**Overwriting function parse in class Parser**/ - QList parse(QString); + QList parse(const QString&); //Playlist Export static bool writeM3UFile(const QString &file_str, const QList &items, bool useRelativePath, bool useUtf8); static bool writeM3UFile(const QString &file, const QList &items, bool useRelativePath); diff --git a/src/library/parserpls.cpp b/src/library/parserpls.cpp index 05263a07d0d..e224aec67be 100644 --- a/src/library/parserpls.cpp +++ b/src/library/parserpls.cpp @@ -34,7 +34,7 @@ ParserPls::ParserPls() : Parser() { ParserPls::~ParserPls() { } -QList ParserPls::parse(QString sFilename) { +QList ParserPls::parse(const QString& sFilename) { //long numEntries =0; QFile file(sFilename); const auto basePath = sFilename.section('/', 0, -2); diff --git a/src/library/parserpls.h b/src/library/parserpls.h index 07720fa7897..4f8ba7cbce6 100644 --- a/src/library/parserpls.h +++ b/src/library/parserpls.h @@ -24,7 +24,7 @@ class ParserPls : public Parser { ParserPls(); virtual ~ParserPls(); /**Can be called to parse a pls file**/ - QList parse(QString); + QList parse(const QString&); //Playlist Export static bool writePLSFile(const QString &file, const QList &items, bool useRelativePath); diff --git a/src/library/playlistfeature.cpp b/src/library/playlistfeature.cpp index 6afa1810d0b..f9ba23e0bb5 100644 --- a/src/library/playlistfeature.cpp +++ b/src/library/playlistfeature.cpp @@ -23,7 +23,7 @@ namespace { QString createPlaylistLabel( - QString name, + const QString& name, int count, int duration) { return QString("%1 (%2) %3").arg(name, QString::number(count), mixxx::Duration::formatTime(duration, mixxx::Duration::Precision::SECONDS)); @@ -74,7 +74,7 @@ void PlaylistFeature::onRightClick(const QPoint& globalPos) { menu.exec(globalPos); } -void PlaylistFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { +void PlaylistFeature::onRightClickChild(const QPoint& globalPos, const QModelIndex& index) { //Save the model index so we can get it in the action slots... m_lastRightClickedIndex = index; int playlistId = playlistIdFromIndex(index); @@ -105,7 +105,8 @@ void PlaylistFeature::onRightClickChild(const QPoint& globalPos, QModelIndex ind menu.exec(globalPos); } -bool PlaylistFeature::dropAcceptChild(const QModelIndex& index, QList urls, QObject* pSource) { +bool PlaylistFeature::dropAcceptChild( + const QModelIndex& index, const QList& urls, QObject* pSource) { int playlistId = playlistIdFromIndex(index); VERIFY_OR_DEBUG_ASSERT(playlistId >= 0) { return false; @@ -125,7 +126,7 @@ bool PlaylistFeature::dropAcceptChild(const QModelIndex& index, QList urls return m_playlistDao.appendTracksToPlaylist(trackIds, playlistId); } -bool PlaylistFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) { +bool PlaylistFeature::dragMoveAcceptChild(const QModelIndex& index, const QUrl& url) { int playlistId = playlistIdFromIndex(index); bool locked = m_playlistDao.isPlaylistLocked(playlistId); @@ -254,7 +255,7 @@ void PlaylistFeature::slotPlaylistContentChanged(QSet playlistIds) { void PlaylistFeature::slotPlaylistTableRenamed( int playlistId, - QString newName) { + const QString& newName) { Q_UNUSED(newName); //qDebug() << "slotPlaylistTableChanged() playlistId:" << playlistId; enum PlaylistDAO::HiddenType type = m_playlistDao.getHiddenType(playlistId); diff --git a/src/library/playlistfeature.h b/src/library/playlistfeature.h index 7a4bff14a96..e9113ca17e5 100644 --- a/src/library/playlistfeature.h +++ b/src/library/playlistfeature.h @@ -28,17 +28,19 @@ class PlaylistFeature : public BasePlaylistFeature { void bindSidebarWidget(WLibrarySidebar* pSidebarWidget) override; - bool dropAcceptChild(const QModelIndex& index, QList urls, QObject* pSource) override; - bool dragMoveAcceptChild(const QModelIndex& index, QUrl url) override; + bool dropAcceptChild(const QModelIndex& index, + const QList& urls, + QObject* pSource) override; + bool dragMoveAcceptChild(const QModelIndex& index, const QUrl& url) override; public slots: void onRightClick(const QPoint& globalPos) override; - void onRightClickChild(const QPoint& globalPos, QModelIndex index) override; + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; private slots: void slotPlaylistTableChanged(int playlistId) override; void slotPlaylistContentChanged(QSet playlistIds) override; - void slotPlaylistTableRenamed(int playlistId, QString newName) override; + void slotPlaylistTableRenamed(int playlistId, const QString& newName) override; protected: QList createPlaylistLabels() override; diff --git a/src/library/playlisttablemodel.cpp b/src/library/playlisttablemodel.cpp index 23fcc42df0a..624689ff985 100644 --- a/src/library/playlisttablemodel.cpp +++ b/src/library/playlisttablemodel.cpp @@ -351,7 +351,7 @@ TrackModel::CapabilitiesFlags PlaylistTableModel::getCapabilities() const { return caps; } -void PlaylistTableModel::playlistsChanged(QSet playlistIds) { +void PlaylistTableModel::playlistsChanged(const QSet& playlistIds) { if (playlistIds.contains(m_iPlaylistId)) { select(); // Repopulate the data model. } diff --git a/src/library/playlisttablemodel.h b/src/library/playlisttablemodel.h index f2b405702fb..58821dc2a50 100644 --- a/src/library/playlisttablemodel.h +++ b/src/library/playlisttablemodel.h @@ -32,7 +32,7 @@ class PlaylistTableModel final : public BaseSqlTableModel { CapabilitiesFlags getCapabilities() const final; private slots: - void playlistsChanged(QSet playlistIds); + void playlistsChanged(const QSet& playlistIds); private: void initSortColumnMapping() override; diff --git a/src/library/proxytrackmodel.cpp b/src/library/proxytrackmodel.cpp index fbd37bdd3e2..03136d34560 100644 --- a/src/library/proxytrackmodel.cpp +++ b/src/library/proxytrackmodel.cpp @@ -148,14 +148,14 @@ bool ProxyTrackModel::filterAcceptsRow(int sourceRow, return rowMatches; } -QString ProxyTrackModel::getModelSetting(QString name) { +QString ProxyTrackModel::getModelSetting(const QString& name) { if (m_pTrackModel == NULL) { return QString(); } return m_pTrackModel->getModelSetting(name); } -bool ProxyTrackModel::setModelSetting(QString name, QVariant value) { +bool ProxyTrackModel::setModelSetting(const QString& name, const QVariant& value) { if (m_pTrackModel == NULL) { return false; } diff --git a/src/library/proxytrackmodel.h b/src/library/proxytrackmodel.h index e7044ca3e61..1a33941fcb1 100644 --- a/src/library/proxytrackmodel.h +++ b/src/library/proxytrackmodel.h @@ -36,8 +36,8 @@ class ProxyTrackModel : public QSortFilterProxyModel, public TrackModel { void removeTracks(const QModelIndexList& indices) final; void moveTrack(const QModelIndex& sourceIndex, const QModelIndex& destIndex) final; QAbstractItemDelegate* delegateForColumn(const int i, QObject* pParent) final; - QString getModelSetting(QString name) final; - bool setModelSetting(QString name, QVariant value) final; + QString getModelSetting(const QString& name) final; + bool setModelSetting(const QString& name, const QVariant& value) final; TrackModel::SortColumnId sortColumnIdFromColumnIndex(int index) override; int columnIndexFromSortColumnId(TrackModel::SortColumnId sortColumn) override; diff --git a/src/library/recording/dlgrecording.cpp b/src/library/recording/dlgrecording.cpp index 03d8f9d64bd..de87a0ebfff 100644 --- a/src/library/recording/dlgrecording.cpp +++ b/src/library/recording/dlgrecording.cpp @@ -139,7 +139,7 @@ void DlgRecording::slotAddToAutoDJReplace() { m_pTrackTableView->slotAddToAutoDJReplace(); } -void DlgRecording::loadSelectedTrackToGroup(QString group, bool play) { +void DlgRecording::loadSelectedTrackToGroup(const QString& group, bool play) { m_pTrackTableView->loadSelectedTrackToGroup(group, play); } @@ -178,7 +178,7 @@ void DlgRecording::slotBytesRecorded(int bytes) { } // gets recorded duration and update label -void DlgRecording::slotDurationRecorded(QString durationRecorded) { +void DlgRecording::slotDurationRecorded(const QString& durationRecorded) { m_durationRecordedStr = durationRecorded; refreshLabels(); } diff --git a/src/library/recording/dlgrecording.h b/src/library/recording/dlgrecording.h index d6b38187715..226d977c23d 100644 --- a/src/library/recording/dlgrecording.h +++ b/src/library/recording/dlgrecording.h @@ -30,7 +30,7 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib void slotAddToAutoDJBottom() override; void slotAddToAutoDJTop() override; void slotAddToAutoDJReplace() override; - void loadSelectedTrackToGroup(QString group, bool play) override; + void loadSelectedTrackToGroup(const QString& group, bool play) override; void moveSelection(int delta) override; inline const QString currentSearch() { return m_proxyModel.currentSearch(); } @@ -39,12 +39,12 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib void slotBytesRecorded(int); void refreshBrowseModel(); void slotRestoreSearch(); - void slotDurationRecorded(QString durationRecorded); + void slotDurationRecorded(const QString& durationRecorded); signals: void loadTrack(TrackPointer tio); - void loadTrackToPlayer(TrackPointer tio, QString group, bool play); - void restoreSearch(QString search); + void loadTrackToPlayer(TrackPointer tio, const QString& group, bool play); + void restoreSearch(const QString& search); private: UserSettingsPointer m_pConfig; diff --git a/src/library/rekordbox/rekordboxfeature.cpp b/src/library/rekordbox/rekordboxfeature.cpp index 7de8b7d1274..16d47a65c8b 100644 --- a/src/library/rekordbox/rekordboxfeature.cpp +++ b/src/library/rekordbox/rekordboxfeature.cpp @@ -149,7 +149,7 @@ bool createPlaylistTracksTable(QSqlDatabase& database, const QString& tableName) return true; } -bool dropTable(QSqlDatabase& database, QString tableName) { +bool dropTable(QSqlDatabase& database, const QString& tableName) { qDebug() << "Dropping Rekordbox table: " << tableName; QSqlQuery query(database); @@ -257,7 +257,7 @@ inline bool instanceof (const T* ptr) { return dynamic_cast(ptr) != nullptr; } -QString toUnicode(std::string toConvert) { +QString toUnicode(const std::string& toConvert) { return QTextCodec::codecForName("UTF-16BE")->toUnicode(QByteArray(toConvert.c_str(), toConvert.length())); } @@ -287,7 +287,7 @@ QString getText(rekordbox_pdb_t::device_sql_string_t* deviceString) { return text.remove(QChar('\x0')); } -int createDevicePlaylist(QSqlDatabase& database, QString devicePath) { +int createDevicePlaylist(QSqlDatabase& database, const QString& devicePath) { int playlistID = -1; QSqlQuery queryInsertIntoDevicePlaylist(database); @@ -352,8 +352,8 @@ void insertTrack( QMap& albumsMap, QMap& genresMap, QMap& keysMap, - QString devicePath, - QString device, + const QString& devicePath, + const QString& device, int audioFilesCount) { int rbID = static_cast(track->id()); QString title = getText(track->title()); @@ -427,8 +427,8 @@ void buildPlaylistTree( QMap& playlistIsFolderMap, QMap>& playlistTreeMap, QMap>& playlistTrackMap, - QString playlistPath, - QString device); + const QString& playlistPath, + const QString& device); QString parseDeviceDB(mixxx::DbConnectionPoolPtr dbConnectionPool, TreeItem* deviceItem) { QString device = deviceItem->getLabel(); @@ -628,8 +628,8 @@ void buildPlaylistTree( QMap& playlistIsFolderMap, QMap>& playlistTreeMap, QMap>& playlistTrackMap, - QString playlistPath, - QString device) { + const QString& playlistPath, + const QString& device) { for (uint32_t childIndex = 0; childIndex < (uint32_t)playlistTreeMap[parentID].size(); childIndex++) { uint32_t childID = playlistTreeMap[parentID][childIndex]; QString playlistItemName = playlistNameMap[childID]; @@ -786,7 +786,12 @@ void clearDeviceTables(QSqlDatabase& database, TreeItem* child) { transaction.commit(); } -void setHotCue(TrackPointer track, double startPosition, double endPosition, int id, QString label, mixxx::RgbColor::optional_t color) { +void setHotCue(TrackPointer track, + double startPosition, + double endPosition, + int id, + const QString& label, + mixxx::RgbColor::optional_t color) { CuePointer pCue; bool hotCueFound = false; @@ -817,7 +822,11 @@ void setHotCue(TrackPointer track, double startPosition, double endPosition, int } } -void readAnalyze(TrackPointer track, double sampleRate, int timingOffset, bool ignoreCues, QString anlzPath) { +void readAnalyze(TrackPointer track, + double sampleRate, + int timingOffset, + bool ignoreCues, + const QString& anlzPath) { if (!QFile(anlzPath).exists()) { return; } @@ -1314,7 +1323,7 @@ void RekordboxFeature::htmlLinkClicked(const QUrl& link) { } } -BaseSqlTableModel* RekordboxFeature::getPlaylistModelForPlaylist(QString playlist) { +BaseSqlTableModel* RekordboxFeature::getPlaylistModelForPlaylist(const QString& playlist) { RekordboxPlaylistModel* model = new RekordboxPlaylistModel(this, m_pLibrary->trackCollections(), m_trackSource); model->setPlaylist(playlist); return model; diff --git a/src/library/rekordbox/rekordboxfeature.h b/src/library/rekordbox/rekordboxfeature.h index 56829f69390..8f41aa22710 100644 --- a/src/library/rekordbox/rekordboxfeature.h +++ b/src/library/rekordbox/rekordboxfeature.h @@ -82,7 +82,7 @@ class RekordboxFeature : public BaseExternalLibraryFeature { private: QString formatRootViewHtml() const; - BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist) override; + BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) override; TreeItemModel m_childModel; RekordboxPlaylistModel* m_pRekordboxPlaylistModel; diff --git a/src/library/rhythmbox/rhythmboxfeature.cpp b/src/library/rhythmbox/rhythmboxfeature.cpp index 2277843b5cb..3ae7f61ba03 100644 --- a/src/library/rhythmbox/rhythmboxfeature.cpp +++ b/src/library/rhythmbox/rhythmboxfeature.cpp @@ -84,7 +84,7 @@ RhythmboxFeature::~RhythmboxFeature() { delete m_pRhythmboxPlaylistModel; } -BaseSqlTableModel* RhythmboxFeature::getPlaylistModelForPlaylist(QString playlist) { +BaseSqlTableModel* RhythmboxFeature::getPlaylistModelForPlaylist(const QString& playlist) { BaseExternalPlaylistModel* pModel = new BaseExternalPlaylistModel( this, m_pLibrary->trackCollections(), "mixxx.db.model.rhythmbox_playlist", @@ -406,7 +406,7 @@ void RhythmboxFeature::importPlaylist(QXmlStreamReader &xml, } } -void RhythmboxFeature::clearTable(QString table_name) { +void RhythmboxFeature::clearTable(const QString& table_name) { qDebug() << "clearTable Thread Id: " << QThread::currentThread(); QSqlQuery query(m_database); query.prepare("delete from "+table_name); diff --git a/src/library/rhythmbox/rhythmboxfeature.h b/src/library/rhythmbox/rhythmboxfeature.h index 94b9b3dfbe2..40607659a33 100644 --- a/src/library/rhythmbox/rhythmboxfeature.h +++ b/src/library/rhythmbox/rhythmboxfeature.h @@ -40,9 +40,9 @@ class RhythmboxFeature : public BaseExternalLibraryFeature { void onTrackCollectionLoaded(); private: - virtual BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist); + virtual BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist); // Removes all rows from a given table - void clearTable(QString table_name); + void clearTable(const QString& table_name); // reads the properties of a track and executes a SQL statement void importTrack(QXmlStreamReader &xml, QSqlQuery &query); // reads all playlist entries and executes a SQL statement diff --git a/src/library/scanner/libraryscanner.h b/src/library/scanner/libraryscanner.h index ad190a8db13..8bda84b91cb 100644 --- a/src/library/scanner/libraryscanner.h +++ b/src/library/scanner/libraryscanner.h @@ -44,12 +44,12 @@ class LibraryScanner : public QThread { signals: void scanStarted(); void scanFinished(); - void progressHashing(QString); - void progressLoading(QString path); - void progressCoverArt(QString file); + void progressHashing(const QString&); + void progressLoading(const QString& path); + void progressCoverArt(const QString& file); void trackAdded(TrackPointer pTrack); - void tracksChanged(QSet changedTrackIds); - void tracksRelocated(QList relocatedTracks); + void tracksChanged(const QSet& changedTrackIds); + void tracksRelocated(const QList& relocatedTracks); // Emitted by scan() to invoke slotStartScan in the scanner thread's event // loop. diff --git a/src/library/scanner/libraryscannerdlg.cpp b/src/library/scanner/libraryscannerdlg.cpp index 42a690b07ac..ff1ee8ec12b 100644 --- a/src/library/scanner/libraryscannerdlg.cpp +++ b/src/library/scanner/libraryscannerdlg.cpp @@ -54,7 +54,7 @@ LibraryScannerDlg::LibraryScannerDlg(QWidget* parent, Qt::WindowFlags f) LibraryScannerDlg::~LibraryScannerDlg() { } -void LibraryScannerDlg::slotUpdate(QString path) { +void LibraryScannerDlg::slotUpdate(const QString& path) { //qDebug() << "LibraryScannerDlg slotUpdate" << m_timer.elapsed().formatMillisWithUnit() << path; if (!m_bCancelled && m_timer.elapsed() > mixxx::Duration::fromSeconds(2)) { setVisible(true); @@ -66,7 +66,7 @@ void LibraryScannerDlg::slotUpdate(QString path) { } } -void LibraryScannerDlg::slotUpdateCover(QString path) { +void LibraryScannerDlg::slotUpdateCover(const QString& path) { //qDebug() << "LibraryScannerDlg slotUpdate" << m_timer.elapsed() << path; if (!m_bCancelled && m_timer.elapsed() > mixxx::Duration::fromSeconds(2)) { setVisible(true); diff --git a/src/library/scanner/libraryscannerdlg.h b/src/library/scanner/libraryscannerdlg.h index 4d43e7dd7a1..3db2b6d1a40 100644 --- a/src/library/scanner/libraryscannerdlg.h +++ b/src/library/scanner/libraryscannerdlg.h @@ -32,15 +32,15 @@ class LibraryScannerDlg : public QWidget { virtual ~LibraryScannerDlg(); public slots: - void slotUpdate(QString path); - void slotUpdateCover(QString path); + void slotUpdate(const QString& path); + void slotUpdateCover(const QString& path); void slotCancel(); void slotScanFinished(); void slotScanStarted(); signals: void scanCancelled(); - void progress(QString); + void progress(const QString&); private: PerformanceTimer m_timer; diff --git a/src/library/serato/seratofeature.cpp b/src/library/serato/seratofeature.cpp index c9a005ef30c..63688d1e1ec 100644 --- a/src/library/serato/seratofeature.cpp +++ b/src/library/serato/seratofeature.cpp @@ -832,7 +832,7 @@ bool createPlaylistTracksTable(QSqlDatabase& database, const QString& tableName) return true; } -bool dropTable(QSqlDatabase& database, QString tableName) { +bool dropTable(QSqlDatabase& database, const QString& tableName) { qDebug() << "Dropping Serato table: " << tableName; QSqlQuery query(database); @@ -952,7 +952,7 @@ void SeratoFeature::htmlLinkClicked(const QUrl& link) { } } -BaseSqlTableModel* SeratoFeature::getPlaylistModelForPlaylist(QString playlist) { +BaseSqlTableModel* SeratoFeature::getPlaylistModelForPlaylist(const QString& playlist) { SeratoPlaylistModel* model = new SeratoPlaylistModel(this, m_pLibrary->trackCollections(), m_trackSource); model->setPlaylist(playlist); return model; diff --git a/src/library/serato/seratofeature.h b/src/library/serato/seratofeature.h index c917b07a65d..515add942e8 100644 --- a/src/library/serato/seratofeature.h +++ b/src/library/serato/seratofeature.h @@ -48,7 +48,7 @@ class SeratoFeature : public BaseExternalLibraryFeature { private: QString formatRootViewHtml() const; - BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist) override; + BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) override; TreeItemModel m_childModel; SeratoPlaylistModel* m_pSeratoPlaylistModel; diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp index 2b046806bb0..e7c38b1afc3 100644 --- a/src/library/setlogfeature.cpp +++ b/src/library/setlogfeature.cpp @@ -98,7 +98,7 @@ void SetlogFeature::onRightClick(const QPoint& globalPos) { // menu.exec(globalPos); } -void SetlogFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) { +void SetlogFeature::onRightClickChild(const QPoint& globalPos, const QModelIndex& index) { //Save the model index so we can get it in the action slots... m_lastRightClickedIndex = index; @@ -371,7 +371,7 @@ void SetlogFeature::slotPlaylistContentChanged(QSet playlistIds) { void SetlogFeature::slotPlaylistTableRenamed( int playlistId, - QString newName) { + const QString& newName) { Q_UNUSED(newName); //qDebug() << "slotPlaylistTableRenamed() playlistId:" << playlistId; enum PlaylistDAO::HiddenType type = m_playlistDao.getHiddenType(playlistId); diff --git a/src/library/setlogfeature.h b/src/library/setlogfeature.h index 7f432759fef..6b5d3396222 100644 --- a/src/library/setlogfeature.h +++ b/src/library/setlogfeature.h @@ -23,7 +23,7 @@ class SetlogFeature : public BasePlaylistFeature { public slots: void onRightClick(const QPoint& globalPos) override; - void onRightClickChild(const QPoint& globalPos, QModelIndex index) override; + void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; void slotJoinWithPrevious(); void slotGetNewPlaylist(); @@ -36,7 +36,7 @@ class SetlogFeature : public BasePlaylistFeature { void slotPlayingTrackChanged(TrackPointer currentPlayingTrack); void slotPlaylistTableChanged(int playlistId) override; void slotPlaylistContentChanged(QSet playlistIds) override; - void slotPlaylistTableRenamed(int playlistId, QString newName) override; + void slotPlaylistTableRenamed(int playlistId, const QString& newName) override; private: void reloadChildModel(int playlistId); diff --git a/src/library/sidebarmodel.cpp b/src/library/sidebarmodel.cpp index 3b2ec478e27..697a6a30a24 100644 --- a/src/library/sidebarmodel.cpp +++ b/src/library/sidebarmodel.cpp @@ -253,7 +253,7 @@ QVariant SidebarModel::data(const QModelIndex& index, int role) const { return QVariant(); } -void SidebarModel::startPressedUntilClickedTimer(QModelIndex pressedIndex) { +void SidebarModel::startPressedUntilClickedTimer(const QModelIndex& pressedIndex) { m_pressedIndex = pressedIndex; m_pressedUntilClickedTimer->start(kPressedUntilClickedTimeoutMillis); } @@ -330,8 +330,7 @@ void SidebarModel::rightClicked(const QPoint& globalPos, const QModelIndex& inde } } -bool SidebarModel::dropAccept(const QModelIndex& index, QList urls, - QObject* pSource) { +bool SidebarModel::dropAccept(const QModelIndex& index, const QList& urls, QObject* pSource) { //qDebug() << "SidebarModel::dropAccept() index=" << index << url; bool result = false; if (index.isValid()) { @@ -355,8 +354,7 @@ bool SidebarModel::hasTrackTable(const QModelIndex& index) const { return false; } - -bool SidebarModel::dragMoveAccept(const QModelIndex& index, QUrl url) { +bool SidebarModel::dragMoveAccept(const QModelIndex& index, const QUrl& url) { //qDebug() << "SidebarModel::dragMoveAccept() index=" << index << url; bool result = false; diff --git a/src/library/sidebarmodel.h b/src/library/sidebarmodel.h index 84e89d5cd46..807e893200c 100644 --- a/src/library/sidebarmodel.h +++ b/src/library/sidebarmodel.h @@ -36,8 +36,8 @@ class SidebarModel : public QAbstractItemModel { int columnCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - bool dropAccept(const QModelIndex& index, QList urls, QObject* pSource); - bool dragMoveAccept(const QModelIndex& index, QUrl url); + bool dropAccept(const QModelIndex& index, const QList& urls, QObject* pSource); + bool dragMoveAccept(const QModelIndex& index, const QUrl& url); bool hasChildren(const QModelIndex& parent = QModelIndex()) const override; bool hasTrackTable(const QModelIndex& index) const; @@ -83,7 +83,7 @@ class SidebarModel : public QAbstractItemModel { QTimer* const m_pressedUntilClickedTimer; QModelIndex m_pressedIndex; - void startPressedUntilClickedTimer(QModelIndex pressedIndex); + void startPressedUntilClickedTimer(const QModelIndex& pressedIndex); void stopPressedUntilClickedTimer(); }; diff --git a/src/library/trackcollection.cpp b/src/library/trackcollection.cpp index eab68593325..18cf5c2d0d8 100644 --- a/src/library/trackcollection.cpp +++ b/src/library/trackcollection.cpp @@ -63,14 +63,14 @@ TrackCollection::~TrackCollection() { DEBUG_ASSERT(!m_database.isOpen()); } -void TrackCollection::repairDatabase(QSqlDatabase database) { +void TrackCollection::repairDatabase(const QSqlDatabase& database) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); kLogger.info() << "Repairing database"; m_crates.repairDatabase(database); } -void TrackCollection::connectDatabase(QSqlDatabase database) { +void TrackCollection::connectDatabase(const QSqlDatabase& database) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); kLogger.info() << "Connecting database"; @@ -174,7 +174,7 @@ bool TrackCollection::removeDirectory(const QString& dir) { return false; } -void TrackCollection::relocateDirectory(QString oldDir, QString newDir) { +void TrackCollection::relocateDirectory(const QString& oldDir, const QString& newDir) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); // We only call this method if the user has picked a relocated directory via diff --git a/src/library/trackcollection.h b/src/library/trackcollection.h index 4e8af126ac5..2e5a78ab2bb 100644 --- a/src/library/trackcollection.h +++ b/src/library/trackcollection.h @@ -30,10 +30,10 @@ class TrackCollection : public QObject, ~TrackCollection() override; void repairDatabase( - QSqlDatabase database) override; + const QSqlDatabase& database) override; void connectDatabase( - QSqlDatabase database) override; + const QSqlDatabase& database) override; void disconnectDatabase() override; QSqlDatabase database() const { @@ -113,9 +113,9 @@ class TrackCollection : public QObject, // Forwarded signals from TrackDAO void trackClean(TrackId trackId); void trackDirty(TrackId trackId); - void tracksAdded(QSet trackIds); - void tracksChanged(QSet trackIds); - void tracksRemoved(QSet trackIds); + void tracksAdded(const QSet& trackIds); + void tracksChanged(const QSet& trackIds); + void tracksRemoved(const QSet& trackIds); void multipleTracksChanged(); void crateInserted(CrateId id); @@ -147,7 +147,7 @@ class TrackCollection : public QObject, bool addDirectory(const QString& dir); bool removeDirectory(const QString& dir); - void relocateDirectory(QString oldDir, QString newDir); + void relocateDirectory(const QString& oldDir, const QString& newDir); void saveTrack(Track* pTrack); diff --git a/src/library/trackloader.cpp b/src/library/trackloader.cpp index 18440104816..65f8c88afc0 100644 --- a/src/library/trackloader.cpp +++ b/src/library/trackloader.cpp @@ -37,7 +37,7 @@ TrackLoader::TrackLoader( } void TrackLoader::invokeSlotLoadTrack( - TrackRef trackRef, + const TrackRef& trackRef, Qt::ConnectionType connectionType) { DEBUG_ASSERT(connectionType == (connectionType & ~Qt::UniqueConnection)); DEBUG_ASSERT((thread() == QThread::currentThread()) || @@ -59,7 +59,7 @@ void TrackLoader::invokeSlotLoadTrack( } void TrackLoader::slotLoadTrack( - TrackRef trackRef) { + const TrackRef& trackRef) { VERIFY_OR_DEBUG_ASSERT(m_trackCollectionManager) { kLogger.warning() << "Track collection manager not accessible"; diff --git a/src/library/trackloader.h b/src/library/trackloader.h index b068d7ef5d7..d3eebc52a63 100644 --- a/src/library/trackloader.h +++ b/src/library/trackloader.h @@ -24,7 +24,7 @@ class TrackLoader: public QObject { // Explicit, thread-safe invocation of the corresponding slot. void invokeSlotLoadTrack( - TrackRef trackRef, + const TrackRef& trackRef, Qt::ConnectionType connectionType = Qt::AutoConnection); public slots: @@ -35,7 +35,7 @@ class TrackLoader: public QObject { // The result of this operation is propagated by the corresponding // signal. void slotLoadTrack( - TrackRef trackRef); + const TrackRef& trackRef); signals: // A nullptr indicates failure to load the track. Receivers need to @@ -43,7 +43,7 @@ class TrackLoader: public QObject { // corresponding slot is invoked by multiple signal senders or // from different clients! void trackLoaded( - TrackRef trackRef, + const TrackRef& trackRef, TrackPointer trackPtr); private: diff --git a/src/library/trackmodel.h b/src/library/trackmodel.h index c714b9c953f..f51515ca706 100644 --- a/src/library/trackmodel.h +++ b/src/library/trackmodel.h @@ -17,8 +17,8 @@ class TrackModel { static const int kHeaderWidthRole = Qt::UserRole + 0; static const int kHeaderNameRole = Qt::UserRole + 1; - TrackModel(QSqlDatabase db, - const char* settingsNamespace) + TrackModel(const QSqlDatabase& db, + const char* settingsNamespace) : m_db(db), m_settingsNamespace(settingsNamespace), m_iDefaultSortColumn(-1), @@ -159,13 +159,13 @@ class TrackModel { /*non-virtual*/ bool hasCapabilities(TrackModel::CapabilitiesFlags caps) const { return (getCapabilities() & caps) == caps; } - virtual QString getModelSetting(QString name) { + virtual QString getModelSetting(const QString& name) { SettingsDAO settings(m_db); QString key = m_settingsNamespace + "." + name; return settings.getValue(key); } - virtual bool setModelSetting(QString name, QVariant value) { + virtual bool setModelSetting(const QString& name, const QVariant& value) { SettingsDAO settings(m_db); QString key = m_settingsNamespace + "." + name; return settings.setValue(key, value); diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp index 4af74f8107e..29bad73e25c 100644 --- a/src/library/traktor/traktorfeature.cpp +++ b/src/library/traktor/traktorfeature.cpp @@ -124,7 +124,7 @@ TraktorFeature::~TraktorFeature() { delete m_pTraktorPlaylistModel; } -BaseSqlTableModel* TraktorFeature::getPlaylistModelForPlaylist(QString playlist) { +BaseSqlTableModel* TraktorFeature::getPlaylistModelForPlaylist(const QString& playlist) { TraktorPlaylistModel* pModel = new TraktorPlaylistModel(this, m_pLibrary->trackCollections(), m_trackSource); pModel->setPlaylist(playlist); return pModel; @@ -182,7 +182,7 @@ void TraktorFeature::activateChild(const QModelIndex& index) { } } -TreeItem* TraktorFeature::importLibrary(QString file) { +TreeItem* TraktorFeature::importLibrary(const QString& file) { //Give thread a low priority QThread* thisThread = QThread::currentThread(); thisThread->setPriority(QThread::LowPriority); @@ -456,8 +456,8 @@ TreeItem* TraktorFeature::parsePlaylists(QXmlStreamReader &xml) { } void TraktorFeature::parsePlaylistEntries( - QXmlStreamReader &xml, - QString playlist_path, + QXmlStreamReader& xml, + const QString& playlist_path, QSqlQuery query_insert_into_playlist, QSqlQuery query_insert_into_playlisttracks) { // In the database, the name of a playlist is specified by the unique path, @@ -539,7 +539,7 @@ void TraktorFeature::parsePlaylistEntries( } } -void TraktorFeature::clearTable(QString table_name) { +void TraktorFeature::clearTable(const QString& table_name) { QSqlQuery query(m_database); query.prepare("delete from "+table_name); diff --git a/src/library/traktor/traktorfeature.h b/src/library/traktor/traktorfeature.h index 8c0baccb349..79e5f9ae149 100644 --- a/src/library/traktor/traktorfeature.h +++ b/src/library/traktor/traktorfeature.h @@ -51,16 +51,18 @@ class TraktorFeature : public BaseExternalLibraryFeature { void onTrackCollectionLoaded(); private: - BaseSqlTableModel* getPlaylistModelForPlaylist(QString playlist) override; - TreeItem* importLibrary(QString file); + BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist) override; + TreeItem* importLibrary(const QString& file); // parses a track in the music collection void parseTrack(QXmlStreamReader &xml, QSqlQuery &query); // Iterates over all playliost and folders and constructs the childmodel TreeItem* parsePlaylists(QXmlStreamReader &xml); // processes a particular playlist - void parsePlaylistEntries(QXmlStreamReader &xml, QString playlist_path, - QSqlQuery query_insert_into_playlist, QSqlQuery query_insert_into_playlisttracks); - void clearTable(QString table_name); + void parsePlaylistEntries(QXmlStreamReader& xml, + const QString& playlist_path, + QSqlQuery query_insert_into_playlist, + QSqlQuery query_insert_into_playlisttracks); + void clearTable(const QString& table_name); static QString getTraktorMusicDatabase(); // private fields TreeItemModel m_childModel; diff --git a/src/mixer/baseplayer.cpp b/src/mixer/baseplayer.cpp index a775091e933..0b8948b81bf 100644 --- a/src/mixer/baseplayer.cpp +++ b/src/mixer/baseplayer.cpp @@ -1,6 +1,6 @@ #include "mixer/baseplayer.h" -BasePlayer::BasePlayer(QObject* pParent, QString group) +BasePlayer::BasePlayer(QObject* pParent, const QString& group) : QObject(pParent), m_group(group) { } diff --git a/src/mixer/baseplayer.h b/src/mixer/baseplayer.h index ec7505c857c..5d02d5fcd70 100644 --- a/src/mixer/baseplayer.h +++ b/src/mixer/baseplayer.h @@ -7,7 +7,7 @@ class BasePlayer : public QObject { Q_OBJECT public: - BasePlayer(QObject* pParent, QString group); + BasePlayer(QObject* pParent, const QString& group); ~BasePlayer() override = default; inline const QString& getGroup() { diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp index 3890c99b445..a8ee1e535cf 100644 --- a/src/mixer/basetrackplayer.cpp +++ b/src/mixer/basetrackplayer.cpp @@ -395,7 +395,7 @@ void BaseTrackPlayerImpl::slotLoadTrack(TrackPointer pNewTrack, bool bPlay) { emit loadingTrack(pNewTrack, pOldTrack); } -void BaseTrackPlayerImpl::slotLoadFailed(TrackPointer pTrack, QString reason) { +void BaseTrackPlayerImpl::slotLoadFailed(TrackPointer pTrack, const QString& reason) { // Note: This slot can be a load failure from the current track or a // a delayed signal from a previous load. // We have probably received a slotTrackLoaded signal, of an old track that diff --git a/src/mixer/basetrackplayer.h b/src/mixer/basetrackplayer.h index 05ce9ed6cd8..c843020ce0a 100644 --- a/src/mixer/basetrackplayer.h +++ b/src/mixer/basetrackplayer.h @@ -82,7 +82,7 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer { void slotCloneFromGroup(const QString& group) final; void slotCloneDeck() final; void slotTrackLoaded(TrackPointer pNewTrack, TrackPointer pOldTrack); - void slotLoadFailed(TrackPointer pTrack, QString reason); + void slotLoadFailed(TrackPointer pTrack, const QString& reason); void slotSetReplayGain(mixxx::ReplayGain replayGain); void slotSetTrackColor(mixxx::RgbColor::optional_t color); void slotPlayToggled(double); diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h index 68cef8d6361..7d6cb574c7b 100644 --- a/src/mixer/playerinfo.h +++ b/src/mixer/playerinfo.h @@ -42,18 +42,18 @@ class PlayerInfo : public QObject { signals: void currentPlayingDeckChanged(int deck); void currentPlayingTrackChanged(TrackPointer pTrack); - void trackLoaded(QString group, TrackPointer pTrack); - void trackUnloaded(QString group, TrackPointer pTrack); + void trackLoaded(const QString& group, TrackPointer pTrack); + void trackUnloaded(const QString& group, TrackPointer pTrack); private: class DeckControls { public: - DeckControls(QString& group) - : m_play(group, "play"), - m_pregain(group, "pregain"), - m_volume(group, "volume"), - m_orientation(group, "orientation") { - } + DeckControls(const QString& group) + : m_play(group, "play"), + m_pregain(group, "pregain"), + m_volume(group, "volume"), + m_orientation(group, "orientation") { + } ControlProxy m_play; ControlProxy m_pregain; diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 856e4045473..382da561e9e 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -520,7 +520,7 @@ void PlayerManager::addAuxiliaryInner() { m_auxiliaries.append(pAuxiliary); } -BaseTrackPlayer* PlayerManager::getPlayer(QString group) const { +BaseTrackPlayer* PlayerManager::getPlayer(const QString& group) const { QMutexLocker locker(&m_mutex); if (m_players.contains(group)) { return m_players[group]; @@ -578,7 +578,7 @@ Auxiliary* PlayerManager::getAuxiliary(unsigned int auxiliary) const { return m_auxiliaries[auxiliary - 1]; } -void PlayerManager::slotCloneDeck(QString source_group, QString target_group) { +void PlayerManager::slotCloneDeck(const QString& source_group, const QString& target_group) { BaseTrackPlayer* pPlayer = getPlayer(target_group); if (pPlayer == nullptr) { @@ -589,7 +589,7 @@ void PlayerManager::slotCloneDeck(QString source_group, QString target_group) { pPlayer->slotCloneFromGroup(source_group); } -void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play) { +void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play) { // Do not lock mutex in this method unless it is changed to access // PlayerManager state. BaseTrackPlayer* pPlayer = getPlayer(group); @@ -629,21 +629,21 @@ void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bo m_lastLoadedPlayer = group; } -void PlayerManager::slotLoadToPlayer(QString location, QString group) { +void PlayerManager::slotLoadToPlayer(const QString& location, const QString& group) { // The library will get the track and then signal back to us to load the // track via slotLoadTrackToPlayer. emit loadLocationToPlayer(location, group); } -void PlayerManager::slotLoadToDeck(QString location, int deck) { +void PlayerManager::slotLoadToDeck(const QString& location, int deck) { slotLoadToPlayer(location, groupForDeck(deck-1)); } -void PlayerManager::slotLoadToPreviewDeck(QString location, int previewDeck) { +void PlayerManager::slotLoadToPreviewDeck(const QString& location, int previewDeck) { slotLoadToPlayer(location, groupForPreviewDeck(previewDeck-1)); } -void PlayerManager::slotLoadToSampler(QString location, int sampler) { +void PlayerManager::slotLoadToSampler(const QString& location, int sampler) { slotLoadToPlayer(location, groupForSampler(sampler-1)); } diff --git a/src/mixer/playermanager.h b/src/mixer/playermanager.h index eff95c5d36c..762d72f678b 100644 --- a/src/mixer/playermanager.h +++ b/src/mixer/playermanager.h @@ -36,7 +36,7 @@ class PlayerManagerInterface { virtual ~PlayerManagerInterface() = default; // Get a BaseTrackPlayer (i.e. a Deck or a Sampler) by its group - virtual BaseTrackPlayer* getPlayer(QString group) const = 0; + virtual BaseTrackPlayer* getPlayer(const QString& group) const = 0; // Get the deck by its deck number. Decks are numbered starting with 1. virtual Deck* getDeck(unsigned int player) const = 0; @@ -125,7 +125,7 @@ class PlayerManager : public QObject, public PlayerManagerInterface { // Get a BaseTrackPlayer (i.e. a Deck, Sampler or PreviewDeck) by its // group. Auxiliaries and microphones are not players. - BaseTrackPlayer* getPlayer(QString group) const override; + BaseTrackPlayer* getPlayer(const QString& group) const override; // Get the deck by its deck number. Decks are numbered starting with 1. Deck* getDeck(unsigned int player) const override; @@ -188,21 +188,21 @@ class PlayerManager : public QObject, public PlayerManagerInterface { public slots: // Slots for loading tracks into a Player, which is either a Sampler or a Deck - void slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); - void slotLoadToPlayer(QString location, QString group); - void slotCloneDeck(QString source_group, QString target_group); + void slotLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play = false); + void slotLoadToPlayer(const QString& location, const QString& group); + void slotCloneDeck(const QString& source_group, const QString& target_group); // Slots for loading tracks to decks void slotLoadTrackIntoNextAvailableDeck(TrackPointer pTrack); // Loads the location to the deck. deckNumber is 1-indexed - void slotLoadToDeck(QString location, int deckNumber); + void slotLoadToDeck(const QString& location, int deckNumber); // Loads the location to the preview deck. previewDeckNumber is 1-indexed - void slotLoadToPreviewDeck(QString location, int previewDeckNumber); + void slotLoadToPreviewDeck(const QString& location, int previewDeckNumber); // Slots for loading tracks to samplers void slotLoadTrackIntoNextAvailableSampler(TrackPointer pTrack); // Loads the location to the sampler. samplerNumber is 1-indexed - void slotLoadToSampler(QString location, int samplerNumber); + void slotLoadToSampler(const QString& location, int samplerNumber); void slotChangeNumDecks(double v); void slotChangeNumSamplers(double v); @@ -217,7 +217,7 @@ class PlayerManager : public QObject, public PlayerManagerInterface { void onTrackAnalysisFinished(); signals: - void loadLocationToPlayer(QString location, QString group); + void loadLocationToPlayer(const QString& location, const QString& group); // Emitted when the user tries to enable a microphone talkover control when // there is no input configured. diff --git a/src/mixer/previewdeck.cpp b/src/mixer/previewdeck.cpp index c414bbb3bc5..e5c27bf6aa8 100644 --- a/src/mixer/previewdeck.cpp +++ b/src/mixer/previewdeck.cpp @@ -6,7 +6,7 @@ PreviewDeck::PreviewDeck(QObject* pParent, EffectsManager* pEffectsManager, VisualsManager* pVisualsManager, EngineChannel::ChannelOrientation defaultOrientation, - QString group) + const QString& group) : BaseTrackPlayerImpl(pParent, pConfig, pMixingEngine, pEffectsManager, pVisualsManager, defaultOrientation, group, /*defaultMaster*/ false, /*defaultHeadphones*/ true, /*primaryDeck*/ false) { diff --git a/src/mixer/previewdeck.h b/src/mixer/previewdeck.h index d1414af654e..421785c9b74 100644 --- a/src/mixer/previewdeck.h +++ b/src/mixer/previewdeck.h @@ -7,12 +7,12 @@ class PreviewDeck : public BaseTrackPlayerImpl { Q_OBJECT public: PreviewDeck(QObject* pParent, - UserSettingsPointer pConfig, - EngineMaster* pMixingEngine, - EffectsManager* pEffectsManager, - VisualsManager* pVisualsManager, - EngineChannel::ChannelOrientation defaultOrientation, - QString group); + UserSettingsPointer pConfig, + EngineMaster* pMixingEngine, + EffectsManager* pEffectsManager, + VisualsManager* pVisualsManager, + EngineChannel::ChannelOrientation defaultOrientation, + const QString& group); ~PreviewDeck() override = default; }; diff --git a/src/mixer/sampler.cpp b/src/mixer/sampler.cpp index b829d1b4c12..92371d0d1a5 100644 --- a/src/mixer/sampler.cpp +++ b/src/mixer/sampler.cpp @@ -8,7 +8,7 @@ Sampler::Sampler(QObject* pParent, EffectsManager* pEffectsManager, VisualsManager* pVisualsManager, EngineChannel::ChannelOrientation defaultOrientation, - QString group) + const QString& group) : BaseTrackPlayerImpl(pParent, pConfig, pMixingEngine, pEffectsManager, pVisualsManager, defaultOrientation, group, /*defaultMaster*/ true, /*defaultHeadphones*/ false, /*primaryDeck*/ false) { diff --git a/src/mixer/sampler.h b/src/mixer/sampler.h index 718ef8b93f1..1d023b3471a 100644 --- a/src/mixer/sampler.h +++ b/src/mixer/sampler.h @@ -12,7 +12,7 @@ class Sampler : public BaseTrackPlayerImpl { EffectsManager* pEffectsManager, VisualsManager* pVisualsManager, EngineChannel::ChannelOrientation defaultOrientation, - QString group); + const QString& group); ~Sampler() override = default; }; diff --git a/src/musicbrainz/tagfetcher.cpp b/src/musicbrainz/tagfetcher.cpp index d400c4783ab..6126f17241f 100644 --- a/src/musicbrainz/tagfetcher.cpp +++ b/src/musicbrainz/tagfetcher.cpp @@ -142,7 +142,7 @@ void TagFetcher::slotAcoustIdTaskSucceeded( } void TagFetcher::slotAcoustIdTaskFailed( - mixxx::network::JsonWebResponse response) { + const mixxx::network::JsonWebResponse& response) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); DEBUG_ASSERT(m_pAcoustIdTask.get() == qobject_cast(sender())); @@ -170,10 +170,10 @@ void TagFetcher::slotAcoustIdTaskAborted() { } void TagFetcher::slotAcoustIdTaskNetworkError( - QUrl requestUrl, + const QUrl& requestUrl, QNetworkReply::NetworkError errorCode, - QString errorString, - QByteArray errorContent) { + const QString& errorString, + const QByteArray& errorContent) { Q_UNUSED(requestUrl); Q_UNUSED(errorContent); DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); @@ -203,10 +203,10 @@ void TagFetcher::slotMusicBrainzTaskAborted() { } void TagFetcher::slotMusicBrainzTaskNetworkError( - QUrl requestUrl, + const QUrl& requestUrl, QNetworkReply::NetworkError errorCode, - QString errorString, - QByteArray errorContent) { + const QString& errorString, + const QByteArray& errorContent) { Q_UNUSED(requestUrl); Q_UNUSED(errorContent); DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); @@ -223,9 +223,9 @@ void TagFetcher::slotMusicBrainzTaskNetworkError( } void TagFetcher::slotMusicBrainzTaskFailed( - mixxx::network::WebResponse response, + const mixxx::network::WebResponse& response, int errorCode, - QString errorMessage) { + const QString& errorMessage) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); DEBUG_ASSERT(m_pMusicBrainzTask.get() == qobject_cast(sender())); @@ -240,7 +240,7 @@ void TagFetcher::slotMusicBrainzTaskFailed( } void TagFetcher::slotMusicBrainzTaskSucceeded( - QList guessedTrackReleases) { + const QList& guessedTrackReleases) { DEBUG_ASSERT_QOBJECT_THREAD_AFFINITY(this); DEBUG_ASSERT(m_pMusicBrainzTask.get() == qobject_cast(sender())); diff --git a/src/musicbrainz/tagfetcher.h b/src/musicbrainz/tagfetcher.h index 107ae7adcf9..7d5784fa140 100644 --- a/src/musicbrainz/tagfetcher.h +++ b/src/musicbrainz/tagfetcher.h @@ -30,13 +30,13 @@ class TagFetcher : public QObject { signals: void resultAvailable( TrackPointer pTrack, - QList guessedTrackReleases); + const QList& guessedTrackReleases); void fetchProgress( - QString message); + const QString& message); void networkError( int httpStatus, - QString app, - QString message, + const QString& app, + const QString& message, int code); private slots: @@ -45,26 +45,26 @@ class TagFetcher : public QObject { void slotAcoustIdTaskSucceeded( QList recordingIds); void slotAcoustIdTaskFailed( - mixxx::network::JsonWebResponse response); + const mixxx::network::JsonWebResponse& response); void slotAcoustIdTaskAborted(); void slotAcoustIdTaskNetworkError( - QUrl requestUrl, + const QUrl& requestUrl, QNetworkReply::NetworkError errorCode, - QString errorString, - QByteArray errorContent); + const QString& errorString, + const QByteArray& errorContent); void slotMusicBrainzTaskSucceeded( - QList guessedTrackReleases); + const QList& guessedTrackReleases); void slotMusicBrainzTaskFailed( - mixxx::network::WebResponse response, + const mixxx::network::WebResponse& response, int errorCode, - QString errorMessage); + const QString& errorMessage); void slotMusicBrainzTaskAborted(); void slotMusicBrainzTaskNetworkError( - QUrl requestUrl, + const QUrl& requestUrl, QNetworkReply::NetworkError errorCode, - QString errorString, - QByteArray errorContent); + const QString& errorString, + const QByteArray& errorContent); private: QNetworkAccessManager m_network; diff --git a/src/musicbrainz/web/acoustidlookuptask.h b/src/musicbrainz/web/acoustidlookuptask.h index 20a1a504a52..75e9b827f50 100644 --- a/src/musicbrainz/web/acoustidlookuptask.h +++ b/src/musicbrainz/web/acoustidlookuptask.h @@ -21,7 +21,7 @@ class AcoustIdLookupTask : public network::JsonWebTask { signals: void succeeded( - QList recordingIds); + const QList& recordingIds); protected: QNetworkReply* sendNetworkRequest( diff --git a/src/musicbrainz/web/musicbrainzrecordingstask.h b/src/musicbrainz/web/musicbrainzrecordingstask.h index e3f65e55a80..953298eb4c4 100644 --- a/src/musicbrainz/web/musicbrainzrecordingstask.h +++ b/src/musicbrainz/web/musicbrainzrecordingstask.h @@ -23,11 +23,11 @@ class MusicBrainzRecordingsTask : public network::WebTask { signals: void succeeded( - QList trackReleases); + const QList& trackReleases); void failed( - network::WebResponse response, + const network::WebResponse& response, int errorCode, - QString errorMessage); + const QString& errorMessage); private slots: void slotNetworkReplyFinished(); diff --git a/src/network/jsonwebtask.h b/src/network/jsonwebtask.h index 9c653d7c6bd..ca83ccea30e 100644 --- a/src/network/jsonwebtask.h +++ b/src/network/jsonwebtask.h @@ -61,7 +61,7 @@ class JsonWebTask : public WebTask { signals: void failed( - network::JsonWebResponse response); + const network::JsonWebResponse& response); private slots: void slotNetworkReplyFinished(); diff --git a/src/network/webtask.h b/src/network/webtask.h index 4a78a8fa79c..8735d3c8242 100644 --- a/src/network/webtask.h +++ b/src/network/webtask.h @@ -128,12 +128,12 @@ class WebTask : public QObject { // is finally deleted. If no receiver is connected the task // will be deleted implicitly. void aborted( - QUrl requestUrl); + const QUrl& requestUrl); void networkError( - QUrl requestUrl, + const QUrl& requestUrl, QNetworkReply::NetworkError errorCode, - QString errorString, - QByteArray errorContent); + const QString& errorString, + const QByteArray& errorContent); protected: template diff --git a/src/preferences/broadcastprofile.h b/src/preferences/broadcastprofile.h index 3f74dfaa462..b72713f1918 100644 --- a/src/preferences/broadcastprofile.h +++ b/src/preferences/broadcastprofile.h @@ -139,7 +139,7 @@ class BroadcastProfile : public QObject { void setOggDynamicUpdate(bool value); signals: - void profileNameChanged(QString oldName, QString newName); + void profileNameChanged(const QString& oldName, const QString& newName); void statusChanged(bool newStatus); void connectionStatusChanged(int newConnectionStatus); diff --git a/src/preferences/broadcastsettings.cpp b/src/preferences/broadcastsettings.cpp index dec9b5dffd4..53d08b6aa56 100644 --- a/src/preferences/broadcastsettings.cpp +++ b/src/preferences/broadcastsettings.cpp @@ -167,7 +167,7 @@ void BroadcastSettings::saveAll() { emit profilesChanged(); } -void BroadcastSettings::onProfileNameChanged(QString oldName, QString newName) { +void BroadcastSettings::onProfileNameChanged(const QString& oldName, const QString& newName) { if (!m_profiles.contains(oldName)) return; diff --git a/src/preferences/broadcastsettings.h b/src/preferences/broadcastsettings.h index bb2063b5f51..ec48f9c2e53 100644 --- a/src/preferences/broadcastsettings.h +++ b/src/preferences/broadcastsettings.h @@ -25,11 +25,11 @@ class BroadcastSettings : public QObject { signals: void profileAdded(BroadcastProfilePtr profile); void profileRemoved(BroadcastProfilePtr profile); - void profileRenamed(QString oldName, BroadcastProfilePtr profile); + void profileRenamed(const QString& oldName, BroadcastProfilePtr profile); void profilesChanged(); private slots: - void onProfileNameChanged(QString oldName, QString newName); + void onProfileNameChanged(const QString& oldName, const QString& newName); void onConnectionStatusChanged(int newStatus); private: diff --git a/src/preferences/broadcastsettingsmodel.cpp b/src/preferences/broadcastsettingsmodel.cpp index 2133fec119e..2ec2401fd2f 100644 --- a/src/preferences/broadcastsettingsmodel.cpp +++ b/src/preferences/broadcastsettingsmodel.cpp @@ -218,7 +218,7 @@ QColor BroadcastSettingsModel::connectionStatusBgColor(BroadcastProfilePtr profi } } -void BroadcastSettingsModel::onProfileNameChanged(QString oldName, QString newName) { +void BroadcastSettingsModel::onProfileNameChanged(const QString& oldName, const QString& newName) { if (!m_profiles.contains(oldName)) return; diff --git a/src/preferences/broadcastsettingsmodel.h b/src/preferences/broadcastsettingsmodel.h index 042cb7b59f5..5100638dcf2 100644 --- a/src/preferences/broadcastsettingsmodel.h +++ b/src/preferences/broadcastsettingsmodel.h @@ -38,7 +38,7 @@ class BroadcastSettingsModel : public QAbstractTableModel { QAbstractItemDelegate* delegateForColumn(const int i, QObject* parent); private slots: - void onProfileNameChanged(QString oldName, QString newName); + void onProfileNameChanged(const QString& oldName, const QString& newName); void onConnectionStatusChanged(int newStatus); private: diff --git a/src/preferences/configobject.cpp b/src/preferences/configobject.cpp index e765afa0b83..2e25ea076e2 100644 --- a/src/preferences/configobject.cpp +++ b/src/preferences/configobject.cpp @@ -262,7 +262,7 @@ QSet ConfigObject::getGroups() { } template -QList ConfigObject::getKeysWithGroup(QString group) const { +QList ConfigObject::getKeysWithGroup(const QString& group) const { QWriteLocker lock(&m_valuesLock); QList filteredList; for (const ConfigKey& key : m_values.keys()) { diff --git a/src/preferences/configobject.h b/src/preferences/configobject.h index 751789caed7..da4ab169a93 100644 --- a/src/preferences/configobject.h +++ b/src/preferences/configobject.h @@ -102,7 +102,7 @@ class ConfigValueKbd : public ConfigValue { ConfigValueKbd() = default; ~ConfigValueKbd() override = default; explicit ConfigValueKbd(const QKeySequence& keys); - explicit ConfigValueKbd(const QDomNode) { + explicit ConfigValueKbd(const QDomNode&) { reportFatalErrorAndQuit("ConfigValueKbd from QDomNode not implemented here"); } @@ -184,7 +184,7 @@ template class ConfigObject { } QSet getGroups(); - QList getKeysWithGroup(QString group) const; + QList getKeysWithGroup(const QString& group) const; protected: // We use QMap because we want a sorted list in mixxx.cfg diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp index c316e2f9c4b..525f2c6dd33 100644 --- a/src/preferences/dialog/dlgprefbroadcast.cpp +++ b/src/preferences/dialog/dlgprefbroadcast.cpp @@ -359,7 +359,7 @@ void DlgPrefBroadcast::selectConnectionRow(int row) { connectionListItemSelected(newSelection); } -void DlgPrefBroadcast::selectConnectionRowByName(QString rowName) { +void DlgPrefBroadcast::selectConnectionRowByName(const QString& rowName) { int row = -1; for (int i = 0; i < m_pSettingsModel->rowCount(); i++) { QModelIndex index = m_pSettingsModel->index(i, kColumnName); diff --git a/src/preferences/dialog/dlgprefbroadcast.h b/src/preferences/dialog/dlgprefbroadcast.h index 4e55b897220..6c9db8e17c3 100644 --- a/src/preferences/dialog/dlgprefbroadcast.h +++ b/src/preferences/dialog/dlgprefbroadcast.h @@ -48,7 +48,7 @@ class DlgPrefBroadcast : public DlgPreferencePage, public Ui::DlgPrefBroadcastDl void applyModel(); void updateModel(); void selectConnectionRow(int row); - void selectConnectionRowByName(QString rowName); + void selectConnectionRowByName(const QString& rowName); void getValuesFromProfile(BroadcastProfilePtr profile); void setValuesToProfile(BroadcastProfilePtr profile); diff --git a/src/preferences/dialog/dlgprefeq.h b/src/preferences/dialog/dlgprefeq.h index d4a4b8493f3..d0f80d0273d 100644 --- a/src/preferences/dialog/dlgprefeq.h +++ b/src/preferences/dialog/dlgprefeq.h @@ -69,7 +69,7 @@ class DlgPrefEQ : public DlgPreferencePage, public Ui::DlgPrefEQDlg { signals: void apply(const QString &); - void effectOnChainSlot(const unsigned int, const unsigned int, QString); + void effectOnChainSlot(const unsigned int, const unsigned int, const QString&); private: void loadSettings(); diff --git a/src/preferences/dialog/dlgprefinterface.cpp b/src/preferences/dialog/dlgprefinterface.cpp index 4202492dbd7..6d684f951fe 100644 --- a/src/preferences/dialog/dlgprefinterface.cpp +++ b/src/preferences/dialog/dlgprefinterface.cpp @@ -357,7 +357,7 @@ void DlgPrefInterface::slotSetScheme(int) { skinPreviewLabel->setPixmap(m_pSkinLoader->getSkinPreview(m_skin, m_colorScheme)); } -void DlgPrefInterface::slotSetSkinDescription(QString skin) { +void DlgPrefInterface::slotSetSkinDescription(const QString& skin) { SkinManifest manifest = LegacySkinParser::getSkinManifest( LegacySkinParser::openSkin(m_pSkinLoader->getSkinPath(skin))); QString description = QString::fromStdString(manifest.description()); diff --git a/src/preferences/dialog/dlgprefinterface.h b/src/preferences/dialog/dlgprefinterface.h index ddd5ffec855..248f5a63058 100644 --- a/src/preferences/dialog/dlgprefinterface.h +++ b/src/preferences/dialog/dlgprefinterface.h @@ -49,7 +49,7 @@ class DlgPrefInterface : public DlgPreferencePage, public Ui::DlgPrefControlsDlg void slotResetToDefaults() override; void slotSetTooltips(); - void slotSetSkinDescription(QString skin); + void slotSetSkinDescription(const QString& skin); void slotSetSkin(int); void slotSetScheme(int); void slotUpdateSchemes(); diff --git a/src/preferences/dialog/dlgpreflibrary.h b/src/preferences/dialog/dlgpreflibrary.h index 22d65eaca2f..9adde26be43 100644 --- a/src/preferences/dialog/dlgpreflibrary.h +++ b/src/preferences/dialog/dlgpreflibrary.h @@ -51,9 +51,9 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { signals: void apply(); void scanLibrary(); - void requestAddDir(QString dir); - void requestRemoveDir(QString dir, Library::RemovalType removalType); - void requestRelocateDir(QString currentDir, QString newDir); + void requestAddDir(const QString& dir); + void requestRemoveDir(const QString& dir, Library::RemovalType removalType); + void requestRelocateDir(const QString& currentDir, const QString& newDir); private slots: void slotRowHeightValueChanged(int); diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index e876be26f19..3d7485fecd5 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -176,7 +176,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager, connect(m_pSoundManager, &SoundManager::outputRegistered, this, - [this](AudioOutput output, AudioSource* source) { + [this](const AudioOutput& output, AudioSource* source) { Q_UNUSED(source); addPath(output); loadSettings(); @@ -185,7 +185,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, SoundManager* pSoundManager, connect(m_pSoundManager, &SoundManager::inputRegistered, this, - [this](AudioInput input, AudioDestination* dest) { + [this](const AudioInput& input, AudioDestination* dest) { Q_UNUSED(dest); addPath(input); loadSettings(); @@ -343,7 +343,7 @@ void DlgPrefSound::initializePaths() { } } -void DlgPrefSound::addPath(AudioOutput output) { +void DlgPrefSound::addPath(const AudioOutput& output) { // if we already know about this output, don't make a new entry foreach (QObject *obj, outputTab->children()) { DlgPrefSoundItem *item = qobject_cast(obj); @@ -374,7 +374,7 @@ void DlgPrefSound::addPath(AudioOutput output) { connectSoundItem(toInsert); } -void DlgPrefSound::addPath(AudioInput input) { +void DlgPrefSound::addPath(const AudioInput& input) { DlgPrefSoundItem *toInsert; // if we already know about this input, don't make a new entry foreach (QObject *obj, inputTab->children()) { diff --git a/src/preferences/dialog/dlgprefsound.h b/src/preferences/dialog/dlgprefsound.h index 94159d8ea50..6682555925d 100644 --- a/src/preferences/dialog/dlgprefsound.h +++ b/src/preferences/dialog/dlgprefsound.h @@ -75,8 +75,8 @@ class DlgPrefSound : public DlgPreferencePage, public Ui::DlgPrefSoundDlg { void micMonitorModeComboBoxChanged(int value); private slots: - void addPath(AudioOutput output); - void addPath(AudioInput input); + void addPath(const AudioOutput& output); + void addPath(const AudioInput& input); void loadSettings(); void apiChanged(int index); void updateAPIs(); diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp index faefab9af57..118f7ab8b4a 100644 --- a/src/preferences/dialog/dlgprefvinyl.cpp +++ b/src/preferences/dialog/dlgprefvinyl.cpp @@ -150,19 +150,19 @@ void DlgPrefVinyl::slotNumDecksChanged(double dNumDecks) { } } -void DlgPrefVinyl::slotVinylType1Changed(QString text) { +void DlgPrefVinyl::slotVinylType1Changed(const QString& text) { LeadinTime1->setValue(getDefaultLeadIn(text)); } -void DlgPrefVinyl::slotVinylType2Changed(QString text) { +void DlgPrefVinyl::slotVinylType2Changed(const QString& text) { LeadinTime2->setValue(getDefaultLeadIn(text)); } -void DlgPrefVinyl::slotVinylType3Changed(QString text) { +void DlgPrefVinyl::slotVinylType3Changed(const QString& text) { LeadinTime3->setValue(getDefaultLeadIn(text)); } -void DlgPrefVinyl::slotVinylType4Changed(QString text) { +void DlgPrefVinyl::slotVinylType4Changed(const QString& text) { LeadinTime4->setValue(getDefaultLeadIn(text)); } @@ -281,7 +281,8 @@ void DlgPrefVinyl::slotUpdate() { } } -void DlgPrefVinyl::verifyAndSaveLeadInTime(QSpinBox* widget, QString group, QString vinyl_type) { +void DlgPrefVinyl::verifyAndSaveLeadInTime( + QSpinBox* widget, const QString& group, const QString& vinyl_type) { QString strLeadIn = widget->text(); bool isInteger; strLeadIn.toInt(&isInteger); @@ -293,7 +294,7 @@ void DlgPrefVinyl::verifyAndSaveLeadInTime(QSpinBox* widget, QString group, QStr } } -int DlgPrefVinyl::getDefaultLeadIn(QString vinyl_type) const { +int DlgPrefVinyl::getDefaultLeadIn(const QString& vinyl_type) const { if (vinyl_type == MIXXX_VINYL_SERATOCV02VINYLSIDEA) { return MIXXX_VINYL_SERATOCV02VINYLSIDEA_LEADIN; } else if (vinyl_type == MIXXX_VINYL_SERATOCV02VINYLSIDEB) { diff --git a/src/preferences/dialog/dlgprefvinyl.h b/src/preferences/dialog/dlgprefvinyl.h index d72426e9974..778dfe6bdd0 100644 --- a/src/preferences/dialog/dlgprefvinyl.h +++ b/src/preferences/dialog/dlgprefvinyl.h @@ -50,10 +50,10 @@ class DlgPrefVinyl : public DlgPreferencePage, Ui::DlgPrefVinylDlg { private slots: void slotNumDecksChanged(double); - void slotVinylType1Changed(QString); - void slotVinylType2Changed(QString); - void slotVinylType3Changed(QString); - void slotVinylType4Changed(QString); + void slotVinylType1Changed(const QString&); + void slotVinylType2Changed(const QString&); + void slotVinylType3Changed(const QString&); + void slotVinylType4Changed(const QString&); private: void setDeckWidgetsVisible(int deck, bool visible); @@ -61,9 +61,8 @@ class DlgPrefVinyl : public DlgPreferencePage, Ui::DlgPrefVinylDlg { void setDeck2WidgetsVisible(bool visible); void setDeck3WidgetsVisible(bool visible); void setDeck4WidgetsVisible(bool visible); - void verifyAndSaveLeadInTime(QSpinBox* widget, QString group, QString vinyl_type); - int getDefaultLeadIn(QString vinyl_type) const; - + void verifyAndSaveLeadInTime(QSpinBox* widget, const QString& group, const QString& vinyl_type); + int getDefaultLeadIn(const QString& vinyl_type) const; QList m_signalWidgets; diff --git a/src/recording/recordingmanager.cpp b/src/recording/recordingmanager.cpp index 54d635de114..63dab0851a5 100644 --- a/src/recording/recordingmanager.cpp +++ b/src/recording/recordingmanager.cpp @@ -74,7 +74,7 @@ RecordingManager::~RecordingManager() { delete m_pToggleRecording; } -QString RecordingManager::formatDateTimeForFilename(QDateTime dateTime) const { +QString RecordingManager::formatDateTimeForFilename(const QDateTime& dateTime) const { // Use a format based on ISO 8601. Windows does not support colons in // filenames so we can't use them anywhere. QString formatted = dateTime.toString("yyyy-MM-dd_hh'h'mm'm'ss's'"); diff --git a/src/recording/recordingmanager.h b/src/recording/recordingmanager.h index f458c14cd11..526963f6cbe 100644 --- a/src/recording/recordingmanager.h +++ b/src/recording/recordingmanager.h @@ -48,7 +48,7 @@ class RecordingManager : public QObject // Emits the cumulative number of bytes currently recorded. void bytesRecorded(int); void isRecording(bool); - void durationRecorded(QString); + void durationRecorded(const QString&); public slots: void slotIsRecording(bool recording, bool error); @@ -58,7 +58,7 @@ class RecordingManager : public QObject void slotToggleRecording(double value); private: - QString formatDateTimeForFilename(QDateTime dateTime) const; + QString formatDateTimeForFilename(const QDateTime& dateTime) const; // slotBytesRecorded just noticed that recording must be interrupted // to split the file. The nth filename will follow the date/time // name of the first split but with a suffix. diff --git a/src/skin/colorschemeparser.cpp b/src/skin/colorschemeparser.cpp index c750e66f8b4..ce0a221d000 100644 --- a/src/skin/colorschemeparser.cpp +++ b/src/skin/colorschemeparser.cpp @@ -13,10 +13,10 @@ #include "skin/legacyskinparser.h" #include "skin/skincontext.h" -void ColorSchemeParser::setupLegacyColorSchemes(QDomElement docElem, - UserSettingsPointer pConfig, - QString* pStyle, - SkinContext* pContext) { +void ColorSchemeParser::setupLegacyColorSchemes(const QDomElement& docElem, + UserSettingsPointer pConfig, + QString* pStyle, + SkinContext* pContext) { QDomNode schemesNode = docElem.namedItem("Schemes"); bool bSelectedColorSchemeFound = false; @@ -71,7 +71,7 @@ void ColorSchemeParser::setupLegacyColorSchemes(QDomElement docElem, } } -ImgSource* ColorSchemeParser::parseFilters(QDomNode filt) { +ImgSource* ColorSchemeParser::parseFilters(const QDomNode& filt) { ImgSource* ret = new ImgLoader(); if (!filt.hasChildNodes()) { diff --git a/src/skin/colorschemeparser.h b/src/skin/colorschemeparser.h index 61f63d188b6..6decd79a92f 100644 --- a/src/skin/colorschemeparser.h +++ b/src/skin/colorschemeparser.h @@ -10,12 +10,13 @@ class ImgSource; class ColorSchemeParser { public: static void setupLegacyColorSchemes( - QDomElement docElem, + const QDomElement& docElem, UserSettingsPointer pConfig, QString* pStyle, SkinContext* pContext); + private: - static ImgSource* parseFilters(QDomNode filter); + static ImgSource* parseFilters(const QDomNode& filter); ColorSchemeParser() { } ~ColorSchemeParser() { } }; diff --git a/src/skin/skincontext.h b/src/skin/skincontext.h index d89e7d9205b..044878f3f42 100644 --- a/src/skin/skincontext.h +++ b/src/skin/skincontext.h @@ -239,11 +239,11 @@ class SkinContext { QDebug logWarning(const char* file, const int line, const QDomNode& node) const; - void defineSingleton(QString objectName, QWidget* widget) { + void defineSingleton(const QString& objectName, QWidget* widget) { return m_pSharedState->singletons.insertSingleton(objectName, widget); } - QWidget* getSingletonWidget(QString objectName) const { + QWidget* getSingletonWidget(const QString& objectName) const { return m_pSharedState->singletons.getSingletonWidget(objectName); } diff --git a/src/skin/skinloader.cpp b/src/skin/skinloader.cpp index abc5a45db0c..2cd7e9f5fbb 100644 --- a/src/skin/skinloader.cpp +++ b/src/skin/skinloader.cpp @@ -145,7 +145,7 @@ LaunchImage* SkinLoader::loadLaunchImage(QWidget* pParent) { return pLaunchImage; } -QString SkinLoader::pickResizableSkin(QString oldSkin) const { +QString SkinLoader::pickResizableSkin(const QString& oldSkin) const { if (oldSkin.contains("latenight", Qt::CaseInsensitive)) { return "LateNight"; } diff --git a/src/skin/skinloader.h b/src/skin/skinloader.h index 2892ce903ca..9b3796508ff 100644 --- a/src/skin/skinloader.h +++ b/src/skin/skinloader.h @@ -41,7 +41,7 @@ class SkinLoader { QList getSkinSearchPaths() const; private: - QString pickResizableSkin(QString oldSkin) const; + QString pickResizableSkin(const QString& oldSkin) const; UserSettingsPointer m_pConfig; }; diff --git a/src/skin/tooltips.cpp b/src/skin/tooltips.cpp index bb4be75bddd..87cbd48918e 100644 --- a/src/skin/tooltips.cpp +++ b/src/skin/tooltips.cpp @@ -7,7 +7,7 @@ Tooltips::Tooltips() { Tooltips::~Tooltips() { } -QString Tooltips::tooltipForId(QString id) const { +QString Tooltips::tooltipForId(const QString& id) const { // We always add a separator at the end. QString joined = m_tooltips.value(id, QStringList()).join(tooltipSeparator()); if (joined.length() > 0) { @@ -20,7 +20,7 @@ QString Tooltips::tooltipSeparator() const { return "\n"; } -QList& Tooltips::add(QString id) { +QList& Tooltips::add(const QString& id) { return m_tooltips[id]; } diff --git a/src/skin/tooltips.h b/src/skin/tooltips.h index fdbfbc8308f..35b2fc05ec7 100644 --- a/src/skin/tooltips.h +++ b/src/skin/tooltips.h @@ -10,12 +10,12 @@ class Tooltips : public QObject { public: Tooltips(); virtual ~Tooltips(); - QString tooltipForId(QString id) const; + QString tooltipForId(const QString& id) const; private: void addStandardTooltips(); QString tooltipSeparator() const; - QList& add(QString id); + QList& add(const QString& id); QHash m_tooltips; }; diff --git a/src/soundio/sounddevicenotfound.h b/src/soundio/sounddevicenotfound.h index 00677a4c2c7..2e33dbf7f99 100644 --- a/src/soundio/sounddevicenotfound.h +++ b/src/soundio/sounddevicenotfound.h @@ -15,7 +15,7 @@ class EngineNetworkStream; class SoundDeviceNotFound : public SoundDevice { public: - SoundDeviceNotFound(QString name) + SoundDeviceNotFound(const QString& name) : SoundDevice(UserSettingsPointer(), nullptr) { m_deviceId.name = name; m_strDisplayName = name; diff --git a/src/soundio/soundmanager.cpp b/src/soundio/soundmanager.cpp index 93a21ee1b63..e5c69268d9f 100644 --- a/src/soundio/soundmanager.cpp +++ b/src/soundio/soundmanager.cpp @@ -118,7 +118,7 @@ SoundManager::~SoundManager() { } QList SoundManager::getDeviceList( - QString filterAPI, bool bOutputDevices, bool bInputDevices) const { + const QString& filterAPI, bool bOutputDevices, bool bInputDevices) const { //qDebug() << "SoundManager::getDeviceList"; if (filterAPI == "None") { @@ -232,7 +232,7 @@ void SoundManager::clearDeviceList(bool sleepAfterClosing) { } } -QList SoundManager::getSampleRates(QString api) const { +QList SoundManager::getSampleRates(const QString& api) const { if (api == MIXXX_PORTAUDIO_JACK_STRING) { // queryDevices must have been called for this to work, but the // ctor calls it -bkgood @@ -558,7 +558,7 @@ SoundManagerConfig SoundManager::getConfig() const { return m_config; } -SoundDeviceError SoundManager::setConfig(SoundManagerConfig config) { +SoundDeviceError SoundManager::setConfig(const SoundManagerConfig& config) { SoundDeviceError err = SOUNDDEVICE_ERROR_OK; m_config = config; checkConfig(); @@ -633,7 +633,7 @@ void SoundManager::readProcess() const { } } -void SoundManager::registerOutput(AudioOutput output, AudioSource *src) { +void SoundManager::registerOutput(const AudioOutput& output, AudioSource* src) { if (m_registeredSources.contains(output)) { qDebug() << "WARNING: AudioOutput already registered!"; } @@ -641,7 +641,7 @@ void SoundManager::registerOutput(AudioOutput output, AudioSource *src) { emit outputRegistered(output, src); } -void SoundManager::registerInput(AudioInput input, AudioDestination *dest) { +void SoundManager::registerInput(const AudioInput& input, AudioDestination* dest) { if (m_registeredDestinations.contains(input)) { // note that this can be totally ok if we just want a certain // AudioInput to be going to a different AudioDest -bkgood diff --git a/src/soundio/soundmanager.h b/src/soundio/soundmanager.h index 2009bfc8177..14879847738 100644 --- a/src/soundio/soundmanager.h +++ b/src/soundio/soundmanager.h @@ -46,7 +46,7 @@ class SoundManager : public QObject { // filterApi, and have at least one output or input channel if the // bOutputDevices or bInputDevices are set, respectively. QList getDeviceList( - QString filterAPI, bool bOutputDevices, bool bInputDevices) const; + const QString& filterAPI, bool bOutputDevices, bool bInputDevices) const; // Creates a list of sound devices void clearAndQueryDevices(); @@ -67,7 +67,7 @@ class SoundManager : public QObject { QString getLastErrorMessage(SoundDeviceError err) const; // Returns a list of samplerates we will attempt to support for a given API. - QList getSampleRates(QString api) const; + QList getSampleRates(const QString& api) const; // Convenience overload for SoundManager::getSampleRates(QString) QList getSampleRates() const; @@ -75,7 +75,7 @@ class SoundManager : public QObject { // Get a list of host APIs supported by PortAudio. QList getHostAPIList() const; SoundManagerConfig getConfig() const; - SoundDeviceError setConfig(SoundManagerConfig config); + SoundDeviceError setConfig(const SoundManagerConfig& config); void checkConfig(); void onDeviceOutputCallback(const SINT iFramesPerBuffer); @@ -89,8 +89,8 @@ class SoundManager : public QObject { void writeProcess() const; void readProcess() const; - void registerOutput(AudioOutput output, AudioSource *src); - void registerInput(AudioInput input, AudioDestination *dest); + void registerOutput(const AudioOutput& output, AudioSource* src); + void registerInput(const AudioInput& input, AudioDestination* dest); QList registeredOutputs() const; QList registeredInputs() const; @@ -112,8 +112,8 @@ class SoundManager : public QObject { signals: void devicesUpdated(); // emitted when pointers to SoundDevices go stale void devicesSetup(); // emitted when the sound devices have been set up - void outputRegistered(AudioOutput output, AudioSource *src); - void inputRegistered(AudioInput input, AudioDestination *dest); + void outputRegistered(const AudioOutput& output, AudioSource* src); + void inputRegistered(const AudioInput& input, AudioDestination* dest); private: // Closes all the devices and empties the list of devices we have. diff --git a/src/soundio/soundmanagerutil.h b/src/soundio/soundmanagerutil.h index 9a7f1a1e2a7..ccc34120258 100644 --- a/src/soundio/soundmanagerutil.h +++ b/src/soundio/soundmanagerutil.h @@ -164,17 +164,21 @@ class AudioInputBuffer : public AudioInput { class AudioSource { public: - virtual const CSAMPLE* buffer(AudioOutput output) const = 0; + virtual const CSAMPLE* buffer(const AudioOutput& output) const = 0; - // This is called by SoundManager whenever an output is connected for this - // source. When this is called it is guaranteed that no callback is - // active. - virtual void onOutputConnected(AudioOutput output) { Q_UNUSED(output); }; + // This is called by SoundManager whenever an output is connected for this + // source. When this is called it is guaranteed that no callback is + // active. + virtual void onOutputConnected(const AudioOutput& output) { + Q_UNUSED(output); + }; // This is called by SoundManager whenever an output is disconnected for // this source. When this is called it is guaranteed that no callback is // active. - virtual void onOutputDisconnected(AudioOutput output) { Q_UNUSED(output); }; + virtual void onOutputDisconnected(const AudioOutput& output) { + Q_UNUSED(output); + }; }; class AudioDestination { @@ -182,18 +186,23 @@ class AudioDestination { // This is called by SoundManager whenever there are new samples from the // configured input to be processed. This is run in the clock reference // callback thread - virtual void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int iNumFrames) = 0; + virtual void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int iNumFrames) = 0; - // This is called by SoundManager whenever an input is configured for this - // destination. When this is called it is guaranteed that no callback is - // active. - virtual void onInputConfigured(AudioInput input) { Q_UNUSED(input); }; + // This is called by SoundManager whenever an input is configured for this + // destination. When this is called it is guaranteed that no callback is + // active. + virtual void onInputConfigured(const AudioInput& input) { + Q_UNUSED(input); + }; // This is called by SoundManager whenever an input is unconfigured for this // destination. When this is called it is guaranteed that no callback is // active. - virtual void onInputUnconfigured(AudioInput input) { Q_UNUSED(input); }; + virtual void onInputUnconfigured(const AudioInput& input) { + Q_UNUSED(input); + }; }; typedef AudioPath::AudioPathType AudioPathType; diff --git a/src/sources/audiosource.cpp b/src/sources/audiosource.cpp index b4cd6b7f687..97ab0f8949b 100644 --- a/src/sources/audiosource.cpp +++ b/src/sources/audiosource.cpp @@ -16,7 +16,7 @@ const SINT kVerifyReadableMaxFrameCount = 1; } // anonymous namespace -AudioSource::AudioSource(QUrl url) +AudioSource::AudioSource(const QUrl& url) : UrlResource(url), m_signalInfo(kSampleLayout) { } @@ -217,7 +217,7 @@ bool AudioSource::verifyReadable() { } std::optional AudioSource::clampWritableSampleFrames( - WritableSampleFrames sampleFrames) const { + const WritableSampleFrames& sampleFrames) const { const auto clampedFrameIndexRange = intersect2(sampleFrames.frameIndexRange(), frameIndexRange()); @@ -275,7 +275,7 @@ std::optional AudioSource::clampWritableSampleFrames( } ReadableSampleFrames AudioSource::readSampleFrames( - WritableSampleFrames sampleFrames) { + const WritableSampleFrames& sampleFrames) { const auto clamped = clampWritableSampleFrames(sampleFrames); if (!clamped) { diff --git a/src/sources/audiosource.h b/src/sources/audiosource.h index 64a8b57a0f4..7672704a979 100644 --- a/src/sources/audiosource.h +++ b/src/sources/audiosource.h @@ -116,14 +116,14 @@ class IAudioSourceReader { // empty the internal memory pointer of the returned buffer might // be null. virtual ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) = 0; + const WritableSampleFrames& sampleFrames) = 0; // The following function is required for accessing the protected // read function from siblings implementing this interface, e.g. // for proxies and adapters. static ReadableSampleFrames readSampleFramesClampedOn( IAudioSourceReader& that, - WritableSampleFrames sampleFrames) { + const WritableSampleFrames& sampleFrames) { return that.readSampleFramesClamped(sampleFrames); } }; @@ -311,10 +311,10 @@ class AudioSource : public UrlResource, public virtual /*implements*/ IAudioSour bool verifyReadable(); ReadableSampleFrames readSampleFrames( - WritableSampleFrames sampleFrames); + const WritableSampleFrames& sampleFrames); protected: - explicit AudioSource(QUrl url); + explicit AudioSource(const QUrl& url); bool initChannelCountOnce(audio::ChannelCount channelCount); bool initChannelCountOnce(SINT channelCount) { @@ -385,7 +385,7 @@ class AudioSource : public UrlResource, public virtual /*implements*/ IAudioSour const audio::SignalInfo& signalInfo); std::optional clampWritableSampleFrames( - WritableSampleFrames sampleFrames) const; + const WritableSampleFrames& sampleFrames) const; audio::SignalInfo m_signalInfo; diff --git a/src/sources/audiosourceproxy.h b/src/sources/audiosourceproxy.h index 33fa6978e76..22f78b3cb8a 100644 --- a/src/sources/audiosourceproxy.h +++ b/src/sources/audiosourceproxy.h @@ -31,7 +31,7 @@ class AudioSourceProxy : public AudioSource { } ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override { + const WritableSampleFrames& sampleFrames) override { DEBUG_ASSERT(getSignalInfo() == m_pAudioSource->getSignalInfo()); DEBUG_ASSERT(getBitrate() == m_pAudioSource->getBitrate()); DEBUG_ASSERT(frameIndexRange() == m_pAudioSource->frameIndexRange()); diff --git a/src/sources/audiosourcestereoproxy.cpp b/src/sources/audiosourcestereoproxy.cpp index 58fd110c2cb..a3412c8ac0a 100644 --- a/src/sources/audiosourcestereoproxy.cpp +++ b/src/sources/audiosourcestereoproxy.cpp @@ -65,7 +65,7 @@ inline bool isDisjunct( } // namespace ReadableSampleFrames AudioSourceStereoProxy::readSampleFramesClamped( - WritableSampleFrames sampleFrames) { + const WritableSampleFrames& sampleFrames) { if (m_pAudioSource->getSignalInfo().getChannelCount() == kChannelCount) { return readSampleFramesClampedOn(*m_pAudioSource, sampleFrames); } diff --git a/src/sources/audiosourcestereoproxy.h b/src/sources/audiosourcestereoproxy.h index 48bd4a4b025..e94e7ba7b46 100644 --- a/src/sources/audiosourcestereoproxy.h +++ b/src/sources/audiosourcestereoproxy.h @@ -27,7 +27,7 @@ class AudioSourceStereoProxy : public AudioSourceProxy { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) override; + const WritableSampleFrames& writableSampleFrames) override; private: SampleBuffer m_tempSampleBuffer; diff --git a/src/sources/metadatasourcetaglib.cpp b/src/sources/metadatasourcetaglib.cpp index 17bbfaa9d43..007f9219f1c 100644 --- a/src/sources/metadatasourcetaglib.cpp +++ b/src/sources/metadatasourcetaglib.cpp @@ -75,8 +75,7 @@ class AiffFile : public TagLib::RIFF::AIFF::File { } }; -inline -QDateTime getMetadataSynchronized(QFileInfo fileInfo) { +inline QDateTime getMetadataSynchronized(const QFileInfo& fileInfo) { return fileInfo.lastModified(); } diff --git a/src/sources/metadatasourcetaglib.h b/src/sources/metadatasourcetaglib.h index 7156f3432fa..ee7b92aaa3c 100644 --- a/src/sources/metadatasourcetaglib.h +++ b/src/sources/metadatasourcetaglib.h @@ -10,12 +10,12 @@ namespace mixxx { class MetadataSourceTagLib : public MetadataSource { public: explicit MetadataSourceTagLib( - QString fileName) + const QString& fileName) : m_fileName(fileName), m_fileType(taglib::getFileTypeFromFileName(fileName)) { } MetadataSourceTagLib( - QString fileName, + const QString& fileName, taglib::FileType fileType) : m_fileName(fileName), m_fileType(fileType) { diff --git a/src/sources/readaheadframebuffer.cpp b/src/sources/readaheadframebuffer.cpp index 574bc65d590..407074963cb 100644 --- a/src/sources/readaheadframebuffer.cpp +++ b/src/sources/readaheadframebuffer.cpp @@ -104,7 +104,7 @@ FrameCount ReadAheadFrameBuffer::discardLastBufferedFrames( } ReadableSampleFrames ReadAheadFrameBuffer::fillBuffer( - ReadableSampleFrames inputBuffer, + const ReadableSampleFrames& inputBuffer, DiscontinuityGapMode discontinuityGapMode) { DEBUG_ASSERT(isValid()); auto inputRange = inputBuffer.frameIndexRange(); @@ -187,7 +187,7 @@ ReadableSampleFrames ReadAheadFrameBuffer::fillBuffer( } WritableSampleFrames ReadAheadFrameBuffer::drainBuffer( - WritableSampleFrames outputBuffer) { + const WritableSampleFrames& outputBuffer) { DEBUG_ASSERT(isValid()); auto outputRange = outputBuffer.frameIndexRange(); #if VERBOSE_DEBUG_LOG @@ -263,7 +263,7 @@ WritableSampleFrames ReadAheadFrameBuffer::drainBuffer( WritableSampleFrames ReadAheadFrameBuffer::consumeAndFillBuffer( ReadableSampleFrames inputBuffer, - WritableSampleFrames outputBuffer, + const WritableSampleFrames& outputBuffer, FrameCount minOutputIndex, std::pair discontinuityModes) { auto inputRange = inputBuffer.frameIndexRange(); diff --git a/src/sources/readaheadframebuffer.h b/src/sources/readaheadframebuffer.h index 7145c53bdb4..0f5d3d6077f 100644 --- a/src/sources/readaheadframebuffer.h +++ b/src/sources/readaheadframebuffer.h @@ -115,7 +115,7 @@ class ReadAheadFrameBuffer final { /// Returns the remaining portion that could not be filled from /// the buffer. WritableSampleFrames drainBuffer( - WritableSampleFrames outputBuffer); + const WritableSampleFrames& outputBuffer); /// Fills first the output buffer and then the internal buffer with /// the data from the input buffer. The whole input buffer is consumed. @@ -136,7 +136,7 @@ class ReadAheadFrameBuffer final { /// Returns the remaining portion that could not be filled from /// the buffer. WritableSampleFrames consumeAndFillBuffer(ReadableSampleFrames inputBuffer, - WritableSampleFrames outputBuffer, + const WritableSampleFrames& outputBuffer, FrameIndex minOutputIndex, std::pair discontinuityModes = std::make_pair( @@ -156,7 +156,7 @@ class ReadAheadFrameBuffer final { /// Returns the unread portion of the readable sample frames, /// which should typically be empty. ReadableSampleFrames fillBuffer( - ReadableSampleFrames inputBuffer, + const ReadableSampleFrames& inputBuffer, DiscontinuityGapMode discontinuityGapMode); /// Advance the read position thereby discarding samples diff --git a/src/sources/soundsource.cpp b/src/sources/soundsource.cpp index 180d83c5a2a..9dcefd02ff3 100644 --- a/src/sources/soundsource.cpp +++ b/src/sources/soundsource.cpp @@ -20,11 +20,11 @@ inline QUrl validateUrl(QUrl url) { } // anonymous namespace -/*static*/ QString SoundSource::getFileExtensionFromUrl(QUrl url) { +/*static*/ QString SoundSource::getFileExtensionFromUrl(const QUrl& url) { return validateUrl(url).toString().section(".", -1).toLower().trimmed(); } -SoundSource::SoundSource(QUrl url, QString type) +SoundSource::SoundSource(const QUrl& url, const QString& type) : AudioSource(validateUrl(url)), MetadataSourceTagLib(getLocalFileName()), m_type(type) { diff --git a/src/sources/soundsource.h b/src/sources/soundsource.h index d6c1a3060b5..54e4c0794fd 100644 --- a/src/sources/soundsource.h +++ b/src/sources/soundsource.h @@ -15,7 +15,7 @@ class SoundSource : public AudioSource, public MetadataSourceTagLib { public: - static QString getFileExtensionFromUrl(QUrl url); + static QString getFileExtensionFromUrl(const QUrl& url); QString getType() const { return m_type; @@ -24,10 +24,10 @@ class SoundSource protected: // If no type is provided the file extension of the file referred // by the URL will be used as the type of the SoundSource. - explicit SoundSource(QUrl url) + explicit SoundSource(const QUrl& url) : SoundSource(url, getFileExtensionFromUrl(url)) { } - SoundSource(QUrl url, QString type); + SoundSource(const QUrl& url, const QString& type); private: QString m_type; @@ -36,7 +36,7 @@ class SoundSource typedef std::shared_ptr SoundSourcePointer; template -SoundSourcePointer newSoundSourceFromUrl(QUrl url) { +SoundSourcePointer newSoundSourceFromUrl(const QUrl& url) { return std::make_shared(url); } diff --git a/src/sources/soundsourceffmpeg.cpp b/src/sources/soundsourceffmpeg.cpp index dbac60f01df..fb9cca8d788 100644 --- a/src/sources/soundsourceffmpeg.cpp +++ b/src/sources/soundsourceffmpeg.cpp @@ -973,17 +973,18 @@ const CSAMPLE* SoundSourceFFmpeg::resampleDecodedAVFrame() { } ReadableSampleFrames SoundSourceFFmpeg::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& originalWritableSampleFrames) { DEBUG_ASSERT(m_frameBuffer.signalInfo() == getSignalInfo()); const SINT readableStartIndex = - writableSampleFrames.frameIndexRange().start(); - const CSAMPLE* readableData = writableSampleFrames.writableData(); + originalWritableSampleFrames.frameIndexRange().start(); + const CSAMPLE* readableData = originalWritableSampleFrames.writableData(); #if VERBOSE_DEBUG_LOG - kLogger.debug() - << "readSampleFramesClamped:" - << "writableSampleFrames.frameIndexRange()" << writableSampleFrames.frameIndexRange(); + kLogger.debug() << "readSampleFramesClamped:" + << "originalWritableSampleFrames.frameIndexRange()" + << originalWritableSampleFrames.frameIndexRange(); #endif + WritableSampleFrames writableSampleFrames = originalWritableSampleFrames; // Consume all buffered sample data before decoding any new data if (m_frameBuffer.isReady()) { diff --git a/src/sources/soundsourceffmpeg.h b/src/sources/soundsourceffmpeg.h index c8e538caee1..762ba08f6f5 100644 --- a/src/sources/soundsourceffmpeg.h +++ b/src/sources/soundsourceffmpeg.h @@ -22,7 +22,7 @@ class SoundSourceFFmpeg : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourceflac.cpp b/src/sources/soundsourceflac.cpp index 3c1f18262f8..8f508bb046c 100644 --- a/src/sources/soundsourceflac.cpp +++ b/src/sources/soundsourceflac.cpp @@ -159,7 +159,7 @@ void SoundSourceFLAC::close() { } ReadableSampleFrames SoundSourceFLAC::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_curFrameIndex != firstFrameIndex) { diff --git a/src/sources/soundsourceflac.h b/src/sources/soundsourceflac.h index f191f9760ba..4714a22da93 100644 --- a/src/sources/soundsourceflac.h +++ b/src/sources/soundsourceflac.h @@ -29,7 +29,7 @@ class SoundSourceFLAC final : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcem4a.cpp b/src/sources/soundsourcem4a.cpp index e8810201867..992abce49ae 100644 --- a/src/sources/soundsourcem4a.cpp +++ b/src/sources/soundsourcem4a.cpp @@ -528,7 +528,7 @@ void SoundSourceM4A::restartDecoding(MP4SampleId sampleBlockId) { } ReadableSampleFrames SoundSourceM4A::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); bool retryAfterReopeningDecoder = false; diff --git a/src/sources/soundsourcem4a.h b/src/sources/soundsourcem4a.h index 62c5fd2a4da..1b58e745eee 100644 --- a/src/sources/soundsourcem4a.h +++ b/src/sources/soundsourcem4a.h @@ -34,7 +34,7 @@ class SoundSourceM4A : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcemediafoundation.cpp b/src/sources/soundsourcemediafoundation.cpp index d729758a2df..f2eb5e6e5aa 100644 --- a/src/sources/soundsourcemediafoundation.cpp +++ b/src/sources/soundsourcemediafoundation.cpp @@ -272,7 +272,7 @@ void SoundSourceMediaFoundation::seekSampleFrame(SINT frameIndex) { } ReadableSampleFrames SoundSourceMediaFoundation::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_currentFrameIndex != kUnknownFrameIndex) { seekSampleFrame(firstFrameIndex); diff --git a/src/sources/soundsourcemediafoundation.h b/src/sources/soundsourcemediafoundation.h index 429aa8ef595..1f02bcea4b6 100644 --- a/src/sources/soundsourcemediafoundation.h +++ b/src/sources/soundsourcemediafoundation.h @@ -64,7 +64,7 @@ class SoundSourceMediaFoundation : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcemodplug.cpp b/src/sources/soundsourcemodplug.cpp index 4d5e6be27f7..4d1520e5b04 100644 --- a/src/sources/soundsourcemodplug.cpp +++ b/src/sources/soundsourcemodplug.cpp @@ -32,7 +32,7 @@ const QStringList kSupportedFileExtensions = { /* read files in 512k chunks */ constexpr SINT kChunkSizeInBytes = SINT(1) << 19; -QString getModPlugTypeFromUrl(QUrl url) { +QString getModPlugTypeFromUrl(const QUrl& url) { const QString fileExtension(SoundSource::getFileExtensionFromUrl(url)); if (fileExtension == "mod") { return "Protracker"; @@ -207,7 +207,7 @@ void SoundSourceModPlug::close() { } ReadableSampleFrames SoundSourceModPlug::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT readOffset = getSignalInfo().frames2samples(writableSampleFrames.frameIndexRange().start()); const SINT readSamples = getSignalInfo().frames2samples(writableSampleFrames.frameLength()); SampleUtil::convertS16ToFloat32( diff --git a/src/sources/soundsourcemodplug.h b/src/sources/soundsourcemodplug.h index 8cef32ac403..baed964810a 100644 --- a/src/sources/soundsourcemodplug.h +++ b/src/sources/soundsourcemodplug.h @@ -34,7 +34,7 @@ class SoundSourceModPlug : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcemp3.cpp b/src/sources/soundsourcemp3.cpp index 98b6f03b78d..20ef444b8f9 100644 --- a/src/sources/soundsourcemp3.cpp +++ b/src/sources/soundsourcemp3.cpp @@ -530,7 +530,7 @@ SINT SoundSourceMp3::findSeekFrameIndex( } ReadableSampleFrames SoundSourceMp3::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if ((m_curFrameIndex != firstFrameIndex)) { diff --git a/src/sources/soundsourcemp3.h b/src/sources/soundsourcemp3.h index b17817ca035..bb83cd9b709 100644 --- a/src/sources/soundsourcemp3.h +++ b/src/sources/soundsourcemp3.h @@ -25,7 +25,7 @@ class SoundSourceMp3 final : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourceoggvorbis.cpp b/src/sources/soundsourceoggvorbis.cpp index 90c49f39823..50a1b65da7c 100644 --- a/src/sources/soundsourceoggvorbis.cpp +++ b/src/sources/soundsourceoggvorbis.cpp @@ -130,7 +130,7 @@ void SoundSourceOggVorbis::close() { } ReadableSampleFrames SoundSourceOggVorbis::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_curFrameIndex != firstFrameIndex) { diff --git a/src/sources/soundsourceoggvorbis.h b/src/sources/soundsourceoggvorbis.h index 2dd70fd4b19..2993974f961 100644 --- a/src/sources/soundsourceoggvorbis.h +++ b/src/sources/soundsourceoggvorbis.h @@ -19,7 +19,7 @@ class SoundSourceOggVorbis final : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourceopus.cpp b/src/sources/soundsourceopus.cpp index f54941da182..c5ade898601 100644 --- a/src/sources/soundsourceopus.cpp +++ b/src/sources/soundsourceopus.cpp @@ -300,7 +300,7 @@ void SoundSourceOpus::close() { } ReadableSampleFrames SoundSourceOpus::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_curFrameIndex != firstFrameIndex) { diff --git a/src/sources/soundsourceopus.h b/src/sources/soundsourceopus.h index 0a94205fba7..b3088007925 100644 --- a/src/sources/soundsourceopus.h +++ b/src/sources/soundsourceopus.h @@ -21,7 +21,7 @@ class SoundSourceOpus final : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcesndfile.cpp b/src/sources/soundsourcesndfile.cpp index dde13dca7a6..032c12b08f7 100644 --- a/src/sources/soundsourcesndfile.cpp +++ b/src/sources/soundsourcesndfile.cpp @@ -142,7 +142,7 @@ void SoundSourceSndFile::close() { } ReadableSampleFrames SoundSourceSndFile::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_curFrameIndex != firstFrameIndex) { diff --git a/src/sources/soundsourcesndfile.h b/src/sources/soundsourcesndfile.h index 89f786ea9d4..1958398ebf4 100644 --- a/src/sources/soundsourcesndfile.h +++ b/src/sources/soundsourcesndfile.h @@ -21,7 +21,7 @@ class SoundSourceSndFile final : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/soundsourcewv.cpp b/src/sources/soundsourcewv.cpp index 20e67b6a987..b37d9171bfc 100644 --- a/src/sources/soundsourcewv.cpp +++ b/src/sources/soundsourcewv.cpp @@ -131,7 +131,7 @@ void SoundSourceWV::close() { } ReadableSampleFrames SoundSourceWV::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { + const WritableSampleFrames& writableSampleFrames) { const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); if (m_curFrameIndex != firstFrameIndex) { diff --git a/src/sources/soundsourcewv.h b/src/sources/soundsourcewv.h index 36f36531a9c..bc99b912856 100644 --- a/src/sources/soundsourcewv.h +++ b/src/sources/soundsourcewv.h @@ -25,7 +25,7 @@ class SoundSourceWV : public SoundSource { protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: OpenResult tryOpen( diff --git a/src/sources/urlresource.h b/src/sources/urlresource.h index 315db7bb47c..747daf68c74 100644 --- a/src/sources/urlresource.h +++ b/src/sources/urlresource.h @@ -19,7 +19,7 @@ class UrlResource { } protected: - explicit UrlResource(QUrl url) + explicit UrlResource(const QUrl& url) : m_url(url) { } diff --git a/src/sources/v1/legacyaudiosourceadapter.cpp b/src/sources/v1/legacyaudiosourceadapter.cpp index c97eddfeed2..84d6db12e2b 100644 --- a/src/sources/v1/legacyaudiosourceadapter.cpp +++ b/src/sources/v1/legacyaudiosourceadapter.cpp @@ -20,8 +20,8 @@ LegacyAudioSourceAdapter::LegacyAudioSourceAdapter( } ReadableSampleFrames LegacyAudioSourceAdapter::readSampleFramesClamped( - WritableSampleFrames writableSampleFrames) { - const SINT firstFrameIndex = writableSampleFrames.frameIndexRange().start(); + const WritableSampleFrames& originalWritableSampleFrames) { + const SINT firstFrameIndex = originalWritableSampleFrames.frameIndexRange().start(); const SINT seekFrameIndex = m_pImpl->seekSampleFrame(firstFrameIndex); if (seekFrameIndex < firstFrameIndex) { @@ -39,6 +39,7 @@ ReadableSampleFrames LegacyAudioSourceAdapter::readSampleFramesClamped( } DEBUG_ASSERT(seekFrameIndex >= firstFrameIndex); + WritableSampleFrames writableSampleFrames = originalWritableSampleFrames; if (seekFrameIndex > firstFrameIndex) { const SINT unreadableFrameOffset = seekFrameIndex - firstFrameIndex; kLogger.warning() diff --git a/src/sources/v1/legacyaudiosourceadapter.h b/src/sources/v1/legacyaudiosourceadapter.h index 5b744dd5570..40aa362b702 100644 --- a/src/sources/v1/legacyaudiosourceadapter.h +++ b/src/sources/v1/legacyaudiosourceadapter.h @@ -16,7 +16,7 @@ class LegacyAudioSourceAdapter : public virtual /*implements*/ IAudioSourceReade protected: ReadableSampleFrames readSampleFramesClamped( - WritableSampleFrames sampleFrames) override; + const WritableSampleFrames& sampleFrames) override; private: AudioSource* m_pOwner; diff --git a/src/test/autodjprocessor_test.cpp b/src/test/autodjprocessor_test.cpp index dfb12f7e23c..0076aee44f7 100644 --- a/src/test/autodjprocessor_test.cpp +++ b/src/test/autodjprocessor_test.cpp @@ -121,7 +121,7 @@ class MockPlayerManager : public PlayerManagerInterface { virtual ~MockPlayerManager() { } - MOCK_CONST_METHOD1(getPlayer, BaseTrackPlayer*(QString)); + MOCK_CONST_METHOD1(getPlayer, BaseTrackPlayer*(const QString&)); MOCK_CONST_METHOD1(getDeck, Deck*(unsigned int)); MOCK_CONST_METHOD1(getPreviewDeck, PreviewDeck*(unsigned int)); MOCK_CONST_METHOD1(getSampler, Sampler*(unsigned int)); @@ -157,7 +157,7 @@ class MockAutoDJProcessor : public AutoDJProcessor { virtual ~MockAutoDJProcessor() { } - MOCK_METHOD3(emitLoadTrackToPlayer, void(TrackPointer, QString, bool)); + MOCK_METHOD3(emitLoadTrackToPlayer, void(TrackPointer, const QString&, bool)); MOCK_METHOD1(emitAutoDJStateChanged, void(AutoDJProcessor::AutoDJState)); }; diff --git a/src/test/controller_preset_validation_test.cpp b/src/test/controller_preset_validation_test.cpp index 415ca1920d8..77b830e8f1e 100644 --- a/src/test/controller_preset_validation_test.cpp +++ b/src/test/controller_preset_validation_test.cpp @@ -69,7 +69,7 @@ class FakeController : public Controller { } protected: - Q_INVOKABLE void send(QList data, unsigned int length, unsigned int reportID) { + Q_INVOKABLE void send(const QList& data, unsigned int length, unsigned int reportID) { Q_UNUSED(data); Q_UNUSED(length); Q_UNUSED(reportID); @@ -84,10 +84,10 @@ class FakeController : public Controller { } private: - void send(QByteArray data) override { + void send(const QByteArray& data) override { Q_UNUSED(data); } - virtual void send(QByteArray data, unsigned int reportID) { + virtual void send(const QByteArray& data, unsigned int reportID) { Q_UNUSED(data); Q_UNUSED(reportID); } diff --git a/src/test/coverartcache_test.cpp b/src/test/coverartcache_test.cpp index 7a9ef416583..44742d5b59b 100644 --- a/src/test/coverartcache_test.cpp +++ b/src/test/coverartcache_test.cpp @@ -11,7 +11,7 @@ // construct the default QPixmap in CoverArtCache class CoverArtCacheTest : public LibraryTest, public CoverArtCache { protected: - void loadCoverFromMetadata(QString trackLocation) { + void loadCoverFromMetadata(const QString& trackLocation) { CoverInfo info; info.type = CoverInfo::METADATA; info.source = CoverInfo::GUESSED; @@ -32,7 +32,9 @@ class CoverArtCacheTest : public LibraryTest, public CoverArtCache { EXPECT_EQ(img, res.coverArt.loadedImage.image); } - void loadCoverFromFile(QString trackLocation, QString coverLocation, QString absoluteCoverLocation) { + void loadCoverFromFile(const QString& trackLocation, + const QString& coverLocation, + const QString& absoluteCoverLocation) { const QImage img = QImage(absoluteCoverLocation); ASSERT_FALSE(img.isNull()); diff --git a/src/test/durationutiltest.cpp b/src/test/durationutiltest.cpp index a47649e4dbe..f918d1a3f5c 100644 --- a/src/test/durationutiltest.cpp +++ b/src/test/durationutiltest.cpp @@ -29,7 +29,7 @@ class DurationUtilTest : public testing::Test { } } - void formatTime(QString expectedMilliseconds, double dSeconds) { + void formatTime(const QString& expectedMilliseconds, double dSeconds) { const QString actualSeconds = mixxx::Duration::formatTime(dSeconds, mixxx::Duration::Precision::SECONDS); const QString expectedSeconds = @@ -45,7 +45,7 @@ class DurationUtilTest : public testing::Test { EXPECT_EQ(expectedMilliseconds, actualMilliseconds); } - void formatSeconds(QString expectedMilliseconds, double dSeconds) { + void formatSeconds(const QString& expectedMilliseconds, double dSeconds) { ASSERT_LE(4, expectedMilliseconds.length()); // 3 digits + 1 decimal point const QString actualSeconds = mixxx::Duration::formatSeconds(dSeconds, mixxx::Duration::Precision::SECONDS); @@ -62,7 +62,7 @@ class DurationUtilTest : public testing::Test { EXPECT_EQ(expectedMilliseconds, actualMilliseconds); } - void formatSecondsLong(QString expectedMilliseconds, double dSeconds) { + void formatSecondsLong(const QString& expectedMilliseconds, double dSeconds) { ASSERT_LE(4, expectedMilliseconds.length()); // 3 digits + 1 decimal point const QString actualSeconds = mixxx::Duration::formatSecondsLong(dSeconds, mixxx::Duration::Precision::SECONDS); @@ -79,7 +79,7 @@ class DurationUtilTest : public testing::Test { EXPECT_EQ(expectedMilliseconds, actualMilliseconds); } - void formatKiloSeconds(QString expectedMilliseconds, double dSeconds) { + void formatKiloSeconds(const QString& expectedMilliseconds, double dSeconds) { ASSERT_LE(4, expectedMilliseconds.length()); // 3 digits + 1 decimal point const QString actualSeconds = mixxx::Duration::formatKiloSeconds(dSeconds, mixxx::Duration::Precision::SECONDS); diff --git a/src/test/enginesynctest.cpp b/src/test/enginesynctest.cpp index c1dc3081337..d058fee95bb 100644 --- a/src/test/enginesynctest.cpp +++ b/src/test/enginesynctest.cpp @@ -34,14 +34,14 @@ class EngineSyncTest : public MockedEngineBackendTest { } return QString(); } - bool isExplicitMaster(QString group) { + bool isExplicitMaster(const QString& group) { return isMaster(group, true); } - bool isSoftMaster(QString group) { + bool isSoftMaster(const QString& group) { return isMaster(group, false); } - bool isFollower(QString group) { + bool isFollower(const QString& group) { if (group == m_sInternalClockGroup) { return !ControlObject::getControl(ConfigKey(m_sInternalClockGroup, "sync_master")) @@ -59,7 +59,7 @@ class EngineSyncTest : public MockedEngineBackendTest { return true; } - void assertSyncOff(QString group) { + void assertSyncOff(const QString& group) { if (group == m_sInternalClockGroup) { ASSERT_EQ(0, ControlObject::getControl( @@ -84,7 +84,7 @@ class EngineSyncTest : public MockedEngineBackendTest { } private: - bool isMaster(QString group, bool explicitMaster) { + bool isMaster(const QString& group, bool explicitMaster) { if (group == m_sInternalClockGroup) { if (!ControlObject::getControl(ConfigKey(m_sInternalClockGroup, "sync_master")) diff --git a/src/test/metadatatest.cpp b/src/test/metadatatest.cpp index c951a2ac0b9..83856e9f7fb 100644 --- a/src/test/metadatatest.cpp +++ b/src/test/metadatatest.cpp @@ -11,7 +11,7 @@ namespace { class MetadataTest : public testing::Test { protected: - double parseBpm(QString inputValue, bool expectedResult, double expectedValue) { + double parseBpm(const QString& inputValue, bool expectedResult, double expectedValue) { //qDebug() << "parseBpm" << inputValue << expectedResult << expectedValue; bool actualResult; diff --git a/src/test/midicontrollertest.cpp b/src/test/midicontrollertest.cpp index 1e44a89e850..0a801ca1952 100644 --- a/src/test/midicontrollertest.cpp +++ b/src/test/midicontrollertest.cpp @@ -22,7 +22,7 @@ class MockMidiController : public MidiController { MOCK_METHOD3(sendShortMsg, void(unsigned char status, unsigned char byte1, unsigned char byte2)); - MOCK_METHOD1(send, void(QByteArray data)); + MOCK_METHOD1(send, void(const QByteArray& data)); MOCK_CONST_METHOD0(isPolling, bool()); }; @@ -32,7 +32,7 @@ class MidiControllerTest : public MixxxTest { m_pController.reset(new MockMidiController(config())); } - void addMapping(MidiInputMapping mapping) { + void addMapping(const MidiInputMapping& mapping) { m_preset.addInputMapping(mapping.key.key, mapping); } diff --git a/src/test/playlisttest.cpp b/src/test/playlisttest.cpp index de75518c57e..47a1792e991 100644 --- a/src/test/playlisttest.cpp +++ b/src/test/playlisttest.cpp @@ -9,7 +9,7 @@ class DummyParser : public Parser { public: - QList parse(QString) override { + QList parse(const QString&) override { return QList(); } diff --git a/src/test/portmidicontroller_test.cpp b/src/test/portmidicontroller_test.cpp index 9d8fccdaa69..3c402cb4bc9 100644 --- a/src/test/portmidicontroller_test.cpp +++ b/src/test/portmidicontroller_test.cpp @@ -33,13 +33,13 @@ class MockPortMidiController : public PortMidiController { PortMidiController::sendShortMsg(status, byte1, byte2); } - void sendSysexMsg(QList data, unsigned int length) { + void sendSysexMsg(const QList& data, unsigned int length) { PortMidiController::sendSysexMsg(data, length); } MOCK_METHOD4(receive, void(unsigned char, unsigned char, unsigned char, mixxx::Duration)); - MOCK_METHOD2(receive, void(const QByteArray, mixxx::Duration)); + MOCK_METHOD2(receive, void(const QByteArray&, mixxx::Duration)); }; class MockPortMidiDevice : public PortMidiDevice { diff --git a/src/test/replaygaintest.cpp b/src/test/replaygaintest.cpp index ca23a529080..3696f0fd8e0 100644 --- a/src/test/replaygaintest.cpp +++ b/src/test/replaygaintest.cpp @@ -8,7 +8,7 @@ namespace { class ReplayGainTest : public testing::Test { protected: - double ratioFromString(QString inputValue, bool expectedResult, double expectedValue) { + double ratioFromString(const QString& inputValue, bool expectedResult, double expectedValue) { //qDebug() << "ratioFromString" << inputValue << expectedResult << expectedValue; bool actualResult; @@ -29,7 +29,7 @@ class ReplayGainTest : public testing::Test { } } - CSAMPLE peakFromString(QString inputValue, bool expectedResult, CSAMPLE expectedValue) { + CSAMPLE peakFromString(const QString& inputValue, bool expectedResult, CSAMPLE expectedValue) { //qDebug() << "peakFromString" << inputValue << expectedResult << expectedValue; bool actualResult; diff --git a/src/test/seratomarkers2test.cpp b/src/test/seratomarkers2test.cpp index 8e6f4be51dc..2a49814cd72 100644 --- a/src/test/seratomarkers2test.cpp +++ b/src/test/seratomarkers2test.cpp @@ -49,7 +49,7 @@ class SeratoMarkers2Test : public testing::Test { quint8 index, quint32 position, mixxx::RgbColor color, - QString label) { + const QString& label) { const mixxx::SeratoMarkers2EntryPointer parsedEntry = mixxx::SeratoMarkers2CueEntry::parse(inputValue); if (!parsedEntry) { EXPECT_FALSE(valid); @@ -72,7 +72,7 @@ class SeratoMarkers2Test : public testing::Test { quint32 startposition, quint32 endposition, bool locked, - QString label) { + const QString& label) { const mixxx::SeratoMarkers2EntryPointer parsedEntry = mixxx::SeratoMarkers2LoopEntry::parse(inputValue); if (!parsedEntry) { EXPECT_FALSE(valid); diff --git a/src/test/signalpathtest.h b/src/test/signalpathtest.h index af63a59e866..9a6c1ea8af3 100644 --- a/src/test/signalpathtest.h +++ b/src/test/signalpathtest.h @@ -144,8 +144,10 @@ class BaseSignalPathTest : public MixxxTest { // Use tools/AudioPlot.py to look at the reference file and make sure it // looks correct. Each line of the generated file contains the left sample // followed by the right sample. - void assertBufferMatchesReference(const CSAMPLE* pBuffer, const int iBufferSize, - QString reference_title, const double delta=.0001) { + void assertBufferMatchesReference(const CSAMPLE* pBuffer, + const int iBufferSize, + const QString& reference_title, + const double delta = .0001) { QFile f(QDir::currentPath() + "/src/test/reference_buffers/" + reference_title); bool pass = true; int i = 0; diff --git a/src/test/soundsourceproviderregistrytest.cpp b/src/test/soundsourceproviderregistrytest.cpp index 38a3d34ded3..2eccc5aa496 100644 --- a/src/test/soundsourceproviderregistrytest.cpp +++ b/src/test/soundsourceproviderregistrytest.cpp @@ -9,8 +9,8 @@ namespace mixxx { class TestSoundSourceProvider : public SoundSourceProvider { public: TestSoundSourceProvider( - QString displayName, - QStringList supportedFileExtensions, + const QString& displayName, + const QStringList& supportedFileExtensions, SoundSourceProviderPriority priorityHint) : m_displayName(displayName), m_supportedFileExtensions(supportedFileExtensions), @@ -56,8 +56,8 @@ class SoundSourceProviderRegistryTest : public testing::Test { } SoundSourceProviderPointer createProvider( - QString name, - QStringList supportedFileExtensions, + const QString& name, + const QStringList& supportedFileExtensions, SoundSourceProviderPriority priorityHint = SoundSourceProviderPriority::Default) { return SoundSourceProviderPointer( new TestSoundSourceProvider( @@ -65,7 +65,7 @@ class SoundSourceProviderRegistryTest : public testing::Test { } static QStringList getAllRegisteredProviderDisplayNamesForFileExtension( - const SoundSourceProviderRegistry& cut, QString fileExt) { + const SoundSourceProviderRegistry& cut, const QString& fileExt) { QStringList displayNames; const QList registrations( cut.getRegistrationsForFileExtension(fileExt)); diff --git a/src/test/trackexport_test.cpp b/src/test/trackexport_test.cpp index 6f6cce4e893..1227c0b1859 100644 --- a/src/test/trackexport_test.cpp +++ b/src/test/trackexport_test.cpp @@ -10,15 +10,15 @@ FakeOverwriteAnswerer::~FakeOverwriteAnswerer() { } -void FakeOverwriteAnswerer::slotProgress(QString filename, int progress, int count) { +void FakeOverwriteAnswerer::slotProgress(const QString& filename, int progress, int count) { m_progress_filename = filename; m_progress = progress; m_progress_count = count; } void FakeOverwriteAnswerer::slotAskOverwriteMode( - QString filename, - std::promise* promise) { + const QString& filename, + std::promise* promise) { auto it = m_answers.find(filename); // Make sure this filename is in the map, and then remove it. // The ASSERT_EQ macro has trouble with this comparison. diff --git a/src/test/trackexport_test.h b/src/test/trackexport_test.h index 8ae78b51de3..359d4db727d 100644 --- a/src/test/trackexport_test.h +++ b/src/test/trackexport_test.h @@ -25,8 +25,8 @@ class FakeOverwriteAnswerer : public QObject { } virtual ~FakeOverwriteAnswerer(); - void setAnswer(QString expected_filename, - TrackExportWorker::OverwriteAnswer answer) { + void setAnswer(const QString& expected_filename, + TrackExportWorker::OverwriteAnswer answer) { // We should never copy a duplicate filename, so if a name already // exists that's a bug in the test. Q_ASSERT(m_answers.find(expected_filename) == m_answers.end()); @@ -46,9 +46,9 @@ class FakeOverwriteAnswerer : public QObject { } public slots: - void slotProgress(QString filename, int progress, int count); + void slotProgress(const QString& filename, int progress, int count); void slotAskOverwriteMode( - QString filename, + const QString& filename, std::promise* promise); void cancelButtonClicked(); diff --git a/src/track/beatfactory.cpp b/src/track/beatfactory.cpp index a5fb85ff9d3..3e2b3da2795 100644 --- a/src/track/beatfactory.cpp +++ b/src/track/beatfactory.cpp @@ -7,8 +7,8 @@ #include "track/beatutils.h" mixxx::BeatsPointer BeatFactory::loadBeatsFromByteArray(const Track& track, - QString beatsVersion, - QString beatsSubVersion, + const QString& beatsVersion, + const QString& beatsSubVersion, const QByteArray& beatsSerialized) { if (beatsVersion == BEAT_GRID_1_VERSION || beatsVersion == BEAT_GRID_2_VERSION) { @@ -47,7 +47,7 @@ QString BeatFactory::getPreferredSubVersion( const bool bEnableOffsetCorrection, const int iMinBpm, const int iMaxBpm, - const QHash extraVersionInfo) { + const QHash& extraVersionInfo) { const char* kSubVersionKeyValueSeparator = "="; const char* kSubVersionFragmentSeparator = "|"; QStringList fragments; @@ -93,8 +93,8 @@ QString BeatFactory::getPreferredSubVersion( } mixxx::BeatsPointer BeatFactory::makePreferredBeats(const Track& track, - QVector beats, - const QHash extraVersionInfo, + const QVector& beats, + const QHash& extraVersionInfo, const bool bEnableFixedTempoCorrection, const bool bEnableOffsetCorrection, const int iSampleRate, diff --git a/src/track/beatfactory.h b/src/track/beatfactory.h index 786cbe8d4f2..c6c941bea80 100644 --- a/src/track/beatfactory.h +++ b/src/track/beatfactory.h @@ -10,8 +10,8 @@ class Track; class BeatFactory { public: static mixxx::BeatsPointer loadBeatsFromByteArray(const Track& track, - QString beatsVersion, - QString beatsSubVersion, + const QString& beatsVersion, + const QString& beatsSubVersion, const QByteArray& beatsSerialized); static mixxx::BeatsPointer makeBeatGrid(const Track& track, double dBpm, @@ -20,14 +20,15 @@ class BeatFactory { static QString getPreferredVersion(const bool bEnableFixedTempoCorrection); static QString getPreferredSubVersion( - const bool bEnableFixedTempoCorrection, - const bool bEnableOffsetCorrection, - const int iMinBpm, const int iMaxBpm, - const QHash extraVersionInfo); + const bool bEnableFixedTempoCorrection, + const bool bEnableOffsetCorrection, + const int iMinBpm, + const int iMaxBpm, + const QHash& extraVersionInfo); static mixxx::BeatsPointer makePreferredBeats(const Track& track, - QVector beats, - const QHash extraVersionInfo, + const QVector& beats, + const QHash& extraVersionInfo, const bool bEnableFixedTempoCorrection, const bool bEnableOffsetCorrection, const int iSampleRate, diff --git a/src/track/beatgrid.cpp b/src/track/beatgrid.cpp index c49f1316b09..81d9302cc77 100644 --- a/src/track/beatgrid.cpp +++ b/src/track/beatgrid.cpp @@ -129,7 +129,7 @@ QString BeatGrid::getSubVersion() const { return m_subVersion; } -void BeatGrid::setSubVersion(QString subVersion) { +void BeatGrid::setSubVersion(const QString& subVersion) { m_subVersion = subVersion; } diff --git a/src/track/beatgrid.h b/src/track/beatgrid.h index 6c2dde079a0..8ea9056951c 100644 --- a/src/track/beatgrid.h +++ b/src/track/beatgrid.h @@ -44,7 +44,7 @@ class BeatGrid final : public Beats { BeatsPointer clone() const override; QString getVersion() const override; QString getSubVersion() const override; - virtual void setSubVersion(QString subVersion); + virtual void setSubVersion(const QString& subVersion); //////////////////////////////////////////////////////////////////////////// // Beat calculations diff --git a/src/track/beatmap.cpp b/src/track/beatmap.cpp index d486beaeb00..4029064e436 100644 --- a/src/track/beatmap.cpp +++ b/src/track/beatmap.cpp @@ -36,7 +36,7 @@ namespace mixxx { class BeatMapIterator : public BeatIterator { public: - BeatMapIterator(BeatList::const_iterator start, BeatList::const_iterator end) + BeatMapIterator(const BeatList::const_iterator& start, const BeatList::const_iterator& end) : m_currentBeat(start), m_endBeat(end) { // Advance to the first enabled beat. @@ -165,7 +165,7 @@ QString BeatMap::getSubVersion() const { return m_subVersion; } -void BeatMap::setSubVersion(QString subVersion) { +void BeatMap::setSubVersion(const QString& subVersion) { m_subVersion = subVersion; } diff --git a/src/track/beatmap.h b/src/track/beatmap.h index 0dad8d31638..d6ad4e7b325 100644 --- a/src/track/beatmap.h +++ b/src/track/beatmap.h @@ -52,7 +52,7 @@ class BeatMap final : public Beats { BeatsPointer clone() const override; QString getVersion() const override; QString getSubVersion() const override; - virtual void setSubVersion(QString subVersion); + virtual void setSubVersion(const QString& subVersion); //////////////////////////////////////////////////////////////////////////// // Beat calculations diff --git a/src/track/beatutils.cpp b/src/track/beatutils.cpp index 1eb2a0afd6f..503de69dc16 100644 --- a/src/track/beatutils.cpp +++ b/src/track/beatutils.cpp @@ -61,7 +61,7 @@ void BeatUtils::printBeatStatistics(const QVector& beats, int SampleRate // Given a sorted set of numbers, find the sample median. // http://en.wikipedia.org/wiki/Median#The_sample_median -double BeatUtils::computeSampleMedian(QList sortedItems) { +double BeatUtils::computeSampleMedian(const QList& sortedItems) { if (sortedItems.empty()) { return 0.0; } @@ -82,8 +82,11 @@ double BeatUtils::computeSampleMedian(QList sortedItems) { } QList BeatUtils::computeWindowedBpmsAndFrequencyHistogram( - const QVector beats, const int windowSize, const int windowStep, - const int sampleRate, QMap* frequencyHistogram) { + const QVector& beats, + const int windowSize, + const int windowStep, + const int sampleRate, + QMap* frequencyHistogram) { QList averageBpmList; for (int i = windowSize; i < beats.size(); i += windowStep) { //get start and end sample of the beats @@ -107,10 +110,10 @@ QList BeatUtils::computeWindowedBpmsAndFrequencyHistogram( } double BeatUtils::computeFilteredWeightedAverage( - const QMap frequencyTable, - const double filterCenter, - const double filterTolerance, - QMap* filteredFrequencyTable) { + const QMap& frequencyTable, + const double filterCenter, + const double filterTolerance, + QMap* filteredFrequencyTable) { double filterWeightedAverage = 0.0; int filterSum = 0; QMapIterator i(frequencyTable); @@ -312,9 +315,10 @@ double BeatUtils::calculateBpm(const QVector& beats, int SampleRate, return constrainedBpm; } -double BeatUtils::calculateOffset( - const QVector beats1, const double bpm1, - const QVector beats2, const int SampleRate) { +double BeatUtils::calculateOffset(const QVector& beats1, + const double bpm1, + const QVector& beats2, + const int SampleRate) { /* * Here we compare to beats vector and try to determine the best offset * based on the occurrences, i.e. by assuming that the almost correct beats @@ -354,8 +358,9 @@ double BeatUtils::calculateOffset( return floor(bestOffset + beatLength1Epsilon); } -double BeatUtils::findFirstCorrectBeat(const QVector rawbeats, - const int SampleRate, const double global_bpm) { +double BeatUtils::findFirstCorrectBeat(const QVector& rawbeats, + const int SampleRate, + const double global_bpm) { for (int i = N; i < rawbeats.size(); i++) { // get start and end sample of the beats double start_sample = rawbeats.at(i-N); @@ -384,9 +389,11 @@ double BeatUtils::findFirstCorrectBeat(const QVector rawbeats, // static double BeatUtils::calculateFixedTempoFirstBeat( - bool enableOffsetCorrection, - const QVector rawbeats, const int sampleRate, - const int totalSamples, const double globalBpm) { + bool enableOffsetCorrection, + const QVector& rawbeats, + const int sampleRate, + const int totalSamples, + const double globalBpm) { if (rawbeats.size() == 0) { return 0; } diff --git a/src/track/beatutils.h b/src/track/beatutils.h index 906e5f00fd8..10a6a8b49fd 100644 --- a/src/track/beatutils.h +++ b/src/track/beatutils.h @@ -47,15 +47,17 @@ class BeatUtils { */ static double calculateBpm(const QVector& beats, int SampleRate, int min_bpm, int max_bpm); - static double findFirstCorrectBeat(const QVector rawBeats, - const int SampleRate, const double global_bpm); + static double findFirstCorrectBeat(const QVector& rawBeats, + const int SampleRate, + const double global_bpm); /* This implement a method to find the best offset so that * the grid generated from bpm is close enough to the one we get from vamp. */ - static double calculateOffset( - const QVector beats1, const double bpm1, - const QVector beats2, const int SampleRate); + static double calculateOffset(const QVector& beats1, + const double bpm1, + const QVector& beats2, + const int SampleRate); // By default Vamp does not assume a 4/4 signature. This is basically a good // property of Vamp, however, it leads to inaccurate beat grids if a 4/4 @@ -64,21 +66,25 @@ class BeatUtils { // positions, this method calculates the position of the first beat assuming // the beats have a fixed tempo given by globalBpm. static double calculateFixedTempoFirstBeat( - bool enableOffsetCorrection, - const QVector rawbeats, const int sampleRate, - const int totalSamples, const double globalBpm); + bool enableOffsetCorrection, + const QVector& rawbeats, + const int sampleRate, + const int totalSamples, + const double globalBpm); private: - static double computeSampleMedian(QList sortedItems); + static double computeSampleMedian(const QList& sortedItems); static double computeFilteredWeightedAverage( - const QMap frequencyTable, - const double filterCenter, - const double filterTolerance, - QMap* filteredFrequencyTable); + const QMap& frequencyTable, + const double filterCenter, + const double filterTolerance, + QMap* filteredFrequencyTable); static QList computeWindowedBpmsAndFrequencyHistogram( - const QVector beats, const int windowSize, const int windowStep, - const int sampleRate, QMap* frequencyHistogram); - + const QVector& beats, + const int windowSize, + const int windowStep, + const int sampleRate, + QMap* frequencyHistogram); }; #endif /* BEATUTILS_H_ */ diff --git a/src/track/cue.cpp b/src/track/cue.cpp index f431513138e..3d1c0c1fe2d 100644 --- a/src/track/cue.cpp +++ b/src/track/cue.cpp @@ -64,7 +64,7 @@ Cue::Cue( double position, double length, int hotCue, - QString label, + const QString& label, mixxx::RgbColor color) : m_bDirty(false), // clear flag after loading from database m_dbId(id), @@ -243,7 +243,7 @@ QString Cue::getLabel() const { return m_label; } -void Cue::setLabel(const QString label) { +void Cue::setLabel(const QString& label) { QMutexLocker lock(&m_mutex); if (m_label == label) { return; diff --git a/src/track/cue.h b/src/track/cue.h index 3a3f05197f1..8362a56c32c 100644 --- a/src/track/cue.h +++ b/src/track/cue.h @@ -34,7 +34,7 @@ class Cue : public QObject { double position, double length, int hotCue, - QString label, + const QString& label, mixxx::RgbColor color); ~Cue() override = default; @@ -60,7 +60,7 @@ class Cue : public QObject { QString getLabel() const; void setLabel( - QString label = QString()); + const QString& label = QString()); mixxx::RgbColor getColor() const; void setColor(mixxx::RgbColor color); diff --git a/src/track/cueinfo.cpp b/src/track/cueinfo.cpp index c1f184e4418..4e46bd77eb8 100644 --- a/src/track/cueinfo.cpp +++ b/src/track/cueinfo.cpp @@ -17,7 +17,7 @@ CueInfo::CueInfo( std::optional startPositionMillis, std::optional endPositionMillis, std::optional hotCueNumber, - QString label, + const QString& label, mixxx::RgbColor::optional_t color) : m_type(type), m_startPositionMillis(startPositionMillis), @@ -63,7 +63,7 @@ QString CueInfo::getLabel() const { return m_label; } -void CueInfo::setLabel(QString label) { +void CueInfo::setLabel(const QString& label) { m_label = label; } diff --git a/src/track/cueinfo.h b/src/track/cueinfo.h index 94e38320f63..9ce4d8ea861 100644 --- a/src/track/cueinfo.h +++ b/src/track/cueinfo.h @@ -29,7 +29,7 @@ class CueInfo { std::optional startPositionMillis, std::optional endPositionMillis, std::optional hotCueNumber, - QString label, + const QString& label, RgbColor::optional_t color); CueType getType() const; @@ -49,7 +49,7 @@ class CueInfo { QString getLabel() const; void setLabel( - QString label = QString()); + const QString& label = QString()); mixxx::RgbColor::optional_t getColor() const; void setColor( diff --git a/src/track/globaltrackcache.cpp b/src/track/globaltrackcache.cpp index 58637ffbcd9..d3ea85771d1 100644 --- a/src/track/globaltrackcache.cpp +++ b/src/track/globaltrackcache.cpp @@ -35,7 +35,7 @@ TrackRef createTrackRef(const Track& track) { } TrackRef validateAndCanonicalizeRequestedTrackRef( - const TrackRef requestedTrackRef, + const TrackRef& requestedTrackRef, const Track& cachedTrack) { const auto cachedTrackRef = createTrackRef(cachedTrack); // If an id has been provided the caller expects that if a track @@ -697,7 +697,7 @@ void GlobalTrackCache::resolve( TrackRef GlobalTrackCache::initTrackId( const TrackPointer& strongPtr, - TrackRef trackRef, + const TrackRef& trackRef, TrackId trackId) { DEBUG_ASSERT(strongPtr); DEBUG_ASSERT(!trackRef.getId().isValid()); diff --git a/src/track/globaltrackcache.h b/src/track/globaltrackcache.h index d66c7f3a541..56a7a8a4cab 100644 --- a/src/track/globaltrackcache.h +++ b/src/track/globaltrackcache.h @@ -263,7 +263,7 @@ class GlobalTrackCache : public QObject { TrackRef initTrackId( const TrackPointer& strongPtr, - TrackRef trackRef, + const TrackRef& trackRef, TrackId trackId); void purgeTrackId(TrackId trackId); diff --git a/src/track/replaygain.cpp b/src/track/replaygain.cpp index c2a1ed01466..e6a4f3862be 100644 --- a/src/track/replaygain.cpp +++ b/src/track/replaygain.cpp @@ -54,7 +54,7 @@ QString normalizeNumberString(const QString& number, bool* pValid) { } // anonymous namespace -double ReplayGain::ratioFromString(QString dbGain, bool* pValid) { +double ReplayGain::ratioFromString(const QString& dbGain, bool* pValid) { if (pValid) { *pValid = false; } @@ -110,7 +110,7 @@ double ReplayGain::normalizeRatio(double ratio) { } } -CSAMPLE ReplayGain::peakFromString(QString strPeak, bool* pValid) { +CSAMPLE ReplayGain::peakFromString(const QString& strPeak, bool* pValid) { if (pValid) { *pValid = false; } diff --git a/src/track/replaygain.h b/src/track/replaygain.h index ca17df25a81..8f47ed44bfc 100644 --- a/src/track/replaygain.h +++ b/src/track/replaygain.h @@ -63,7 +63,7 @@ class ReplayGain final { // Parsing and formatting of gain values according to the // ReplayGain 1.0/2.0 specification. - static double ratioFromString(QString dBGain, bool* pValid = 0); + static double ratioFromString(const QString& dBGain, bool* pValid = 0); static QString ratioToString(double ratio); static double normalizeRatio(double ratio); @@ -87,7 +87,7 @@ class ReplayGain final { // Parsing and formatting of peak amplitude values according to // the ReplayGain 1.0/2.0 specification. - static CSAMPLE peakFromString(QString strPeak, bool* pValid = 0); + static CSAMPLE peakFromString(const QString& strPeak, bool* pValid = 0); static QString peakToString(CSAMPLE peak); static CSAMPLE normalizePeak(CSAMPLE peak); diff --git a/src/track/serato/beatgrid.h b/src/track/serato/beatgrid.h index ac3baf07d9f..77f03c91963 100644 --- a/src/track/serato/beatgrid.h +++ b/src/track/serato/beatgrid.h @@ -109,7 +109,9 @@ class SeratoBeatGrid final { const QList& nonTerminalMarkers() const { return m_nonTerminalMarkers; } - void setNonTerminalMarkers(QList nonTerminalMarkers) { + void setNonTerminalMarkers( + const QList& + nonTerminalMarkers) { m_nonTerminalMarkers = nonTerminalMarkers; } diff --git a/src/track/serato/beatsimporter.cpp b/src/track/serato/beatsimporter.cpp index a7ffe4175a4..9c0007885f4 100644 --- a/src/track/serato/beatsimporter.cpp +++ b/src/track/serato/beatsimporter.cpp @@ -10,7 +10,7 @@ SeratoBeatsImporter::SeratoBeatsImporter() } SeratoBeatsImporter::SeratoBeatsImporter( - QList nonTerminalMarkers, + const QList& nonTerminalMarkers, SeratoBeatGridTerminalMarkerPointer pTerminalMarker) : BeatsImporter(), m_nonTerminalMarkers(nonTerminalMarkers), diff --git a/src/track/serato/beatsimporter.h b/src/track/serato/beatsimporter.h index 31151f48188..bebe8d2758d 100644 --- a/src/track/serato/beatsimporter.h +++ b/src/track/serato/beatsimporter.h @@ -11,7 +11,7 @@ class SeratoBeatsImporter : public BeatsImporter { public: SeratoBeatsImporter(); SeratoBeatsImporter( - QList nonTerminalMarkers, + const QList& nonTerminalMarkers, SeratoBeatGridTerminalMarkerPointer pTerminalMarker); ~SeratoBeatsImporter() override = default; diff --git a/src/track/serato/markers.h b/src/track/serato/markers.h index 896a5cc1a50..d4a32a4a531 100644 --- a/src/track/serato/markers.h +++ b/src/track/serato/markers.h @@ -158,7 +158,7 @@ class SeratoMarkers final { const QList& getEntries() const { return m_entries; } - void setEntries(QList entries) { + void setEntries(const QList& entries) { m_entries = entries; } diff --git a/src/track/serato/markers2.h b/src/track/serato/markers2.h index 89e89a8de83..96917a77565 100644 --- a/src/track/serato/markers2.h +++ b/src/track/serato/markers2.h @@ -177,7 +177,7 @@ inline QDebug operator<<(QDebug dbg, const SeratoMarkers2ColorEntry& arg) { class SeratoMarkers2CueEntry : public SeratoMarkers2Entry { public: - SeratoMarkers2CueEntry(quint8 index, quint32 position, RgbColor color, QString label) + SeratoMarkers2CueEntry(quint8 index, quint32 position, RgbColor color, const QString& label) : m_index(index), m_position(position), m_color(color), @@ -225,7 +225,7 @@ class SeratoMarkers2CueEntry : public SeratoMarkers2Entry { return m_label; } - void setLabel(QString label) { + void setLabel(const QString& label) { m_label = label; } @@ -265,7 +265,7 @@ class SeratoMarkers2LoopEntry : public SeratoMarkers2Entry { quint32 endposition, RgbColor color, bool locked, - QString label) + const QString& label) : m_index(index), m_startposition(startposition), m_endposition(endposition), @@ -331,7 +331,7 @@ class SeratoMarkers2LoopEntry : public SeratoMarkers2Entry { return m_label; } - void setLabel(QString label) { + void setLabel(const QString& label) { m_label = label; } diff --git a/src/track/track.cpp b/src/track/track.cpp index 75e4fa3c299..97f5c818c7f 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -140,7 +140,7 @@ void Track::relocate( void Track::importMetadata( mixxx::TrackMetadata importedMetadata, - QDateTime metadataSynchronized) { + const QDateTime& metadataSynchronized) { // Safe some values that are needed after move assignment and unlocking(see below) const auto newBpm = importedMetadata.getTrackInfo().getBpm(); const auto newKey = importedMetadata.getTrackInfo().getKey(); diff --git a/src/track/track.h b/src/track/track.h index 802b298c435..7e58b395371 100644 --- a/src/track/track.h +++ b/src/track/track.h @@ -315,7 +315,7 @@ class Track : public QObject { // Set/get track metadata and cover art (optional) all at once. void importMetadata( mixxx::TrackMetadata importedMetadata, - QDateTime metadataSynchronized = QDateTime()); + const QDateTime& metadataSynchronized = QDateTime()); // Merge additional metadata that is not (yet) stored in the database // and only available from file tags. void mergeImportedMetadata( diff --git a/src/track/trackmetadata.cpp b/src/track/trackmetadata.cpp index cc7d5b94324..692326ea0ba 100644 --- a/src/track/trackmetadata.cpp +++ b/src/track/trackmetadata.cpp @@ -75,8 +75,7 @@ bool TrackMetadata::updateAudioPropertiesFromStream( return changed; } - -int TrackMetadata::parseCalendarYear(QString year, bool* pValid) { +int TrackMetadata::parseCalendarYear(const QString& year, bool* pValid) { const QDateTime dateTime(parseDateTime(year)); if (0 < dateTime.date().year()) { if (pValid) { @@ -104,7 +103,7 @@ int TrackMetadata::parseCalendarYear(QString year, bool* pValid) { } } -QString TrackMetadata::formatCalendarYear(QString year, bool* pValid) { +QString TrackMetadata::formatCalendarYear(const QString& year, bool* pValid) { bool calendarYearValid = false; int calendarYear = parseCalendarYear(year, &calendarYearValid); if (pValid) { @@ -117,7 +116,7 @@ QString TrackMetadata::formatCalendarYear(QString year, bool* pValid) { } } -QString TrackMetadata::reformatYear(QString year) { +QString TrackMetadata::reformatYear(const QString& year) { const QDateTime dateTime(parseDateTime(year)); if (dateTime.isValid()) { // date/time diff --git a/src/track/trackmetadata.h b/src/track/trackmetadata.h index 586e21b028e..bae8ee188e2 100644 --- a/src/track/trackmetadata.h +++ b/src/track/trackmetadata.h @@ -58,25 +58,25 @@ class TrackMetadata final { Bpm::Comparison cmpBpm = Bpm::Comparison::Default) const; // Parse an format date/time values according to ISO 8601 - static QDate parseDate(QString str) { + static QDate parseDate(const QString& str) { return QDate::fromString(str.trimmed().replace(" ", ""), Qt::ISODate); } - static QDateTime parseDateTime(QString str) { + static QDateTime parseDateTime(const QString& str) { return QDateTime::fromString(str.trimmed().replace(" ", ""), Qt::ISODate); } static QString formatDate(QDate date) { return date.toString(Qt::ISODate); } - static QString formatDateTime(QDateTime dateTime) { + static QString formatDateTime(const QDateTime& dateTime) { return dateTime.toString(Qt::ISODate); } // Parse and format the calendar year (for simplified display) static constexpr int kCalendarYearInvalid = 0; - static int parseCalendarYear(QString year, bool* pValid = nullptr); - static QString formatCalendarYear(QString year, bool* pValid = nullptr); + static int parseCalendarYear(const QString& year, bool* pValid = nullptr); + static QString formatCalendarYear(const QString& year, bool* pValid = nullptr); - static QString reformatYear(QString year); + static QString reformatYear(const QString& year); }; bool operator==(const TrackMetadata& lhs, const TrackMetadata& rhs); diff --git a/src/track/tracknumbers.cpp b/src/track/tracknumbers.cpp index a379b089459..f14105c85ec 100644 --- a/src/track/tracknumbers.cpp +++ b/src/track/tracknumbers.cpp @@ -66,7 +66,7 @@ TrackNumbers::ParseResult TrackNumbers::parseFromString( //static void TrackNumbers::splitString( - QString str, + const QString& str, QString* pActualText, QString* pTotalText) { // NOTE(uklotzde): The input string must be passed by value and diff --git a/src/track/tracknumbers.h b/src/track/tracknumbers.h index 7e591b953df..70a8cdc9b5c 100644 --- a/src/track/tracknumbers.h +++ b/src/track/tracknumbers.h @@ -97,7 +97,7 @@ class TrackNumbers final { // output parameters pActualText and pTotalText are // optional and the caller might pass a nullptr. static void splitString( - QString str, + const QString& str, QString* pActualText = nullptr, QString* pTotalText = nullptr); // Joins the actual and total strings diff --git a/src/util/color/colorpalette.h b/src/util/color/colorpalette.h index b3c4872013a..48a8d0c3c8d 100644 --- a/src/util/color/colorpalette.h +++ b/src/util/color/colorpalette.h @@ -10,9 +10,9 @@ class ColorPalette final { public: ColorPalette( - QString name, - QList colorList, - QList colorIndicesByHotcue = {}) + const QString& name, + const QList& colorList, + const QList& colorIndicesByHotcue = {}) : m_name(name), m_colorList(colorList), m_colorIndicesByHotcue(colorIndicesByHotcue) { @@ -49,7 +49,7 @@ class ColorPalette final { return m_name; } - void setName(const QString name) { + void setName(const QString& name) { m_name = name; } diff --git a/src/util/db/dbconnection.cpp b/src/util/db/dbconnection.cpp index 850c47c55aa..e9b65d31888 100644 --- a/src/util/db/dbconnection.cpp +++ b/src/util/db/dbconnection.cpp @@ -24,7 +24,7 @@ const mixxx::Logger kLogger("DbConnection"); QSqlDatabase createDatabase( const DbConnection::Params& params, - const QString connectionName) { + const QString& connectionName) { kLogger.info() << "Available drivers for database connections:" << QSqlDatabase::drivers(); @@ -41,7 +41,7 @@ QSqlDatabase createDatabase( QSqlDatabase cloneDatabase( const QSqlDatabase& database, - const QString connectionName) { + const QString& connectionName) { DEBUG_ASSERT(!database.isOpen()); return QSqlDatabase::cloneDatabase(database, connectionName); } @@ -233,7 +233,7 @@ void sqliteLike(sqlite3_context *context, #endif // __SQLITE3__ -bool initDatabase(QSqlDatabase database, StringCollator* pCollator) { +bool initDatabase(const QSqlDatabase& database, StringCollator* pCollator) { DEBUG_ASSERT(database.isOpen()); #ifdef __SQLITE3__ QVariant v = database.driver()->handle(); diff --git a/src/util/db/fwdsqlquery.cpp b/src/util/db/fwdsqlquery.cpp index d11b5327e97..d3b0467475b 100644 --- a/src/util/db/fwdsqlquery.cpp +++ b/src/util/db/fwdsqlquery.cpp @@ -33,10 +33,10 @@ bool prepareQuery(QSqlQuery& query, const QString& statement) { } // anonymous namespace FwdSqlQuery::FwdSqlQuery( - QSqlDatabase database, + const QSqlDatabase& database, const QString& statement) - : QSqlQuery(database), - m_prepared(prepareQuery(*this, statement)) { + : QSqlQuery(database), + m_prepared(prepareQuery(*this, statement)) { if (!m_prepared) { DEBUG_ASSERT(!database.isOpen() || hasError()); kLogger.critical() diff --git a/src/util/db/fwdsqlquery.h b/src/util/db/fwdsqlquery.h index 734c2c1392b..2ab24135874 100644 --- a/src/util/db/fwdsqlquery.h +++ b/src/util/db/fwdsqlquery.h @@ -36,7 +36,7 @@ class FwdSqlQuery: protected QSqlQuery { public: FwdSqlQuery( - QSqlDatabase database, + const QSqlDatabase& database, const QString& statement); bool isPrepared() const { diff --git a/src/util/db/sqlqueryfinisher.h b/src/util/db/sqlqueryfinisher.h index 2eb16525dc8..299bb7733b1 100644 --- a/src/util/db/sqlqueryfinisher.h +++ b/src/util/db/sqlqueryfinisher.h @@ -10,9 +10,9 @@ // resources of prepared statements until the next execution. class SqlQueryFinisher final { public: - explicit SqlQueryFinisher(QSqlQuery query) - : m_query(query) { // implicitly shared (not copied) - } + explicit SqlQueryFinisher(const QSqlQuery& query) + : m_query(query) { // implicitly shared (not copied) + } SqlQueryFinisher(SqlQueryFinisher&& other) : m_query(std::move(other.m_query)) { // implicitly shared (not moved) other.release(); diff --git a/src/util/db/sqlstorage.h b/src/util/db/sqlstorage.h index fa42bf4ab20..7b5fb461a55 100644 --- a/src/util/db/sqlstorage.h +++ b/src/util/db/sqlstorage.h @@ -18,7 +18,7 @@ class SqlStorage { // strayed rows should be deleted. // This function will only be called while no database // is attached to avoid invalidation of internal caches! - virtual void repairDatabase(QSqlDatabase database) = 0; + virtual void repairDatabase(const QSqlDatabase& database) = 0; // Attach an open database connection to the storage class. // Implementations might need to do the following: @@ -29,7 +29,7 @@ class SqlStorage { // until it is detached (see below). Implementations must // store an implicitly shared copy of the QSqlDatabase for // accessing it. - virtual void connectDatabase(QSqlDatabase database) = 0; + virtual void connectDatabase(const QSqlDatabase& database) = 0; // Detach the currently attached database, e.g. before // closing it. diff --git a/src/util/debug.h b/src/util/debug.h index e1a59e86bde..f405e70b8a4 100644 --- a/src/util/debug.h +++ b/src/util/debug.h @@ -23,7 +23,7 @@ QString toDebugString(const T& object) { // the Qt event loop to continue processing. This means that you must not call // this function from a code section which is not re-entrant (e.g. paintEvent on // a QWidget). -inline void reportFatalErrorAndQuit(QString message) { +inline void reportFatalErrorAndQuit(const QString& message) { QByteArray message_bytes = message.toLocal8Bit(); qFatal("%s", message_bytes.constData()); ErrorDialogHandler* dialogHandler = ErrorDialogHandler::instance(); @@ -37,7 +37,7 @@ inline void reportFatalErrorAndQuit(QString message) { // user which allows the Qt event loop to continue processing. This means that // you must not call this function from a code section which is not re-entrant // (e.g. paintEvent on a QWidget). -inline void reportCriticalErrorAndQuit(QString message) { +inline void reportCriticalErrorAndQuit(const QString& message) { qCritical() << message; ErrorDialogHandler* dialogHandler = ErrorDialogHandler::instance(); if (dialogHandler) { diff --git a/src/util/dnd.cpp b/src/util/dnd.cpp index 947e435b4d3..5dd3c3d11f4 100644 --- a/src/util/dnd.cpp +++ b/src/util/dnd.cpp @@ -15,7 +15,7 @@ namespace { QDrag* dragUrls( const QList& trackUrls, QWidget* pDragSource, - QString sourceIdentifier) { + const QString& sourceIdentifier) { if (trackUrls.isEmpty()) { return NULL; } @@ -188,7 +188,7 @@ bool DragAndDropHelper::dragEnterAccept( QDrag* DragAndDropHelper::dragTrack( TrackPointer pTrack, QWidget* pDragSource, - QString sourceIdentifier) { + const QString& sourceIdentifier) { QList trackUrls; trackUrls.append(pTrack->getFileInfo().toUrl()); return dragUrls(trackUrls, pDragSource, sourceIdentifier); @@ -198,7 +198,7 @@ QDrag* DragAndDropHelper::dragTrack( QDrag* DragAndDropHelper::dragTrackLocations( const QList& locations, QWidget* pDragSource, - QString sourceIdentifier) { + const QString& sourceIdentifier) { QList trackUrls; foreach (QString location, locations) { trackUrls.append(TrackFile(location).toUrl()); diff --git a/src/util/dnd.h b/src/util/dnd.h index 77d2b5a077c..efd4d40e37e 100644 --- a/src/util/dnd.h +++ b/src/util/dnd.h @@ -34,12 +34,12 @@ class DragAndDropHelper final { static QDrag* dragTrack( TrackPointer pTrack, QWidget* pDragSource, - QString sourceIdentifier); + const QString& sourceIdentifier); static QDrag* dragTrackLocations( const QList& locations, QWidget* pDragSource, - QString sourceIdentifier); + const QString& sourceIdentifier); static void handleTrackDragEnterEvent( QDragEnterEvent* event, diff --git a/src/util/translations.h b/src/util/translations.h index 7597e0e675f..117cb2a402f 100644 --- a/src/util/translations.h +++ b/src/util/translations.h @@ -78,9 +78,12 @@ class Translations { } private: - static bool loadTranslations(const QLocale& systemLocale, QString userLocale, - const QString& translation, const QString& prefix, - const QString& translationPath, QTranslator* pTranslator) { + static bool loadTranslations(const QLocale& systemLocale, + const QString& userLocale, + const QString& translation, + const QString& prefix, + const QString& translationPath, + QTranslator* pTranslator) { if (userLocale.size() == 0) { QStringList uiLanguages = systemLocale.uiLanguages(); if (uiLanguages.size() > 0 && uiLanguages.first() == "en") { diff --git a/src/util/valuetransformer.cpp b/src/util/valuetransformer.cpp index f62da80ad2e..f412d0da869 100644 --- a/src/util/valuetransformer.cpp +++ b/src/util/valuetransformer.cpp @@ -25,8 +25,8 @@ double ValueTransformer::transformInverse(double argument) const { } // static -ValueTransformer* ValueTransformer::parseFromXml(QDomElement transformElement, - const SkinContext& context) { +ValueTransformer* ValueTransformer::parseFromXml(const QDomElement& transformElement, + const SkinContext& context) { if (transformElement.isNull() || !transformElement.hasChildNodes()) { return NULL; } diff --git a/src/util/valuetransformer.h b/src/util/valuetransformer.h index 7d84369202e..12018c666b9 100644 --- a/src/util/valuetransformer.h +++ b/src/util/valuetransformer.h @@ -84,8 +84,8 @@ class ValueTransformer { double transform(double argument) const; double transformInverse(double argument) const; - static ValueTransformer* parseFromXml(QDomElement transformElement, - const SkinContext& context); + static ValueTransformer* parseFromXml(const QDomElement& transformElement, + const SkinContext& context); private: ValueTransformer(); diff --git a/src/vinylcontrol/vinylcontrol.cpp b/src/vinylcontrol/vinylcontrol.cpp index bf8552e3cd9..9f89c12281c 100644 --- a/src/vinylcontrol/vinylcontrol.cpp +++ b/src/vinylcontrol/vinylcontrol.cpp @@ -2,11 +2,12 @@ #include "control/controlproxy.h" #include "control/controlobject.h" -VinylControl::VinylControl(UserSettingsPointer pConfig, QString group) +VinylControl::VinylControl(UserSettingsPointer pConfig, const QString& group) : m_pConfig(pConfig), m_group(group), m_iLeadInTime(m_pConfig->getValueString( - ConfigKey(group, "vinylcontrol_lead_in_time")).toInt()), + ConfigKey(group, "vinylcontrol_lead_in_time")) + .toInt()), m_dVinylPosition(0.0), m_fTimecodeQuality(0.0f) { // Get Control objects diff --git a/src/vinylcontrol/vinylcontrol.h b/src/vinylcontrol/vinylcontrol.h index 805cc8dbdf2..cdc142fc0a4 100644 --- a/src/vinylcontrol/vinylcontrol.h +++ b/src/vinylcontrol/vinylcontrol.h @@ -11,7 +11,7 @@ class ControlProxy; class VinylControl : public QObject { public: - VinylControl(UserSettingsPointer pConfig, QString group); + VinylControl(UserSettingsPointer pConfig, const QString& group); virtual ~VinylControl(); virtual void toggleVinylControl(bool enable); diff --git a/src/vinylcontrol/vinylcontrolprocessor.cpp b/src/vinylcontrol/vinylcontrolprocessor.cpp index 1fd8e6a202d..a7b5379d289 100644 --- a/src/vinylcontrol/vinylcontrolprocessor.cpp +++ b/src/vinylcontrol/vinylcontrolprocessor.cpp @@ -153,7 +153,7 @@ void VinylControlProcessor::reloadConfig() { } } -void VinylControlProcessor::onInputConfigured(AudioInput input) { +void VinylControlProcessor::onInputConfigured(const AudioInput& input) { if (input.getType() != AudioInput::VINYLCONTROL) { qDebug() << "WARNING: AudioInput type is not VINYLCONTROL. Ignoring."; return; @@ -177,7 +177,7 @@ void VinylControlProcessor::onInputConfigured(AudioInput input) { delete pCurrent; } -void VinylControlProcessor::onInputUnconfigured(AudioInput input) { +void VinylControlProcessor::onInputUnconfigured(const AudioInput& input) { if (input.getType() != AudioInput::VINYLCONTROL) { qDebug() << "WARNING: AudioInput type is not VINYLCONTROL. Ignoring."; return; @@ -203,9 +203,9 @@ bool VinylControlProcessor::deckConfigured(int index) const { return m_processors[index] != NULL; } -void VinylControlProcessor::receiveBuffer(AudioInput input, - const CSAMPLE* pBuffer, - unsigned int nFrames) { +void VinylControlProcessor::receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int nFrames) { ScopedTimer t("VinylControlProcessor::receiveBuffer"); if (input.getType() != AudioInput::VINYLCONTROL) { qDebug() << "WARNING: AudioInput type is not VINYLCONTROL. Ignoring incoming buffer."; diff --git a/src/vinylcontrol/vinylcontrolprocessor.h b/src/vinylcontrol/vinylcontrolprocessor.h index 1ab825d829b..0ea9d3fa924 100644 --- a/src/vinylcontrol/vinylcontrolprocessor.h +++ b/src/vinylcontrol/vinylcontrolprocessor.h @@ -41,8 +41,8 @@ class VinylControlProcessor : public QThread, public AudioDestination { } public slots: - virtual void onInputConfigured(AudioInput input); - virtual void onInputUnconfigured(AudioInput input); + virtual void onInputConfigured(const AudioInput& input); + virtual void onInputUnconfigured(const AudioInput& input); // Called by the engine callback. Must not touch any state in // VinylControlProcessor except for m_samplePipes. NOTE: @@ -53,8 +53,7 @@ class VinylControlProcessor : public QThread, public AudioDestination { // method is re-entrant since the VinylControlProcessor is registered for // multiple AudioDestinations, however it is not re-entrant for a given // AudioInput index. - void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int iNumFrames); + void receiveBuffer(const AudioInput& input, const CSAMPLE* pBuffer, unsigned int iNumFrames); protected: void run(); diff --git a/src/vinylcontrol/vinylcontrolxwax.cpp b/src/vinylcontrol/vinylcontrolxwax.cpp index c115fea263f..f4f134eb393 100644 --- a/src/vinylcontrol/vinylcontrolxwax.cpp +++ b/src/vinylcontrol/vinylcontrolxwax.cpp @@ -48,7 +48,7 @@ const double kMinSignal = 75.0 / SAMPLE_MAX; bool VinylControlXwax::s_bLUTInitialized = false; QMutex VinylControlXwax::s_xwaxLUTMutex; -VinylControlXwax::VinylControlXwax(UserSettingsPointer pConfig, QString group) +VinylControlXwax::VinylControlXwax(UserSettingsPointer pConfig, const QString& group) : VinylControl(pConfig, group), m_dVinylPositionOld(0.0), m_pWorkBuffer(new short[MAX_BUFFER_LEN]), diff --git a/src/vinylcontrol/vinylcontrolxwax.h b/src/vinylcontrol/vinylcontrolxwax.h index f0b3be6907e..45567003f16 100644 --- a/src/vinylcontrol/vinylcontrolxwax.h +++ b/src/vinylcontrol/vinylcontrolxwax.h @@ -22,7 +22,7 @@ extern "C" { class VinylControlXwax : public VinylControl { public: - VinylControlXwax(UserSettingsPointer pConfig, QString group); + VinylControlXwax(UserSettingsPointer pConfig, const QString& group); virtual ~VinylControlXwax(); static void freeLUTs(); diff --git a/src/waveform/renderers/waveformmark.cpp b/src/waveform/renderers/waveformmark.cpp index 7bbd98630dd..951fa352fc0 100644 --- a/src/waveform/renderers/waveformmark.cpp +++ b/src/waveform/renderers/waveformmark.cpp @@ -7,7 +7,7 @@ #include "waveformmark.h" namespace { -Qt::Alignment decodeAlignmentFlags(QString alignString, Qt::Alignment defaultFlags) { +Qt::Alignment decodeAlignmentFlags(const QString& alignString, Qt::Alignment defaultFlags) { QStringList stringFlags = alignString.toLower() .split('|', #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) diff --git a/src/waveform/renderers/waveformwidgetrenderer.cpp b/src/waveform/renderers/waveformwidgetrenderer.cpp index e66ea37fa89..2058b1d661c 100644 --- a/src/waveform/renderers/waveformwidgetrenderer.cpp +++ b/src/waveform/renderers/waveformwidgetrenderer.cpp @@ -290,7 +290,7 @@ void WaveformWidgetRenderer::drawPlayPosmarker(QPainter* painter) { } void WaveformWidgetRenderer::drawTriangle(QPainter* painter, - QBrush fillColor, + const QBrush& fillColor, QPointF p0, QPointF p1, QPointF p2) { diff --git a/src/waveform/renderers/waveformwidgetrenderer.h b/src/waveform/renderers/waveformwidgetrenderer.h index 9a4a761ac08..26f5582f75a 100644 --- a/src/waveform/renderers/waveformwidgetrenderer.h +++ b/src/waveform/renderers/waveformwidgetrenderer.h @@ -139,7 +139,7 @@ class WaveformWidgetRenderer { } void setTrack(TrackPointer track); - void setMarkPositions(QMap markPositions) { + void setMarkPositions(const QMap& markPositions) { m_markPositions = markPositions; } @@ -206,7 +206,7 @@ class WaveformWidgetRenderer { // draw play position indicator triangles void drawPlayPosmarker(QPainter* painter); void drawTriangle(QPainter* painter, - QBrush fillColor, + const QBrush& fillColor, QPointF p1, QPointF p2, QPointF p3); diff --git a/src/waveform/visualplayposition.cpp b/src/waveform/visualplayposition.cpp index aeafaf8f974..68a9641cf86 100644 --- a/src/waveform/visualplayposition.cpp +++ b/src/waveform/visualplayposition.cpp @@ -112,7 +112,7 @@ void VisualPlayPosition::slotAudioBufferSizeChanged(double sizeMillis) { } //static -QSharedPointer VisualPlayPosition::getVisualPlayPosition(QString group) { +QSharedPointer VisualPlayPosition::getVisualPlayPosition(const QString& group) { QSharedPointer vpp = m_listVisualPlayPosition.value(group); if (vpp.isNull()) { vpp = QSharedPointer(new VisualPlayPosition(group)); diff --git a/src/waveform/visualplayposition.h b/src/waveform/visualplayposition.h index badbf6b77e6..0ca4e16b666 100644 --- a/src/waveform/visualplayposition.h +++ b/src/waveform/visualplayposition.h @@ -55,7 +55,7 @@ class VisualPlayPosition : public QObject { // WARNING: Not thread safe. This function must only be called from the main // thread. - static QSharedPointer getVisualPlayPosition(QString group); + static QSharedPointer getVisualPlayPosition(const QString& group); // This is called by SoundDevicePortAudio just after the callback starts. static void setCallbackEntryToDacSecs(double secs, const PerformanceTimer& time); diff --git a/src/waveform/waveform.cpp b/src/waveform/waveform.cpp index 86f736c7278..efb9ba6fce0 100644 --- a/src/waveform/waveform.cpp +++ b/src/waveform/waveform.cpp @@ -17,7 +17,7 @@ int computeTextureStride(int size) { return stride; } -Waveform::Waveform(const QByteArray data) +Waveform::Waveform(const QByteArray& data) : m_id(-1), m_saveState(SaveState::NotSaved), m_dataSize(0), diff --git a/src/waveform/waveform.h b/src/waveform/waveform.h index cd9cefefcfa..813d846c0b5 100644 --- a/src/waveform/waveform.h +++ b/src/waveform/waveform.h @@ -37,7 +37,7 @@ class Waveform { Saved }; - explicit Waveform(const QByteArray pData = QByteArray()); + explicit Waveform(const QByteArray& pData = QByteArray()); Waveform(int audioSampleRate, int audioSamples, int desiredVisualSampleRate, int maxVisualSamples); @@ -58,7 +58,7 @@ class Waveform { return m_version; } - void setVersion(QString version) { + void setVersion(const QString& version) { QMutexLocker locker(&m_mutex); m_version = version; } @@ -68,7 +68,7 @@ class Waveform { return m_description; } - void setDescription(QString description) { + void setDescription(const QString& description) { QMutexLocker locker(&m_mutex); m_description = description; } diff --git a/src/waveform/waveformmarklabel.cpp b/src/waveform/waveformmarklabel.cpp index 33aa6d3b311..0c7b3f77973 100644 --- a/src/waveform/waveformmarklabel.cpp +++ b/src/waveform/waveformmarklabel.cpp @@ -1,9 +1,14 @@ #include "waveform/waveformmarklabel.h" #include "util/math.h" -void WaveformMarkLabel::prerender(QPointF bottomLeft, QPixmap icon, QString text, - QFont font, QColor textColor, QColor backgroundColor, - float widgetWidth, double scaleFactor) { +void WaveformMarkLabel::prerender(QPointF bottomLeft, + const QPixmap& icon, + QString text, + const QFont& font, + QColor textColor, + QColor backgroundColor, + float widgetWidth, + double scaleFactor) { if (text.isEmpty() && icon.isNull()) { clear(); return; diff --git a/src/waveform/waveformmarklabel.h b/src/waveform/waveformmarklabel.h index e3a588a49b0..fdb87badfe1 100644 --- a/src/waveform/waveformmarklabel.h +++ b/src/waveform/waveformmarklabel.h @@ -16,9 +16,14 @@ class WaveformMarkLabel { WaveformMarkLabel() {}; // Render the label to an internal QPixmap buffer - void prerender(QPointF bottomLeft, QPixmap icon, QString text, - QFont font, QColor textColor, QColor backgroundColor, - float widgetWidth, double scaleFactor); + void prerender(QPointF bottomLeft, + const QPixmap& icon, + QString text, + const QFont& font, + QColor textColor, + QColor backgroundColor, + float widgetWidth, + double scaleFactor); // Draw the prerendered pixmap void draw(QPainter* pPainter); @@ -27,7 +32,7 @@ class WaveformMarkLabel { return m_areaRect; }; - void setAreaRect(QRectF areaRect) { + void setAreaRect(const QRectF& areaRect) { m_areaRect = areaRect; } diff --git a/src/widget/trackdroptarget.h b/src/widget/trackdroptarget.h index cb7cd4a77f8..01c0b99be51 100644 --- a/src/widget/trackdroptarget.h +++ b/src/widget/trackdroptarget.h @@ -23,8 +23,8 @@ class TrackDropTarget { } signals: - virtual void trackDropped(QString filename, QString group) = 0; - virtual void cloneDeck(QString sourceGroup, QString targetGroup) = 0; + virtual void trackDropped(const QString& filename, const QString& group) = 0; + virtual void cloneDeck(const QString& sourceGroup, const QString& targetGroup) = 0; }; #endif // TRACKDROPTARGET diff --git a/src/widget/wcoverart.h b/src/widget/wcoverart.h index 3b28624f662..dc49f17649f 100644 --- a/src/widget/wcoverart.h +++ b/src/widget/wcoverart.h @@ -33,8 +33,8 @@ class WCoverArt : public QWidget, public WBaseWidget, public TrackDropTarget { void slotEnable(bool); signals: - void trackDropped(QString filename, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& filename, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; private slots: void slotCoverFound( diff --git a/src/widget/wcoverartlabel.cpp b/src/widget/wcoverartlabel.cpp index 1e066463678..2d76d4be501 100644 --- a/src/widget/wcoverartlabel.cpp +++ b/src/widget/wcoverartlabel.cpp @@ -50,7 +50,7 @@ WCoverArtLabel::WCoverArtLabel(QWidget* parent) WCoverArtLabel::~WCoverArtLabel() = default; void WCoverArtLabel::setCoverArt(const CoverInfo& coverInfo, - QPixmap px) { + const QPixmap& px) { m_pCoverMenu->setCoverArt(coverInfo); if (px.isNull()) { m_loadedCover = px; diff --git a/src/widget/wcoverartlabel.h b/src/widget/wcoverartlabel.h index 23df1050ccc..e269b25c13a 100644 --- a/src/widget/wcoverartlabel.h +++ b/src/widget/wcoverartlabel.h @@ -19,7 +19,7 @@ class WCoverArtLabel : public QLabel { explicit WCoverArtLabel(QWidget* parent = nullptr); ~WCoverArtLabel() override; // Verifies that the base destructor is virtual - void setCoverArt(const CoverInfo& coverInfo, QPixmap px); + void setCoverArt(const CoverInfo& coverInfo, const QPixmap& px); void loadTrack(TrackPointer pTrack); signals: diff --git a/src/widget/wcuemenupopup.cpp b/src/widget/wcuemenupopup.cpp index 89c8ef5d474..ea92cb56c07 100644 --- a/src/widget/wcuemenupopup.cpp +++ b/src/widget/wcuemenupopup.cpp @@ -67,7 +67,7 @@ WCueMenuPopup::WCueMenuPopup(UserSettingsPointer pConfig, QWidget* parent) layout()->activate(); } -void WCueMenuPopup::setTrackAndCue(TrackPointer pTrack, CuePointer pCue) { +void WCueMenuPopup::setTrackAndCue(TrackPointer pTrack, const CuePointer& pCue) { if (pTrack && pCue) { m_pTrack = pTrack; m_pCue = pCue; diff --git a/src/widget/wcuemenupopup.h b/src/widget/wcuemenupopup.h index 940be0219d5..491be15de56 100644 --- a/src/widget/wcuemenupopup.h +++ b/src/widget/wcuemenupopup.h @@ -23,7 +23,7 @@ class WCueMenuPopup : public QWidget { delete m_pDeleteCue; } - void setTrackAndCue(TrackPointer pTrack, CuePointer pCue); + void setTrackAndCue(TrackPointer pTrack, const CuePointer& pCue); void setColorPalette(const ColorPalette& palette) { if (m_pColorPicker != nullptr) { diff --git a/src/widget/wdisplay.cpp b/src/widget/wdisplay.cpp index 70d072709c3..f2110bfcdd8 100644 --- a/src/widget/wdisplay.cpp +++ b/src/widget/wdisplay.cpp @@ -98,9 +98,9 @@ void WDisplay::resetPositions() { m_disabledPixmaps.resize(0); } -void WDisplay::setPixmapBackground(PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +void WDisplay::setPixmapBackground(const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { m_pPixmapBack = WPixmapStore::getPaintable(source, mode, scaleFactor); if (m_pPixmapBack.isNull() || m_pPixmapBack->isNull()) { qDebug() << metaObject()->className() diff --git a/src/widget/wdisplay.h b/src/widget/wdisplay.h index 1e5715429c7..b5b8acad333 100644 --- a/src/widget/wdisplay.h +++ b/src/widget/wdisplay.h @@ -53,7 +53,7 @@ class WDisplay : public WWidget { double scaleFactor); void setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); diff --git a/src/widget/wknobcomposed.cpp b/src/widget/wknobcomposed.cpp index 8b2c3deb6a3..e2fbb98c1f3 100644 --- a/src/widget/wknobcomposed.cpp +++ b/src/widget/wknobcomposed.cpp @@ -88,9 +88,9 @@ void WKnobComposed::clear() { m_pKnob.clear(); } -void WKnobComposed::setPixmapBackground(PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +void WKnobComposed::setPixmapBackground(const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { m_pPixmapBack = WPixmapStore::getPaintable(source, mode, scaleFactor); if (m_pPixmapBack.isNull() || m_pPixmapBack->isNull()) { qDebug() << metaObject()->className() @@ -98,9 +98,9 @@ void WKnobComposed::setPixmapBackground(PixmapSource source, } } -void WKnobComposed::setPixmapKnob(PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +void WKnobComposed::setPixmapKnob(const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { m_pKnob = WPixmapStore::getPaintable(source, mode, scaleFactor); if (m_pKnob.isNull() || m_pKnob->isNull()) { qDebug() << metaObject()->className() diff --git a/src/widget/wknobcomposed.h b/src/widget/wknobcomposed.h index 454fd48b131..489c5db9a17 100644 --- a/src/widget/wknobcomposed.h +++ b/src/widget/wknobcomposed.h @@ -38,11 +38,11 @@ class WKnobComposed : public WWidget { void inputActivity(); void clear(); void setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); void setPixmapKnob( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); void drawArc(QPainter* pPainter); diff --git a/src/widget/wlibrary.cpp b/src/widget/wlibrary.cpp index 8e10fe512b1..4d8b81e60df 100644 --- a/src/widget/wlibrary.cpp +++ b/src/widget/wlibrary.cpp @@ -33,7 +33,7 @@ void WLibrary::setup(const QDomNode& node, const SkinContext& context) { kMaxTrackTableBackgroundColorOpacity); } -bool WLibrary::registerView(QString name, QWidget* view) { +bool WLibrary::registerView(const QString& name, QWidget* view) { QMutexLocker lock(&m_mutex); if (m_viewMap.contains(name)) { return false; diff --git a/src/widget/wlibrary.h b/src/widget/wlibrary.h index 5c6a4fad7ec..91e655ffa7c 100644 --- a/src/widget/wlibrary.h +++ b/src/widget/wlibrary.h @@ -25,7 +25,7 @@ class WLibrary : public QStackedWidget, public WBaseWidget { // the view and is in charge of deleting it. Returns whether or not the // registration was successful. Registered widget must implement the // LibraryView interface. - bool registerView(QString name, QWidget* view); + bool registerView(const QString& name, QWidget* view); LibraryView* getActiveView() const; diff --git a/src/widget/wlibrarytableview.cpp b/src/widget/wlibrarytableview.cpp index 0baabfc6bd0..ff650d0afe0 100644 --- a/src/widget/wlibrarytableview.cpp +++ b/src/widget/wlibrarytableview.cpp @@ -12,12 +12,11 @@ #include "widget/wwidget.h" WLibraryTableView::WLibraryTableView(QWidget* parent, - UserSettingsPointer pConfig, - ConfigKey vScrollBarPosKey) + UserSettingsPointer pConfig, + const ConfigKey& vScrollBarPosKey) : QTableView(parent), m_pConfig(pConfig), m_vScrollBarPosKey(vScrollBarPosKey) { - loadVScrollBarPosState(); // Setup properties for table diff --git a/src/widget/wlibrarytableview.h b/src/widget/wlibrarytableview.h index da2413a1dc3..2b65c949c03 100644 --- a/src/widget/wlibrarytableview.h +++ b/src/widget/wlibrarytableview.h @@ -19,8 +19,8 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { public: WLibraryTableView(QWidget* parent, - UserSettingsPointer pConfig, - ConfigKey vScrollBarPosKey); + UserSettingsPointer pConfig, + const ConfigKey& vScrollBarPosKey); ~WLibraryTableView() override; void moveSelection(int delta) override; @@ -40,8 +40,7 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { signals: void loadTrack(TrackPointer pTrack); - void loadTrackToPlayer(TrackPointer pTrack, QString group, - bool play = false); + void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play = false); void trackSelected(TrackPointer pTrack); void onlyCachedCoverArt(bool); void scrollValueChanged(int); diff --git a/src/widget/wmainmenubar.h b/src/widget/wmainmenubar.h index 7f305ac4b2d..a40be8d49b5 100644 --- a/src/widget/wmainmenubar.h +++ b/src/widget/wmainmenubar.h @@ -64,7 +64,7 @@ class WMainMenuBar : public QMenuBar { void toggleBroadcasting(bool toggle); void toggleRecording(bool enabled); void toggleVinylControl(int deck); - void visitUrl(QString url); + void visitUrl(const QString& url); void quit(); void internalRecordingStateChange(bool recording); diff --git a/src/widget/woverview.h b/src/widget/woverview.h index 03be183855a..20e36d61bd9 100644 --- a/src/widget/woverview.h +++ b/src/widget/woverview.h @@ -47,8 +47,8 @@ class WOverview : public WWidget, public TrackDropTarget { AnalyzerProgress analyzerProgress); signals: - void trackDropped(QString filename, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& filename, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; protected: WOverview( diff --git a/src/widget/wpixmapstore.cpp b/src/widget/wpixmapstore.cpp index ebb33e25ef3..bf007dce233 100644 --- a/src/widget/wpixmapstore.cpp +++ b/src/widget/wpixmapstore.cpp @@ -13,9 +13,9 @@ QSharedPointer WPixmapStore::m_loader = QSharedPointer(new ImgLoader()); // static -PaintablePointer WPixmapStore::getPaintable(PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +PaintablePointer WPixmapStore::getPaintable(const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { if (source.isEmpty()) { return PaintablePointer(); } diff --git a/src/widget/wpixmapstore.h b/src/widget/wpixmapstore.h index ec501617c6c..01100a0c57e 100644 --- a/src/widget/wpixmapstore.h +++ b/src/widget/wpixmapstore.h @@ -39,7 +39,7 @@ typedef QWeakPointer WeakPaintablePointer; class WPixmapStore { public: static PaintablePointer getPaintable( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); static QPixmap* getPixmapNoCache(const QString& fileName, double scaleFactor); diff --git a/src/widget/wpushbutton.cpp b/src/widget/wpushbutton.cpp index dface204ba9..00a8efe5b9b 100644 --- a/src/widget/wpushbutton.cpp +++ b/src/widget/wpushbutton.cpp @@ -257,8 +257,11 @@ void WPushButton::setStates(int iStates) { m_align.resize(iStates); } -void WPushButton::setPixmap(int iState, bool bPressed, PixmapSource source, - Paintable::DrawMode mode, double scaleFactor) { +void WPushButton::setPixmap(int iState, + bool bPressed, + const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { QVector& pixmaps = bPressed ? m_pressedPixmaps : m_unpressedPixmaps; @@ -279,9 +282,9 @@ void WPushButton::setPixmap(int iState, bool bPressed, PixmapSource source, pixmaps.replace(iState, pPixmap); } -void WPushButton::setPixmapBackground(PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +void WPushButton::setPixmapBackground(const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { // Load background pixmap m_pPixmapBack = WPixmapStore::getPaintable(source, mode, scaleFactor); if (!source.isEmpty() && diff --git a/src/widget/wpushbutton.h b/src/widget/wpushbutton.h index ac5f6ef525e..6393ea57101 100644 --- a/src/widget/wpushbutton.h +++ b/src/widget/wpushbutton.h @@ -95,13 +95,16 @@ class WPushButton : public WWidget { virtual void restyleAndRepaint(); // Associates a pixmap of a given state of the button with the widget - void setPixmap(int iState, bool bPressed, PixmapSource source, - Paintable::DrawMode mode, double scaleFactor); + void setPixmap(int iState, + bool bPressed, + const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor); // Associates a background pixmap with the widget. This is only needed if // the button pixmaps contains alpha channel values. void setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); diff --git a/src/widget/wrecordingduration.cpp b/src/widget/wrecordingduration.cpp index 7d314408cd6..ee9770bf64a 100644 --- a/src/widget/wrecordingduration.cpp +++ b/src/widget/wrecordingduration.cpp @@ -39,6 +39,6 @@ void WRecordingDuration::slotRecordingInactive(bool isRecording) { } } -void WRecordingDuration::refreshLabel(QString durationRecorded) { +void WRecordingDuration::refreshLabel(const QString& durationRecorded) { setText(durationRecorded); } diff --git a/src/widget/wrecordingduration.h b/src/widget/wrecordingduration.h index 840cc575ead..e6adbd5411e 100644 --- a/src/widget/wrecordingduration.h +++ b/src/widget/wrecordingduration.h @@ -18,7 +18,7 @@ class WRecordingDuration: public WLabel { void setup(const QDomNode& node, const SkinContext& context) override; private slots: - void refreshLabel(QString); + void refreshLabel(const QString&); void slotRecordingInactive(bool); private: diff --git a/src/widget/wsingletoncontainer.cpp b/src/widget/wsingletoncontainer.cpp index 11f50737396..6deebe709d2 100644 --- a/src/widget/wsingletoncontainer.cpp +++ b/src/widget/wsingletoncontainer.cpp @@ -58,7 +58,7 @@ void WSingletonContainer::showEvent(QShowEvent* event) { } } -void SingletonMap::insertSingleton(QString objectName, QWidget* widget) { +void SingletonMap::insertSingleton(const QString& objectName, QWidget* widget) { if (m_singletons.contains(objectName)){ qWarning() << "ERROR: Tried to insert a singleton with a name that has" << "already been inserted:" << objectName; @@ -67,6 +67,6 @@ void SingletonMap::insertSingleton(QString objectName, QWidget* widget) { m_singletons.insert(objectName, widget); } -QWidget* SingletonMap::getSingletonWidget(QString objectName) const { +QWidget* SingletonMap::getSingletonWidget(const QString& objectName) const { return m_singletons.value(objectName, nullptr); } diff --git a/src/widget/wsingletoncontainer.h b/src/widget/wsingletoncontainer.h index 87812d4f945..168e263ad4a 100644 --- a/src/widget/wsingletoncontainer.h +++ b/src/widget/wsingletoncontainer.h @@ -73,12 +73,12 @@ class SingletonMap { // Takes a constructed QWidget and inserts it in the map of available // singletons. Checks that an object of that name hasn't already been // defined. - void insertSingleton(QString objectName, QWidget* widget); + void insertSingleton(const QString& objectName, QWidget* widget); // We don't want to end up with badly-constructed containers, so only // provide a factory function. Returns NULL if the objectName is not in // the map. - QWidget* getSingletonWidget(QString objectName) const; + QWidget* getSingletonWidget(const QString& objectName) const; private: QMap m_singletons; diff --git a/src/widget/wslidercomposed.cpp b/src/widget/wslidercomposed.cpp index 3d3035bd0cf..0c28df5b618 100644 --- a/src/widget/wslidercomposed.cpp +++ b/src/widget/wslidercomposed.cpp @@ -167,9 +167,9 @@ void WSliderComposed::setup(const QDomNode& node, const SkinContext& context) { setFocusPolicy(Qt::NoFocus); } -void WSliderComposed::setSliderPixmap(PixmapSource sourceSlider, - Paintable::DrawMode drawMode, - double scaleFactor) { +void WSliderComposed::setSliderPixmap(const PixmapSource& sourceSlider, + Paintable::DrawMode drawMode, + double scaleFactor) { m_pSlider = WPixmapStore::getPaintable(sourceSlider, drawMode, scaleFactor); if (!m_pSlider) { qDebug() << "WSliderComposed: Error loading slider pixmap:" << sourceSlider.getPath(); @@ -180,9 +180,9 @@ void WSliderComposed::setSliderPixmap(PixmapSource sourceSlider, } void WSliderComposed::setHandlePixmap(bool bHorizontal, - PixmapSource sourceHandle, - Paintable::DrawMode mode, - double scaleFactor) { + const PixmapSource& sourceHandle, + Paintable::DrawMode mode, + double scaleFactor) { m_bHorizontal = bHorizontal; m_handler.setHorizontal(m_bHorizontal); m_pHandle = WPixmapStore::getPaintable(sourceHandle, mode, scaleFactor); diff --git a/src/widget/wslidercomposed.h b/src/widget/wslidercomposed.h index 87370facc70..df178232632 100644 --- a/src/widget/wslidercomposed.h +++ b/src/widget/wslidercomposed.h @@ -46,12 +46,12 @@ class WSliderComposed : public WWidget { void setup(const QDomNode& node, const SkinContext& context); void setSliderPixmap( - PixmapSource sourceSlider, + const PixmapSource& sourceSlider, Paintable::DrawMode drawMode, double scaleFactor); void setHandlePixmap( bool bHorizontal, - PixmapSource sourceHandle, + const PixmapSource& sourceHandle, Paintable::DrawMode mode, double scaleFactor); inline bool isHorizontal() const { return m_bHorizontal; }; diff --git a/src/widget/wspinny.h b/src/widget/wspinny.h index 190094af421..5f82d330026 100644 --- a/src/widget/wspinny.h +++ b/src/widget/wspinny.h @@ -62,8 +62,8 @@ class WSpinny : public QGLWidget, public WBaseWidget, public VinylSignalQualityL signals: - void trackDropped(QString filename, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& filename, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; protected: //QWidget: diff --git a/src/widget/wstarrating.cpp b/src/widget/wstarrating.cpp index a7f58e05ba7..a9a010bf5b2 100644 --- a/src/widget/wstarrating.cpp +++ b/src/widget/wstarrating.cpp @@ -7,7 +7,7 @@ #include "track/track.h" -WStarRating::WStarRating(QString group, QWidget* pParent) +WStarRating::WStarRating(const QString& group, QWidget* pParent) : WWidget(pParent), m_starRating(0, 5), m_group(group), diff --git a/src/widget/wstarrating.h b/src/widget/wstarrating.h index 6304efe6053..426701042b9 100644 --- a/src/widget/wstarrating.h +++ b/src/widget/wstarrating.h @@ -18,7 +18,7 @@ class ControlPushButton; class WStarRating : public WWidget { Q_OBJECT public: - WStarRating(QString group, QWidget* pParent); + WStarRating(const QString& group, QWidget* pParent); virtual void setup(const QDomNode& node, const SkinContext& context); QSize sizeHint() const override; diff --git a/src/widget/wstatuslight.cpp b/src/widget/wstatuslight.cpp index 48d7b4baba2..e3ab09736ab 100644 --- a/src/widget/wstatuslight.cpp +++ b/src/widget/wstatuslight.cpp @@ -70,9 +70,10 @@ void WStatusLight::setup(const QDomNode& node, const SkinContext& context) { setFocusPolicy(Qt::NoFocus); } -void WStatusLight::setPixmap(int iState, PixmapSource source, - Paintable::DrawMode mode, - double scaleFactor) { +void WStatusLight::setPixmap(int iState, + const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor) { if (iState < 0 || iState >= m_pixmaps.size()) { return; } diff --git a/src/widget/wstatuslight.h b/src/widget/wstatuslight.h index ac7250dff50..9ac71aa0060 100644 --- a/src/widget/wstatuslight.h +++ b/src/widget/wstatuslight.h @@ -45,8 +45,10 @@ class WStatusLight : public WWidget { void paintEvent(QPaintEvent * /*unused*/) override; private: - void setPixmap(int iState, PixmapSource source, - Paintable::DrawMode mode, double scaleFactor); + void setPixmap(int iState, + const PixmapSource& source, + Paintable::DrawMode mode, + double scaleFactor); void setNoPos(int iNoPos); // Current position diff --git a/src/widget/wtime.cpp b/src/widget/wtime.cpp index 272ef97a6f8..54f3f853b26 100644 --- a/src/widget/wtime.cpp +++ b/src/widget/wtime.cpp @@ -24,7 +24,7 @@ void WTime::setup(const QDomNode& node, const SkinContext& context) { refreshTime(); } -void WTime::setTimeFormat(QDomNode node, const SkinContext& context) { +void WTime::setTimeFormat(const QDomNode& node, const SkinContext& context) { // if a custom format is defined, all other formatting flags are ignored QString customFormat; if (context.hasNodeSelectString(node, "CustomFormat", &customFormat)) { diff --git a/src/widget/wtime.h b/src/widget/wtime.h index 9c4c464e093..1db63c164d0 100644 --- a/src/widget/wtime.h +++ b/src/widget/wtime.h @@ -22,7 +22,7 @@ class WTime: public WLabel { void refreshTime(); private: - void setTimeFormat(QDomNode node, const SkinContext& context); + void setTimeFormat(const QDomNode& node, const SkinContext& context); QTimer* m_pTimer; QString m_sTimeFormat; diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index 1130062081f..c24e4fa8f55 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -1206,7 +1206,7 @@ void WTrackMenu::slotColorPicked(mixxx::RgbColor::optional_t color) { hide(); } -void WTrackMenu::loadSelectionToGroup(QString group, bool play) { +void WTrackMenu::loadSelectionToGroup(const QString& group, bool play) { TrackPointer pTrack = getFirstTrackPointer(); if (!pTrack) { return; diff --git a/src/widget/wtrackmenu.h b/src/widget/wtrackmenu.h index ad569cf8a78..703664a4742 100644 --- a/src/widget/wtrackmenu.h +++ b/src/widget/wtrackmenu.h @@ -72,7 +72,7 @@ class WTrackMenu : public QMenu { void slotShowDlgTrackInfo(); signals: - void loadTrackToPlayer(TrackPointer pTrack, QString group, bool play = false); + void loadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play = false); private slots: // File @@ -166,7 +166,7 @@ class WTrackMenu : public QMenu { void lockBpm(bool lock); - void loadSelectionToGroup(QString group, bool play = false); + void loadSelectionToGroup(const QString& group, bool play = false); void clearTrackSelection(); bool isAnyTrackBpmLocked() const; diff --git a/src/widget/wtrackproperty.h b/src/widget/wtrackproperty.h index fe4c5edccb6..2a8b3e2d0a0 100644 --- a/src/widget/wtrackproperty.h +++ b/src/widget/wtrackproperty.h @@ -28,31 +28,31 @@ class WTrackProperty : public WLabel, public TrackDropTarget { void setup(const QDomNode& node, const SkinContext& context) override; signals: - void trackDropped(QString filename, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& filename, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; - public slots: - void slotTrackLoaded(TrackPointer pTrack); - void slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack); +public slots: + void slotTrackLoaded(TrackPointer pTrack); + void slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack); - protected: - void contextMenuEvent(QContextMenuEvent* event) override; +protected: + void contextMenuEvent(QContextMenuEvent* event) override; - private slots: - void slotTrackChanged(TrackId); +private slots: + void slotTrackChanged(TrackId); - private: - void dragEnterEvent(QDragEnterEvent *event) override; - void dropEvent(QDropEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void mouseDoubleClickEvent(QMouseEvent* event) override; +private: + void dragEnterEvent(QDragEnterEvent* event) override; + void dropEvent(QDropEvent* event) override; + void mouseMoveEvent(QMouseEvent* event) override; + void mouseDoubleClickEvent(QMouseEvent* event) override; - void updateLabel(); + void updateLabel(); - const QString m_group; - const UserSettingsPointer m_pConfig; - TrackPointer m_pCurrentTrack; - QString m_property; + const QString m_group; + const UserSettingsPointer m_pConfig; + TrackPointer m_pCurrentTrack; + QString m_property; - const parented_ptr m_pTrackMenu; + const parented_ptr m_pTrackMenu; }; diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 0c1bd930c45..56d4a06520a 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -755,7 +755,7 @@ void WTrackTableView::loadSelectedTrack() { } } -void WTrackTableView::loadSelectedTrackToGroup(QString group, bool play) { +void WTrackTableView::loadSelectedTrackToGroup(const QString& group, bool play) { auto indices = selectionModel()->selectedRows(); if (indices.size() > 0) { // If the track load override is disabled, check to see if a track is diff --git a/src/widget/wtracktableview.h b/src/widget/wtracktableview.h index 9e0ad84d4f2..f0ecaa9b9cc 100644 --- a/src/widget/wtracktableview.h +++ b/src/widget/wtracktableview.h @@ -37,7 +37,7 @@ class WTrackTableView : public WLibraryTableView { bool hasFocus() const override; void keyPressEvent(QKeyEvent* event) override; void loadSelectedTrack() override; - void loadSelectedTrackToGroup(QString group, bool play) override; + void loadSelectedTrackToGroup(const QString& group, bool play) override; void assignNextTrackColor() override; void assignPreviousTrackColor() override; TrackModel::SortColumnId getColumnIdFromCurrentIndex() override; diff --git a/src/widget/wtracktext.h b/src/widget/wtracktext.h index 106408da343..66a68ee878b 100644 --- a/src/widget/wtracktext.h +++ b/src/widget/wtracktext.h @@ -25,8 +25,8 @@ class WTrackText : public WLabel, public TrackDropTarget { ~WTrackText() override; signals: - void trackDropped(QString fileName, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& fileName, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; public slots: void slotTrackLoaded(TrackPointer track); diff --git a/src/widget/wtrackwidgetgroup.h b/src/widget/wtrackwidgetgroup.h index 839e59c349c..761d3fb0ecf 100644 --- a/src/widget/wtrackwidgetgroup.h +++ b/src/widget/wtrackwidgetgroup.h @@ -21,8 +21,8 @@ class WTrackWidgetGroup : public WWidgetGroup, public TrackDropTarget { void setup(const QDomNode& node, const SkinContext& context) override; signals: - void trackDropped(QString fileName, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& fileName, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; public slots: void slotTrackLoaded(TrackPointer pTrack); diff --git a/src/widget/wvumeter.cpp b/src/widget/wvumeter.cpp index 2f8bf642c36..4e984ae5629 100644 --- a/src/widget/wvumeter.cpp +++ b/src/widget/wvumeter.cpp @@ -95,7 +95,7 @@ void WVuMeter::setup(const QDomNode& node, const SkinContext& context) { } void WVuMeter::setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor) { m_pPixmapBack = WPixmapStore::getPaintable(source, mode, scaleFactor); @@ -107,8 +107,10 @@ void WVuMeter::setPixmapBackground( } } -void WVuMeter::setPixmaps(PixmapSource source, bool bHorizontal, - Paintable::DrawMode mode, double scaleFactor ) { +void WVuMeter::setPixmaps(const PixmapSource& source, + bool bHorizontal, + Paintable::DrawMode mode, + double scaleFactor) { m_pPixmapVu = WPixmapStore::getPaintable(source, mode, scaleFactor); if (m_pPixmapVu.isNull() || m_pPixmapVu->isNull()) { qDebug() << "WVuMeter: Error loading vu pixmap" << source.getPath(); diff --git a/src/widget/wvumeter.h b/src/widget/wvumeter.h index d8aedec1eca..e616f4070f8 100644 --- a/src/widget/wvumeter.h +++ b/src/widget/wvumeter.h @@ -36,11 +36,11 @@ class WVuMeter : public WWidget { void setup(const QDomNode& node, const SkinContext& context); void setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); void setPixmaps( - PixmapSource source, + const PixmapSource& source, bool bHorizontal, Paintable::DrawMode mode, double scaleFactor); diff --git a/src/widget/wwaveformviewer.h b/src/widget/wwaveformviewer.h index 08dc0afa98e..e3b3eb1439e 100644 --- a/src/widget/wwaveformviewer.h +++ b/src/widget/wwaveformviewer.h @@ -43,8 +43,8 @@ class WWaveformViewer : public WWidget, public TrackDropTarget { void leaveEvent(QEvent* /*unused*/) override; signals: - void trackDropped(QString filename, QString group) override; - void cloneDeck(QString source_group, QString target_group) override; + void trackDropped(const QString& filename, const QString& group) override; + void cloneDeck(const QString& sourceGroup, const QString& targetGroup) override; public slots: void slotTrackLoaded(TrackPointer track); diff --git a/src/widget/wwidgetgroup.cpp b/src/widget/wwidgetgroup.cpp index 541383b1d62..12f9e149f73 100644 --- a/src/widget/wwidgetgroup.cpp +++ b/src/widget/wwidgetgroup.cpp @@ -155,7 +155,7 @@ void WWidgetGroup::setup(const QDomNode& node, const SkinContext& context) { } void WWidgetGroup::setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor) { // Load background pixmap @@ -167,7 +167,7 @@ void WWidgetGroup::setPixmapBackground( } void WWidgetGroup::setPixmapBackgroundHighlighted( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor) { // Load background pixmap for the highlighted state diff --git a/src/widget/wwidgetgroup.h b/src/widget/wwidgetgroup.h index fb1ac389697..a59954a51b6 100644 --- a/src/widget/wwidgetgroup.h +++ b/src/widget/wwidgetgroup.h @@ -67,11 +67,11 @@ class WWidgetGroup : public QFrame, public WBaseWidget { virtual void setup(const QDomNode& node, const SkinContext& context); void setPixmapBackground( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); void setPixmapBackgroundHighlighted( - PixmapSource source, + const PixmapSource& source, Paintable::DrawMode mode, double scaleFactor); void addWidget(QWidget* pChild); From a099452f7c544bf5d8342a707cc8386cc5fe98f0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Thu, 19 Nov 2020 00:14:11 +0100 Subject: [PATCH 2/3] Fix -Wclazy-old-style-connect issues from *.ui files --- src/dialog/dlgabout.cpp | 3 + src/dialog/dlgaboutdlg.ui | 34 ----- src/preferences/dialog/dlgprefdeck.cpp | 33 +++++ src/preferences/dialog/dlgprefdeckdlg.ui | 130 -------------------- src/preferences/dialog/dlgprefmodplug.cpp | 13 ++ src/preferences/dialog/dlgprefmodplugdlg.ui | 50 -------- 6 files changed, 49 insertions(+), 214 deletions(-) diff --git a/src/dialog/dlgabout.cpp b/src/dialog/dlgabout.cpp index 5e9e4b1ad19..58b0e5ea7ad 100644 --- a/src/dialog/dlgabout.cpp +++ b/src/dialog/dlgabout.cpp @@ -322,4 +322,7 @@ DlgAbout::DlgAbout(QWidget* parent) : QDialog(parent), Ui::DlgAboutDlg() { << sectionTemplate.arg(s_specialThanks, specialThanks.join("
")); textBrowser->setHtml(sections.join("")); + + connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgAbout::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgAbout::reject); } diff --git a/src/dialog/dlgaboutdlg.ui b/src/dialog/dlgaboutdlg.ui index 012646b3d4a..5b506e53e32 100644 --- a/src/dialog/dlgaboutdlg.ui +++ b/src/dialog/dlgaboutdlg.ui @@ -210,38 +210,4 @@ p, li { white-space: pre-wrap; } - - - buttonBox - accepted() - DlgAboutDlg - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DlgAboutDlg - reject() - - - 316 - 260 - - - 286 - 274 - - - - diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index e560fc458e5..27b47470023 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -376,6 +376,39 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, connect(checkBoxResetSpeed, &QCheckBox::toggled, this, &DlgPrefDeck::slotUpdateSpeedAutoReset); connect(checkBoxResetPitch, &QCheckBox::toggled, this, &DlgPrefDeck::slotUpdatePitchAutoReset); + connect(SliderRateRampSensitivity, + QOverload::of(&QAbstractSlider::valueChanged), + SpinBoxRateRampSensitivity, + QOverload::of(&QSpinBox::setValue)); + connect(SpinBoxRateRampSensitivity, + QOverload::of(&QSpinBox::valueChanged), + SliderRateRampSensitivity, + QOverload::of(&QAbstractSlider::setValue)); + connect(radioButtonRateRampModeLinear, + &QRadioButton::toggled, + labelSpeedRampSensitivity, + &QWidget::setEnabled); + connect(radioButtonRateRampModeLinear, + &QRadioButton::toggled, + SliderRateRampSensitivity, + &QWidget::setEnabled); + connect(radioButtonRateRampModeLinear, + &QRadioButton::toggled, + SpinBoxRateRampSensitivity, + &QWidget::setEnabled); + connect(radioButtonRateRampModeStepping, + &QRadioButton::toggled, + labelSpeedTemporary, + &QWidget::setEnabled); + connect(radioButtonRateRampModeStepping, + &QRadioButton::toggled, + spinBoxTemporaryRateCoarse, + &QWidget::setEnabled); + connect(radioButtonRateRampModeStepping, + &QRadioButton::toggled, + spinBoxTemporaryRateFine, + &QWidget::setEnabled); + slotUpdate(); } diff --git a/src/preferences/dialog/dlgprefdeckdlg.ui b/src/preferences/dialog/dlgprefdeckdlg.ui index 30158337934..db19d27b7e5 100644 --- a/src/preferences/dialog/dlgprefdeckdlg.ui +++ b/src/preferences/dialog/dlgprefdeckdlg.ui @@ -668,136 +668,6 @@ You can always drag-and-drop tracks on screen to clone a deck. spinBoxTemporaryRateFine - - - SliderRateRampSensitivity - valueChanged(int) - SpinBoxRateRampSensitivity - setValue(int) - - - 372 - 442 - - - 437 - 445 - - - - - SpinBoxRateRampSensitivity - valueChanged(int) - SliderRateRampSensitivity - setValue(int) - - - 437 - 445 - - - 372 - 442 - - - - - radioButtonRateRampModeLinear - toggled(bool) - labelSpeedRampSensitivity - setEnabled(bool) - - - 438 - 417 - - - 117 - 446 - - - - - radioButtonRateRampModeLinear - toggled(bool) - SliderRateRampSensitivity - setEnabled(bool) - - - 438 - 417 - - - 372 - 442 - - - - - radioButtonRateRampModeLinear - toggled(bool) - SpinBoxRateRampSensitivity - setEnabled(bool) - - - 438 - 417 - - - 437 - 445 - - - - - radioButtonRateRampModeStepping - toggled(bool) - labelSpeedTemporary - setEnabled(bool) - - - 263 - 417 - - - 438 - 467 - - - - - radioButtonRateRampModeStepping - toggled(bool) - spinBoxTemporaryRateCoarse - setEnabled(bool) - - - 263 - 417 - - - 438 - 493 - - - - - radioButtonRateRampModeStepping - toggled(bool) - spinBoxTemporaryRateFine - setEnabled(bool) - - - 263 - 417 - - - 438 - 521 - - - - diff --git a/src/preferences/dialog/dlgprefmodplug.cpp b/src/preferences/dialog/dlgprefmodplug.cpp index 41d4bce4782..8a5097a0ab1 100644 --- a/src/preferences/dialog/dlgprefmodplug.cpp +++ b/src/preferences/dialog/dlgprefmodplug.cpp @@ -16,6 +16,19 @@ DlgPrefModplug::DlgPrefModplug(QWidget *parent, m_pConfig(_config) { m_pUi->setupUi(this); m_pUi->advancedSettings->setVisible(m_pUi->showAdvanced->isChecked()); + + connect(m_pUi->memoryLimit, + &QAbstractSlider::valueChanged, + m_pUi->memoryLimitSpin, + &QSpinBox::setValue); + connect(m_pUi->memoryLimitSpin, + QOverload::of(&QSpinBox::valueChanged), + m_pUi->memoryLimit, + &QAbstractSlider::setValue); + connect(m_pUi->showAdvanced, + &QAbstractButton::toggled, + m_pUi->advancedSettings, + &QWidget::setVisible); } DlgPrefModplug::~DlgPrefModplug() { diff --git a/src/preferences/dialog/dlgprefmodplugdlg.ui b/src/preferences/dialog/dlgprefmodplugdlg.ui index 4edc3efcc57..fa62ff17a5f 100644 --- a/src/preferences/dialog/dlgprefmodplugdlg.ui +++ b/src/preferences/dialog/dlgprefmodplugdlg.ui @@ -543,54 +543,4 @@ surroundDelay - - - memoryLimit - valueChanged(int) - memoryLimitSpin - setValue(int) - - - 405 - 58 - - - 556 - 58 - - - - - memoryLimitSpin - valueChanged(int) - memoryLimit - setValue(int) - - - 556 - 58 - - - 405 - 58 - - - - - showAdvanced - toggled(bool) - advancedSettings - setVisible(bool) - - - 97 - 154 - - - 395 - 323 - - - - From 9213b41a02c408bf82b0606f3a71646036f7d1e7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Nov 2020 20:57:44 +0100 Subject: [PATCH 3/3] GitHub Actions: Use clazy level2 blocklist to make skipped tests explicit --- .github/workflows/clazy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clazy.yml b/.github/workflows/clazy.yml index f64fe067865..8c5a08c1f3e 100644 --- a/.github/workflows/clazy.yml +++ b/.github/workflows/clazy.yml @@ -82,4 +82,4 @@ jobs: run: cmake --build . -j $(nproc) working-directory: cmake_build env: - CLAZY_CHECKS: level1,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast + CLAZY_CHECKS: level2,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast,no-qstring-allocations,no-function-args-by-value,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-missing-qobject-macro,no-rule-of-three,no-returning-void-expression,no-missing-typeinfo,no-base-class-event