mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
|
#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
|
||
|
HighlightPhrase UserHighlightModel::getItemFromRow(std::vector<QStandardItem *> &row,
|
||
|
const HighlightPhrase &original)
|
||
|
{
|
||
|
// key, regex
|
||
|
|
||
|
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()};
|
||
|
}
|
||
|
|
||
|
// 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
|