mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
take default theme name from startup instead of using empty (#6663)
This commit is contained in:
parent
04f06206b7
commit
e39bbd2b31
3 changed files with 6 additions and 1 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <QPixmapCache>
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
#include <QStyle>
|
||||
#include <QStyleFactory>
|
||||
#include <QStyleHints>
|
||||
#include <Qt>
|
||||
|
|
@ -89,6 +90,7 @@ struct PaletteColorInfo
|
|||
|
||||
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
defaultStyleName = qApp->style()->objectName();
|
||||
ensureThemeDirectoryExists();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, &ThemeManager::themeChangedSlot);
|
||||
|
|
@ -346,7 +348,7 @@ void ThemeManager::themeChangedSlot()
|
|||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
qApp->setPalette(createDarkGreenFusionPalette());
|
||||
} else {
|
||||
qApp->setStyle("");
|
||||
qApp->setStyle(defaultStyleName); // setting the style also sets the palette
|
||||
}
|
||||
|
||||
if (dirPath.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
QString defaultStyleName;
|
||||
std::array<QBrush, Role::MaxRole + 1> brushes;
|
||||
QStringMap availableThemes;
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
// Lambda is cleaner to read than overloading this
|
||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabDisplayCardNameChanged, this, [this] { repaint(); });
|
||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||
&HomeWidget::updateButtonsToBackgroundColor);
|
||||
}
|
||||
|
||||
void HomeWidget::initializeBackgroundFromSource()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue