X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fchatmonitorsettingspage.cpp;h=8a8faf7ca2b9816fda65da9490246233b1d66c8f;hp=16c3627fbfa1c310ccda289abd93f221969c4846;hb=HEAD;hpb=a95ad2de573027f9bee36db972bcae4195168d0c diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index 16c3627f..592103c6 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2020 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 * @@ -20,8 +20,11 @@ #include "chatmonitorsettingspage.h" +#include #include +#include "backlogrequester.h" +#include "backlogsettings.h" #include "buffermodel.h" #include "bufferview.h" #include "bufferviewconfig.h" @@ -67,6 +70,10 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget* 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 @@ -279,3 +286,34 @@ void ChatMonitorSettingsPage::switchOperationMode(int idx) } 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("

%1

%2

") + .arg(tr("No initial backlog will be fetched when using the backlog request method of %1.") + .arg(tr("Only fetch when needed").replace(" ", " ")), + tr("Configure this in the %1 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 +}