summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRJ Skerry-Ryan <rryan@mixxx.org>2018-10-25 22:39:12 -0700
committerRJ Skerry-Ryan <rryan@mixxx.org>2018-10-26 00:14:38 -0700
commit10ec4cb3d6c5d6a3d7727ef74a16c7c3526ed30f (patch)
tree033cc4304a434c024d3ffde5450ac0d51908ee26 /src
parent398b533a847db24ddb6f3d30e1d2964f62308cbf (diff)
Fix some issues identified by clazy.
Diffstat (limited to 'src')
-rw-r--r--src/control/control.cpp13
-rw-r--r--src/control/controlmodel.cpp1
-rw-r--r--src/control/controlobjectscript.cpp4
-rw-r--r--src/control/controlobjectscript.h4
-rw-r--r--src/controllers/controllerengine.cpp10
-rw-r--r--src/controllers/controlpickermenu.cpp6
-rw-r--r--src/controllers/keyboard/keyboardeventfilter.cpp5
-rw-r--r--src/controllers/learningutils.cpp22
-rw-r--r--src/controllers/midi/midicontroller.cpp13
-rw-r--r--src/controllers/midi/midicontrollerpresetfilehandler.cpp8
-rw-r--r--src/dialog/dlgdevelopertools.cpp7
-rw-r--r--src/effects/lv2/lv2backend.cpp7
-rw-r--r--src/engine/cachingreader.cpp2
-rw-r--r--src/engine/enginebuffer.cpp10
-rw-r--r--src/engine/loopingcontrol.cpp2
-rw-r--r--src/library/baseplaylistfeature.cpp16
-rw-r--r--src/library/basetrackcache.cpp5
-rw-r--r--src/library/browse/foldertreemodel.cpp4
-rw-r--r--src/library/dao/analysisdao.cpp1
-rw-r--r--src/library/dao/playlistdao.cpp7
-rw-r--r--src/library/dao/trackdao.cpp4
-rw-r--r--src/library/proxytrackmodel.cpp2
-rw-r--r--src/mixer/playermanager.cpp6
-rw-r--r--src/musicbrainz/acoustidclient.cpp2
-rw-r--r--src/musicbrainz/musicbrainzclient.cpp2
-rw-r--r--src/preferences/broadcastsettings.cpp8
-rw-r--r--src/preferences/broadcastsettingsmodel.cpp22
-rw-r--r--src/preferences/configobject.cpp6
-rw-r--r--src/preferences/dialog/dlgprefbroadcast.cpp32
-rw-r--r--src/preferences/dialog/dlgprefkey.cpp22
-rw-r--r--src/skin/imgloader.cpp9
-rw-r--r--src/skin/legacyskinparser.cpp6
-rw-r--r--src/skin/skincontext.cpp4
-rw-r--r--src/soundio/sounddevice.cpp6
-rw-r--r--src/soundio/soundmanager.cpp19
-rw-r--r--src/soundio/soundmanagerconfig.cpp1
-rw-r--r--src/sources/soundsourceproviderregistry.cpp5
-rw-r--r--src/track/beatmap.cpp24
-rw-r--r--src/track/beatutils.cpp2
-rw-r--r--src/track/keyfactory.cpp4
-rw-r--r--src/track/keyutils.cpp19
-rw-r--r--src/track/trackmetadatataglib.cpp2
-rw-r--r--src/util/logging.cpp2
-rw-r--r--src/util/stat.cpp4
-rw-r--r--src/util/statmodel.cpp5
-rw-r--r--src/util/statsmanager.cpp17
-rw-r--r--src/waveform/renderers/waveformmark.cpp2
-rw-r--r--src/widget/wwidgetstack.cpp6
48 files changed, 176 insertions, 214 deletions
diff --git a/src/control/control.cpp b/src/control/control.cpp
index 0e757ed43e..1cbc550e43 100644
--- a/src/control/control.cpp
+++ b/src/control/control.cpp
@@ -84,9 +84,8 @@ ControlDoublePrivate::~ControlDoublePrivate() {
void ControlDoublePrivate::insertAlias(const ConfigKey& alias, const ConfigKey& key) {
MMutexLocker locker(&s_qCOHashMutex);
- QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> >::const_iterator it =
- s_qCOHash.find(key);
- if (it == s_qCOHash.end()) {
+ auto it = s_qCOHash.constFind(key);
+ if (it == s_qCOHash.constEnd()) {
qWarning() << "WARNING: ControlDoublePrivate::insertAlias called for null control" << key;
return;
}
@@ -118,9 +117,8 @@ QSharedPointer<ControlDoublePrivate> ControlDoublePrivate::getControl(
// Scope for MMutexLocker.
{
MMutexLocker locker(&s_qCOHashMutex);
- QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> >::const_iterator it = s_qCOHash.find(key);
-
- if (it != s_qCOHash.end()) {
+ auto it = s_qCOHash.constFind(key);
+ if (it != s_qCOHash.constEnd()) {
if (pCreatorCO) {
if (warn) {
qDebug() << "ControlObject" << key.group << key.item << "already created";
@@ -152,8 +150,7 @@ void ControlDoublePrivate::getControls(
QList<QSharedPointer<ControlDoublePrivate> >* pControlList) {
s_qCOHashMutex.lock();
pControlList->clear();
- for (QHash<ConfigKey, QWeakPointer<ControlDoublePrivate> >::const_iterator it = s_qCOHash.begin();
- it != s_qCOHash.end(); ++it) {
+ for (auto it = s_qCOHash.constBegin(); it != s_qCOHash.constEnd(); ++it) {
QSharedPointer<ControlDoublePrivate> pControl = it.value();
if (!pControl.isNull()) {
pControlList->push_back(pControl);
diff --git a/src/control/controlmodel.cpp b/src/control/controlmodel.cpp
index 0f431fa4af..c3e30168f3 100644
--- a/src/control/controlmodel.cpp
+++ b/src/control/controlmodel.cpp
@@ -59,7 +59,6 @@ QVariant ControlModel::data(const QModelIndex& index,
}
const ControlInfo& control = m_controls.at(row);
- QString value;
switch (column) {
case CONTROL_COLUMN_GROUP:
return control.key.group;
diff --git a/src/control/controlobjectscript.cpp b/src/control/controlobjectscript.cpp
index 2922417334..1705b895e5 100644
--- a/src/control/controlobjectscript.cpp
+++ b/src/control/controlobjectscript.cpp
@@ -57,7 +57,7 @@ void ControlObjectScript::removeScriptConnection(const ScriptConnection& conn) {
void ControlObjectScript::disconnectAllConnectionsToFunction(const QScriptValue& function) {
// Make a local copy of m_scriptConnections because items are removed within the loop.
- QList<ScriptConnection> connections = m_scriptConnections;
+ auto connections = m_scriptConnections;
for (const auto& conn: connections) {
if (conn.callback.strictlyEquals(function)) {
removeScriptConnection(conn);
@@ -70,7 +70,7 @@ void ControlObjectScript::slotValueChanged(double value, QObject*) {
// This allows a script to disconnect a callback from inside the
// the callback. Otherwise the this may crash since the disconnect call
// happens during conn.function.call() in the middle of the loop below.
- QList<ScriptConnection> connections = m_scriptConnections;
+ auto connections = m_scriptConnections;
for (auto&& conn: connections) {
conn.executeCallback(value);
}
diff --git a/src/control/controlobjectscript.h b/src/control/controlobjectscript.h
index 15e29aedf6..61079333d5 100644
--- a/src/control/controlobjectscript.h
+++ b/src/control/controlobjectscript.h
@@ -1,6 +1,8 @@
#ifndef CONTROLOBJECTSCRIPT_H
#define CONTROLOBJECTSCRIPT_H
+#include <QVector>
+
#include "controllers/controllerengine.h"
#include "controllers/controllerdebug.h"
#include "control/controlproxy.h"
@@ -36,7 +38,7 @@ class ControlObjectScript : public ControlProxy {
void slotValueChanged(double v, QObject*);
private:
- QList<ScriptConnection> m_scriptConnections;
+ QVector<ScriptConnection> m_scriptConnections;
};
#endif // CONTROLOBJECTSCRIPT_H
diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp
index b9c069a53d..0aa1d102a5 100644
--- a/src/controllers/controllerengine.cpp
+++ b/src/controllers/controllerengine.cpp
@@ -113,10 +113,8 @@ QScriptValue ControllerEngine::wrapFunctionCode(const QString& codeSnippet,
int numberOfArgs) {
QScriptValue wrappedFunction;
- QHash<QString, QScriptValue>::const_iterator i =
- m_scriptWrappedFunctionCache.find(codeSnippet);
-
- if (i != m_scriptWrappedFunctionCache.end()) {
+ auto i = m_scriptWrappedFunctionCache.constFind(codeSnippet);
+ if (i != m_scriptWrappedFunctionCache.constEnd()) {
wrappedFunction = i.value();
} else {
QStringList wrapperArgList;
@@ -1104,8 +1102,8 @@ void ControllerEngine::timerEvent(QTimerEvent *event) {
return;
}
- QHash<int, TimerInfo>::const_iterator it = m_timers.find(timerId);
- if (it == m_timers.end()) {
+ auto it = m_timers.constFind(timerId);
+ if (it == m_timers.constEnd()) {
qWarning() << "Timer" << timerId << "fired but there's no function mapped to it!";
return;
}
diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp
index 17f3f49ba7..8b82f05b68 100644
--- a/src/controllers/controlpickermenu.cpp
+++ b/src/controllers/controlpickermenu.cpp
@@ -432,7 +432,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
tr("Replace Auto DJ Queue with selected tracks"),
m_libraryStr, libraryMenu);
-
+
// Load track (these can be loaded into any channel)
addDeckAndSamplerControl("LoadSelectedTrack",
tr("Load Track"),
@@ -1072,10 +1072,6 @@ void ControlPickerMenu::addAvailableControl(ConfigKey key,
}
bool ControlPickerMenu::controlExists(ConfigKey key) const {
- qDebug() << "LOOKING FOR KEY " << key;
- foreach(const ConfigKey& key, m_titlesByKey.keys()) {
- qDebug() << "key: " << key;
- }
return m_titlesByKey.contains(key);
}
diff --git a/src/controllers/keyboard/keyboardeventfilter.cpp b/src/controllers/keyboard/keyboardeventfilter.cpp
index b62fc2dda6..28305f59ff 100644
--- a/src/controllers/keyboard/keyboardeventfilter.cpp
+++ b/src/controllers/keyboard/keyboardeventfilter.cpp
@@ -51,9 +51,8 @@ bool KeyboardEventFilter::eventFilter(QObject*, QEvent* e) {
// Check if a shortcut is defined
bool result = false;
// using const_iterator here is faster than QMultiHash::values()
- for (QMultiHash<ConfigValueKbd, ConfigKey>::const_iterator it =
- m_keySequenceToControlHash.find(ksv);
- it != m_keySequenceToControlHash.end() && it.key() == ksv; ++it) {
+ for (auto it = m_keySequenceToControlHash.constFind(ksv);
+ it != m_keySequenceToControlHash.constEnd() && it.key() == ksv; ++it) {
const ConfigKey& configKey = it.value();
if (configKey.group != "[KeyboardShortcuts]") {
ControlObject* control = ControlObject::getControl(configKey);
diff --git a/src/controllers/learningutils.cpp b/src/controllers/learningutils.cpp
index dfd28caf5b..4df4710df3 100644
--- a/src/controllers/learningutils.cpp
+++ b/src/controllers/learningutils.cpp
@@ -73,19 +73,17 @@ MidiInputMappings LearningUtils::guessMidiInputMappings(
qDebug() << "Control:" << control;
}
- for (QMap<unsigned char, int>::const_iterator it = stats.value_histogram.begin();
- it != stats.value_histogram.end(); ++it) {
+ for (auto it = stats.value_histogram.constBegin();
+ it != stats.value_histogram.constEnd(); ++it) {
qDebug() << "Overall Value:" << it.key()
<< "count" << it.value();
}
- for (QMap<unsigned char, MessageStats>::const_iterator control_it =
- stats_by_control.begin();
- control_it != stats_by_control.end(); ++control_it) {
+ for (auto control_it = stats_by_control.constBegin();
+ control_it != stats_by_control.constEnd(); ++control_it) {
QString controlName = QString("Control %1").arg(control_it.key());
- for (QMap<unsigned char, int>::const_iterator it =
- control_it->value_histogram.begin();
- it != control_it->value_histogram.end(); ++it) {
+ for (auto it = control_it->value_histogram.constBegin();
+ it != control_it->value_histogram.constEnd(); ++it) {
qDebug() << controlName << "Value:" << it.key()
<< "count" << it.value();
}
@@ -103,8 +101,8 @@ MidiInputMappings LearningUtils::guessMidiInputMappings(
bool has_cc = stats.opcodes.contains(MIDI_CC);
bool only_cc = stats.opcodes.size() == 1 && has_cc;
int num_cc_controls = 0;
- for (QMap<unsigned char, MessageStats>::const_iterator it = stats_by_control.begin();
- it != stats_by_control.end(); ++it) {
+ for (auto it = stats_by_control.constBegin();
+ it != stats_by_control.constEnd(); ++it) {
if (it->opcodes.contains(MIDI_CC)) {
num_cc_controls++;
}
@@ -225,8 +223,8 @@ MidiInputMappings LearningUtils::guessMidiInputMappings(
// Find the CC control (based on the predicate one must exist) and add a
// binding for it.
- for (QMap<unsigned char, MessageStats>::const_iterator it = stats_by_control.begin();
- it != stats_by_control.end(); ++it) {
+ for (auto it = stats_by_control.constBegin();
+ it != stats_by_control.constEnd(); ++it) {
if (it->opcodes.contains(MIDI_CC)) {
MidiKey knob;
knob.status = MIDI_CC | *stats.channels.begin();
diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp
index 8dec542e7a..0176aa653e 100644
--- a/src/controllers/midi/midicontroller.cpp
+++ b/src/controllers/midi/midicontroller.cpp
@@ -211,7 +211,7 @@ void MidiController::receive(unsigned char status, unsigned char control,
emit(messageReceived(status, control, value));
auto it = m_temporaryInputMappings.constFind(mappingKey.key);
- if (it != m_temporaryInputMappings.end()) {
+ if (it != m_temporaryInputMappings.constEnd()) {
for (; it != m_temporaryInputMappings.end() && it.key() == mappingKey.key; ++it) {
processInputMapping(it.value(), status, control, value, timestamp);
}
@@ -220,7 +220,7 @@ void MidiController::receive(unsigned char status, unsigned char control,
}
auto it = m_preset.inputMappings.constFind(mappingKey.key);
- for (; it != m_preset.inputMappings.end() && it.key() == mappingKey.key; ++it) {
+ for (; it != m_preset.inputMappings.constEnd() && it.key() == mappingKey.key; ++it) {
processInputMapping(it.value(), status, control, value, timestamp);
}
}
@@ -271,8 +271,7 @@ void MidiController::processInputMapping(const MidiInputMapping& mapping,
if (mapping_is_14bit) {
bool found = false;
- for (QList<QPair<MidiInputMapping, unsigned char> >::iterator it =
- m_fourteen_bit_queued_mappings.begin();
+ for (auto it = m_fourteen_bit_queued_mappings.begin();
it != m_fourteen_bit_queued_mappings.end(); ++it) {
if (it->first.control == mapping.control) {
if ((it->first.options.fourteen_bit_lsb && mapping.options.fourteen_bit_lsb) ||
@@ -463,8 +462,8 @@ void MidiController::receive(QByteArray data, mixxx::Duration timestamp) {
emit(messageReceived(mappingKey.status, mappingKey.control, 0x7F));
auto it = m_temporaryInputMappings.constFind(mappingKey.key);
- if (it != m_temporaryInputMappings.end()) {
- for (; it != m_temporaryInputMappings.end() && it.key() == mappingKey.key; ++it) {
+ if (it != m_temporaryInputMappings.constEnd()) {
+ for (; it != m_temporaryInputMappings.constEnd() && it.key() == mappingKey.key; ++it) {
processInputMapping(it.value(), data, timestamp);
}
return;
@@ -472,7 +471,7 @@ void MidiController::receive(QByteArray data, mixxx::Duration timestamp) {
}
auto it = m_preset.inputMappings.constFind(mappingKey.key);
- for (; it != m_preset.inputMappings.end() && it.key() == mappingKey.key; ++it) {
+ for (; it != m_preset.inputMappings.constEnd() && it.key() == mappingKey.key; ++it) {
processInputMapping(it.value(), data, timestamp);
}
}
diff --git a/src/controllers/midi/midicontrollerpresetfilehandler.cpp b/src/controllers/midi/midicontrollerpresetfilehandler.cpp
index 682e091441..32e0124476 100644
--- a/src/controllers/midi/midicontrollerpresetfilehandler.cpp
+++ b/src/controllers/midi/midicontrollerpresetfilehandler.cpp
@@ -211,8 +211,8 @@ void MidiControllerPresetFileHandler::addControlsToDocument(const MidiController
// to remove duplicate keys or else we'll duplicate those values.
auto sortedInputKeys = preset.inputMappings.uniqueKeys();
std::sort(sortedInputKeys.begin(), sortedInputKeys.end());
- for (auto key : sortedInputKeys) {
- for (auto it = preset.inputMappings.constFind(key);
+ for (const auto& key : sortedInputKeys) {
+ for (auto it = preset.inputMappings.constFind(key);
it != preset.inputMappings.constEnd() && it.key() == key; ++it) {
QDomElement controlNode = inputMappingToXML(doc, it.value());
controls.appendChild(controlNode);
@@ -225,8 +225,8 @@ void MidiControllerPresetFileHandler::addControlsToDocument(const MidiController
QDomElement outputs = doc->createElement("outputs");
auto sortedOutputKeys = preset.outputMappings.uniqueKeys();
std::sort(sortedOutputKeys.begin(), sortedOutputKeys.end());
- for (auto key : sortedOutputKeys) {
- for (auto it = preset.outputMappings.constFind(key);
+ for (const auto& key : sortedOutputKeys) {
+ for (auto it = preset.outputMappings.constFind(key);
it != preset.outputMappings.constEnd() && it.key() == key; ++it) {
QDomElement outputNode = outputMappingToXML(doc, it.value());
outputs.appendChild(outputNode);
diff --git a/src/dialog/dlgdevelopertools.cpp b/src/dialog/dlgdevelopertools.cpp
index d80b3a5232..8691e6453d 100644
--- a/src/dialog/dlgdevelopertools.cpp
+++ b/src/dialog/dlgdevelopertools.cpp
@@ -18,8 +18,8 @@ DlgDeveloperTools::DlgDeveloperTools(QWidget* pParent,
QHash<ConfigKey, ConfigKey> controlAliases =
ControlDoublePrivate::getControlAliases();
- for (QList<QSharedPointer<ControlDoublePrivate> >::const_iterator it = controlsList.begin();
- it != controlsList.end(); ++it) {
+ for (auto it = controlsList.constBegin();
+ it != controlsList.constEnd(); ++it) {
const QSharedPointer<ControlDoublePrivate>& pControl = *it;
if (pControl) {
m_controlModel.addControl(pControl->getKey(), pControl->name(),
@@ -142,8 +142,7 @@ void DlgDeveloperTools::slotControlDump() {
QList<QSharedPointer<ControlDoublePrivate> > controlsList;
ControlDoublePrivate::getControls(&controlsList);
- for (QList<QSharedPointer<ControlDoublePrivate> >::const_iterator it =
- controlsList.begin(); it != controlsList.end(); ++it) {
+ for (auto it = controlsList.constBegin(); it != controlsList.constEnd(); ++it) {
const QSharedPointer<ControlDoublePrivate>& pControl = *it;
if (pControl) {
QString line = pControl->getKey().group + "," +
diff --git a/src/effects/lv2/lv2backend.cpp b/src/effects/lv2/lv2backend.cpp
index f32956cd2a..2a5090805c 100644
--- a/src/effects/lv2/lv2backend.cpp
+++ b/src/effects/lv2/lv2backend.cpp
@@ -54,7 +54,12 @@ const QList<QString> LV2Backend::getEffectIds() const {
}
const QSet<QString> LV2Backend::getDiscoveredPluginIds() const {
- return m_registeredEffects.keys().toSet();
+ QSet<QString> pluginIds;
+ for (auto it = m_registeredEffects.constBegin();
+ it != m_registeredEffects.constEnd(); ++it) {
+ pluginIds.insert(it.key());
+ }
+ return pluginIds;
}
bool LV2Backend::canInstantiateEffect(const QString& effectId) const {
diff --git a/src/engine/cachingreader.cpp b/src/engine/cachingreader.cpp
index d52404df83..89012638d9 100644
--- a/src/engine/cachingreader.cpp
+++ b/src/engine/cachingreader.cpp
@@ -89,7 +89,7 @@ void CachingReader::freeChunk(CachingReaderChunkForOwner* pChunk) {
}
void CachingReader::freeAllChunks() {
- for (CachingReaderChunkForOwner* pChunk: m_chunks) {
+ for (CachingReaderChunkForOwner* pChunk: qAsConst(m_chunks)) {
// We will receive CHUNK_READ_INVALID for all pending chunk reads
// which should free the chunks individually.
if (pChunk->getState() == CachingReaderChunkForOwner::READ_PENDING) {
diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp
index 79d0aa95be..5fdb3ebd4a 100644
--- a/src/engine/enginebuffer.cpp
+++ b/src/engine/enginebuffer.cpp
@@ -461,8 +461,8 @@ void EngineBuffer::setNewPlaypos(double newpos, bool adjustingPhase) {
m_iSamplesCalculated = 1000000;
// Must hold the engineLock while using m_engineControls
- for (QList<EngineControl*>::iterator it = m_engineControls.begin();
- it != m_engineControls.end(); ++it) {
+ for (auto it = m_engineControls.constBegin();
+ it != m_engineControls.constEnd(); ++it) {
EngineControl *pControl = *it;
pControl->notifySeek(m_filepos_play, adjustingPhase);
}
@@ -1021,9 +1021,7 @@ void EngineBuffer::process(CSAMPLE* pOutput, const int iBufferSize) {
}
}
- QListIterator<EngineControl*> it(m_engineControls);
- while (it.hasNext()) {
- EngineControl* pControl = it.next();
+ for (const auto& pControl : qAsConst(m_engineControls)) {
pControl->setCurrentSample(m_filepos_play, m_trackSamplesOld);
pControl->process(rate, m_filepos_play, m_trackSamplesOld, iBufferSize);
}
@@ -1279,7 +1277,7 @@ void EngineBuffer::hintReader(const double dRate) {
m_hintList.append(hint);
}
- for (const auto& pControl: m_engineControls) {
+ for (const auto& pControl : qAsConst(m_engineControls)) {
pControl->hintReader(&m_hintList);
}
m_pReader->hintAndMaybeWake(m_hintList);
diff --git a/src/engine/loopingcontrol.cpp b/src/engine/loopingcontrol.cpp
index d5eedaebd1..bf51dfd9eb 100644
--- a/src/engine/loopingcontrol.cpp
+++ b/src/engine/loopingcontrol.cpp
@@ -911,7 +911,7 @@ void LoopingControl::updateBeatLoopingControls() {
// O(n) search, but there are only ~10-ish beatloop controls so this is
// fine.
double dBeatloopSize = m_pCOBeatLoopSize->get();
- for (BeatLoopingControl* pBeatLoopControl: m_beatLoops) {
+ for (BeatLoopingControl* pBeatLoopControl: qAsConst(m_beatLoops)) {
if (pBeatLoopControl->getSize() == dBeatloopSize) {
if (m_bLoopingEnabled) {
pBeatLoopControl->activate();
diff --git a/src/library/baseplaylistfeature.cpp b/src/library/baseplaylistfeature.cpp
index 0971edbcfb..d2f77e26a4 100644
--- a/src/library/baseplaylistfeature.cpp
+++ b/src/library/baseplaylistfeature.cpp
@@ -623,8 +623,8 @@ QModelIndex BasePlaylistFeature::constructChildModel(int selected_id) {
int selected_row = -1;
int row = 0;
- for (QList<QPair<int, QString> >::const_iterator it = m_playlistList.begin();
- it != m_playlistList.end(); ++it, ++row) {
+ for (auto it = m_playlistList.constBegin();
+ it != m_playlistList.constEnd(); ++it, ++row) {
int playlist_id = it->first;
QString playlist_name = it->second;
@@ -654,8 +654,8 @@ void BasePlaylistFeature::updateChildModel(int selected_id) {
buildPlaylistList();
int row = 0;
- for (QList<QPair<int, QString> >::const_iterator it = m_playlistList.begin();
- it != m_playlistList.end(); ++it, ++row) {
+ for (auto it = m_playlistList.constBegin();
+ it != m_playlistList.constEnd(); ++it, ++row) {
int playlist_id = it->first;
QString playlist_name = it->second;
@@ -680,8 +680,8 @@ void BasePlaylistFeature::clearChildModel() {
QModelIndex BasePlaylistFeature::indexFromPlaylistId(int playlistId) {
int row = 0;
- for (QList<QPair<int, QString> >::const_iterator it = m_playlistList.begin();
- it != m_playlistList.end(); ++it, ++row) {
+ for (auto it = m_playlistList.constBegin();
+ it != m_playlistList.constEnd(); ++it, ++row) {
int current_id = it->first;
QString playlist_name = it->second;
@@ -708,8 +708,8 @@ void BasePlaylistFeature::slotTrackSelected(TrackPointer pTrack) {
// Set all playlists the track is in bold (or if there is no track selected,
// clear all the bolding).
int row = 0;
- for (QList<QPair<int, QString> >::const_iterator it = m_playlistList.begin();
- it != m_playlistList.end(); ++it, ++row) {
+ for (auto it = m_playlistList.constBegin();
+ it != m_playlistList.constEnd(); ++it, ++row) {
TreeItem* playlist = rootItem->child(row);
if (playlist == nullptr) {
continue;
diff --git a/src/library/basetrackcache.cpp b/src/library/basetrackcache.cpp
index c11060d766..fcceaec9d3 100644
--- a/src/library/basetrackcache.cpp
+++ b/src/library/basetrackcache.cpp
@@ -452,9 +452,8 @@ QVariant BaseTrackCache::data(TrackId trackId, int column) const {
// metadata. Currently the upper-levels will not delegate row-specific
// columns to this method, but there should still be a check here I think.
if (!result.isValid()) {
- QHash<TrackId, QVector<QVariant> >::const_iterator it =
- m_trackInfo.find(trackId);
- if (it != m_trackInfo.end()) {
+ auto it = m_trackInfo.constFind(trackId);
+ if (it != m_trackInfo.constEnd()) {
const QVector<QVariant>& fields = it.value();
result = fields.value(column, result);
}
diff --git a/src/library/browse/foldertreemodel.cpp b/src/library/browse/foldertreemodel.cpp
index a91cb8eae0..03738bed54 100644
--- a/src/library/browse/foldertreemodel.cpp
+++ b/src/library/browse/foldertreemodel.cpp
@@ -50,8 +50,8 @@ bool FolderTreeModel::hasChildren(const QModelIndex& parent) const {
}
bool FolderTreeModel::directoryHasChildren(const QString& path) const {
- QHash<QString, bool>::const_iterator it = m_directoryCache.find(path);
- if (it != m_directoryCache.end()) {
+ auto it = m_directoryCache.constFind(path);
+ if (it != m_directoryCache.constEnd()) {
return it.value();
}
diff --git a/src/library/dao/analysisdao.cpp b/src/library/dao/analysisdao.cpp
index 58121296e8..f1a43c2810 100644
--- a/src/library/dao/analysisdao.cpp
+++ b/src/library/dao/analysisdao.cpp
@@ -125,7 +125,6 @@ bool AnalysisDao::saveAnalysis(AnalysisDao::AnalysisInfo* info) {
"VALUES (:trackId,:type,:description,:version,:data_checksum)")
.arg(s_analysisTableName));
- QByteArray waveformBytes;
query.bindValue(":trackId", info->trackId.toVariant());
query.bindValue(":type", info->type);
query.bindValue(":description", info->description);
diff --git a/src/library/dao/playlistdao.cpp b/src/library/dao/playlistdao.cpp
index e05a524420..dd206a7ca8 100644
--- a/src/library/dao/playlistdao.cpp
+++ b/src/library/dao/playlistdao.cpp
@@ -457,7 +457,6 @@ void PlaylistDAO::removeTracksFromPlaylist(const int playlistId, QList<int>& pos
//qDebug() << "PlaylistDAO::removeTrackFromPlaylist"
// << QThread::currentThread() << m_data