From 3e60e770b573f79b6792daa9cc7de50c41cf5216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 24 Dec 2018 14:49:53 +0100 Subject: NOISSUE just don't use std::abs, it doesn't work --- application/MainWindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'application/MainWindow.cpp') diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index a1066718..56119942 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -1241,6 +1241,16 @@ void MainWindow::onCatToggled(bool state) MMC->settings()->set("TheCat", state); } +namespace { +template +T non_stupid_abs(T in) +{ + if (in < 0) + return -in; + return in; +} +} + void MainWindow::setCatBackground(bool enabled) { if (enabled) @@ -1248,7 +1258,7 @@ void MainWindow::setCatBackground(bool enabled) QDateTime now = QDateTime::currentDateTime(); QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0)); ; - QString cat = (std::abs(now.daysTo(xmas)) <= 4) ? "catmas" : "kitteh"; + QString cat = (non_stupid_abs(now.daysTo(xmas)) <= 4) ? "catmas" : "kitteh"; view->setStyleSheet(QString(R"( GroupView { -- cgit v1.2.3