implement https://bugs.launchpad.net/mixxx/+bug/1180052
Merge remote-tracking branch 'upstream/master' into beatgrid_sync
Merge branch 'master' into beatgrid_sync
Merge branch 'master' into beatgrid_sync
Merge branch 'master' into beatgrid_sync
change text and add test
Release allocated memory at least GLIBC doesn't do it without

Valgrind:
==3147== 8,388,608 bytes in 2 blocks are possibly lost in loss record 1,784 of 1,784
==3147==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3147==    by 0xA875DD: std::vector<WaveformData, std::allocator<WaveformData> >::_M_fill_insert(__gnu_cxx::__normal_iterator<WaveformData*, std::vector<WaveformData, std::allocator<WaveformData> > >, unsigned long, WaveformData const&) (new_allocator.h:94)
==3147==    by 0xA85006: Waveform::resize(int) (stl_vector.h:1004)
==3147==    by 0xA85678: Waveform::readByteArray(QByteArray) (waveform.cpp:118)
==3147==    by 0xA88064: WaveformFactory::updateWaveformFromAnalysis(Waveform*, AnalysisDao::AnalysisInfo const&)
(waveformfactory.cpp:11)
==3147==    by 0x4BAC99: AnalyserWaveform::loadStored(QSharedPointer<TrackInfoObject>) const (analyserwaveform.cpp:138)
==3147==    by 0x4BA1E2: AnalyserWaveform::initialise(QSharedPointer<TrackInfoObject>, int, int) (analyserwaveform.cpp:72)
==3147==    by 0x4B22AE: AnalyserQueue::run() (analyserqueue.cpp:320)
==3147==    by 0x77A90CB: ??? (in /usr/lib64/libQtCore.so.4.8.4)
==3147==    by 0xA05AE0E: start_thread (in /lib64/libpthread-2.17.so)
==3147==    by 0xD6FB44C: clone (in /lib64/libc-2.17.so)
Release signals when exit object

==7691== 8,925,096 (64 direct, 8,925,032 indirect) bytes in 1 blocks are definitely lost in loss record 1,822 of 1,823
==7691==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7691==    by 0x78BCF43: ??? (in /usr/lib64/libQtCore.so.4.8.4)
==7691==    by 0x78BE484: QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType) (in /usr/lib64/libQtCore.so.4.8.4)
==7691==    by 0x4C61C8: BaseTrackPlayer::slotLoadTrack(QSharedPointer<TrackInfoObject>, bool) (basetrackplayer.cpp:160)
==7691==    by 0x98861B: PlayerManager::slotLoadTrackIntoNextAvailableDeck(QSharedPointer<TrackInfoObject>) (playermanager.cpp:402)
==7691==    by 0x96752A: PlayerManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_playermanager.cc:81)
==7691==    by 0x78BA29E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.4)
==7691==    by 0x8ED0A2: Library::loadTrack(QSharedPointer<TrackInfoObject>) (moc_library.cc:176)
==7691==    by 0x8D1D75: Library::slotLoadTrack(QSharedPointer<TrackInfoObject>) (library.cpp:196)
==7691==    by 0x8ED499: Library::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_library.cc:103)
==7691==    by 0x78BA29E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.4)
==7691==    by 0x8EE82F: LibraryFeature::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_libraryfeature.cc:154)
I know deleteLater() is here for the reason an there is lots of discussion how not so wonderfull is to use
straight delete with QObject but then documentation of deleteLater says object is deleted when thread is exited
and it seems that the said thread in this point main so memory usage will rise and rise

Dicussion about using deleteLater()
http://stackoverflow.com/questions/4888189/how-delete-and-deletelater-works-wrt-to-signals-and-slots-in-qt

