feat: add Cat support

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-10-01 20:11:07 +02:00
parent 5c02265325
commit 3009356c8a
4 changed files with 36 additions and 47 deletions

View File

@ -161,3 +161,35 @@ QModelIndex InstanceView::mappedIndex(const QModelIndex& index) const
{
return m_proxy->mapToSource(index);
}
void InstanceView::setCatDisplayed(bool enabled)
{
if (enabled) {
QDateTime now = QDateTime::currentDateTime();
QDateTime birthday(QDate(now.date().year(), 11, 30), QTime(0, 0));
QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0));
QString cat;
if (std::abs(now.daysTo(xmas)) <= 4) {
cat = "catmas";
} else if (std::abs(now.daysTo(birthday)) <= 12) {
cat = "cattiversary";
} else {
cat = "kitteh";
}
setStyleSheet(QString(R"(
*
{
background-image: url(:/backgrounds/%1);
background-attachment: fixed;
background-clip: padding;
background-position: bottom right;
background-repeat: none;
background-color:palette(base);
})")
.arg(cat));
m_table->setAlternatingRowColors(false);
} else {
setStyleSheet(QString());
m_table->setAlternatingRowColors(true);
}
}

View File

@ -39,6 +39,8 @@ class InstanceView : public QStackedWidget {
// save state of current view
void storeState();
void setCatDisplayed(bool enabled);
signals:
void instanceActivated(InstancePtr inst);
void currentInstanceChanged(InstancePtr current, InstancePtr previous);