aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/instanceview/InstanceView.cpp
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-13 20:05:16 -0700
committerGitHub <noreply@github.com>2023-07-13 20:05:16 -0700
commit520594e5296b09205e55bc018b1f759df5725e96 (patch)
tree07e334684062151c5fdf699e805d9326255a3dc3 /launcher/ui/instanceview/InstanceView.cpp
parent8d7dcdfc5b2a231a1304878e25929e6f4ff4e338 (diff)
parent94d4d12ee0a12572b2b661003f10cfbdda1b434a (diff)
downloadPrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.tar.gz
PrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.tar.bz2
PrismLauncher-520594e5296b09205e55bc018b1f759df5725e96.zip
Merge branch 'develop' into chore/add-compiler-warnings
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/instanceview/InstanceView.cpp')
-rw-r--r--launcher/ui/instanceview/InstanceView.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/launcher/ui/instanceview/InstanceView.cpp b/launcher/ui/instanceview/InstanceView.cpp
index 3b27e9fa..23b71600 100644
--- a/launcher/ui/instanceview/InstanceView.cpp
+++ b/launcher/ui/instanceview/InstanceView.cpp
@@ -48,6 +48,7 @@
#include <QAccessible>
#include "VisualGroup.h"
+#include "ui/themes/ThemeManager.h"
#include <QDebug>
#include <Application.h>
@@ -73,6 +74,7 @@ InstanceView::InstanceView(QWidget *parent)
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setAcceptDrops(true);
setAutoScroll(true);
+ setPaintCat(APPLICATION->settings()->get("TheCat").toBool());
}
InstanceView::~InstanceView()
@@ -500,12 +502,35 @@ void InstanceView::mouseDoubleClickEvent(QMouseEvent *event)
}
}
+
+void InstanceView::setPaintCat(bool visible)
+{
+ m_catVisible = visible;
+ if (visible)
+ m_catPixmap.load(QString(":/backgrounds/%1").arg(ThemeManager::getCatImage()));
+ else
+ m_catPixmap = QPixmap();
+}
+
void InstanceView::paintEvent([[maybe_unused]] QPaintEvent *event)
{
executeDelayedItemsLayout();
QPainter painter(this->viewport());
+ if (m_catVisible) {
+ int widWidth = this->viewport()->width();
+ int widHeight = this->viewport()->height();
+ if (m_catPixmap.width() < widWidth)
+ widWidth = m_catPixmap.width();
+ if (m_catPixmap.height() < widHeight)
+ widHeight = m_catPixmap.height();
+ auto pixmap = m_catPixmap.scaled(widWidth, widHeight, Qt::KeepAspectRatio);
+ QRect rectOfPixmap = pixmap.rect();
+ rectOfPixmap.moveBottomRight(this->viewport()->rect().bottomRight());
+ painter.drawPixmap(rectOfPixmap.topLeft(), pixmap);
+ }
+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStyleOptionViewItem option;
initViewItemOption(&option);