See #734. Thanks to Adam Harwood for rebasing this. ~Sput
QString showHighlightsSettingsId = "ShowHighlights";
QString operationModeSettingsId = "OperationMode";
QString buffersSettingsId = "Buffers";
QString showHighlightsSettingsId = "ShowHighlights";
QString operationModeSettingsId = "OperationMode";
QString buffersSettingsId = "Buffers";
+ QString showBacklogSettingsId = "ShowBacklog";
_showHighlights = viewSettings.value(showHighlightsSettingsId, false).toBool();
_operationMode = viewSettings.value(operationModeSettingsId, 0).toInt();
// read configured list of buffers to monitor/ignore
foreach(QVariant v, viewSettings.value(buffersSettingsId, QVariant()).toList())
_bufferIds << v.value<BufferId>();
_showHighlights = viewSettings.value(showHighlightsSettingsId, false).toBool();
_operationMode = viewSettings.value(operationModeSettingsId, 0).toInt();
// read configured list of buffers to monitor/ignore
foreach(QVariant v, viewSettings.value(buffersSettingsId, QVariant()).toList())
_bufferIds << v.value<BufferId>();
+ _showBacklog = viewSettings.value(showBacklogSettingsId, true).toBool();
viewSettings.notify(showHighlightsSettingsId, this, SLOT(showHighlightsSettingChanged(const QVariant &)));
viewSettings.notify(operationModeSettingsId, this, SLOT(operationModeSettingChanged(const QVariant &)));
viewSettings.notify(buffersSettingsId, this, SLOT(buffersSettingChanged(const QVariant &)));
viewSettings.notify(showHighlightsSettingsId, this, SLOT(showHighlightsSettingChanged(const QVariant &)));
viewSettings.notify(operationModeSettingsId, this, SLOT(operationModeSettingChanged(const QVariant &)));
viewSettings.notify(buffersSettingsId, this, SLOT(buffersSettingChanged(const QVariant &)));
+ viewSettings.notify(showBacklogSettingsId, this, SLOT(showBacklogSettingChanged(const QVariant &)));
Q_UNUSED(sourceParent)
QModelIndex source_index = sourceModel()->index(sourceRow, 0);
Q_UNUSED(sourceParent)
QModelIndex source_index = sourceModel()->index(sourceRow, 0);
+ BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
- if (flags & Message::Backlog || (!_showOwnMessages && flags & Message::Self))
+ if ((flags & Message::Backlog) && (!_showBacklog ||
+ (Client::networkModel()->lastSeenMsgId(bufferId) >= sourceModel()->data(source_index, MessageModel::MsgIdRole).value<MsgId>())))
+ return false;
+
+ if (!_showOwnMessages && flags & Message::Self)
return false;
Message::Type type = (Message::Type)source_index.data(MessageModel::TypeRole).toInt();
if (!(type & (Message::Plain | Message::Notice | Message::Action)))
return false;
return false;
Message::Type type = (Message::Type)source_index.data(MessageModel::TypeRole).toInt();
if (!(type & (Message::Plain | Message::Notice | Message::Action)))
return false;
- BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
-
// ChatMonitorSettingsPage
if (_operationMode == ChatViewSettings::OptOut
&& !(_showHighlights && flags & Message::Highlight)
// ChatMonitorSettingsPage
if (_operationMode == ChatViewSettings::OptOut
&& !(_showHighlights && flags & Message::Highlight)
+
+void ChatMonitorFilter::showBacklogSettingChanged(const QVariant &newValue) {
+ _showBacklog = newValue.toBool();
+}
void showHighlightsSettingChanged(const QVariant &newValue);
void operationModeSettingChanged(const QVariant &newValue);
void buffersSettingChanged(const QVariant &newValue);
void showHighlightsSettingChanged(const QVariant &newValue);
void operationModeSettingChanged(const QVariant &newValue);
void buffersSettingChanged(const QVariant &newValue);
+ void showBacklogSettingChanged(const QVariant &newValue);
private:
int _showFields;
private:
int _showFields;
QList<BufferId> _bufferIds;
bool _showHighlights;
int _operationMode;
QList<BufferId> _bufferIds;
bool _showHighlights;
int _operationMode;
connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int)));
connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int)));
connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+ connect(ui.showBacklog, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
settings["ShowOwnMsgs"] = false;
settings["Buffers"] = QVariant();
settings["Default"] = true;
settings["ShowOwnMsgs"] = false;
settings["Buffers"] = QVariant();
settings["Default"] = true;
+ settings["ShowBacklog"] = true;
load();
widgetHasChanged();
}
load();
widgetHasChanged();
}
ui.operationMode->setCurrentIndex(settings["OperationMode"].toInt() - 1);
ui.showHighlights->setChecked(settings["ShowHighlights"].toBool());
ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool());
ui.operationMode->setCurrentIndex(settings["OperationMode"].toInt() - 1);
ui.showHighlights->setChecked(settings["ShowHighlights"].toBool());
ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool());
+ ui.showBacklog->setChecked(settings["ShowBacklog"].toBool());
// get all available buffer Ids
QList<BufferId> allBufferIds = Client::networkModel()->allBufferIds();
// get all available buffer Ids
QList<BufferId> allBufferIds = Client::networkModel()->allBufferIds();
settings["ShowHighlights"] = chatViewSettings.value("ShowHighlights", false);
settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
settings["ShowHighlights"] = chatViewSettings.value("ShowHighlights", false);
settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
+ settings["ShowBacklog"] = chatViewSettings.value("ShowBacklog", true);
chatViewSettings.setValue("OperationMode", ui.operationMode->currentIndex() + 1);
chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked());
chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked());
chatViewSettings.setValue("OperationMode", ui.operationMode->currentIndex() + 1);
chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked());
chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked());
+ chatViewSettings.setValue("ShowBacklog", ui.showBacklog->isChecked());
// save list of active buffers
QVariantList saveableBufferIdList;
// save list of active buffers
QVariantList saveableBufferIdList;
</property>
</widget>
</item>
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="showBacklog">
+ <property name="toolTip">
+ <string>Display messages from backlog on reconnect</string>
+ </property>
+ <property name="text">
+ <string>Show messages from backlog</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
</layout>
</widget>
<customwidgets>