make MainWindow cat update instantly

Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
Tayou 2023-01-20 15:13:25 +01:00
parent 1a35fec134
commit cdc9f93f71
No known key found for this signature in database
GPG Key ID: 02CA43C1CB6E9887
4 changed files with 10 additions and 0 deletions

View File

@ -208,6 +208,7 @@ signals:
void updateAllowedChanged(bool status);
void globalSettingsAboutToOpen();
void globalSettingsClosed();
int currentCatChanged(int index);
#ifdef Q_OS_MACOS
void clickedOnDock();

View File

@ -974,6 +974,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
ui->actionCAT->setChecked(cat_enable);
// NOTE: calling the operator like that is an ugly hack to appease ancient gcc...
connect(ui->actionCAT.operator->(), SIGNAL(toggled(bool)), SLOT(onCatToggled(bool)));
connect(APPLICATION, &Application::currentCatChanged, this, &MainWindow::onCatChanged);
setCatBackground(cat_enable);
}
@ -2076,6 +2077,10 @@ void MainWindow::newsButtonClicked()
news_dialog.exec();
}
void MainWindow::onCatChanged(int) {
setCatBackground(APPLICATION->settings()->get("TheCat").toBool());
}
void MainWindow::on_actionAbout_triggered()
{
AboutDialog dialog(this);

View File

@ -90,6 +90,8 @@ protected:
private slots:
void onCatToggled(bool);
void onCatChanged(int);
void on_actionAbout_triggered();
void on_actionAddInstance_triggered();

View File

@ -106,6 +106,8 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch
}
connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview()));
connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview()));
connect(ui->themeCustomizationWidget, &ThemeCustomizationWidget::currentCatChanged, APPLICATION, &Application::currentCatChanged);
}
LauncherPage::~LauncherPage()