From 6bdc75d07319b3b2a846ee4a905288ec0d9371f6 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 20 Feb 2020 20:51:07 +0100 Subject: Reset user colors on theme change (in qml timeline) --- src/timeline/TimelineModel.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/timeline/TimelineModel.cpp') diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 8de6bec6..cad39bc5 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -196,9 +196,6 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj if (idx >= 0) emit dataChanged(index(idx, 0), index(idx, 0)); }); - - connect( - ChatPage::instance(), &ChatPage::themeChanged, this, [this]() { userColors.clear(); }); } QHash @@ -650,15 +647,6 @@ TimelineModel::addBackwardsEvents(const mtx::responses::Messages &msgs) prev_batch_token_ = QString::fromStdString(msgs.end); } -QColor -TimelineModel::userColor(QString id, QColor background) -{ - if (!userColors.contains(id)) - userColors.insert( - id, QColor(utils::generateContrastingHexColor(id, background.name()))); - return userColors.value(id); -} - QString TimelineModel::displayName(QString id) const { @@ -1446,7 +1434,8 @@ TimelineModel::formatTypingUsers(const std::vector &users, QColor bg) auto formatUser = [this, bg](const QString &user_id) -> QString { auto uncoloredUsername = escapeEmoji(displayName(user_id).toHtmlEscaped()); - QString prefix = QString("").arg(userColor(user_id, bg).name()); + QString prefix = + QString("").arg(manager_->userColor(user_id, bg).name()); // color only parts that don't have a font already specified QString coloredUsername; -- cgit 1.5.1