2017-07-09 17:58:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-07-23 14:16:13 +02:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QVector>
|
2017-07-09 17:58:59 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2017-07-23 14:16:13 +02:00
|
|
|
class EmoteManager;
|
|
|
|
|
|
|
|
class CompletionModel : public QAbstractListModel
|
2017-07-09 17:58:59 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual int columnCount(const QModelIndex & /*parent*/) const override
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role) const override
|
|
|
|
{
|
2017-07-23 14:16:13 +02:00
|
|
|
// TODO: Implement more safely
|
|
|
|
return QVariant(this->emotes.at(index.row()));
|
2017-07-09 17:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual int rowCount(const QModelIndex &parent) const override
|
|
|
|
{
|
2017-07-23 14:16:13 +02:00
|
|
|
return this->emotes.size();
|
2017-07-09 17:58:59 +02:00
|
|
|
}
|
2017-07-23 14:16:13 +02:00
|
|
|
|
|
|
|
QVector<QString> emotes;
|
2017-07-09 17:58:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CompletionManager
|
|
|
|
{
|
2017-07-23 14:16:13 +02:00
|
|
|
CompletionManager(EmoteManager &_emoteManager);
|
|
|
|
|
|
|
|
EmoteManager &emoteManager;
|
2017-07-09 17:58:59 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
CompletionModel *createModel(const std::string &channelName);
|
2017-07-23 14:16:13 +02:00
|
|
|
void updateModel(CompletionModel *model, const std::string &channelName = std::string());
|
2017-07-09 17:58:59 +02:00
|
|
|
|
|
|
|
friend class Application;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|