summary refs log tree commit diff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp

index b7980fc3..66bc86f6 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp
@@ -15,6 +15,8 @@ using TimelineEvent = mtx::events::collections::TimelineEvents; +QHash<QString, QString> authorColors_; + QString utils::localUser() { @@ -512,6 +514,28 @@ utils::luminance(const QColor &col) } void +utils::clearAuthorColors() +{ + authorColors_.clear(); +} + +QString +utils::getAuthorColor(const QString &author) +{ + if (authorColors_.contains(author)) { + return authorColors_[author]; + } else { + return ""; + } +} + +void +utils::addAuthorColor(const QString &author, const QString &color) +{ + authorColors_[author] = color; +} + +void utils::centerWidget(QWidget *widget, QWidget *parent) { auto findCenter = [childRect = widget->rect()](QRect hostRect) -> QPoint {