diff options
Diffstat (limited to 'src/plugins/platforminputcontexts')
10 files changed, 342 insertions, 305 deletions
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 338c7ca3be..f8fe671a2b 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -272,7 +278,7 @@ QString TableGenerator::findComposeFile() // check if user’s home directory has a file named .XCompose if (cleanState()) { - QString path = qgetenv("HOME") + QStringLiteral("/.XCompose"); + QString path = qgetenv("HOME") + QLatin1String("/.XCompose"); if (QFile::exists(path)) return path; } diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index 8ad081bea5..bf9f16b3e4 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp index fb40480203..857f437661 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -111,7 +117,7 @@ bool QComposeInputContext::filterEvent(const QEvent *event) keysym = keyEvent->nativeVirtualKey(); int nCompose = 0; - while (m_composeBuffer[nCompose] != 0 && nCompose < QT_KEYSEQUENCE_MAX_LEN) + while (nCompose < QT_KEYSEQUENCE_MAX_LEN && m_composeBuffer[nCompose] != 0) nCompose++; if (nCompose == QT_KEYSEQUENCE_MAX_LEN) { diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h index bdf5a91335..f82280903d 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -68,7 +74,7 @@ protected: private: QObject *m_focusObject; QVector<QComposeTableElement> m_composeTable; - uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN + 1]; + uint m_composeBuffer[QT_KEYSEQUENCE_MAX_LEN]; TableGenerator::TableState m_tableState; bool m_compositionTableInitialized; }; diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp index 15c98ed006..97a7242ca6 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp index 1b1a3be2c4..2846f52c8c 100644 --- a/src/plugins/platforminputcontexts/ibus/main.cpp +++ b/src/plugins/platforminputcontexts/ibus/main.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -53,7 +59,6 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString Q_UNUSED(paramList); if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) { - qDBusRegisterMetaType<QIBusSerializable>(); qDBusRegisterMetaType<QIBusAttribute>(); qDBusRegisterMetaType<QIBusAttributeList>(); qDBusRegisterMetaType<QIBusText>(); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index a952123576..200d5789a8 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -112,7 +118,7 @@ QIBusPlatformInputContext::QIBusPlatformInputContext () m_eventFilterUseSynchronousMode = false; if (qEnvironmentVariableIsSet("IBUS_ENABLE_SYNC_MODE")) { bool ok; - int enableSync = qgetenv("IBUS_ENABLE_SYNC_MODE").toInt(&ok); + int enableSync = qEnvironmentVariableIntValue("IBUS_ENABLE_SYNC_MODE", &ok); if (ok && enableSync == 1) m_eventFilterUseSynchronousMode = true; } @@ -283,7 +289,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint void QIBusPlatformInputContext::surroundingTextRequired() { if (debug) - qDebug() << "surroundingTextRequired"; + qDebug("surroundingTextRequired"); d->needsSurroundingText = true; update(Qt::ImSurroundingText); } @@ -397,6 +403,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal bool retval = reply.value(); qCDebug(qtQpaInputMethods) << "filterEventFinished return" << code << sym << state << retval; if (!retval) { +#ifndef QT_NO_CONTEXTMENU if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu && window != NULL) { const QPoint globalPos = window->screen()->handle()->cursor()->pos(); @@ -404,6 +411,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers); } +#endif // QT_NO_CONTEXTMENU QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, code, sym, state, string, isAutoRepeat); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h index 824e9c2073..4f2722480e 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index 7cf3b24570..ac82fa3931 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -44,13 +50,9 @@ QIBusSerializable::QIBusSerializable() { } -QIBusSerializable::~QIBusSerializable() +void QIBusSerializable::deserializeFrom(const QDBusArgument &argument) { -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object) -{ - argument >> object.name; + argument >> name; argument.beginMap(); while (!argument.atEnd()) { @@ -60,19 +62,18 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable argument >> key; argument >> value; argument.endMapEntry(); - object.attachments[key] = value.variant().value<QDBusArgument>(); + attachments[key] = value.variant().value<QDBusArgument>(); } argument.endMap(); - return argument; } -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object) +void QIBusSerializable::serializeTo(QDBusArgument &argument) const { - argument << object.name; + argument << name; argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>()); - QHashIterator<QString, QDBusArgument> i(object.attachments); + QHashIterator<QString, QDBusArgument> i(attachments); while (i.hasNext()) { i.next(); @@ -85,7 +86,6 @@ QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &obje argument.endMapEntry(); } argument.endMap(); - return argument; } QIBusAttribute::QIBusAttribute() @@ -97,43 +97,35 @@ QIBusAttribute::QIBusAttribute() name = "IBusAttribute"; } -QIBusAttribute::~QIBusAttribute() -{ -} - -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute) +void QIBusAttribute::serializeTo(QDBusArgument &argument) const { argument.beginStructure(); - argument << static_cast<const QIBusSerializable &>(attribute); + QIBusSerializable::serializeTo(argument); - quint32 t = (quint32) attribute.type; + quint32 t = (quint32) type; argument << t; - argument << attribute.value; - argument << attribute.start; - argument << attribute.end; + argument << value; + argument << start; + argument << end; argument.endStructure(); - - return argument; } -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute) +void QIBusAttribute::deserializeFrom(const QDBusArgument &argument) { argument.beginStructure(); - argument >> static_cast<QIBusSerializable &>(attribute); + QIBusSerializable::deserializeFrom(argument); quint32 t; argument >> t; - attribute.type = (QIBusAttribute::Type) t; - argument >> attribute.value; - argument >> attribute.start; - argument >> attribute.end; + type = (QIBusAttribute::Type) t; + argument >> value; + argument >> start; + argument >> end; argument.endStructure(); - - return argument; } QTextCharFormat QIBusAttribute::format() const @@ -181,34 +173,30 @@ QIBusAttributeList::QIBusAttributeList() name = "IBusAttrList"; } -QIBusAttributeList::~QIBusAttributeList() -{ -} - -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attrList) +void QIBusAttributeList::serializeTo(QDBusArgument &argument) const { argument.beginStructure(); - argument << static_cast<const QIBusSerializable &>(attrList); + QIBusSerializable::serializeTo(argument); argument.beginArray(qMetaTypeId<QDBusVariant>()); - for (int i = 0; i < attrList.attributes.size(); ++i) { + for (int i = 0; i < attributes.size(); ++i) { QVariant variant; - variant.setValue(attrList.attributes.at(i)); + variant.setValue(attributes.at(i)); argument << QDBusVariant (variant); } argument.endArray(); argument.endStructure(); - return argument; } -const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList) +void QIBusAttributeList::deserializeFrom(const QDBusArgument &arg) { qCDebug(qtQpaInputMethodsSerialize) << "QIBusAttributeList::fromDBusArgument()" << arg.currentSignature(); + arg.beginStructure(); - arg >> static_cast<QIBusSerializable &>(attrList); + QIBusSerializable::deserializeFrom(arg); arg.beginArray(); while (!arg.atEnd()) { @@ -217,12 +205,11 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &at QIBusAttribute attr; var.variant().value<QDBusArgument>() >> attr; - attrList.attributes.append(attr); + attributes.append(std::move(attr)); } arg.endArray(); arg.endStructure(); - return arg; } QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const @@ -263,138 +250,115 @@ QIBusText::QIBusText() name = "IBusText"; } -QIBusText::~QIBusText() -{ -} - -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text) +void QIBusText::serializeTo(QDBusArgument &argument) const { argument.beginStructure(); - argument << static_cast<const QIBusSerializable &>(text); + QIBusSerializable::serializeTo(argument); - argument << text.text << text.attributes; + argument << text << attributes; argument.endStructure(); - return argument; } -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text) +void QIBusText::deserializeFrom(const QDBusArgument &argument) { qCDebug(qtQpaInputMethodsSerialize) << "QIBusText::fromDBusArgument()" << argument.currentSignature(); + argument.beginStructure(); - argument >> static_cast<QIBusSerializable &>(text); + QIBusSerializable::deserializeFrom(argument); - argument >> text.text; + argument >> text; QDBusVariant variant; argument >> variant; - variant.variant().value<QDBusArgument>() >> text.attributes; + variant.variant().value<QDBusArgument>() >> attributes; argument.endStructure(); - return argument; } QIBusEngineDesc::QIBusEngineDesc() - : engine_name(""), - longname(""), - description(""), - language(""), - license(""), - author(""), - icon(""), - layout(""), - rank(0), - hotkeys(""), - symbol(""), - setup(""), - layout_variant(""), - layout_option(""), - version(""), - textdomain(""), - iconpropkey("") + : rank(0) { name = "IBusEngineDesc"; } -QIBusEngineDesc::~QIBusEngineDesc() -{ -} - -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc) +void QIBusEngineDesc::serializeTo(QDBusArgument &argument) const { argument.beginStructure(); - argument << static_cast<const QIBusSerializable &>(desc); - - argument << desc.engine_name; - argument << desc.longname; - argument << desc.description; - argument << desc.language; - argument << desc.license; - argument << desc.author; - argument << desc.icon; - argument << desc.layout; - argument << desc.rank; - argument << desc.hotkeys; - argument << desc.symbol; - argument << desc.setup; - argument << desc.layout_variant; - argument << desc.layout_option; - argument << desc.version; - argument << desc.textdomain; - argument << desc.iconpropkey; + QIBusSerializable::serializeTo(argument); + + argument << engine_name; + argument << longname; + argument << description; + argument << language; + argument << license; + argument << author; + argument << icon; + argument << layout; + argument << rank; + argument << hotkeys; + argument << symbol; + argument << setup; + argument << layout_variant; + argument << layout_option; + argument << version; + argument << textdomain; + argument << iconpropkey; argument.endStructure(); - return argument; } -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc) +void QIBusEngineDesc::deserializeFrom(const QDBusArgument &argument) { qCDebug(qtQpaInputMethodsSerialize) << "QIBusEngineDesc::fromDBusArgument()" << argument.currentSignature(); argument.beginStructure(); - argument >> static_cast<QIBusSerializable &>(desc); - - argument >> desc.engine_name; - argument >> desc.longname; - argument >> desc.description; - argument >> desc.language; - argument >> desc.license; - argument >> desc.author; - argument >> desc.icon; - argument >> desc.layout; - argument >> desc.rank; - argument >> desc.hotkeys; - argument >> desc.symbol; - argument >> desc.setup; + QIBusSerializable::deserializeFrom(argument); + + argument >> engine_name; + argument >> longname; + argument >> description; + argument >> language; + argument >> license; + argument >> author; + argument >> icon; + argument >> layout; + argument >> rank; + argument >> hotkeys; + argument >> symbol; + argument >> setup; // Previous IBusEngineDesc supports the arguments between engine_name // and setup. - if (argument.currentSignature() == "") { - argument.endStructure(); - return argument; - } - argument >> desc.layout_variant; - argument >> desc.layout_option; + if (argument.currentSignature() == "") + goto olderThanV2; + argument >> layout_variant; + argument >> layout_option; // Previous IBusEngineDesc supports the arguments between engine_name // and layout_option. - if (argument.currentSignature() == "") { - argument.endStructure(); - return argument; - } - argument >> desc.version; - if (argument.currentSignature() == "") { - argument.endStructure(); - return argument; - } - argument >> desc.textdomain; - if (argument.currentSignature() == "") { - argument.endStructure(); - return argument; - } - argument >> desc.iconpropkey; - + if (argument.currentSignature() == "") + goto olderThanV3; + argument >> version; + if (argument.currentSignature() == "") + goto olderThanV4; + argument >> textdomain; + if (argument.currentSignature() == "") + goto olderThanV5; + argument >> iconpropkey; + // <-- insert new member streaming here (1/2) + goto newest; +olderThanV2: + layout_variant.clear(); + layout_option.clear(); +olderThanV3: + version.clear(); +olderThanV4: + textdomain.clear(); +olderThanV5: + iconpropkey.clear(); + // <-- insert new members here (2/2) +newest: argument.endStructure(); - return argument; } QT_END_NAMESPACE diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h index b4145863bc..217cd836fc 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.h +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h @@ -1,31 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -48,13 +54,15 @@ class QIBusSerializable { public: QIBusSerializable(); - virtual ~QIBusSerializable(); + + void serializeTo(QDBusArgument &argument) const; + void deserializeFrom(const QDBusArgument &argument); QString name; QHash<QString, QDBusArgument> attachments; }; -class QIBusAttribute : public QIBusSerializable +class QIBusAttribute : private QIBusSerializable { public: enum Type { @@ -73,42 +81,53 @@ public: }; QIBusAttribute(); - ~QIBusAttribute(); QTextCharFormat format() const; + void serializeTo(QDBusArgument &argument) const; + void deserializeFrom(const QDBusArgument &argument); + Type type; quint32 value; quint32 start; quint32 end; }; +Q_DECLARE_TYPEINFO(QIBusAttribute, Q_MOVABLE_TYPE); -class QIBusAttributeList : public QIBusSerializable +class QIBusAttributeList : private QIBusSerializable { public: QIBusAttributeList(); - ~QIBusAttributeList(); QList<QInputMethodEvent::Attribute> imAttributes() const; + void serializeTo(QDBusArgument &argument) const; + void deserializeFrom(const QDBusArgument &argument); + QVector<QIBusAttribute> attributes; }; +Q_DECLARE_TYPEINFO(QIBusAttributeList, Q_MOVABLE_TYPE); -class QIBusText : public QIBusSerializable +class QIBusText : private QIBusSerializable { public: QIBusText(); - ~QIBusText(); + + void serializeTo(QDBusArgument &argument) const; + void deserializeFrom(const QDBusArgument &argument); QString text; QIBusAttributeList attributes; }; +Q_DECLARE_TYPEINFO(QIBusText, Q_MOVABLE_TYPE); -class QIBusEngineDesc : public QIBusSerializable +class QIBusEngineDesc : private QIBusSerializable { public: QIBusEngineDesc(); - ~QIBusEngineDesc(); + + void serializeTo(QDBusArgument &argument) const; + void deserializeFrom(const QDBusArgument &argument); QString engine_name; QString longname; @@ -128,25 +147,30 @@ public: QString textdomain; QString iconpropkey; }; +Q_DECLARE_TYPEINFO(QIBusEngineDesc, Q_MOVABLE_TYPE); -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusSerializable &object); -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusSerializable &object); - -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute); -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute); +inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute) +{ attribute.serializeTo(argument); return argument; } +inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute) +{ attribute.deserializeFrom(argument); return argument; } -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList); -const QDBusArgument &operator>>(const QDBusArgument &arg, QIBusAttributeList &attrList); +inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList) +{ attributeList.serializeTo(argument); return argument; } +inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttributeList &attributeList) +{ attributeList.deserializeFrom(argument); return argument; } -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text); -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text); +inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text) +{ text.serializeTo(argument); return argument; } +inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text) +{ text.deserializeFrom(argument); return argument; } -QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc); -const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc); +inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc) +{ desc.serializeTo(argument); return argument; } +inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc) +{ desc.deserializeFrom(argument); return argument; } QT_END_NAMESPACE -Q_DECLARE_METATYPE(QIBusSerializable) Q_DECLARE_METATYPE(QIBusAttribute) Q_DECLARE_METATYPE(QIBusAttributeList) Q_DECLARE_METATYPE(QIBusText) |