5957551d06
* Support for user-defined sounds and colors * Make color & sound columns selectable * Add custom row for subscription highlights * Add subscriptions to custom highlights and centrally manage highlight colors * Dynamically update message highlight colors
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#include "controllers/highlights/HighlightBlacklistModel.hpp"
|
|
|
|
#include "Application.hpp"
|
|
#include "singletons/Settings.hpp"
|
|
#include "util/StandardItemHelper.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
// commandmodel
|
|
HighlightBlacklistModel::HighlightBlacklistModel(QObject *parent)
|
|
: SignalVectorModel<HighlightBlacklistUser>(2, parent)
|
|
{
|
|
}
|
|
|
|
// turn a vector item into a model row
|
|
HighlightBlacklistUser HighlightBlacklistModel::getItemFromRow(
|
|
std::vector<QStandardItem *> &row, const HighlightBlacklistUser &original)
|
|
{
|
|
// key, regex
|
|
|
|
return HighlightBlacklistUser{
|
|
row[Column::Pattern]->data(Qt::DisplayRole).toString(),
|
|
row[Column::UseRegex]->data(Qt::CheckStateRole).toBool()};
|
|
}
|
|
|
|
// turns a row in the model into a vector item
|
|
void HighlightBlacklistModel::getRowFromItem(const HighlightBlacklistUser &item,
|
|
std::vector<QStandardItem *> &row)
|
|
{
|
|
setStringItem(row[Column::Pattern], item.getPattern());
|
|
setBoolItem(row[Column::UseRegex], item.isRegex());
|
|
}
|
|
|
|
} // namespace chatterino
|