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:
+15
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user