From e5e2921bbad17e2a98eb8b1b0ca3ae5075f51e74 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 3 Jul 2023 17:50:57 +0200 Subject: [PATCH] Fluent2 skin reactivated --- skins/fluent2/QskFluent2Skin.cpp | 1868 ++++++++++++++++------- skins/fluent2/QskFluent2Skin.h | 5 +- skins/fluent2/QskFluent2SkinFactory.cpp | 76 +- skins/fluent2/QskFluent2Theme.cpp | 122 +- skins/fluent2/QskFluent2Theme.h | 35 +- src/controls/QskSkinManager.cpp | 4 - 6 files changed, 1507 insertions(+), 603 deletions(-) diff --git a/skins/fluent2/QskFluent2Skin.cpp b/skins/fluent2/QskFluent2Skin.cpp index 18559b93..e1641198 100644 --- a/skins/fluent2/QskFluent2Skin.cpp +++ b/skins/fluent2/QskFluent2Skin.cpp @@ -7,6 +7,67 @@ Definitions ( where possible ) taken from https://www.figma.com/file/NAWMapFlXnoOb86Q2H5GKr/Windows-UI-(Community) */ + +/* + TODO: + + - we have a lot of lines with 1 pixels. Unfortunately OpenGL does some sort + of antialiasing, when a line is not a pixel position. On screens with high + resolution usually no probem, but f.e on mine ... + + - QskCheckBox::Error is not properly supported + + - Pressed state is missing + + - QskComboBox + - QskPageIndicator + + - Hovered state is missing + + - QskPageIndicator + + - QskScrollView + + The extended mode of the scrollbar needs to be implemented + + - QskListView + + - hover state is not implemented + - Indicator subcontrol might be better than using the border of the selection box + + - using qskDpToPixels ? + */ + +/* + The palette is made of a specific configurable colors and + predefined semitransparent shades of gray. Both need to + be resolved to opaque colors with the base colors of the sections. + + Resolving the colors can be done in 2 ways: + + - render time + + This actually means, that we do not create opaque colors and + create the scene graph nodes with semitransparent colors. + + - definition time + + We create opaque colors for the base colors of the sections + and set them as skin hints. + + Resolving at render time sounds like the right solution as we + background colors set in application code will just work. + + Unfortunately we have 2 different sets of grays for light/dark + base colors and when applications are setting a light color, where a + dark color ( or v.v ) is expected we might end up with unacceptable + results: ( white on light or black on dark ). + + So there are pros and cons and we do not have a final opinion + about waht to do. For the moment we implement resolving at definition + time as an option to be able to play with both solutions. + */ + #include "QskFluent2Skin.h" #include "QskFluent2Theme.h" @@ -17,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -79,52 +141,124 @@ namespace return qRgba( value, value, value, qRound( opacity * 255 ) ); } - inline QRgb flattenedColor( QRgb foregroundColor, QRgb backgroundColor ) + inline constexpr QRgb rgbFlattened( QRgb foreground, QRgb background ) { - const qreal alphaRatio = ( ( foregroundColor & QskRgb::AlphaMask ) >> 24 ) / 255.0; - return QskRgb::interpolated( backgroundColor, foregroundColor, alphaRatio ); + //Q_ASSERT( qAlpha( background ) == 255 ); + + const auto r2 = qAlpha( foreground ) / 255.0; + const auto r1 = 1.0 - r2; + + const auto r = qRound( r1 * qRed( background ) + r2 * qRed( foreground ) ); + const auto g = qRound( r1 * qGreen( background ) + r2 * qGreen( foreground ) ); + const auto b = qRound( r1 * qBlue( background ) + r2 * qBlue( foreground ) ); + + return qRgb( r, g, b ); + } + + inline constexpr QRgb rgbSolid( QRgb foreground, QRgb background ) + { + /* + dummy method, so that we can compare the results with + or without resolving the foreground alpha value + */ + +#if 0 + return rgbFlattened( foreground, background ); +#else + //Q_ASSERT( qAlpha( background ) == 255 ); + Q_UNUSED( background ); + return foreground; +#endif } class Editor : private QskSkinHintTableEditor { public: - Editor( QskSkinHintTable* table, const QskFluent2Theme& palette ) + Editor( QskSkinHintTable* table ) : QskSkinHintTableEditor( table ) - , theme( palette ) { } - void setup(); + void setupMetrics(); + void setupColors( QskAspect::Section, const QskFluent2Theme& ); private: - void setupBox(); - void setupCheckBox(); - void setupComboBox(); - void setupDialogButtonBox(); - void setupFocusIndicator(); - void setupInputPanel(); - void setupListView(); - void setupMenu(); - void setupPageIndicator(); - void setupPopup(); - void setupProgressBar(); - void setupPushButton(); - void setupRadioBox(); - void setupScrollView(); - void setupSegmentedBar(); - void setupSeparator(); - void setupSlider(); - void setupSpinBox(); - void setupSubWindow(); - void setupSwitchButton(); - void setupTabButton(); - void setupTabBar(); - void setupTabView(); - void setupTextInput(); - void setupTextLabel(); - void setupVirtualKeyboard(); + void setupPopup( const QskFluent2Theme& ); + void setupSubWindow( const QskFluent2Theme& ); - QskGraphic symbol( const char* name ) const + void setupBoxMetrics(); + void setupBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupCheckBoxMetrics(); + void setupCheckBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupComboBoxMetrics(); + void setupComboBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupDialogButtonBoxMetrics(); + void setupDialogButtonBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupFocusIndicatorMetrics(); + void setupFocusIndicatorColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupGraphicLabelMetrics(); + void setupGraphicLabelColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupListViewMetrics(); + void setupListViewColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupMenuMetrics(); + void setupMenuColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupPageIndicatorMetrics(); + void setupPageIndicatorColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupProgressBarMetrics(); + void setupProgressBarColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupPushButtonMetrics(); + void setupPushButtonColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupRadioBoxMetrics(); + void setupRadioBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupScrollViewMetrics(); + void setupScrollViewColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupSegmentedBarMetrics(); + void setupSegmentedBarColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupSeparatorMetrics(); + void setupSeparatorColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupSliderMetrics(); + void setupSliderColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupSpinBoxMetrics(); + void setupSpinBoxColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupSwitchButtonMetrics(); + void setupSwitchButtonColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupTabButtonMetrics(); + void setupTabButtonColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupTabBarMetrics(); + void setupTabBarColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupTabViewMetrics(); + void setupTabViewColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupTextInputMetrics(); + void setupTextInputColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupTextLabelMetrics(); + void setupTextLabelColors( QskAspect::Section, const QskFluent2Theme& ); + + void setupVirtualKeyboardMetrics(); + void setupVirtualKeyboardColors( QskAspect::Section, const QskFluent2Theme& ); + + inline QskGraphic symbol( const char* name ) const { const QString path = QStringLiteral( ":fluent2/icons/qvg/" ) + name + QStringLiteral( ".qvg" ); @@ -132,66 +266,102 @@ namespace return QskGraphicIO::read( path ); } - void setBoxBorderGradient( QskAspect aspect, QskFluent2Theme::BorderGradient gradient, QRgb baseColor ) + inline void setBoxBorderGradient( QskAspect aspect, + QRgb border1, QRgb border2, QRgb baseColor ) { - const QRgb leftTopRightColor = flattenedColor( gradient[ 0 ], baseColor ); - const QRgb bottomColor = flattenedColor( gradient[ 1 ], baseColor ); + border1 = rgbFlattened( border1, baseColor ); + border2 = rgbFlattened( border2, baseColor ); - setBoxBorderColors( aspect, { leftTopRightColor, leftTopRightColor, leftTopRightColor, bottomColor } ); + setBoxBorderColors( aspect, { border1, border1, border1, border2 } ); } - const QskFluent2Theme& theme; + inline void setBoxBorderGradient( QskAspect aspect, + const QskFluent2Theme::BorderGradient& gradient, QRgb baseColor ) + { + setBoxBorderGradient( aspect, gradient[ 0 ], gradient[ 1 ], baseColor ); + } }; } -void Editor::setup() +void Editor::setupMetrics() { - setupBox(); - setupCheckBox(); - setupComboBox(); - setupDialogButtonBox(); - setupFocusIndicator(); - setupInputPanel(); - setupListView(); - setupMenu(); - setupPageIndicator(); - setupPopup(); - setupProgressBar(); - setupPushButton(); - setupRadioBox(); - setupScrollView(); - setupSegmentedBar(); - setupSeparator(); - setupSlider(); - setupSpinBox(); - setupSubWindow(); - setupSwitchButton(); - setupTabButton(); - setupTabBar(); - setupTabView(); - setupTextInput(); - setupTextLabel(); - setupVirtualKeyboard(); + setupBoxMetrics(); + setupCheckBoxMetrics(); + setupComboBoxMetrics(); + setupDialogButtonBoxMetrics(); + setupFocusIndicatorMetrics(); + setupGraphicLabelMetrics(); + setupListViewMetrics(); + setupMenuMetrics(); + setupPageIndicatorMetrics(); + setupProgressBarMetrics(); + setupPushButtonMetrics(); + setupRadioBoxMetrics(); + setupScrollViewMetrics(); + setupSegmentedBarMetrics(); + setupSeparatorMetrics(); + setupSliderMetrics(); + setupSpinBoxMetrics(); + setupSwitchButtonMetrics(); + setupTabButtonMetrics(); + setupTabBarMetrics(); + setupTabViewMetrics(); + setupTextInputMetrics(); + setupTextLabelMetrics(); + setupVirtualKeyboardMetrics(); } -void Editor::setupBox() +void Editor::setupColors( QskAspect::Section section, const QskFluent2Theme& theme ) { - using Q = QskBox; - using A = QskAspect; + if ( section == QskAspect::Body ) + { + // TODO + setupPopup( theme ); + setupSubWindow( theme ); + } - const auto& pal = theme.palette; + setupBoxColors( section, theme ); + setupCheckBoxColors( section, theme ); + setupComboBoxColors( section, theme ); + setupDialogButtonBoxColors( section, theme ); + setupFocusIndicatorColors( section, theme ); + setupGraphicLabelColors( section, theme ); + setupGraphicLabelMetrics(); + setupListViewColors( section, theme ); + setupMenuColors( section, theme ); + setupPageIndicatorColors( section, theme ); + setupProgressBarColors( section, theme ); + setupPushButtonColors( section, theme ); + setupRadioBoxColors( section, theme ); + setupScrollViewColors( section, theme ); + setupSegmentedBarColors( section, theme ); + setupSeparatorColors( section, theme ); + setupSliderColors( section, theme ); + setupSwitchButtonColors( section, theme ); + setupSpinBoxColors( section, theme ); + setupTabButtonColors( section, theme ); + setupTabBarColors( section, theme ); + setupTabViewColors( section, theme ); + setupTextInputColors( section, theme ); + setupTextLabelColors( section, theme ); + setupVirtualKeyboardColors( section, theme ); +}; - setGradient( Q::Panel, pal.background.solid.base ); - setGradient( Q::Panel | A::Header, pal.background.solid.tertiary ); - setGradient( Q::Panel | A::Footer, pal.background.solid.tertiary ); +void Editor::setupBoxMetrics() +{ } -void Editor::setupCheckBox() +void Editor::setupBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + setGradient( QskBox::Panel | section, + theme.palette.background.solid.base ); +} + +void Editor::setupCheckBoxMetrics() { using Q = QskCheckBox; - const auto& pal = theme.palette; - setStrutSize( Q::Panel, 126, 38 ); setSpacing( Q::Panel, 8 ); @@ -200,482 +370,941 @@ void Editor::setupCheckBox() setBoxBorderMetrics( Q::Box, 1 ); setPadding( Q::Box, 5 ); // "icon size" - setGradient( Q::Box, pal.fillColor.controlAlt.secondary ); - setBoxBorderColors( Q::Box, pal.strokeColor.controlStrong.defaultColor ); - - setGradient( Q::Box | Q::Checked, pal.fillColor.accent.defaultColor ); - setBoxBorderColors( Q::Box | Q::Checked, pal.fillColor.accent.defaultColor ); - - const auto checkMark = symbol( "checkmark" ); - setSymbol( Q::Indicator | Q::Checked, checkMark, { QskStateCombination::CombinationNoState, Q::Disabled } ); - setGraphicRole( Q::Indicator, QskFluent2Skin::GraphicRoleFillColorTextOnAccentPrimary ); - setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); - - - setGradient( Q::Box | Q::Hovered, pal.fillColor.controlAlt.tertiary ); - setBoxBorderColors( Q::Box | Q::Hovered, pal.strokeColor.controlStrong.defaultColor ); - setGradient( Q::Box | Q::Hovered | Q::Checked, pal.fillColor.accent.secondary ); - setBoxBorderColors( Q::Box | Q::Hovered | Q::Checked, pal.fillColor.accent.secondary ); - // indicator the same as in Rest state - - setGradient( Q::Box | Q::Pressed, pal.fillColor.controlAlt.quaternary ); - setBoxBorderColors( Q::Box | Q::Pressed, pal.strokeColor.controlStrong.disabled ); - setGradient( Q::Box | Q::Pressed | Q::Checked, pal.fillColor.accent.tertiary ); - setBoxBorderColors( Q::Box | Q::Pressed | Q::Checked, pal.fillColor.accent.tertiary ); - setGraphicRole( Q::Indicator | Q::Pressed | Q::Checked, QskFluent2Skin::GraphicRoleFillColorTextOnAccentSecondary ); - - setGradient( Q::Box | Q::Disabled, pal.fillColor.controlAlt.disabled ); - setBoxBorderColors( Q::Box | Q::Disabled, pal.strokeColor.controlStrong.disabled ); - setGradient( Q::Box | Q::Disabled | Q::Checked, pal.fillColor.accent.disabled ); - setBoxBorderColors( Q::Box | Q::Disabled | Q::Checked, pal.fillColor.accent.disabled ); - setGraphicRole( Q::Indicator | Q::Disabled | Q::Checked, QskFluent2Skin::GraphicRoleFillColorTextOnAccentDisabled ); - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); } -void Editor::setupComboBox() +void Editor::setupCheckBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { - using Q = QskComboBox; + using Q = QskCheckBox; + using A = QskAspect; const auto& pal = theme.palette; + const auto checkMark = symbol( "checkmark" ); + + for ( const auto state1 : { A::NoState, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + QRgb fillColor, borderColor, textColor; + + for ( const auto state2 : { A::NoState, Q::Checked } ) + { + const auto states = state1 | state2; + + if ( states == A::NoState ) + { + fillColor = pal.fillColor.controlAlt.secondary; + borderColor = pal.strokeColor.controlStrong.defaultColor; + textColor = pal.fillColor.text.primary; + } + else if ( states == Q::Hovered ) + { + fillColor = pal.fillColor.controlAlt.tertiary; + borderColor = pal.strokeColor.controlStrong.defaultColor; + textColor = pal.fillColor.text.primary; + } + else if ( states == ( Q::Hovered | Q::Checked ) ) + { + fillColor = pal.fillColor.accent.secondary; + borderColor = fillColor; + textColor = pal.fillColor.text.primary; + } + else if ( states == Q::Checked ) + { + fillColor = pal.fillColor.accent.defaultColor; + borderColor = pal.fillColor.accent.defaultColor; + textColor = pal.fillColor.text.primary; + } + else if ( states == Q::Pressed ) + { + fillColor = pal.fillColor.controlAlt.quaternary; + borderColor = pal.strokeColor.controlStrong.disabled; + textColor = pal.fillColor.text.primary; + } + else if ( states == ( Q::Pressed | Q::Checked ) ) + { + fillColor = pal.fillColor.accent.tertiary; + borderColor = pal.fillColor.accent.tertiary; + textColor = pal.fillColor.text.primary; + + setSymbol( Q::Indicator | states, checkMark ); + } + else if ( states == Q::Disabled ) + { + fillColor = pal.fillColor.controlAlt.disabled; + borderColor = pal.strokeColor.controlStrong.disabled; + textColor = pal.fillColor.text.disabled; + } + else if ( states == ( Q::Disabled | Q::Checked ) ) + { + fillColor = pal.fillColor.accent.disabled; + borderColor = pal.fillColor.accent.disabled; + textColor = pal.fillColor.text.disabled; + } + + /* + Support for QskCheckBox::Error is not properly defined. + Doing some basic definitions, so that we can at least + see the boxes with this state. TODO ... + */ + for ( const auto state3 : { A::NoState, Q::Error } ) + { + const auto box = Q::Box | section | states | state3; + const auto text = Q::Text | section | states | state3; + const auto indicator = Q::Indicator | section | states | state3; + +#if 1 + if ( state3 == Q::Error && !( states & Q::Disabled ) ) + { + borderColor = QskRgb::IndianRed; + if ( states & Q::Checked ) + fillColor = QskRgb::DarkRed; + } +#endif + fillColor = rgbSolid( fillColor, pal.background.solid.base ); + setGradient( box, fillColor ); + + borderColor = rgbSolid( borderColor, fillColor ); + setBoxBorderColors( box, borderColor ); + + setColor( text, textColor ); + + if ( states & Q::Checked ) + { + setGraphicRole( indicator, ( states & Q::Disabled ) + ? QskFluent2Skin::GraphicRoleFillColorTextOnAccentDisabled + : QskFluent2Skin::GraphicRoleFillColorTextOnAccentPrimary ); + + setSymbol( indicator, checkMark ); + } + } + } + } +} + +void Editor::setupComboBoxMetrics() +{ + using Q = QskComboBox; + setStrutSize( Q::Panel, { -1, 32 } ); setBoxBorderMetrics( Q::Panel, 1 ); setBoxShape( Q::Panel, 3 ); setPadding( Q::Panel, { 11, 0, 11, 0 } ); - setGradient( Q::Panel, pal.fillColor.control.defaultColor ); - setBoxBorderGradient( Q::Panel, pal.elevation.control.border, - pal.fillColor.control.defaultColor ); - setStrutSize( Q::Icon, 12, 12 ); setPadding( Q::Icon, { 0, 0, 8, 0 } ); - setGraphicRole( Q::Icon, QskFluent2Skin::GraphicRoleFillColorTextPrimary ); setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); setStrutSize( Q::StatusIndicator, 12, 12 ); setSymbol( Q::StatusIndicator, symbol( "spin-box-arrow-down" ) ); setSymbol( Q::StatusIndicator | Q::PopupOpen, symbol( "spin-box-arrow-up" ) ); - setGraphicRole( Q::StatusIndicator, QskFluent2Skin::GraphicRoleFillColorTextSecondary ); - - // Hovered: - - setGradient( Q::Panel | Q::Hovered, pal.fillColor.control.secondary ); - setBoxBorderGradient( Q::Panel | Q::Hovered, pal.elevation.textControl.border, - pal.fillColor.control.secondary ); - - - // Focused (Pressed doesn't exist yet): - + // Using Focused (Pressed doesn't exist yet): setBoxBorderMetrics( Q::Panel | Q::Focused, { 1, 1, 1, 2 } ); - - setGradient( Q::Panel | Q::Focused, pal.fillColor.control.inputActive ); - - auto gradient = pal.elevation.textControl.border; - gradient.at( 1 ) = pal.fillColor.accent.defaultColor; - - setBoxBorderGradient( Q::Panel | Q::Focused, gradient, pal.fillColor.control.inputActive ); - - // Disabled: - - setGradient( Q::Panel | Q::Disabled, pal.fillColor.control.disabled ); - setBoxBorderColors( Q::Panel | Q::Disabled, pal.strokeColor.control.defaultColor ); - - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); - setGraphicRole( Q::Icon | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); - - setGraphicRole( Q::StatusIndicator | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); } -void Editor::setupDialogButtonBox() +void Editor::setupComboBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { - using Q = QskDialogButtonBox; + using Q = QskComboBox; + using W = QskFluent2Skin; + const auto& pal = theme.palette; - setPadding( Q::Panel, 24 ); - setGradient( Q::Panel, pal.background.solid.base ); - setPadding(Q::Panel, 20 ); + for ( const auto state : { QskAspect::NoState, Q::Hovered, Q::Focused, Q::Disabled } ) + { + QRgb panelColor, borderColor1, borderColor2, textColor; + + if ( state == QskAspect::NoState ) + { + panelColor = pal.fillColor.control.defaultColor; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + textColor = pal.fillColor.text.primary; + + } + else if ( state == Q::Hovered ) + { + panelColor = pal.fillColor.control.secondary; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.elevation.textControl.border[1]; + textColor = pal.fillColor.text.primary; + } + else if ( state == Q::Focused ) + { + + panelColor = pal.fillColor.control.inputActive; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.fillColor.accent.defaultColor; + textColor = pal.fillColor.text.primary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.disabled; + borderColor2 = borderColor1 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.text.disabled; + } + + const auto panel = Q::Panel | section | state; + const auto text = Q::Text | section | state; + const auto icon = Q::Icon | section | state; + const auto indicator = Q::StatusIndicator | section | state; + + panelColor = rgbSolid( panelColor, pal.background.solid.base ); + + setGradient( panel, panelColor ); + setBoxBorderGradient( panel, borderColor1, borderColor2, panelColor ); + + setColor( text, textColor ); + + if ( state == Q::Disabled ) + { + setGraphicRole( icon, W::GraphicRoleFillColorTextDisabled ); + setGraphicRole( indicator, W::GraphicRoleFillColorTextDisabled ); + } + else + { + setGraphicRole( icon, W::GraphicRoleFillColorTextPrimary ); + setGraphicRole( indicator, W::GraphicRoleFillColorTextSecondary ); + } + } } -void Editor::setupFocusIndicator() +void Editor::setupDialogButtonBoxMetrics() +{ + setPadding( QskDialogButtonBox::Panel, 20 ); +} + +void Editor::setupDialogButtonBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + setGradient( QskDialogButtonBox::Panel | section, + theme.palette.background.solid.base ); +} + +void Editor::setupFocusIndicatorMetrics() { using Q = QskFocusIndicator; - const auto& pal = theme.palette; setBoxBorderMetrics( Q::Panel, 2 ); setPadding( Q::Panel, 3 ); setBoxShape( Q::Panel, 4 ); - setBoxBorderColors( Q::Panel, pal.strokeColor.focus.outer ); } -void Editor::setupInputPanel() +void Editor::setupFocusIndicatorColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { + using Q = QskFocusIndicator; + const auto& pal = theme.palette; + + setBoxBorderColors( Q::Panel | section, pal.strokeColor.focus.outer ); } -void Editor::setupListView() +void Editor::setupListViewMetrics() { + using Q = QskListView; + + setBoxBorderMetrics( Q::Cell | Q::Selected, { 3, 0, 0, 0 } ); } -void Editor::setupMenu() +void Editor::setupListViewColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskListView; + using A = QskAspect; + + const auto& pal = theme.palette; + + for ( const auto state1 : { A::NoState, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + QRgb textColor, indicatorColor; + + if ( state1 == Q::Disabled ) + { + textColor = pal.fillColor.text.disabled; + indicatorColor = pal.fillColor.accent.disabled; + } + if ( state1 == Q::Pressed ) + { + textColor = pal.fillColor.text.secondary; + indicatorColor = pal.fillColor.accent.defaultColor; + } + else + { + textColor = pal.fillColor.text.primary; + indicatorColor = pal.fillColor.accent.defaultColor; + } + + for ( const auto state2 : { A::NoState, Q::Selected } ) + { + QRgb cellColor; + + if ( state2 == A::NoState ) + { + if ( state1 == Q::Hovered ) + cellColor = pal.fillColor.subtle.secondary; + else if ( state1 == Q::Pressed ) + cellColor = pal.fillColor.subtle.tertiary; + else + cellColor = Qt::transparent; + } + else + { + if ( state1 == Q::Hovered ) + cellColor = pal.fillColor.subtle.tertiary; + else + cellColor = pal.fillColor.subtle.secondary; + } + + const auto cell = Q::Cell | section | state1 | state2; + const auto text = Q::Text | section | state1 | state2; + + setGradient( cell, cellColor ); + + { + /* + We are using a section of the left border to display a + bar indicating the selection. Maybe we should introduce a + subcontrol instead TODO ... + */ + const auto c1 = cellColor; + const auto c2 = indicatorColor; + + const auto p1 = ( state1 == Q::Pressed ) ? 0.33 : 0.25; + const auto p2 = 1.0 - p1; + + setBoxBorderColors( cell, + QskGradient( { { p1, c1 }, { p1, c2 }, { p2, c2 }, { p2, c1 } } ) ); + } + + setColor( text, textColor ); + } + } +} + +void Editor::setupMenuMetrics() { using Q = QskMenu; - const auto& pal = theme.palette; setPadding( Q::Panel, { 4, 6, 4, 6 } ); setBoxBorderMetrics( Q::Panel, 1 ); - setBoxBorderColors( Q::Panel, pal.strokeColor.surface.flyout ); setBoxShape( Q::Panel, 7 ); - setGradient( Q::Panel, pal.background.flyout.defaultColor ); - setShadowMetrics( Q::Panel, theme.shadow.flyout.metrics ); - setShadowColor( Q::Panel, theme.shadow.flyout.color ); setPadding( Q::Segment, { 0, 10, 0, 10 } ); setSpacing( Q::Segment, 15 ); - - setGradient( Q::Segment | Q::Selected, pal.fillColor.subtle.secondary ); setBoxBorderMetrics( Q::Segment | Q::Selected, { 3, 0, 0, 0 } ); - QskGradient selectedGradient( { { 0.0, pal.fillColor.subtle.secondary }, - { 0.25, pal.fillColor.subtle.secondary }, - { 0.25, pal.fillColor.accent.defaultColor }, - { 0.75, pal.fillColor.accent.defaultColor }, - { 0.75, pal.fillColor.subtle.secondary }, - { 1.0, pal.fillColor.subtle.secondary } } ); - setBoxBorderColors( Q::Segment | Q::Selected, selectedGradient ); - setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); setStrutSize( Q::Icon, 12, 12 ); setPadding( Q::Icon, { 8, 8, 0, 8 } ); +} + +void Editor::setupMenuColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + Q_UNUSED( section ); + + using Q = QskMenu; + +#if 1 + setShadowMetrics( Q::Panel, theme.shadow.flyout.metrics ); +#endif + + const auto& pal = theme.palette; + + setBoxBorderColors( Q::Panel, pal.strokeColor.surface.flyout ); + setGradient( Q::Panel, pal.background.flyout.defaultColor ); + setShadowColor( Q::Panel, theme.shadow.flyout.color ); + + setGradient( Q::Segment | Q::Selected, pal.fillColor.subtle.secondary ); + + /* + We are using a section of the left border to display a + bar indicating the selection. Maybe we should introduce a + subcontrol instead TODO ... + */ + const auto c1 = pal.fillColor.subtle.secondary; + const auto c2 = pal.fillColor.accent.defaultColor; + + setBoxBorderColors( Q::Segment | Q::Selected, + QskGradient( { { 0.25, c1 }, { 0.25, c2 }, { 0.75, c2 }, { 0.75, c1 } } ) ); + + setColor( Q::Text, pal.fillColor.text.primary ); + setGraphicRole( Q::Icon, QskFluent2Skin::GraphicRoleFillColorTextPrimary ); } -void Editor::setupPageIndicator() +void Editor::setupPageIndicatorMetrics() { + using Q = QskPageIndicator; + using A = QskAspect; + + setPadding( Q::Panel, 5 ); + setSpacing( Q::Panel, 6 ); + + // circles, without border + + setBoxShape( Q::Bullet, 100, Qt::RelativeSize ); + setBoxBorderMetrics( Q::Bullet, 0 ); + + /* + Pressed/Hovered are not yet implemented. + Sizes would be: + + - Q::Pressed : 3 + - Q::Pressed | Q::Selected : 5 + - Q::Hovered : 5 + - Q::Hovered | Q::Selected : 7 + */ + + setStrutSize( Q::Bullet, 6, 6 ); + + /* + Using the margin to adjust sizes is a weired type of implementation. + Needs to be changed TODO ... + */ + for ( auto state : { A::NoState, Q::Disabled } ) + { + setMargin( Q::Bullet | state | Q::Selected, 0 ); + setMargin( Q::Bullet | state, 1 ); + } } -void Editor::setupPopup() +void Editor::setupPageIndicatorColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskPageIndicator; + using A = QskAspect; + + const auto& pal = theme.palette; + + setGradient( Q::Panel, QskGradient() ); + + // Pressed/Hovered are missing - color for both would be pal.fillColor.text.secondary + + for ( const auto state : { A::NoState, Q::Disabled } ) + { + const auto color = ( state == A::NoState ) + ? pal.fillColor.controlStrong.defaultColor + : pal.fillColor.controlStrong.disabled; + + const auto bullet = Q::Bullet | state | section; + + setGradient( bullet, color ); + setGradient( bullet | Q::Selected, color ); + } +} + +void Editor::setupPopup( const QskFluent2Theme& theme ) { using Q = QskPopup; + const auto& pal = theme.palette; setGradient( Q::Overlay, pal.background.overlay.defaultColor ); } -void Editor::setupProgressBar() +void Editor::setupProgressBarMetrics() { using Q = QskProgressBar; using A = QskAspect; - const auto& pal = theme.palette; setMetric( Q::Groove | A::Size, 1 ); setBoxShape( Q::Groove, 100, Qt::RelativeSize ); - setGradient( Q::Groove, pal.strokeColor.controlStrong.defaultColor ); - setMetric( Q::Bar| A::Size, 3 ); + setMetric( Q::Bar | A::Size, 3 ); setBoxShape( Q::Bar, 100, Qt::RelativeSize ); - setGradient( Q::Bar, pal.fillColor.accent.defaultColor ); } -void Editor::setupPushButton() +void Editor::setupProgressBarColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskProgressBar; + + const auto& pal = theme.palette; + + setGradient( Q::Groove | section, pal.strokeColor.controlStrong.defaultColor ); + setGradient( Q::Bar | section, pal.fillColor.accent.defaultColor ); +} + +void Editor::setupPushButtonMetrics() { using Q = QskPushButton; using W = QskFluent2Skin; - const auto& pal = theme.palette; setStrutSize( Q::Panel, { 120, 32 } ); setBoxShape( Q::Panel, 4 ); setBoxBorderMetrics( Q::Panel, 1 ); + setBoxBorderMetrics( Q::Panel | W::Accent | Q::Disabled, 0 ); // Fluent buttons don't really have icons, - // but for the sake of compatibility with the - // gallery app, let's define their style here as well: + setStrutSize( Q::Icon, 12, 12 ); setPadding( Q::Icon, { 0, 0, 8, 0 } ); - setFontRole( Q::Text, QskFluent2Skin::Body ); - - // Accent buttons: - - setBoxBorderGradient( Q::Panel | W::Accent, pal.elevation.accentControl.border, - pal.fillColor.accent.defaultColor ); - - setGradient( Q::Panel | W::Accent, pal.fillColor.accent.defaultColor ); - setColor( Q::Text | W::Accent, pal.fillColor.textOnAccent.primary ); - setGraphicRole( Q::Icon | W::Accent, QskFluent2Skin::GraphicRoleFillColorTextOnAccentPrimary ); - - - setBoxBorderGradient( Q::Panel | W::Accent | Q::Hovered, pal.elevation.accentControl.border, - pal.fillColor.accent.secondary ); - - - setGradient( Q::Panel | W::Accent | Q::Hovered, pal.fillColor.accent.secondary ); - - - setGradient( Q::Panel | W::Accent | Q::Pressed, pal.fillColor.accent.tertiary ); - setColor( Q::Text | W::Accent | Q::Pressed, pal.fillColor.textOnAccent.secondary ); - setGraphicRole( Q::Icon | W::Accent | Q::Pressed, QskFluent2Skin::GraphicRoleFillColorTextOnAccentSecondary ); - - const QRgb accentPressedBorderColor = flattenedColor( pal.strokeColor.control.onAccentDefault, - pal.fillColor.accent.tertiary ); - - setBoxBorderColors( Q::Panel | W::Accent | Q::Pressed, accentPressedBorderColor ); - - - setGradient( Q::Panel | W::Accent | Q::Disabled, pal.fillColor.accent.disabled ); - setColor( Q::Text | W::Accent | Q::Disabled, pal.fillColor.textOnAccent.disabled ); - setGraphicRole( Q::Icon | W::Accent | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextOnAccentDisabled ); - setBoxBorderMetrics( Q::Panel | W::Accent | Q::Disabled, 0 ); - - - // Standard buttons: - - setBoxBorderGradient( Q::Panel, pal.elevation.control.border, - pal.fillColor.control.defaultColor ); - - - setGradient( Q::Panel, pal.fillColor.control.defaultColor ); - setColor( Q::Text, pal.fillColor.text.primary ); - setGraphicRole( Q::Icon, QskFluent2Skin::GraphicRoleFillColorTextPrimary ); - - - setBoxBorderGradient( Q::Panel | Q::Hovered, pal.elevation.control.border, - pal.fillColor.control.secondary ); - - - setGradient( Q::Panel | Q::Hovered, pal.fillColor.control.secondary ); - - - const QRgb standardPressedBorderColor = flattenedColor( pal.strokeColor.control.defaultColor, - pal.fillColor.control.tertiary ); - - setBoxBorderColors( Q::Panel | Q::Pressed, standardPressedBorderColor ); - - setGradient( Q::Panel | Q::Pressed, pal.fillColor.control.tertiary ); - setColor( Q::Text | Q::Pressed, pal.fillColor.text.secondary ); - setGraphicRole( Q::Icon | Q::Pressed, QskFluent2Skin::GraphicRoleFillColorTextSecondary ); - - - const QRgb standardDisabledBorderColor = flattenedColor( pal.strokeColor.control.defaultColor, - pal.fillColor.control.disabled ); - - setBoxBorderColors( Q::Panel | Q::Disabled, standardDisabledBorderColor ); - - setGradient( Q::Panel | Q::Disabled, pal.fillColor.control.disabled ); - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); - setGraphicRole( Q::Icon | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); + setFontRole( Q::Text, W::Body ); } -void Editor::setupRadioBox() +void Editor::setupPushButtonColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskPushButton; + using W = QskFluent2Skin; + + const auto& pal = theme.palette; + + for ( const auto variation : { QskAspect::NoVariation, W::Accent } ) + { + const auto panel = Q::Panel | section | variation; + const auto text = Q::Text | section | variation; + const auto icon = Q::Icon | section | variation; + + for ( const auto state : { QskAspect::NoState, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + QRgb panelColor, borderColor1, borderColor2, textColor; + int graphicRole; + + if ( variation == W::Accent ) + { + if ( state == Q::Hovered ) + { + panelColor = pal.fillColor.accent.secondary; + borderColor1 = pal.elevation.accentControl.border[0]; + borderColor2 = pal.elevation.accentControl.border[1]; + textColor = pal.fillColor.textOnAccent.primary; + graphicRole = W::GraphicRoleFillColorTextOnAccentPrimary; + } + else if ( state == Q::Pressed ) + { + panelColor = pal.fillColor.accent.tertiary; + borderColor1 = borderColor2 = pal.strokeColor.control.onAccentDefault; + textColor = pal.fillColor.textOnAccent.secondary; + graphicRole = W::GraphicRoleFillColorTextOnAccentSecondary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.accent.disabled; + borderColor1 = borderColor2 = panelColor; // irrelevant: width is 0 + textColor = pal.fillColor.textOnAccent.disabled; + graphicRole = W::GraphicRoleFillColorTextOnAccentDisabled; + } + else + { + panelColor = pal.fillColor.accent.defaultColor; + borderColor1 = pal.elevation.accentControl.border[0]; + borderColor2 = pal.elevation.accentControl.border[1]; + textColor = pal.fillColor.textOnAccent.primary; + graphicRole = W::GraphicRoleFillColorTextOnAccentPrimary; + } + } + else + { + if ( state == Q::Hovered ) + { + panelColor = pal.fillColor.control.secondary; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + textColor = pal.fillColor.text.primary; + graphicRole = W::GraphicRoleFillColorTextPrimary; + } + else if ( state == Q::Pressed ) + { + panelColor = pal.fillColor.control.tertiary; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.text.secondary; + graphicRole = W::GraphicRoleFillColorTextSecondary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.disabled; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.text.disabled; + graphicRole = W::GraphicRoleFillColorTextDisabled; + } + else + { + panelColor = pal.fillColor.control.defaultColor; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[0]; + textColor = pal.fillColor.text.primary; + graphicRole = W::GraphicRoleFillColorTextPrimary; + } + } + + panelColor = rgbSolid( panelColor, pal.background.solid.base ); + + setGradient( panel | state, panelColor ); + + setBoxBorderGradient( panel | state, + borderColor1, borderColor2, panelColor ); + + setColor( text | state, textColor ); + setGraphicRole( icon | state, graphicRole ); + } + } +} + +void Editor::setupRadioBoxMetrics() { using Q = QskRadioBox; - const auto& pal = theme.palette; setSpacing( Q::Button, 8 ); setStrutSize( Q::Button, { 115, 38 } ); - setStrutSize( Q::CheckIndicatorPanel, { 20, 20 } ); + /* + We do not have an indicator - states are indicated by the panel border + + However the colors of the inner side of the border are not solid for + the selected states and we use a dummy indicator to get this done. + + How to solve this in a better way, TODO ... + */ + + setBoxShape( Q::CheckIndicator, 100, Qt::RelativeSize ); + setBoxBorderMetrics( Q::CheckIndicator, 0 ); + setBoxBorderMetrics( Q::CheckIndicator | Q::Selected, 1 ); + setBoxBorderMetrics( Q::CheckIndicator | Q::Pressed | Q::Selected, 1 ); + setBoxShape( Q::CheckIndicatorPanel, 100, Qt::RelativeSize ); + setStrutSize( Q::CheckIndicatorPanel, { 20, 20 } ); + setBoxBorderMetrics( Q::CheckIndicatorPanel, 1 ); - setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); - // Rest - - setGradient( Q::CheckIndicatorPanel, pal.fillColor.controlAlt.secondary ); - setBoxBorderColors( Q::CheckIndicatorPanel, pal.strokeColor.controlStrong.defaultColor ); - - setGradient( Q::CheckIndicatorPanel | Q::Selected, pal.fillColor.accent.defaultColor ); setBoxBorderMetrics( Q::CheckIndicatorPanel | Q::Selected, 0 ); - setPadding( Q::CheckIndicatorPanel | Q::Selected, { 5, 5 } ); // indicator "strut size" - setBoxShape( Q::CheckIndicator | Q::Selected, 100, Qt::RelativeSize ); - setBoxBorderMetrics( Q::CheckIndicator | Q::Selected, 1 ); - setGradient( Q::CheckIndicator | Q::Selected, pal.fillColor.textOnAccent.primary ); - - setBoxBorderGradient( Q::CheckIndicator | Q::Selected, pal.elevation.circle.border, - pal.fillColor.accent.defaultColor ); - - - // Hover - - setGradient( Q::CheckIndicatorPanel | Q::Hovered, pal.fillColor.controlAlt.tertiary ); - - setGradient( Q::CheckIndicatorPanel | Q::Hovered | Q::Selected, pal.fillColor.accent.secondary ); setPadding( Q::CheckIndicatorPanel | Q::Hovered | Q::Selected, { 4, 4 } ); // indicator "strut size" - - setBoxBorderGradient( Q::CheckIndicator | Q::Hovered, pal.elevation.circle.border, - pal.fillColor.accent.secondary ); - - // Pressed - - setGradient( Q::CheckIndicatorPanel | Q::Pressed, pal.fillColor.controlAlt.quaternary ); - setBoxBorderColors( Q::CheckIndicatorPanel | Q::Pressed, pal.strokeColor.controlStrong.disabled ); - setPadding( Q::CheckIndicatorPanel | Q::Pressed, { 7, 7 } ); // indicator "strut size" - setBoxShape( Q::CheckIndicator | Q::Pressed, 100, Qt::RelativeSize ); - setBoxBorderMetrics( Q::CheckIndicator | Q::Pressed, 0 ); - setGradient( Q::CheckIndicator | Q::Pressed, pal.fillColor.textOnAccent.primary ); - - setGradient( Q::CheckIndicatorPanel | Q::Pressed | Q::Selected, pal.fillColor.accent.tertiary ); setBoxBorderMetrics( Q::CheckIndicatorPanel | Q::Pressed | Q::Selected, 0 ); - setPadding( Q::CheckIndicatorPanel | Q::Pressed | Q::Selected, { 6, 6 } ); // indicator "strut size" - setBoxBorderMetrics( Q::CheckIndicator | Q::Pressed, 1 ); - setBoxBorderGradient( Q::CheckIndicator | Q::Pressed | Q::Selected, pal.elevation.circle.border, - pal.fillColor.accent.tertiary ); - - // Disabled - - setGradient( Q::CheckIndicatorPanel | Q::Disabled, pal.fillColor.controlAlt.disabled ); - setBoxBorderColors( Q::CheckIndicatorPanel | Q::Disabled, pal.strokeColor.controlStrong.disabled ); - - setGradient( Q::CheckIndicatorPanel | Q::Disabled | Q::Selected, pal.fillColor.accent.disabled ); setBoxBorderMetrics( Q::CheckIndicatorPanel | Q::Disabled | Q::Selected, 0 ); - setPadding( Q::CheckIndicatorPanel | Q::Disabled | Q::Selected, { 6, 6 } ); // indicator "strut size" - setBoxBorderMetrics( Q::CheckIndicator | Q::Disabled | Q::Selected, 0 ); - setGradient( Q::CheckIndicator | Q::Disabled | Q::Selected, pal.fillColor.textOnAccent.primary ); - setBoxShape( Q::CheckIndicator | Q::Disabled | Q::Selected, 100, Qt::RelativeSize ); - - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); + setFontRole( Q::Text, QskFluent2Skin::Body ); } -void Editor::setupScrollView() +void Editor::setupRadioBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { + using Q = QskRadioBox; + using A = QskAspect; + + const auto& pal = theme.palette; + + for ( const auto state1 : { A::NoState, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + for ( const auto state2 : { A::NoState, Q::Selected } ) + { + const auto states = state1 | state2; + + auto indicatorColor = pal.fillColor.textOnAccent.primary; + if ( !( states & Q::Selected ) ) + indicatorColor = QskRgb::toTransparent( indicatorColor, 0 ); + + auto textColor = pal.fillColor.text.primary; + if ( states & Q::Disabled ) + textColor = pal.fillColor.text.disabled; + + QRgb panelBorderColor; + if ( states & ( Q::Disabled | Q::Pressed ) ) + panelBorderColor = pal.strokeColor.controlStrong.disabled; + else + panelBorderColor = pal.strokeColor.controlStrong.defaultColor; + + auto panelColor = pal.fillColor.accent.defaultColor; + + if ( states == A::NoState ) + { + panelColor = pal.fillColor.controlAlt.secondary; + } + else if ( states == Q::Selected ) + { + } + else if ( states == Q::Hovered ) + { + panelColor = pal.fillColor.controlAlt.tertiary; + } + else if ( states == ( Q::Hovered | Q::Selected ) ) + { + panelColor = pal.fillColor.accent.secondary; + } + else if ( states == Q::Pressed ) + { + panelColor = pal.fillColor.controlAlt.quaternary; + } + else if ( states == ( Q::Pressed | Q::Selected ) ) + { + panelColor = pal.fillColor.accent.tertiary; + } + else if ( states == Q::Disabled ) + { + panelColor = pal.fillColor.controlAlt.disabled; + } + else if ( states == ( Q::Disabled | Q::Selected ) ) + { + panelColor = pal.fillColor.accent.disabled; + } + + const auto panel = Q::CheckIndicatorPanel | section | states; + const auto indicator = Q::CheckIndicator | section | states; + const auto text = Q::Text | section | states; + + +#if 0 + // we have different colors when making colors solid early. TODO ... + panelColor = rgbSolid2( panelColor, pal.background.solid.base ); + indicatorColor = rgbSolid2( indicatorColor, pal.background.solid.base ); +#endif + setBoxBorderGradient( indicator, pal.elevation.circle.border, panelColor ); + + setGradient( panel, panelColor ); + setBoxBorderColors( panel, panelBorderColor ); + + setGradient( indicator, indicatorColor ); + + setColor( text, textColor ); + } + } } -void Editor::setupSegmentedBar() +void Editor::setupScrollViewMetrics() +{ + using A = QskAspect; + using Q = QskScrollView; + + for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } ) + setMetric( subControl | A::Size, 2 ); + + const auto handleExtent = 40.0; + setStrutSize( Q::HorizontalScrollHandle, handleExtent, 0.0 ); + setStrutSize( Q::VerticalScrollHandle, 0.0, handleExtent ); +} + +void Editor::setupScrollViewColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskScrollView; + + const auto& pal = theme.palette; + +#if 1 + setGradient( Q::Panel, QColor() ); + setGradient( Q::Viewport, QColor() ); +#endif + + for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } ) + { + setGradient( subControl | section, pal.fillColor.controlStrong.defaultColor ); + } +} + +void Editor::setupSegmentedBarMetrics() { using Q = QskSegmentedBar; using A = QskAspect; - const auto& pal = theme.palette; const QSizeF segmentStrutSize( 120, 32 ); setBoxBorderMetrics( Q::Panel, 1 ); - - setBoxBorderGradient( Q::Panel, pal.elevation.control.border, - pal.fillColor.control.defaultColor ); - - setGradient( Q::Panel, pal.fillColor.control.defaultColor ); + setBoxBorderMetrics( Q::Panel | Q::Selected | Q::Disabled, 0 ); setSpacing( Q::Panel, 8 ); setStrutSize( Q::Icon, { 12, 12 } ); - setGraphicRole( Q::Icon, QskFluent2Skin::GraphicRoleFillColorTextPrimary ); setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); setStrutSize( Q::Segment | A::Horizontal, segmentStrutSize ); setStrutSize( Q::Segment | A::Vertical, segmentStrutSize.transposed() ); - setBoxShape( Q::Segment , 4 ); + setBoxShape( Q::Segment, 4 ); setPadding( Q::Segment, { 8, 0, 8, 0 } ); - - // Hovered: - setGradient( Q::Segment | Q::Hovered, pal.fillColor.control.secondary ); - - setBoxBorderGradient( Q::Segment | Q::Hovered, pal.elevation.control.border, - pal.fillColor.control.secondary ); - - // Selected: - setGradient( Q::Segment | Q::Selected, pal.fillColor.accent.defaultColor ); - setGraphicRole( Q::Icon | Q::Selected, QskFluent2Skin::GraphicRoleFillColorTextOnAccentPrimary ); - setColor( Q::Text | Q::Selected, pal.fillColor.textOnAccent.primary ); - - // Disabled: - const QRgb standardDisabledBorderColor = flattenedColor( pal.strokeColor.control.defaultColor, - pal.fillColor.control.disabled ); - - setBoxBorderColors( Q::Segment | Q::Disabled, standardDisabledBorderColor ); - - setGradient( Q::Segment | Q::Disabled, pal.fillColor.control.disabled ); - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); - setGraphicRole( Q::Icon | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); - - - setGradient( Q::Segment | Q::Selected | Q::Disabled, pal.fillColor.accent.disabled ); - setColor( Q::Text | Q::Selected | Q::Disabled, pal.fillColor.textOnAccent.disabled ); - setGraphicRole( Q::Icon | Q::Selected | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextOnAccentDisabled ); - setBoxBorderMetrics( Q::Panel | Q::Selected | Q::Disabled, 0 ); - } -void Editor::setupSeparator() +void Editor::setupSegmentedBarColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { + using Q = QskSegmentedBar; using A = QskAspect; - using Q = QskSeparator; + using W = QskFluent2Skin; const auto& pal = theme.palette; - for ( auto variation : { A::Horizontal, A::Vertical } ) - { - const auto aspect = Q::Panel | variation; + auto panelColor = pal.fillColor.control.defaultColor; + panelColor = rgbSolid( panelColor, pal.background.solid.base ); - setMetric( aspect | A::Size, 1 ); - setBoxShape( Q::Panel, 0 ); - setBoxBorderMetrics( Q::Panel, 0 ); - setGradient( aspect, pal.strokeColor.divider.defaultColor ); + setGradient( Q::Panel, panelColor ); + + for ( const auto state1 : { A::NoState, Q::Hovered, Q::Disabled } ) + { + for ( const auto state2 : { A::NoState, Q::Selected } ) + { + const auto states = state1 | state2; + + QRgb segmentColor, borderColor1, borderColor2, textColor; + int graphicRole; + + if ( states == A::NoState ) + { + segmentColor = pal.fillColor.control.defaultColor; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + textColor = pal.fillColor.text.primary; + + graphicRole = W::GraphicRoleFillColorTextPrimary; + } + else if ( states & Q::Hovered ) + { + segmentColor = pal.fillColor.control.secondary; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + textColor = pal.fillColor.text.primary; + + graphicRole = W::GraphicRoleFillColorTextPrimary; + } + else if ( states == ( Q::Selected | Q::Disabled ) ) + { + segmentColor = pal.fillColor.accent.disabled; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.textOnAccent.disabled; + + graphicRole = W::GraphicRoleFillColorTextOnAccentDisabled; + } + else if ( states & Q::Selected ) + { + segmentColor = pal.fillColor.accent.defaultColor; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + textColor = pal.fillColor.textOnAccent.primary; + + graphicRole = W::GraphicRoleFillColorTextOnAccentPrimary; + } + else if ( states == Q::Disabled ) + { + segmentColor = pal.fillColor.control.disabled; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.text.disabled; + graphicRole = W::GraphicRoleFillColorTextDisabled; + } + + const auto segment = Q::Segment | section | states; + const auto text = Q::Text | section | states; + const auto icon = Q::Icon | section | states; + + segmentColor = rgbSolid( segmentColor, pal.background.solid.base ); + + setGradient( segment, segmentColor ); + setBoxBorderGradient( segment, borderColor1, borderColor2, panelColor ); + + setColor( text, textColor ); + + setGraphicRole( icon, graphicRole ); + } } } -void Editor::setupSlider() +void Editor::setupSeparatorMetrics() +{ + using Q = QskSeparator; + using A = QskAspect; + + setMetric( Q::Panel | A::Size, 1 ); + setBoxShape( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); +} + +void Editor::setupSeparatorColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskSeparator; + + const auto& pal = theme.palette; + setGradient( Q::Panel | section, pal.strokeColor.divider.defaultColor ); +} + +void Editor::setupSliderMetrics() { using Q = QskSlider; using A = QskAspect; - const auto& pal = theme.palette; const qreal extent = 22; setMetric( Q::Panel | A::Size, extent ); setBoxShape( Q::Panel, 0 ); setBoxBorderMetrics( Q::Panel, 0 ); - setGradient( Q::Panel, {} ); setPadding( Q::Panel | A::Horizontal, QskMargins( 0.5 * extent, 0 ) ); setPadding( Q::Panel | A::Vertical, QskMargins( 0, 0.5 * extent ) ); setMetric( Q::Groove | A::Size, 4 ); - setGradient( Q::Groove, pal.fillColor.controlStrong.defaultColor ); setBoxShape( Q::Groove, 100, Qt::RelativeSize ); setMetric( Q::Fill | A::Size, 4 ); - setGradient( Q::Fill, pal.fillColor.accent.defaultColor ); setBoxShape( Q::Fill, 100, Qt::RelativeSize ); setStrutSize( Q::Handle, { 22, 22 } ); - setGradient( Q::Handle, pal.fillColor.controlSolid.defaultColor ); setBoxShape( Q::Handle, 100, Qt::RelativeSize ); setBoxBorderMetrics( Q::Handle, 1 ); - setBoxBorderGradient( Q::Handle, pal.elevation.circle.border, pal.fillColor.controlSolid.defaultColor ); setStrutSize( Q::Ripple, { 12, 12 } ); - setGradient( Q::Ripple, pal.fillColor.accent.defaultColor ); setBoxShape( Q::Ripple, 100, Qt::RelativeSize ); setStrutSize( Q::Ripple | Q::Hovered, { 14, 14 } ); setStrutSize( Q::Ripple | Q::Pressed, { 10, 10 } ); - setGradient( Q::Ripple | Q::Pressed, pal.fillColor.accent.tertiary ); - - setGradient( Q::Groove | Q::Disabled, pal.fillColor.controlStrong.disabled ); - setGradient( Q::Fill | Q::Disabled, pal.fillColor.accent.disabled ); - setGradient( Q::Ripple | Q::Disabled, pal.fillColor.controlStrong.disabled ); } -void Editor::setupSpinBox() +void Editor::setupSliderColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskSlider; + using A = QskAspect; + + const auto& pal = theme.palette; + + { + const auto handleColor = pal.fillColor.controlSolid.defaultColor; + + setGradient( Q::Handle, handleColor ); + setBoxBorderGradient( Q::Handle, pal.elevation.circle.border, handleColor ); + } + + for ( auto state : { A::NoState , Q::Pressed , Q::Disabled } ) + { + QRgb grooveColor, fillColor, rippleColor; + + if ( state == A::NoState ) + { + grooveColor = pal.fillColor.controlStrong.defaultColor; + fillColor = pal.fillColor.accent.defaultColor; + rippleColor = fillColor; + } + else if ( state == Q::Pressed ) + { + grooveColor = pal.fillColor.controlStrong.defaultColor; + fillColor = pal.fillColor.accent.defaultColor; + rippleColor = pal.fillColor.accent.tertiary; + } + else if ( state == Q::Disabled ) + { + grooveColor = pal.fillColor.controlStrong.disabled; + fillColor = pal.fillColor.accent.disabled; + rippleColor = grooveColor; + } + + grooveColor = rgbSolid( grooveColor, pal.background.solid.base ); + + setGradient( Q::Groove | section | state, grooveColor ); + setGradient( Q::Fill | section | state, fillColor ); + setGradient( Q::Ripple | section | state, rippleColor ); + } +} + +void Editor::setupSpinBoxMetrics() { using Q = QskSpinBox; - const auto& pal = theme.palette; setHint( Q::Panel | QskAspect::Style, Q::ButtonsRight ); setStrutSize( Q::Panel, { -1, 32 } ); @@ -683,19 +1312,11 @@ void Editor::setupSpinBox() setBoxShape( Q::Panel, 3 ); setPadding( Q::Panel, { 11, 0, 11, 0 } ); - setGradient( Q::Panel, pal.fillColor.control.defaultColor ); - setBoxBorderGradient( Q::Panel, pal.elevation.control.border, - pal.fillColor.control.defaultColor ); - setAlignment( Q::Text, Qt::AlignLeft ); setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); setPadding( Q::TextPanel, { 11, 5, 0, 0 } ); - setStrutSize( Q::UpPanel, 16, 16 ); - setStrutSize( Q::DownPanel, 16, 16 ); - setStrutSize( Q::UpPanel, 32, 20 ); setPadding( Q::UpPanel, { 11, 7, 11, 7 } ); @@ -705,213 +1326,407 @@ void Editor::setupSpinBox() setSymbol( Q::UpIndicator, symbol( "spin-box-arrow-up" ) ); setSymbol( Q::DownIndicator, symbol( "spin-box-arrow-down" ) ); - setGraphicRole( Q::UpIndicator, QskFluent2Skin::GraphicRoleFillColorTextSecondary ); - setGraphicRole( Q::DownIndicator, QskFluent2Skin::GraphicRoleFillColorTextSecondary ); - - // Hovered: - - setGradient( Q::Panel | Q::Hovered, pal.fillColor.control.secondary ); - setBoxBorderGradient( Q::Panel | Q::Hovered, pal.elevation.textControl.border, - pal.fillColor.control.secondary ); - - // Focused (Pressed doesn't exist yet): - setBoxBorderMetrics( Q::Panel | Q::Focused, { 1, 1, 1, 2 } ); - - setGradient( Q::Panel | Q::Focused, pal.fillColor.control.inputActive ); - - auto gradient = pal.elevation.textControl.border; - gradient.at( 1 ) = pal.fillColor.accent.defaultColor; - - setBoxBorderGradient( Q::Panel | Q::Focused, gradient, pal.fillColor.control.inputActive ); - - // Disabled: - - setGradient( Q::Panel | Q::Disabled, pal.fillColor.control.disabled ); - setBoxBorderColors( Q::Panel | Q::Disabled, pal.strokeColor.control.defaultColor ); - - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); - - setGraphicRole( Q::UpIndicator | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); - setGraphicRole( Q::DownIndicator | Q::Disabled, QskFluent2Skin::GraphicRoleFillColorTextDisabled ); } -void Editor::setupTabBar() +void Editor::setupSpinBoxColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskSpinBox; + using A = QskAspect; + + const auto& pal = theme.palette; + + for ( auto state : { A::NoState, Q::Hovered, Q::Focused, Q::Disabled } ) + { + QRgb panelColor, borderColor1, borderColor2; + + if ( state == A::NoState ) + { + panelColor = pal.fillColor.control.defaultColor; + borderColor1 = pal.elevation.control.border[0]; + borderColor2 = pal.elevation.control.border[1]; + } + else if ( state == Q::Hovered ) + { + panelColor = pal.fillColor.control.secondary; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.elevation.textControl.border[1]; + } + else if ( state == Q::Focused ) + { + // Focused (Pressed doesn't exist yet): + + panelColor = pal.fillColor.control.inputActive; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.fillColor.accent.defaultColor; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.disabled; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + } + + QRgb textColor; + int graphicRole; + + if ( state != Q::Disabled ) + { + textColor = pal.fillColor.text.primary; + graphicRole = QskFluent2Skin::GraphicRoleFillColorTextSecondary; + } + else + { + textColor = pal.fillColor.text.disabled; + graphicRole = QskFluent2Skin::GraphicRoleFillColorTextDisabled; + } + + const auto panel = Q::Panel | section | state; + const auto text = Q::Text | section | state; + const auto upIndicator = Q::UpIndicator | section | state; + const auto downIndicator = Q::DownIndicator | section | state; + + panelColor = rgbSolid( panelColor, pal.background.solid.base ); + + setGradient( panel, panelColor ); + setBoxBorderGradient( panel, borderColor1, borderColor2, panelColor ); + + setColor( text, textColor ); + + setGraphicRole( upIndicator, graphicRole ); + setGraphicRole( downIndicator, graphicRole ); + } +} + +void Editor::setupTabBarMetrics() { } -void Editor::setupTabButton() +void Editor::setupTabBarColors( QskAspect::Section section, const QskFluent2Theme& theme ) +{ + setGradient( QskTabBar::Panel | section, theme.palette.background.solid.base ); +} + +void Editor::setupTabButtonMetrics() { using Q = QskTabButton; - const auto& pal = theme.palette; setStrutSize( Q::Panel, { -1, 31 } ); setPadding( Q::Panel, { 7, 0, 7, 0 } ); setBoxShape( Q::Panel, { 7, 7, 0, 0 } ); - setGradient( Q::Panel, Qt::transparent ); - setBoxBorderMetrics( Q::Panel, { 0, 0, 0, 1 } ); - setBoxBorderColors( Q::Panel, pal.strokeColor.card.defaultColor ); - - setGradient( Q::Panel | Q::Checked, pal.background.solid.tertiary ); - setBoxBorderMetrics( Q::Panel | Q::Checked, { 1, 1, 1, 0 } ); - setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); + setBoxBorderMetrics( Q::Panel, { 0, 0, 0, 1 } ); + setBoxBorderMetrics( Q::Panel | Q::Checked, { 1, 1, 1, 0 } ); + setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.secondary ); - setFontRole( Q::Text | Q::Checked, QskFluent2Skin::BodyStrong ); - setColor( Q::Text | Q::Checked, pal.fillColor.text.primary ); - - setGradient( Q::Panel | Q::Hovered, pal.fillColor.subtle.secondary ); - - setGradient( Q::Panel | Q::Pressed, pal.fillColor.subtle.tertiary ); } -void Editor::setupTabView() +void Editor::setupTabButtonColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { - using Q = QskTabView; + using Q = QskTabButton; const auto& pal = theme.palette; - setGradient( Q::Page, pal.background.solid.tertiary ); + for ( const auto state : { QskAspect::NoState, + Q::Checked, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + QRgb panelColor, textColor; + + if ( state == Q::Checked ) + { + panelColor = pal.background.solid.secondary; + textColor = pal.fillColor.text.primary; + } + else if ( state == Q::Hovered ) + { + panelColor = pal.fillColor.subtle.secondary; + textColor = pal.fillColor.text.secondary; + } + else if ( state == Q::Pressed ) + { + panelColor = pal.fillColor.subtle.tertiary; + textColor = pal.fillColor.text.secondary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.disabled; + textColor = pal.fillColor.text.disabled; + } + else + { + panelColor = pal.fillColor.subtle.tertiary; + textColor = pal.fillColor.text.secondary; + } + + const auto panel = Q::Panel | section | state; + const auto text = Q::Text | section | state; + + panelColor = rgbSolid( panelColor, pal.background.solid.base ); + setGradient( panel, panelColor ); + + const auto borderColor = rgbSolid( + pal.strokeColor.card.defaultColor, pal.background.solid.base ); + + setBoxBorderColors( panel, borderColor ); + + setColor( text, textColor ); + } } -void Editor::setupTextLabel() +void Editor::setupTabViewMetrics() +{ +} + +void Editor::setupTabViewColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskTabView; + setGradient( Q::Page | section, theme.palette.background.solid.secondary ); +} + +void Editor::setupGraphicLabelMetrics() +{ + using Q = QskGraphicLabel; + + setPadding( Q::Panel, 10 ); + setBoxShape( Q::Panel, 3 ); + setBoxBorderMetrics( Q::Panel, 1 ); +} + +void Editor::setupGraphicLabelColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskGraphicLabel; + const auto& pal = theme.palette; + +#if 1 + setColor( Q::Panel | section, pal.fillColor.subtle.secondary ); + setBoxBorderColors( Q::Panel | section, pal.strokeColor.control.defaultColor ); +#endif +} + +void Editor::setupTextLabelMetrics() +{ + using Q = QskTextLabel; + + setPadding( Q::Panel, 10 ); + setBoxShape( Q::Panel, 3 ); + setBoxBorderMetrics( Q::Panel, 1 ); + + setFontRole( Q::Text, QskFluent2Skin::Body ); +} + +void Editor::setupTextLabelColors( + QskAspect::Section section, const QskFluent2Theme& theme ) { using Q = QskTextLabel; const auto& pal = theme.palette; - setPadding( Q::Panel, 10 ); - - setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.primary ); +#if 1 + setColor( Q::Panel | section, pal.fillColor.subtle.secondary ); + setBoxBorderColors( Q::Panel | section, pal.strokeColor.control.defaultColor ); +#endif + setColor( Q::Text | section, pal.fillColor.text.primary ); } - -void Editor::setupTextInput() +void Editor::setupTextInputMetrics() { using Q = QskTextInput; - const auto& pal = theme.palette; setStrutSize( Q::Panel, { -1, 30 } ); - setBoxBorderMetrics( Q::Panel, 1 ); - setBoxShape( Q::Panel, 3 ); setPadding( Q::Panel, { 11, 0, 11, 0 } ); + setBoxBorderMetrics( Q::Panel, 1 ); + for( const auto& state : { Q::Focused, Q::Editing } ) + setBoxBorderMetrics( Q::Panel | state, { 1, 1, 1, 2 } ); + + setBoxShape( Q::Panel, 3 ); + setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); setFontRole( Q::Text, QskFluent2Skin::Body ); - setColor( Q::Text, pal.fillColor.text.secondary ); +} - setGradient( Q::Panel, pal.fillColor.control.defaultColor ); - setBoxBorderGradient( Q::Panel, pal.elevation.textControl.border, - pal.fillColor.control.defaultColor ); +void Editor::setupTextInputColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskTextInput; + using A = QskAspect; + + const auto& pal = theme.palette; setColor( Q::PanelSelected, pal.fillColor.accent.selectedTextBackground ); setColor( Q::TextSelected, pal.fillColor.textOnAccent.selectedText ); - // Hovered: - - setGradient( Q::Panel | Q::Hovered, pal.fillColor.control.secondary ); - setBoxBorderGradient( Q::Panel | Q::Hovered, pal.elevation.textControl.border, - pal.fillColor.control.secondary ); - - - // Pressed & Focused: - - for( const auto& state : { Q::Focused, Q::Editing } ) + for( const auto state : { A::NoState, Q::Hovered, Q::Focused, Q::Editing, Q::Disabled } ) { - setBoxBorderMetrics( Q::Panel | state, { 1, 1, 1, 2 } ); + QRgb panelColor, borderColor1, borderColor2, textColor; - setGradient( Q::Panel | state, pal.fillColor.control.inputActive ); + if ( state == A::NoState ) + { + panelColor = pal.fillColor.control.defaultColor; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.elevation.textControl.border[1]; + textColor = pal.fillColor.text.secondary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.secondary; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.elevation.textControl.border[1]; + textColor = pal.fillColor.text.secondary; + } + else if ( ( state == Q::Focused ) || ( state == Q::Editing ) ) + { + panelColor = pal.fillColor.control.inputActive; + borderColor1 = pal.elevation.textControl.border[0]; + borderColor2 = pal.fillColor.accent.defaultColor; + textColor = pal.fillColor.text.secondary; + } + else if ( state == Q::Disabled ) + { + panelColor = pal.fillColor.control.disabled; + borderColor1 = borderColor2 = pal.strokeColor.control.defaultColor; + textColor = pal.fillColor.text.disabled; + } - auto gradient = pal.elevation.textControl.border; - gradient.at( 1 ) = pal.fillColor.accent.defaultColor; + const auto panel = Q::Panel | section | state; + const auto text = Q::Text | section | state; - setBoxBorderGradient( Q::Panel | state, gradient, pal.fillColor.control.inputActive ); + panelColor = rgbSolid( panelColor, pal.background.solid.base ); + + setGradient( panel, panelColor ); + setBoxBorderGradient( panel, borderColor1, borderColor2, panelColor ); + + setColor( text, textColor ); } - - // Disabled: - - setGradient( Q::Panel | Q::Disabled, pal.fillColor.control.disabled ); - setBoxBorderColors( Q::Panel | Q::Disabled, pal.strokeColor.control.defaultColor ); - - setColor( Q::Text | Q::Disabled, pal.fillColor.text.disabled ); } -void Editor::setupSwitchButton() +void Editor::setupSwitchButtonMetrics() { using Q = QskSwitchButton; using A = QskAspect; - const auto& pal = theme.palette; const QSizeF strutSize( 38, 18 ); setStrutSize( Q::Groove | A::Horizontal, strutSize ); setStrutSize( Q::Groove | A::Vertical, strutSize.transposed() ); setBoxShape( Q::Groove, 100, Qt::RelativeSize ); + setBoxBorderMetrics( Q::Groove, 1 ); setBoxBorderMetrics( Q::Groove | Q::Checked, 0 ); setBoxShape( Q::Handle, 100, Qt::RelativeSize ); setPosition( Q::Handle, 0.1, { QskStateCombination::CombinationNoState, Q::Disabled } ); - setPosition( Q::Handle | Q::Checked, 0.9, { QskStateCombination::CombinationNoState, Q::Disabled } ); - setAnimation( Q::Handle | A::Metric, 100 ); + setPosition( Q::Handle | Q::Checked, 0.9, + { QskStateCombination::CombinationNoState, Q::Disabled } ); + setBoxBorderMetrics( Q::Handle, 0 ); setBoxBorderMetrics( Q::Handle | Q::Checked, 1 ); - - // ### big size during animation - - setGradient( Q::Groove, pal.fillColor.controlAlt.secondary ); - setGradient( Q::Groove | Q::Checked, pal.fillColor.accent.defaultColor ); - setBoxBorderColors( Q::Groove, pal.strokeColor.controlStrong.defaultColor ); + setBoxBorderMetrics( Q::Handle | Q::Disabled | Q::Checked, 0 ); setStrutSize( Q::Handle, 12, 12 ); - setGradient( Q::Handle, pal.strokeColor.controlStrong.defaultColor ); - setGradient( Q::Handle | Q::Checked, pal.fillColor.textOnAccent.primary ); - setBoxBorderGradient( Q::Handle | Q::Checked, pal.elevation.circle.border, - pal.fillColor.accent.defaultColor ); - - - setGradient( Q::Groove | Q::Hovered, pal.fillColor.controlAlt.tertiary ); - setGradient( Q::Groove | Q::Hovered | Q::Checked, pal.fillColor.accent.secondary ); - setBoxBorderColors( Q::Groove | Q::Hovered, pal.fillColor.text.secondary ); - - setStrutSize( Q::Handle | Q::Hovered, 14, 14, { QskStateCombination::CombinationNoState, Q::Checked } ); - setGradient( Q::Handle | Q::Hovered, pal.fillColor.text.secondary ); - // Handle | Hovered | Checked is the same as in Rest state - - setBoxBorderGradient( Q::Handle | Q::Hovered | Q::Checked, pal.elevation.circle.border, - pal.fillColor.accent.secondary ); - - - setGradient( Q::Groove | Q::Pressed, pal.fillColor.controlAlt.quaternary ); - setGradient( Q::Groove | Q::Pressed | Q::Checked, pal.fillColor.accent.tertiary ); - setBoxBorderColors( Q::Groove | Q::Pressed, pal.strokeColor.controlStrong.defaultColor ); + setStrutSize( Q::Handle | Q::Hovered, 14, 14, + { QskStateCombination::CombinationNoState, Q::Checked } ); const QSizeF pressedSize( 17, 14 ); - setStrutSize( Q::Handle | Q::Pressed | A::Horizontal, pressedSize, { QskStateCombination::CombinationNoState, Q::Checked } ); - setStrutSize( Q::Handle | Q::Pressed | A::Vertical, pressedSize.transposed(), { QskStateCombination::CombinationNoState, Q::Checked } ); - setGradient( Q::Handle | Q::Pressed, pal.strokeColor.controlStrong.defaultColor ); - // Handle | Pressed | Checked is the same as in Rest state - setBoxBorderGradient( Q::Handle | Q::Pressed | Q::Checked, pal.elevation.circle.border, - pal.fillColor.accent.tertiary ); + setStrutSize( Q::Handle | Q::Pressed | A::Horizontal, + pressedSize, { QskStateCombination::CombinationNoState, Q::Checked } ); + setStrutSize( Q::Handle | Q::Pressed | A::Vertical, + pressedSize.transposed(), { QskStateCombination::CombinationNoState, Q::Checked } ); - setGradient( Q::Groove | Q::Disabled, pal.fillColor.controlAlt.disabled ); - setBoxBorderColors( Q::Groove | Q::Disabled, pal.fillColor.text.disabled ); - setGradient( Q::Groove | Q::Disabled | Q::Checked, pal.fillColor.accent.disabled ); - setBoxBorderColors( Q::Groove | Q::Disabled | Q::Checked, pal.fillColor.accent.disabled ); + setStrutSize( Q::Handle | Q::Disabled, 12, 12, + { QskStateCombination::CombinationNoState, Q::Checked } ); - setStrutSize( Q::Handle | Q::Disabled, 12, 12, { QskStateCombination::CombinationNoState, Q::Checked } ); - setGradient( Q::Handle | Q::Disabled, pal.fillColor.text.disabled ); - setGradient( Q::Handle | Q::Disabled | Q::Checked, pal.fillColor.textOnAccent.disabled ); - setBoxBorderMetrics( Q::Handle | Q::Disabled | Q::Checked, 1 ); + setAnimation( Q::Handle | A::Metric, 100 ); } -void Editor::setupSubWindow() +void Editor::setupSwitchButtonColors( + QskAspect::Section section, const QskFluent2Theme& theme ) +{ + using Q = QskSwitchButton; + using A = QskAspect; + + const auto& pal = theme.palette; + + for ( const auto state1 : { A::NoState, Q::Hovered, Q::Pressed, Q::Disabled } ) + { + for ( const auto state2 : { A::NoState, Q::Checked } ) + { + const auto states = state1 | state2; + + QRgb grooveColor, grooveBorderColor, handleColor; + + if ( states == A::NoState ) + { + grooveColor = pal.fillColor.controlAlt.secondary; + grooveBorderColor = pal.strokeColor.controlStrong.defaultColor; + handleColor = pal.strokeColor.controlStrong.defaultColor; + } + else if ( states == Q::Checked ) + { + grooveColor = pal.fillColor.accent.defaultColor; + grooveBorderColor = pal.strokeColor.controlStrong.defaultColor; + handleColor = pal.fillColor.textOnAccent.primary; + } + else if ( states == Q::Hovered ) + { + grooveColor = pal.fillColor.controlAlt.tertiary; + grooveBorderColor = pal.fillColor.text.secondary; + handleColor = pal.fillColor.text.secondary; + } + else if ( states == ( Q::Hovered | Q::Checked ) ) + { + grooveColor = pal.fillColor.accent.secondary; + grooveBorderColor = pal.strokeColor.controlStrong.defaultColor; + handleColor = pal.fillColor.textOnAccent.primary; + //handleColor = pal.fillColor.accent.defaultColor; + } + else if ( states == Q::Pressed ) + { + grooveColor = pal.fillColor.controlAlt.quaternary; + grooveBorderColor = pal.strokeColor.controlStrong.defaultColor; + handleColor = pal.strokeColor.controlStrong.defaultColor; + } + else if ( states == ( Q::Pressed | Q::Checked ) ) + { + grooveColor = pal.fillColor.accent.tertiary; + grooveBorderColor = pal.strokeColor.controlStrong.defaultColor; + handleColor = pal.fillColor.textOnAccent.primary; + } + else if ( states == Q::Disabled ) + { + grooveColor = pal.fillColor.controlAlt.disabled; + grooveBorderColor = pal.fillColor.text.disabled; + handleColor = pal.fillColor.text.disabled; + } + else if ( states == ( Q::Disabled | Q::Checked ) ) + { + grooveColor = pal.fillColor.accent.disabled; + grooveBorderColor = pal.fillColor.accent.disabled; + handleColor = pal.fillColor.textOnAccent.disabled; + } + + const auto groove = Q::Groove | section | states; + const auto handle = Q::Handle | section | states; + + grooveColor = rgbSolid( grooveColor, pal.background.solid.base ); + + setGradient( groove, grooveColor ); + setBoxBorderColors( groove, grooveBorderColor ); + + setGradient( handle, handleColor ); + setBoxBorderGradient( handle, pal.elevation.circle.border, grooveColor ); + } + } +} + +void Editor::setupSubWindow( const QskFluent2Theme& theme ) { using Q = QskSubWindow; const auto& pal = theme.palette; @@ -933,32 +1748,51 @@ void Editor::setupSubWindow() setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap ); } -void Editor::setupVirtualKeyboard() +void Editor::setupVirtualKeyboardMetrics() { using Q = QskVirtualKeyboard; - const auto& pal = theme.palette; setMargin( Q::ButtonPanel, 2 ); + setFontRole( Q::ButtonText, QskFluent2Skin::BodyLarge ); + setPadding( Q::Panel, 8 ); +} + +void Editor::setupVirtualKeyboardColors( + QskAspect::Section, const QskFluent2Theme& theme ) +{ + using Q = QskVirtualKeyboard; + + const auto& pal = theme.palette; + setGradient( Q::ButtonPanel, pal.fillColor.control.defaultColor ); setGradient( Q::ButtonPanel | Q::Hovered, pal.fillColor.control.secondary ); setGradient( Q::ButtonPanel | QskPushButton::Pressed, pal.fillColor.control.tertiary ); setColor( Q::ButtonText, pal.fillColor.text.primary ); - setFontRole( Q::ButtonText, QskFluent2Skin::BodyLarge ); setColor( Q::ButtonText | QskPushButton::Pressed, pal.fillColor.text.secondary ); - setGradient( Q::Panel, pal.background.solid.secondary ); - setPadding( Q::Panel, 8 ); + setGradient( Q::Panel, pal.background.solid.tertiary ); } -QskFluent2Skin::QskFluent2Skin( const QskFluent2Theme& palette, QObject* parent ) +QskFluent2Skin::QskFluent2Skin( QObject* parent ) : Inherited( parent ) { setupFonts(); - setupGraphicFilters( palette ); - Editor editor( &hintTable(), palette ); - editor.setup(); + Editor editor( &hintTable() ); + editor.setupMetrics(); +} + +void QskFluent2Skin::addTheme( QskAspect::Section section, const QskFluent2Theme& theme ) +{ + if ( section == QskAspect::Body ) + { + // design flaw: we can't have section sensitive filters. TODO .. + setupGraphicFilters( theme ); + } + + Editor editor( &hintTable() ); + editor.setupColors( section, theme ); } QskFluent2Skin::~QskFluent2Skin() diff --git a/skins/fluent2/QskFluent2Skin.h b/skins/fluent2/QskFluent2Skin.h index f731327f..2678dba4 100644 --- a/skins/fluent2/QskFluent2Skin.h +++ b/skins/fluent2/QskFluent2Skin.h @@ -18,9 +18,12 @@ class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin using Inherited = QskSkin; public: - QskFluent2Skin( const QskFluent2Theme&, QObject* parent = nullptr ); + QskFluent2Skin( QObject* parent = nullptr ); ~QskFluent2Skin() override; + void addTheme( QskAspect::Section, const QskFluent2Theme& ); + void setup(); + enum GraphicRole { GraphicRoleFillColorTextDisabled, diff --git a/skins/fluent2/QskFluent2SkinFactory.cpp b/skins/fluent2/QskFluent2SkinFactory.cpp index a7127ba8..8b393b73 100644 --- a/skins/fluent2/QskFluent2SkinFactory.cpp +++ b/skins/fluent2/QskFluent2SkinFactory.cpp @@ -7,8 +7,16 @@ #include "QskFluent2Skin.h" #include "QskFluent2Theme.h" -static const QString fluent2LightSkinName = QStringLiteral( "Fluent2 Light" ); -static const QString fluent2DarkSkinName = QStringLiteral( "Fluent2 Dark" ); +static const QString nameLight = QStringLiteral( "Fluent2 Light" ); +static const QString nameDark = QStringLiteral( "Fluent2 Dark" ); + +namespace +{ + inline constexpr QRgb rgbGray( int value ) + { + return qRgba( value, value, value, 255 ); + } +} QskFluent2SkinFactory::QskFluent2SkinFactory( QObject* parent ) : QskSkinFactory( parent ) @@ -21,23 +29,71 @@ QskFluent2SkinFactory::~QskFluent2SkinFactory() QStringList QskFluent2SkinFactory::skinNames() const { - return { fluent2LightSkinName, fluent2DarkSkinName }; + return { nameLight, nameDark }; } QskSkin* QskFluent2SkinFactory::createSkin( const QString& skinName ) { - if ( QString::compare( skinName, fluent2LightSkinName, Qt::CaseInsensitive ) == 0 ) + QskSkin::ColorScheme colorScheme; + + if ( QString::compare( skinName, nameLight, Qt::CaseInsensitive ) == 0 ) { - QskFluent2Theme theme( QskSkin::LightScheme ); - return new QskFluent2Skin( theme ); + colorScheme = QskSkin::LightScheme; } - else if ( QString::compare( skinName, fluent2DarkSkinName, Qt::CaseInsensitive ) == 0 ) + else if ( QString::compare( skinName, nameDark, Qt::CaseInsensitive ) == 0 ) { - QskFluent2Theme theme( QskSkin::DarkScheme ); - return new QskFluent2Skin( theme ); + colorScheme = QskSkin::DarkScheme; + } + else + { + return nullptr; } - return nullptr; + struct + { + QskSkin::ColorScheme scheme; + QskFluent2Theme::BaseColors baseColors; + QskFluent2Theme::AccentColors accentColors; + + QskFluent2Theme theme() const { return { scheme, baseColors, accentColors }; } + } colors[2]; + + switch( colorScheme ) + { + case QskSkin::LightScheme: + { + colors[0].scheme = colorScheme; + colors[0].baseColors = { rgbGray( 243 ), rgbGray( 249 ), rgbGray( 238 ) }; + colors[0].accentColors = { 0xff0078d4, 0xff005eb7, 0xff003d92, 0xff001968 }; + + colors[1].scheme = colorScheme; + colors[1].baseColors = { rgbGray( 249 ), rgbGray( 249 ), rgbGray( 238 ) }; + colors[1].accentColors = colors[0].accentColors; + + break; + } + case QskSkin::DarkScheme: + { + colors[0].scheme = colorScheme; + colors[0].baseColors = { rgbGray( 32 ), rgbGray( 40 ), rgbGray( 28 ) }; + colors[0].accentColors = { 0xff0078d4, 0xff0093f9, 0xff60ccfe, 0xff98ecfe }; + + colors[1].scheme = colorScheme; + colors[1].baseColors = { rgbGray( 40 ), rgbGray( 44 ), rgbGray( 28 ) }; + colors[1].accentColors = colors[0].accentColors; + + break; + } + default:; + } + + auto skin = new QskFluent2Skin(); + + skin->addTheme( QskAspect::Body, colors[0].theme() ); + skin->addTheme( QskAspect::Header, colors[1].theme() ); + skin->addTheme( QskAspect::Footer, colors[1].theme() ); + + return skin; } #include "moc_QskFluent2SkinFactory.cpp" diff --git a/skins/fluent2/QskFluent2Theme.cpp b/skins/fluent2/QskFluent2Theme.cpp index 97f4ad3f..402d86cf 100644 --- a/skins/fluent2/QskFluent2Theme.cpp +++ b/skins/fluent2/QskFluent2Theme.cpp @@ -14,27 +14,25 @@ namespace } } -QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme ) - : QskFluent2Theme( colorScheme, - { // default Fluent accent colors: - 0xff98ecfe, - 0xff60ccfe, - 0xff0093f9, - 0xff0078d4, - 0xff005eb7, - 0xff003d92, - 0xff001968 - } ) -{ -} - QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, - const std::array< QRgb, NumAccentColors >& accentColors ) + const BaseColors& baseColors, const AccentColors& accentColors ) { using namespace QskRgb; + { + auto& colors = palette.background; + + colors.solid.base = baseColors.primary; + colors.solid.secondary = baseColors.secondary; + colors.solid.tertiary = baseColors.tertiary; + } + if( colorScheme != QskSkin::DarkScheme ) { + { + palette.background.solid.quaternary = rgbGray( 255 ); + } + { auto& colors = palette.fillColor; @@ -43,9 +41,10 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, colors.text.tertiary = rgbGray( 0, 0.4458 ); colors.text.disabled = rgbGray( 0, 0.3614 ); - colors.accentText.primary = accentColors[ AccentDark2 ]; - colors.accentText.secondary = accentColors[ AccentDark3 ]; - colors.accentText.tertiary = accentColors[ AccentDark1 ]; + colors.accentText.primary = accentColors.tertiary; + colors.accentText.secondary = accentColors.quaternary; + colors.accentText.tertiary = accentColors.secondary; + colors.accentText.disabled = rgbGray( 0, 0.3614 ); colors.textOnAccent.primary = rgbGray( 255 ); @@ -73,13 +72,34 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, colors.controlAlt.quaternary = rgbGray( 0, 0.0924 ); colors.controlAlt.disabled = Qt::transparent; - colors.accent.defaultColor = accentColors[ AccentDark1 ]; - colors.accent.secondary = toTransparentF( accentColors[ AccentDark1 ], 0.90 ); - colors.accent.tertiary = toTransparentF( accentColors[ AccentDark1 ], 0.80 ); + colors.accent.defaultColor = accentColors.secondary; + colors.accent.secondary = toTransparentF( accentColors.secondary, 0.90 ); + colors.accent.tertiary = toTransparentF( accentColors.secondary, 0.80 ); colors.accent.disabled = rgbGray( 0, 0.2169 ); - colors.accent.selectedTextBackground = accentColors[ AccentBase ]; + colors.accent.selectedTextBackground = accentColors.primary; } +#if 0 + { + // system colors + + critical = 0xffc42b1c; + success = 0xff0f7b0f; + attention = 0xff005fb7; + caution = 0xff9d5d00; + attentionBackground = rgbGray( 246, 0.50 ); + successBackground = 0xffdff6dd; + cautionBackground = 0xfffff4ce; + criticalBackground = 0xfffde7e9; + neutral = rgbGray( 0, 0.4458 ); + neutralBackground = rgbGray( 0, 0.0241 ); + + solidNeutral = rgbGray( 138 ); + solidAttentionBackground = rgbGray( 247 ); + solidNeutralBackground = rgbGray( 243 ); + } +#endif + { auto& colors = palette.elevation; @@ -118,30 +138,23 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, { auto& colors = palette.background; - colors.card.defaultColor = rgbGray( 255, 0.70 ); - colors.card.secondary = rgbGray( 246, 0.50 ); - colors.card.tertiary = rgbGray( 255 ); - colors.overlay.defaultColor = rgbGray( 0, 0.30 ); colors.layer.alt = rgbGray( 255 ); colors.flyout.defaultColor = rgbGray( 252, 0.85 ); - colors.solid.base = rgbGray( 243 ); - colors.solid.secondary = rgbGray( 238 ); - colors.solid.tertiary = rgbGray( 249 ); - colors.solid.quaternary = rgbGray( 255 ); } // Shadow: - shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.04 ) }; - shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.10 ) }; shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.14 ) }; // ### should actually be drawn twice with different values: shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.1474 ) }; } else { + { + palette.background.solid.quaternary = rgbGray( 44 ); + } { auto& colors = palette.fillColor; @@ -150,9 +163,9 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, colors.text.tertiary = rgbGray( 255, 0.5442 ); colors.text.disabled = rgbGray( 255, 0.3628 ); - colors.accentText.primary = accentColors[ AccentLight3 ]; - colors.accentText.secondary = accentColors[ AccentLight3 ]; - colors.accentText.tertiary = accentColors[ AccentLight2 ]; + colors.accentText.primary = accentColors.quaternary; + colors.accentText.secondary = accentColors.quaternary; + colors.accentText.tertiary = accentColors.tertiary; colors.accentText.disabled = rgbGray( 255, 0.3628 ); colors.textOnAccent.primary = rgbGray( 0 ); @@ -180,13 +193,33 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, colors.controlAlt.quaternary = rgbGray( 255, 0.0698 ); colors.controlAlt.disabled = Qt::transparent; - colors.accent.defaultColor = accentColors[ AccentLight2 ]; - colors.accent.secondary = toTransparentF( accentColors[ AccentLight2 ], 0.90 ); - colors.accent.tertiary = toTransparentF( accentColors[ AccentLight2 ], 0.80 ); + colors.accent.defaultColor = accentColors.tertiary; + colors.accent.secondary = toTransparentF( accentColors.tertiary, 0.90 ); + colors.accent.tertiary = toTransparentF( accentColors.tertiary, 0.80 ); colors.accent.disabled = rgbGray( 255, 0.1581 ); - colors.accent.selectedTextBackground = accentColors[ AccentBase ]; + colors.accent.selectedTextBackground = accentColors.primary; } +#if 0 + { + // system colors + + critical = 0xffff99a4; + success = 0xff6ccb5f; + attention = 0xff60cdff; + caution = 0xfffce100; + attentionBackground = rgbGray( 255, 0.0326 ); + successBackground = 0xff393d1b; + cautionBackground = 0xff433519; + criticalBackground = 0xff442726; + neutral = rgbGray( 255, 0.5442 ); + neutralBackground = rgbGray( 255, 0.0326 ); + solidNeutral = rgbGray( 157 ); + solidAttentionBackground = rgbGray( 46 ); + solidNeutralBackground = rgbGray( 46 ); + } +#endif + { auto& colors = palette.elevation; @@ -227,24 +260,13 @@ QskFluent2Theme::QskFluent2Theme( QskSkin::ColorScheme colorScheme, { auto& colors = palette.background; - colors.card.defaultColor = rgbGray( 255, 0.0512 ); - colors.card.secondary = rgbGray( 255, 0.0326 ); - colors.card.tertiary = rgbGray( 255 ); // not set in Figma - colors.overlay.defaultColor = rgbGray( 0, 0.30 ); colors.layer.alt = rgbGray( 255, 0.0538 ); colors.flyout.defaultColor = rgbGray( 44, 0.96 ); - - colors.solid.base = rgbGray( 32 ); - colors.solid.secondary = rgbGray( 28 ); - colors.solid.tertiary = rgbGray( 40 ); - colors.solid.quaternary = rgbGray( 44 ); } // Shadow: - shadow.cardRest = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.13 ) }; - shadow.cardHover = { QskShadowMetrics( 0, 4, QPointF( 0, 2 ) ), rgbGray( 0, 0.26 ) }; shadow.flyout = { QskShadowMetrics( 0, 16, QPointF( 0, 8 ) ), rgbGray( 0, 0.26 ) }; // ### should actually be drawn twice with different values: shadow.dialog = { QskShadowMetrics( 0, 21, QPointF( 0, 2 ) ), rgbGray( 0, 0.37 ) }; diff --git a/skins/fluent2/QskFluent2Theme.h b/skins/fluent2/QskFluent2Theme.h index af563871..8aba499b 100644 --- a/skins/fluent2/QskFluent2Theme.h +++ b/skins/fluent2/QskFluent2Theme.h @@ -17,21 +17,23 @@ class QSK_FLUENT2_EXPORT QskFluent2Theme { public: - enum AccentColors + struct BaseColors { - AccentLight3, - AccentLight2, - AccentLight1, - AccentBase, - AccentDark1, - AccentDark2, - AccentDark3, - - NumAccentColors + QRgb primary; + QRgb secondary; + QRgb tertiary; }; - QskFluent2Theme( QskSkin::ColorScheme ); - QskFluent2Theme( QskSkin::ColorScheme, const std::array< QRgb, NumAccentColors >& ); + struct AccentColors + { + QRgb primary; + QRgb secondary; + QRgb tertiary; + QRgb quaternary; + }; + + QskFluent2Theme( QskSkin::ColorScheme, const BaseColors& baseColors, + const AccentColors& accentColors ); typedef std::array< QRgb, 2 > BorderGradient; @@ -175,13 +177,6 @@ class QSK_FLUENT2_EXPORT QskFluent2Theme struct Background { - struct - { - QRgb defaultColor; - QRgb secondary; - QRgb tertiary; - } card; - struct { QRgb defaultColor; @@ -222,8 +217,6 @@ class QSK_FLUENT2_EXPORT QskFluent2Theme struct { - ShadowSettings cardRest; - ShadowSettings cardHover; ShadowSettings flyout; ShadowSettings dialog; } shadow; diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index 3013a8bb..a41fcfca 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -90,10 +90,6 @@ namespace const auto factoryData = pluginData.value( TokenData ).toObject(); m_factoryId = factoryData.value( TokenFactoryId ).toString().toLower(); -#if 1 - if ( m_factoryId == "fluent2factory" ) - return false; // we need to solve a couple of problems first -#endif if ( m_factoryId.isEmpty() ) { // Creating a dummy factory id