diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2020-05-11 23:23:51 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2020-05-16 20:55:55 +0200 |
commit | fccf48f5af1fced9af1f2d3fc0781607cb36d919 (patch) | |
tree | d4f3724d1bcdfdfdaa5e6c799e1d0ae563959ff2 /src/waveform | |
parent | 472d443cb56c2e7d1791ac9a3ec8cab03ffd10ad (diff) |
Don't use a non const references in WaveformWidgetFactory::setWidgetType()
Diffstat (limited to 'src/waveform')
-rw-r--r-- | src/waveform/waveformwidgetfactory.cpp | 25 | ||||
-rw-r--r-- | src/waveform/waveformwidgetfactory.h | 4 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 0c0c3037c8..c3354c8e7e 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -316,8 +316,8 @@ bool WaveformWidgetFactory::setConfig(UserSettingsPointer config) { m_config->getValueString(ConfigKey("[Waveform]","WaveformType")).toInt(&ok)); // Store the widget type on m_configType for later initialization. // We will initialize the objects later because of a problem with GL on QT 5.14.2 on Windows - if (!ok || !setWidgetType(type, m_configType)) { - setWidgetType(autoChooseWidgetType(), m_configType); + if (!ok || !setWidgetType(type, &m_configType)) { + setWidgetType(autoChooseWidgetType(), &m_configType); } for (int i = 0; i < FilterCount; i++) { @@ -449,28 +449,35 @@ int WaveformWidgetFactory::getVSyncType() { } bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type) { - return setWidgetType(type, m_type); + return setWidgetType(type, &m_type); } -bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type, WaveformWidgetType::Type& currentType) { - if (type == currentType) +bool WaveformWidgetFactory::setWidgetType( + WaveformWidgetType::Type type, + WaveformWidgetType::Type* pCurrentType) { + if (type == *pCurrentType) { return true; + } // check if type is acceptable int index = findHandleIndexFromType(type); if (index > -1) { // type is acceptable - currentType = type; + *pCurrentType = type; if (m_config) { - m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); + m_config->setValue( + ConfigKey("[Waveform]", "WaveformType"), + static_cast<int>(*pCurrentType)); } return true; } // fallback - currentType = WaveformWidgetType::EmptyWaveform; + *pCurrentType = WaveformWidgetType::EmptyWaveform; if (m_config) { - m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); + m_config->setValue( + ConfigKey("[Waveform]", "WaveformType"), + static_cast<int>(*pCurrentType)); } return false; } diff --git a/src/waveform/waveformwidgetfactory.h b/src/waveform/waveformwidgetfactory.h index 83e26c579f..7b09932fde 100644 --- a/src/waveform/waveformwidgetfactory.h +++ b/src/waveform/waveformwidgetfactory.h @@ -96,7 +96,9 @@ class WaveformWidgetFactory : public QObject, public Singleton<WaveformWidgetFac WaveformWidgetType::Type getType() const { return m_type;} protected: - bool setWidgetType(WaveformWidgetType::Type type, WaveformWidgetType::Type& currentType); + bool setWidgetType( + WaveformWidgetType::Type type, + WaveformWidgetType::Type* pCurrentType); public: void setDefaultZoom(double zoom); |