X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fsuggester.h;h=d5293c39ea510fc1f0c2b835c5ba218842abe0bf;hb=HEAD;hp=e14492f1320ff11ecefa6720033d064d563a12a3;hpb=7cdd5bd476021ec84d54c4ec5be02280e1e9e548;p=minitube diff --git a/src/suggester.h b/src/suggester.h index e14492f..d5293c3 100644 --- a/src/suggester.h +++ b/src/suggester.h @@ -21,19 +21,50 @@ $END_LICENSE */ #ifndef SUGGESTER_H #define SUGGESTER_H -#include +#include + +class Suggestion { + +public: + Suggestion(QString value = QString(), + QString type = QString(), + QString userData = QString()) : + value(value), type(type), userData(userData) { } + QString value; + QString type; + QString userData; + + bool operator==(const Suggestion &other) const { + return (value == other.value) && (type == other.type); + } + + bool operator!=(const Suggestion &other) const { + return !(*this == other); + } + + bool operator==(Suggestion *other) const { + qDebug() << "Comparing" << this << other; + return (value == other->value) && (type == other->type); + } + + bool operator!=(Suggestion *other) const { + return !(this == other); + } + +}; class Suggester : public QObject { Q_OBJECT public: - Suggester(QObject *parent = 0) : QObject(parent) { } - virtual void suggest(QString query) = 0; + Suggester(QObject *parent) : QObject(parent) { } + virtual void suggest(const QString &query) = 0; signals: - void ready(QStringList); + void ready(const QVector &suggestions); }; #endif // SUGGESTER_H +