From d263dd92c6f269c4d91281fd48eb2be13e51db1a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 8 Feb 2021 14:48:05 +0200 Subject: [PATCH] drop text codec plugins support Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - package/freebsd/pkg-plist | 3 - package/netbsd/PLIST.common | 3 - package/openbsd/pkg/PLIST | 3 - scripts/incfsck.py | 1 - scripts/namefsck.py | 2 - src/core/CMakeLists.txt | 3 - src/core/codecs/qtextcodec.cpp | 62 +--------- src/core/codecs/qtextcodecplugin.cpp | 158 ------------------------- src/core/codecs/qtextcodecplugin.h | 84 ------------- src/core/global/qconfig.h.cmake | 7 +- src/tools/uic/cpp/cppwriteincludes.cpp | 2 - 12 files changed, 5 insertions(+), 324 deletions(-) delete mode 100644 src/core/codecs/qtextcodecplugin.cpp delete mode 100644 src/core/codecs/qtextcodecplugin.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 307f39b79..3300fc9ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -898,7 +898,6 @@ katie_generate_obsolete(QTextBlockGroup QtGui qtextobject.h) katie_generate_obsolete(QTextBlock QtGui qtextobject.h) katie_generate_obsolete(QTextBlockUserData QtGui qtextobject.h) katie_generate_obsolete(QTextCharFormat QtGui qtextformat.h) -katie_generate_obsolete(QTextCodecFactoryInterface QtCore qtextcodecplugin.h) katie_generate_obsolete(QTextDecoder QtCore qtextcodec.h) katie_generate_obsolete(QTextEncoder QtCore qtextcodec.h) katie_generate_obsolete(QTextFragment QtGui qtextobject.h) diff --git a/package/freebsd/pkg-plist b/package/freebsd/pkg-plist index 705c031cd..a3bcf7977 100644 --- a/package/freebsd/pkg-plist +++ b/package/freebsd/pkg-plist @@ -174,8 +174,6 @@ include/katie/QtCore/QSystemSemaphore include/katie/QtCore/QTemporaryFile include/katie/QtCore/QTextBoundaryFinder include/katie/QtCore/QTextCodec -include/katie/QtCore/QTextCodecFactoryInterface -include/katie/QtCore/QTextCodecPlugin include/katie/QtCore/QTextDecoder include/katie/QtCore/QTextEncoder include/katie/QtCore/QTextStream @@ -328,7 +326,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h include/katie/QtCore/qtemporaryfile.h include/katie/QtCore/qtextboundaryfinder.h include/katie/QtCore/qtextcodec.h -include/katie/QtCore/qtextcodecplugin.h include/katie/QtCore/qtextstream.h include/katie/QtCore/qthread.h include/katie/QtCore/qthreadpool.h diff --git a/package/netbsd/PLIST.common b/package/netbsd/PLIST.common index 4961c9d77..05624ecd6 100644 --- a/package/netbsd/PLIST.common +++ b/package/netbsd/PLIST.common @@ -177,8 +177,6 @@ include/katie/QtCore/QSystemSemaphore include/katie/QtCore/QTemporaryFile include/katie/QtCore/QTextBoundaryFinder include/katie/QtCore/QTextCodec -include/katie/QtCore/QTextCodecFactoryInterface -include/katie/QtCore/QTextCodecPlugin include/katie/QtCore/QTextDecoder include/katie/QtCore/QTextEncoder include/katie/QtCore/QTextStream @@ -331,7 +329,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h include/katie/QtCore/qtemporaryfile.h include/katie/QtCore/qtextboundaryfinder.h include/katie/QtCore/qtextcodec.h -include/katie/QtCore/qtextcodecplugin.h include/katie/QtCore/qtextstream.h include/katie/QtCore/qthread.h include/katie/QtCore/qthreadpool.h diff --git a/package/openbsd/pkg/PLIST b/package/openbsd/pkg/PLIST index e930b6ae0..3dfa2c7a5 100644 --- a/package/openbsd/pkg/PLIST +++ b/package/openbsd/pkg/PLIST @@ -177,8 +177,6 @@ include/katie/QtCore/QSystemSemaphore include/katie/QtCore/QTemporaryFile include/katie/QtCore/QTextBoundaryFinder include/katie/QtCore/QTextCodec -include/katie/QtCore/QTextCodecFactoryInterface -include/katie/QtCore/QTextCodecPlugin include/katie/QtCore/QTextDecoder include/katie/QtCore/QTextEncoder include/katie/QtCore/QTextStream @@ -331,7 +329,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h include/katie/QtCore/qtemporaryfile.h include/katie/QtCore/qtextboundaryfinder.h include/katie/QtCore/qtextcodec.h -include/katie/QtCore/qtextcodecplugin.h include/katie/QtCore/qtextstream.h include/katie/QtCore/qthread.h include/katie/QtCore/qthreadpool.h diff --git a/scripts/incfsck.py b/scripts/incfsck.py index 734a3b7f9..db7e82868 100755 --- a/scripts/incfsck.py +++ b/scripts/incfsck.py @@ -89,7 +89,6 @@ incmap = { 'QStringRef': 'qstring.h', 'QSysInfo': 'qglobal.h', 'QSystemLocale': 'qlocale.h', - 'QTextCodecFactoryInterface': 'qtextcodecplugin.h', 'QTextDecoder': 'qtextcodec.h', 'QTextEncoder': 'qtextcodec.h', 'QTextStreamFunction': 'qtextstream.h', diff --git a/scripts/namefsck.py b/scripts/namefsck.py index 84b6ce7ef..a88209d50 100755 --- a/scripts/namefsck.py +++ b/scripts/namefsck.py @@ -725,8 +725,6 @@ classlist = [ "QTextBrowser", "QTextCharFormat", "QTextCodec", - "QTextCodecFactoryInterface", - "QTextCodecPlugin", "QTextCursor", "QTextDecoder", "QTextDocument", diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5b66b7112..e9e740278 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -28,7 +28,6 @@ set(CORE_PUBLIC_HEADERS QtConcurrentMap QBitArray QChar - QTextCodecPlugin QMap QTextStream QDebug @@ -121,7 +120,6 @@ set(CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec_p.h ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec.h ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qicucodec_p.h - ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodecplugin.h ${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuture.h ${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfutureinterface.h ${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuturesynchronizer.h @@ -296,7 +294,6 @@ set(CORE_HEADERS set(CORE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodecplugin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/codecs/qicucodec.cpp ${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuture.cpp ${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfutureinterface.cpp diff --git a/src/core/codecs/qtextcodec.cpp b/src/core/codecs/qtextcodec.cpp index 6c07cda39..bbf58b5aa 100644 --- a/src/core/codecs/qtextcodec.cpp +++ b/src/core/codecs/qtextcodec.cpp @@ -47,12 +47,6 @@ #include "qhash.h" #include "qicucodec_p.h" -#ifndef QT_NO_LIBRARY -# include "qcoreapplication.h" -# include "qtextcodecplugin.h" -# include "qfactoryloader_p.h" -#endif - #include #include #include @@ -63,11 +57,6 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, codecsloader, - (QTextCodecFactoryInterface_iid, QLatin1String("/codecs"))) -#endif - static inline bool nameMatch(const QByteArray &name, const QByteArray &name2) { return (ucnv_compareNames(name.constData(), name2.constData()) == 0); @@ -549,18 +538,6 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) } } -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN) - const QFactoryLoader *l = codecsloader(); - foreach (const QString &key, l->keys()) { - if (nameMatch(name, key.toLatin1())) { - if (QTextCodecFactoryInterface *factory - = qobject_cast(l->instance(key))) { - return factory->create(key); - } - } - } -#endif - foreach(const QByteArray &codec, QIcuCodec::allCodecs()) { if (nameMatch(name, codec)) { return new QIcuCodec(name); @@ -589,13 +566,6 @@ QTextCodec* QTextCodec::codecForMib(int mib) } } -#ifndef QT_NO_TEXTCODECPLUGIN - QString name = QLatin1String("MIB: ") + QString::number(mib); - if (QTextCodecFactoryInterface *factory - = qobject_cast(codecsloader()->instance(name))) - return factory->create(name); -#endif - foreach(const int codec, QIcuCodec::allMibs()) { if (mib == codec) { return new QIcuCodec(mib); @@ -616,20 +586,9 @@ QTextCodec* QTextCodec::codecForMib(int mib) */ QList QTextCodec::availableCodecs() { - QList codecs; - codecs << "System" << QIcuCodec::allCodecs(); - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN) - const QFactoryLoader *l = codecsloader(); - foreach (const QString &key, l->keys()) { - if (!key.startsWith(QLatin1String("MIB: "))) { - QByteArray name = key.toLatin1(); - if (!codecs.contains(name)) - codecs += name; - } - } -#endif - + static const QList codecs = QList() + << "System" + << QIcuCodec::allCodecs(); return codecs; } @@ -641,20 +600,7 @@ QList QTextCodec::availableCodecs() */ QList QTextCodec::availableMibs() { - QList codecs; - codecs << QIcuCodec::allMibs(); - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN) - const QFactoryLoader *l = codecsloader(); - foreach (const QString &key, l->keys()) { - if (key.startsWith(QLatin1String("MIB: "))) { - int mib = key.mid(5).toInt(); - if (!codecs.contains(mib)) - codecs += mib; - } - } -#endif - + static const QList codecs = QIcuCodec::allMibs(); return codecs; } diff --git a/src/core/codecs/qtextcodecplugin.cpp b/src/core/codecs/qtextcodecplugin.cpp deleted file mode 100644 index ed4ca5b1e..000000000 --- a/src/core/codecs/qtextcodecplugin.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2016 Ivailo Monev -** -** This file is part of the QtCore module of the Katie Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtextcodecplugin.h" -#include "qstringlist.h" - -#ifndef QT_NO_TEXTCODECPLUGIN - -QT_BEGIN_NAMESPACE - -/*! - \class QTextCodecPlugin - \brief The QTextCodecPlugin class provides an abstract base for custom QTextCodec plugins. - \reentrant - \ingroup plugins - - The text codec plugin is a simple plugin interface that makes it - easy to create custom text codecs that can be loaded dynamically - into applications. - - Writing a text codec plugin is achieved by subclassing this base - class, reimplementing the pure virtual functions names(), - aliases(), createForName(), mibEnums() and createForMib(), and - exporting the class with the Q_EXPORT_PLUGIN2() macro. See \l{How - to Create Qt Plugins} for details. - - See the \l{http://www.iana.org/assignments/character-sets}{IANA - character-sets encoding file} for more information on mime - names and mib enums. -*/ - -/*! - \fn QStringList QTextCodecPlugin::names() const - - Returns the list of MIME names supported by this plugin. - - If a codec has several names, the extra names are returned by aliases(). - - \sa createForName(), aliases() -*/ - -/*! - \fn QList QTextCodecPlugin::aliases() const - - Returns the list of aliases supported by this plugin. -*/ - -/*! - \fn QTextCodec *QTextCodecPlugin::createForName(const QByteArray &name) - - Creates a QTextCodec object for the codec called \a name. The \a name - must come from the list of encodings returned by names(). Encoding - names are case sensitive. - - Example: - - \snippet doc/src/snippets/code/src_corelib_codecs_qtextcodecplugin.cpp 0 - - \sa names() -*/ - - -/*! - \fn QList QTextCodecPlugin::mibEnums() const - - Returns the list of mib enums supported by this plugin. - - \sa createForMib() -*/ - -/*! - \fn QTextCodec *QTextCodecPlugin::createForMib(int mib); - - Creates a QTextCodec object for the mib enum \a mib. - - See \l{http://www.iana.org/assignments/character-sets}{the - IANA character-sets encoding file} for more information. - - \sa mibEnums() -*/ - -/*! - Constructs a text codec plugin with the given \a parent. This is - invoked automatically by the Q_EXPORT_PLUGIN2() macro. -*/ -QTextCodecPlugin::QTextCodecPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the text codec plugin. - - You never have to call this explicitly. Qt destroys a plugin - automatically when it is no longer used. -*/ -QTextCodecPlugin::~QTextCodecPlugin() -{ -} - -QStringList QTextCodecPlugin::keys() const -{ - QStringList keys; - - foreach (const QByteArray &name, names()) - keys += QString::fromLatin1(name.constData()); - - foreach (const QByteArray &alias, aliases()) - keys += QString::fromLatin1(alias.constData()); - - foreach (const int mib, mibEnums()) - keys += QLatin1String("MIB: ") + QString::number(mib); - - return keys; -} - -QTextCodec *QTextCodecPlugin::create(const QString &name) -{ - if (name.startsWith(QLatin1String("MIB: "))) - return createForMib(name.mid(4).toInt()); - return createForName(name.toLatin1()); -} - -#include "moc_qtextcodecplugin.h" - -QT_END_NAMESPACE - -#endif // QT_NO_TEXTCODECPLUGIN diff --git a/src/core/codecs/qtextcodecplugin.h b/src/core/codecs/qtextcodecplugin.h deleted file mode 100644 index 5ca78c513..000000000 --- a/src/core/codecs/qtextcodecplugin.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2016 Ivailo Monev -** -** This file is part of the QtCore module of the Katie Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTEXTCODECPLUGIN_H -#define QTEXTCODECPLUGIN_H - -#include -#include - - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_TEXTCODECPLUGIN - -class QTextCodec; - -struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface -{ - virtual QTextCodec *create(const QString &key) = 0; -}; - -QT_END_NAMESPACE - -#define QTextCodecFactoryInterface_iid "Katie.QTextCodecFactoryInterface" -Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid) - -QT_BEGIN_NAMESPACE - -class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QTextCodecFactoryInterface:QFactoryInterface) -public: - QT_DEPRECATED_CONSTRUCTOR QTextCodecPlugin(QObject *parent = Q_NULLPTR); - ~QTextCodecPlugin(); - - QT_DEPRECATED virtual QList names() const = 0; - QT_DEPRECATED virtual QList aliases() const = 0; - QT_DEPRECATED virtual QTextCodec *createForName(const QByteArray &name) = 0; - - QT_DEPRECATED virtual QList mibEnums() const = 0; - QT_DEPRECATED virtual QTextCodec *createForMib(int mib) = 0; - -private: - QStringList keys() const; - QTextCodec *create(const QString &name); -}; - -#endif // QT_NO_TEXTCODECPLUGIN - -QT_END_NAMESPACE - - -#endif // QTEXTCODECPLUGIN_H diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index 9622fb923..b9ccccd74 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -100,6 +100,7 @@ #define QT_NO_IMAGE_TEXT #define QT_NO_IMAGEFORMAT_MNG #define QT_NO_TEXTODFWRITER +#define QT_NO_TEXTCODECPLUGIN // Not supported, used to bootstrap #cmakedefine QT_NO_QOBJECT @@ -291,7 +292,6 @@ #cmakedefine QT_NO_TEXTBROWSER #cmakedefine QT_NO_TEXTCODE #cmakedefine QT_NO_TEXTCODEC -#cmakedefine QT_NO_TEXTCODECPLUGIN #cmakedefine QT_NO_TEXTCONTROL #cmakedefine QT_NO_TEXTDATE #cmakedefine QT_NO_TEXTEDIT @@ -503,11 +503,6 @@ # define QT_NO_SVG #endif -// QTextCodecPlugin -#if !defined(QT_NO_TEXTCODECPLUGIN) && (defined(QT_NO_TEXTCODEC) || defined(QT_NO_LIBRARY)) -# define QT_NO_TEXTCODECPLUGIN -#endif - // QColorDialog #if !defined(QT_NO_COLORDIALOG) && defined(QT_NO_SPINBOX) # define QT_NO_COLORDIALOG diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index ef12b8713..32e9c6d20 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -651,8 +651,6 @@ static const struct ClassTblData { { QLatin1String("QTextBrowser"), QLatin1String("QtGui/qtextbrowser.h") }, { QLatin1String("QTextCharFormat"), QLatin1String("QtGui/qtextformat.h") }, { QLatin1String("QTextCodec"), QLatin1String("QtCore/qtextcodec.h") }, - { QLatin1String("QTextCodecFactoryInterface"), QLatin1String("QtCore/qtextcodecplugin.h") }, - { QLatin1String("QTextCodecPlugin"), QLatin1String("QtCore/qtextcodecplugin.h") }, { QLatin1String("QTextCursor"), QLatin1String("QtGui/qtextcursor.h") }, { QLatin1String("QTextDecoder"), QLatin1String("QtCore/qtextcodec.h") }, { QLatin1String("QTextDocument"), QLatin1String("QtGui/qtextdocument.h") },