Compare commits

...

24 Commits

Author SHA1 Message Date
4c0c6c8d60 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.51.0 release. 2018-10-07 10:07:12 +00:00
f485719012 kimg_rgb: optimize away QRegExp and QString::fromLocal8Bit.
Summary:
The code is even simpler this way.

Found by using heaptrack.

Test Plan: the unittest for rgb still passes.

Reviewers: cfeck

Reviewed By: cfeck

Subscribers: jtamate, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15890
2018-10-03 00:51:29 +02:00
1db1b94657 [EPS] qWarning -> qCWarning 2018-09-17 11:56:58 +02:00
98c65a438d [EPS] Fix crash at app shutdown (being tried to persist clipboard image)
Summary:
Deny any capabilities when there is no QApp instance.

BUG: 397040

Test Plan:
Untested, as I do not experience the bug on my system and had no time to
invest into trying to.

Reviewers: zccrs, dfaure, pino

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15405
2018-09-17 11:54:18 +02:00
167967a145 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.50.0 release. 2018-08-31 22:22:12 +00:00
17239a7ea6 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.49.0 release. 2018-08-04 08:43:39 +00:00
118d262bec GIT_SILENT Upgrade ECM and KF5 version requirements for 5.48.0 release. 2018-07-07 21:52:47 +00:00
67a84f459d Use override 2018-06-12 07:01:11 +02:00
de2b942b33 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.47.0 release. 2018-06-02 16:28:21 +00:00
813a7bdddb Remove duplicated mime types from json files
Qt expects a bijection between keys and mime types.
2018-05-25 14:32:11 +03:00
a4d1f4db1d Use override 2018-05-23 08:06:50 +02:00
29d090f078 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.46.0 release. 2018-05-05 12:39:09 +00:00
19f33239e7 [XCF/GIMP loader] Raise maximimum allowed image size to 32767x32767 on 64 bit platforms
The GIMP image loader had a limit to 16K x 16K pixels, because this would
already exhaust the 2 GByte address space limit of 32 bit systems.

Remove this limit on 64 bit systems to allow the full 32K x 32K size.

BUG: 391970

Differential Revision: https://phabricator.kde.org/D12557
2018-05-02 02:10:26 +02:00
4668fbbcdc GIT_SILENT Upgrade ECM and KF5 version requirements for 5.45.0 release. 2018-04-07 07:47:44 +00:00
698ba297d3 We depend against 5.8.0 now 2018-03-27 08:01:04 +02:00
3a9bafdbbe GIT_SILENT Upgrade Qt5 version requirement to 5.8.0. 2018-03-24 13:34:11 +00:00
e5b226e804 Remove not necessary QtCore and co 2018-03-11 13:49:26 +01:00
871d0f976f GIT_SILENT Upgrade ECM and KF5 version requirements for 5.44.0 release. 2018-03-03 09:52:42 +00:00
7aa5333a3f kcoreaddons_add_plugin: remove effectless OBJECT_DEPENDS on json file
The JSON file argument is passed to Q_PLUGIN_METADATA, which is a no-code
macro at the C++ level and only used to note information used by moc
for the generated moc file.

So when the content of the JSON file has changed, this will not change
anything in the preprocessed source file itself. It only has an effect on
the content of the moc file generated based on it, which is either included
and thus already triggers a dependecy or generated by automoc and compiled
separately into the target with the needed dependencies.

It is automoc which needs to properly trigger a recreation of the moc
file when checking the sources (and at least in 3.9 & 10 does),
and this is nothing that can be influenced by dependency rules.
2018-02-23 19:09:18 +01:00
aeabd92eea GIT_SILENT Upgrade ECM and KF5 version requirements for 5.43.0 release. 2018-02-05 08:11:10 +00:00
64e719f329 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.42.0 release. 2018-01-05 23:41:49 +00:00
eef855b146 Remove obsolete reviewboardrc file 2018-01-05 13:24:38 +01:00
04e2ee01cb Set LIBRARY_OUTPUT_DIRECTORY so the autotests can run without the plugins installed
Do this properly by defining a function (inspired by kcoreaddons_add_plugin)
2018-01-05 11:19:18 +01:00
7f2c44add4 Use brace-initializer instead of nullptr in returning 0-QFlags
Differential Revision: https://phabricator.kde.org/D9182
2017-12-05 19:34:30 +01:00
28 changed files with 147 additions and 163 deletions

