Add subtitle to Hype Chats (#4715)

* feat: more hype chat

* Add `std::chrono::seconds` overload to formatTime

* Move & rename it to HypeChat + some other mini things

* Add changelog entry

* fix formattime test

---------

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-07-30 18:54:42 +02:00
committed by GitHub
parent 71594ad0d8
commit 703847c9ba
8 changed files with 207 additions and 8 deletions
+15 -1
View File
@@ -1,4 +1,7 @@
#include "FormatTime.hpp"
#include "util/FormatTime.hpp"
#include <algorithm>
#include <limits>
namespace chatterino {
@@ -57,4 +60,15 @@ QString formatTime(QString totalSecondsString)
return "n/a";
}
QString formatTime(std::chrono::seconds totalSeconds)
{
auto count = totalSeconds.count();
return formatTime(static_cast<int>(std::clamp(
count,
static_cast<std::chrono::seconds::rep>(std::numeric_limits<int>::min()),
static_cast<std::chrono::seconds::rep>(
std::numeric_limits<int>::max()))));
}
} // namespace chatterino