UX tweak + formatting + added cat to wizard

Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
Tayou
2023-01-09 16:54:10 +01:00
parent 1b80ae0fca
commit 49d317b19a
12 changed files with 127 additions and 107 deletions

View File

@ -23,31 +23,31 @@
#include "ui/widgets/ThemeCustomizationWidget.h"
#include "ui_ThemeCustomizationWidget.h"
ThemeWizardPage::ThemeWizardPage(QWidget *parent) :
BaseWizardPage(parent),
ui(new Ui::ThemeWizardPage) {
ThemeWizardPage::ThemeWizardPage(QWidget* parent) : BaseWizardPage(parent), ui(new Ui::ThemeWizardPage)
{
ui->setupUi(this);
ui->themeCustomizationWidget->showFeatures((ThemeFields)(ThemeFields::ICONS | ThemeFields::WIDGETS));
connect(ui->themeCustomizationWidget, QOverload<int>::of(&ThemeCustomizationWidget::currentIconThemeChanged), this, &ThemeWizardPage::updateIcons);
connect(ui->themeCustomizationWidget, QOverload<int>::of(&ThemeCustomizationWidget::currentCatChanged), this, &ThemeWizardPage::updateCat);
updateIcons();
updateCat();
}
ThemeWizardPage::~ThemeWizardPage() {
delete ui;
}
void ThemeWizardPage::initializePage()
ThemeWizardPage::~ThemeWizardPage()
{
delete ui;
}
void ThemeWizardPage::initializePage() {}
bool ThemeWizardPage::validatePage()
{
return true;
}
void ThemeWizardPage::updateIcons() {
void ThemeWizardPage::updateIcons()
{
qDebug() << "Setting Icons";
ui->previewIconButton0->setIcon(APPLICATION->getThemedIcon("new"));
ui->previewIconButton1->setIcon(APPLICATION->getThemedIcon("centralmods"));
@ -64,6 +64,25 @@ void ThemeWizardPage::updateIcons() {
parentWidget()->update();
}
void ThemeWizardPage::updateCat()
{
qDebug() << "Setting Cat";
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));
QDateTime halloween(QDate(now.date().year(), 10, 31), QTime(0, 0));
QString cat = APPLICATION->settings()->get("BackgroundCat").toString();
if (std::abs(now.daysTo(xmas)) <= 4) {
cat += "-xmas";
} else if (std::abs(now.daysTo(halloween)) <= 4) {
cat += "-spooky";
} else if (std::abs(now.daysTo(birthday)) <= 12) {
cat += "-bday";
}
ui->catImagePreviewButton->setIcon(QIcon(QString(R"(:/backgrounds/%1)").arg(cat)));
}
void ThemeWizardPage::retranslate()
{
ui->retranslateUi(this);

View File

@ -38,6 +38,7 @@ public:
private slots:
void updateIcons();
void updateCat();
private:
Ui::ThemeWizardPage *ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>510</width>
<height>552</height>
</rect>
</property>
<property name="windowTitle">
@ -309,6 +309,28 @@
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="catImagePreviewButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>256</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>256</width>
<height>256</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">