mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
DolphinQt/Settings: Split setting of the user style into two functions.
This makes it so that if you just want to reload the current style (eg. on program start, or in response to a system event), you don't need to know the name of the currently selected user style. It's also more consistent with the way the 'userstyle/enabled' flag works.
This commit is contained in:
@ -123,7 +123,7 @@ void Settings::SetThemeName(const QString& theme_name)
|
||||
emit ThemeChanged();
|
||||
}
|
||||
|
||||
QString Settings::GetCurrentUserStyle() const
|
||||
QString Settings::GetUserStyleName() const
|
||||
{
|
||||
if (GetQSettings().contains(QStringLiteral("userstyle/name")))
|
||||
return GetQSettings().value(QStringLiteral("userstyle/name")).toString();
|
||||
@ -132,6 +132,11 @@ QString Settings::GetCurrentUserStyle() const
|
||||
return QFileInfo(GetQSettings().value(QStringLiteral("userstyle/path")).toString()).fileName();
|
||||
}
|
||||
|
||||
void Settings::SetUserStyleName(const QString& stylesheet_name)
|
||||
{
|
||||
GetQSettings().setValue(QStringLiteral("userstyle/name"), stylesheet_name);
|
||||
}
|
||||
|
||||
void Settings::InitDefaultPalette()
|
||||
{
|
||||
s_default_palette = std::make_unique<QPalette>(qApp->palette());
|
||||
@ -169,8 +174,9 @@ bool Settings::IsThemeDark()
|
||||
}
|
||||
|
||||
// Calling this before the main window has been created breaks the style of some widgets.
|
||||
void Settings::SetCurrentUserStyle(const QString& stylesheet_name)
|
||||
void Settings::ApplyStyle()
|
||||
{
|
||||
const QString stylesheet_name = GetUserStyleName();
|
||||
QString stylesheet_contents;
|
||||
|
||||
// If we haven't found one, we continue with an empty (default) style
|
||||
@ -243,8 +249,6 @@ void Settings::SetCurrentUserStyle(const QString& stylesheet_name)
|
||||
}
|
||||
|
||||
qApp->setStyleSheet(stylesheet_contents);
|
||||
|
||||
GetQSettings().setValue(QStringLiteral("userstyle/name"), stylesheet_name);
|
||||
}
|
||||
|
||||
bool Settings::AreUserStylesEnabled() const
|
||||
|
Reference in New Issue
Block a user