View File

@ -1,5 +0,0 @@
REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
REPOSITORY = 'git://anongit.kde.org/kimageformats'
BRANCH = 'master'
TARGET_GROUPS = 'kdeframeworks'
TARGET_PEOPLE = 'alexmerry'

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0)
project(KImageFormats)
include(FeatureSummary)
find_package(ECM 5.41.0 NO_MODULE)
find_package(ECM 5.51.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
@ -17,7 +17,7 @@ include(KDECMakeSettings)
include(CheckIncludeFiles)
set(REQUIRED_QT_VERSION 5.7.0)
set(REQUIRED_QT_VERSION 5.8.0)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(KF5Archive)

View File

@ -2,107 +2,100 @@
##################################
function(kimageformats_add_plugin plugin)
set(options)
set(oneValueArgs JSON)
set(multiValueArgs SOURCES)
cmake_parse_arguments(KIF_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT KIF_ADD_PLUGIN_SOURCES)
message(FATAL_ERROR "kimageformats_add_plugin called without SOURCES parameter")
endif()
get_filename_component(json "${KIF_ADD_PLUGIN_JSON}" REALPATH)
if(NOT KIF_ADD_PLUGIN_JSON OR NOT EXISTS ${json})
message(FATAL_ERROR "JSON file doesn't exist: ${json}")
endif()
add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES})
set_property(TARGET ${plugin} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${json})
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats")
target_link_libraries(${plugin} Qt5::Gui)
install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats)
endfunction()
##################################
install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
if (BUILD_EPS_PLUGIN)
if (Qt5PrintSupport_FOUND)
add_library(kimg_eps MODULE eps.cpp)
target_link_libraries(kimg_eps Qt5::Gui Qt5::PrintSupport)
install(TARGETS kimg_eps DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_eps JSON "eps.json" SOURCES eps.cpp)
target_link_libraries(kimg_eps Qt5::PrintSupport)
install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
endif()
endif()
##################################
# need this for Qt's version of the plugin
install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
if(OpenEXR_FOUND)
add_library(kimg_exr MODULE exr.cpp)
target_link_libraries(kimg_exr Qt5::Gui OpenEXR::IlmImf)
kimageformats_add_plugin(kimg_exr JSON "exr.json" SOURCES exr.cpp)
target_link_libraries(kimg_exr OpenEXR::IlmImf)
kde_target_enable_exceptions(kimg_exr PRIVATE)
install(TARGETS kimg_exr DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
endif()
##################################
add_library(kimg_pcx MODULE pcx.cpp)
target_link_libraries(kimg_pcx Qt5::Gui)
install(TARGETS kimg_pcx DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_pcx JSON "pcx.json" SOURCES pcx.cpp)
install(FILES pcx.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_pic MODULE pic.cpp)
target_link_libraries(kimg_pic Qt5::Gui)
install(TARGETS kimg_pic DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_pic JSON "pic.json" SOURCES pic.cpp)
install(FILES pic.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_psd MODULE psd.cpp)
target_link_libraries(kimg_psd Qt5::Gui)
install(TARGETS kimg_psd DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_psd JSON "psd.json" SOURCES psd.cpp)
install(FILES psd.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_ras MODULE ras.cpp)
target_link_libraries(kimg_ras Qt5::Gui)
install(TARGETS kimg_ras DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_ras JSON "ras.json" SOURCES ras.cpp)
install(FILES ras.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_rgb MODULE rgb.cpp)
target_link_libraries(kimg_rgb Qt5::Gui)
install(TARGETS kimg_rgb DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_rgb JSON "rgb.json" SOURCES rgb.cpp)
install(FILES rgb.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_tga MODULE tga.cpp)
target_link_libraries(kimg_tga Qt5::Gui)
install(TARGETS kimg_tga DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_tga JSON "tga.json" SOURCES tga.cpp)
install(FILES tga.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
add_library(kimg_xcf MODULE xcf.cpp)
target_link_libraries(kimg_xcf Qt5::Gui)
install(TARGETS kimg_xcf DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_xcf JSON "xcf.json" SOURCES xcf.cpp)
install(FILES xcf.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
##################################
if (KF5Archive_FOUND)
add_library(kimg_kra MODULE kra.cpp)
target_link_libraries(kimg_kra Qt5::Gui KF5::Archive)
install(TARGETS kimg_kra DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_kra JSON "kra.json" SOURCES kra.cpp)
target_link_libraries(kimg_kra KF5::Archive)
install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
add_library(kimg_ora MODULE ora.cpp)
target_link_libraries(kimg_ora Qt5::Gui KF5::Archive)
install(TARGETS kimg_ora DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
kimageformats_add_plugin(kimg_ora JSON "ora.json" SOURCES ora.cpp)
target_link_libraries(kimg_ora KF5::Archive)
install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
endif()

View File

@ -14,6 +14,7 @@
#include <QPrinter>
#include <QProcess>
#include <QTemporaryFile>
#include <QCoreApplication>
// logging category for this framework, default: log stuff >= warning
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
@ -156,7 +157,7 @@ bool EPSHandler::read(QImage *image)
QTemporaryFile tmpFile;
if (!tmpFile.open()) {
qWarning() << "Could not create the temporary file" << tmpFile.fileName();
qCWarning(EPSPLUGIN) << "Could not create the temporary file" << tmpFile.fileName();
return false;
}
qCDebug(EPSPLUGIN) << "temporary file:" << tmpFile.fileName();
@ -198,7 +199,7 @@ bool EPSHandler::read(QImage *image)
converter.setProcessChannelMode(QProcess::ForwardedErrorChannel);
converter.start(QStringLiteral("gs"), gsArgs);
if (!converter.waitForStarted(3000)) {
qWarning() << "Reading EPS files requires gs (from GhostScript)";
qCWarning(EPSPLUGIN) << "Reading EPS files requires gs (from GhostScript)";
return false;
}
@ -297,7 +298,7 @@ bool EPSHandler::write(const QImage &image)
converter.start(QStringLiteral("gs"), gsArgs);
if (!converter.waitForStarted(3000)) {
qWarning() << "Creating EPS files requires pdftops (from Poppler) or gs (from GhostScript)";
qCWarning(EPSPLUGIN) << "Creating EPS files requires pdftops (from Poppler) or gs (from GhostScript)";
return false;
}
}
@ -312,7 +313,7 @@ bool EPSHandler::write(const QImage &image)
bool EPSHandler::canRead(QIODevice *device)
{
if (!device) {
qWarning("EPSHandler::canRead() called with no device");
qCWarning(EPSPLUGIN) << "EPSHandler::canRead() called with no device";
return false;
}
@ -333,14 +334,23 @@ bool EPSHandler::canRead(QIODevice *device)
QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{
// prevent bug #397040: when on app shutdown the clipboard content is to be copied to survive end of the app,
// QXcbIntegration looks for some QImageIOHandler to apply, querying the capabilities and picking any first.
// At that point this plugin no longer has its requirements e.g. to run the external process, so we have to deny.
// The capabilities seem to be queried on demand in Qt code and not cached, so it's fine to report based
// in current dynamic state
if (!QCoreApplication::instance()) {
return {};
}
if (format == "eps" || format == "epsi" || format == "epsf") {
return Capabilities(CanRead | CanWrite);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -15,9 +15,9 @@ class EPSHandler : public QImageIOHandler
public:
EPSHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
};
@ -28,8 +28,8 @@ class EPSPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "eps.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
Q_DECLARE_LOGGING_CATEGORY(EPSPLUGIN)

View File

@ -41,10 +41,10 @@ public:
{
}
bool read(char c[], int n) Q_DECL_OVERRIDE;
Imf::Int64 tellg() Q_DECL_OVERRIDE;
void seekg(Imf::Int64 pos) Q_DECL_OVERRIDE;
void clear() Q_DECL_OVERRIDE;
bool read(char c[], int n) override;
Imf::Int64 tellg() override;
void seekg(Imf::Int64 pos) override;
void clear() override;
private:
QIODevice *m_dev;
@ -218,10 +218,10 @@ QImageIOPlugin::Capabilities EXRPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -18,8 +18,8 @@ class EXRHandler : public QImageIOHandler
public:
EXRHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *outImage) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *outImage) override;
static bool canRead(QIODevice *device);
};
@ -30,8 +30,8 @@ class EXRPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "exr.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_EXR_H

View File

@ -11,7 +11,7 @@
#include "hdr_p.h"
#include <QImage>
#include <QtCore/QDataStream>
#include <QDataStream>
#include <QDebug>

View File

@ -66,10 +66,10 @@ QImageIOPlugin::Capabilities KraPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,8 +17,8 @@ class KraHandler : public QImageIOHandler
public:
KraHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
static bool canRead(QIODevice *device);
};
@ -29,8 +29,8 @@ class KraPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "kra.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};

View File

@ -1,5 +1,4 @@
{
"Keys": [ "kra" ],
"MimeTypes": [ "application/x-krita", "application/x-krita" ]
"MimeTypes": [ "application/x-krita" ]
}

View File

@ -65,10 +65,10 @@ QImageIOPlugin::Capabilities OraPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,8 +17,8 @@ class OraHandler : public QImageIOHandler
public:
OraHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
static bool canRead(QIODevice *device);
};
@ -29,8 +29,8 @@ class OraPlugin : public QImageIOPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ora.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};

