mirror-chatterino2/src/completionmanager.hpp
Rasmus Karlsson 3bf111a091 More progress on tab-complete
There are missing parts to the "account-based" emotes that needs to be
completed before emote completion can be considered done. For now, when
I've been testing, I've been manually injecting the oauthClient and
oauthToken to the settings file with the `user_subscriptions` scope
2017-07-23 14:16:13 +02:00

48 lines
969 B
C++

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