mirror-chatterino2/src/controllers/ignores/IgnoreModel.cpp

33 lines
877 B
C++
Raw Normal View History

2018-06-26 14:09:39 +02:00
#include "IgnoreModel.hpp"
2018-05-13 19:24:32 +02:00
2018-06-26 14:09:39 +02:00
#include "Application.hpp"
#include "singletons/SettingsManager.hpp"
#include "util/StandardItemHelper.hpp"
2018-05-13 19:24:32 +02:00
namespace chatterino {
// commandmodel
IgnoreModel::IgnoreModel(QObject *parent)
2018-06-26 17:06:17 +02:00
: SignalVectorModel<IgnorePhrase>(2, parent)
2018-05-13 19:24:32 +02:00
{
}
// turn a vector item into a model row
IgnorePhrase IgnoreModel::getItemFromRow(std::vector<QStandardItem *> &row,
const IgnorePhrase &original)
2018-05-13 19:24:32 +02:00
{
// key, regex
return IgnorePhrase{row[0]->data(Qt::DisplayRole).toString(),
row[1]->data(Qt::CheckStateRole).toBool()};
}
// turns a row in the model into a vector item
void IgnoreModel::getRowFromItem(const IgnorePhrase &item, std::vector<QStandardItem *> &row)
{
2018-06-26 17:06:17 +02:00
setStringItem(row[0], item.getPattern());
setBoolItem(row[1], item.isRegex());
2018-05-13 19:24:32 +02:00
}
} // namespace chatterino