Permalink
Browse files

NOISSUE just don't use std::abs, it doesn't work

  • Loading branch information...
peterix committed Dec 24, 2018
1 parent 70052b1 commit 3e60e770b573f79b6792daa9cc7de50c41cf5216
Showing with 11 additions and 1 deletion.
  1. +11 −1 application/MainWindow.cpp
@@ -1241,14 +1241,24 @@ void MainWindow::onCatToggled(bool state)
MMC->settings()->set("TheCat", state);
}

namespace {
template <typename T>
T non_stupid_abs(T in)
{
if (in < 0)
return -in;
return in;
}
}

void MainWindow::setCatBackground(bool enabled)
{
if (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
{

0 comments on commit 3e60e77

Please sign in to comment.