Add option to use server timestamp from the message instead of the local clock time for logging. (#6346)

This commit is contained in:
droidicus
2025-07-27 06:11:13 -04:00
committed by GitHub
parent 154c436063
commit 1423f548a7
6 changed files with 45 additions and 3 deletions
@@ -13,6 +13,7 @@
#include "util/PostToThread.hpp"
#include "widgets/helper/EditableModelView.hpp"
#include "widgets/helper/IconDelegate.hpp"
#include "widgets/settingspages/SettingWidget.hpp"
#include <QFileDialog>
#include <QHBoxLayout>
@@ -165,6 +166,18 @@ ModerationPage::ModerationPage()
logTimestampFormat->setToolTip("a = am/pm, zzz = milliseconds");
logsTimestampFormatLayout.append(logTimestampFormat);
SettingWidget::checkbox("Use Twitch's timestamps",
getSettings()->tryUseTwitchTimestamps)
->setTooltip(
"Try to use Twitch's timestamp (the time when the message was "
"received by Twitch's chat server), rather than your "
"computer's local timestamp.\nNote that using this setting can "
"result in out-of-order timestamps in the log files, and that "
"if Twitch's timestamp was unavailable for a message, it will "
"fall back to your computer's local timestamp.")
->conditionallyEnabledBy(getSettings()->enableLogging)
->addToLayout(logs->layout());
QCheckBox *onlyLogListedChannels =
this->createCheckBox("Only log channels listed below",
getSettings()->onlyLogListedChannels);
@@ -590,6 +590,17 @@ void SettingWidget::addTo(GeneralPageView &view, QFormLayout *formLayout)
formLayout->addRow(this->label, this->actionWidget);
}
void SettingWidget::addToLayout(QLayout *layout)
{
if (this->label == this->actionWidget)
{
layout->addWidget(this->actionWidget);
return;
}
assert(false && "unimplemented");
}
void SettingWidget::registerWidget(GeneralPageView &view)
{
if (this->label != nullptr)
@@ -20,6 +20,7 @@
#include <vector>
class QFormLayout;
class QLayout;
namespace chatterino {
@@ -121,6 +122,9 @@ public:
void addTo(GeneralPageView &view);
void addTo(GeneralPageView &view, QFormLayout *formLayout);
/// For settings pages without a page view
void addToLayout(QLayout *layout);
private:
/// Registers this widget & its optional label to the given page view
void registerWidget(GeneralPageView &view);