summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-01-12 10:43:29 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-20 18:48:22 +0100
commit3a3356a85079d734dfa57205a00e1996afc033df (patch)
tree1be52f3f40b313080dde28dbdffac486ce33d8f4
parent712cfb509484599f1586f68cc379e3e7464e9967 (diff)
remove obsolete codec plugin loading code
Change-Id: I1f3dbb5c10009413f701947b1b89ed3dbc94bf3d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--dist/changes-5.0.04
-rw-r--r--src/corelib/codecs/codecs.pri2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp87
-rw-r--r--src/corelib/codecs/qtextcodecplugin.cpp161
-rw-r--r--src/corelib/codecs/qtextcodecplugin.h96
-rw-r--r--src/corelib/global/qconfig-medium.h3
-rw-r--r--src/corelib/global/qconfig-minimal.h3
-rw-r--r--src/corelib/global/qconfig-nacl.h3
-rw-r--r--src/corelib/global/qconfig-small.h3
-rw-r--r--src/corelib/global/qfeatures.h5
10 files changed, 5 insertions, 362 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index b0f969396c..1ec68fcb0d 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -171,6 +171,8 @@ information about a particular change.
- qmake
* several functions and built-in variables were modified to return normalized paths.
+- QTextCodecPlugin has been removed since it is no longer used. All text codecs
+ are now built into QtCore.
****************************************************************************
* General *
@@ -338,7 +340,7 @@ Qt for Windows CE
****************************************************************************
* Plugins *
****************************************************************************
-
+- The text codecs that were previously plugins are now built into QtCore.
****************************************************************************
* Important Behavior Changes *
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index 0478ecfde3..d0bafc3e74 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -8,7 +8,6 @@ HEADERS += \
codecs/qtextcodec.h \
codecs/qtsciicodec_p.h \
codecs/qutfcodec_p.h \
- codecs/qtextcodecplugin.h \
codecs/qgb18030codec_p.h \
codecs/qeucjpcodec_p.h \
codecs/qjiscodec_p.h \
@@ -24,7 +23,6 @@ SOURCES += \
codecs/qtextcodec.cpp \
codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp \
- codecs/qtextcodecplugin.cpp \
codecs/qgb18030codec.cpp \
codecs/qjpunicode.cpp \
codecs/qeucjpcodec.cpp \
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 2d142cc335..ce118f7749 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -47,11 +47,6 @@
#include "qlist.h"
#include "qfile.h"
-#ifndef QT_NO_LIBRARY
-# include "qcoreapplication.h"
-# include "qtextcodecplugin.h"
-# include "private/qfactoryloader_p.h"
-#endif
#include "qstringlist.h"
#ifdef Q_OS_UNIX
@@ -100,11 +95,6 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
-#endif
-
//Cache for QTextCodec::codecForName and codecForMib.
typedef QHash<QByteArray, QTextCodec *> QTextCodecCache;
Q_GLOBAL_STATIC(QTextCodecCache, qTextCodecCache)
@@ -146,39 +136,6 @@ static bool nameMatch(const QByteArray &name, const QByteArray &test)
}
-static QTextCodec *createForName(const QByteArray &name)
-{
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
- QFactoryLoader *l = loader();
- QStringList keys = l->keys();
- for (int i = 0; i < keys.size(); ++i) {
- if (nameMatch(name, keys.at(i).toLatin1())) {
- QString realName = keys.at(i);
- if (QTextCodecFactoryInterface *factory
- = qobject_cast<QTextCodecFactoryInterface*>(l->instance(realName))) {
- return factory->create(realName);
- }
- }
- }
-#else
- Q_UNUSED(name);
-#endif
- return 0;
-}
-
-static QTextCodec *createForMib(int mib)
-{
-#ifndef QT_NO_TEXTCODECPLUGIN
- QString name = QLatin1String("MIB: ") + QString::number(mib);
- if (QTextCodecFactoryInterface *factory
- = qobject_cast<QTextCodecFactoryInterface*>(loader()->instance(name)))
- return factory->create(name);
-#else
- Q_UNUSED(mib);
-#endif
- return 0;
-}
-
static QList<QTextCodec*> *all = 0;
#ifdef Q_DEBUG_TEXTCODEC
static bool destroying_is_ok = false;
@@ -936,10 +893,6 @@ QTextCodec::ConverterState::~ConverterState()
\o Converts a Unicode string to an 8-bit character string.
\endtable
- You may find it more convenient to make your codec class
- available as a plugin; see \l{How to Create Qt Plugins} for
- details.
-
\sa QTextStream, QTextDecoder, QTextEncoder, {Codecs Example}
*/
@@ -1032,10 +985,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
}
}
- codec = createForName(name);
- if (codec && cache)
- cache->insert(name, codec);
- return codec;
+ return 0;
}
@@ -1072,16 +1022,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
}
- codec = createForMib(mib);
-
- // Qt 3 used 1000 (mib for UCS2) as its identifier for the utf16 codec. Map
- // this correctly for compatibility.
- if (!codec && mib == 1000)
- return codecForMib(1015);
-
- if (codec && cache)
- cache->insert(key, codec);
- return codec;
+ return 0;
}
/*!
@@ -1114,18 +1055,6 @@ QList<QByteArray> QTextCodec::availableCodecs()
locker.unlock();
#endif
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
- QFactoryLoader *l = loader();
- QStringList keys = l->keys();
- for (int i = 0; i < keys.size(); ++i) {
- if (!keys.at(i).startsWith(QLatin1String("MIB: "))) {
- QByteArray name = keys.at(i).toLatin1();
- if (!codecs.contains(name))
- codecs += name;
- }
- }
-#endif
-
return codecs;
}
@@ -1154,18 +1083,6 @@ QList<int> QTextCodec::availableMibs()
locker.unlock();
#endif
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
- QFactoryLoader *l = loader();
- QStringList keys = l->keys();
- for (int i = 0; i < keys.size(); ++i) {
- if (keys.at(i).startsWith(QLatin1String("MIB: "))) {
- int mib = keys.at(i).mid(5).toInt();
- if (!codecs.contains(mib))
- codecs += mib;
- }
- }
-#endif
-
return codecs;
}
diff --git a/src/corelib/codecs/qtextcodecplugin.cpp b/src/corelib/codecs/qtextcodecplugin.cpp
deleted file mode 100644
index 4eb075c5f2..0000000000
--- a/src/corelib/codecs/qtextcodecplugin.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt 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.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $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<QByteArray> 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<int> 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;
- QList<QByteArray> list = names();
- list += aliases();
- for (int i = 0; i < list.size(); ++i)
- keys += QString::fromLatin1(list.at(i));
- QList<int> mibs = mibEnums();
- for (int i = 0; i < mibs.count(); ++i)
- keys += QLatin1String("MIB: ") + QString::number(mibs.at(i));
- return keys;
-}
-
-QTextCodec *QTextCodecPlugin::create(const QString &name)
-{
- if (name.startsWith(QLatin1String("MIB: ")))
- return createForMib(name.mid(4).toInt());
- return createForName(name.toLatin1());
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODECPLUGIN
diff --git a/src/corelib/codecs/qtextcodecplugin.h b/src/corelib/codecs/qtextcodecplugin.h
deleted file mode 100644
index 9a00bbc9fa..0000000000
--- a/src/corelib/codecs/qtextcodecplugin.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt 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.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTEXTCODECPLUGIN_H
-#define QTEXTCODECPLUGIN_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-#ifndef QT_NO_TEXTCODECPLUGIN
-
-class QTextCodec;
-
-struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface
-{
- virtual QTextCodec *create(const QString &key) = 0;
-};
-
-#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface"
-
-Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid)
-
-
-class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QTextCodecFactoryInterface:QFactoryInterface)
-public:
- explicit QTextCodecPlugin(QObject *parent = 0);
- ~QTextCodecPlugin();
-
- virtual QList<QByteArray> names() const = 0;
- virtual QList<QByteArray> aliases() const = 0;
- virtual QTextCodec *createForName(const QByteArray &name) = 0;
-
- virtual QList<int> mibEnums() const = 0;
- virtual QTextCodec *createForMib(int mib) = 0;
-
-private:
- QStringList keys() const;
- QTextCodec *create(const QString &name);
-};
-
-#endif // QT_NO_TEXTCODECPLUGIN
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTEXTCODECPLUGIN_H
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index 96207d1cd8..779d4ef011 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -91,9 +91,6 @@
#ifndef QT_NO_CODECS
# define QT_NO_CODECS
#endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-# define QT_NO_TEXTCODECPLUGIN
-#endif
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index 30440243de..29f7779a4c 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -164,9 +164,6 @@
#ifndef QT_NO_CODECS
# define QT_NO_CODECS
#endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-# define QT_NO_TEXTCODECPLUGIN
-#endif
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index 6b943ab422..45f012fa79 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -128,9 +128,6 @@
#ifndef QT_NO_CODECS
# define QT_NO_CODECS
#endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-# define QT_NO_TEXTCODECPLUGIN
-#endif
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index 84a5ec59d9..18dd051f5a 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -125,9 +125,6 @@
#ifndef QT_NO_CODECS
# define QT_NO_CODECS
#endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-# define QT_NO_TEXTCODECPLUGIN
-#endif
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 5055414834..c039f15c2f 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -633,11 +633,6 @@
#define QT_NO_TABDIALOG
#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