From 57e0e85d777d18374b168b39d6df85417878067f Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 30 Mar 2018 15:58:05 +0200 Subject: [PATCH] Update a usernames "timeAdded" every time it tries to be added This keeps "recent chatters" from expiring Progress on #57 --- src/util/completionmodel.cpp | 2 ++ src/util/completionmodel.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/completionmodel.cpp b/src/util/completionmodel.cpp index 0bef743b1..a183c04a0 100644 --- a/src/util/completionmodel.cpp +++ b/src/util/completionmodel.cpp @@ -105,6 +105,8 @@ void CompletionModel::addUser(const QString &str) this->emotes.erase(p.first); auto result2 = this->emotes.insert(ts); assert(result2.second); + } else { + p.first->timeAdded = std::chrono::steady_clock::now(); } } } diff --git a/src/util/completionmodel.hpp b/src/util/completionmodel.hpp index 629f5dd15..016e23985 100644 --- a/src/util/completionmodel.hpp +++ b/src/util/completionmodel.hpp @@ -39,7 +39,7 @@ class CompletionModel : public QAbstractListModel // Type will help decide the lifetime of the tagged strings Type type; - std::chrono::steady_clock::time_point timeAdded; + mutable std::chrono::steady_clock::time_point timeAdded; bool HasExpired(const std::chrono::steady_clock::time_point &now) const {