From 3f2a4410efb34ab9c9da9a4e4956e09f5456cc3a Mon Sep 17 00:00:00 2001 From: Qoole <2862661+qoole@users.noreply.github.com> Date: Tue, 26 May 2026 20:20:19 +0100 Subject: [PATCH] perf(activity): inline FolderMan::instance() and avoid string concat in hot path - FolderMan::instance(): make it an inline accessor returning the static pointer, removing the out-of-line call overhead at every use site without adding any local caching or extra complexity. - ActivityListModel::convertLinkToActionButton: move the reply icon URL construction inside the isReplyIconApplicable branch and bake the trailing slash into the string literal so the path is a single immutable QString instead of two QString::operator+ allocations. Signed-off-by: Qoole <2862661+qoole@users.noreply.github.com> --- src/gui/folderman.cpp | 5 ----- src/gui/folderman.h | 2 +- src/gui/tray/activitylistmodel.cpp | 9 +++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 138c7c207aac5..c31565bdb7ac8 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -97,11 +97,6 @@ FolderMan::FolderMan(QObject *parent) connect(this, &FolderMan::folderListChanged, this, &FolderMan::slotSetupPushNotifications); } -FolderMan *FolderMan::instance() -{ - return _instance; -} - FolderMan::~FolderMan() { qDeleteAll(_folderMap); diff --git a/src/gui/folderman.h b/src/gui/folderman.h index c74e1832861a6..575cafd881c1a 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -80,7 +80,7 @@ class FolderMan : public QObject }; ~FolderMan() override; - static FolderMan *instance(); + static FolderMan *instance() { return _instance; } int setupFolders(); int setupFoldersMigration(); diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 9034750791f0d..7cbeafa2c3c3f 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -963,11 +963,12 @@ QVariant ActivityListModel::convertLinkToActionButton(const OCC::ActivityLink &a const auto isReplyIconApplicable = activityLink._verb == QStringLiteral("REPLY"); - const QString replyButtonPath = QStringLiteral("image://svgimage-custom-color/reply.svg"); - if (isReplyIconApplicable) { - activityLinkCopy._imageSource = QString(replyButtonPath + "/"); - activityLinkCopy._imageSourceHovered = QString(replyButtonPath + "/"); + using namespace Qt::StringLiterals; + + const auto replyButtonPath = u"image://svgimage-custom-color/reply.svg/"_s; + activityLinkCopy._imageSource = replyButtonPath; + activityLinkCopy._imageSourceHovered = replyButtonPath; } return QVariant::fromValue(activityLinkCopy);