==7930== 5,776,177 (40 direct, 5,776,137 indirect) bytes in 1 blocks are definitely lost in loss record 1,754 of 1,754
==7930==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7930==    by 0xA128BE: BeatFactory::loadBeatsFromByteArray(QSharedPointer<TrackInfoObject>, QString, QString,
QByteArray*) (qsharedpointer_impl.h:267)
==7930==    by 0x8BAACA: TrackDAO::getTrackFromDB(int) const (trackdao.cpp:934)
==7930==    by 0x8BC5FB: TrackDAO::getTrack(int, bool) const (trackdao.cpp:1059)
==7930==    by 0x81A402: BaseSqlTableModel::getTrack(QModelIndex const&) const (basesqltablemodel.cpp:693)
==7930==    by 0xAD48E6: WTrackTableView::slotMouseDoubleClicked(QModelIndex const&) (wtracktableview.cpp:378)
==7930==    by 0xA978F1: WTrackTableView::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
(moc_wtracktableview.cc:91)
==7930==    by 0x78BA29E: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in
/usr/lib64/libQtCore.so.4.8.4)
==7930==    by 0x60F0664: QAbstractItemView::doubleClicked(QModelIndex const&) (in /usr/lib64/libQtGui.so.4.8.4)
==7930==    by 0x60F07C4: QAbstractItemView::mouseDoubleClickEvent(QMouseEvent*) (in /usr/lib64/libQtGui.so.4.8.4)
==7930==    by 0x5C39161: QWidget::event(QEvent*) (in /usr/lib64/libQtGui.so.4.8.4)
==7930==    by 0x5FE3F25: QFrame::event(QEvent*) (in /usr/lib64/libQtGui.so.4.8.4)
add HID mapping for Hercules DJ Console MP3

Add mapping provided by a user from this Bug
https://bugs.launchpad.net/mixxx/+bug/1232822
Fixes leakage of non freed EngineEffect that leaks memory also clear QMap (just because other QMap is also cleared)

==18481== 5,122,340 (120 direct, 5,122,220 indirect) bytes in 1 blocks are definitely lost in loss record 1,798 of 1,799
==18481==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18481==    by 0x6455F6: Effect::Effect(QObject*, EffectsManager*, EffectManifest const&, QSharedPointer<EffectInstantiator>) (effect.cpp:20)
==18481==    by 0x673D28: EffectsBackend::instantiateEffect(EffectsManager*, QString const&) (effectsbackend.cpp:58)
==18481==    by 0x682C4D: EffectsManager::instantiateEffect(QString const&) (effectsmanager.cpp:129)
==18481==    by 0x68596C: EffectsManager::setupDefaults() (effectsmanager.cpp:158)
==18481==    by 0x95341C: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:148)
==18481==    by 0x470772: main (main.cpp:338)
Because SampleUtil::alloc() usage  pure usage of delete could led in crash when freeing reverb
effects so use SampleUtil::free() to fix this

==18091== Mismatched free() / delete / delete []
==18091==    at 0x4C2AA9C: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18091==    by 0x6BE5BA: GroupEffectProcessor<ReverbGroupState>::~GroupEffectProcessor() (reverbeffect.h:29)
==18091==    by 0x6BDA3F: ReverbEffect::~ReverbEffect() (reverbeffect.cpp:62)
==18091==    by 0x7921BE: EngineEffect::~EngineEffect() (engineeffect.cpp:38)
==18091==    by 0x792D58: EngineEffect::~EngineEffect() (engineeffect.cpp:51)
==18091==    by 0x646DA3: Effect::~Effect() (effect.cpp:61)
==18091==    by 0x647B98: Effect::~Effect() (effect.cpp:62)
==18091==    by 0x64D057: EffectChain::~EffectChain() (qsharedpointer_impl.h:342)
==18091==    by 0x64D218: EffectChain::~EffectChain() (effectchain.cpp:26)
==18091==    by 0x653B38: EffectChainManager::~EffectChainManager() (qsharedpointer_impl.h:342)
==18091==    by 0x653C48: EffectChainManager::~EffectChainManager() (effectchainmanager.cpp:21)
==18091==    by 0x684C33: EffectsManager::~EffectsManager() (effectsmanager.cpp:25)
==18091==  Address 0x1b7eb580 is 0 bytes inside a block of size 640,000 alloc'd
==18091==    at 0x4C2B537: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18091==    by 0x6BF301: GroupEffectProcessor<ReverbGroupState>::initialize(QSet<QString> const&) (reverbeffect.h:25)
==18091==    by 0x79397D: EngineEffect::EngineEffect(EffectManifest const&, QSet<QString> const&, QSharedPointer<EffectInstantiator>) (engineeffect.cpp:31)
==18091==    by 0x644A8F: Effect::Effect(QObject*, EffectsManager*, EffectManifest const&, QSharedPointer<EffectInstantiator>) (effect.cpp:18)
==18091==    by 0x674EA8: EffectsBackend::instantiateEffect(EffectsManager*, QString const&) (effectsbackend.cpp:58)
==18091==    by 0x683DCD: EffectsManager::instantiateEffect(QString const&) (effectsmanager.cpp:129)
==18091==    by 0x68766B: EffectsManager::setupDefaults() (effectsmanager.cpp:180)
==18091==    by 0x95B4BC: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:148)
==18091==    by 0x470772: main (main.cpp:338)
==18091==
EngineEffectManager is allocated but not freed

