+ QModelIndex source_index = mapToSource(index);
+
+ QStringList fields;
+ if (_showFields & NetworkField) {
+ fields << Client::networkModel()->networkName(bufid);
+ }
+ if (_showFields & BufferField) {
+ fields << Client::networkModel()->bufferName(bufid);
+ }
+
+ Message::Type messageType = (Message::Type)source_index.data(MessageModel::TypeRole).toInt();
+ if (messageType & (Message::Plain | Message::Notice)) {
+ QString sender = MessageFilter::data(index, ChatLineModel::EditRole).toString();
+ fields << sender;
+ }
+ return QString("<%1>").arg(fields.join(":"));
+}
+
+
+void ChatMonitorFilter::addShowField(int field)
+{
+ if (_showFields & field)
+ return;
+
+ ChatViewSettings(idString()).setValue("ShowFields", _showFields | field);
+}
+
+
+void ChatMonitorFilter::removeShowField(int field)
+{
+ if (!(_showFields & field))
+ return;
+
+ ChatViewSettings(idString()).setValue("ShowFields", _showFields ^ field);
+}
+
+
+void ChatMonitorFilter::setShowOwnMessages(bool show)
+{
+ if (_showOwnMessages == show)
+ return;
+
+ ChatViewSettings(idString()).setValue("ShowOwnMsgs", show);
+}
+
+
+void ChatMonitorFilter::showFieldsSettingChanged(const QVariant &newValue)
+{
+ int newFields = newValue.toInt();
+ if (_showFields == newFields)
+ return;
+
+ _showFields = newFields;
+
+ int rows = rowCount();
+ if (rows == 0)
+ return;
+
+ emit dataChanged(index(0, ChatLineModel::SenderColumn), index(rows - 1, ChatLineModel::SenderColumn));
+}
+
+
+void ChatMonitorFilter::showOwnMessagesSettingChanged(const QVariant &newValue)
+{
+ _showOwnMessages = newValue.toBool();
+}
+
+
+void ChatMonitorFilter::showHighlightsSettingChanged(const QVariant &newValue)
+{
+ _showHighlights = newValue.toBool();
+}
+
+
+void ChatMonitorFilter::operationModeSettingChanged(const QVariant &newValue)
+{
+ _operationMode = newValue.toInt();
+}
+
+
+void ChatMonitorFilter::buffersSettingChanged(const QVariant &newValue)
+{
+ _bufferIds.clear();
+ foreach(QVariant v, newValue.toList()) {
+ _bufferIds << v.value<BufferId>();
+ }
+ invalidateFilter();
+}
+
+void ChatMonitorFilter::showBacklogSettingChanged(const QVariant &newValue) {
+ _showBacklog = newValue.toBool();
+}