mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Move warning yellow palette generation for warn labels to anonymous namespace function
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
8312cda0e4
commit
e6676ac0f0
1 changed files with 13 additions and 10 deletions
|
@ -45,6 +45,15 @@ namespace
|
|||
{
|
||||
constexpr QColor darkWarnYellow(63, 63, 0);
|
||||
constexpr QColor lightWarnYellow(255, 255, 192);
|
||||
|
||||
QPalette yellowWarnWidgetPalette(const QPalette &existingPalette)
|
||||
{
|
||||
const auto warnYellow = OCC::Theme::instance()->darkMode() ? darkWarnYellow : lightWarnYellow;
|
||||
auto modifiedPalette = existingPalette;
|
||||
modifiedPalette.setColor(QPalette::Window, warnYellow);
|
||||
modifiedPalette.setColor(QPalette::Base, warnYellow);
|
||||
return modifiedPalette;
|
||||
}
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
|
@ -168,11 +177,8 @@ void FolderWizardLocalPath::changeEvent(QEvent *e)
|
|||
|
||||
void FolderWizardLocalPath::changeStyle()
|
||||
{
|
||||
const auto warnYellow = Theme::instance()->darkMode() ? darkWarnYellow : lightWarnYellow;
|
||||
auto modifiedPalette = _ui.warnLabel->palette();
|
||||
modifiedPalette.setColor(QPalette::Window, warnYellow);
|
||||
modifiedPalette.setColor(QPalette::Base, warnYellow);
|
||||
_ui.warnLabel->setPalette(modifiedPalette);
|
||||
const auto yellowWarnPalette = yellowWarnWidgetPalette(_ui.warnLabel->palette());
|
||||
_ui.warnLabel->setPalette(yellowWarnPalette);
|
||||
}
|
||||
|
||||
// =================================================================================
|
||||
|
@ -550,11 +556,8 @@ void FolderWizardRemotePath::changeEvent(QEvent *e)
|
|||
|
||||
void FolderWizardRemotePath::changeStyle()
|
||||
{
|
||||
const auto warnYellow = Theme::instance()->darkMode() ? darkWarnYellow : lightWarnYellow;
|
||||
auto modifiedPalette = _ui.warnLabel->palette();
|
||||
modifiedPalette.setColor(QPalette::Window, warnYellow);
|
||||
modifiedPalette.setColor(QPalette::Base, warnYellow);
|
||||
_ui.warnLabel->setPalette(modifiedPalette);
|
||||
const auto yellowWarnPalette = yellowWarnWidgetPalette(_ui.warnLabel->palette());
|
||||
_ui.warnLabel->setPalette(yellowWarnPalette);
|
||||
}
|
||||
|
||||
// ====================================================================================
|
||||
|
|
Loading…
Reference in a new issue