From c45f6501f501a65f753604bfd2341035ae12fd30 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 16 Aug 2023 12:49:23 -0400 Subject: Make quick_read_setting() a templated method This allows terser usage and removes the need for manually invoking QVariant's .value() method. --- src/activitypub/apactivity.cpp | 2 +- src/activitypub/appost.cpp | 2 +- src/activitypub/apquestion.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/activitypub') diff --git a/src/activitypub/apactivity.cpp b/src/activitypub/apactivity.cpp index 3bc6444..6717731 100644 --- a/src/activitypub/apactivity.cpp +++ b/src/activitypub/apactivity.cpp @@ -42,7 +42,7 @@ QString APActivity::get_html_render(HtmlRenderDetails render_info) { html.replace("{{object}}", object->get_html_render(render_info)); if (published.isValid()) html.replace("{{published}}", render_info.locale->toString( - SettingsInterface::quick_read_setting("ui/timezone").value() ? published.toUTC() : published.toLocalTime() + SettingsInterface::quick_read_setting("ui/timezone") ? published.toUTC() : published.toLocalTime() )); return html; diff --git a/src/activitypub/appost.cpp b/src/activitypub/appost.cpp index 24a01f5..87d6f08 100644 --- a/src/activitypub/appost.cpp +++ b/src/activitypub/appost.cpp @@ -47,7 +47,7 @@ QString APPost::get_html_render(HtmlRenderDetails render_info) { if (published.isValid()) { // Using QLocale::toString() is forward compatible with Qt 6 as QDateTime::toString() will not return anymore a string in the system locale. html.replace("{{published}}", render_info.locale->toString( - SettingsInterface::quick_read_setting("ui/timezone").value() ? published.toUTC() : published.toLocalTime() + SettingsInterface::quick_read_setting("ui/timezone") ? published.toUTC() : published.toLocalTime() )); } diff --git a/src/activitypub/apquestion.cpp b/src/activitypub/apquestion.cpp index 06fde9e..9cdffd0 100644 --- a/src/activitypub/apquestion.cpp +++ b/src/activitypub/apquestion.cpp @@ -20,12 +20,12 @@ QString APQuestion::get_html_render(HtmlRenderDetails render_info) { if (end_time.isValid()) { html.replace("{{end-time}}", render_info.locale->toString( - SettingsInterface::quick_read_setting("ui/timezone").value() ? end_time.toUTC() : end_time.toLocalTime() + SettingsInterface::quick_read_setting("ui/timezone") ? end_time.toUTC() : end_time.toLocalTime() )); } if (closed_time.isValid()) { html.replace("{{closed-time}}", render_info.locale->toString( - SettingsInterface::quick_read_setting("ui/timezone").value() ? closed_time.toUTC() : closed_time.toLocalTime() + SettingsInterface::quick_read_setting("ui/timezone") ? closed_time.toUTC() : closed_time.toLocalTime() )); } -- cgit v1.2.3-54-g00ecf