Add highlighting of all messages from a certain user (#564)

* Rework to use controllers

* Rework to use controllers

* Add doHighlight

* Cherry pick?

* Fixes per PR

* Remove file
This commit is contained in:
DatGuy1
2018-07-05 16:58:20 +03:00
committed by fourtf
parent eb69cbf5f5
commit 9c7c99928f
7 changed files with 135 additions and 0 deletions
@@ -3,6 +3,7 @@
#include "Application.hpp"
#include "controllers/highlights/HighlightBlacklistModel.hpp"
#include "controllers/highlights/HighlightModel.hpp"
#include "controllers/highlights/UserHighlightModel.hpp"
#include "widgets/dialogs/NotificationPopup.hpp"
namespace chatterino {
@@ -33,6 +34,26 @@ HighlightModel *HighlightController::createModel(QObject *parent)
return model;
}
UserHighlightModel *HighlightController::createUserModel(QObject *parent)
{
auto *model = new UserHighlightModel(parent);
model->init(&this->highlightedUsers);
return model;
}
bool HighlightController::isHighlightedUser(const QString &username)
{
const auto &userItems = this->highlightedUsers.getVector();
for (const auto &highlightedUser : userItems) {
if (highlightedUser.isMatch(username)) {
return true;
}
}
return false;
}
HighlightBlacklistModel *HighlightController::createBlacklistModel(QObject *parent)
{
auto *model = new HighlightBlacklistModel(parent);