From a74c65d6469a2f1ce0d1927ffbd73be90bf754c5 Mon Sep 17 00:00:00 2001 From: RJ Ryan Date: Tue, 18 Nov 2014 00:11:37 -0500 Subject: [PATCH] Code fascism. * Fix compiler warnings in non-3rd-party code. * Add some missing const-references. * Eliminate cases of "if(" "( ... )" and "for(". --- src/analyserbeats.cpp | 4 +- src/analyserkey.cpp | 4 +- src/analyserqueue.cpp | 2 +- src/analyserwaveform.cpp | 6 +- src/analyserwaveform.h | 22 ++--- src/audiotagger.cpp | 2 +- src/audiotagger.h | 28 +++--- src/configobject.cpp | 6 +- src/controllers/controllerengine.cpp | 5 +- src/controllers/controllerpresetinfo.cpp | 3 +- src/controllers/controllerpresetinfo.h | 1 - src/controlobjectslave.h | 2 +- src/controlobjectthread.h | 2 +- src/controlvaluedelegate.cpp | 44 ++++----- src/dlgprefbeats.cpp | 21 ++--- src/dlgprefkey.cpp | 10 +- src/dlgpreflibrary.cpp | 2 +- src/dlgprefrecord.cpp | 2 +- src/dlgprefwaveform.cpp | 10 +- src/dlgprefwaveform.h | 2 +- src/dlgtrackinfo.cpp | 2 +- src/effects/native/bessel8lvmixeqeffect.cpp | 9 +- src/effects/native/echoeffect.cpp | 1 + src/effects/native/filtereffect.cpp | 2 +- src/effects/native/flangereffect.cpp | 1 + .../native/moogladder4filtereffect.cpp | 2 +- src/effects/native/reverbeffect.cpp | 1 + src/encoder/encoderffmpegmp3.cpp | 5 +- src/encoder/encoderffmpegvorbis.cpp | 5 +- src/encoder/encodermp3.cpp | 6 +- src/engine/enginefilterdelay.h | 6 +- src/engine/enginefiltermoogladder4.h | 10 +- src/engine/loopingcontrol.cpp | 2 +- src/engine/ratecontrol.cpp | 41 ++++---- src/engine/sidechain/enginerecord.cpp | 11 +-- src/engine/sidechain/engineshoutcast.cpp | 16 ++-- src/library/analysisfeature.cpp | 23 ++--- src/library/analysisfeature.h | 10 +- src/library/banshee/bansheeplaylistmodel.cpp | 8 +- src/library/baseplaylistfeature.cpp | 4 +- src/library/bpmeditor.cpp | 8 +- src/library/browse/browsefeature.cpp | 2 +- src/library/browse/browsethread.cpp | 7 +- src/library/browse/foldertreemodel.cpp | 2 +- src/library/browse/foldertreemodel.h | 2 +- src/library/cratefeature.cpp | 12 +-- src/library/cratefeature.h | 2 +- src/library/dao/analysisdao.cpp | 2 +- src/library/dao/directorydao.cpp | 4 +- src/library/dao/playlistdao.cpp | 5 +- src/library/dao/trackdao.cpp | 4 +- src/library/hiddentablemodel.cpp | 2 +- src/library/itunes/itunesfeature.cpp | 2 +- src/library/library.cpp | 4 +- src/library/librarytablemodel.cpp | 2 +- src/library/parser.cpp | 6 +- src/library/parser.h | 2 +- src/library/parsercsv.cpp | 26 ++--- src/library/parserm3u.cpp | 7 +- src/library/parserpls.cpp | 23 ++--- src/library/parserpls.h | 8 +- src/library/playlistfeature.cpp | 8 +- src/library/playlisttablemodel.cpp | 2 +- src/library/recording/recordingfeature.cpp | 3 +- src/library/rhythmbox/rhythmboxfeature.cpp | 12 ++- src/library/scanner/scannerutil.h | 2 +- src/library/searchquery.cpp | 2 +- src/library/setlogfeature.cpp | 2 +- src/library/sidebarmodel.cpp | 2 +- src/library/sidebarmodel.h | 12 +-- src/library/songdownloader.cpp | 2 +- src/library/stardelegate.cpp | 2 +- src/library/stareditor.cpp | 2 +- src/library/trackcollection.cpp | 7 +- src/library/traktor/traktorfeature.cpp | 2 +- src/library/treeitem.cpp | 2 +- src/library/treeitemmodel.cpp | 2 +- src/mixxx.cpp | 9 +- src/mixxxkeyboard.cpp | 2 +- src/musicbrainz/acoustidclient.cpp | 3 +- src/musicbrainz/chromaprinter.cpp | 2 +- src/musicbrainz/musicbrainzclient.cpp | 2 +- src/skin/pixmapsource.cpp | 11 +-- src/skin/pixmapsource.h | 10 +- src/skin/skincontext.cpp | 26 +++-- src/skin/skincontext.h | 7 +- src/skin/svgparser.cpp | 94 +++++++++---------- src/skin/svgparser.h | 9 +- src/soundsource.cpp | 2 +- src/soundsource.h | 2 +- src/soundsourceffmpeg.cpp | 8 +- src/soundsourceflac.cpp | 3 +- src/soundsourceoggvorbis.cpp | 4 +- src/soundsourceopus.cpp | 6 +- src/soundsourceproxy.cpp | 2 +- src/soundsourcetaglib.cpp | 17 ++-- src/test/enginesynctest.cpp | 2 +- src/test/mixxxtest.cpp | 2 +- src/test/mixxxtest.h | 2 +- src/test/wpushbutton_test.cpp | 2 +- src/track/beatutils.cpp | 3 +- src/transposeproxymodel.h | 49 +++++----- src/util/math.h | 2 +- src/util/performancetimer.h | 4 +- src/util/singleton.h | 19 ++-- src/util/threadcputimer.cpp | 4 + src/vamp/vampanalyser.cpp | 5 +- src/vamp/vampanalyser.h | 4 +- .../renderers/glslwaveformrenderersignal.cpp | 6 +- .../renderers/glwaveformrendererrgb.cpp | 21 +++-- .../renderers/glwaveformrendererrgb.h | 2 +- .../glwaveformrenderersimplesignal.cpp | 7 +- .../qtwaveformrenderersimplesignal.cpp | 6 +- .../renderers/waveformrendererrgb.cpp | 2 +- src/waveform/vsyncthread.cpp | 13 ++- src/waveform/vsyncthread.h | 2 +- src/waveform/widgets/glrgbwaveformwidget.cpp | 4 +- .../widgets/glsimplewaveformwidget.cpp | 2 +- src/waveform/widgets/glslwaveformwidget.cpp | 2 +- src/waveform/widgets/glvsynctestwidget.cpp | 2 +- .../widgets/qtsimplewaveformwidget.cpp | 2 +- src/waveform/widgets/rgbwaveformwidget.cpp | 8 +- src/widget/controlwidgetconnection.cpp | 2 +- src/widget/wdisplay.cpp | 6 +- src/widget/wimagestore.cpp | 22 ++--- src/widget/wimagestore.h | 6 +- src/widget/wlabel.cpp | 2 +- src/widget/woverview.cpp | 8 +- src/widget/woverviewhsv.cpp | 9 +- src/widget/woverviewlmh.cpp | 2 +- src/widget/woverviewrgb.cpp | 2 +- src/widget/wpixmapstore.cpp | 10 +- src/widget/wpixmapstore.h | 2 +- src/widget/wsizeawarestack.cpp | 2 +- src/widget/wstarrating.cpp | 20 ++-- src/widget/wstatuslight.cpp | 2 +- src/widget/wtracktableview.cpp | 12 +-- src/widget/wwaveformviewer.h | 4 +- 138 files changed, 510 insertions(+), 536 deletions(-) diff --git a/src/analyserbeats.cpp b/src/analyserbeats.cpp index 9ee35e085bd..f7d05f88375 100644 --- a/src/analyserbeats.cpp +++ b/src/analyserbeats.cpp @@ -30,7 +30,7 @@ AnalyserBeats::AnalyserBeats(ConfigObject* pConfig) m_iMaxBpm(9999) { } -AnalyserBeats::~AnalyserBeats(){ +AnalyserBeats::~AnalyserBeats() { } bool AnalyserBeats::initialise(TrackPointer tio, int sampleRate, int totalSamples) { @@ -86,7 +86,7 @@ bool AnalyserBeats::initialise(TrackPointer tio, int sampleRate, int totalSample bool bShouldAnalyze = !loadStored(tio); if (bShouldAnalyze) { - m_pVamp = new VampAnalyser(m_pConfig); + m_pVamp = new VampAnalyser(); bShouldAnalyze = m_pVamp->Init(library, pluginID, m_iSampleRate, totalSamples, m_bPreferencesFastAnalysis); if (!bShouldAnalyze) { diff --git a/src/analyserkey.cpp b/src/analyserkey.cpp index 01b4e245da1..554f5b0d20c 100644 --- a/src/analyserkey.cpp +++ b/src/analyserkey.cpp @@ -19,7 +19,7 @@ AnalyserKey::AnalyserKey(ConfigObject* pConfig) m_bPreferencesReanalyzeEnabled(false) { } -AnalyserKey::~AnalyserKey(){ +AnalyserKey::~AnalyserKey() { delete m_pVamp; } @@ -56,7 +56,7 @@ bool AnalyserKey::initialise(TrackPointer tio, int sampleRate, int totalSamples) bool bShouldAnalyze = !loadStored(tio); if (bShouldAnalyze) { - m_pVamp = new VampAnalyser(m_pConfig); + m_pVamp = new VampAnalyser(); bShouldAnalyze = m_pVamp->Init( library, m_pluginId, sampleRate, totalSamples, m_bPreferencesFastAnalysisEnabled); diff --git a/src/analyserqueue.cpp b/src/analyserqueue.cpp index 799732b4e4e..182ce05f94d 100644 --- a/src/analyserqueue.cpp +++ b/src/analyserqueue.cpp @@ -372,7 +372,7 @@ void AnalyserQueue::emitUpdateProgress(TrackPointer tio, int progress) { // The following tries will success if the previous signal was processed in the GUI Thread // This prevent the AnalysisQueue from filling up the GUI Thread event Queue // 100 % is emitted in any case - if (progress < 1000 - FINALIZE_PERCENT && progress > 0 ) { + if (progress < 1000 - FINALIZE_PERCENT && progress > 0) { // Signals during processing are not required in any case if (!m_progressInfo.sema.tryAcquire()) { return; diff --git a/src/analyserwaveform.cpp b/src/analyserwaveform.cpp index 2c5ea65430f..ae95eb29bb8 100644 --- a/src/analyserwaveform.cpp +++ b/src/analyserwaveform.cpp @@ -178,8 +178,8 @@ void AnalyserWaveform::resetFilters(TrackPointer tio, int sampleRate) { } void AnalyserWaveform::destroyFilters() { - for( int i = 0; i < FilterCount; i++) { - if( m_filter[i]) { + for (int i = 0; i < FilterCount; ++i) { + if (m_filter[i]) { delete m_filter[i]; m_filter[i] = 0; } @@ -202,7 +202,7 @@ void AnalyserWaveform::process(const CSAMPLE* buffer, const int bufferLength) { m_filter[High]->process(buffer, &m_buffers[High][0], bufferLength); - for( int i = 0; i < bufferLength; i+=2) { + for (int i = 0; i < bufferLength; i+=2) { // Take max value, not average of data CSAMPLE cover[2] = { fabs(buffer[i]), fabs(buffer[i+1]) }; CSAMPLE clow[2] = { fabs(m_buffers[ Low][i]), fabs(m_buffers[ Low][i+1]) }; diff --git a/src/analyserwaveform.h b/src/analyserwaveform.h index bbc47896253..3439b34a456 100644 --- a/src/analyserwaveform.h +++ b/src/analyserwaveform.h @@ -39,10 +39,10 @@ class WaveformStride { m_position = 0; m_averagePosition = 0; m_averageDivisor = 0; - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { m_overallData[i] = 0.0f; m_averageOverallData[i] = 0.0f; - for( int f = 0; f < FilterCount; f++) { + for (int f = 0; f < FilterCount; ++f) { m_filteredData[i][f] = 0.0f; m_averageFilteredData[i][f] = 0.0f; } @@ -52,10 +52,10 @@ class WaveformStride { inline void reset() { m_position = 0; m_averageDivisor = 0; - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { m_overallData[i] = 0.0f; m_averageOverallData[i] = 0.0f; - for( int f = 0; f < FilterCount; f++) { + for (int f = 0; f < FilterCount; ++f) { m_filteredData[i][f] = 0.0f; m_averageFilteredData[i][f] = 0.0f; } @@ -63,7 +63,7 @@ class WaveformStride { } inline void store(WaveformData* data) { - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { WaveformData& datum = *(data + i); datum.filtered.all = static_cast(math_min(255.0, m_postScaleConversion * scaleSignal(m_overallData[i]) + 0.5)); @@ -75,10 +75,10 @@ class WaveformStride { m_postScaleConversion * scaleSignal(m_filteredData[i][High], High) + 0.5)); } m_averageDivisor++; - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { m_averageOverallData[i] += m_overallData[i]; m_overallData[i] = 0.0f; - for( int f = 0; f < FilterCount; f++) { + for (int f = 0; f < FilterCount; ++f) { m_averageFilteredData[i][f] += m_filteredData[i][f]; m_filteredData[i][f] = 0.0f; } @@ -87,7 +87,7 @@ class WaveformStride { inline void averageStore(WaveformData* data) { if (m_averageDivisor) { - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { WaveformData& datum = *(data + i); datum.filtered.all = static_cast(math_min(255.0, m_postScaleConversion * scaleSignal(m_averageOverallData[i] / m_averageDivisor) + 0.5)); @@ -100,7 +100,7 @@ class WaveformStride { } } else { // This is the case if The Overview Waveform has more samples than the detailed waveform - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { WaveformData& datum = *(data + i); datum.filtered.all = static_cast(math_min(255.0, m_postScaleConversion * scaleSignal(m_overallData[i]) + 0.5)); @@ -114,9 +114,9 @@ class WaveformStride { } m_averageDivisor = 0; - for( int i = 0; i < ChannelCount; i++) { + for (int i = 0; i < ChannelCount; ++i) { m_averageOverallData[i] = 0.0f; - for( int f = 0; f < FilterCount; f++) { + for (int f = 0; f < FilterCount; ++f) { m_averageFilteredData[i][f] = 0.0f; } } diff --git a/src/audiotagger.cpp b/src/audiotagger.cpp index ed2db48e0d6..b5bd5fcf914 100644 --- a/src/audiotagger.cpp +++ b/src/audiotagger.cpp @@ -116,7 +116,7 @@ bool AudioTagger::save() { file = new TagLib::FLAC::File(fileBA.constData()); //If the flac has no ID3v2 tag, we create a new one and add the TBPM and TKEY frame - addID3v2Tag(((TagLib::FLAC::File*)file)->ID3v2Tag(true) ); + addID3v2Tag(((TagLib::FLAC::File*)file)->ID3v2Tag(true)); //If the flac has no APE tag, we create a new one and add the TBPM and TKEY frame addXiphComment(((TagLib::FLAC::File*) file)->xiphComment(true)); diff --git a/src/audiotagger.h b/src/audiotagger.h index f8bc9918fcc..4133bfb4aa8 100644 --- a/src/audiotagger.h +++ b/src/audiotagger.h @@ -14,20 +14,20 @@ class AudioTagger { public: AudioTagger(const QString& file, SecurityTokenPointer pToken); - virtual ~AudioTagger ( ); - - void setArtist (QString artist ); - void setTitle (QString title ); - void setAlbum (QString album ); - void setAlbumArtist (QString albumArtist ); - void setGenre (QString genre ); - void setComposer (QString composer ); - void setGrouping (QString grouping ); - void setYear (QString year ); - void setComment (QString comment ); - void setKey (QString key ); - void setBpm (QString bpm ); - void setTracknumber (QString tracknumber ); + virtual ~AudioTagger(); + + void setArtist(QString artist); + void setTitle(QString title); + void setAlbum(QString album); + void setAlbumArtist(QString albumArtist); + void setGenre(QString genre); + void setComposer(QString composer); + void setGrouping(QString grouping); + void setYear(QString year); + void setComment(QString comment); + void setKey(QString key); + void setBpm(QString bpm); + void setTracknumber(QString tracknumber); bool save(); private: diff --git a/src/configobject.cpp b/src/configobject.cpp index 45fb5e8459b..14a862eef98 100644 --- a/src/configobject.cpp +++ b/src/configobject.cpp @@ -93,12 +93,12 @@ void ConfigValueKbd::valCopy(const ConfigValueKbd& v) QTextStream(&value) << m_qKey.toString(); } -bool operator==(const ConfigValue & s1, const ConfigValue & s2) +bool operator==(const ConfigValue& s1, const ConfigValue& s2) { return (s1.value.toUpper() == s2.value.toUpper()); } -bool operator==(const ConfigValueKbd & s1, const ConfigValueKbd & s2) +bool operator==(const ConfigValueKbd& s1, const ConfigValueKbd& s2) { return (s1.value.toUpper() == s2.value.toUpper()); } @@ -192,7 +192,7 @@ ConfigKey *ConfigObject::get(ValueType v) while (iterator.hasNext()) { it = iterator.next(); - if (QString::compare(it->val->value, v.value, Qt::CaseInsensitive) == 0){ + if (QString::compare(it->val->value, v.value, Qt::CaseInsensitive) == 0) { //qDebug() << "ConfigObject #534: QString::compare match for " << it->key->group << it->key->item; return it->key; } diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp index bbe5513f4be..9f6d5016fc4 100644 --- a/src/controllers/controllerengine.cpp +++ b/src/controllers/controllerengine.cpp @@ -821,9 +821,8 @@ QScriptValue ControllerEngine::connectControl(QString group, QString name, ControllerEngineConnection conn = i.value(); return m_pEngine->newQObject( - new ControllerEngineConnectionScriptValue(conn), - QScriptEngine::ScriptOwnership - ); + new ControllerEngineConnectionScriptValue(conn), + QScriptEngine::ScriptOwnership); } } else if (callback.isFunction()) { diff --git a/src/controllers/controllerpresetinfo.cpp b/src/controllers/controllerpresetinfo.cpp index d0817f86a80..fcc730b37b0 100644 --- a/src/controllers/controllerpresetinfo.cpp +++ b/src/controllers/controllerpresetinfo.cpp @@ -134,8 +134,7 @@ QHash PresetInfo::parseOSCProduct(const QDomElement& element) c return product; } -PresetInfoEnumerator::PresetInfoEnumerator(ConfigObject* pConfig) - : m_pConfig(pConfig) { +PresetInfoEnumerator::PresetInfoEnumerator(ConfigObject* pConfig) { controllerDirPaths.append(localPresetsPath(pConfig)); controllerDirPaths.append(resourcePresetsPath(pConfig)); diff --git a/src/controllers/controllerpresetinfo.h b/src/controllers/controllerpresetinfo.h index 60e756dcf81..baf7de1dfb4 100644 --- a/src/controllers/controllerpresetinfo.h +++ b/src/controllers/controllerpresetinfo.h @@ -83,7 +83,6 @@ class PresetInfoEnumerator { private: QList fileExtensions; - ConfigObject* m_pConfig; // List of paths for controller presets QList controllerDirPaths; diff --git a/src/controlobjectslave.h b/src/controlobjectslave.h index 33801f88a21..111803bdd7d 100644 --- a/src/controlobjectslave.h +++ b/src/controlobjectslave.h @@ -31,7 +31,7 @@ class ControlObjectSlave : public QObject { bool connectValueChanged(const QObject* receiver, const char* method, Qt::ConnectionType type = Qt::AutoConnection); bool connectValueChanged( - const char* method, Qt::ConnectionType type = Qt::AutoConnection ); + const char* method, Qt::ConnectionType type = Qt::AutoConnection); // Called from update(); inline void emitValueChanged() { diff --git a/src/controlobjectthread.h b/src/controlobjectthread.h index 36114f2c338..3ea5c5f04b9 100644 --- a/src/controlobjectthread.h +++ b/src/controlobjectthread.h @@ -36,7 +36,7 @@ class ControlObjectThread : public QObject { bool connectValueChanged(const QObject* receiver, const char* method, Qt::ConnectionType type = Qt::AutoConnection); bool connectValueChanged( - const char* method, Qt::ConnectionType type = Qt::AutoConnection ); + const char* method, Qt::ConnectionType type = Qt::AutoConnection); QString name() const; QString description() const; diff --git a/src/controlvaluedelegate.cpp b/src/controlvaluedelegate.cpp index e354be64738..c85eabd2e6b 100644 --- a/src/controlvaluedelegate.cpp +++ b/src/controlvaluedelegate.cpp @@ -18,11 +18,10 @@ QStringList ControlValueDelegate::m_flangerControlValues; QStringList ControlValueDelegate::m_microphoneControlValues; -ControlValueDelegate::ControlValueDelegate(QObject *parent) - : QItemDelegate(parent) -{ - if (m_channelControlValues.isEmpty()) //List is static/shared across all objects, so only fill once. - { +ControlValueDelegate::ControlValueDelegate(QObject* parent) + : QItemDelegate(parent) { + // List is static/shared across all objects, so only fill once. + if (m_channelControlValues.isEmpty()) { m_channelControlValues.append("beatsync"); m_channelControlValues.append("cue_default"); m_channelControlValues.append("filterHigh"); @@ -170,9 +169,8 @@ ControlValueDelegate::ControlValueDelegate(QObject *parent) } } -void ControlValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ +void ControlValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem& option, + const QModelIndex& index) const { if (index.data().canConvert()) { QString value = index.data().value(); @@ -192,10 +190,9 @@ void ControlValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem & } } -QWidget *ControlValueDelegate::createEditor(QWidget *parent, - const QStyleOptionViewItem &/* option */, - const QModelIndex &index ) const -{ +QWidget* ControlValueDelegate::createEditor(QWidget* parent, + const QStyleOptionViewItem& /* option */, + const QModelIndex& index) const { //TODO: Use index to grab the value of the ControlGroup column next to // this item. We want to do this because some of the possible // ControlValues only apply to Channel1/2, and not Master (for example). @@ -238,18 +235,16 @@ QWidget *ControlValueDelegate::createEditor(QWidget *parent, return editor; } -void ControlValueDelegate::setEditorData(QWidget *editor, - const QModelIndex &index) const -{ +void ControlValueDelegate::setEditorData(QWidget* editor, + const QModelIndex& index) const { QString value = index.model()->data(index, Qt::EditRole).toString(); QComboBox *comboBox = static_cast(editor); comboBox->setCurrentIndex(comboBox->findText(value)); } -void ControlValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const -{ +void ControlValueDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, + const QModelIndex& index) const { QString midiType = 0; QComboBox *comboBox = static_cast(editor); //comboBox->interpretText(); @@ -260,10 +255,9 @@ void ControlValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod model->setData(index, text, Qt::EditRole); } -void ControlValueDelegate::updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, - const QModelIndex &/* index */) const -{ +void ControlValueDelegate::updateEditorGeometry(QWidget* editor, + const QStyleOptionViewItem& option, + const QModelIndex& /* index */) const { editor->setGeometry(option.rect); } @@ -273,9 +267,9 @@ void ControlValueDelegate::updateEditorGeometry(QWidget *editor, @param controlGroup The group that has just been selected and should be verified against. @param index The model index of the ControlValue. */ -bool ControlValueDelegate::verifyControlValueValidity(QString controlGroup, QAbstractItemModel *model, - const QModelIndex& index) -{ +bool ControlValueDelegate::verifyControlValueValidity(QString controlGroup, + QAbstractItemModel* model, + const QModelIndex& index) { QString value = index.data().value(); if (controlGroup == CONTROLGROUP_CHANNEL1_STRING || diff --git a/src/dlgprefbeats.cpp b/src/dlgprefbeats.cpp index a1523531e06..2c11182e448 100644 --- a/src/dlgprefbeats.cpp +++ b/src/dlgprefbeats.cpp @@ -56,7 +56,7 @@ DlgPrefBeats::DlgPrefBeats(QWidget *parent, ConfigObject *_config) DlgPrefBeats::~DlgPrefBeats() { } -void DlgPrefBeats::loadSettings(){ +void DlgPrefBeats::loadSettings() { if(m_pconfig->getValueString( ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_BEAT_PLUGIN_ID))==QString("")) { slotResetToDefaults(); @@ -115,39 +115,39 @@ void DlgPrefBeats::slotResetToDefaults() { slotUpdate(); } -void DlgPrefBeats::pluginSelected(int i){ +void DlgPrefBeats::pluginSelected(int i) { if (i==-1) return; m_selectedAnalyser = m_listIdentifier[i]; slotUpdate(); } -void DlgPrefBeats::analyserEnabled(int i){ +void DlgPrefBeats::analyserEnabled(int i) { m_banalyserEnabled = static_cast(i); slotUpdate(); } -void DlgPrefBeats::fixedtempoEnabled(int i){ +void DlgPrefBeats::fixedtempoEnabled(int i) { m_bfixedtempoEnabled = static_cast(i); slotUpdate(); } -void DlgPrefBeats::offsetEnabled(int i){ +void DlgPrefBeats::offsetEnabled(int i) { m_boffsetEnabled = static_cast(i); slotUpdate(); } -void DlgPrefBeats::minBpmRangeChanged(int value){ +void DlgPrefBeats::minBpmRangeChanged(int value) { m_minBpm = value; slotUpdate(); } -void DlgPrefBeats::maxBpmRangeChanged(int value){ +void DlgPrefBeats::maxBpmRangeChanged(int value) { m_maxBpm = value; slotUpdate(); } -void DlgPrefBeats::slotUpdate(){ +void DlgPrefBeats::slotUpdate() { bfixedtempo->setEnabled(m_banalyserEnabled); boffset->setEnabled((m_banalyserEnabled && m_bfixedtempoEnabled)); plugincombo->setEnabled(m_banalyserEnabled); @@ -171,7 +171,7 @@ void DlgPrefBeats::slotUpdate(){ bFastAnalysis->setChecked(m_FastAnalysisEnabled); int comboselected = m_listIdentifier.indexOf(m_selectedAnalyser); - if ( comboselected==-1) { + if (comboselected == -1) { qDebug()<<"DlgPrefBeats: Plugin("<* _config) DlgPrefKey::~DlgPrefKey() { } -void DlgPrefKey::loadSettings(){ +void DlgPrefKey::loadSettings() { qDebug() << "DlgPrefKey::loadSettings"; qDebug() << "Key plugin ID:" << m_pConfig->getValueString( ConfigKey(VAMP_CONFIG_KEY, VAMP_ANALYSER_KEY_PLUGIN_ID)); @@ -165,7 +165,7 @@ void DlgPrefKey::slotResetToDefaults() { slotUpdate(); } -void DlgPrefKey::pluginSelected(int i){ +void DlgPrefKey::pluginSelected(int i) { if (i == -1) { return; } @@ -173,12 +173,12 @@ void DlgPrefKey::pluginSelected(int i){ slotUpdate(); } -void DlgPrefKey::analyserEnabled(int i){ +void DlgPrefKey::analyserEnabled(int i) { m_bAnalyserEnabled = static_cast(i); slotUpdate(); } -void DlgPrefKey::fastAnalysisEnabled(int i){ +void DlgPrefKey::fastAnalysisEnabled(int i) { m_bFastAnalysisEnabled = static_cast(i); slotUpdate(); } @@ -269,7 +269,7 @@ void DlgPrefKey::slotUpdate() { } int comboselected = m_listIdentifier.indexOf(m_selectedAnalyser); - if (comboselected == -1){ + if (comboselected == -1) { qDebug() << "DlgPrefKey: Plugin not found in slotUpdate()"; return; } diff --git a/src/dlgpreflibrary.cpp b/src/dlgpreflibrary.cpp index 8b9402346d0..32d43736178 100644 --- a/src/dlgpreflibrary.cpp +++ b/src/dlgpreflibrary.cpp @@ -92,7 +92,7 @@ void DlgPrefLibrary::slotHide() { } } -void DlgPrefLibrary::initialiseDirList(){ +void DlgPrefLibrary::initialiseDirList() { // save which index was selected const QString selected = dirList->currentIndex().data().toString(); // clear and fill model diff --git a/src/dlgprefrecord.cpp b/src/dlgprefrecord.cpp index bf66c63b230..895926404cd 100644 --- a/src/dlgprefrecord.cpp +++ b/src/dlgprefrecord.cpp @@ -158,7 +158,7 @@ void DlgPrefRecord::updateTextQuality() { int quality = getSliderQualityVal(); //QString encodingType = comboBoxEncoding->currentText(); - TextQuality->setText(QString( QString::number(quality) + tr("kbps"))); + TextQuality->setText(QString(QString::number(quality) + tr("kbps"))); } void DlgPrefRecord::slotEncoding() { diff --git a/src/dlgprefwaveform.cpp b/src/dlgprefwaveform.cpp index ec2dcc0d52c..0823aee1dfd 100644 --- a/src/dlgprefwaveform.cpp +++ b/src/dlgprefwaveform.cpp @@ -12,9 +12,9 @@ DlgPrefWaveform::DlgPrefWaveform(QWidget* pParent, MixxxMainWindow* pMixxx, setupUi(this); // Waveform overview init - waveformOverviewComboBox->addItem( tr("Filtered") ); // "0" - waveformOverviewComboBox->addItem( tr("HSV") ); // "1" - waveformOverviewComboBox->addItem( tr("RGB") ); // "2" + waveformOverviewComboBox->addItem(tr("Filtered")); // "0" + waveformOverviewComboBox->addItem(tr("HSV")); // "1" + waveformOverviewComboBox->addItem(tr("RGB")); // "2" // Populate waveform options. WaveformWidgetFactory* factory = WaveformWidgetFactory::instance(); @@ -163,7 +163,7 @@ void DlgPrefWaveform::slotSetWaveformOverviewType(int index) { } void DlgPrefWaveform::slotSetDefaultZoom(int index) { - WaveformWidgetFactory::instance()->setDefaultZoom( index + 1); + WaveformWidgetFactory::instance()->setDefaultZoom(index + 1); } void DlgPrefWaveform::slotSetZoomSynchronization(bool checked) { @@ -186,7 +186,7 @@ void DlgPrefWaveform::slotSetVisualGainHigh(double gain) { WaveformWidgetFactory::instance()->setVisualGain(WaveformWidgetFactory::High,gain); } -void DlgPrefWaveform::slotSetNormalizeOverview( bool normalize) { +void DlgPrefWaveform::slotSetNormalizeOverview(bool normalize) { WaveformWidgetFactory::instance()->setOverviewNormalized(normalize); } diff --git a/src/dlgprefwaveform.h b/src/dlgprefwaveform.h index e2c8b13fa2c..c6aedc859b2 100644 --- a/src/dlgprefwaveform.h +++ b/src/dlgprefwaveform.h @@ -32,7 +32,7 @@ class DlgPrefWaveform : public DlgPreferencePage, public Ui::DlgPrefWaveformDlg void slotSetVisualGainLow(double gain); void slotSetVisualGainMid(double gain); void slotSetVisualGainHigh(double gain); - void slotSetNormalizeOverview( bool normalize); + void slotSetNormalizeOverview(bool normalize); void slotWaveformMeasured(float frameRate, int droppedFrames); private: diff --git a/src/dlgtrackinfo.cpp b/src/dlgtrackinfo.cpp index 018c39383bc..6bd8b89b6c1 100644 --- a/src/dlgtrackinfo.cpp +++ b/src/dlgtrackinfo.cpp @@ -30,7 +30,7 @@ DlgTrackInfo::~DlgTrackInfo() { qDebug() << "~DlgTrackInfo()"; } -void DlgTrackInfo::init(){ +void DlgTrackInfo::init() { setupUi(this); cueTable->hideColumn(0); diff --git a/src/effects/native/bessel8lvmixeqeffect.cpp b/src/effects/native/bessel8lvmixeqeffect.cpp index 1571b1609ee..9a17f5784fa 100644 --- a/src/effects/native/bessel8lvmixeqeffect.cpp +++ b/src/effects/native/bessel8lvmixeqeffect.cpp @@ -1,13 +1,6 @@ #include "effects/native/bessel8lvmixeqeffect.h" #include "util/math.h" -// constant to calculate the group delay from the low pass corner -// mean value of a set of fid_calc_delay() calls for different corners -static const double kGroupDelay1Hz = 0.5067964223; -// kDelayOffset is required to match short delays. -static const double kDelayOffset = 0.2; -static const double kMaxCornerFreq = 14212; - // static QString Bessel8LVMixEQEffect::getId() { return "org.mixxx.effects.bessel8lvmixeq"; @@ -23,7 +16,7 @@ EffectManifest Bessel8LVMixEQEffect::getManifest() { manifest.setDescription(QObject::tr( "A Bessel 8th order filter equalizer with Lipshitz and Vanderkooy mix (bit perfect unity, roll-off -48 db/Oct). " "To adjust frequency shelves see the Equalizer preferences.")); - manifest.setIsMixingEQ(true); + manifest.setIsMixingEQ(true); manifest.setEffectRampsFromDry(true); EffectManifestParameter* low = manifest.addParameter(); diff --git a/src/effects/native/echoeffect.cpp b/src/effects/native/echoeffect.cpp index b443ab4a342..5f26ceceeae 100644 --- a/src/effects/native/echoeffect.cpp +++ b/src/effects/native/echoeffect.cpp @@ -105,6 +105,7 @@ void EchoEffect::processGroup(const QString& group, EchoGroupState* pGroupState, const EffectProcessor::EnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(group); + Q_UNUSED(enableState); Q_UNUSED(groupFeatures); EchoGroupState& gs = *pGroupState; double delay_time = m_pDelayParameter->value(); diff --git a/src/effects/native/filtereffect.cpp b/src/effects/native/filtereffect.cpp index 43ef7be19c1..237d32ce9a6 100644 --- a/src/effects/native/filtereffect.cpp +++ b/src/effects/native/filtereffect.cpp @@ -69,7 +69,7 @@ FilterGroupState::FilterGroupState() } FilterGroupState::~FilterGroupState() { - SampleUtil::free(m_pBuf ); + SampleUtil::free(m_pBuf); delete m_pLowFilter; delete m_pHighFilter; } diff --git a/src/effects/native/flangereffect.cpp b/src/effects/native/flangereffect.cpp index 065c355d6df..f146d33f7e4 100644 --- a/src/effects/native/flangereffect.cpp +++ b/src/effects/native/flangereffect.cpp @@ -81,6 +81,7 @@ void FlangerEffect::processGroup(const QString& group, const EffectProcessor::EnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(group); + Q_UNUSED(enableState); Q_UNUSED(groupFeatures); Q_UNUSED(sampleRate); CSAMPLE lfoPeriod = m_pPeriodParameter->value(); diff --git a/src/effects/native/moogladder4filtereffect.cpp b/src/effects/native/moogladder4filtereffect.cpp index 448d95fa93e..74bc88b9f53 100644 --- a/src/effects/native/moogladder4filtereffect.cpp +++ b/src/effects/native/moogladder4filtereffect.cpp @@ -75,7 +75,7 @@ MoogLadder4FilterGroupState::MoogLadder4FilterGroupState() } MoogLadder4FilterGroupState::~MoogLadder4FilterGroupState() { - SampleUtil::free(m_pBuf ); + SampleUtil::free(m_pBuf); delete m_pLowFilter; delete m_pHighFilter; } diff --git a/src/effects/native/reverbeffect.cpp b/src/effects/native/reverbeffect.cpp index 2217fbecbde..3914ff59e35 100644 --- a/src/effects/native/reverbeffect.cpp +++ b/src/effects/native/reverbeffect.cpp @@ -69,6 +69,7 @@ void ReverbEffect::processGroup(const QString& group, const EffectProcessor::EnableState enableState, const GroupFeatureState& groupFeatures) { Q_UNUSED(group); + Q_UNUSED(enableState); Q_UNUSED(groupFeatures); Q_UNUSED(sampleRate); CSAMPLE bandwidth = m_pBandWidthParameter->value(); diff --git a/src/encoder/encoderffmpegmp3.cpp b/src/encoder/encoderffmpegmp3.cpp index 00f10c964c1..dc3b28afa96 100644 --- a/src/encoder/encoderffmpegmp3.cpp +++ b/src/encoder/encoderffmpegmp3.cpp @@ -20,10 +20,9 @@ // Constructor #if LIBAVCODEC_VERSION_INT > 3544932 -EncoderFfmpegMp3::EncoderFfmpegMp3(EncoderCallback* pCallback) : EncoderFfmpegCore( pCallback, AV_CODEC_ID_MP3 ) +EncoderFfmpegMp3::EncoderFfmpegMp3(EncoderCallback* pCallback) : EncoderFfmpegCore(pCallback, AV_CODEC_ID_MP3) #else -EncoderFfmpegMp3::EncoderFfmpegMp3(EncoderCallback* pCallback) : EncoderFfmpegCore( pCallback, CODEC_ID_MP3 ) +EncoderFfmpegMp3::EncoderFfmpegMp3(EncoderCallback* pCallback) : EncoderFfmpegCore(pCallback, CODEC_ID_MP3) #endif { } - diff --git a/src/encoder/encoderffmpegvorbis.cpp b/src/encoder/encoderffmpegvorbis.cpp index 66912ddf314..096d9ffb9e2 100644 --- a/src/encoder/encoderffmpegvorbis.cpp +++ b/src/encoder/encoderffmpegvorbis.cpp @@ -20,10 +20,9 @@ // Constructor #if LIBAVCODEC_VERSION_INT > 3544932 -EncoderFfmpegVorbis::EncoderFfmpegVorbis(EncoderCallback* pCallback) : EncoderFfmpegCore( pCallback, AV_CODEC_ID_VORBIS ) +EncoderFfmpegVorbis::EncoderFfmpegVorbis(EncoderCallback* pCallback) : EncoderFfmpegCore(pCallback, AV_CODEC_ID_VORBIS) #else -EncoderFfmpegVorbis::EncoderFfmpegVorbis(EncoderCallback* pCallback) : EncoderFfmpegCore( pCallback, CODEC_ID_VORBIS ) +EncoderFfmpegVorbis::EncoderFfmpegVorbis(EncoderCallback* pCallback) : EncoderFfmpegCore(pCallback, CODEC_ID_VORBIS) #endif { } - diff --git a/src/encoder/encodermp3.cpp b/src/encoder/encodermp3.cpp index 95830bf888d..e1211844dfd 100644 --- a/src/encoder/encodermp3.cpp +++ b/src/encoder/encodermp3.cpp @@ -276,7 +276,7 @@ void EncoderMp3::flush() { int rc = 0; /**Flush also writes ID3 tags **/ rc = lame_encode_flush(m_lameFlags, m_bufferOut, m_bufferOutSize); - if (rc < 0 ){ + if (rc < 0) { return; } //end encoded audio to shoutcast or file @@ -303,7 +303,7 @@ void EncoderMp3::encodeBuffer(const CSAMPLE *samples, const int size) { rc = lame_encode_buffer_float(m_lameFlags, m_bufferIn[0], m_bufferIn[1], size/2, m_bufferOut, m_bufferOutSize); - if (rc < 0 ){ + if (rc < 0) { return; } //write encoded audio to shoutcast stream or file @@ -362,7 +362,7 @@ int EncoderMp3::initEncoder(int bitrate, int samplerate) { return 0; } -void EncoderMp3::updateMetaData(char* artist, char* title, char* album){ +void EncoderMp3::updateMetaData(char* artist, char* title, char* album) { m_metaDataTitle = title; m_metaDataArtist = artist; m_metaDataAlbum = album; diff --git a/src/engine/enginefilterdelay.h b/src/engine/enginefilterdelay.h index a12bf8281cd..08ce03d7ed7 100644 --- a/src/engine/enginefilterdelay.h +++ b/src/engine/enginefilterdelay.h @@ -35,12 +35,12 @@ class EngineFilterDelay : public EngineObjectConstIn { } virtual void process(const CSAMPLE* pIn, CSAMPLE* pOutput, - const int iBufferSize) { + const int iBufferSize) { if (!m_doRamping) { int delaySourcePos = (m_delayPos + SIZE - m_delaySamples) % SIZE; Q_ASSERT(delaySourcePos >= 0); - Q_ASSERT(delaySourcePos <= SIZE); + Q_ASSERT(delaySourcePos <= static_cast(SIZE)); for (int i = 0; i < iBufferSize; ++i) { // put sample into delay buffer: @@ -56,7 +56,7 @@ class EngineFilterDelay : public EngineObjectConstIn { int oldDelaySourcePos = (m_delayPos + SIZE - m_oldDelaySamples) % SIZE; Q_ASSERT(delaySourcePos >= 0); - Q_ASSERT(delaySourcePos <= SIZE); + Q_ASSERT(delaySourcePos <= static_cast(SIZE)); double cross_mix = 0.0; double cross_inc = 2 / static_cast(iBufferSize); diff --git a/src/engine/enginefiltermoogladder4.h b/src/engine/enginefiltermoogladder4.h index ce8254687e2..f9cc6401d91 100644 --- a/src/engine/enginefiltermoogladder4.h +++ b/src/engine/enginefiltermoogladder4.h @@ -68,7 +68,7 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { float kfc = cutoff / sampleRate; float kf = kfc; - if (MODE == LP_OVERS || MODE == HP_OVERS ) { + if (MODE == LP_OVERS || MODE == HP_OVERS) { // m_inputSampeRate is half the actual filter sampling rate in oversampling mode kf = kfc / 2; } @@ -83,7 +83,7 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { // Resonance correction for self oscillation ~4 m_kacr = resonance * (-3.9364 * (kfc*kfc) + 1.8409 * kfc + 0.9968); - if (MODE == HP_OVERS || MODE == HP ) { + if (MODE == HP_OVERS || MODE == HP) { m_postGain = 1; } else { m_postGain = (1 + resonance / 4 * (1.1f + cutoff / sampleRate * 3.5f)) @@ -108,7 +108,7 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { m_buffersClear = false; } - inline CSAMPLE processSample(float input, struct Buffer* pB ) { + inline CSAMPLE processSample(float input, struct Buffer* pB) { const float v2 = 2 + kVt; // twice the 'thermal voltage of a transistor' @@ -128,7 +128,7 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { pB->m_azt4 = az4 - at4; // Oversampling if requested - if (MODE == LP_OVERS || MODE == HP_OVERS ) { + if (MODE == LP_OVERS || MODE == HP_OVERS) { // 1/2-sample delay for phase compensation pB->m_amf = (az4 + pB->m_az5) / 2; pB->m_az5 = az4; @@ -155,7 +155,7 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { pB->m_amf = az4; } - if (MODE == HP_OVERS || MODE == HP ) { + if (MODE == HP_OVERS || MODE == HP) { return (x1 - 3 * az3 + 2 * az4) * m_postGain; } return pB->m_amf * m_postGain; diff --git a/src/engine/loopingcontrol.cpp b/src/engine/loopingcontrol.cpp index 26858a497fa..753cbf9bb1b 100644 --- a/src/engine/loopingcontrol.cpp +++ b/src/engine/loopingcontrol.cpp @@ -786,7 +786,7 @@ void LoopingControl::slotBeatLoop(double beats, bool keepStartPoint) { } } - if ((loop_in == -1) || ( loop_out == -1)) + if ((loop_in == -1) || (loop_out == -1)) return; if (!even(loop_in)) diff --git a/src/engine/ratecontrol.cpp b/src/engine/ratecontrol.cpp index d1f914c2599..07a291cfc19 100644 --- a/src/engine/ratecontrol.cpp +++ b/src/engine/ratecontrol.cpp @@ -210,10 +210,8 @@ void RateControl::setBpmControl(BpmControl* bpmcontrol) { void RateControl::setRateRamp(bool linearMode) { - if ( linearMode ) - m_eRateRampMode = RateControl::RATERAMP_LINEAR; - else - m_eRateRampMode = RateControl::RATERAMP_STEP; + m_eRateRampMode = linearMode ? + RateControl::RATERAMP_LINEAR : RateControl::RATERAMP_STEP; } void RateControl::setRateRampSensitivity(int sense) @@ -221,12 +219,13 @@ void RateControl::setRateRampSensitivity(int sense) // Reverse the actual sensitivity value passed. // That way the gui works in an intuitive manner. sense = RATE_SENSITIVITY_MAX - sense + RATE_SENSITIVITY_MIN; - if ( sense < RATE_SENSITIVITY_MIN ) + if (sense < RATE_SENSITIVITY_MIN) { m_iRateRampSensitivity = RATE_SENSITIVITY_MIN; - else if ( sense > RATE_SENSITIVITY_MAX ) + } else if (sense > RATE_SENSITIVITY_MAX) { m_iRateRampSensitivity = RATE_SENSITIVITY_MAX; - else + } else { m_iRateRampSensitivity = sense; + } } void RateControl::setTemp(double v) { @@ -536,13 +535,10 @@ double RateControl::process(const double rate, double latrate = ((double)bufferSamples / (double)m_pSampleRate->get()); - if ((m_ePbPressed) && (!m_bTempStarted)) - { + if ((m_ePbPressed) && (!m_bTempStarted)) { m_bTempStarted = true; - - if ( m_eRateRampMode == RATERAMP_STEP ) - { + if (m_eRateRampMode == RATERAMP_STEP) { // old temporary pitch shift behavior double range = m_pRateRange->get(); @@ -581,10 +577,11 @@ double RateControl::process(const double rate, if (m_ePbCurrent) { // apply ramped pitchbending - if ( m_ePbCurrent == RateControl::RATERAMP_UP ) + if (m_ePbCurrent == RateControl::RATERAMP_UP) { addRateTemp(m_dTempRateChange); - else if ( m_ePbCurrent == RateControl::RATERAMP_DOWN ) + } else if (m_ePbCurrent == RateControl::RATERAMP_DOWN) { subRateTemp(m_dTempRateChange); + } } else if ((m_bTempStarted) || ((m_eRampBackMode != RATERAMP_RAMPBACK_NONE) && (m_dRateTemp != 0.0))) { @@ -606,12 +603,13 @@ double RateControl::process(const double rate, else if ((m_eRampBackMode != RATERAMP_RAMPBACK_NONE) && (m_dRateTempRampbackChange == 0.0)) { - if ( fabs(m_dRateTemp) < m_dRateTempRampbackChange) + if (fabs(m_dRateTemp) < m_dRateTempRampbackChange) { resetRateTemp(); - else if ( m_dRateTemp > 0 ) + } else if (m_dRateTemp > 0) { subRateTemp(m_dRateTempRampbackChange); - else + } else { addRateTemp(m_dRateTempRampbackChange); + } } else resetRateTemp(); @@ -635,16 +633,17 @@ double RateControl::getTempRate() { void RateControl::setRateTemp(double v) { // Do not go backwards - if (( 1. + getRawRate() + v ) < 0) + if ((1. + getRawRate() + v) < 0) return; m_dRateTemp = v; - if ( m_dRateTemp < -1.0 ) + if (m_dRateTemp < -1.0) { m_dRateTemp = -1.0; - else if ( m_dRateTemp > 1.0 ) + } else if (m_dRateTemp > 1.0) { m_dRateTemp = 1.0; - else if ( isnan(m_dRateTemp)) + } else if (isnan(m_dRateTemp)) { m_dRateTemp = 0; + } } void RateControl::addRateTemp(double v) diff --git a/src/engine/sidechain/enginerecord.cpp b/src/engine/sidechain/enginerecord.cpp index bd8ad905c32..cac3cdb78e4 100644 --- a/src/engine/sidechain/enginerecord.cpp +++ b/src/engine/sidechain/enginerecord.cpp @@ -122,10 +122,10 @@ bool EngineRecord::metaDataHasChanged() m_iMetaDataLife = 0; TrackPointer pTrack = PlayerInfo::instance().getCurrentPlayingTrack(); - if ( !pTrack ) + if (!pTrack) return false; - if ( m_pCurrentTrack ) { + if (m_pCurrentTrack) { if ((pTrack->getId() == -1) || (m_pCurrentTrack->getId() == -1)) { if ((pTrack->getArtist() == m_pCurrentTrack->getArtist()) && (pTrack->getTitle() == m_pCurrentTrack->getArtist())) { @@ -232,9 +232,8 @@ void EngineRecord::writeCueLine() { % 75); m_cueFile.write(QString(" TRACK %1 AUDIO\n") - .arg((double)m_cueTrack, 2, 'f', 0, '0') - .toLatin1() - ); + .arg((double)m_cueTrack, 2, 'f', 0, '0') + .toLatin1()); m_cueFile.write(QString(" TITLE \"%1\"\n") .arg(m_pCurrentTrack->getTitle()).toLatin1()); @@ -276,7 +275,7 @@ bool EngineRecord::fileOpen() { bool EngineRecord::openFile() { // Unfortunately, we cannot use QFile for writing WAV and AIFF audio. - if (m_encoding == ENCODING_WAVE || m_encoding == ENCODING_AIFF){ + if (m_encoding == ENCODING_WAVE || m_encoding == ENCODING_AIFF) { // set sfInfo m_sfInfo.samplerate = m_sampleRate; m_sfInfo.channels = 2; diff --git a/src/engine/sidechain/engineshoutcast.cpp b/src/engine/sidechain/engineshoutcast.cpp index 526731a37f2..5ca7701c00e 100644 --- a/src/engine/sidechain/engineshoutcast.cpp +++ b/src/engine/sidechain/engineshoutcast.cpp @@ -107,7 +107,7 @@ EngineShoutcast::~EngineShoutcast() { } bool EngineShoutcast::serverDisconnect() { - if (m_encoder){ + if (m_encoder) { m_encoder->flush(); delete m_encoder; m_encoder = NULL; @@ -377,7 +377,7 @@ bool EngineShoutcast::serverConnect() { * If m_encoder is NULL, then we propably want to use MP3 streaming, however, lame could not be found * It does not make sense to connect */ - if(m_encoder == NULL){ + if (m_encoder == NULL) { m_pConfig->set(ConfigKey(SHOUTCAST_PREF_KEY,"enabled"),ConfigValue("0")); m_pShoutcastStatus->set(SHOUTCAST_DISCONNECTED); return false; @@ -429,7 +429,7 @@ bool EngineShoutcast::serverConnect() { } //otherwise disable shoutcast in preferences m_pConfig->set(ConfigKey(SHOUTCAST_PREF_KEY,"enabled"),ConfigValue("0")); - if(m_pShout){ + if (m_pShout) { shout_close(m_pShout); //errorDialog(tr("Mixxx could not connect to the server"), tr("Please check your connection to the Internet and verify that your username and password are correct.")); } @@ -446,11 +446,11 @@ void EngineShoutcast::write(unsigned char *header, unsigned char *body, if (m_iShoutStatus == SHOUTERR_CONNECTED) { // Send header if there is one - if ( headerLen > 0 ) { + if (headerLen > 0) { ret = shout_send(m_pShout, header, headerLen); if (ret != SHOUTERR_SUCCESS) { qDebug() << "DEBUG: Send error: " << shout_get_error(m_pShout); - if ( m_iShoutFailures > 3 ){ + if (m_iShoutFailures > 3) { if(!serverConnect()) errorDialog(tr("Lost connection to streaming server"), tr("Please check your connection to the Internet and verify that your username and password are correct.")); } @@ -467,7 +467,7 @@ void EngineShoutcast::write(unsigned char *header, unsigned char *body, ret = shout_send(m_pShout, body, bodyLen); if (ret != SHOUTERR_SUCCESS) { qDebug() << "DEBUG: Send error: " << shout_get_error(m_pShout); - if ( m_iShoutFailures > 3 ){ + if (m_iShoutFailures > 3) { if(!serverConnect()) errorDialog(tr("Lost connection to streaming server"), tr("Please check your connection to the Internet and verify that your username and password are correct.")); } @@ -529,7 +529,7 @@ void EngineShoutcast::process(const CSAMPLE* pBuffer, const int iBufferSize) { return; // If we are connected, encode the samples. - if (iBufferSize > 0 && m_encoder){ + if (iBufferSize > 0 && m_encoder) { m_encoder->encodeBuffer(pBuffer, iBufferSize); } @@ -613,7 +613,7 @@ void EngineShoutcast::updateMetaData() { // the references to $title and $artist by doing a single // pass over the string int replaceIndex = 0; - + // Make a copy so we don't overwrite the references only // once per streaming session. QString metadataFinal = m_metadataFormat; diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index c4bd1af03fc..e7aeb44701f 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -1,4 +1,4 @@ -// preparefeature.cpp +// analysisfeature.cpp // Created 8/23/2009 by RJ Ryan (rryan@mit.edu) // Forked 11/11/2009 by Albert Santoni (alberts@mixxx.org) @@ -36,23 +36,18 @@ AnalysisFeature::~AnalysisFeature() { cleanupAnalyser(); } -// Sets the title of this feature to the default name, given by m_sAnalysisTitleName + void AnalysisFeature::setTitleDefault() { - m_Title = m_analysisTitleName; - emit(featureIsLoading(this, false)); // Signals a change in title + m_Title = m_analysisTitleName; + emit(featureIsLoading(this, false)); } -// Sets the title of this feature to the default name followed by (x / y) -// where x is the current track being analyzed and y is the total number of tracks in the job void AnalysisFeature::setTitleProgress(int trackNum, int totalNum) { - QString title = m_analysisTitleName; - title.append(" ("); - title.append(QString::number(trackNum)); - title.append(" / "); - title.append(QString::number(totalNum)); - title.append(")"); - m_Title = title; - emit(featureIsLoading(this, false)); // Signals a change in title + m_Title = QString("%1 (%2 / %3)") + .arg(m_analysisTitleName) + .arg(QString::number(trackNum)) + .arg(QString::number(totalNum)); + emit(featureIsLoading(this, false)); } QVariant AnalysisFeature::title() { diff --git a/src/library/analysisfeature.h b/src/library/analysisfeature.h index 19411234b70..e481262e48c 100644 --- a/src/library/analysisfeature.h +++ b/src/library/analysisfeature.h @@ -53,8 +53,14 @@ class AnalysisFeature : public LibraryFeature { void cleanupAnalyser(); private: - void setTitleDefault(); // Set title to tr("Analyze") - void setTitleProgress(int trackNum, int totalNum); // Set title to "Analyze (x out of y)" + // Sets the title of this feature to the default name, given by + // m_sAnalysisTitleName + void setTitleDefault(); + + // Sets the title of this feature to the default name followed by (x / y) + // where x is the current track being analyzed and y is the total number of + // tracks in the job + void setTitleProgress(int trackNum, int totalNum); ConfigObject* m_pConfig; TrackCollection* m_pTrackCollection; diff --git a/src/library/banshee/bansheeplaylistmodel.cpp b/src/library/banshee/bansheeplaylistmodel.cpp index 5c87e864b10..7b6a8f8b87c 100644 --- a/src/library/banshee/bansheeplaylistmodel.cpp +++ b/src/library/banshee/bansheeplaylistmodel.cpp @@ -134,7 +134,7 @@ void BansheePlaylistModel::setTableModel(int playlistId) { if (!list.isEmpty()) { beginInsertRows(QModelIndex(), 0, list.size() - 1); - foreach (struct BansheeDbConnection::PlaylistEntry entry, list){ + foreach (struct BansheeDbConnection::PlaylistEntry entry, list) { query.bindValue(":" CLM_VIEW_ORDER, entry.viewOrder + 1); query.bindValue(":" CLM_ARTIST, entry.pArtist->name); query.bindValue(":" CLM_TITLE, entry.pTrack->title); @@ -265,7 +265,7 @@ void BansheePlaylistModel::trackLoaded(QString group, TrackPointer pTrack) { } } if (pTrack) { - for (int row = 0; row < rowCount(); ++row ) { + for (int row = 0; row < rowCount(); ++row) { QUrl rowUrl(getFieldString(index(row, 0), CLM_URI)); if (rowUrl.toLocalFile() == pTrack->getLocation()) { m_iPreviewDeckTrackId = getFieldString(index(row, 0), CLM_VIEW_ORDER).toInt(); @@ -278,9 +278,7 @@ void BansheePlaylistModel::trackLoaded(QString group, TrackPointer pTrack) { QString BansheePlaylistModel::getFieldString(const QModelIndex& index, const QString& fieldName) const { - return index.sibling( - index.row(), fieldIndex(fieldName) - ).data().toString(); + return index.sibling(index.row(), fieldIndex(fieldName)).data().toString(); } TrackPointer BansheePlaylistModel::getTrack(const QModelIndex& index) const { diff --git a/src/library/baseplaylistfeature.cpp b/src/library/baseplaylistfeature.cpp index 11637b7eedb..a7d73c54ca7 100644 --- a/src/library/baseplaylistfeature.cpp +++ b/src/library/baseplaylistfeature.cpp @@ -495,8 +495,8 @@ void BasePlaylistFeature::bindWidget(WLibrary* libraryWidget, libraryWidget->registerView(m_rootViewName, edit); } -void BasePlaylistFeature::htmlLinkClicked(const QUrl & link) { - if (QString(link.path())=="create") { +void BasePlaylistFeature::htmlLinkClicked(const QUrl& link) { + if (QString(link.path()) == "create") { slotCreatePlaylist(); } else { qDebug() << "Unknonw playlist link clicked" << link.path(); diff --git a/src/library/bpmeditor.cpp b/src/library/bpmeditor.cpp index 84de7380674..8ab417ed0c7 100644 --- a/src/library/bpmeditor.cpp +++ b/src/library/bpmeditor.cpp @@ -37,21 +37,21 @@ BPMEditor::BPMEditor(EditMode mode, QWidget *parent) connect(m_pLock, SIGNAL(clicked(bool)), this, SIGNAL(finishedEditing())); } -BPMEditor::~BPMEditor(){ +BPMEditor::~BPMEditor() { delete m_pLock; delete m_pBPMSpinBox; delete m_pLayout; } -bool BPMEditor::getLock(){ +bool BPMEditor::getLock() { return m_pLock->isChecked(); } -double BPMEditor::getBPM(){ +double BPMEditor::getBPM() { return m_pBPMSpinBox->value(); } -void BPMEditor::setData(const QModelIndex &index, int lockColumn){ +void BPMEditor::setData(const QModelIndex& index, int lockColumn) { if (m_pBPMSpinBox) { m_pBPMSpinBox->setValue(index.data().toDouble()); } else { diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp index a2308c1e93f..9aa38649d76 100644 --- a/src/library/browse/browsefeature.cpp +++ b/src/library/browse/browsefeature.cpp @@ -271,7 +271,7 @@ void BrowseFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index // This is called whenever you double click or use the triangle symbol to expand // the subtree. The method will read the subfolders. -void BrowseFeature::onLazyChildExpandation(const QModelIndex &index){ +void BrowseFeature::onLazyChildExpandation(const QModelIndex& index) { TreeItem *item = static_cast(index.internalPointer()); if (!item) { return; diff --git a/src/library/browse/browsethread.cpp b/src/library/browse/browsethread.cpp index dd8cb9db0f0..773dd8c9c57 100644 --- a/src/library/browse/browsethread.cpp +++ b/src/library/browse/browsethread.cpp @@ -46,7 +46,7 @@ BrowseThread::~BrowseThread() { wait(); qDebug() << "Browser background thread terminated!"; } -BrowseThread* BrowseThread::getInstance(){ +BrowseThread* BrowseThread::getInstance() { if (!m_instance) { s_Mutex.lock(); @@ -58,8 +58,7 @@ BrowseThread* BrowseThread::getInstance(){ } return m_instance; } -void BrowseThread::destroyInstance() -{ +void BrowseThread::destroyInstance() { s_Mutex.lock(); if(m_instance){ delete m_instance; @@ -235,7 +234,7 @@ void BrowseThread::populateModel() { ++row; // If 10 tracks have been analyzed, send it to GUI // Will limit GUI freezing - if(row % 10 == 0){ + if (row % 10 == 0) { // this is a blocking operation emit(rowsAppended(rows, thisModelObserver)); //qDebug() << "Append " << rows.count() << " from " << filepath; diff --git a/src/library/browse/foldertreemodel.cpp b/src/library/browse/foldertreemodel.cpp index 8f80f04770c..62b28afc412 100644 --- a/src/library/browse/foldertreemodel.cpp +++ b/src/library/browse/foldertreemodel.cpp @@ -32,7 +32,7 @@ FolderTreeModel::~FolderTreeModel() { * Note that BrowseFeature inserts folder trees dynamically and rowCount() * is only called if necessary. */ -bool FolderTreeModel::hasChildren( const QModelIndex & parent) const { +bool FolderTreeModel::hasChildren(const QModelIndex& parent) const { TreeItem *item = static_cast(parent.internalPointer()); /* Usually the child count is 0 becuase we do lazy initalization * However, for, buid-in items such as 'Quick Links' there exist diff --git a/src/library/browse/foldertreemodel.h b/src/library/browse/foldertreemodel.h index dcbb6cd3212..240e26b4472 100644 --- a/src/library/browse/foldertreemodel.h +++ b/src/library/browse/foldertreemodel.h @@ -20,7 +20,7 @@ class FolderTreeModel : public TreeItemModel { public: FolderTreeModel(QObject *parent = 0); virtual ~FolderTreeModel(); - virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const; + virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; bool directoryHasChildren(const QString& path) const; private: diff --git a/src/library/cratefeature.cpp b/src/library/cratefeature.cpp index 3151afffc79..10fb6f25970 100644 --- a/src/library/cratefeature.cpp +++ b/src/library/cratefeature.cpp @@ -177,8 +177,7 @@ void CrateFeature::bindWidget(WLibrary* libraryWidget, edit->setHtml(getRootViewHtml()); edit->setOpenLinks(false); connect(edit, SIGNAL(anchorClicked(const QUrl)), - this, SLOT(htmlLinkClicked(const QUrl)) - ); + this, SLOT(htmlLinkClicked(const QUrl))); libraryWidget->registerView("CRATEHOME", edit); } @@ -544,7 +543,7 @@ void CrateFeature::slotImportPlaylist() { lastCrateDirectory, tr("Playlist Files (*.m3u *.m3u8 *.pls *.csv)")); // Exit method if user cancelled the open dialog. - if (playlist_file.isNull() || playlist_file.isEmpty() ) return; + if (playlist_file.isNull() || playlist_file.isEmpty()) return; // Update the import/export crate directory QFileInfo fileName(playlist_file); @@ -676,7 +675,7 @@ void CrateFeature::slotCrateTableRenamed(int a_iCrateId, slotCrateTableChanged(a_iCrateId); } -void CrateFeature::htmlLinkClicked(const QUrl & link) { +void CrateFeature::htmlLinkClicked(const QUrl& link) { if (QString(link.path())=="create") { slotCreateCrate(); } else { @@ -700,9 +699,8 @@ QString CrateFeature::getRootViewHtml() const { html.append(""); html.append(""); html.append(""); - html.append( - QString("%1").arg(createCrateLink) - ); + html.append(QString("%1") + .arg(createCrateLink)); html.append(""); return html; } diff --git a/src/library/cratefeature.h b/src/library/cratefeature.h index 2aa52cb29e3..1a77807889d 100644 --- a/src/library/cratefeature.h +++ b/src/library/cratefeature.h @@ -58,7 +58,7 @@ class CrateFeature : public LibraryFeature { void slotAnalyzeCrate(); void slotCrateTableChanged(int playlistId); void slotCrateTableRenamed(int playlistId, QString a_strName); - void htmlLinkClicked(const QUrl & link); + void htmlLinkClicked(const QUrl& link); private: QString getRootViewHtml() const; diff --git a/src/library/dao/analysisdao.cpp b/src/library/dao/analysisdao.cpp index 108dc3d5bf0..48f861e1f8c 100644 --- a/src/library/dao/analysisdao.cpp +++ b/src/library/dao/analysisdao.cpp @@ -216,7 +216,7 @@ void AnalysisDao::deleteAnalysises(const QList& ids) { LOG_FAILED_QUERY(query) << "couldn't delete analysis"; } const int idColumn = query.record().indexOf("id"); - while(query.next()){ + while (query.next()) { int id = query.value(idColumn).toInt(); QString dataPath = getAnalysisStoragePath().absoluteFilePath( QString::number(id)); diff --git a/src/library/dao/directorydao.cpp b/src/library/dao/directorydao.cpp index 48c6fa333ef..3244c02dd9f 100644 --- a/src/library/dao/directorydao.cpp +++ b/src/library/dao/directorydao.cpp @@ -11,7 +11,7 @@ DirectoryDAO::DirectoryDAO(QSqlDatabase& database) : m_database(database) { } -DirectoryDAO::~DirectoryDAO(){ +DirectoryDAO::~DirectoryDAO() { } void DirectoryDAO::initialize() { @@ -58,7 +58,7 @@ int DirectoryDAO::addDirectory(const QString& newDir) { return ALL_FINE; } -bool DirectoryDAO::isChildDir(QString testDir, QString dirStr){ +bool DirectoryDAO::isChildDir(QString testDir, 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 68db807a7a0..93dbbc7529d 100644 --- a/src/library/dao/playlistdao.cpp +++ b/src/library/dao/playlistdao.cpp @@ -470,8 +470,9 @@ bool PlaylistDAO::insertTrackIntoPlaylist(const int trackId, const int playlistI return true; } -int PlaylistDAO::insertTracksIntoPlaylist(const QList& trackIds, const int playlistId, int position) { - if (playlistId < 0 || position < 0 ) { +int PlaylistDAO::insertTracksIntoPlaylist(const QList& trackIds, + const int playlistId, int position) { + if (playlistId < 0 || position < 0) { return 0; } diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp index 81109177a78..c2e468648d0 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -1327,7 +1327,7 @@ void TrackDAO::markUnverifiedTracksAsDeleted() { if (!query.exec()) { LOG_FAILED_QUERY(query) << "Couldn't find unverified tracks"; } - while (query.next()){ + while (query.next()) { trackIds.insert(query.value(query.record().indexOf("id")).toInt()); } emit(tracksRemoved(trackIds)); @@ -1520,7 +1520,7 @@ void TrackDAO::markTracksAsMixxxDeleted(const QString& dir) { } } -void TrackDAO::writeAudioMetaData(TrackInfoObject* pTrack){ +void TrackDAO::writeAudioMetaData(TrackInfoObject* pTrack) { if (m_pConfig && m_pConfig->getValueString(ConfigKey("[Library]","WriteAudioTags")).toInt() == 1) { AudioTagger tagger(pTrack->getLocation(), pTrack->getSecurityToken()); diff --git a/src/library/hiddentablemodel.cpp b/src/library/hiddentablemodel.cpp index 6d7d2a9a55c..a35305b96f3 100644 --- a/src/library/hiddentablemodel.cpp +++ b/src/library/hiddentablemodel.cpp @@ -9,7 +9,7 @@ HiddenTableModel::HiddenTableModel(QObject* parent, HiddenTableModel::~HiddenTableModel() { } -void HiddenTableModel::setTableModel(int id){ +void HiddenTableModel::setTableModel(int id) { Q_UNUSED(id); QSqlQuery query; const QString tableName("hidden_songs"); diff --git a/src/library/itunes/itunesfeature.cpp b/src/library/itunes/itunesfeature.cpp index c9c5f4b14b7..27452b6eb39 100644 --- a/src/library/itunes/itunesfeature.cpp +++ b/src/library/itunes/itunesfeature.cpp @@ -68,7 +68,7 @@ ITunesFeature::ITunesFeature(QObject* parent, TrackCollection* pTrackCollection) m_isActivated = false; m_title = tr("iTunes"); - m_database = QSqlDatabase::cloneDatabase( pTrackCollection->getDatabase(), "ITUNES_SCANNER"); + m_database = QSqlDatabase::cloneDatabase(pTrackCollection->getDatabase(), "ITUNES_SCANNER"); //Open the database connection in this thread. if (!m_database.open()) { diff --git a/src/library/library.cpp b/src/library/library.cpp index b4ef64ea46e..c2a80c93a71 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -273,7 +273,7 @@ void Library::slotRequestAddDir(QString dir) { } // set at least one directory in the config file so that it will be possible // to downgrade from 1.12 - if (m_pConfig->getValueString(PREF_LEGACY_LIBRARY_DIR).length() < 1){ + if (m_pConfig->getValueString(PREF_LEGACY_LIBRARY_DIR).length() < 1) { m_pConfig->set(PREF_LEGACY_LIBRARY_DIR, dir); } } @@ -337,6 +337,6 @@ void Library::slotRequestRelocateDir(QString oldDir, QString newDir) { } } -QStringList Library::getDirs(){ +QStringList Library::getDirs() { return m_pTrackCollection->getDirectoryDAO().getDirs(); } diff --git a/src/library/librarytablemodel.cpp b/src/library/librarytablemodel.cpp index 32f8d034be7..716037cda06 100644 --- a/src/library/librarytablemodel.cpp +++ b/src/library/librarytablemodel.cpp @@ -9,7 +9,7 @@ const QString LibraryTableModel::DEFAULT_LIBRARYFILTER = LibraryTableModel::LibraryTableModel(QObject* parent, TrackCollection* pTrackCollection, const char* settingsNamespace) - : BaseSqlTableModel(parent, pTrackCollection, settingsNamespace){ + : BaseSqlTableModel(parent, pTrackCollection, settingsNamespace) { setTableModel(); } diff --git a/src/library/parser.cpp b/src/library/parser.cpp index c9814b38424..bb8cf441940 100644 --- a/src/library/parser.cpp +++ b/src/library/parser.cpp @@ -43,17 +43,17 @@ long Parser::countParsed() return (long)m_sLocations.count(); } -bool Parser::isFilepath(QString sFilepath){ +bool Parser::isFilepath(QString sFilepath) { QFile file(sFilepath); bool exists = file.exists(); file.close(); return exists; } -bool Parser::isBinary(QString filename){ +bool Parser::isBinary(QString filename) { QFile file(filename); - if(file.open(QIODevice::ReadOnly)){ + if (file.open(QIODevice::ReadOnly)) { char c; unsigned char uc; diff --git a/src/library/parser.h b/src/library/parser.h index b836ba6abec..7164ec60bf4 100644 --- a/src/library/parser.h +++ b/src/library/parser.h @@ -47,7 +47,7 @@ class Parser : public QObject /**Checks if the file does contain binary content**/ bool isBinary(QString); /**Checks if the given string represents a local filepath**/ - bool isFilepath(QString ); + bool isFilepath(QString); // check for Utf8 encoding static bool isUtf8(const char* string); }; diff --git a/src/library/parsercsv.cpp b/src/library/parsercsv.cpp index 2ed2e221653..16ffd1787bb 100644 --- a/src/library/parsercsv.cpp +++ b/src/library/parsercsv.cpp @@ -34,7 +34,7 @@ QList ParserCsv::parse(QString sFilename) { if (file.open(QIODevice::ReadOnly) && !isBinary(sFilename)) { QByteArray ba = file.readAll(); - QList > tokens = tokenize( ba, ','); + QList > tokens = tokenize(ba, ','); // detect Location column int loc_coll = 0x7fffffff; @@ -49,7 +49,7 @@ QList ParserCsv::parse(QString sFilename) { if (loc_coll < tokens[i].size()) { // Todo: check if path is relative QFileInfo fi = tokens[i][loc_coll]; - if (fi.isRelative()){ + if (fi.isRelative()) { // add base path qDebug() << "is relative" << basepath << fi.filePath(); fi.setFile(basepath,fi.filePath()); @@ -85,9 +85,9 @@ QList > ParserCsv::tokenize(const QByteArray& str, char delimiter for (int pos = 0; pos < str.length(); ++pos) { char c = str[pos]; - if (!quotes && c == '"' ){ + if (!quotes && c == '"') { quotes = true; - } else if (quotes && c== '"' ){ + } else if (quotes && c== '"' ) { if (pos + 1 < str.length() && str[pos+1]== '"') { field.append(c); pos++; @@ -126,7 +126,7 @@ bool ParserCsv::writeCSVFile(const QString &file_str, BaseSqlTableModel* pPlayli */ QFile file(file_str); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){ + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox::warning(NULL,tr("Playlist Export Failed"), tr("Could not create file")+" "+file_str); return false; @@ -149,7 +149,7 @@ bool ParserCsv::writeCSVFile(const QString &file_str, BaseSqlTableModel* pPlayli (pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW) == i)) { continue; } - if (!first){ + if (!first) { out << ","; } else { first = false; @@ -166,12 +166,12 @@ bool ParserCsv::writeCSVFile(const QString &file_str, BaseSqlTableModel* pPlayli for (int j = 0; j < rows; j++) { // writing fields section first = true; - for(int i = 0; i < columns; ++i){ + for (int i = 0; i < columns; ++i) { if (pPlaylistTableModel->isColumnInternal(i) || (pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW) == i)) { continue; } - if (!first){ + if (!first) { out << ","; } else { first = false; @@ -198,7 +198,7 @@ bool ParserCsv::writeReadableTextFile(const QString &file_str, BaseSqlTableModel */ QFile file(file_str); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){ + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox::warning(NULL,tr("Readable text Export Failed"), tr("Could not create file")+" "+file_str); return false; @@ -214,14 +214,14 @@ bool ParserCsv::writeReadableTextFile(const QString &file_str, BaseSqlTableModel for (int j = 0; j < rows; j++) { // writing fields section i = pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_POSITION); - if (i >= 0){ + if (i >= 0) { int nr = pPlaylistTableModel->data(pPlaylistTableModel->index(j,i)).toInt(); out << QString("%1.").arg(nr,2,10,QLatin1Char('0')); } if (writeTimestamp) { i = pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_DATETIMEADDED); - if (i >= 0){ + if (i >= 0) { QTime time = pPlaylistTableModel->data(pPlaylistTableModel->index(j,i)).toTime(); if (j == 0) { msecsFromStartToMidnight = time.msecsTo(QTime(0,0,0,0)); @@ -233,12 +233,12 @@ bool ParserCsv::writeReadableTextFile(const QString &file_str, BaseSqlTableModel } i = pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_ARTIST); - if (i >= 0){ + if (i >= 0) { out << " "; out << pPlaylistTableModel->data(pPlaylistTableModel->index(j,i)).toString(); } i = pPlaylistTableModel->fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_TITLE); - if (i >= 0){ + if (i >= 0) { out << " - "; out << pPlaylistTableModel->data(pPlaylistTableModel->index(j,i)).toString();; } diff --git a/src/library/parserm3u.cpp b/src/library/parserm3u.cpp index 6c94280b69a..4e585fc4556 100644 --- a/src/library/parserm3u.cpp +++ b/src/library/parserm3u.cpp @@ -107,12 +107,13 @@ QString ParserM3u::getFilepath(QTextStream *stream, QString basepath) textline = stream->readLine(); - while(!textline.isEmpty()){ + while (!textline.isEmpty()) { //qDebug() << "Untransofrmed text: " << textline; - if(textline.isNull()) + if (textline.isNull()) { break; + } - if(!textline.contains("#")){ + if (!textline.contains("#")) { filename = textline; filename.remove("file://"); QByteArray strlocbytes = filename.toUtf8(); diff --git a/src/library/parserpls.cpp b/src/library/parserpls.cpp index e7518f1775e..15f8d556c23 100644 --- a/src/library/parserpls.cpp +++ b/src/library/parserpls.cpp @@ -44,7 +44,7 @@ QList ParserPls::parse(QString sFilename) clearLocations(); - if (file.open(QIODevice::ReadOnly) && !isBinary(sFilename) ) { + if (file.open(QIODevice::ReadOnly) && !isBinary(sFilename)) { /* Unfortunately, QT 4.7 does not handle (=\r or asci value 13) line breaks. * This is important on OS X where iTunes, e.g., exports M3U playlists using @@ -90,10 +90,10 @@ long ParserPls::getNumEntries(QTextStream *stream) QString textline; textline = stream->readLine(); - if(textline.contains("[playlist]")){ - - while(!textline.contains("NumberOfEntries")) + if (textline.contains("[playlist]")) { + while (!textline.contains("NumberOfEntries")) { textline = stream->readLine(); + } QString temp = textline.section("=",-1,-1); @@ -111,9 +111,10 @@ QString ParserPls::getFilepath(QTextStream *stream, QString basepath) { QString textline,filename = ""; textline = stream->readLine(); - while(!textline.isEmpty()){ - if(textline.isNull()) + while (!textline.isEmpty()) { + if (textline.isNull()) { break; + } if(textline.contains("File")) { int iPos = textline.indexOf("=",0); @@ -150,7 +151,7 @@ QString ParserPls::getFilepath(QTextStream *stream, QString basepath) bool ParserPls::writePLSFile(const QString &file_str, QList &items, bool useRelativePath) { QFile file(file_str); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){ + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox::warning(NULL,tr("Playlist Export Failed"), tr("Could not create file")+" "+file_str); return false; @@ -162,15 +163,15 @@ bool ParserPls::writePLSFile(const QString &file_str, QList &items, boo QTextStream out(&file); out << "[playlist]\n"; out << "NumberOfEntries=" << items.size() << "\n"; - for(int i =0; i < items.size(); ++i){ + for (int i = 0; i < items.size(); ++i) { //Write relative path if possible - if(useRelativePath){ + if (useRelativePath) { //QDir::relativePath() will return the absolutePath if it cannot compute the //relative Path out << "File" << i << "=" << base_dir.relativeFilePath(items.at(i)) << "\n"; - } - else + } else { out << "File" << i << "=" << items.at(i) << "\n"; + } } return true; diff --git a/src/library/parserpls.h b/src/library/parserpls.h index 4e3f47b4046..c8b8b6bbe2e 100644 --- a/src/library/parserpls.h +++ b/src/library/parserpls.h @@ -20,7 +20,7 @@ class ParserPls : public Parser { Q_OBJECT -public: + public: ParserPls(); virtual ~ParserPls(); /**Can be called to parse a pls file**/ @@ -28,11 +28,11 @@ class ParserPls : public Parser { //Playlist Export static bool writePLSFile(const QString &file, QList &items, bool useRelativePath); -private: + private: /**Returns the Number of entries in the pls file**/ - long getNumEntries(QTextStream * ); + long getNumEntries(QTextStream*); /**Reads a line from the file and returns filepath**/ - QString getFilepath(QTextStream *, QString); + QString getFilepath(QTextStream*, QString); }; diff --git a/src/library/playlistfeature.cpp b/src/library/playlistfeature.cpp index bd8841431b4..11cf1a5efdd 100644 --- a/src/library/playlistfeature.cpp +++ b/src/library/playlistfeature.cpp @@ -82,7 +82,7 @@ void PlaylistFeature::onRightClickChild(const QPoint& globalPos, QModelIndex ind } bool PlaylistFeature::dropAcceptChild(const QModelIndex& index, QList urls, - QObject* pSource){ + QObject* pSource) { //TODO: Filter by supported formats regex and reject anything that doesn't match. int playlistId = playlistIdFromIndex(index); //m_playlistDao.appendTrackToPlaylist(url.toLocalFile(), playlistId); @@ -219,10 +219,8 @@ QString PlaylistFeature::getRootViewHtml() const { html.append(QString("

%1 %2

").arg(playlistsSummary3, playlistsSummary4)); html.append(""); - html.append( - QString("%1") - .arg(createPlaylistLink) - ); + html.append(QString("%1") + .arg(createPlaylistLink)); html.append(""); return html; } diff --git a/src/library/playlisttablemodel.cpp b/src/library/playlisttablemodel.cpp index 0091d1a3cbd..89e77728faa 100644 --- a/src/library/playlisttablemodel.cpp +++ b/src/library/playlisttablemodel.cpp @@ -159,7 +159,7 @@ void PlaylistTableModel::moveTrack(const QModelIndex& sourceIndex, m_playlistDao.moveTrack(m_iPlaylistId, oldPosition, newPosition); } -bool PlaylistTableModel::isLocked(){ +bool PlaylistTableModel::isLocked() { return m_playlistDao.isPlaylistLocked(m_iPlaylistId); } diff --git a/src/library/recording/recordingfeature.cpp b/src/library/recording/recordingfeature.cpp index dd430d05db1..3021384df91 100644 --- a/src/library/recording/recordingfeature.cpp +++ b/src/library/recording/recordingfeature.cpp @@ -17,8 +17,7 @@ RecordingFeature::RecordingFeature(QObject* parent, ConfigObject* p : LibraryFeature(parent), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), - m_pRecordingManager(pRecordingManager){ - + m_pRecordingManager(pRecordingManager) { } RecordingFeature::~RecordingFeature() { diff --git a/src/library/rhythmbox/rhythmboxfeature.cpp b/src/library/rhythmbox/rhythmboxfeature.cpp index e2d0977d3ec..01965e56562 100644 --- a/src/library/rhythmbox/rhythmboxfeature.cpp +++ b/src/library/rhythmbox/rhythmboxfeature.cpp @@ -138,10 +138,11 @@ TreeItem* RhythmboxFeature::importMusicCollection() { // Try and open the Rhythmbox DB. An API call which tells us where // the file is would be nice. QFile db(QDir::homePath() + "/.gnome2/rhythmbox/rhythmdb.xml"); - if ( ! db.exists()) { + if (!db.exists()) { db.setFileName(QDir::homePath() + "/.local/share/rhythmbox/rhythmdb.xml"); - if ( ! db.exists()) + if (!db.exists()) { return NULL; + } } if (!db.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -192,10 +193,11 @@ TreeItem* RhythmboxFeature::importMusicCollection() { TreeItem* RhythmboxFeature::importPlaylists() { QFile db(QDir::homePath() + "/.gnome2/rhythmbox/playlists.xml"); - if ( ! db.exists()) { + if (!db.exists()) { db.setFileName(QDir::homePath() + "/.local/share/rhythmbox/playlists.xml"); - if (!db.exists()) + if (!db.exists()) { return NULL; + } } //Open file if (!db.open(QIODevice::ReadOnly | QIODevice::Text)) @@ -314,7 +316,7 @@ void RhythmboxFeature::importTrack(QXmlStreamReader &xml, QSqlQuery &query) { continue; } if (xml.name() == "location") { - locationUrl = QUrl::fromEncoded( xml.readElementText().toUtf8()); + locationUrl = QUrl::fromEncoded(xml.readElementText().toUtf8()); continue; } } diff --git a/src/library/scanner/scannerutil.h b/src/library/scanner/scannerutil.h index 8904540031d..f00210b4555 100644 --- a/src/library/scanner/scannerutil.h +++ b/src/library/scanner/scannerutil.h @@ -22,7 +22,7 @@ class ScannerUtil { // Blacklist the _Serato_ directory that pollutes "My Music" on Windows. QString seratoDir = QDir::toNativeSeparators( QDesktopServices::storageLocation(QDesktopServices::MusicLocation) + - "/_Serato_" ); + "/_Serato_"); blacklist << seratoDir; #endif return blacklist; diff --git a/src/library/searchquery.cpp b/src/library/searchquery.cpp index 0b2cc26cbb0..5495e5e5978 100644 --- a/src/library/searchquery.cpp +++ b/src/library/searchquery.cpp @@ -239,7 +239,7 @@ DurationFilterNode::DurationFilterNode(const QStringList& sqlColumns, init(argument); } -double DurationFilterNode::parse(const QString& arg, bool* ok){ +double DurationFilterNode::parse(const QString& arg, bool* ok) { QRegExp regex("^(\\d*)(m|:)?([0-6]?\\d)?s?$"); if (regex.indexIn(arg) == -1) { *ok = false; diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp index 9f32cfc2241..b28bfbe5570 100644 --- a/src/library/setlogfeature.cpp +++ b/src/library/setlogfeature.cpp @@ -204,7 +204,7 @@ void SetlogFeature::slotJoinWithPrevious() { m_pPlaylistTableModel->select(); int rows = m_pPlaylistTableModel->rowCount(); - for(int i = 0; i < rows; ++i){ + for (int i = 0; i < rows; ++i) { QModelIndex index = m_pPlaylistTableModel->index(i,0); if (index.isValid()) { TrackPointer track = m_pPlaylistTableModel->getTrack(index); diff --git a/src/library/sidebarmodel.cpp b/src/library/sidebarmodel.cpp index 94e7751d59a..05a7a8efd13 100644 --- a/src/library/sidebarmodel.cpp +++ b/src/library/sidebarmodel.cpp @@ -107,7 +107,7 @@ QModelIndex SidebarModel::parent(const QModelIndex& index) const { // if we have selected an item at the first level of a childnode if (tree_item_parent) { - if (tree_item_parent->data() == "$root"){ + if (tree_item_parent->data() == "$root") { LibraryFeature* feature = tree_item->getFeature(); for (int i = 0; i < m_sFeatures.size(); ++i) { if (feature == m_sFeatures[i]) { diff --git a/src/library/sidebarmodel.h b/src/library/sidebarmodel.h index 8eb5f5fcf67..ef234a95604 100644 --- a/src/library/sidebarmodel.h +++ b/src/library/sidebarmodel.h @@ -29,10 +29,10 @@ class SidebarModel : public QAbstractItemModel { int rowCount(const QModelIndex& parent = QModelIndex()) const; int columnCount(const QModelIndex& parent = QModelIndex()) const; QVariant data(const QModelIndex& index, - int role = Qt::DisplayRole ) const; + int role = Qt::DisplayRole) const; bool dropAccept(const QModelIndex& index, QList urls, QObject* pSource); bool dragMoveAccept(const QModelIndex& index, QUrl url); - virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const; + virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; public slots: void clicked(const QModelIndex& index); @@ -42,10 +42,10 @@ class SidebarModel : public QAbstractItemModel { // Slots for every single QAbstractItemModel signal // void slotColumnsAboutToBeInserted(const QModelIndex& parent, int start, int end); - // void slotColumnsAboutToBeRemoved(const QModelIndex & parent, int start, int end); - // void slotColumnsInserted(const QModelIndex & parent, int start, int end); - // void slotColumnsRemoved(const QModelIndex & parent, int start, int end); - void slotDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight); + // void slotColumnsAboutToBeRemoved(const QModelIndex& parent, int start, int end); + // void slotColumnsInserted(const QModelIndex& parent, int start, int end); + // void slotColumnsRemoved(const QModelIndex& parent, int start, int end); + void slotDataChanged(const QModelIndex& topLeft, const QModelIndex & bottomRight); //void slotHeaderDataChanged(Qt::Orientation orientation, int first, int last); // void slotLayoutAboutToBeChanged(); // void slotLayoutChanged(); diff --git a/src/library/songdownloader.cpp b/src/library/songdownloader.cpp index 7ad75caa943..0ac17b8001b 100644 --- a/src/library/songdownloader.cpp +++ b/src/library/songdownloader.cpp @@ -98,7 +98,7 @@ void SongDownloader::slotError(QNetworkReply::NetworkError error) { emit(downloadError()); } -void SongDownloader::slotProgress( qint64 bytesReceived, qint64 bytesTotal ) { +void SongDownloader::slotProgress(qint64 bytesReceived, qint64 bytesTotal) { qDebug() << bytesReceived << "/" << bytesTotal; emit(downloadProgress(bytesReceived, bytesTotal)); } diff --git a/src/library/stardelegate.cpp b/src/library/stardelegate.cpp index ffc8aaa6c73..a653fb30c9d 100644 --- a/src/library/stardelegate.cpp +++ b/src/library/stardelegate.cpp @@ -33,7 +33,7 @@ StarDelegate::StarDelegate(QObject *pParent) void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { //let the editor to the painting if this is true - if(index==m_currentEditedCellIndex){ + if (index == m_currentEditedCellIndex) { return; } diff --git a/src/library/stareditor.cpp b/src/library/stareditor.cpp index d5b06f4933e..1bee94898a4 100644 --- a/src/library/stareditor.cpp +++ b/src/library/stareditor.cpp @@ -71,7 +71,7 @@ void StarEditor::paintEvent(QPaintEvent *) } } - void StarEditor::leaveEvent(QEvent *){ + void StarEditor::leaveEvent(QEvent*) { m_starRating.setStarCount(0); update(); } diff --git a/src/library/trackcollection.cpp b/src/library/trackcollection.cpp index e34e3d5aaea..ad9051da189 100644 --- a/src/library/trackcollection.cpp +++ b/src/library/trackcollection.cpp @@ -201,9 +201,8 @@ void TrackCollection::installSorting(QSqlDatabase &db) { // than the second, respectively. //static int TrackCollection::sqliteLocaleAwareCompare(void* pArg, - int len1, const void* data1, - int len2, const void* data2 ) -{ + int len1, const void* data1, + int len2, const void* data2) { Q_UNUSED(pArg); // Construct a QString without copy QString string1 = QString::fromRawData(reinterpret_cast(data1), @@ -285,7 +284,7 @@ int TrackCollection::likeCompareInner( const QChar* string, // The string to compare against int stringSize, const QChar esc // The escape character -){ +) { static const QChar MATCH_ONE = QChar('_'); static const QChar MATCH_ALL = QChar('%'); diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp index 4353189b8f7..a09f257464b 100644 --- a/src/library/traktor/traktorfeature.cpp +++ b/src/library/traktor/traktorfeature.cpp @@ -208,7 +208,7 @@ TreeItem* TraktorFeature::importLibrary(QString file) { inCollectionTag = true; } // Each "ENTRY" tag in represents a track - if (inCollectionTag && xml.name() == "ENTRY" ) { + if (inCollectionTag && xml.name() == "ENTRY") { //parse track parseTrack(xml, query); ++nAudioFiles; //increment number of files in the music collection diff --git a/src/library/treeitem.cpp b/src/library/treeitem.cpp index 2af1ca0524f..ca715938c8b 100644 --- a/src/library/treeitem.cpp +++ b/src/library/treeitem.cpp @@ -112,7 +112,7 @@ bool TreeItem::removeChildren(int position, int count) { if (position < 0 || position + count > m_childItems.size()) return false; - for (int row = 0; row < count; ++row){ + for (int row = 0; row < count; ++row) { //Remove from list to avoid invalid pointers TreeItem* item = m_childItems.takeAt(position); if(item) delete item; diff --git a/src/library/treeitemmodel.cpp b/src/library/treeitemmodel.cpp index 678e8f8d59c..26c0391bfd4 100644 --- a/src/library/treeitemmodel.cpp +++ b/src/library/treeitemmodel.cpp @@ -132,7 +132,7 @@ int TreeItemModel::rowCount(const QModelIndex &parent) const { TreeItem *parentItem = NULL; //qDebug() << "parent data: " << parent.data(); - if (!parent.isValid()){ + if (!parent.isValid()) { parentItem = m_pRootItem; } else{ diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 0b9731d0ba3..ebb1c05ad34 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -882,8 +882,7 @@ int MixxxMainWindow::noSoundDlg(void) } else if (msgBox.clickedButton() == wikiButton) { QDesktopServices::openUrl(QUrl( "http://mixxx.org/wiki/doku.php/troubleshooting" - "#no_or_too_few_sound_cards_appear_in_the_preferences_dialog") - ); + "#no_or_too_few_sound_cards_appear_in_the_preferences_dialog")); wikiButton->setEnabled(false); } else if (msgBox.clickedButton() == reconfigureButton) { msgBox.hide(); @@ -943,7 +942,7 @@ int MixxxMainWindow::noOutputDlg(bool *continueClicked) // This way of opening the dialog allows us to use it synchronously m_pPrefDlg->setWindowModality(Qt::ApplicationModal); m_pPrefDlg->exec(); - if ( m_pPrefDlg->result() == QDialog::Accepted) { + if (m_pPrefDlg->result() == QDialog::Accepted) { m_pSoundManager->queryDevices(); return 0; } @@ -1370,7 +1369,7 @@ void MixxxMainWindow::initActions() bool scriptDebuggerEnabled = m_pConfig->getValueString( ConfigKey("[ScriptDebugger]", "Enabled")) == "1"; m_pDeveloperDebugger = new QAction(scriptDebuggerTitle, this); - + m_pDeveloperDebugger->setShortcut( QKeySequence(m_pKbdConfig->getValueString(ConfigKey("[KeyboardShortcuts]", "DeveloperMenu_EnableDebugger"), @@ -1382,7 +1381,7 @@ void MixxxMainWindow::initActions() m_pDeveloperDebugger->setChecked(scriptDebuggerEnabled); connect(m_pDeveloperDebugger, SIGNAL(toggled(bool)), this, SLOT(slotDeveloperDebugger(bool))); - + // TODO: This code should live in a separate class. diff --git a/src/mixxxkeyboard.cpp b/src/mixxxkeyboard.cpp index 2a4238f1cb8..422817684af 100644 --- a/src/mixxxkeyboard.cpp +++ b/src/mixxxkeyboard.cpp @@ -158,7 +158,7 @@ QKeySequence MixxxKeyboard::getKeySeq(QKeyEvent* e) { if (e->modifiers() & Qt::MetaModifier) modseq += "Meta+"; - if( e->key() >= 0x01000020 && e->key() <= 0x01000023 ) { + if (e->key() >= 0x01000020 && e->key() <= 0x01000023) { // Do not act on Modifier only // avoid returning "khmer vowel sign ie (U+17C0)" return k; diff --git a/src/musicbrainz/acoustidclient.cpp b/src/musicbrainz/acoustidclient.cpp index 5ec8e8646e9..91612f39815 100644 --- a/src/musicbrainz/acoustidclient.cpp +++ b/src/musicbrainz/acoustidclient.cpp @@ -94,8 +94,7 @@ void AcoustidClient::requestFinished() { emit(finished(id, ID)); } -QString AcoustidClient::parseResult(QXmlStreamReader& reader){ - +QString AcoustidClient::parseResult(QXmlStreamReader& reader) { while (!reader.atEnd()) { QXmlStreamReader::TokenType type = reader.readNext(); if (type== QXmlStreamReader::StartElement) { diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp index ac3c8fca12c..ef611676a7f 100644 --- a/src/musicbrainz/chromaprinter.cpp +++ b/src/musicbrainz/chromaprinter.cpp @@ -9,7 +9,7 @@ ChromaPrinter::ChromaPrinter(QObject* parent) : QObject(parent) { } -QString ChromaPrinter::getFingerPrint(TrackPointer pTrack){ +QString ChromaPrinter::getFingerPrint(TrackPointer pTrack) { SoundSourceProxy soundSourceProxy(pTrack); Mixxx::SoundSourcePointer pSoundSource(soundSourceProxy.open()); if (pSoundSource.isNull()) { diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index 6be3e64d4e3..4a97b2ef03e 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -23,7 +23,7 @@ const int MusicBrainzClient::m_DefaultTimeout = 5000; // msec MusicBrainzClient::MusicBrainzClient(QObject* parent) : QObject(parent), m_network(this), - m_timeouts(m_DefaultTimeout, this){ + m_timeouts(m_DefaultTimeout, this) { } void MusicBrainzClient::start(int id, const QString& mbid) { diff --git a/src/skin/pixmapsource.cpp b/src/skin/pixmapsource.cpp index 62a2973f78c..d208fbd4e1c 100644 --- a/src/skin/pixmapsource.cpp +++ b/src/skin/pixmapsource.cpp @@ -5,7 +5,7 @@ PixmapSource::PixmapSource() { } -PixmapSource::PixmapSource(const QString &filepath) { +PixmapSource::PixmapSource(const QString& filepath) { setPath(filepath); } @@ -20,7 +20,7 @@ QString PixmapSource::getPath() const { return m_path; } -void PixmapSource::setPath(const QString &newPath) { +void PixmapSource::setPath(const QString& newPath) { m_baData.truncate(0); m_path = newPath; if (m_path.endsWith(".svg", Qt::CaseInsensitive)) { @@ -42,7 +42,7 @@ bool PixmapSource::isBitmap() const { return m_eType == BITMAP; } -void PixmapSource::setSVG(const QByteArray &content) { +void PixmapSource::setSVG(const QByteArray& content) { m_baData = content; m_eType = SVG; } @@ -50,10 +50,9 @@ void PixmapSource::setSVG(const QByteArray &content) { QString PixmapSource::getId() const { quint16 checksum; if (m_baData.isEmpty()) { - checksum = qChecksum( m_path.toAscii().constData(), m_path.length() ); + checksum = qChecksum(m_path.toAscii().constData(), m_path.length()); } else { - checksum = qChecksum( m_baData.constData(), m_baData.length() ); + checksum = qChecksum(m_baData.constData(), m_baData.length()); } return m_path + QString::number(checksum); } - diff --git a/src/skin/pixmapsource.h b/src/skin/pixmapsource.h index 1c1756e6d81..c33b2e49e7a 100644 --- a/src/skin/pixmapsource.h +++ b/src/skin/pixmapsource.h @@ -6,24 +6,24 @@ class PixmapSource { public: PixmapSource(); - PixmapSource(const QString &filepath); + PixmapSource(const QString& filepath); virtual ~PixmapSource(); bool isEmpty() const; bool isSVG() const; bool isBitmap() const; - void setSVG(const QByteArray &content); - void setPath(const QString &newPath); + void setSVG(const QByteArray& content); + void setPath(const QString& newPath); QString getPath() const; QByteArray getData() const; QString getId() const; - + private: enum Type { SVG, BITMAP }; - + QString m_path; QByteArray m_baData; enum Type m_eType; diff --git a/src/skin/skincontext.cpp b/src/skin/skincontext.cpp index 568c1f78145..4502dfa4a3f 100644 --- a/src/skin/skincontext.cpp +++ b/src/skin/skincontext.cpp @@ -10,7 +10,8 @@ SkinContext::SkinContext() { } -SkinContext::SkinContext(ConfigObject* pConfig, QString xmlPath) +SkinContext::SkinContext(ConfigObject* pConfig, + const QString& xmlPath) : m_pConfig(pConfig), m_xmlPath(xmlPath) { } @@ -25,7 +26,7 @@ SkinContext::SkinContext(const SkinContext& parent) it != m_variables.end(); ++it) { context.setProperty(it.key(), it.value()); } - + if (CmdlineArgs::Instance().getDeveloper() && m_pConfig->getValueString( ConfigKey("[ScriptDebugger]", "Enabled")) == "1") { // Enable script debugger @@ -56,7 +57,7 @@ void SkinContext::setVariable(const QString& name, const QString& value) { context.setProperty(name, value); } -void SkinContext::setXmlPath(const QString xmlPath) { +void SkinContext::setXmlPath(const QString& xmlPath) { m_xmlPath = xmlPath; } @@ -229,30 +230,30 @@ QString SkinContext::nodeToString(const QDomNode& node) const { PixmapSource SkinContext::getPixmapSource(const QDomNode& pixmapNode) const { PixmapSource source; - + const SvgParser svgParser(*this); - + if (!pixmapNode.isNull()) { QDomNode svgNode = selectNode(pixmapNode, "svg"); if (!svgNode.isNull()) { // inline svg const QByteArray rslt = svgParser.saveToQByteArray( - svgParser.parseSvgTree(svgNode, m_xmlPath) ); - source.setSVG( rslt ); + svgParser.parseSvgTree(svgNode, m_xmlPath)); + source.setSVG(rslt); } else { // filename QString pixmapName = nodeToString(pixmapNode); if (!pixmapName.isEmpty()) { - source.setPath( getSkinPath(pixmapName) ); + source.setPath(getSkinPath(pixmapName)); if (source.isSVG()) { const QByteArray rslt = svgParser.saveToQByteArray( - svgParser.parseSvgFile(source.getPath()) ); - source.setSVG( rslt ); + svgParser.parseSvgFile(source.getPath())); + source.setSVG(rslt); } } } } - + return source; } @@ -277,6 +278,3 @@ QScriptValue SkinContext::importScriptExtension(const QString& extensionName) { const QScriptEngine& SkinContext::getScriptEngine() const { return m_scriptEngine; } - - - diff --git a/src/skin/skincontext.h b/src/skin/skincontext.h index 664c86471cb..835d3139bec 100644 --- a/src/skin/skincontext.h +++ b/src/skin/skincontext.h @@ -19,7 +19,7 @@ class SkinContext { public: SkinContext(); - SkinContext(ConfigObject* pConfig, QString xmlPath); + SkinContext(ConfigObject* pConfig, const QString& xmlPath); SkinContext(const SkinContext& parent); virtual ~SkinContext(); @@ -41,7 +41,7 @@ class SkinContext { return m_variables; } void setVariable(const QString& name, const QString& value); - void setXmlPath(const QString xmlPath); + void setXmlPath(const QString& xmlPath); // Updates the SkinContext with all the children of node. void updateVariables(const QDomNode& node); @@ -76,14 +76,13 @@ class SkinContext { private: QString variableNodeToText(const QDomElement& element) const; - + mutable QScriptEngine m_scriptEngine; QScriptEngineDebugger m_debugger; QHash m_variables; QString m_skinBasePath; ConfigObject* m_pConfig; QString m_xmlPath; - }; #endif /* SKINCONTEXT_H */ diff --git a/src/skin/svgparser.cpp b/src/skin/svgparser.cpp index d0fc25018a4..1f3c1464bee 100644 --- a/src/skin/svgparser.cpp +++ b/src/skin/svgparser.cpp @@ -21,7 +21,7 @@ QDomNode SvgParser::parseSvgFile(const QString& svgFileName) const { QDomDocument document; document.setContent(&file); svgNode = document.elementsByTagName("svg").item(0); - scanTree(svgNode); + scanTree(&svgNode); file.close(); } return svgNode; @@ -32,50 +32,50 @@ QDomNode SvgParser::parseSvgTree(const QDomNode& svgSkinNode, m_currentFile = sourcePath; // clone svg to don't alter xml input QDomNode svgNode = svgSkinNode.cloneNode(true); - scanTree(svgNode); + scanTree(&svgNode); return svgNode; } -void SvgParser::scanTree(QDomNode& node) const { +void SvgParser::scanTree(QDomNode* node) const { parseElement(node); - QDomNodeList children = node.childNodes(); - for (uint i=0; ichildNodes(); + for (uint i = 0; i < children.length(); ++i) { QDomNode child = children.at(i); if (child.isElement()) { - scanTree(child); + scanTree(&child); } } } -void SvgParser::parseElement(QDomNode& node) const { - QDomElement element = node.toElement(); - - parseAttributes(node); - - if (element.tagName() == "text"){ - if (element.hasAttribute("value")){ +void SvgParser::parseElement(QDomNode* node) const { + QDomElement element = node->toElement(); + + parseAttributes(*node); + + if (element.tagName() == "text") { + if (element.hasAttribute("value")) { QString expression = element.attribute("value"); QString result = evaluateTemplateExpression( - expression, node.lineNumber() ).toString(); - - if (!result.isNull()){ - QDomNodeList children = node.childNodes(); - for (uint i=0; ilineNumber()).toString(); + + if (!result.isNull()) { + QDomNodeList children = node->childNodes(); + for (uint i = 0; i < children.length(); ++i) { + node->removeChild(children.at(i)); } - - QDomNode newChild = node.ownerDocument().createTextNode(result); - node.appendChild(newChild); + + QDomNode newChild = node->ownerDocument().createTextNode(result); + node->appendChild(newChild); } } - - } else if (element.tagName() == "Variable"){ + + } else if (element.tagName() == "Variable") { QString value; - if (element.hasAttribute("expression")){ + if (element.hasAttribute("expression")) { QString expression = element.attribute("expression"); value = evaluateTemplateExpression( - expression, node.lineNumber() ).toString(); - } else if (element.hasAttribute("name")){ + expression, node->lineNumber()).toString(); + } else if (element.hasAttribute("name")) { /* TODO (jclaveau) : Getting the variable from the context or the * script engine have the same result here (in the skin context two) * Isn't it useless? @@ -83,22 +83,22 @@ void SvgParser::parseElement(QDomNode& node) const { */ value = m_context.variable(element.attribute("name")); } - - if (!value.isNull()){ + + if (!value.isNull()) { // replace node by its value - QDomNode varParentNode = node.parentNode(); - QDomNode varValueNode = node.ownerDocument().createTextNode(value); - QDomNode oldChild = varParentNode.replaceChild(varValueNode, node); - + QDomNode varParentNode = node->parentNode(); + QDomNode varValueNode = node->ownerDocument().createTextNode(value); + QDomNode oldChild = varParentNode.replaceChild(varValueNode, *node); + if (oldChild.isNull()) { // replaceChild has a really weird behaviour so I add this check qDebug() << "SVG : unable to replace dom node changed. \n"; } } - - } else if (element.tagName() == "script"){ + + } else if (element.tagName() == "script") { // Look for a filepath in the "src" attribute - QString scriptPath = node.toElement().attribute("src"); + QString scriptPath = node->toElement().attribute("src"); if (!scriptPath.isNull()) { QFile scriptFile(m_context.getSkinPath(scriptPath)); scriptFile.open(QIODevice::ReadOnly|QIODevice::Text); @@ -107,18 +107,17 @@ void SvgParser::parseElement(QDomNode& node) const { scriptPath); } // Evaluates the content of the script element - QString expression = m_context.nodeToString(node); + QString expression = m_context.nodeToString(*node); QScriptValue result = m_context.evaluateScript( - expression, m_currentFile, node.lineNumber()); + expression, m_currentFile, node->lineNumber()); } } -void SvgParser::parseAttributes(QDomNode& node) const { - +void SvgParser::parseAttributes(const QDomNode& node) const { QDomNamedNodeMap attributes = node.attributes(); QDomElement element = node.toElement(); - + // Retrieving hooks pattern from script extension QScriptValue global = m_context.getScriptEngine().globalObject(); QScriptValue hooksPattern = global.property("svg") @@ -126,16 +125,16 @@ void SvgParser::parseAttributes(QDomNode& node) const { QRegExp hookRx; if (!hooksPattern.isNull()) hookRx.setPattern(hooksPattern.toString()); - + // expr-attribute_name="var_name"; QRegExp nameRx("^expr-([^=\\s]+)$"); // TODO (jclaveau) : move this pattern definition to the script extension? for (uint i=0; i < attributes.length(); i++) { - + QDomAttr attribute = attributes.item(i).toAttr(); QString attributeValue = attribute.value(); QString attributeName = attribute.name(); - + // searching variable attributes : // expr-attribute_name="variable_name|expression" if (nameRx.indexIn(attributeName) != -1) { @@ -146,7 +145,7 @@ void SvgParser::parseAttributes(QDomNode& node) const { } continue; } - + if (!hookRx.isEmpty()) { // searching hooks in the attribute value int pos = 0; @@ -160,7 +159,7 @@ void SvgParser::parseAttributes(QDomNode& node) const { pos += replacement.length(); } } - + attribute.setValue(attributeValue); } } @@ -180,8 +179,7 @@ QScriptValue SvgParser::evaluateTemplateExpression(const QString& expression, expression, m_currentFile, lineNumber); if (m_context.getScriptEngine().hasUncaughtException()) { // return an empty string as replacement for the in-attribute expression - QScriptValue nullValue; - return nullValue; + return QScriptValue(); } else { return out; } diff --git a/src/skin/svgparser.h b/src/skin/svgparser.h index 1c656b32554..4b25adadcc9 100644 --- a/src/skin/svgparser.h +++ b/src/skin/svgparser.h @@ -20,16 +20,15 @@ class SvgParser { QByteArray saveToQByteArray(const QDomNode& svgNode) const; private: - void scanTree(QDomNode& node) const; - void parseElement(QDomNode& svgNode) const; - void parseAttributes(QDomNode& node) const; + void scanTree(QDomNode* node) const; + void parseElement(QDomNode* svgNode) const; + void parseAttributes(const QDomNode& node) const; QScriptValue evaluateTemplateExpression(const QString& expression, int lineNumber) const; - + mutable SkinContext m_context; mutable QString m_currentFile; QDomDocument m_document; - }; #endif /* SVGPARSER_H */ diff --git a/src/soundsource.cpp b/src/soundsource.cpp index 454674b3c23..120d41af893 100644 --- a/src/soundsource.cpp +++ b/src/soundsource.cpp @@ -38,7 +38,7 @@ namespace } float parseReplayGainString(QString sReplayGain) { - QString ReplayGainstring = sReplayGain.remove( " dB" ); + QString ReplayGainstring = sReplayGain.remove(" dB"); float fReplayGain = db2ratio(ReplayGainstring.toFloat()); // I found some mp3s of mine with replaygain tag set to 0dB even if not normalized. // This is because of Rapid Evolution 3, I suppose. I prefer to rescan them by setting value to 0 (i.e. rescan via analyserrg) diff --git a/src/soundsource.h b/src/soundsource.h index 68a5255f227..4518a4d1757 100644 --- a/src/soundsource.h +++ b/src/soundsource.h @@ -147,7 +147,7 @@ class SoundSource inline void setTrackNumber(QString trackNumber) { m_sTrackNumber = trackNumber; } - inline void setKey(QString key){ + inline void setKey(QString key) { m_sKey = key; } inline void setBpm(float bpm) { diff --git a/src/soundsourceffmpeg.cpp b/src/soundsourceffmpeg.cpp index 23d9c3be57e..fec7c2ec026 100644 --- a/src/soundsourceffmpeg.cpp +++ b/src/soundsourceffmpeg.cpp @@ -277,7 +277,7 @@ bool SoundSourceFFmpeg::readFramesToCache(unsigned int count, qint64 offset) { } - if( l_iFrameCount > 0 ) { + if (l_iFrameCount > 0) { qDebug() << "SoundSourceFFmpeg::readFramesToCache(): Frame balance is not 0 it is: " << l_iFrameCount; } @@ -383,19 +383,19 @@ Result SoundSourceFFmpeg::open() { qDebug() << "av_open_input_file: cannot open" << qBAFilename; return ERR; } - + #if LIBAVCODEC_VERSION_INT > 3544932 av_dict_free(&l_iFormatOpts); #endif - + // Retrieve stream information if (avformat_find_stream_info(m_pFormatCtx, NULL)<0) { qDebug() << "av_find_stream_info: cannot open" << qBAFilename; return ERR; } - + //debug only (Enable if needed) //av_dump_format(m_pFormatCtx, 0, qBAFilename.constData(), false); diff --git a/src/soundsourceflac.cpp b/src/soundsourceflac.cpp index 865750e65e2..ea235918fe6 100644 --- a/src/soundsourceflac.cpp +++ b/src/soundsourceflac.cpp @@ -70,8 +70,7 @@ Result SoundSourceFLAC::open() { FLAC__stream_decoder_init_stream( m_decoder, FLAC_read_cb, FLAC_seek_cb, FLAC_tell_cb, FLAC_length_cb, FLAC_eof_cb, FLAC_write_cb, FLAC_metadata_cb, FLAC_error_cb, - (void*) this) - ); + (void*) this)); if (initStatus != FLAC__STREAM_DECODER_INIT_STATUS_OK) { qWarning() << "SSFLAC: decoder init failed!"; goto decoderError; diff --git a/src/soundsourceoggvorbis.cpp b/src/soundsourceoggvorbis.cpp index e7c8b068d40..22d2d4b2fbe 100644 --- a/src/soundsourceoggvorbis.cpp +++ b/src/soundsourceoggvorbis.cpp @@ -59,7 +59,7 @@ SoundSourceOggVorbis::SoundSourceOggVorbis(QString qFilename) SoundSourceOggVorbis::~SoundSourceOggVorbis() { - if (filelength > 0){ + if (filelength > 0) { ov_clear(&vf); } } @@ -93,7 +93,7 @@ Result SoundSourceOggVorbis::open() { channels = vi->channels; setSampleRate(vi->rate); - if(channels > 2){ + if (channels > 2) { qDebug() << "oggvorbis: No support for more than 2 channels!"; ov_clear(&vf); filelength = 0; diff --git a/src/soundsourceopus.cpp b/src/soundsourceopus.cpp index ec457c8c451..36c612ab371 100644 --- a/src/soundsourceopus.cpp +++ b/src/soundsourceopus.cpp @@ -56,7 +56,7 @@ Result SoundSourceOpus::open() { const QByteArray qBAFilename(getFilename().toLocal8Bit()); m_ptrOpusFile = op_open_file(qBAFilename.constData(), &error); - if ( m_ptrOpusFile == NULL ) { + if (m_ptrOpusFile == NULL) { qDebug() << "opus: Input does not appear to be an Opus bitstream."; m_lFilelength = 0; return ERR; @@ -215,12 +215,12 @@ Result SoundSourceOpus::parseHeader() { // This is left for debug reasons !! // qDebug() << "opus: We have " << l_ptrOpusTags->comments; - for( i = 0; i < l_ptrOpusTags->comments; i ++){ + for (i = 0; i < l_ptrOpusTags->comments; ++i) { QString l_SWholeTag = QString(l_ptrOpusTags->user_comments[i]); QString l_STag = l_SWholeTag.left(l_SWholeTag.indexOf("=")); QString l_SPayload = l_SWholeTag.right((l_SWholeTag.length() - l_SWholeTag.indexOf("=")) - 1); - if (!l_STag.compare("ARTIST") ) { + if (!l_STag.compare("ARTIST")) { this->setArtist(l_SPayload); } else if (!l_STag.compare("ALBUM")) { this->setAlbum(l_SPayload); diff --git a/src/soundsourceproxy.cpp b/src/soundsourceproxy.cpp index f23d208862b..7bbb7d2c4d8 100644 --- a/src/soundsourceproxy.cpp +++ b/src/soundsourceproxy.cpp @@ -165,7 +165,7 @@ void SoundSourceProxy::loadPlugins() { // static Mixxx::SoundSourcePointer SoundSourceProxy::initialize(const QString& qFilename) { QString extension(qFilename); - extension.remove(0, (qFilename.lastIndexOf(".") + 1)).toLower(); + extension = extension.remove(0, (qFilename.lastIndexOf(".") + 1)).toLower(); #ifdef __FFMPEGFILE__ return Mixxx::SoundSourcePointer(new SoundSourceFFmpeg(qFilename)); diff --git a/src/soundsourcetaglib.cpp b/src/soundsourcetaglib.cpp index ad38f57036d..3cba92f713f 100644 --- a/src/soundsourcetaglib.cpp +++ b/src/soundsourcetaglib.cpp @@ -150,19 +150,18 @@ void readID3v2Tag(SoundSource* pSoundSource, const TagLib::ID3v2::Tag& id3v2) { // Foobar2000-style ID3v2.3.0 tags // TODO: Check if everything is ok. TagLib::ID3v2::FrameList frames = id3v2.frameListMap()["TXXX"]; - for ( TagLib::ID3v2::FrameList::Iterator it = frames.begin(); it != frames.end(); ++it ) { + for (TagLib::ID3v2::FrameList::Iterator it = frames.begin(); it != frames.end(); ++it) { TagLib::ID3v2::UserTextIdentificationFrame* ReplayGainframe = - dynamic_cast( *it ); - if ( ReplayGainframe && ReplayGainframe->fieldList().size() >= 2 ) - { - QString desc = toQString( ReplayGainframe->description() ).toLower(); - if ( desc == "replaygain_album_gain" ){ - QString sReplayGain = toQString( ReplayGainframe->fieldList()[1]); + dynamic_cast(*it); + if (ReplayGainframe && ReplayGainframe->fieldList().size() >= 2) { + QString desc = toQString(ReplayGainframe->description()).toLower(); + if (desc == "replaygain_album_gain") { + QString sReplayGain = toQString(ReplayGainframe->fieldList()[1]); pSoundSource->setReplayGainString(sReplayGain); } //Prefer track gain over album gain. - if ( desc == "replaygain_track_gain" ){ - QString sReplayGain = toQString( ReplayGainframe->fieldList()[1]); + if (desc == "replaygain_track_gain") { + QString sReplayGain = toQString(ReplayGainframe->fieldList()[1]); pSoundSource->setReplayGainString(sReplayGain); } } diff --git a/src/test/enginesynctest.cpp b/src/test/enginesynctest.cpp index d9aca86971e..a8e1cb8cefc 100644 --- a/src/test/enginesynctest.cpp +++ b/src/test/enginesynctest.cpp @@ -28,7 +28,7 @@ class EngineSyncTest : public MockedEngineBackendTest { return ""; } void assertIsMaster(QString group) { - if (group == m_sInternalClockGroup){ + if (group == m_sInternalClockGroup) { ASSERT_EQ(1, ControlObject::getControl(ConfigKey(m_sInternalClockGroup, "sync_master"))->get()); diff --git a/src/test/mixxxtest.cpp b/src/test/mixxxtest.cpp index 7797833a388..18b10d95e14 100644 --- a/src/test/mixxxtest.cpp +++ b/src/test/mixxxtest.cpp @@ -47,7 +47,7 @@ MixxxTest::~MixxxTest() { removeDir(testDataDir); } -bool MixxxTest::removeDir(const QString & dirName) { +bool MixxxTest::removeDir(const QString& dirName) { bool result = true; QDir dir(dirName); diff --git a/src/test/mixxxtest.h b/src/test/mixxxtest.h index 00516829c1d..520451c4a20 100644 --- a/src/test/mixxxtest.h +++ b/src/test/mixxxtest.h @@ -49,7 +49,7 @@ class MixxxTest : public testing::Test { QScopedPointer > m_pConfig; private: - bool removeDir(const QString & dirName); + bool removeDir(const QString& dirName); QString testDataDir; }; diff --git a/src/test/wpushbutton_test.cpp b/src/test/wpushbutton_test.cpp index b1be94bb6c9..8878395ff36 100644 --- a/src/test/wpushbutton_test.cpp +++ b/src/test/wpushbutton_test.cpp @@ -13,7 +13,7 @@ class WPushButtonTest : public MixxxTest { public: WPushButtonTest() - : m_pGroup("[Channel1]"){ + : m_pGroup("[Channel1]") { } protected: diff --git a/src/track/beatutils.cpp b/src/track/beatutils.cpp index eb493d6c916..76165a57dac 100644 --- a/src/track/beatutils.cpp +++ b/src/track/beatutils.cpp @@ -139,7 +139,8 @@ double BeatUtils::computeFilteredWeightedAverage( return filterWeightedAverage / static_cast(filterSum); } -double BeatUtils::calculateBpm(const QVector& beats, int SampleRate, int min_bpm, int max_bpm){ +double BeatUtils::calculateBpm(const QVector& beats, int SampleRate, + int min_bpm, int max_bpm) { /* * Let's compute the average local * BPM for N subsequent beats. diff --git a/src/transposeproxymodel.h b/src/transposeproxymodel.h index 8b15138f1ce..8eb22f3ae54 100644 --- a/src/transposeproxymodel.h +++ b/src/transposeproxymodel.h @@ -2,28 +2,29 @@ #include class TransposeProxyModel : public QAbstractProxyModel{ -public: - TransposeProxyModel(QObject *p = 0) : QAbstractProxyModel(p){} - QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const{ - return index(sourceIndex.column(), sourceIndex.row()); - } - QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const{ - return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); - } - QModelIndex index(int r, int c, const QModelIndex &ind=QModelIndex()) const{ - Q_UNUSED(ind); - return createIndex(r,c); - } - QModelIndex parent(const QModelIndex&) const { - return QModelIndex(); - } - int rowCount(const QModelIndex &) const{ - return sourceModel()->columnCount(); - } - int columnCount(const QModelIndex &) const{ - return sourceModel()->rowCount(); - } - QVariant data(const QModelIndex &ind, int role) const { - return sourceModel()->data(mapToSource(ind), role); - } + public: + TransposeProxyModel(QObject *p = 0) : QAbstractProxyModel(p) {} + + QModelIndex mapFromSource (const QModelIndex& sourceIndex) const { + return index(sourceIndex.column(), sourceIndex.row()); + } + QModelIndex mapToSource(const QModelIndex& proxyIndex) const { + return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); + } + QModelIndex index(int r, int c, const QModelIndex& ind = QModelIndex()) const { + Q_UNUSED(ind); + return createIndex(r,c); + } + QModelIndex parent(const QModelIndex&) const { + return QModelIndex(); + } + int rowCount(const QModelIndex&) const { + return sourceModel()->columnCount(); + } + int columnCount(const QModelIndex&) const { + return sourceModel()->rowCount(); + } + QVariant data(const QModelIndex& ind, int role) const { + return sourceModel()->data(mapToSource(ind), role); + } }; diff --git a/src/util/math.h b/src/util/math.h index d7d86270215..ecdce81ad5e 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -69,7 +69,7 @@ inline int roundUpToPowerOf2(int v) { // MSVS 2013 (_MSC_VER 1800) introduced C99 support. #if defined(__WINDOWS__) && _MSC_VER < 1800 -inline int round(double x){ +inline int round(double x) { return x < 0.0 ? ceil(x - 0.5) : floor(x + 0.5); } #endif diff --git a/src/util/performancetimer.h b/src/util/performancetimer.h index aa56e915cf8..8a5513d57a3 100644 --- a/src/util/performancetimer.h +++ b/src/util/performancetimer.h @@ -43,7 +43,7 @@ #define PERFORMANCETIMER_H // -// This is a fork of QPerformanceTimer just without the Q prefix +// This is a fork of QPerformanceTimer just without the Q prefix // To fix interface changes issues in different QT versions // Added restart() function // return time in ns resolution @@ -61,7 +61,9 @@ class PerformanceTimer private: qint64 t1; +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) qint64 t2; +#endif }; #endif // PERFORMANCETIMER_H diff --git a/src/util/singleton.h b/src/util/singleton.h index 4aa9a124385..b4a53503c49 100644 --- a/src/util/singleton.h +++ b/src/util/singleton.h @@ -7,25 +7,24 @@ template class Singleton { public: - static T* create() - { - if( !m_instance) + static T* create() { + if (!m_instance) { m_instance = new T(); + } return m_instance; } - static T* instance() - { + static T* instance() { if (m_instance == NULL) { qWarning() << "Singleton class has not been created yet, returning NULL"; } return m_instance; } - static void destroy() - { - if( m_instance) + static void destroy() { + if (m_instance) { delete m_instance; + } } protected: @@ -34,8 +33,8 @@ class Singleton private: //hide copy constructor and assign operator - Singleton( const Singleton&) {} - const Singleton& operator = ( const Singleton&) {} + Singleton(const Singleton&) {} + const Singleton& operator= (const Singleton&) {} static T* m_instance; }; diff --git a/src/util/threadcputimer.cpp b/src/util/threadcputimer.cpp index 8a8b9f8b402..0281bc78ff1 100644 --- a/src/util/threadcputimer.cpp +++ b/src/util/threadcputimer.cpp @@ -65,6 +65,10 @@ static inline void do_gettime(qint64 *sec, qint64 *frac) *frac = ts.tv_nsec; return; } +#else + Q_UNUSED(threadCpuTimeChecked); + Q_UNUSED(threadCpuTimeAvailable); + Q_UNUSED(unixCheckClockType); #endif *sec = 0; *frac = 0; diff --git a/src/vamp/vampanalyser.cpp b/src/vamp/vampanalyser.cpp index edef71538ca..f624dca1835 100644 --- a/src/vamp/vampanalyser.cpp +++ b/src/vamp/vampanalyser.cpp @@ -101,7 +101,7 @@ void VampAnalyser::initializePluginPaths() { #endif } -VampAnalyser::VampAnalyser(ConfigObject* pconfig) +VampAnalyser::VampAnalyser() : m_iSampleCount(0), m_iOUT(0), m_iRemainingSamples(0), @@ -113,8 +113,7 @@ VampAnalyser::VampAnalyser(ConfigObject* pconfig) m_plugin(NULL), m_bDoNotAnalyseMoreSamples(false), m_FastAnalysisEnabled(false), - m_iMaxSamplesToAnalyse(0), - m_pConfig(pconfig) { + m_iMaxSamplesToAnalyse(0) { } VampAnalyser::~VampAnalyser() { diff --git a/src/vamp/vampanalyser.h b/src/vamp/vampanalyser.h index e99989c4ad4..a145e7edd4f 100644 --- a/src/vamp/vampanalyser.h +++ b/src/vamp/vampanalyser.h @@ -19,7 +19,7 @@ class VampAnalyser { public: - VampAnalyser(ConfigObject *pconfig); + VampAnalyser(); virtual ~VampAnalyser(); bool Init(const QString pluginlibrary, const QString pluginid, @@ -53,8 +53,6 @@ class VampAnalyser { bool m_bDoNotAnalyseMoreSamples; bool m_FastAnalysisEnabled; int m_iMaxSamplesToAnalyse; - /** Pointer to config object */ - ConfigObject* m_pConfig; }; #endif /* VAMPANALYSER_H_ */ diff --git a/src/waveform/renderers/glslwaveformrenderersignal.cpp b/src/waveform/renderers/glslwaveformrenderersignal.cpp index ba3b45025fc..28d3ba4ce37 100644 --- a/src/waveform/renderers/glslwaveformrenderersignal.cpp +++ b/src/waveform/renderers/glslwaveformrenderersignal.cpp @@ -189,7 +189,7 @@ void GLSLWaveformRendererSignal::createFrameBuffers() //qDebug() << bufferWidth; } -bool GLSLWaveformRendererSignal::onInit(){ +bool GLSLWaveformRendererSignal::onInit() { m_loadedWaveform = 0; if (!m_frameShaderProgram) @@ -210,12 +210,12 @@ void GLSLWaveformRendererSignal::onSetup(const QDomNode& /*node*/) { } -void GLSLWaveformRendererSignal::onSetTrack(){ +void GLSLWaveformRendererSignal::onSetTrack() { m_loadedWaveform = 0; loadTexture(); } -void GLSLWaveformRendererSignal::onResize(){ +void GLSLWaveformRendererSignal::onResize() { createFrameBuffers(); } diff --git a/src/waveform/renderers/glwaveformrendererrgb.cpp b/src/waveform/renderers/glwaveformrendererrgb.cpp index 0fcc88115b1..d1c56169b27 100644 --- a/src/waveform/renderers/glwaveformrendererrgb.cpp +++ b/src/waveform/renderers/glwaveformrendererrgb.cpp @@ -118,15 +118,17 @@ void GLWaveformRendererRGB::draw(QPainter* painter, QPaintEvent* /*event*/) { glEnable(GL_LINE_SMOOTH); glBegin(GL_LINES); { - for( int visualIndex = firstVisualIndex; + for (int visualIndex = firstVisualIndex; visualIndex < lastVisualIndex; visualIndex += 2) { - if( visualIndex < 0) + if (visualIndex < 0) { continue; + } - if( visualIndex > dataSize - 1) + if (visualIndex > dataSize - 1) { break; + } float left_low = lowGain * (float) data[visualIndex].filtered.low; float left_mid = midGain * (float) data[visualIndex].filtered.mid; @@ -164,10 +166,11 @@ void GLWaveformRendererRGB::draw(QPainter* painter, QPaintEvent* /*event*/) { glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - if( m_alignment == Qt::AlignBottom) + if (m_alignment == Qt::AlignBottom) { glOrtho(firstVisualIndex, lastVisualIndex, 0.0, 255.0, -10.0, 10.0); - else + } else { glOrtho(firstVisualIndex, lastVisualIndex, 255.0, 0.0, -10.0, 10.0); + } glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -179,15 +182,17 @@ void GLWaveformRendererRGB::draw(QPainter* painter, QPaintEvent* /*event*/) { glEnable(GL_LINE_SMOOTH); glBegin(GL_LINES); { - for( int visualIndex = firstVisualIndex; + for (int visualIndex = firstVisualIndex; visualIndex < lastVisualIndex; visualIndex += 2) { - if( visualIndex < 0) + if (visualIndex < 0) { continue; + } - if( visualIndex > dataSize - 1) + if (visualIndex > dataSize - 1) { break; + } float low = lowGain * (float) math_max(data[visualIndex].filtered.low, data[visualIndex+1].filtered.low); float mid = midGain * (float) math_max(data[visualIndex].filtered.mid, data[visualIndex+1].filtered.mid); diff --git a/src/waveform/renderers/glwaveformrendererrgb.h b/src/waveform/renderers/glwaveformrendererrgb.h index 1dcf617747c..50ef5d2c557 100644 --- a/src/waveform/renderers/glwaveformrendererrgb.h +++ b/src/waveform/renderers/glwaveformrendererrgb.h @@ -7,7 +7,7 @@ class ControlObject; class GLWaveformRendererRGB : public WaveformRendererSignalBase { public: - explicit GLWaveformRendererRGB( WaveformWidgetRenderer* waveformWidgetRenderer); + explicit GLWaveformRendererRGB(WaveformWidgetRenderer* waveformWidgetRenderer); virtual ~GLWaveformRendererRGB(); virtual void onSetup(const QDomNode& node); diff --git a/src/waveform/renderers/glwaveformrenderersimplesignal.cpp b/src/waveform/renderers/glwaveformrenderersimplesignal.cpp index cf37456a483..197a124035e 100644 --- a/src/waveform/renderers/glwaveformrenderersimplesignal.cpp +++ b/src/waveform/renderers/glwaveformrenderersimplesignal.cpp @@ -14,10 +14,10 @@ GLWaveformRendererSimpleSignal::GLWaveformRendererSimpleSignal( } -GLWaveformRendererSimpleSignal::~GLWaveformRendererSimpleSignal(){ +GLWaveformRendererSimpleSignal::~GLWaveformRendererSimpleSignal() { } -void GLWaveformRendererSimpleSignal::onSetup(const QDomNode &node){ +void GLWaveformRendererSimpleSignal::onSetup(const QDomNode& node) { Q_UNUSED(node); } @@ -26,8 +26,7 @@ inline void setPoint(QPointF& point, qreal x, qreal y) { point.setY(y); } -void GLWaveformRendererSimpleSignal::draw(QPainter* painter, QPaintEvent* /*event*/){ - +void GLWaveformRendererSimpleSignal::draw(QPainter* painter, QPaintEvent* /*event*/) { TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); if (!pTrack) { return; diff --git a/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp b/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp index 561f5d040d6..64c7dae1365 100644 --- a/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp +++ b/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp @@ -15,10 +15,10 @@ QtWaveformRendererSimpleSignal::QtWaveformRendererSimpleSignal(WaveformWidgetRen } -QtWaveformRendererSimpleSignal::~QtWaveformRendererSimpleSignal(){ +QtWaveformRendererSimpleSignal::~QtWaveformRendererSimpleSignal() { } -void QtWaveformRendererSimpleSignal::onSetup(const QDomNode &node){ +void QtWaveformRendererSimpleSignal::onSetup(const QDomNode& node) { Q_UNUSED(node); QColor borderColor = m_pColors->getSignalColor().lighter(125); @@ -36,7 +36,7 @@ inline void setPoint(QPointF& point, qreal x, qreal y) { point.setY(y); } -void QtWaveformRendererSimpleSignal::draw(QPainter* painter, QPaintEvent* /*event*/){ +void QtWaveformRendererSimpleSignal::draw(QPainter* painter, QPaintEvent* /*event*/) { TrackPointer pTrack = m_waveformRenderer->getTrackInfo(); if (!pTrack) { diff --git a/src/waveform/renderers/waveformrendererrgb.cpp b/src/waveform/renderers/waveformrendererrgb.cpp index 5b8b0c595ec..445cf6528ee 100644 --- a/src/waveform/renderers/waveformrendererrgb.cpp +++ b/src/waveform/renderers/waveformrendererrgb.cpp @@ -11,7 +11,7 @@ WaveformRendererRGB::WaveformRendererRGB( WaveformWidgetRenderer* waveformWidgetRenderer) - : WaveformRendererSignalBase( waveformWidgetRenderer) { + : WaveformRendererSignalBase(waveformWidgetRenderer) { } WaveformRendererRGB::~WaveformRendererRGB() { diff --git a/src/waveform/vsyncthread.cpp b/src/waveform/vsyncthread.cpp index d85c4c38f13..f4e3c0a197b 100644 --- a/src/waveform/vsyncthread.cpp +++ b/src/waveform/vsyncthread.cpp @@ -23,6 +23,7 @@ VSyncThread::VSyncThread(MixxxMainWindow* mixxxMainWindow) : QThread(mixxxMainWindow), + m_bDoRendering(true), m_vSyncTypeChanged(false), m_usSyncIntervalTime(33333), m_vSyncMode(ST_TIMER), @@ -31,20 +32,18 @@ VSyncThread::VSyncThread(MixxxMainWindow* mixxxMainWindow) m_swapWait(0), m_displayFrameRate(60.0), m_vSyncPerRendering(1), - m_pGuiTick(mixxxMainWindow->getGuiTick()){ - doRendering = true; + m_pGuiTick(mixxxMainWindow->getGuiTick()) { } VSyncThread::~VSyncThread() { - doRendering = false; + m_bDoRendering = false; m_semaVsyncSlot.release(2); // Two slots wait(); //delete m_glw; } -void VSyncThread::stop() -{ - doRendering = false; +void VSyncThread::stop() { + m_bDoRendering = false; } @@ -55,7 +54,7 @@ void VSyncThread::run() { m_usWaitToSwap = m_usSyncIntervalTime; m_timer.start(); - while (doRendering) { + while (m_bDoRendering) { if (m_vSyncMode == ST_FREE) { // for benchmark only! diff --git a/src/waveform/vsyncthread.h b/src/waveform/vsyncthread.h index f47ae67251f..cc22ad89c23 100644 --- a/src/waveform/vsyncthread.h +++ b/src/waveform/vsyncthread.h @@ -73,7 +73,7 @@ class VSyncThread : public QThread { void vsyncSwap(); private: - bool doRendering; + bool m_bDoRendering; QGLWidget *m_glw; #if defined(__APPLE__) diff --git a/src/waveform/widgets/glrgbwaveformwidget.cpp b/src/waveform/widgets/glrgbwaveformwidget.cpp index af2d9208e0b..7970efa0743 100644 --- a/src/waveform/widgets/glrgbwaveformwidget.cpp +++ b/src/waveform/widgets/glrgbwaveformwidget.cpp @@ -13,7 +13,7 @@ #include "util/performancetimer.h" -GLRGBWaveformWidget::GLRGBWaveformWidget( const char* group, QWidget* parent) +GLRGBWaveformWidget::GLRGBWaveformWidget(const char* group, QWidget* parent) : QGLWidget(parent, SharedGLContext::getWidget()), WaveformWidgetAbstract(group) { @@ -47,7 +47,7 @@ void GLRGBWaveformWidget::castToQWidget() { m_widget = static_cast(static_cast(this)); } -void GLRGBWaveformWidget::paintEvent( QPaintEvent* event) { +void GLRGBWaveformWidget::paintEvent(QPaintEvent* event) { Q_UNUSED(event); } diff --git a/src/waveform/widgets/glsimplewaveformwidget.cpp b/src/waveform/widgets/glsimplewaveformwidget.cpp index cac2bd5d049..cb2edb65188 100644 --- a/src/waveform/widgets/glsimplewaveformwidget.cpp +++ b/src/waveform/widgets/glsimplewaveformwidget.cpp @@ -40,7 +40,7 @@ GLSimpleWaveformWidget::GLSimpleWaveformWidget(const char* group, QWidget* paren m_initSuccess = init(); } -GLSimpleWaveformWidget::~GLSimpleWaveformWidget(){ +GLSimpleWaveformWidget::~GLSimpleWaveformWidget() { if (QGLContext::currentContext() != context()) { makeCurrent(); } diff --git a/src/waveform/widgets/glslwaveformwidget.cpp b/src/waveform/widgets/glslwaveformwidget.cpp index 88c91afb03a..be721ec1d0d 100644 --- a/src/waveform/widgets/glslwaveformwidget.cpp +++ b/src/waveform/widgets/glslwaveformwidget.cpp @@ -43,7 +43,7 @@ GLSLWaveformWidget::GLSLWaveformWidget(const char* group, QWidget* parent) m_initSuccess = init(); } -GLSLWaveformWidget::~GLSLWaveformWidget(){ +GLSLWaveformWidget::~GLSLWaveformWidget() { makeCurrent(); } diff --git a/src/waveform/widgets/glvsynctestwidget.cpp b/src/waveform/widgets/glvsynctestwidget.cpp index 8adff040ccb..0b33edcfc79 100644 --- a/src/waveform/widgets/glvsynctestwidget.cpp +++ b/src/waveform/widgets/glvsynctestwidget.cpp @@ -39,7 +39,7 @@ GLVSyncTestWidget::GLVSyncTestWidget(const char* group, QWidget* parent) qDebug() << "GLVSyncTestWidget.isSharing() =" << isSharing(); } -GLVSyncTestWidget::~GLVSyncTestWidget(){ +GLVSyncTestWidget::~GLVSyncTestWidget() { if (QGLContext::currentContext() != context()) { makeCurrent(); } diff --git a/src/waveform/widgets/qtsimplewaveformwidget.cpp b/src/waveform/widgets/qtsimplewaveformwidget.cpp index f869b63b500..b662f1e14ad 100644 --- a/src/waveform/widgets/qtsimplewaveformwidget.cpp +++ b/src/waveform/widgets/qtsimplewaveformwidget.cpp @@ -40,7 +40,7 @@ QtSimpleWaveformWidget::QtSimpleWaveformWidget(const char* group, QWidget* paren m_initSuccess = init(); } -QtSimpleWaveformWidget::~QtSimpleWaveformWidget(){ +QtSimpleWaveformWidget::~QtSimpleWaveformWidget() { if (QGLContext::currentContext() != context()) { makeCurrent(); } diff --git a/src/waveform/widgets/rgbwaveformwidget.cpp b/src/waveform/widgets/rgbwaveformwidget.cpp index f64b77b634c..95d33a5aa1e 100644 --- a/src/waveform/widgets/rgbwaveformwidget.cpp +++ b/src/waveform/widgets/rgbwaveformwidget.cpp @@ -11,9 +11,9 @@ #include "waveform/renderers/waveformrendererendoftrack.h" #include "waveform/renderers/waveformrenderbeat.h" -RGBWaveformWidget::RGBWaveformWidget( const char* group, QWidget* parent) - : QWidget(parent), - WaveformWidgetAbstract(group) { +RGBWaveformWidget::RGBWaveformWidget(const char* group, QWidget* parent) + : QWidget(parent), + WaveformWidgetAbstract(group) { addRenderer(); addRenderer(); addRenderer(); @@ -35,7 +35,7 @@ void RGBWaveformWidget::castToQWidget() { m_widget = static_cast(this); } -void RGBWaveformWidget::paintEvent( QPaintEvent* event) { +void RGBWaveformWidget::paintEvent(QPaintEvent* event) { QPainter painter(this); draw(&painter,event); } diff --git a/src/widget/controlwidgetconnection.cpp b/src/widget/controlwidgetconnection.cpp index 26e40576072..b6a07d33594 100644 --- a/src/widget/controlwidgetconnection.cpp +++ b/src/widget/controlwidgetconnection.cpp @@ -125,7 +125,7 @@ void ControlWidgetPropertyConnection::slotControlValueChanged(double v) { QVariant parameter; QWidget* pWidget = m_pWidget->toQWidget(); QVariant property = pWidget->property(m_propertyName.constData()); - if (property.type() == QMetaType::Bool) { + if (property.type() == QVariant::Bool) { parameter = getControlParameterForValue(v) > 0; } else { parameter = getControlParameterForValue(v); diff --git a/src/widget/wdisplay.cpp b/src/widget/wdisplay.cpp index 21e6f972396..81eaddc9695 100644 --- a/src/widget/wdisplay.cpp +++ b/src/widget/wdisplay.cpp @@ -100,9 +100,9 @@ void WDisplay::setPixmap(QVector* pPixmaps, int iPos, if (iPos < 0 || iPos >= pPixmaps->size()) { return; } - + PixmapSource source(filename); - PaintablePointer pPixmap = WPixmapStore::getPaintable( source, + PaintablePointer pPixmap = WPixmapStore::getPaintable(source, Paintable::TILE); if (pPixmap.isNull() || pPixmap->isNull()) { @@ -163,7 +163,7 @@ void WDisplay::onConnectedControlChanged(double dParameter, double dValue) { } } -void WDisplay::paintEvent(QPaintEvent* ) { +void WDisplay::paintEvent(QPaintEvent*) { QStyleOption option; option.initFrom(this); QStylePainter p(this); diff --git a/src/widget/wimagestore.cpp b/src/widget/wimagestore.cpp index 2273aa43785..aea67137a96 100644 --- a/src/widget/wimagestore.cpp +++ b/src/widget/wimagestore.cpp @@ -9,17 +9,17 @@ QHash WImageStore::m_dictionary; QSharedPointer WImageStore::m_loader = QSharedPointer(); // static -QImage * WImageStore::getImageNoCache(const QString& fileName) { +QImage* WImageStore::getImageNoCache(const QString& fileName) { return getImageNoCache(PixmapSource(fileName)); } // static -QImage * WImageStore::getImage(const QString &fileName) { +QImage* WImageStore::getImage(const QString& fileName) { return getImage(PixmapSource(fileName)); } // static -QImage * WImageStore::getImage(const PixmapSource source) { +QImage* WImageStore::getImage(const PixmapSource& source) { // Search for Image in list ImageInfoType* info = NULL; @@ -56,20 +56,20 @@ QImage * WImageStore::getImage(const PixmapSource source) { /**/ // static -QImage * WImageStore::getImageNoCache(const PixmapSource source) { +QImage* WImageStore::getImageNoCache(const PixmapSource& source) { QImage* pImage; if (source.isSVG()) { - QScopedPointer pSvgRenderer(new QSvgRenderer()); - if( source.getData().isEmpty() ){ - pSvgRenderer->load(source.getPath()); + QSvgRenderer renderer; + if (source.getData().isEmpty()) { + renderer.load(source.getPath()); } else { - pSvgRenderer->load(source.getData()); + renderer.load(source.getData()); } - - pImage = new QImage(pSvgRenderer->defaultSize(), QImage::Format_ARGB32); + + pImage = new QImage(renderer.defaultSize(), QImage::Format_ARGB32); pImage->fill(0x00000000); // Transparent black. QPainter painter(pImage); - pSvgRenderer->render(&painter); + renderer.render(&painter); } else { if (m_loader) { pImage = m_loader->getImage(source.getPath()); diff --git a/src/widget/wimagestore.h b/src/widget/wimagestore.h index 376579a2b9c..4e79c5487b1 100644 --- a/src/widget/wimagestore.h +++ b/src/widget/wimagestore.h @@ -8,14 +8,14 @@ #include "skin/imgsource.h" #include "skin/pixmapsource.h" -class QImage; +class QImage; class WImageStore { public: static QImage* getImage(const QString &fileName); static QImage* getImageNoCache(const QString &fileName); - static QImage* getImage(const PixmapSource source); - static QImage* getImageNoCache(const PixmapSource source); + static QImage* getImage(const PixmapSource& source); + static QImage* getImageNoCache(const PixmapSource& source); static void deleteImage(QImage* p); static void setLoader(QSharedPointer ld); // For external owned images like software generated ones. diff --git a/src/widget/wlabel.cpp b/src/widget/wlabel.cpp index 838a749cd82..9dc755457c9 100644 --- a/src/widget/wlabel.cpp +++ b/src/widget/wlabel.cpp @@ -50,7 +50,7 @@ void WLabel::setup(QDomNode node, const SkinContext& context) { // Font size if (context.hasNode(node, "FontSize")) { int fontsize = context.selectString(node, "FontSize").toInt(); - setFont( QFont("Helvetica",fontsize,QFont::Normal) ); + setFont(QFont("Helvetica", fontsize, QFont::Normal)); } // Alignment diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 19b3e748284..64b651c901f 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -312,7 +312,7 @@ void WOverview::paintEvent(QPaintEvent *) { diffGain = 255.0 - 255.0 / visualGain; } - if (m_diffGain != diffGain || m_waveformImageScaled.isNull() ) { + if (m_diffGain != diffGain || m_waveformImageScaled.isNull()) { QRect sourceRect(0, diffGain, m_pWaveformSourceImage->width(), m_pWaveformSourceImage->height() - 2 * diffGain); m_waveformImageScaled = m_pWaveformSourceImage->copy( @@ -350,7 +350,7 @@ void WOverview::paintEvent(QPaintEvent *) { const float gain = (float)(width()-2) / trackSamples; // Draw range (loop) - for( unsigned int i = 0; i < m_markRanges.size(); i++) { + for (unsigned int i = 0; i < m_markRanges.size(); ++i) { WaveformMarkRange& currentMarkRange = m_markRanges[i]; // If the mark range is not active we should not draw it. @@ -397,7 +397,7 @@ void WOverview::paintEvent(QPaintEvent *) { painter.setOpacity(0.9); - for( int i = 0; i < m_marks.size(); i++) { + for (int i = 0; i < m_marks.size(); ++i) { WaveformMark& currentMark = m_marks[i]; if (currentMark.m_pointControl && currentMark.m_pointControl->get() >= 0.0) { //const float markPosition = 1.0 + @@ -415,7 +415,7 @@ void WOverview::paintEvent(QPaintEvent *) { QPointF textPoint; textPoint.setX(markPosition+0.5f); - if( currentMark.m_align == Qt::AlignTop) { + if (currentMark.m_align == Qt::AlignTop) { QFontMetricsF metric(markerFont); textPoint.setY(metric.tightBoundingRect(currentMark.m_text).height()+0.5f); } else { diff --git a/src/widget/woverviewhsv.cpp b/src/widget/woverviewhsv.cpp index 218bbcb9ff3..68df3512a8e 100644 --- a/src/widget/woverviewhsv.cpp +++ b/src/widget/woverviewhsv.cpp @@ -24,7 +24,7 @@ bool WOverviewHSV::drawNextPixmapPart() { } const int dataSize = m_pWaveform->getDataSize(); - if (dataSize == 0 ) { + if (dataSize == 0) { return false; } @@ -93,15 +93,14 @@ bool WOverviewHSV::drawNextPixmapPart() { maxHigh[0] + maxHigh[1]) * 1.2; // Prevent division by zero - if( total > 0 ) - { + if (total > 0) { // Normalize low and high // (mid not need, because it not change the color) lo = (maxLow[0] + maxLow[1]) / total; hi = (maxHigh[0] + maxHigh[1]) / total; - } - else + } else { lo = hi = 0.0; + } // Set color color.setHsvF(h, 1.0-hi, 1.0-lo); diff --git a/src/widget/woverviewlmh.cpp b/src/widget/woverviewlmh.cpp index 61632fa90b1..113944bf0c1 100644 --- a/src/widget/woverviewlmh.cpp +++ b/src/widget/woverviewlmh.cpp @@ -26,7 +26,7 @@ bool WOverviewLMH::drawNextPixmapPart() { } const int dataSize = m_pWaveform->getDataSize(); - if (dataSize == 0 ) { + if (dataSize == 0) { return false; } diff --git a/src/widget/woverviewrgb.cpp b/src/widget/woverviewrgb.cpp index b70a8249a9e..4c95f5d1d25 100644 --- a/src/widget/woverviewrgb.cpp +++ b/src/widget/woverviewrgb.cpp @@ -23,7 +23,7 @@ bool WOverviewRGB::drawNextPixmapPart() { } const int dataSize = m_pWaveform->getDataSize(); - if (dataSize == 0 ) { + if (dataSize == 0) { return false; } diff --git a/src/widget/wpixmapstore.cpp b/src/widget/wpixmapstore.cpp index 006390e780c..ecd1f89faee 100644 --- a/src/widget/wpixmapstore.cpp +++ b/src/widget/wpixmapstore.cpp @@ -68,16 +68,16 @@ Paintable::Paintable(const QString& fileName, DrawMode mode) } } -Paintable::Paintable(PixmapSource source, DrawMode mode) +Paintable::Paintable(const PixmapSource& source, DrawMode mode) : m_draw_mode(mode) { if (source.isSVG()) { QScopedPointer pSvgRenderer(new QSvgRenderer()); - if( source.getData().isEmpty() ){ + if (source.getData().isEmpty()) { pSvgRenderer->load(source.getPath()); } else { pSvgRenderer->load(source.getData()); } - + if (mode == STRETCH) { m_pSvg.reset(pSvgRenderer.take()); } else if (mode == TILE) { @@ -94,7 +94,7 @@ Paintable::Paintable(PixmapSource source, DrawMode mode) } } else { QPixmap * pPixmap = new QPixmap(); - if (!source.getData().isEmpty()){ + if (!source.getData().isEmpty()) { pPixmap->loadFromData(source.getData()); } else { pPixmap->load(source.getPath()); @@ -241,7 +241,7 @@ PaintablePointer WPixmapStore::getPaintable(PixmapSource source, } return PaintablePointer(); } - + m_paintableCache[source.getId()] = pPaintable; return pPaintable; } diff --git a/src/widget/wpixmapstore.h b/src/widget/wpixmapstore.h index d4452842732..cc3fedbde06 100644 --- a/src/widget/wpixmapstore.h +++ b/src/widget/wpixmapstore.h @@ -44,7 +44,7 @@ class Paintable { // Takes ownership of QImage. Paintable(QImage* pImage, DrawMode mode); Paintable(const QString& fileName, DrawMode mode); - Paintable(PixmapSource source, DrawMode mode); + Paintable(const PixmapSource& source, DrawMode mode); QSize size() const; int width() const; diff --git a/src/widget/wsizeawarestack.cpp b/src/widget/wsizeawarestack.cpp index 59d16478310..9177d6cb5c7 100644 --- a/src/widget/wsizeawarestack.cpp +++ b/src/widget/wsizeawarestack.cpp @@ -28,7 +28,7 @@ class SizeAwareLayout : public QStackedLayout QWidget *wc = widget(i); bool notFit = false; - if (i > 0 ) { + if (i > 0) { // Check minimum, but not for the smallest, it is the fallback notFit = wc->minimumHeight() > s.height() || wc->minimumWidth() > s.width(); } diff --git a/src/widget/wstarrating.cpp b/src/widget/wstarrating.cpp index 58d1c6beb73..f40bdb75cf4 100644 --- a/src/widget/wstarrating.cpp +++ b/src/widget/wstarrating.cpp @@ -26,14 +26,14 @@ QSize WStarRating::sizeHint() const { QSize widgetSize = style()->sizeFromContents(QStyle::CT_PushButton, &option, m_starRating.sizeHint(), this); widgetSize.expandedTo(QApplication::globalStrut()); - + m_contentRect.setRect( - (widgetSize.width() - m_starRating.sizeHint().width() ) / 2, - (widgetSize.height() - m_starRating.sizeHint().height() ) / 2, + (widgetSize.width() - m_starRating.sizeHint().width()) / 2, + (widgetSize.height() - m_starRating.sizeHint().height()) / 2, m_starRating.sizeHint().width(), m_starRating.sizeHint().height() ); - + return widgetSize; } @@ -72,10 +72,10 @@ void WStarRating::paintEvent(QPaintEvent *) { QStyleOption option; option.initFrom(this); QStylePainter painter(this); - + painter.setBrush(option.palette.text()); painter.drawPrimitive(QStyle::PE_Widget, option); - + m_starRating.paint(&painter, m_contentRect, option.palette, StarRating::ReadOnly, option.state & QStyle::State_Selected); @@ -106,17 +106,17 @@ int WStarRating::starAtPosition(int x) { return 0; } int star = (x / (m_starRating.sizeHint().width() / m_starRating.maxStarCount())) + 1; - - if (star <= 0 || star > m_starRating.maxStarCount()){ + + if (star <= 0 || star > m_starRating.maxStarCount()) { return 0; } - + return star; } void WStarRating::mouseReleaseEvent(QMouseEvent*) { if (!m_pCurrentTrack) return; - + m_pCurrentTrack->setRating(m_starRating.starCount()); } diff --git a/src/widget/wstatuslight.cpp b/src/widget/wstatuslight.cpp index f33553c9087..773ea43d656 100644 --- a/src/widget/wstatuslight.cpp +++ b/src/widget/wstatuslight.cpp @@ -48,7 +48,7 @@ void WStatusLight::setNoPos(int iNoPos) { } WStatusLight::SizeMode WStatusLight::SizeModeFromString(QString str) { - if (str.toUpper() == "FIXED" ) { + if (str.toUpper() == "FIXED") { return FIXED; } else if (str.toUpper() == "RESIZE") { return RESIZE; diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index c925a4d7e77..28263f232c7 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -740,7 +740,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) { } } m_pPlaylistMenu->addSeparator(); - QAction *newPlaylistAction = new QAction( tr("Create New Playlist"), m_pPlaylistMenu); + QAction* newPlaylistAction = new QAction(tr("Create New Playlist"), m_pPlaylistMenu); m_pPlaylistMenu->addAction(newPlaylistAction); m_playlistMapper.setMapping(newPlaylistAction, -1);// -1 to signify new playlist connect(newPlaylistAction, SIGNAL(triggered()), &m_playlistMapper, SLOT(map())); @@ -770,7 +770,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) { connect(pAction, SIGNAL(triggered()), &m_crateMapper, SLOT(map())); } m_pCrateMenu->addSeparator(); - QAction *newCrateAction = new QAction( tr("Create New Crate"), m_pCrateMenu); + QAction* newCrateAction = new QAction(tr("Create New Crate"), m_pCrateMenu); m_pCrateMenu->addAction(newCrateAction); m_crateMapper.setMapping(newCrateAction, -1);// -1 to signify new playlist connect(newCrateAction, SIGNAL(triggered()), &m_crateMapper, SLOT(map())); @@ -795,7 +795,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) { } int column = trackModel->fieldIndex("bpm_lock"); QModelIndex index = indices.at(0).sibling(indices.at(0).row(),column); - if (index.data().toBool()){ //BPM is locked + if (index.data().toBool()) { //BPM is locked m_pBpmUnlockAction->setEnabled(true); m_pBpmLockAction->setEnabled(false); m_pBpmDoubleAction->setEnabled(false); @@ -1350,7 +1350,7 @@ void WTrackTableView::addSelectionToPlaylist(int iPlaylistId) { trackIds.append(iTrackId); } } - if (iPlaylistId==-1){//i.e. a new playlist is suppose to be created + if (iPlaylistId == -1) { // i.e. a new playlist is suppose to be created QString name; bool validNameGiven = false; @@ -1412,7 +1412,7 @@ void WTrackTableView::addSelectionToCrate(int iCrateId) { trackIds.append(iTrackId); } } - if (iCrateId == -1){//i.e. a new crate is suppose to be created + if (iCrateId == -1) { // i.e. a new crate is suppose to be created QString name; bool validNameGiven = false; do { @@ -1526,7 +1526,7 @@ void WTrackTableView::slotUnlockBpm() { lockBpm(false); } -void WTrackTableView::slotScaleBpm(int scale){ +void WTrackTableView::slotScaleBpm(int scale) { TrackModel* trackModel = getTrackModel(); if (trackModel == NULL) { return; diff --git a/src/widget/wwaveformviewer.h b/src/widget/wwaveformviewer.h index d3f7de0e367..19f4ad042dd 100644 --- a/src/widget/wwaveformviewer.h +++ b/src/widget/wwaveformviewer.h @@ -36,8 +36,8 @@ class WWaveformViewer : public WWidget { void trackDropped(QString filename, QString group); public slots: - void onTrackLoaded( TrackPointer track); - void onTrackUnloaded( TrackPointer track); + void onTrackLoaded(TrackPointer track); + void onTrackUnloaded(TrackPointer track); protected: virtual void resizeEvent(QResizeEvent *event);