==18942== 2,627,848 (40 direct, 2,627,808 indirect) bytes in 1 blocks are definitely lost in loss record 1,589 of 1,589
==18942==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18942==    by 0x687CFC: EffectsManager::EffectsManager(QObject*, ConfigObject<ConfigValue>*) (effectsmanager.cpp:19)
==18942==    by 0x9535A8: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:137)
==18942==    by 0x470772: main (main.cpp:338)
Freeing allocated EngineEffectRack

==19186== 2,572,176 (24 direct, 2,572,152 indirect) bytes in 1 blocks are definitely lost in loss record 1,578 of 1,578
==19186==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19186==    by 0x66DC30: EffectRack::EffectRack(EffectsManager*, EffectChainManager*, unsigned int) (effectrack.cpp:16)
==19186==    by 0x653148: EffectChainManager::addEffectRack() (effectchainmanager.cpp:37)
==19186==    by 0x685852: EffectsManager::setupDefaults() (effectsmanager.cpp:137)
==19186==    by 0x95361C: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:148)
==19186==    by 0x470772: main (main.cpp:338)
Freeing allocated Buffer in engineeffectchain.cpp and let Effect chaing to free it also.

==19402== 642,456 (56 direct, 642,400 indirect) bytes in 1 blocks are definitely lost in loss record 1,577 of 1,580
==19402==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19402==    by 0x64BD6B: EffectChain::EffectChain(EffectsManager*, QString const&, QSharedPointer<EffectChain>) (effectchain.cpp:21)
==19402==    by 0x66CADE: EffectRack::addEffectChainSlot() (effectrack.cpp:132)
==19402==    by 0x68592C: EffectsManager::setupDefaults() (effectsmanager.cpp:150)
==19402==    by 0x95363C: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:148)
==19402==    by 0x470772: main (main.cpp:338)
This leak is really needed (and if it is I really like it!).
I studied the code and didn't get understand how this comment like situation can be happening.
I Mixxx releases this pointer at the last one it shouldn't cause any trouble. But this commit can be ignored
just slowering the noise in valgrind and as comment says it's 11 bytes per time so this
doesn't fill up memory (just looks awful)

    // Need to strdup the string because EngineChannel will save the pointer,
    // but we might get deleted before the EngineChannel. TODO(XXX)
    // pSafeGroupName is leaked. It's like 5 bytes so whatever.
I totally agree about this comment but again just cleaning valgrind to see what are the real
leaks and what are just 'needed' ones.

        // We don't know if something downstream expects the string to persist,
        // so dupe it (probably leaking it).
Leaking allocation of object. Probably shouldn't do that but just cleaning valgrind.

==5934== 284 (48 direct, 236 indirect) bytes in 1 blocks are definitely lost in loss record 1,336 of 1,528
==5934==    at 0x4C2BCA7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5934==    by 0x7B6DB0: EngineMicrophone::EngineMicrophone(char const*, EffectsManager*) (enginemicrophone.cpp:33)
==5934==    by 0x953DEC: MixxxMainWindow::MixxxMainWindow(QApplication*, CmdlineArgs const&) (mixxx.cpp:175)
==5934==    by 0x470772: main (main.cpp:338)
Merge upstream and resolve conflict
Bug 1160043: Added spinbox/slider in Prefrences->waveform to make end of
track user configurable. Currently, the timer ranges from 0 (no flash)
to 60 secs before the end of track.