mirror-chatterino2/src/controllers/ignores/IgnoreController.cpp
2018-06-26 14:09:39 +02:00

37 lines
821 B
C++

#include "controllers/ignores/IgnoreController.hpp"
#include "Application.hpp"
#include "controllers/ignores/IgnoreModel.hpp"
#include <cassert>
namespace chatterino {
namespace controllers {
namespace ignores {
void IgnoreController::initialize()
{
assert(!this->initialized);
this->initialized = true;
for (const IgnorePhrase &phrase : this->ignoresSetting.getValue()) {
this->phrases.appendItem(phrase);
}
this->phrases.delayedItemsChanged.connect([this] { //
this->ignoresSetting.setValue(this->phrases.getVector());
});
}
IgnoreModel *IgnoreController::createModel(QObject *parent)
{
IgnoreModel *model = new IgnoreModel(parent);
model->init(&this->phrases);
return model;
}
} // namespace ignores
} // namespace controllers
} // namespace chatterino