View File

@ -1,5 +1,4 @@
{
"Keys": [ "ora" ],
"MimeTypes": [ "image/openraster", "image/openraster" ]
"MimeTypes": [ "image/openraster" ]
}

View File

@ -667,10 +667,10 @@ QImageIOPlugin::Capabilities PCXPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,9 +17,9 @@ class PCXHandler : public QImageIOHandler
public:
PCXHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
};
@ -30,8 +30,8 @@ class PCXPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pcx.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PCX_H

View File

@ -449,10 +449,10 @@ QImageIOPlugin::Capabilities SoftimagePICPlugin::capabilities(QIODevice *device,
return Capabilities(CanRead | CanWrite);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -154,13 +154,13 @@ struct PicChannel {
class SoftimagePICHandler : public QImageIOHandler
{
public:
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &) override;
QVariant option(ImageOption option) const Q_DECL_OVERRIDE;
void setOption(ImageOption option, const QVariant &value) Q_DECL_OVERRIDE;
bool supportsOption(ImageOption option) const Q_DECL_OVERRIDE;
QVariant option(ImageOption option) const override;
void setOption(ImageOption option, const QVariant &value) override;
bool supportsOption(ImageOption option) const override;
static bool canRead(QIODevice *device);
@ -195,8 +195,8 @@ class SoftimagePICPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pic.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PIC_H

View File

@ -300,10 +300,10 @@ QImageIOPlugin::Capabilities PSDPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,8 +17,8 @@ class PSDHandler : public QImageIOHandler
public:
PSDHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
static bool canRead(QIODevice *device);
};
@ -29,8 +29,8 @@ class PSDPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "psd.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PSD_H

View File

@ -12,7 +12,7 @@
#include "ras_p.h"
#include <QImage>
#include <QtCore/QDataStream>
#include <QDataStream>
// #include <QDebug>
namespace // Private.
@ -282,10 +282,10 @@ QImageIOPlugin::Capabilities RASPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -18,8 +18,8 @@ class RASHandler : public QImageIOHandler
public:
RASHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
static bool canRead(QIODevice *device);
};
@ -30,8 +30,8 @@ class RASPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ras.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_RAS_H

