Make JavaScript processing code compatible with Qt 5

This commit is contained in:
Martchus 2023-07-30 16:35:34 +02:00
parent 11d3cefbcf
commit 8c2ab29927
2 changed files with 26 additions and 0 deletions

View File

@ -26,6 +26,16 @@
#include <iostream>
#include <limits>
#include <type_traits>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QT_BEGIN_NAMESPACE
uint qHash(const TagParser::KnownField key, uint seed) noexcept
{
return ::qHash(static_cast<std::underlying_type_t<TagParser::KnownField>>(key), seed);
}
QT_END_NAMESPACE
#endif
namespace Cli {
@ -95,9 +105,16 @@ QString UtilityObject::fixUmlauts(const QString &str) const
TagValueObject::TagValueObject(const TagParser::TagValue &value, QJSEngine *engine, QObject *parent)
: QObject(parent)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_type(QString::fromUtf8(TagParser::tagDataTypeString(value.type())))
#endif
, m_initial(true)
{
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const auto type = TagParser::tagDataTypeString(value.type());
m_type = QString::fromUtf8(type.data(), type.size());
#endif
switch (value.type()) {
case TagParser::TagDataType::Undefined:
break;

View File

@ -1,6 +1,15 @@
#ifndef CLI_MEDIA_FILE_INFO_OBJECT_H
#define CLI_MEDIA_FILE_INFO_OBJECT_H
#include <QtGlobal>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QT_BEGIN_NAMESPACE
namespace TagParser {
enum class KnownField : unsigned int;
}
uint qHash(const TagParser::KnownField key, uint seed = 0) noexcept;
#endif
#include <QJSValue>
#include <QObject>