Signed-off-by: HeyaGlitz <heyaglitz0x99@proton.me>
This commit is contained in:
HeyaGlitz 2022-11-13 02:25:07 +01:00
parent 1b52829e6c
commit ddbc80e1ef
No known key found for this signature in database
GPG Key ID: E6942B6A79B5AEAC
10 changed files with 67 additions and 11 deletions

View File

@ -604,6 +604,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("InstSortMode", "Name");
m_settings->registerSetting("SelectedInstance", QString());

View File

@ -1,8 +1,11 @@
<!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="defaultCatmas">catmas.png</file>
<file alias="defaultCattiversary">cattiversary.png</file>
<file alias="defaultCat">catbackground.png</file>
<file alias="jinxCat">jinxbg.png</file>
<file alias="jinxCatmas">jinxmas.png</file>
<file alias="jinxCattiversary">jinxversary.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

View File

@ -1603,15 +1603,21 @@ 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 = "default";
if(APPLICATION->settings()->get("CatStyle").toString() == "Jinx")
{
cat = "jinx";
}
if(non_stupid_abs(now.daysTo(xmas)) <= 4) {
cat = "catmas";
cat += "Catmas";
}
else if (non_stupid_abs(now.daysTo(birthday)) <= 12) {
cat = "cattiversary";
cat += "Cattiversary";
}
else {
cat = "kitteh";
cat += "Cat";
}
view->setStyleSheet(QString(R"(
InstanceView
@ -1935,6 +1941,7 @@ void MainWindow::globalSettingsClosed()
updateMainToolBar();
updateToolsMenu();
updateStatusCenter();
updateCat();
// This needs to be done to prevent UI elements disappearing in the event the config is changed
// but PolyMC exits abnormally, causing the window state to never be saved:
APPLICATION->settings()->set("MainWindowState", saveState().toBase64());
@ -2285,6 +2292,11 @@ void MainWindow::updateStatusCenter()
}
}
void MainWindow::updateCat()
{
setCatBackground(APPLICATION->settings()->get("TheCat").toBool());
}
void MainWindow::refreshCurrentInstance(bool running)
{
auto current = view->selectionModel()->currentIndex();

View File

@ -204,6 +204,8 @@ private slots:
void updateNewsLabel();
void updateCat();
/*!
* Runs the DownloadTask and installs updates.
*/

View File

@ -159,8 +159,8 @@ void LauncherPage::on_instDirBrowseBtn_clicked()
if (result == QMessageBox::Ok)
{
ui->instDirTextBox->setText(cooked_dir);
}
}
}
}
else
{
ui->instDirTextBox->setText(cooked_dir);
@ -317,6 +317,11 @@ void LauncherPage::applySettings()
break;
}
if(s->get("CatStyle") != ui->themeComboBoxCat->currentText())
{
s->set("CatStyle", ui->themeComboBoxCat->currentText());
}
if(original != s->get("IconTheme"))
{
APPLICATION->setIconTheme(s->get("IconTheme").toString());
@ -430,6 +435,19 @@ void LauncherPage::loadSettings()
}
idx++;
}
//TODO: Don't make it hardcoded via strings
auto currentCatStyle = s->get("CatStyle").toString();
ui->themeComboBoxCat->addItem("BackgroundCat");
ui->themeComboBoxCat->addItem("Jinx");
if(currentCatStyle == "Jinx")
{
ui->themeComboBoxCat->setCurrentIndex(1);
}
else
{
ui->themeComboBoxCat->setCurrentIndex(0);
}
}
// Toolbar/menu bar settings (not applicable if native menu bar is present)

View File

@ -245,7 +245,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="themeIconsLabel">
<property name="text">
<string>&amp;Icons</string>
</property>
@ -313,7 +313,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="themeColorsLabel">
<property name="text">
<string>&amp;Colors</string>
</property>
@ -335,6 +335,26 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="themeCatLabel">
<property name="text">
<string>&amp;Cat Type</string>
</property>
<property name="buddy">
<cstring>themeComboBoxCat</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="themeComboBoxCat">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="currentText">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>