move plugin text codecs to QtCore

Having plugin text codecs adds considerable complexity to
configuring Qt. The plugin interface is designed for optional
features, but text codecs tend to be used for essential functions.
A dramatic example is loading a codec plugin from a file whose path
needs to be converted by the codec.

Codec plugins can also be a nuisance to builders of applications
linking to static Qt. This is because the application might need
to explicilty import the static codec plugins which are actually
dependencies of QtCore.

For these reasons, it has been decided not to have text codec plugins
any longer.

Change-Id: Ic6c80a9c949bd42e881e932d1edae23fe4fe4c88
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Mark Brand 2012-01-13 00:24:13 +01:00 committed by Qt by Nokia
parent 7ee3d8c8ec
commit 2ae91491b4
29 changed files with 22 additions and 665 deletions

View File

@ -9,13 +9,13 @@ HEADERS += \
codecs/qtsciicodec_p.h \
codecs/qutfcodec_p.h \
codecs/qtextcodecplugin.h \
../plugins/codecs/cn/qgb18030codec.h \
../plugins/codecs/jp/qeucjpcodec.h \
../plugins/codecs/jp/qjiscodec.h \
../plugins/codecs/jp/qsjiscodec.h \
../plugins/codecs/kr/qeuckrcodec.h \
../plugins/codecs/tw/qbig5codec.h \
../plugins/codecs/jp/qfontjpcodec.h
codecs/qgb18030codec_p.h \
codecs/qeucjpcodec_p.h \
codecs/qjiscodec_p.h \
codecs/qsjiscodec_p.h \
codecs/qeuckrcodec_p.h \
codecs/qbig5codec_p.h \
codecs/qfontjpcodec_p.h
SOURCES += \
codecs/qisciicodec.cpp \
@ -25,14 +25,14 @@ SOURCES += \
codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp \
codecs/qtextcodecplugin.cpp \
../plugins/codecs/cn/qgb18030codec.cpp \
../plugins/codecs/jp/qjpunicode.cpp \
../plugins/codecs/jp/qeucjpcodec.cpp \
../plugins/codecs/jp/qjiscodec.cpp \
../plugins/codecs/jp/qsjiscodec.cpp \
../plugins/codecs/kr/qeuckrcodec.cpp \
../plugins/codecs/tw/qbig5codec.cpp \
../plugins/codecs/jp/qfontjpcodec.cpp
codecs/qgb18030codec.cpp \
codecs/qjpunicode.cpp \
codecs/qeucjpcodec.cpp \
codecs/qjiscodec.cpp \
codecs/qsjiscodec.cpp \
codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp \
codecs/qfontjpcodec.cpp
unix {
SOURCES += codecs/qfontlaocodec.cpp

View File

@ -66,16 +66,16 @@
# include "qisciicodec_p.h"
#if !defined(Q_OS_INTEGRITY)
# if !defined(QT_BOOTSTRAPPED)
# include "../../plugins/codecs/cn/qgb18030codec.h"
# include "../../plugins/codecs/jp/qeucjpcodec.h"
# include "../../plugins/codecs/jp/qjiscodec.h"
# include "../../plugins/codecs/jp/qsjiscodec.h"
# include "../../plugins/codecs/kr/qeuckrcodec.h"
# include "../../plugins/codecs/tw/qbig5codec.h"
# include "qgb18030codec_p.h"
# include "qeucjpcodec_p.h"
# include "qjiscodec_p.h"
# include "qsjiscodec_p.h"
# include "qeuckrcodec_p.h"
# include "qbig5codec_p.h"
# endif // !QT_BOOTSTRAPPED
# if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED)
# include "qfontlaocodec_p.h"
# include "../../plugins/codecs/jp/qfontjpcodec.h"
# include "qfontjpcodec_p.h"
# endif
#endif // !Q_OS_INTEGRITY
#endif // QT_NO_CODECS

View File

@ -1,14 +0,0 @@
TARGET = qcncodecs
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
QT = core
HEADERS = qgb18030codec.h
SOURCES = qgb18030codec.cpp \
main.cpp
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target

View File

@ -1,145 +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 plugins 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 <qtextcodec.h>
#include <qlist.h>
#include "qgb18030codec.h"
#ifndef QT_NO_TEXTCODECPLUGIN
QT_BEGIN_NAMESPACE
class CNTextCodecs : public QTextCodecPlugin
{
public:
CNTextCodecs() {}
QList<QByteArray> names() const;
QList<QByteArray> aliases() const;
QList<int> mibEnums() const;
QTextCodec *createForMib(int);
QTextCodec *createForName(const QByteArray &);
};
QList<QByteArray> CNTextCodecs::names() const
{
QList<QByteArray> list;
list += QGb18030Codec::_name();
list += QGbkCodec::_name();
list += QGb2312Codec::_name();
#ifdef Q_OS_UNIX
list += QFontGb2312Codec::_name();
list += QFontGbkCodec::_name();
#endif
return list;
}
QList<QByteArray> CNTextCodecs::aliases() const
{
QList<QByteArray> list;
list += QGb18030Codec::_aliases();
list += QGbkCodec::_aliases();
list += QGb2312Codec::_aliases();
#ifdef Q_OS_UNIX
list += QFontGb2312Codec::_aliases();
list += QFontGbkCodec::_aliases();
#endif
return list;
}
QList<int> CNTextCodecs::mibEnums() const
{
QList<int> list;
list += QGb18030Codec::_mibEnum();
list += QGbkCodec::_mibEnum();
list += QGb2312Codec::_mibEnum();
#ifdef Q_OS_UNIX
list += QFontGb2312Codec::_mibEnum();
list += QFontGbkCodec::_mibEnum();
#endif
return list;
}
QTextCodec *CNTextCodecs::createForMib(int mib)
{
if (mib == QGb18030Codec::_mibEnum())
return new QGb18030Codec;
if (mib == QGbkCodec::_mibEnum())
return new QGbkCodec;
if (mib == QGb2312Codec::_mibEnum())
return new QGb2312Codec;
#ifdef Q_OS_UNIX
if (mib == QFontGbkCodec::_mibEnum())
return new QFontGbkCodec;
if (mib == QFontGb2312Codec::_mibEnum())
return new QFontGb2312Codec;
#endif
return 0;
}
QTextCodec *CNTextCodecs::createForName(const QByteArray &name)
{
if (name == QGb18030Codec::_name() || QGb18030Codec::_aliases().contains(name))
return new QGb18030Codec;
if (name == QGbkCodec::_name() || QGbkCodec::_aliases().contains(name))
return new QGbkCodec;
if (name == QGb2312Codec::_name() || QGb2312Codec::_aliases().contains(name))
return new QGb2312Codec;
#ifdef Q_OS_UNIX
if (name == QFontGbkCodec::_name() || QFontGbkCodec::_aliases().contains(name))
return new QFontGbkCodec;
if (name == QFontGb2312Codec::_name() || QFontGb2312Codec::_aliases().contains(name))
return new QFontGb2312Codec;
#endif
return 0;
}
Q_EXPORT_STATIC_PLUGIN(CNTextCodecs)
Q_EXPORT_PLUGIN2(qcncodecs, CNTextCodecs)
QT_END_NAMESPACE
#endif // QT_NO_TEXTCODECPLUGIN

View File

@ -1,4 +0,0 @@
TEMPLATE = subdirs
SUBDIRS = cn jp tw kr

View File

@ -1,25 +0,0 @@
TARGET = qjpcodecs
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
QT = core
HEADERS = qjpunicode.h \
qeucjpcodec.h \
qjiscodec.h \
qsjiscodec.h
SOURCES = qeucjpcodec.cpp \
qjiscodec.cpp \
qsjiscodec.cpp \
qjpunicode.cpp \
main.cpp
unix {
HEADERS += qfontjpcodec.h
SOURCES += qfontjpcodec.cpp
}
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target

View File

@ -1,149 +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 plugins 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 <qtextcodec.h>
#include <qstringlist.h>
#ifndef QT_NO_TEXTCODECPLUGIN
#include "qeucjpcodec.h"
#include "qjiscodec.h"
#include "qsjiscodec.h"
#ifdef Q_OS_UNIX
#include "qfontjpcodec.h"
#endif
QT_BEGIN_NAMESPACE
class JPTextCodecs : public QTextCodecPlugin
{
public:
JPTextCodecs() {}
QList<QByteArray> names() const;
QList<QByteArray> aliases() const;
QList<int> mibEnums() const;
QTextCodec *createForMib(int);
QTextCodec *createForName(const QByteArray &);
};
QList<QByteArray> JPTextCodecs::names() const
{
QList<QByteArray> list;
list += QEucJpCodec::_name();
list += QJisCodec::_name();
list += QSjisCodec::_name();
#ifdef Q_OS_UNIX
list += QFontJis0201Codec::_name();
list += QFontJis0208Codec::_name();
#endif
return list;
}
QList<QByteArray> JPTextCodecs::aliases() const
{
QList<QByteArray> list;
list += QEucJpCodec::_aliases();
list += QJisCodec::_aliases();
list += QSjisCodec::_aliases();
#ifdef Q_OS_UNIX
list += QFontJis0201Codec::_aliases();
list += QFontJis0208Codec::_aliases();
#endif
return list;
}
QList<int> JPTextCodecs::mibEnums() const
{
QList<int> list;
list += QEucJpCodec::_mibEnum();
list += QJisCodec::_mibEnum();
list += QSjisCodec::_mibEnum();
#ifdef Q_OS_UNIX
list += QFontJis0201Codec::_mibEnum();
list += QFontJis0208Codec::_mibEnum();
#endif
return list;
}
QTextCodec *JPTextCodecs::createForMib(int mib)
{
if (mib == QEucJpCodec::_mibEnum())
return new QEucJpCodec;
if (mib == QJisCodec::_mibEnum())
return new QJisCodec;
if (mib == QSjisCodec::_mibEnum())
return new QSjisCodec;
#ifdef Q_OS_UNIX
if (mib == QFontJis0208Codec::_mibEnum())
return new QFontJis0208Codec;
if (mib == QFontJis0201Codec::_mibEnum())
return new QFontJis0201Codec;
#endif
return 0;
}
QTextCodec *JPTextCodecs::createForName(const QByteArray &name)
{
if (name == QEucJpCodec::_name() || QEucJpCodec::_aliases().contains(name))
return new QEucJpCodec;
if (name == QJisCodec::_name() || QJisCodec::_aliases().contains(name))
return new QJisCodec;
if (name == QSjisCodec::_name() || QSjisCodec::_aliases().contains(name))
return new QSjisCodec;
#ifdef Q_OS_UNIX
if (name == QFontJis0208Codec::_name() || QFontJis0208Codec::_aliases().contains(name))
return new QFontJis0208Codec;
if (name == QFontJis0201Codec::_name() || QFontJis0201Codec::_aliases().contains(name))
return new QFontJis0201Codec;
#endif
return 0;
}
Q_EXPORT_STATIC_PLUGIN(JPTextCodecs);
Q_EXPORT_PLUGIN2(qjpcodecs, JPTextCodecs);
QT_END_NAMESPACE
#endif // QT_NO_TEXTCODECPLUGIN

View File

@ -1,18 +0,0 @@
TARGET = qkrcodecs
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
QT = core
HEADERS = qeuckrcodec.h \
cp949codetbl.h
SOURCES = qeuckrcodec.cpp \
main.cpp
wince*: {
SOURCES += ../../../corelib/kernel/qfunctions_wince.cpp
}
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target

View File

@ -1,131 +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 plugins 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 <qtextcodec.h>
#include <qstringlist.h>
#include "qeuckrcodec.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTCODECPLUGIN
class KRTextCodecs : public QTextCodecPlugin
{
public:
KRTextCodecs() {}
QList<QByteArray> names() const;
QList<QByteArray> aliases() const;
QList<int> mibEnums() const;
QTextCodec *createForMib(int);
QTextCodec *createForName(const QByteArray &);
};
QList<QByteArray> KRTextCodecs::names() const
{
QList<QByteArray> list;
list += QEucKrCodec::_name();
#ifdef Q_OS_UNIX
list += QFontKsc5601Codec::_name();
#endif
list += QCP949Codec::_name();
return list;
}
QList<QByteArray> KRTextCodecs::aliases() const
{
QList<QByteArray> list;
list += QEucKrCodec::_aliases();
#ifdef Q_OS_UNIX
list += QFontKsc5601Codec::_aliases();
#endif
list += QCP949Codec::_aliases();
return list;
}
QList<int> KRTextCodecs::mibEnums() const
{
QList<int> list;
list += QEucKrCodec::_mibEnum();
#ifdef Q_OS_UNIX
list += QFontKsc5601Codec::_mibEnum();
#endif
list += QCP949Codec::_mibEnum();
return list;
}
QTextCodec *KRTextCodecs::createForMib(int mib)
{
if (mib == QEucKrCodec::_mibEnum())
return new QEucKrCodec;
#ifdef Q_OS_UNIX
if (mib == QFontKsc5601Codec::_mibEnum())
return new QFontKsc5601Codec;
#endif
if (mib == QCP949Codec::_mibEnum())
return new QCP949Codec;
return 0;
}
QTextCodec *KRTextCodecs::createForName(const QByteArray &name)
{
if (name == QEucKrCodec::_name() || QEucKrCodec::_aliases().contains(name))
return new QEucKrCodec;
#ifdef Q_OS_UNIX
if (name == QFontKsc5601Codec::_name() || QFontKsc5601Codec::_aliases().contains(name))
return new QFontKsc5601Codec;
#endif
if (name == QCP949Codec::_name() || QCP949Codec::_aliases().contains(name))
return new QCP949Codec;
return 0;
}
Q_EXPORT_STATIC_PLUGIN(KRTextCodecs);
Q_EXPORT_PLUGIN2(qkrcodecs, KRTextCodecs);
#endif // QT_NO_TEXTCODECPLUGIN
QT_END_NAMESPACE

View File

@ -1,138 +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 plugins 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 <qtextcodec.h>
#include <qstringlist.h>
#ifndef QT_NO_TEXTCODECPLUGIN
#include "qbig5codec.h"
QT_BEGIN_NAMESPACE
class TWTextCodecs : public QTextCodecPlugin
{
public:
TWTextCodecs() {}
QList<QByteArray> names() const;
QList<QByteArray> aliases() const;
QList<int> mibEnums() const;
QTextCodec *createForMib(int);
QTextCodec *createForName(const QByteArray &);
};
QList<QByteArray> TWTextCodecs::names() const
{
QList<QByteArray> list;
list += QBig5Codec::_name();
list += QBig5hkscsCodec::_name();
#ifdef Q_OS_UNIX
list += QFontBig5Codec::_name();
list += QFontBig5hkscsCodec::_name();
#endif
return list;
}
QList<QByteArray> TWTextCodecs::aliases() const
{
QList<QByteArray> list;
list += QBig5Codec::_aliases();
list += QBig5hkscsCodec::_aliases();
#ifdef Q_OS_UNIX
list += QFontBig5Codec::_aliases();
list += QFontBig5hkscsCodec::_aliases();
#endif
return list;
}
QList<int> TWTextCodecs::mibEnums() const
{
QList<int> list;
list += QBig5Codec::_mibEnum();
list += QBig5hkscsCodec::_mibEnum();
#ifdef Q_OS_UNIX
list += QFontBig5Codec::_mibEnum();
list += QFontBig5hkscsCodec::_mibEnum();
#endif
return list;
}
QTextCodec *TWTextCodecs::createForMib(int mib)
{
if (mib == QBig5Codec::_mibEnum())
return new QBig5Codec;
if (mib == QBig5hkscsCodec::_mibEnum())
return new QBig5hkscsCodec;
#ifdef Q_OS_UNIX
if (mib == QFontBig5hkscsCodec::_mibEnum())
return new QFontBig5hkscsCodec;
if (mib == QFontBig5Codec::_mibEnum())
return new QFontBig5Codec;
#endif
return 0;
}
QTextCodec *TWTextCodecs::createForName(const QByteArray &name)
{
if (name == QBig5Codec::_name() || QBig5Codec::_aliases().contains(name))
return new QBig5Codec;
if (name == QBig5hkscsCodec::_name() || QBig5hkscsCodec::_aliases().contains(name))
return new QBig5hkscsCodec;
#ifdef Q_OS_UNIX
if (name == QFontBig5hkscsCodec::_name() || QFontBig5hkscsCodec::_aliases().contains(name))
return new QFontBig5hkscsCodec;
if (name == QFontBig5Codec::_name() || QFontBig5Codec::_aliases().contains(name))
return new QFontBig5Codec;
#endif
return 0;
}
Q_EXPORT_STATIC_PLUGIN(TWTextCodecs);
Q_EXPORT_PLUGIN2(qtwcodecs, TWTextCodecs);
#endif // QT_NO_TEXTCODECPLUGIN
QT_END_NAMESPACE

View File

@ -1,14 +0,0 @@
TARGET = qtwcodecs
load(qt_plugin)
CONFIG += warn_on
DESTDIR = $$QT.core.plugins/codecs
QT = core
HEADERS = qbig5codec.h
SOURCES = qbig5codec.cpp \
main.cpp
target.path += $$[QT_INSTALL_PLUGINS]/codecs
INSTALLS += target

View File

@ -1,11 +1,6 @@
TEMPLATE = subdirs
SUBDIRS *= sqldrivers bearer
unix {
contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv)|contains(QT_CONFIG,sun-libiconv):SUBDIRS *= codecs
} else {
SUBDIRS *= codecs
}
!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats
!isEmpty(QT.widgets.name): SUBDIRS += accessible