2018-07-05 15:58:20 +02:00
|
|
|
#include "UserHighlightModel.hpp"
|
|
|
|
|
|
|
|
#include "Application.hpp"
|
|
|
|
#include "singletons/Settings.hpp"
|
|
|
|
#include "util/StandardItemHelper.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
// commandmodel
|
|
|
|
UserHighlightModel::UserHighlightModel(QObject *parent)
|
|
|
|
: SignalVectorModel<HighlightPhrase>(4, parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// turn vector item into model row
|
2018-08-06 21:17:03 +02:00
|
|
|
HighlightPhrase UserHighlightModel::getItemFromRow(
|
|
|
|
std::vector<QStandardItem *> &row, const HighlightPhrase &original)
|
2018-07-05 15:58:20 +02:00
|
|
|
{
|
|
|
|
// key, regex
|
|
|
|
|
2018-08-06 21:17:03 +02:00
|
|
|
return HighlightPhrase{row[0]->data(Qt::DisplayRole).toString(),
|
|
|
|
row[1]->data(Qt::CheckStateRole).toBool(),
|
|
|
|
row[2]->data(Qt::CheckStateRole).toBool(),
|
|
|
|
row[3]->data(Qt::CheckStateRole).toBool()};
|
2018-07-05 15:58:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// row into vector item
|
|
|
|
void UserHighlightModel::getRowFromItem(const HighlightPhrase &item,
|
|
|
|
std::vector<QStandardItem *> &row)
|
|
|
|
{
|
|
|
|
setStringItem(row[0], item.getPattern());
|
|
|
|
setBoolItem(row[1], item.getAlert());
|
|
|
|
setBoolItem(row[2], item.getSound());
|
|
|
|
setBoolItem(row[3], item.isRegex());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace chatterino
|