View File

@ -23,8 +23,8 @@
#include "rgb_p.h"
#include <QtCore/QMap>
#include <QtCore/QVector>
#include <QMap>
#include <QVector>
#include <QImage>
// #include <QDebug>
@ -686,8 +686,8 @@ bool RGBHandler::canRead(QIODevice *device)
return false;
}
qint64 oldPos = device->pos();
QByteArray head = device->readLine(64);
const qint64 oldPos = device->pos();
const QByteArray head = device->readLine(64);
int readBytes = head.size();
if (device->isSequential()) {
@ -699,10 +699,7 @@ bool RGBHandler::canRead(QIODevice *device)
device->seek(oldPos);
}
const QRegExp regexp(QLatin1String("^\x01\xda\x01[\x01\x02]"));
QString data(QString::fromLocal8Bit(head));
return data.contains(regexp);
return head.size() >= 4 && head.startsWith("\x01\xda\x01") && (head[3] == 1 || head[3] == 2);
}
///////////////////////////////////////////////////////////////////////////////
@ -714,10 +711,10 @@ QImageIOPlugin::Capabilities RGBPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,9 +17,9 @@ class RGBHandler : public QImageIOHandler
public:
RGBHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
};
@ -30,8 +30,8 @@ class RGBPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "rgb.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_RGB_H

