Merge pull request #1508 from xslendix/move_pussy

Add a way to change the position of the cat.
This commit is contained in:
Lenny McLennington 2022-12-08 06:49:58 +00:00 committed by GitHub
commit 7839bd0e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 2 deletions

View File

@ -605,6 +605,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// The cat
m_settings->registerSetting("TheCat", false);
m_settings->registerSetting("CatStyle", "BackgroundCat");
m_settings->registerSetting("CatPosition", "top right");
m_settings->registerSetting("InstSortMode", "Name");
m_settings->registerSetting("SelectedInstance", QString());

View File

@ -1620,16 +1620,21 @@ void MainWindow::setCatBackground(bool enabled)
else {
cat += "Cat";
}
auto cat_position = APPLICATION->settings()->get("CatPosition").toString().toLower().trimmed();
if (cat_position != "top left" && cat_position != "bottom left" && cat_position != "bottom right" && cat_position != "top right")
cat_position = "top right";
view->setStyleSheet(QString(R"(
InstanceView
{
background-image: url(:/backgrounds/%1);
background-attachment: fixed;
background-clip: padding;
background-position: top right;
background-position: %2;
background-repeat: none;
background-color:palette(base);
})").arg(cat));
})").arg(cat, cat_position));
}
else
{

View File

@ -322,6 +322,11 @@ void LauncherPage::applySettings()
s->set("CatStyle", ui->themeComboBoxCat->currentText());
}
if(s->get("CatPosition") != ui->themeComboBoxCatPosition->currentData())
{
s->set("CatPosition", ui->themeComboBoxCatPosition->currentData());
}
if(original != s->get("IconTheme"))
{
APPLICATION->setIconTheme(s->get("IconTheme").toString());
@ -447,6 +452,20 @@ void LauncherPage::loadSettings()
ui->themeComboBoxCat->setCurrentIndex(1);
else
ui->themeComboBoxCat->setCurrentIndex(0);
auto currentCatPosition = s->get("CatPosition").toString();
ui->themeComboBoxCatPosition->addItem(tr("Top Left"), "top left");
ui->themeComboBoxCatPosition->addItem(tr("Top Right"), "top right");
ui->themeComboBoxCatPosition->addItem(tr("Bottom Left"), "bottom left");
ui->themeComboBoxCatPosition->addItem(tr("Bottom Right"), "bottom right");
if (currentCatPosition == "top left")
ui->themeComboBoxCatPosition->setCurrentIndex(0);
else if (currentCatPosition == "bottom left")
ui->themeComboBoxCatPosition->setCurrentIndex(2);
else if (currentCatPosition == "bottom right")
ui->themeComboBoxCatPosition->setCurrentIndex(3);
else
ui->themeComboBoxCatPosition->setCurrentIndex(1);
}
// Toolbar/menu bar settings (not applicable if native menu bar is present)

View File

@ -355,6 +355,17 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="themeCatPositionLabel">
<property name="text">
<string>Cat Position</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="themeComboBoxCatPosition">
</widget>
</item>
</layout>
</widget>
</item>