/***************************************************************************
- * Copyright (C) 2005-2018 by the Quassel Project *
+ * Copyright (C) 2005-2022 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "chatmonitorsettingspage.h"
+#include <QMessageBox>
#include <QVariant>
+#include "backlogrequester.h"
+#include "backlogsettings.h"
#include "buffermodel.h"
#include "bufferview.h"
#include "bufferviewconfig.h"
#include "client.h"
#include "icon.h"
#include "networkmodel.h"
+#include "util.h"
ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget* parent)
: SettingsPage(tr("Interface"), tr("Chat Monitor"), parent)
connect(ui.alwaysOwn, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
connect(ui.showBacklog, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
connect(ui.includeRead, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged);
+
+ // AsNeededBacklogRequester conflicts with showing backlog in Chat Monitor
+ BacklogSettings backlogSettings;
+ backlogSettings.initAndNotify("RequesterType", this, &ChatMonitorSettingsPage::setRequesterType, BacklogRequester::AsNeeded);
}
bool ChatMonitorSettingsPage::hasDefaults() const
allBufferIds.removeAll(v.value<BufferId>());
}
Client::networkModel()->sortBufferIds(bufferIdsFromConfig);
- _configActive->initSetBufferList(bufferIdsFromConfig);
+ _configActive->setBufferList(bufferIdsFromConfig);
}
ui.activeBuffers->setFilteredModel(Client::bufferModel(), _configActive);
Client::networkModel()->sortBufferIds(allBufferIds);
- _configAvailable->initSetBufferList(allBufferIds);
+ _configAvailable->setBufferList(allBufferIds);
ui.availableBuffers->setFilteredModel(Client::bufferModel(), _configAvailable);
setChangedState(false);
// save list of active buffers
QVariantList saveableBufferIdList;
foreach (BufferId id, _configActive->bufferList()) {
- saveableBufferIdList << QVariant::fromValue<BufferId>(id);
+ saveableBufferIdList << QVariant::fromValue(id);
}
chatViewSettings.setValue("Buffers", saveableBufferIdList);
if (_configActive->bufferList().count() != settings["Buffers"].toList().count())
return true;
- QSet<BufferId> uiBufs = _configActive->bufferList().toSet();
+ QSet<BufferId> uiBufs = toQSet(_configActive->bufferList());
QSet<BufferId> settingsBufs;
foreach (QVariant v, settings["Buffers"].toList())
settingsBufs << v.value<BufferId>();
}
widgetHasChanged();
}
+
+void ChatMonitorSettingsPage::setRequesterType(const QVariant& v)
+{
+ bool usingAsNeededRequester = (v.toInt() == BacklogRequester::AsNeeded);
+ ui.showBacklogUnavailableDetails->setVisible(usingAsNeededRequester);
+ if (usingAsNeededRequester) {
+ ui.showBacklog->setText(tr("Show messages from backlog (not available)"));
+ }
+ else {
+ ui.showBacklog->setText(tr("Show messages from backlog"));
+ }
+}
+
+void ChatMonitorSettingsPage::on_showBacklogUnavailableDetails_clicked()
+{
+ // Explain that backlog fetching is disabled, so backlog messages won't show up
+ //
+ // Technically, backlog messages *will* show up once fetched, e.g. after clicking on a buffer.
+ // This might be too trivial of a detail to warrant explaining, though.
+ QMessageBox::information(this,
+ tr("Messages from backlog are not fetched"),
+ QString("<p>%1</p><p>%2</p>")
+ .arg(tr("No initial backlog will be fetched when using the backlog request method of <i>%1</i>.")
+ .arg(tr("Only fetch when needed").replace(" ", " ")),
+ tr("Configure this in the <i>%1</i> settings page.")
+ .arg(tr("Backlog Fetching").replace(" ", " "))
+ )
+ );
+ // Re-use translations of "Only fetch when needed" and "Backlog Fetching" as this is a
+ // word-for-word reference, forcing all spaces to be non-breaking
+}