diff --git a/src/controllers/midi/midimessage.cpp b/src/controllers/midi/midimessage.cpp index a4f5b6838a29..f6e227c4a237 100644 --- a/src/controllers/midi/midimessage.cpp +++ b/src/controllers/midi/midimessage.cpp @@ -5,7 +5,7 @@ QDebug operator<<(QDebug debug, MidiOpCode midiOpCode) { return debug; } -uint qHash(MidiOpCode key, uint seed) { +qhash_seed_t qHash(MidiOpCode key, qhash_seed_t seed) { return qHash(static_cast(key), seed); } diff --git a/src/controllers/midi/midimessage.h b/src/controllers/midi/midimessage.h index 38685deda47b..e70a10c1ce59 100644 --- a/src/controllers/midi/midimessage.h +++ b/src/controllers/midi/midimessage.h @@ -8,6 +8,7 @@ #include #include "preferences/usersettings.h" +#include "util/compatibility/qhash.h" // The second value of each OpCode will be the channel number the message // corresponds to. So 0xB0 is a CC on the first channel, and 0xB1 is a CC @@ -96,7 +97,7 @@ enum class MidiOpCode : uint8_t { SystemReset = 0xFF, }; QDebug operator<<(QDebug debug, MidiOpCode midiOpCode); -uint qHash(MidiOpCode key, uint seed); +qhash_seed_t qHash(MidiOpCode key, qhash_seed_t seed); enum class MidiOption : uint16_t { None = 0x0000, diff --git a/src/effects/defs.h b/src/effects/defs.h index 6393cf4b3293..9ea6639cdca5 100644 --- a/src/effects/defs.h +++ b/src/effects/defs.h @@ -1,8 +1,10 @@ #pragma once -#include "util/memory.h" -#include "engine/channelhandle.h" -#include #include +#include + +#include "engine/channelhandle.h" +#include "util/compatibility/qhash.h" +#include "util/memory.h" enum class EffectEnableState { Disabled, @@ -22,9 +24,9 @@ enum class SignalProcessingStage { Postfader }; -inline uint qHash( +inline qhash_seed_t qHash( SignalProcessingStage stage, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(static_cast(stage), seed); }; diff --git a/src/engine/channelhandle.h b/src/engine/channelhandle.h index a9c685212733..240e5254f50c 100644 --- a/src/engine/channelhandle.h +++ b/src/engine/channelhandle.h @@ -7,6 +7,7 @@ #include #include "util/assert.h" +#include "util/compatibility/qhash.h" // ChannelHandle defines a unique identifier for channels of audio in the engine // (e.g. headphone output, master output, deck 1, microphone 3). Previously we @@ -75,9 +76,9 @@ inline QDebug operator<<(QDebug stream, const ChannelHandle& h) { return stream; } -inline uint qHash( +inline qhash_seed_t qHash( const ChannelHandle& handle, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(handle.handle(), seed); } @@ -115,9 +116,9 @@ inline QDebug operator<<(QDebug stream, const ChannelHandleAndGroup& g) { return stream; } -inline uint qHash( +inline qhash_seed_t qHash( const ChannelHandleAndGroup& handleGroup, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(handleGroup.handle(), seed); } diff --git a/src/preferences/configobject.h b/src/preferences/configobject.h index ef9b5ba8a6d4..fd80d9cc1795 100644 --- a/src/preferences/configobject.h +++ b/src/preferences/configobject.h @@ -1,14 +1,15 @@ #pragma once -#include -#include #include -#include #include +#include +#include #include #include +#include #include "util/assert.h" +#include "util/compatibility/qhash.h" #include "util/debug.h" // Class for the key for a specific configuration element. A key consists of a @@ -59,9 +60,9 @@ inline QDebug operator<<(QDebug stream, const ConfigKey& configKey) { } // QHash hash function for ConfigKey objects. -inline uint qHash( +inline qhash_seed_t qHash( const ConfigKey& key, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(key.group, seed) ^ qHash(key.item, seed); } @@ -95,9 +96,9 @@ inline bool operator!=(const ConfigValue& lhs, const ConfigValue& rhs) { return !(lhs == rhs); } -inline uint qHash( +inline qhash_seed_t qHash( const ConfigValue& key, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(key.value.toUpper(), seed); } diff --git a/src/soundio/soundmanagerutil.h b/src/soundio/soundmanagerutil.h index dddb140795a5..c5e1a555b4f5 100644 --- a/src/soundio/soundmanagerutil.h +++ b/src/soundio/soundmanagerutil.h @@ -6,6 +6,7 @@ #include #include +#include "util/compatibility/qhash.h" #include "util/fifo.h" #include "util/types.h" @@ -21,9 +22,9 @@ class ChannelGroup { return (m_channels << 8) | m_channelBase; } - friend uint qHash( + friend qhash_seed_t qHash( const ChannelGroup& group, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(group.hashValue(), seed); } @@ -96,9 +97,9 @@ class AudioPath { return (m_type << 8) | m_index; } - friend uint qHash( + friend qhash_seed_t qHash( const AudioPath& path, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(path.hashValue(), seed); } @@ -273,9 +274,9 @@ inline bool operator<(const SoundDeviceId& lhs, const SoundDeviceId& rhs) { Q_DECLARE_METATYPE(SoundDeviceId); -inline uint qHash( +inline qhash_seed_t qHash( const SoundDeviceId& id, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(id.name, seed) ^ qHash(id.alsaHwDevice, seed) ^ qHash(id.portAudioIndex, seed); diff --git a/src/track/trackref.h b/src/track/trackref.h index 4288a0c669be..a2635af6b0c7 100644 --- a/src/track/trackref.h +++ b/src/track/trackref.h @@ -1,6 +1,7 @@ #pragma once #include "track/trackid.h" +#include "util/compatibility/qhash.h" #include "util/fileinfo.h" // A track in the library is identified by a location and an id. @@ -128,9 +129,9 @@ std::ostream& operator<<(std::ostream& os, const TrackRef& trackRef); QDebug operator<<(QDebug debug, const TrackRef& trackRef); -inline uint qHash( +inline qhash_seed_t qHash( const TrackRef& key, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash( key.getLocation(), seed) ^ qHash(key.getId(), seed); diff --git a/src/util/compatibility/qhash.h b/src/util/compatibility/qhash.h new file mode 100644 index 000000000000..367c84a64545 --- /dev/null +++ b/src/util/compatibility/qhash.h @@ -0,0 +1,7 @@ +#pragma once + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +typedef size_t qhash_seed_t; +#else +typedef uint qhash_seed_t; +#endif diff --git a/src/util/db/dbid.h b/src/util/db/dbid.h index a5d68f4a8f7b..15749fe23d74 100644 --- a/src/util/db/dbid.h +++ b/src/util/db/dbid.h @@ -1,16 +1,14 @@ #pragma once - -#include -#include -#include - #include #include #include +#include +#include +#include #include "util/assert.h" - +#include "util/compatibility/qhash.h" // Base class for ID values of objects that are stored in the database. // @@ -102,9 +100,9 @@ class DbId { return debug << dbId.m_value; } - friend uint qHash( + friend qhash_seed_t qHash( const DbId& dbId, - uint seed = 0) { + qhash_seed_t seed = 0) { return qHash(dbId.m_value, seed); }