When the show backlog option is used, give users the option to include previously read messages.
QString operationModeSettingsId = "OperationMode";
QString buffersSettingsId = "Buffers";
QString showBacklogSettingsId = "ShowBacklog";
QString operationModeSettingsId = "OperationMode";
QString buffersSettingsId = "Buffers";
QString showBacklogSettingsId = "ShowBacklog";
+ QString includeReadSettingsId = "IncludeRead";
_showHighlights = viewSettings.value(showHighlightsSettingsId, false).toBool();
_operationMode = viewSettings.value(operationModeSettingsId, 0).toInt();
_showHighlights = viewSettings.value(showHighlightsSettingsId, false).toBool();
_operationMode = viewSettings.value(operationModeSettingsId, 0).toInt();
foreach(QVariant v, viewSettings.value(buffersSettingsId, QVariant()).toList())
_bufferIds << v.value<BufferId>();
_showBacklog = viewSettings.value(showBacklogSettingsId, true).toBool();
foreach(QVariant v, viewSettings.value(buffersSettingsId, QVariant()).toList())
_bufferIds << v.value<BufferId>();
_showBacklog = viewSettings.value(showBacklogSettingsId, true).toBool();
+ _includeRead = viewSettings.value(includeReadSettingsId, 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(showBacklogSettingsId, this, SLOT(showBacklogSettingChanged(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 &)));
+ viewSettings.notify(includeReadSettingsId, this, SLOT(includeReadSettingChanged(const QVariant &)));
BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
BufferId bufferId = source_index.data(MessageModel::BufferIdRole).value<BufferId>();
Message::Flags flags = (Message::Flags)source_index.data(MessageModel::FlagsRole).toInt();
- if ((flags & Message::Backlog) && (!_showBacklog ||
- (Client::networkModel()->lastSeenMsgId(bufferId) >= sourceModel()->data(source_index, MessageModel::MsgIdRole).value<MsgId>())))
+ if ((flags & Message::Backlog) && (!_showBacklog || (!_includeRead &&
+ (Client::networkModel()->lastSeenMsgId(bufferId) >= sourceModel()->data(source_index, MessageModel::MsgIdRole).value<MsgId>()))))
return false;
if (!_showOwnMessages && flags & Message::Self)
return false;
if (!_showOwnMessages && flags & Message::Self)
void ChatMonitorFilter::showBacklogSettingChanged(const QVariant &newValue) {
_showBacklog = newValue.toBool();
}
void ChatMonitorFilter::showBacklogSettingChanged(const QVariant &newValue) {
_showBacklog = newValue.toBool();
}
+
+void ChatMonitorFilter::includeReadSettingChanged(const QVariant &newValue) {
+ _includeRead = newValue.toBool();
+}
void operationModeSettingChanged(const QVariant &newValue);
void buffersSettingChanged(const QVariant &newValue);
void showBacklogSettingChanged(const QVariant &newValue);
void operationModeSettingChanged(const QVariant &newValue);
void buffersSettingChanged(const QVariant &newValue);
void showBacklogSettingChanged(const QVariant &newValue);
+ void includeReadSettingChanged(const QVariant &newValue);
private:
int _showFields;
private:
int _showFields;
bool _showHighlights;
int _operationMode;
bool _showBacklog;
bool _showHighlights;
int _operationMode;
bool _showBacklog;
connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showBacklog, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.showBacklog, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
+ connect(ui.includeRead, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
settings["Buffers"] = QVariant();
settings["Default"] = true;
settings["ShowBacklog"] = true;
settings["Buffers"] = QVariant();
settings["Default"] = true;
settings["ShowBacklog"] = true;
+ settings["IncludeRead"] = false;
load();
widgetHasChanged();
}
load();
widgetHasChanged();
}
ui.showHighlights->setChecked(settings["ShowHighlights"].toBool());
ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool());
ui.showBacklog->setChecked(settings["ShowBacklog"].toBool());
ui.showHighlights->setChecked(settings["ShowHighlights"].toBool());
ui.showOwnMessages->setChecked(settings["ShowOwnMsgs"].toBool());
ui.showBacklog->setChecked(settings["ShowBacklog"].toBool());
+ ui.includeRead->setChecked(settings["IncludeRead"].toBool());
// get all available buffer Ids
QList<BufferId> allBufferIds = Client::networkModel()->allBufferIds();
// get all available buffer Ids
QList<BufferId> allBufferIds = Client::networkModel()->allBufferIds();
settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
settings["ShowBacklog"] = chatViewSettings.value("ShowBacklog", true);
settings["ShowOwnMsgs"] = chatViewSettings.value("ShowOwnMsgs", false);
settings["Buffers"] = chatViewSettings.value("Buffers", QVariantList());
settings["ShowBacklog"] = chatViewSettings.value("ShowBacklog", true);
+ settings["IncludeRead"] = chatViewSettings.value("IncludeRead", true);
chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked());
chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked());
chatViewSettings.setValue("ShowBacklog", ui.showBacklog->isChecked());
chatViewSettings.setValue("ShowHighlights", ui.showHighlights->isChecked());
chatViewSettings.setValue("ShowOwnMsgs", ui.showOwnMessages->isChecked());
chatViewSettings.setValue("ShowBacklog", ui.showBacklog->isChecked());
+ chatViewSettings.setValue("IncludeRead", ui.includeRead->isChecked());
// save list of active buffers
QVariantList saveableBufferIdList;
// save list of active buffers
QVariantList saveableBufferIdList;
return true;
if (settings["ShowOwnMsgs"].toBool() != ui.showOwnMessages->isChecked())
return true;
return true;
if (settings["ShowOwnMsgs"].toBool() != ui.showOwnMessages->isChecked())
return true;
+ if (settings["ShowBacklog"].toBool() != ui.showBacklog->isChecked())
+ return true;
+ if (settings["IncludeRead"].toBool() != ui.includeRead->isChecked())
+ return true;
if (_configActive->bufferList().count() != settings["Buffers"].toList().count())
return true;
if (_configActive->bufferList().count() != settings["Buffers"].toList().count())
return true;
</property>
</widget>
</item>
</property>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="includeRead">
+ <property name="toolTip">
+ <string>Include read messages from backlog on reconnect</string>
+ </property>
+ <property name="text">
+ <string>Include read messages</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<customwidgets>
</layout>
</widget>
<customwidgets>
<tabstop>activeBuffers</tabstop>
<tabstop>showHighlights</tabstop>
<tabstop>showOwnMessages</tabstop>
<tabstop>activeBuffers</tabstop>
<tabstop>showHighlights</tabstop>
<tabstop>showOwnMessages</tabstop>
+ <tabstop>showBacklog</tabstop>
+ <tabstop>includeRead</tabstop>
+ <connections>
+ <connection>
+ <sender>showBacklog</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>includeRead</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ </connections>