Switch all plugins to QLoggingCategory

This commit is contained in:
Mirco Miranda
2025-09-19 10:00:26 +02:00
parent a4e18734bd
commit fda751c641
17 changed files with 372 additions and 286 deletions
+14 -8
View File
@@ -15,7 +15,7 @@
#include <QColorSpace>
#include <QDataStream>
#include <QDebug>
#include <QLoggingCategory>
#include <cmath>
@@ -24,6 +24,12 @@
// #define DDS_DISABLE_STRIDE_ALIGNMENT
#endif
#ifdef QT_DEBUG
Q_LOGGING_CATEGORY(LOG_DDSPLUGIN, "kf.imageformats.plugins.dds", QtDebugMsg)
#else
Q_LOGGING_CATEGORY(LOG_DDSPLUGIN, "kf.imageformats.plugins.dds", QtWarningMsg)
#endif
enum Format {
FormatUnknown = 0,
@@ -2389,7 +2395,7 @@ bool QDDSHandler::write(const QImage &outImage)
return writeA32B32G32R32F(outImage, s);
}
qWarning() << "Format" << formatName(format) << "is not supported";
qCWarning(LOG_DDSPLUGIN) << "Format" << formatName(format) << "is not supported";
return false;
}
@@ -2462,7 +2468,7 @@ bool QDDSHandler::jumpToImage(int imageNumber)
bool QDDSHandler::canRead(QIODevice *device)
{
if (!device) {
qWarning() << "DDSHandler::canRead() called with no device";
qCWarning(LOG_DDSPLUGIN) << "DDSHandler::canRead() called with no device";
return false;
}
@@ -2487,7 +2493,7 @@ bool QDDSHandler::ensureScanned() const
that->m_format = FormatUnknown;
if (device()->isSequential()) {
qWarning() << "Sequential devices are not supported";
qCWarning(LOG_DDSPLUGIN) << "Sequential devices are not supported";
return false;
}
@@ -2520,25 +2526,25 @@ bool QDDSHandler::verifyHeader(const DDSHeader &dds) const
quint32 requiredFlags = DDSHeader::FlagCaps | DDSHeader::FlagHeight
| DDSHeader::FlagWidth | DDSHeader::FlagPixelFormat;
if ((flags & requiredFlags) != requiredFlags) {
qWarning() << "Wrong dds.flags - not all required flags present. "
qCWarning(LOG_DDSPLUGIN) << "Wrong dds.flags - not all required flags present. "
"Actual flags :" << flags;
return false;
}
if (dds.size != ddsSize) {
qWarning() << "Wrong dds.size: actual =" << dds.size
qCWarning(LOG_DDSPLUGIN) << "Wrong dds.size: actual =" << dds.size
<< "expected =" << ddsSize;
return false;
}
if (dds.pixelFormat.size != pixelFormatSize) {
qWarning() << "Wrong dds.pixelFormat.size: actual =" << dds.pixelFormat.size
qCWarning(LOG_DDSPLUGIN) << "Wrong dds.pixelFormat.size: actual =" << dds.pixelFormat.size
<< "expected =" << pixelFormatSize;
return false;
}
if (dds.width > INT_MAX || dds.height > INT_MAX) {
qWarning() << "Can't read image with w/h bigger than INT_MAX";
qCWarning(LOG_DDSPLUGIN) << "Can't read image with w/h bigger than INT_MAX";
return false;
}