diff --git a/CMakeLists.txt b/CMakeLists.txt index d18c86a..b570379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ include(CheckIncludeFiles) include(FindPkgConfig) set(REQUIRED_QT_VERSION 6.4.0) -find_package(Qt${QT_MAJOR_VERSION}Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) +find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(KF6Archive) set_package_properties(KF6Archive PROPERTIES @@ -32,12 +32,12 @@ set_package_properties(KF6Archive PROPERTIES # this available in PATH set(BUILD_EPS_PLUGIN FALSE) if (UNIX) - find_package(Qt${QT_MAJOR_VERSION}PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) - set_package_properties(Qt${QT_MAJOR_VERSION}PrintSupport PROPERTIES + find_package(Qt6PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) + set_package_properties(Qt6PrintSupport PROPERTIES PURPOSE "Required for the QImage plugin for EPS images" TYPE OPTIONAL ) - if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport) + if (TARGET Qt6::PrintSupport) set(BUILD_EPS_PLUGIN TRUE) endif() endif() diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index c807e55..db9fdb7 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,5 +1,3 @@ -#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE) - include(ECMMarkAsTest) include(CMakeParseArguments) @@ -15,7 +13,7 @@ macro(kimageformats_read_tests) if (NOT TARGET readtest) add_executable(readtest readtest.cpp) - target_link_libraries(readtest Qt${QT_MAJOR_VERSION}::Gui) + target_link_libraries(readtest Qt6::Gui) target_compile_definitions(readtest PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read") ecm_mark_as_test(readtest) @@ -38,7 +36,7 @@ macro(kimageformats_write_tests) if (NOT TARGET writetest) add_executable(writetest writetest.cpp) - target_link_libraries(writetest Qt${QT_MAJOR_VERSION}::Gui) + target_link_libraries(writetest Qt6::Gui) target_compile_definitions(writetest PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write") ecm_mark_as_test(writetest) @@ -147,19 +145,19 @@ if (LibRaw_FOUND) ) endif() -find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET) +find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET) -if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test) - message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, some autotests will not be built.") +if(NOT TARGET Qt6::Test) + message(STATUS "Qt6Test not found, some autotests will not be built.") return() endif() add_executable(pictest pictest.cpp) -target_link_libraries(pictest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) +target_link_libraries(pictest Qt6::Gui Qt6::Test) ecm_mark_as_test(pictest) add_test(NAME kimageformats-pic COMMAND pictest) add_executable(anitest anitest.cpp) -target_link_libraries(anitest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) +target_link_libraries(anitest Qt6::Gui Qt6::Test) ecm_mark_as_test(anitest) add_test(NAME kimageformats-ani COMMAND anitest) diff --git a/src/imageformats/CMakeLists.txt b/src/imageformats/CMakeLists.txt index a50f3ad..dc7087e 100644 --- a/src/imageformats/CMakeLists.txt +++ b/src/imageformats/CMakeLists.txt @@ -13,7 +13,7 @@ function(kimageformats_add_plugin plugin) add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES}) set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats") - target_link_libraries(${plugin} Qt${QT_MAJOR_VERSION}::Gui) + target_link_libraries(${plugin} Qt6::Gui) install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats) endfunction() @@ -21,47 +21,24 @@ endfunction() kimageformats_add_plugin(kimg_ani SOURCES ani.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES ani.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() - ################################## if (TARGET avif) kimageformats_add_plugin(kimg_avif SOURCES "avif.cpp") target_link_libraries(kimg_avif "avif") - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES avif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() -endif() - -################################## - -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) endif() ################################## if (BUILD_EPS_PLUGIN) - if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport) + if (TARGET Qt6::PrintSupport) kimageformats_add_plugin(kimg_eps SOURCES eps.cpp) - target_link_libraries(kimg_eps Qt${QT_MAJOR_VERSION}::PrintSupport) - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() + target_link_libraries(kimg_eps Qt6::PrintSupport) endif() endif() ################################## -if (QT_MAJOR_VERSION STREQUAL "5") - # need this for Qt's version of the plugin - install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() - -################################## - if(OpenEXR_FOUND) kimageformats_add_plugin(kimg_exr SOURCES exr.cpp) if(TARGET OpenEXR::OpenEXR) @@ -75,28 +52,17 @@ if(OpenEXR_FOUND) target_link_libraries(kimg_exr OpenEXR::IlmImf) endif() kde_target_enable_exceptions(kimg_exr PRIVATE) - - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() endif() ################################## kimageformats_add_plugin(kimg_hdr SOURCES hdr.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES hdr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## if (LibHeif_FOUND) kimageformats_add_plugin(kimg_heif SOURCES heif.cpp) target_link_libraries(kimg_heif PkgConfig::LibHeif) - - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES heif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() endif() ################################## @@ -107,60 +73,35 @@ if (LibJXL_FOUND AND LibJXLThreads_FOUND) if (LibJXL_VERSION VERSION_GREATER_EQUAL "0.7.0") target_compile_definitions(kimg_jxl PRIVATE KIMG_JXL_API_VERSION=70) endif() - - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES jxl.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() endif() ################################## kimageformats_add_plugin(kimg_pcx SOURCES pcx.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES pcx.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_pic SOURCES pic.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES pic.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_psd SOURCES psd.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES psd.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_ras SOURCES ras.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES ras.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_rgb SOURCES rgb.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES rgb.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_tga SOURCES tga.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES tga.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## kimageformats_add_plugin(kimg_xcf SOURCES xcf.cpp) -if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES xcf.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) -endif() ################################## @@ -168,9 +109,6 @@ if (LibRaw_FOUND) kimageformats_add_plugin(kimg_raw SOURCES raw.cpp) kde_enable_exceptions() target_link_libraries(kimg_raw LibRaw::LibRaw) - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES raw.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() endif() ################################## @@ -179,14 +117,8 @@ if (KF6Archive_FOUND) kimageformats_add_plugin(kimg_kra SOURCES kra.cpp) target_link_libraries(kimg_kra KF6::Archive) - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() kimageformats_add_plugin(kimg_ora SOURCES ora.cpp) target_link_libraries(kimg_ora KF6::Archive) - if (QT_MAJOR_VERSION STREQUAL "5") - install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/) - endif() endif() diff --git a/src/imageformats/ani.desktop b/src/imageformats/ani.desktop deleted file mode 100644 index 122b71f..0000000 --- a/src/imageformats/ani.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=ani -X-KDE-MimeType=application/x-navi-animation -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/avif.desktop b/src/imageformats/avif.desktop deleted file mode 100644 index fcda177..0000000 --- a/src/imageformats/avif.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=avif -X-KDE-MimeType=image/avif -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/dds-qt.desktop b/src/imageformats/dds-qt.desktop deleted file mode 100644 index 13b6ca3..0000000 --- a/src/imageformats/dds-qt.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=dds -X-KDE-MimeType=image/x-dds -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/eps.desktop b/src/imageformats/eps.desktop deleted file mode 100644 index 4a4160f..0000000 --- a/src/imageformats/eps.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=eps,epsi,epsf -X-KDE-MimeType=image/x-eps -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/exr.desktop b/src/imageformats/exr.desktop deleted file mode 100644 index 6725314..0000000 --- a/src/imageformats/exr.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=exr -X-KDE-MimeType=image/x-exr -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/hdr.desktop b/src/imageformats/hdr.desktop deleted file mode 100644 index d355d52..0000000 --- a/src/imageformats/hdr.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=hdr -X-KDE-MimeType=image/x-hdr -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/heif.desktop b/src/imageformats/heif.desktop deleted file mode 100644 index 049b5fd..0000000 --- a/src/imageformats/heif.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=heif -X-KDE-MimeType=image/heif -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/jp2.desktop b/src/imageformats/jp2.desktop deleted file mode 100644 index 3d673c6..0000000 --- a/src/imageformats/jp2.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=jp2 -X-KDE-MimeType=image/jp2 -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/kra.desktop b/src/imageformats/kra.desktop deleted file mode 100644 index a258504..0000000 --- a/src/imageformats/kra.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=kra -X-KDE-MimeType=application/x-krita -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/ora.desktop b/src/imageformats/ora.desktop deleted file mode 100644 index 7bb7865..0000000 --- a/src/imageformats/ora.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=ora -X-KDE-MimeType=image/openraster -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/pcx.desktop b/src/imageformats/pcx.desktop deleted file mode 100644 index 5faad53..0000000 --- a/src/imageformats/pcx.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=pcx -X-KDE-MimeType=image/x-pcx -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/pic.desktop b/src/imageformats/pic.desktop deleted file mode 100644 index 3424677..0000000 --- a/src/imageformats/pic.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=pic -X-KDE-MimeType=image/x-pic -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/psd.desktop b/src/imageformats/psd.desktop deleted file mode 100644 index a21a634..0000000 --- a/src/imageformats/psd.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=psd,psb,pdd,psdt -X-KDE-MimeType=image/vnd.adobe.photoshop -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/ras.desktop b/src/imageformats/ras.desktop deleted file mode 100644 index 49b617a..0000000 --- a/src/imageformats/ras.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=ras -X-KDE-MimeType=image/x-sun-raster -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/raw.desktop b/src/imageformats/raw.desktop deleted file mode 100644 index 55385c2..0000000 --- a/src/imageformats/raw.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=3fr,arw,arq,bay,bmq,crw,cr2,cr3,cap,cine,cs1,dcs,dc2,dcr,dng,drf,dxo,eip,erf,fff,hdr,iiq,k25,kdc,kc2,mdc,mef,mfw,mos,mrw,nef,nrw,obm,orf,ori,pef,ptx,pxn,qtk,r3d,raf,raw,rdc,rwl,rw2,rwz,sr2,srf,srw,sti,x3f -X-KDE-MimeType=image/x-hasselblad-3fr,image/x-sony-arw,image/x-arq,image/x-bay,image/x-bmq,image/x-canon-crw,image/x-canon-cr2,image/x-canon-cr3,image/x-cap,image/x-cine,image/x-cs1,image/x-kodak-dcs,image/x-dc2,image/x-kodak-dcr,image/x-adobe-dng,image/x-drf,image/x-dxo,image/x-epson-eip,image/x-epson-erf,image/x-fff,image/x-hdr,image/x-iiq,image/x-kodak-k25,image/x-kodak-kdc,image/x-kodak-kc2,image/x-minolta-mdc,image/x-mamiya-mef,image/x-mfw,image/x-aptus-mos,image/x-minolta-mrw,image/x-nikon-nef,image/x-nikon-nrw,image/x-obm,image/x-olympus-orf,image/x-ori,image/x-pentax-pef,image/x-ptx,image/x-pxn,image/x-qtk,image/x-r3d,image/x-fuji-raf,image/x-raw,image/x-rdc,image/x-rwl,image/x-panasonic-rw2,image/x-rwz,image/x-sony-sr2,image/x-sony-srf,image/x-samsung-srw,image/x-sti,image/x-sigma-x3f -X-KDE-Read=true -X-KDE-Write=false diff --git a/src/imageformats/rgb.desktop b/src/imageformats/rgb.desktop deleted file mode 100644 index f1cf796..0000000 --- a/src/imageformats/rgb.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=rgb,rgba,bw,sgi -X-KDE-MimeType=image/x-rgb -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/tga.desktop b/src/imageformats/tga.desktop deleted file mode 100644 index 4554c81..0000000 --- a/src/imageformats/tga.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=tga -X-KDE-MimeType=image/x-tga -X-KDE-Read=true -X-KDE-Write=true diff --git a/src/imageformats/util_p.h b/src/imageformats/util_p.h index 7a0d5de..2429ffe 100644 --- a/src/imageformats/util_p.h +++ b/src/imageformats/util_p.h @@ -11,10 +11,7 @@ #include #include - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include -#endif // QVector uses some extra space for stuff, hence the 32 here suggested by Thiago Macieira static constexpr int kMaxQVectorSize = std::numeric_limits::max() - 32; @@ -24,13 +21,9 @@ static constexpr int kMaxQVectorSize = std::numeric_limits::max() - 32; inline QImage imageAlloc(const QSize &size, const QImage::Format &format) { QImage img; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - img = QImage(size, format); -#else if (!QImageIOHandler::allocateImage(size, format, &img)) { img = QImage(); // paranoia } -#endif return img; } diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index fa04267..223bbb7 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -9,18 +9,16 @@ #include "util_p.h" #include "xcf_p.h" +#include #include #include #include +#include #include #include #include #include #include -#include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -#include -#endif #include #include @@ -1110,13 +1108,11 @@ bool XCFImageFormat::composeTiles(XCFImage &xcf_image) // tiles of 64x64 pixels. The required memory to build the image is at least doubled because tiles are loaded // and then the final image is created by copying the tiles inside it. // NOTE: on Windows to open a 10GiB image the plugin uses 28GiB of RAM -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) qint64 channels = 1 + (layer.type == RGB_GIMAGE ? 2 : 0) + (layer.type == RGBA_GIMAGE ? 3 : 0); if (qint64(layer.width) * qint64(layer.height) * channels * 2ll / 1024ll / 1024ll > QImageReader::allocationLimit()) { qCDebug(XCFPLUGIN) << "Rejecting image as it exceeds the current allocation limit of" << QImageReader::allocationLimit() << "megabytes"; return false; } -#endif layer.image_tiles.resize(layer.nrows); diff --git a/src/imageformats/xcf.desktop b/src/imageformats/xcf.desktop deleted file mode 100644 index 6614c7a..0000000 --- a/src/imageformats/xcf.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=QImageIOPlugins -X-KDE-ImageFormat=xcf -X-KDE-MimeType=image/x-xcf -X-KDE-Read=true -X-KDE-Write=false diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 19fe01f..87d033f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,7 +5,7 @@ include(ECMMarkAsTest) macro(kimageformats_executable_tests) foreach(_testname ${ARGN}) add_executable(${_testname} ${_testname}.cpp) - target_link_libraries(${_testname} Qt${QT_MAJOR_VERSION}::Gui) + target_link_libraries(${_testname} Qt6::Gui) ecm_mark_as_test(${_testname}) endforeach(_testname) endmacro()