qskinny/inputcontext/QskInputContextPlugin.cpp

45 lines
1.2 KiB
C++
Raw Normal View History

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"
#include "QskPinyinTextPredictor.h"
#include "QskHunspellTextPredictor.h"
#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
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 )
{
auto context = new QskInputContext();
2018-04-23 14:39:34 +02:00
#if 0
context->registerPredictor( QLocale(),
new QskHunspellTextPredictor( this ) );
#endif
#if 0
context->registerPredictor(
QLocale::Chinese, new QskPinyinTextPredictor( this ) );
#endif
return context;
}
2018-04-01 12:47:44 +02:00
2017-07-21 18:21:34 +02:00
return nullptr;
}
};
#include "QskInputContextPlugin.moc"