View File

@ -23,7 +23,7 @@
#include <assert.h>
#include <QImage>
#include <QtCore/QDataStream>
#include <QDataStream>
// #include <QDebug>
typedef quint32 uint;
@ -145,9 +145,7 @@ struct TgaHeaderInfo {
switch (tga.image_type) {
case TGA_TYPE_RLE_INDEXED:
rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH();
#endif
// no break is intended!
case TGA_TYPE_INDEXED:
pal = true;
@ -155,9 +153,7 @@ struct TgaHeaderInfo {
case TGA_TYPE_RLE_RGB:
rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH();
#endif
// no break is intended!
case TGA_TYPE_RGB:
rgb = true;
@ -165,9 +161,7 @@ struct TgaHeaderInfo {
case TGA_TYPE_RLE_GREY:
rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH();
#endif
// no break is intended!
case TGA_TYPE_GREY:
grey = true;
@ -423,10 +417,10 @@ QImageIOPlugin::Capabilities TGAPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -17,9 +17,9 @@ class TGAHandler : public QImageIOHandler
public:
TGAHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
};
@ -30,8 +30,8 @@ class TGAPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tga.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_TGA_H

View File

@ -24,9 +24,9 @@
#include <stdlib.h>
#include <QImage>
#include <QPainter>
#include <QtCore/QIODevice>
#include <QtCore/QStack>
#include <QtCore/QVector>
#include <QIODevice>
#include <QStack>
#include <QVector>
// #include <QDebug>
#include "gimp_p.h"
@ -713,7 +713,8 @@ bool XCFImageFormat::composeTiles(XCFImage &xcf_image)
// SANITY CHECK: Catch corrupted XCF image file where the width or height
// of a tile is reported are bogus. See Bug# 234030.
if (layer.width > 32767 || layer.height > 32767 || layer.width * layer.height > 16384 * 16384) {
if (layer.width > 32767 || layer.height > 32767
|| (sizeof(void *) == 4 && layer.width * layer.height > 16384 * 16384)) {
return false;
}
@ -1323,9 +1324,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
image.fill(qRgb(255, 255, 255));
break;
} // else, fall through to 32-bit representation
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH();
#endif
case RGBA_GIMAGE:
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
if (image.isNull()) {
@ -1345,9 +1344,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
image.fill(255);
break;
} // else, fall through to 32-bit representation
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH();
#endif
case GRAYA_GIMAGE:
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
if (image.isNull()) {
@ -2690,10 +2687,10 @@ QImageIOPlugin::Capabilities XCFPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return nullptr;
return {};
}
if (!device->isOpen()) {
return nullptr;
return {};
}
Capabilities cap;

View File

@ -29,9 +29,9 @@ class XCFHandler : public QImageIOHandler
public:
XCFHandler();
bool canRead() const Q_DECL_OVERRIDE;
bool read(QImage *image) Q_DECL_OVERRIDE;
bool write(const QImage &image) Q_DECL_OVERRIDE;
bool canRead() const override;
bool read(QImage *image) override;
bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
};
@ -42,8 +42,8 @@ class XCFPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "xcf.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_XCF_H