Compare commits

...

8 Commits

Author SHA1 Message Date
beaf20bd4a GIT_SILENT Upgrade ECM and KF5 version requirements for 5.52.0 release. 2018-11-03 12:00:43 +00:00
8ac949d459 Fix minor EBN issues 2018-10-22 19:58:24 +03:00
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
17 changed files with 58 additions and 47 deletions

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0)
project(KImageFormats)
include(FeatureSummary)
find_package(ECM 5.48.0 NO_MODULE)
find_package(ECM 5.52.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)

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,6 +334,15 @@ 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);
}

View File

@ -4,8 +4,8 @@
*
* This library is distributed under the conditions of the GNU LGPL.
*/
#ifndef KIMG_EPS_H
#define KIMG_EPS_H
#ifndef KIMG_EPS_P_H
#define KIMG_EPS_P_H
#include <QImageIOPlugin>
#include <QLoggingCategory>
@ -34,5 +34,5 @@ public:
Q_DECLARE_LOGGING_CATEGORY(EPSPLUGIN)
#endif // KIMG_EPS_H
#endif // KIMG_EPS_P_H

View File

@ -8,8 +8,8 @@
*
*/
#ifndef KIMG_EXR_H
#define KIMG_EXR_H
#ifndef KIMG_EXR_P_H
#define KIMG_EXR_P_H
#include <QImageIOPlugin>
@ -34,4 +34,4 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_EXR_H
#endif // KIMG_EXR_P_H

View File

@ -7,8 +7,8 @@
version 2 of the License, or (at your option) any later version.
*/
#ifndef KIMG_HDR_H
#define KIMG_HDR_H
#ifndef KIMG_HDR_P_H
#define KIMG_HDR_P_H
class QImageIO;

View File

@ -7,8 +7,8 @@
version 2 of the License, or (at your option) any later version.
*/
#ifndef KIMG_PCX_H
#define KIMG_PCX_H
#ifndef KIMG_PCX_P_H
#define KIMG_PCX_P_H
#include <QImageIOPlugin>
@ -34,4 +34,4 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PCX_H
#endif // KIMG_PCX_P_H

View File

@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
*/

View File

@ -14,12 +14,12 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
*/
#ifndef KIMG_PIC_H
#define KIMG_PIC_H
#ifndef KIMG_PIC_P_H
#define KIMG_PIC_P_H
#include <QImageIOPlugin>
#include <QDataStream>
@ -199,4 +199,4 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PIC_H
#endif // KIMG_PIC_P_H

View File

@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*

View File

@ -7,8 +7,8 @@
version 2 of the License, or (at your option) any later version.
*/
#ifndef KIMG_PSD_H
#define KIMG_PSD_H
#ifndef KIMG_PSD_P_H
#define KIMG_PSD_P_H
#include <QImageIOPlugin>
@ -33,5 +33,5 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_PSD_H
#endif // KIMG_PSD_P_H

View File

@ -8,8 +8,8 @@
version 2 of the License, or (at your option) any later version.
*/
#ifndef KIMG_RAS_H
#define KIMG_RAS_H
#ifndef KIMG_RAS_P_H
#define KIMG_RAS_P_H
#include <QImageIOPlugin>
@ -34,5 +34,5 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_RAS_H
#endif // KIMG_RAS_P_H

View File

@ -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);
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -7,8 +7,8 @@
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
#ifndef KIMG_RGB_H
#define KIMG_RGB_H
#ifndef KIMG_RGB_P_H
#define KIMG_RGB_P_H
#include <QImageIOPlugin>
@ -34,5 +34,5 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_RGB_H
#endif // KIMG_RGB_P_H

View File

@ -14,12 +14,12 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ----------------------------------------------------------------------------
*/
#ifndef KIMAGEFORMATS_RLE_H
#define KIMAGEFORMATS_RLE_H
#ifndef KIMAGEFORMATS_RLE_P_H
#define KIMAGEFORMATS_RLE_P_H
#include <QDebug>
#include <QDataStream>
@ -220,4 +220,4 @@ static inline void encodeRLEData(RLEVariant variant,
}
}
#endif // KIMAGEFORMATS_RLE_H
#endif // KIMAGEFORMATS_RLE_P_H

View File

@ -7,8 +7,8 @@
version 2 of the License, or (at your option) any later version.
*/
#ifndef KIMG_TGA_H
#define KIMG_TGA_H
#ifndef KIMG_TGA_P_H
#define KIMG_TGA_P_H
#include <QImageIOPlugin>
@ -34,4 +34,4 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_TGA_H
#endif // KIMG_TGA_P_H

View File

@ -19,8 +19,8 @@
*
*/
#ifndef KIMG_XCF_H
#define KIMG_XCF_H
#ifndef KIMG_XCF_P_H
#define KIMG_XCF_P_H
#include <QImageIOPlugin>
@ -46,4 +46,4 @@ public:
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
};
#endif // KIMG_XCF_H
#endif // KIMG_XCF_P_H

View File

@ -19,6 +19,9 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef FORMAT_ENUM_H
#define FORMAT_ENUM_H
#include <QImage>
// Generated from QImage::Format enum
@ -71,3 +74,4 @@ QString formatToString(QImage::Format format)
QLatin1String(">");
}
#endif