From 4e1bebf0f5e06ecdd99c41771e7b4ee19c0cdcf3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 17 Nov 2020 20:02:14 +0100 Subject: 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 +- src/controllers/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 +- src/engine/cachingreader/cachingreaderworker.cpp | 2 +- src/engine/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 +- src/musicbrainz/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 +- src/test/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 +- src/waveform/renderers/waveformwidgetrenderer.cpp | 2 +- src/waveform/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(-) (limited to 'src') diff --git a/src/analyzer/analyzerbeats.cpp b/src/analyzer/analyzerbeats.cpp index 62b98115cb..67dd45d17f 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 01b9098f28..e0667149e6 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 fc9bb3ee09..a11f711525 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 52ba45b88b..b25fec8b07 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 f7dba829fc..ec0a6a1b0f 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 c12ccc3723..86b13f2c26 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 6edecb5ca4..680b792831 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 8e4ade0d4d..46598c3373 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 9b0ae2f9f9..6f988913f3 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 da89fafb06..9f2f89c395 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 d0e55f4d38..9264b67774 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 8ffc6b1644..8c16262d6f 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 169cade841..cf01306458 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 eabb38e07b..b0a10e2ae8 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 be6778c915..3dd146a6e9 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 1bbd3c986d..a323ac3133 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 1109f2b971..2d655b02b0 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 d723c8b8a1..62ec95b452 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 c3ab24cca5..deaa65f91a 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 b958992425..98c8e95537 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 c92b06152d..b0c4e40163 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 1ec4a93e0f..05e7d6bd93 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 543046e576..5aa71b84ce 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 22a6d49b93..b6f3ae5f53 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 9ac26c01e1..a62b77ef43 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 ef56a8eb2a..a3dee755c7 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 6fe0486d56..29c4e9dd9b 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 408ee217b5..d523ee5329 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 93b97bab6a..930c8c48d6 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 edef5bd2f9..59ba41eeb2 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 4e95615923..b1b9e0bf0a 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 94e32869ba..018c2cfd64 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 05e2cb9055..10157ed257 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 c8d7cf1590..3272bd0494 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 3a08f062d5..898b5cb033 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 1ec78e1ddf..0b816e0132 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 06fed55a48..b98ac4c796 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 53b6e0085e..7002f3cb85 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 dad8c785bc..9caab019b7 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