Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rory the Cat and a setting to change cats #372

Merged
merged 5 commits into from Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions launcher/Application.cpp
Expand Up @@ -501,6 +501,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Theming
m_settings->registerSetting("IconTheme", QString("pe_colored"));
m_settings->registerSetting("ApplicationTheme", QString("system"));
m_settings->registerSetting("BackgroundCat", QString("kitteh"));

// Remembered state
m_settings->registerSetting("LastUsedGroupForNewInstance", QString());
Expand Down
12 changes: 9 additions & 3 deletions launcher/resources/backgrounds/backgrounds.qrc
@@ -1,8 +1,14 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/backgrounds">
<file alias="kitteh">catbgrnd2.png</file>
<file alias="catmas">catmas.png</file>
<file alias="cattiversary">cattiversary.png</file>
<file alias="kitteh">kitteh.png</file>
<file alias="kitteh-xmas">kitteh-xmas.png</file>
<file alias="kitteh-bday">kitteh-bday.png</file>
<file alias="rory">rory.png</file>
<file alias="rory-xmas">rory-xmas.png</file>
<file alias="rory-bday">rory-bday.png</file>
santiagocezar marked this conversation as resolved.
Show resolved Hide resolved
<file alias="rory-flat">rory-flat.png</file>
<file alias="rory-flat-xmas">rory-flat-xmas.png</file>
<file alias="rory-flat-bday">rory-flat-bday.png</file>
</qresource>
</RCC>
Binary file added launcher/resources/backgrounds/rory-bday.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added launcher/resources/backgrounds/rory-flat-bday.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added launcher/resources/backgrounds/rory-flat-xmas.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added launcher/resources/backgrounds/rory-flat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added launcher/resources/backgrounds/rory-xmas.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added launcher/resources/backgrounds/rory.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions launcher/ui/MainWindow.cpp
Expand Up @@ -1560,26 +1560,27 @@ void MainWindow::setCatBackground(bool 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;
QString cat = APPLICATION->settings()->get("BackgroundCat").toString();

qDebug() << "The choosen cat is " << cat << ".";
Scrumplex marked this conversation as resolved.
Show resolved Hide resolved

if(non_stupid_abs(now.daysTo(xmas)) <= 4) {
cat = "catmas";
cat += "-xmas";
}
else if (non_stupid_abs(now.daysTo(birthday)) <= 12) {
cat = "cattiversary";
}
else {
cat = "kitteh";
cat += "-bday";
}
view->setStyleSheet(QString(R"(
InstanceView
{
background-image: url(:/backgrounds/%1);
background-attachment: fixed;
background-clip: padding;
background-position: top right;
background-position: bottom left;
background-repeat: none;
background-color:palette(base);
})").arg(cat));
})")
.arg(cat));
}
else
{
Expand Down
21 changes: 21 additions & 0 deletions launcher/ui/pages/global/LauncherPage.cpp
Expand Up @@ -334,6 +334,18 @@ void LauncherPage::applySettings()
APPLICATION->setApplicationTheme(newAppTheme, false);
}

switch (ui->themeBackgroundCat->currentIndex()) {
case 0: // original cat
s->set("BackgroundCat", "kitteh");
break;
case 1: // rory the cat
s->set("BackgroundCat", "rory");
break;
case 2: // rory the cat flat edition
s->set("BackgroundCat", "rory-flat");
break;
}

s->set("MenuBarInsteadOfToolBar", ui->preferMenuBarCheckBox->isChecked());

// Console settings
Expand Down Expand Up @@ -425,6 +437,15 @@ void LauncherPage::loadSettings()
ui->themeComboBox->setCurrentIndex(9);
}

auto cat = s->get("BackgroundCat").toString();
if (cat == "kitteh") {
ui->themeBackgroundCat->setCurrentIndex(0);
} else if (cat == "rory") {
ui->themeBackgroundCat->setCurrentIndex(1);
} else if (cat == "rory-flat") {
ui->themeBackgroundCat->setCurrentIndex(2);
}

{
auto currentTheme = s->get("ApplicationTheme").toString();
auto themes = APPLICATION->getValidApplicationThemes();
Expand Down
38 changes: 38 additions & 0 deletions launcher/ui/pages/global/LauncherPage.ui
Expand Up @@ -340,6 +340,44 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Cat</string>
</property>
<property name="buddy">
<cstring>themeBackgroundCat</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="themeBackgroundCat">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<item>
<property name="text">
<string>Background Cat (from MultiMC)</string>
</property>
</item>
<item>
<property name="text">
<string>Rory ID 11 (drawn by Ashtaka)</string>
</property>
</item>
<item>
<property name="text">
<string>Rory ID 11 (flat edition, drawn by Ashtaka)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down