diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2019-01-11 22:18:50 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2019-01-11 22:18:50 +0100 |
commit | 7c3fb1dc3826e761b68c85fdd3de54fc542e685c (patch) | |
tree | 0abda4c87f440108124cbdcb89da5dfa45d1ccdf /src | |
parent | 833a2a150558e49d6ed08b8653ffd53afed854a2 (diff) |
remove QT4 compatibility layer from util/compatibility.h
Diffstat (limited to 'src')
-rw-r--r-- | src/control/controlvalue.h | 2 | ||||
-rw-r--r-- | src/controllers/bulk/bulkcontroller.cpp | 2 | ||||
-rw-r--r-- | src/controllers/hid/hidcontroller.cpp | 2 | ||||
-rw-r--r-- | src/engine/cachingreader/cachingreaderworker.cpp | 2 | ||||
-rw-r--r-- | src/engine/controls/loopingcontrol.cpp | 2 | ||||
-rw-r--r-- | src/engine/effects/engineeffectchain.cpp | 2 | ||||
-rw-r--r-- | src/engine/enginebuffer.cpp | 10 | ||||
-rw-r--r-- | src/engine/sidechain/shoutconnection.cpp | 2 | ||||
-rw-r--r-- | src/library/export/trackexportworker.cpp | 4 | ||||
-rw-r--r-- | src/library/trackcollection.cpp | 1 | ||||
-rw-r--r-- | src/mixer/playermanager.cpp | 6 | ||||
-rw-r--r-- | src/mixxx.cpp | 11 | ||||
-rw-r--r-- | src/preferences/broadcastprofile.cpp | 2 | ||||
-rw-r--r-- | src/preferences/dialog/dlgpreferences.cpp | 3 | ||||
-rw-r--r-- | src/soundio/soundmanager.cpp | 2 | ||||
-rw-r--r-- | src/util/compatibility.h | 41 | ||||
-rw-r--r-- | src/util/statsmanager.cpp | 4 | ||||
-rw-r--r-- | src/util/task.cpp | 2 | ||||
-rw-r--r-- | src/waveform/waveform.h | 2 |
19 files changed, 38 insertions, 64 deletions
diff --git a/src/control/controlvalue.h b/src/control/controlvalue.h index 356f85b921..ae1110abe4 100644 --- a/src/control/controlvalue.h +++ b/src/control/controlvalue.h @@ -77,7 +77,7 @@ class ControlValueAtomicBase { public: inline T getValue() const { T value; - unsigned int index = static_cast<unsigned int>(load_atomic(m_readIndex)) % cRingSize; + unsigned int index = static_cast<unsigned int>(m_readIndex.load()) % cRingSize; while (!m_ring[index].tryGet(&value)) { // We are here if // 1) there are more then kMaxReaderSlots reader (get) reading the same value or diff --git a/src/controllers/bulk/bulkcontroller.cpp b/src/controllers/bulk/bulkcontroller.cpp index bc4e0cf187..398cf9c863 100644 --- a/src/controllers/bulk/bulkcontroller.cpp +++ b/src/controllers/bulk/bulkcontroller.cpp @@ -33,7 +33,7 @@ void BulkReader::run() { m_stop = 0; unsigned char data[255]; - while (load_atomic(m_stop) == 0) { + while (m_stop.load() == 0) { // Blocked polling: The only problem with this is that we can't close // the device until the block is released, which means the controller // has to send more data diff --git a/src/controllers/hid/hidcontroller.cpp b/src/controllers/hid/hidcontroller.cpp index 3a44ae9aa8..a9e50550a7 100644 --- a/src/controllers/hid/hidcontroller.cpp +++ b/src/controllers/hid/hidcontroller.cpp @@ -28,7 +28,7 @@ HidReader::~HidReader() { void HidReader::run() { m_stop = 0; unsigned char *data = new unsigned char[255]; - while (load_atomic(m_stop) == 0) { + while (m_stop.load() == 0) { // Blocked polling: The only problem with this is that we can't close // the device until the block is released, which means the controller // has to send more data diff --git a/src/engine/cachingreader/cachingreaderworker.cpp b/src/engine/cachingreader/cachingreaderworker.cpp index aeccbfb5e4..d89c6bd187 100644 --- a/src/engine/cachingreader/cachingreaderworker.cpp +++ b/src/engine/cachingreader/cachingreaderworker.cpp @@ -96,7 +96,7 @@ void CachingReaderWorker::run() { QThread::currentThread()->setObjectName(QString("CachingReaderWorker %1").arg(++id)); Event::start(m_tag); - while (!load_atomic(m_stop)) { + while (!m_stop.load()) { // Request is initialized by reading from FIFO CachingReaderChunkReadRequest request; if (m_newTrackAvailable) { diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp index cdf7d62b51..851bf86c42 100644 --- a/src/engine/controls/loopingcontrol.cpp +++ b/src/engine/controls/loopingcontrol.cpp @@ -792,7 +792,7 @@ void LoopingControl::notifySeek(double dNewPlaypos, bool adjustingPhase) { void LoopingControl::setLoopingEnabled(bool enabled) { m_bLoopingEnabled = enabled; m_pCOLoopEnabled->set(enabled); - BeatLoopingControl* pActiveBeatLoop = load_atomic_pointer(m_pActiveBeatLoop); + BeatLoopingControl* pActiveBeatLoop = m_pActiveBeatLoop.load(); if (pActiveBeatLoop != nullptr) { if (enabled) { pActiveBeatLoop->activate(); diff --git a/src/engine/effects/engineeffectchain.cpp b/src/engine/effects/engineeffectchain.cpp index dd855f1618..11e57d1778 100644 --- a/src/engine/effects/engineeffectchain.cpp +++ b/src/engine/effects/engineeffectchain.cpp @@ -293,7 +293,7 @@ bool EngineEffectChain::process(const ChannelHandle& inputHandle, && m_mixMode == EffectChainMixMode::DryPlusWet; if (!skipAddingDry) { - for (int i=0; i <= numSamples; ++i) { + for (SINT i = 0; i <= static_cast<SINT>(numSamples); ++i) { pIntermediateOutput[i] += pIntermediateInput[i]; } } diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 878de3c71d..e16385ca0d 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -382,7 +382,7 @@ void EngineBuffer::requestEnableSync(bool enabled) { return; } SyncRequestQueued enable_request = - static_cast<SyncRequestQueued>(load_atomic(m_iEnableSyncQueued)); + static_cast<SyncRequestQueued>(m_iEnableSyncQueued.load()); if (enabled) { m_iEnableSyncQueued = SYNC_REQUEST_ENABLE; } else { @@ -597,10 +597,10 @@ bool EngineBuffer::updateIndicatorsAndModifyPlay(bool newPlay) { // allow the set since it might apply to a track we are loading due to the // asynchrony. bool playPossible = true; - if ((!m_pCurrentTrack && load_atomic(m_iTrackLoading) == 0) || - (m_pCurrentTrack && load_atomic(m_iTrackLoading) == 0 && + if ((!m_pCurrentTrack && m_iTrackLoading.load() == 0) || + (m_pCurrentTrack && m_iTrackLoading.load() == 0 && m_filepos_play >= m_pTrackSamples->get() && - !load_atomic(m_iSeekQueued))) { + !m_iSeekQueued.load())) { // play not possible playPossible = false; } @@ -1009,7 +1009,7 @@ void EngineBuffer::process(CSAMPLE* pOutput, const int iBufferSize) { m_iSampleRate = sample_rate; } - bool bTrackLoading = load_atomic(m_iTrackLoading) != 0; + bool bTrackLoading = m_iTrackLoading.load() != 0; if (!bTrackLoading && m_pause.tryLock()) { processTrackLocked(pOutput, iBufferSize, sample_rate); // release the pauselock diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp index 1c856e49ba..9f5895ec37 100644 --- a/src/engine/sidechain/shoutconnection.cpp +++ b/src/engine/sidechain/shoutconnection.cpp @@ -944,7 +944,7 @@ QSharedPointer<FIFO<CSAMPLE>> ShoutConnection::getOutputFifo() { } bool ShoutConnection::threadWaiting() { - return load_atomic(m_threadWaiting); + return m_threadWaiting.load(); } void ShoutConnection::run() { diff --git a/src/library/export/trackexportworker.cpp b/src/library/export/trackexportworker.cpp index 076ac7dc37..551437a5e1 100644 --- a/src/library/export/trackexportworker.cpp +++ b/src/library/export/trackexportworker.cpp @@ -80,7 +80,7 @@ void TrackExportWorker::run() { // on the bar, which looks really nice. emit(progress(it->fileName(), i, copy_list.size())); copyFile(*it, it.key()); - if (load_atomic(m_bStop)) { + if (m_bStop.load()) { emit(canceled()); return; } @@ -161,7 +161,7 @@ TrackExportWorker::OverwriteAnswer TrackExportWorker::makeOverwriteRequest( // We can be either canceled from the other thread, or as a return value // from this call. First check for a call from the other thread. - if (load_atomic(m_bStop)) { + if (m_bStop.load()) { return OverwriteAnswer::CANCEL; } diff --git a/src/library/trackcollection.cpp b/src/library/trackcollection.cpp index 62c0b64ab4..a93293059d 100644 --- a/src/library/trackcollection.cpp +++ b/src/library/trackcollection.cpp @@ -1,5 +1,6 @@ #include <QStringBuilder> #include <QThread> +#include <QApplication> #include "library/trackcollection.h" diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index c58bc23beb..aa05ba3341 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -209,7 +209,7 @@ bool PlayerManager::isPreviewDeckGroup(const QString& group, int* number) { unsigned int PlayerManager::numDecks() { // We do this to cache the control once it is created so callers don't incur // a hashtable lookup every time they call this. - ControlProxy* pCOPNumDecks = load_atomic_pointer(m_pCOPNumDecks); + ControlProxy* pCOPNumDecks = m_pCOPNumDecks.load(); if (pCOPNumDecks == nullptr) { pCOPNumDecks = new ControlProxy(ConfigKey("[Master]", "num_decks")); if (!pCOPNumDecks->valid()) { @@ -227,7 +227,7 @@ unsigned int PlayerManager::numDecks() { unsigned int PlayerManager::numSamplers() { // We do this to cache the control once it is created so callers don't incur // a hashtable lookup every time they call this. - ControlProxy* pCOPNumSamplers = load_atomic_pointer(m_pCOPNumSamplers); + ControlProxy* pCOPNumSamplers = m_pCOPNumSamplers.load(); if (pCOPNumSamplers == nullptr) { pCOPNumSamplers = new ControlProxy(ConfigKey("[Master]", "num_samplers")); if (!pCOPNumSamplers->valid()) { @@ -245,7 +245,7 @@ unsigned int PlayerManager::numSamplers() { unsigned int PlayerManager::numPreviewDecks() { // We do this to cache the control once it is created so callers don't incur // a hashtable lookup every time they call this. - ControlProxy* pCOPNumPreviewDecks = load_atomic_pointer(m_pCOPNumPreviewDecks); + ControlProxy* pCOPNumPreviewDecks = m_pCOPNumPreviewDecks.load(); if (pCOPNumPreviewDecks == nullptr) { pCOPNumPreviewDecks = new ControlProxy( ConfigKey("[Master]", "num_preview_decks")); diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 3a70294a82..4debd9be33 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -24,6 +24,9 @@ #include <QGLWidget> #include <QUrl> #include <QtDebug> +#include <QLocale> +#include <QGuiApplication> +#include <QInputMethod> #include "dialog/dlgabout.h" #include "preferences/dialog/dlgpreferences.h" @@ -115,8 +118,16 @@ Bool __xErrorHandler(Display* display, XErrorEvent* event, xError* error) { // application defined handler. return False; } + #endif +inline QLocale inputLocale() { + // Use the default config for local keyboard + QInputMethod* pInputMethod = QGuiApplication::inputMethod(); + return pInputMethod ? pInputMethod->locale() : + QLocale(QLocale::English); +} + } // anonymous namespace // static diff --git a/src/preferences/broadcastprofile.cpp b/src/preferences/broadcastprofile.cpp index 202499f106..960a164fef 100644 --- a/src/preferences/broadcastprofile.cpp +++ b/src/preferences/broadcastprofile.cpp @@ -434,7 +434,7 @@ void BroadcastProfile::setConnectionStatus(int newState) { } int BroadcastProfile::connectionStatus() { - return load_atomic(m_connectionStatus); + return m_connectionStatus.load(); } void BroadcastProfile::setSecureCredentialStorage(bool value) { diff --git a/src/preferences/dialog/dlgpreferences.cpp b/src/preferences/dialog/dlgpreferences.cpp index 8d0d9b54f8..bedac9a955 100644 --- a/src/preferences/dialog/dlgpreferences.cpp +++ b/src/preferences/dialog/dlgpreferences.cpp @@ -75,6 +75,9 @@ DlgPreferences::DlgPreferences(MixxxMainWindow * mixxx, SkinLoader* pSkinLoader, : m_pConfig(pSettingsManager->settings()), m_pageSizeHint(QSize(0, 0)), m_preferencesUpdated(ConfigKey("[Preferences]", "updated"), false) { +#ifndef __LILV__ + Q_UNUSED(pLV2Backend); +#endif /* __LILV__ */ setupUi(this); #if QT_VERSION >= 0x040400 //setHeaderHidden is a qt4.4 addition so having it in the .ui file breaks the build on OpenBSD4.4 (FIXME: revisit this when OpenBSD4.5 comes out?) contentsTreeWidget->setHeaderHidden(true); diff --git a/src/soundio/soundmanager.cpp b/src/soundio/soundmanager.cpp index 31fc5d0090..9e9f61313d 100644 --- a/src/soundio/soundmanager.cpp +++ b/src/soundio/soundmanager.cpp @@ -675,7 +675,7 @@ int SoundManager::getConfiguredDeckCount() const { void SoundManager::processUnderflowHappened() { if (m_underflowUpdateCount == 0) { - if (load_atomic(m_underflowHappened)) { + if (m_underflowHappened.load()) { m_pMasterAudioLatencyOverload->set(1.0); m_pMasterAudioLatencyOverloadCount->set( m_pMasterAudioLatencyOverloadCount->get() + 1); diff --git a/src/util/compatibility.h b/src/util/compatibility.h index ec16604f29..c44177a1a4 100644 --- a/src/util/compatibility.h +++ b/src/util/compatibility.h @@ -1,47 +1,6 @@ #ifndef COMPATABILITY_H #define COMPATABILITY_H -#include <QAtomicInt> -#include <QAtomicPointer> -#include <QStringList> -#include <QApplication> - -#include <QLocale> -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include <QApplication> -#else -#include <QGuiApplication> -#include <QInputMethod> -#endif - -inline int load_atomic(const QAtomicInt& value) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return value; -#else - return value.load(); -#endif -} - -template <typename T> -inline T* load_atomic_pointer(const QAtomicPointer<T>& value) { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return value; -#else - return value.load(); -#endif -} - -inline QLocale inputLocale() { -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return QApplication::keyboardInputLocale(); -#else - // Use the default config for local keyboard - QInputMethod* pInputMethod = QGuiApplication::inputMethod(); - return pInputMethod ? pInputMethod->locale() : - QLocale(QLocale::English); -#endif -} - #if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) // this adds const to non-const objects (like std::as_const) diff --git a/src/util/statsmanager.cpp b/src/util/statsmanager.cpp index f766a95a78..53d604eef2 100644 --- a/src/util/statsmanager.cpp +++ b/src/util/statsmanager.cpp @@ -248,7 +248,7 @@ void StatsManager::run() { processIncomingStatReports(); m_statsPipeLock.unlock(); - if (load_atomic(m_emitAllStats) == 1) { + if (m_emitAllStats.load() == 1) { for (auto it = m_stats.constBegin(); it != m_stats.constEnd(); ++it) { emit(statUpdated(it.value())); @@ -256,7 +256,7 @@ void StatsManager::run() { m_emitAllStats = 0; } - if (load_atomic(m_quit) == 1) { + if (m_quit.load() == 1) { qDebug() << "StatsManager thread shutting down."; break; } diff --git a/src/util/task.cpp b/src/util/task.cpp index 3c0364f0ed..af9a8e512b 100644 --- a/src/util/task.cpp +++ b/src/util/task.cpp @@ -7,7 +7,7 @@ TaskWatcher::TaskWatcher(QObject* pParent) : QObject(pParent) { } TaskWatcher::~TaskWatcher() { - if (load_atomic(m_activeTasks) > 0) { + if (m_activeTasks.load() > 0) { qWarning() << "TaskWatcher destroyed before all tasks were done."; } } diff --git a/src/waveform/waveform.h b/src/waveform/waveform.h index 2123e7e869..950e983eeb 100644 --- a/src/waveform/waveform.h +++ b/src/waveform/waveform.h @@ -100,7 +100,7 @@ class Waveform { // Atomically lookup the completion of the waveform. Represents the number // of data elements that have been processed out of dataSize. int getCompletion() const { - return load_atomic(m_completion); + return m_completion.load(); } void setCompletion(int completion) { m_completion = completion; |