2018-02-06 13:55:35 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-04-26 12:42:33 +00:00
|
|
|
#ifndef QSK_TEXT_PREDICTOR_H
|
|
|
|
#define QSK_TEXT_PREDICTOR_H
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-04-26 12:42:33 +00:00
|
|
|
#include <QskGlobal.h>
|
2018-07-19 12:10:48 +00:00
|
|
|
#include <qobject.h>
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-04-26 12:42:33 +00:00
|
|
|
// abstract base class for input methods for retrieving predictive text
|
|
|
|
|
|
|
|
class QSK_EXPORT QskTextPredictor : public QObject
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
public:
|
2018-04-20 06:52:26 +00:00
|
|
|
enum Attribute
|
|
|
|
{
|
|
|
|
Words = 1 << 0
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_ENUM( Attribute )
|
|
|
|
Q_DECLARE_FLAGS( Attributes, Attribute )
|
|
|
|
|
2018-07-31 15:32:25 +00:00
|
|
|
~QskTextPredictor() override;
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-04-26 12:42:33 +00:00
|
|
|
virtual void request( const QString& text ) = 0;
|
|
|
|
virtual void reset() = 0;
|
2018-04-20 06:52:26 +00:00
|
|
|
|
|
|
|
virtual int candidateCount() const = 0;
|
|
|
|
virtual QString candidate( int ) const = 0;
|
2018-03-30 08:15:05 +00:00
|
|
|
|
2018-06-04 08:00:52 +00:00
|
|
|
virtual QStringList candidates() const;
|
|
|
|
|
2018-04-20 06:52:26 +00:00
|
|
|
Attributes attributes() const;
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
Q_SIGNALS:
|
2018-04-26 12:42:33 +00:00
|
|
|
void predictionChanged();
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
protected:
|
2018-04-26 12:42:33 +00:00
|
|
|
QskTextPredictor( Attributes, QObject* );
|
2018-04-23 12:06:40 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
private:
|
2018-04-20 06:52:26 +00:00
|
|
|
const Attributes m_attributes;
|
|
|
|
};
|
2018-04-11 09:02:29 +00:00
|
|
|
|
2018-03-30 16:31:13 +00:00
|
|
|
#endif
|