2018-02-06 14:55:35 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
#include <qpa/qplatforminputcontextplugin_p.h>
|
|
|
|
|
|
|
|
#include "QskInputContext.h"
|
2018-04-26 14:42:33 +02:00
|
|
|
#include "QskPinyinTextPredictor.h"
|
|
|
|
#include "QskHunspellTextPredictor.h"
|
2018-04-23 14:37:17 +02:00
|
|
|
|
|
|
|
#include <QLocale>
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-04-01 12:47:44 +02:00
|
|
|
class QskInputContextPlugin final : public QPlatformInputContextPlugin
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-03-30 18:31:13 +02:00
|
|
|
Q_PLUGIN_METADATA( IID QPlatformInputContextFactoryInterface_iid FILE "metadata.json" )
|
2018-04-01 12:47:44 +02:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
public:
|
2018-04-01 12:47:44 +02:00
|
|
|
virtual QPlatformInputContext* create(
|
|
|
|
const QString& system, const QStringList& ) override
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2018-04-01 12:47:44 +02:00
|
|
|
if ( system.compare( QStringLiteral( "skinny" ), Qt::CaseInsensitive ) == 0 )
|
2018-04-23 14:37:17 +02:00
|
|
|
{
|
|
|
|
auto context = new QskInputContext();
|
|
|
|
|
2018-04-23 14:39:34 +02:00
|
|
|
#if 0
|
2018-04-26 14:42:33 +02:00
|
|
|
context->registerPredictor( QLocale(),
|
|
|
|
new QskHunspellTextPredictor( this ) );
|
2018-04-23 14:37:17 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
2018-04-26 14:42:33 +02:00
|
|
|
context->registerPredictor(
|
|
|
|
QLocale::Chinese, new QskPinyinTextPredictor( this ) );
|
2018-04-23 14:37:17 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return context;
|
|
|
|
}
|
2018-04-01 12:47:44 +02:00
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#include "QskInputContextPlugin.moc"
|