Commit 9940774f authored by Volker Krause's avatar Volker Krause
Browse files

Deprecated QMatrix based API in favor of QTransform

QMatrix is gone in Qt6.

Based on a draft by Friedrich, but with using QTransform -> QMatrix
conversion instead of duplicating the implementation.
parent 22ad3c64
......@@ -74,10 +74,12 @@ include(ECMGenerateHeaders)
include(ECMSetupVersion)
include(ECMMarkNonGuiExecutable)
include(ECMQtDeclareLoggingCategory)
include(GenerateExportHeader)
include(ECMGenerateExportHeader)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
############## Find Packages ###################
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE
......
......@@ -53,8 +53,16 @@ ecm_generate_headers(kexiv2_CamelCase_HEADERS
REQUIRED_HEADERS kexiv2_HEADERS
)
generate_export_header(KExiv2
BASE_NAME libkexiv2
ecm_generate_export_header(KExiv2
#BASE_NAME libkexiv2
#VERSION ${KF_VERSION}
BASE_NAME kexiv2
EXPORT_FILE_NAME libkexiv2_export.h
EXPORT_MACRO_NAME LIBKEXIV2_EXPORT
VERSION ${libkexiv2_VERSION}
DEPRECATED_BASE_VERSION 0
DEPRECATION_VERSIONS 5.1
EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
)
target_include_directories(KExiv2
......
......@@ -910,7 +910,7 @@ QImage KExiv2::getExifThumbnail(bool fixOrientation) const
bool KExiv2::rotateExifQImage(QImage& image, ImageOrientation orientation) const
{
QMatrix matrix = RotationMatrix::toMatrix(orientation);
QTransform matrix = RotationMatrix::toTransform(orientation);
if ((orientation != ORIENTATION_NORMAL) && (orientation != ORIENTATION_UNSPECIFIED))
{
......
......@@ -267,14 +267,14 @@ KExiv2::ImageOrientation RotationMatrix::exifOrientation() const
return KExiv2::ORIENTATION_UNSPECIFIED;
}
QMatrix RotationMatrix::toMatrix() const
QTransform RotationMatrix::toTransform() const
{
return toMatrix(exifOrientation());
return toTransform(exifOrientation());
}
QMatrix RotationMatrix::toMatrix(KExiv2::ImageOrientation orientation)
QTransform RotationMatrix::toTransform(KExiv2::ImageOrientation orientation)
{
QMatrix matrix;
QTransform matrix;
switch (orientation)
{
......@@ -316,4 +316,18 @@ QMatrix RotationMatrix::toMatrix(KExiv2::ImageOrientation orientation)
return matrix;
}
#if KEXIV2_BUILD_DEPRECATED_SINCE(5, 1)
QMatrix RotationMatrix::toMatrix() const
{
return toMatrix(exifOrientation());
}
#endif
#if KEXIV2_BUILD_DEPRECATED_SINCE(5, 1)
QMatrix RotationMatrix::toMatrix(KExiv2::ImageOrientation orientation)
{
return toTransform(orientation).toAffine();
}
#endif
} // namespace KExiv2Iface
......@@ -9,15 +9,18 @@
#ifndef LIBKEXIV2_ROTATIONMATRIX_H
#define LIBKEXIV2_ROTATIONMATRIX_H
// Qt includes
#include <QMatrix>
// Local includes
#include "kexiv2.h"
#include "libkexiv2_export.h"
// Qt includes
#if KEXIV2_ENABLE_DEPRECATED_SINCE(5, 1)
#include <QMatrix>
#endif
#include <QTransform>
namespace KExiv2Iface
{
......@@ -84,11 +87,30 @@ public:
*/
KExiv2::ImageOrientation exifOrientation() const;
/**
* Returns a QTransform representing this matrix
* @since 5.1
*/
QTransform toTransform() const;
/**
* Returns a QTransform for the given Exif orientation
* @since 5.1
*/
static QTransform toTransform(KExiv2::ImageOrientation orientation);
#if KEXIV2_ENABLE_DEPRECATED_SINCE(5, 1)
/// Returns a QMatrix representing this matrix
/// @deprecated Since 5.1, use toTransform().
KEXIV2_DEPRECATED_VERSION(5, 1, "Use toTransform()")
QMatrix toMatrix() const;
#endif
#if KEXIV2_ENABLE_DEPRECATED_SINCE(5, 1)
/// Returns a QMatrix for the given Exif orientation
KEXIV2_DEPRECATED_VERSION(5, 1, "Use toTransform(KExiv2::ImageOrientation)")
static QMatrix toMatrix(KExiv2::ImageOrientation orientation);
#endif
RotationMatrix(int m11, int m12, int m21, int m22);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment