mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +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 darkWarnYellow(63, 63, 0);
|
||||||
constexpr QColor lightWarnYellow(255, 255, 192);
|
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 {
|
namespace OCC {
|
||||||
|
@ -168,11 +177,8 @@ void FolderWizardLocalPath::changeEvent(QEvent *e)
|
||||||
|
|
||||||
void FolderWizardLocalPath::changeStyle()
|
void FolderWizardLocalPath::changeStyle()
|
||||||
{
|
{
|
||||||
const auto warnYellow = Theme::instance()->darkMode() ? darkWarnYellow : lightWarnYellow;
|
const auto yellowWarnPalette = yellowWarnWidgetPalette(_ui.warnLabel->palette());
|
||||||
auto modifiedPalette = _ui.warnLabel->palette();
|
_ui.warnLabel->setPalette(yellowWarnPalette);
|
||||||
modifiedPalette.setColor(QPalette::Window, warnYellow);
|
|
||||||
modifiedPalette.setColor(QPalette::Base, warnYellow);
|
|
||||||
_ui.warnLabel->setPalette(modifiedPalette);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =================================================================================
|
// =================================================================================
|
||||||
|
@ -550,11 +556,8 @@ void FolderWizardRemotePath::changeEvent(QEvent *e)
|
||||||
|
|
||||||
void FolderWizardRemotePath::changeStyle()
|
void FolderWizardRemotePath::changeStyle()
|
||||||
{
|
{
|
||||||
const auto warnYellow = Theme::instance()->darkMode() ? darkWarnYellow : lightWarnYellow;
|
const auto yellowWarnPalette = yellowWarnWidgetPalette(_ui.warnLabel->palette());
|
||||||
auto modifiedPalette = _ui.warnLabel->palette();
|
_ui.warnLabel->setPalette(yellowWarnPalette);
|
||||||
modifiedPalette.setColor(QPalette::Window, warnYellow);
|
|
||||||
modifiedPalette.setColor(QPalette::Base, warnYellow);
|
|
||||||
_ui.warnLabel->setPalette(modifiedPalette);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================================
|
// ====================================================================================
|
||||||
|
|
Loading…
Reference in a new issue