Merge pull request #1972 from lumiscosity/feature/cat_opacity

Add a cat opacity option
This commit is contained in:
TheKodeToad 2024-01-06 19:42:17 +00:00 committed by GitHub
commit f285c3fe13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 1 deletions

View File

@ -666,6 +666,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
// The cat // The cat
m_settings->registerSetting("TheCat", false); m_settings->registerSetting("TheCat", false);
m_settings->registerSetting("CatOpacity", 100);
m_settings->registerSetting("StatusBarVisible", true); m_settings->registerSetting("StatusBarVisible", true);

View File

@ -458,6 +458,7 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
QPainter painter(this->viewport()); QPainter painter(this->viewport());
if (m_catVisible) { if (m_catVisible) {
painter.setOpacity(APPLICATION->settings()->get("CatOpacity").toFloat() / 100);
int widWidth = this->viewport()->width(); int widWidth = this->viewport()->width();
int widHeight = this->viewport()->height(); int widHeight = this->viewport()->height();
if (m_catPixmap.width() < widWidth) if (m_catPixmap.width() < widWidth)
@ -468,6 +469,7 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
QRect rectOfPixmap = pixmap.rect(); QRect rectOfPixmap = pixmap.rect();
rectOfPixmap.moveBottomRight(this->viewport()->rect().bottomRight()); rectOfPixmap.moveBottomRight(this->viewport()->rect().bottomRight());
painter.drawPixmap(rectOfPixmap.topLeft(), pixmap); painter.drawPixmap(rectOfPixmap.topLeft(), pixmap);
painter.setOpacity(1.0);
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)

View File

@ -221,6 +221,9 @@ void LauncherPage::applySettings()
break; break;
} }
// Cat
s->set("CatOpacity", ui->catOpacitySpinBox->value());
// Mods // Mods
s->set("ModMetadataDisabled", ui->metadataDisableBtn->isChecked()); s->set("ModMetadataDisabled", ui->metadataDisableBtn->isChecked());
s->set("ModDependenciesDisabled", ui->dependenciesDisableBtn->isChecked()); s->set("ModDependenciesDisabled", ui->dependenciesDisableBtn->isChecked());
@ -276,6 +279,9 @@ void LauncherPage::loadSettings()
ui->sortByNameBtn->setChecked(true); ui->sortByNameBtn->setChecked(true);
} }
// Cat
ui->catOpacitySpinBox->setValue(s->get("CatOpacity").toInt());
// Mods // Mods
ui->metadataDisableBtn->setChecked(s->get("ModMetadataDisabled").toBool()); ui->metadataDisableBtn->setChecked(s->get("ModMetadataDisabled").toBool());
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());

View File

@ -186,7 +186,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="dependenciesDisableBtn"> <widget class="QCheckBox" name="dependenciesDisableBtn">
<property name="toolTip"> <property name="toolTip">
<string>Disable the automatic detection, installation, and updating of mod dependencies.</string> <string>Disable the automatic detection, installation, and updating of mod dependencies.</string>
@ -300,6 +300,54 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="catBox">
<property name="title">
<string>Cat</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="catOpacityLabel">
<property name="toolTip">
<string>Set the cat's opacity. 0% is fully transparent and 100% is fully opaque.</string>
</property>
<property name="text">
<string>Opacity</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="catOpacitySpinBox">
<property name="specialValueText">
<string/>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="toolsBox"> <widget class="QGroupBox" name="toolsBox">
<property name="sizePolicy"> <property name="sizePolicy">