Skip to content

Commit

Permalink
Move warning yellow palette generation for warn labels to anonymous n…
Browse files Browse the repository at this point in the history
…amespace function

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Sep 16, 2023
1 parent 22f2807 commit 4762fcb
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}

// =================================================================================
Expand Down Expand Up @@ -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);
}

// ====================================================================================
Expand Down

0 comments on commit 4762fcb

Please sign in to comment.