summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-02-20 20:51:07 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-02-20 20:51:07 +0100
commit6bdc75d07319b3b2a846ee4a905288ec0d9371f6 (patch)
tree855cd92fb12a652f9959d0a1e64b15db82ba3e79 /src/timeline/TimelineModel.cpp
parentClear user colors on theme change (diff)
downloadnheko-6bdc75d07319b3b2a846ee4a905288ec0d9371f6.tar.xz
Reset user colors on theme change (in qml timeline)
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp15
1 files changed, 2 insertions, 13 deletions
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<int, QByteArray> @@ -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<QString> &users, QColor bg) auto formatUser = [this, bg](const QString &user_id) -> QString { auto uncoloredUsername = escapeEmoji(displayName(user_id).toHtmlEscaped()); - QString prefix = QString("<font color=\"%1\">").arg(userColor(user_id, bg).name()); + QString prefix = + QString("<font color=\"%1\">").arg(manager_->userColor(user_id, bg).name()); // color only parts that don't have a font already specified QString coloredUsername;