From 6035d4ea5024386a4e73dc7fbe5956517386c2a6 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 17 Jan 2024 17:35:26 +0100 Subject: [PATCH 01/27] Using https://en.m.wikipedia.org/wiki/File:Tux-simple-flat-monochrome.svg --- examples/qvgviewer/MainWindow.cpp | 32 ++------ examples/qvgviewer/MainWindow.h | 5 -- examples/qvgviewer/qvg/01.01.10.qvg | Bin 4495 -> 0 bytes examples/qvgviewer/qvg/01.03.04q.qvg | Bin 12867 -> 0 bytes examples/qvgviewer/qvg/01.08.05q.qvg | Bin 15593 -> 0 bytes examples/qvgviewer/qvg/01.25.18.qvg | Bin 18383 -> 0 bytes examples/qvgviewer/qvg/Tux.qvg | Bin 0 -> 23699 bytes examples/qvgviewer/qvgviewer.qrc | 7 +- examples/qvgviewer/svg/01.01.10.svg | 25 ------- examples/qvgviewer/svg/01.03.04q.svg | 78 -------------------- examples/qvgviewer/svg/01.08.05q.svg | 105 --------------------------- examples/qvgviewer/svg/01.25.18.svg | 34 --------- examples/qvgviewer/svg/Tux.svg | 21 ++++++ 13 files changed, 29 insertions(+), 278 deletions(-) delete mode 100644 examples/qvgviewer/qvg/01.01.10.qvg delete mode 100644 examples/qvgviewer/qvg/01.03.04q.qvg delete mode 100644 examples/qvgviewer/qvg/01.08.05q.qvg delete mode 100644 examples/qvgviewer/qvg/01.25.18.qvg create mode 100644 examples/qvgviewer/qvg/Tux.qvg delete mode 100644 examples/qvgviewer/svg/01.01.10.svg delete mode 100644 examples/qvgviewer/svg/01.03.04q.svg delete mode 100644 examples/qvgviewer/svg/01.08.05q.svg delete mode 100644 examples/qvgviewer/svg/01.25.18.svg create mode 100644 examples/qvgviewer/svg/Tux.svg diff --git a/examples/qvgviewer/MainWindow.cpp b/examples/qvgviewer/MainWindow.cpp index bd32d95f..33269930 100644 --- a/examples/qvgviewer/MainWindow.cpp +++ b/examples/qvgviewer/MainWindow.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -75,18 +74,7 @@ class GraphicLabel : public QskGraphicLabel MainWindow::MainWindow() { - m_tabView = new QskTabView(); - m_tabView->setTabBarEdge( Qt::LeftEdge ); - - const QString resourceDir( ":/qvg" ); - const QStringList icons = QDir( resourceDir ).entryList(); - - for ( const auto& icon : icons ) - { - auto title = icon; - m_tabView->addTab( title.replace( ".qvg", "" ), - new GraphicLabel( QskGraphicIO::read( resourceDir + "/" + icon ) ) ); - } + auto label = new GraphicLabel( QskGraphicIO::read( QString( ":/qvg/Tux.qvg" ) ) ); auto invertButton = new QskPushButton( "Inverted" ); invertButton->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); @@ -97,12 +85,12 @@ MainWindow::MainWindow() box->setPanel( true ); box->setPadding( 5 ); box->addItem( invertButton ); - box->addItem( m_tabView ); + box->addItem( label ); addItem( box ); connect( invertButton, &QskPushButton::toggled, - this, &MainWindow::setDarknessMode ); + label, &GraphicLabel::setDarknessMode ); connect( qskSetup, &QskSetup::skinChanged, this, &MainWindow::setGraphicRoles ); @@ -110,21 +98,11 @@ MainWindow::MainWindow() setGraphicRoles( qskSetup->skin() ); } -void MainWindow::setDarknessMode( bool on ) -{ - for ( int i = 0; i < m_tabView->count(); i++ ) - { - auto label = static_cast< GraphicLabel* >( m_tabView->pageAt( i ) ); - label->setDarknessMode( on ); - } -} - void MainWindow::setGraphicRoles( QskSkin* skin ) { - // substituting black and white + // substituting black QskColorFilter colorFilter; - colorFilter.addColorSubstitution( qRgb( 0, 0, 0 ), qRgb( 189, 183, 107 ) ); - colorFilter.addColorSubstitution( qRgb( 255, 255, 255 ), qRgb( 50, 50, 50 ) ); + colorFilter.addColorSubstitution( QskRgb::Black, QskRgb::DarkKhaki ); skin->setGraphicFilter( GraphicLabel::Inverted, colorFilter ); } diff --git a/examples/qvgviewer/MainWindow.h b/examples/qvgviewer/MainWindow.h index aca9d988..2d8eb8b5 100644 --- a/examples/qvgviewer/MainWindow.h +++ b/examples/qvgviewer/MainWindow.h @@ -7,7 +7,6 @@ #include -class QskTabView; class QskSkin; class MainWindow : public QskWindow @@ -18,9 +17,5 @@ class MainWindow : public QskWindow MainWindow(); private Q_SLOTS: - void setDarknessMode( bool on ); void setGraphicRoles( QskSkin* ); - - private: - QskTabView* m_tabView; }; diff --git a/examples/qvgviewer/qvg/01.01.10.qvg b/examples/qvgviewer/qvg/01.01.10.qvg deleted file mode 100644 index ecc02b2ee636e8edfebb41dfe52caaaab99c1615..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4495 zcmds*dr*{B6u`d+n!_ZLl9{L}`F0R|kSOXNB!nOoToo4qd5MIIxC`uxj^;RyGFHNv zQ)n3Il=;XU)3nCPtKo}$td3=lI-+Lgn21?9jGCQuzWsK;1^(#||KT#T-}n9QIrnw$ zIpon*3w_XoAFg)ew(UIPvp&zf; z=JjAdH-ZY-Z|v+atp6QD{R^bnj($W+=$4DV;}$~b4&}wSzDq|Wiv|BST@G^If{dW_ zFw>F-jh*RxHKcnrWY3CPzr1}vX44-Y+j_rh4@CNY`hCfXz06v+hggzS{A(k2py_m^ zAIP5Qyp<7ICMIv*-Me<<=ZIuTUFJKkaLdmIra(&NZV0mM)zOK6-z$NOUvmQQze!S+@4DgW>%Jsia)j$nF8rOo<960x(1SK^OvHfSU2-huLDVUSHjeO zN7kke{F_VVQ>4qx-1)J|UEX~vtI4kxAyb9@Tu68H0vAgCwqK9g6|h*848h%0 zcbM7(TR^bibe~s+Eu4IMAG3ub;rxSbPmFy)(bqXCJ$7~w`FMvy$IbX>wQDM<8wzdd0Qj%u0u{e?eS0 z$y<=gP&$;?98x55J(9!r%1HN3uv{fq3S?c!uN=F;a+K_{P-Elh-ELqCve$tr z2ByNxYbeG6%-uj^2`61KrHeKXM;47~H8Mp^J<5Is9;OPbA9`W01K`N6+7s+IjdktL zTq?+(QDI%X^AwiTP@J|4jn8Z4-dEOS^5K76y3O~WBD*TLnvX1=xTQ#qOc01?E2-9 zIf?vf7wfiMt3JrvYRvM*xk*qOOlIE+j$Cq4ies`ENpJldU3;|*nF8^BseULF{KU3K zrb50yg`G!`wS?luF=h_-n-T+4K=ZGA2BxAPQfwIxS*ywaqgl5!7{fzF9%NNf`nrz{ zeb~he<7;KiDB8B{b|YG<tkWkK+0F&GBaPKe9;pIM^iY~a@@>J^4mrc+0K)bGT-Hx zE0O~BJA>NFe6h(kXIs8FK~fbShaTUCjC$SoWRVy|XucQA8=~EhY>gCr2he(mbcc2( zw^dTk`-9npxqOy_JRdTxi5P@%Iv?c4TK0>gxM8HWbH{D?eQVF(He5L5EDx^l7)Zx9 zE+*Hv$yKj&uwTB@smU4x4)xZ_o&h%vcU(!k-&(Zufq3IbwgoE6kam#oPpvT+agt21 wl;ng4(a<*}%pqogGF{}i6b^&hw&?;lxu4*$?FuAz5#+SmW6S9IC`0Pb%gvH$=8 diff --git a/examples/qvgviewer/qvg/01.03.04q.qvg b/examples/qvgviewer/qvg/01.03.04q.qvg deleted file mode 100644 index f7a926702550b39cbad4e3af03342313d6496c2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12867 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 diff --git a/examples/qvgviewer/qvg/01.08.05q.qvg b/examples/qvgviewer/qvg/01.08.05q.qvg deleted file mode 100644 index 5f0f72d44374be86fe1c713bdc11aa9728574137..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15593 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≺N8dxsd`S?zNa0`6 z=Ky~ZRZ$%vkAlzc?^%}YJo1}GkXJz2(-NL9f|bx-7Vv!81(XfF0(lV(_pO$HkH)r8 zm9Pvkm6@UM+d^+k-voL5BK1u?U*Q|1i3@Q296m~bi>AR zrw9U9QT4c<#||6EaS82(GMP^h!|v5M?vjANLU(=2Hprc+_Ai*VpXYO8AgeP~E}!Fk zx{H+6MdGKQI~j7Ly>Ri#~BPe5Irn1jL@{4aJlR!G2#}gr$=S;4LKVFi zauzXv9((?J@rscBL3aq=t$dyG5r~OzWFG!KR4vSf;0Vt0c|QM*k^u%U<@W;^^Klh= zE##)E$`sGw^->819@3SwcQ2o1$Qhx#Yu>%m`5MxPs)0$&SJ7oRVm~cBc)sc2J4JeK z7{%Aui)7iwWBr}w9C^o6XkE;7{#up+ye+8%wT`juJgMlsmyu5AB8ECpSX1(Kbc=_v zJm0FyA{f5QWACPwiv|VA0dYNOa zVQVTznf4b0MJv&o@n5>+rqX*jCwRW1Dyf`gv1Np*}V9pmlNIGg4#Wy^keBpjDZ8v-uIq-&2wi~`n_?l;0(PcMM z9Vo20toeMWbUadgeZAD$Feh$B=VuFeC+i#X!lAULmf-EE^n&YMA@X^f(%Gku432$` zs=8dXKZPM(9j*OfJ&Zf928J=py2msam^vuhFI{gR-}1`&C^{>?&Y#G+A&)I? zOy~R#E3b1PhJ5D;56Sfi!wzkGitURHI@HToT)i3?t~Vr|dUI@H3Hhrtki)kc5*yW6 zjoF}x#7dZI(Al84k?_!TDBl^e=Ya9A*NXO2eG`Dd9@66`k@>u{5QDKy-qi~{t-3jw zKX>K00fDD+7(bXRFD85X7;I>lh>CfN&i}oRJ*8bmf4g|kVn?EhZx(J-6j*=DR&bUCxQ1IA;^#!466T!-ST*DGBgdt!_$@=p=| kh>L1Kk?KFT80`8euzr26aP|4`{{HXMsd?*v8sqK%1K?KCi~s-t diff --git a/examples/qvgviewer/qvg/01.25.18.qvg b/examples/qvgviewer/qvg/01.25.18.qvg deleted file mode 100644 index 73c0ea83bb6547854c94d7b26d298d3df88fb135..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18383 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 literal 0 HcmV?d00001 diff --git a/examples/qvgviewer/qvgviewer.qrc b/examples/qvgviewer/qvgviewer.qrc index 336168ae..75be73f3 100644 --- a/examples/qvgviewer/qvgviewer.qrc +++ b/examples/qvgviewer/qvgviewer.qrc @@ -1,9 +1,8 @@ + + - qvg/01.01.10.qvg - qvg/01.03.04q.qvg - qvg/01.25.18.qvg - qvg/01.08.05q.qvg + qvg/Tux.qvg diff --git a/examples/qvgviewer/svg/01.01.10.svg b/examples/qvgviewer/svg/01.01.10.svg deleted file mode 100644 index 557ae7d3..00000000 --- a/examples/qvgviewer/svg/01.01.10.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - diff --git a/examples/qvgviewer/svg/01.03.04q.svg b/examples/qvgviewer/svg/01.03.04q.svg deleted file mode 100644 index 29041bbd..00000000 --- a/examples/qvgviewer/svg/01.03.04q.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/examples/qvgviewer/svg/01.08.05q.svg b/examples/qvgviewer/svg/01.08.05q.svg deleted file mode 100644 index 413339ff..00000000 --- a/examples/qvgviewer/svg/01.08.05q.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/qvgviewer/svg/01.25.18.svg b/examples/qvgviewer/svg/01.25.18.svg deleted file mode 100644 index 958cb57c..00000000 --- a/examples/qvgviewer/svg/01.25.18.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - -image/svg+xml diff --git a/examples/qvgviewer/svg/Tux.svg b/examples/qvgviewer/svg/Tux.svg new file mode 100644 index 00000000..2daa3da1 --- /dev/null +++ b/examples/qvgviewer/svg/Tux.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + From 0e417033593bb2257d7789741da46b5af0d04343 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 18 Jan 2024 08:50:45 +0100 Subject: [PATCH 02/27] avoid deprecation warnings from Qt 6.7 --- src/CMakeLists.txt | 1 + src/inputpanel/QskVirtualKeyboard.cpp | 2 +- ...outs.cpp => QskVirtualKeyboardLayouts.hpp} | 42 +++++++++---------- 3 files changed, 23 insertions(+), 22 deletions(-) rename src/inputpanel/{QskVirtualKeyboardLayouts.cpp => QskVirtualKeyboardLayouts.hpp} (97%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 351997f7..87f89b12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -456,6 +456,7 @@ list(APPEND HEADERS inputpanel/QskInputPanelBox.h inputpanel/QskInputPredictionBar.h inputpanel/QskVirtualKeyboard.h + inputpanel/QskVirtualKeyboardLayouts.hpp ) list(APPEND SOURCES diff --git a/src/inputpanel/QskVirtualKeyboard.cpp b/src/inputpanel/QskVirtualKeyboard.cpp index 1416a587..2acfa771 100644 --- a/src/inputpanel/QskVirtualKeyboard.cpp +++ b/src/inputpanel/QskVirtualKeyboard.cpp @@ -78,7 +78,7 @@ QskVirtualKeyboard::QskVirtualKeyboard( QQuickItem* parent ) #define LOWER( x ) int( x + 32 ) // Convert an uppercase key to lowercase m_data->layouts = { -#include "QskVirtualKeyboardLayouts.cpp" +#include "QskVirtualKeyboardLayouts.hpp" }; #undef LOWER diff --git a/src/inputpanel/QskVirtualKeyboardLayouts.cpp b/src/inputpanel/QskVirtualKeyboardLayouts.hpp similarity index 97% rename from src/inputpanel/QskVirtualKeyboardLayouts.cpp rename to src/inputpanel/QskVirtualKeyboardLayouts.hpp index 7d933f60..af89df6e 100644 --- a/src/inputpanel/QskVirtualKeyboardLayouts.cpp +++ b/src/inputpanel/QskVirtualKeyboardLayouts.hpp @@ -27,7 +27,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_Slash }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde, Qt::Key_NumberSign }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -78,7 +78,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar }, { Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_NumberSign, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_NumberSign, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -103,7 +103,7 @@ { Qt::Key_paragraph, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_copyright, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_onequarter, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_periodcentered, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -130,7 +130,7 @@ { Qt::Key_paragraph, Qt::Key_sterling, 0x0384 /*tonos*/, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_copyright, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_onequarter, Qt::Key_threequarters, Qt::Key_Bar }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, Qt::Key_mu, }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, 0x0b5 /*Qt::Key_micro*/, }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_periodcentered, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -155,7 +155,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar }, { Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_NumberSign, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_NumberSign, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -180,7 +180,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight }, { Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright }, { }, - { Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -205,7 +205,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar }, { Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde, Qt::Key_NumberSign }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -230,7 +230,7 @@ { Qt::Key_paragraph, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_copyright, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_onequarter, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_Bar }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_periodcentered, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -245,7 +245,7 @@ { Qt::Key_Mode_switch, Qt::Key_twosuperior, Qt::Key_Space, Qt::Key_Plus, Qt::Key_Exclam, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, { - { Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0, Qt::Key_degree, Qt::Key_mu }, + { Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0, Qt::Key_degree, 0x0b5 /*Qt::Key_micro*/ }, { Qt::Key_A, Qt::Key_Z, Qt::Key_E, Qt::Key_R, Qt::Key_T, Qt::Key_Y, Qt::Key_U, Qt::Key_I, Qt::Key_O, Qt::Key_P, Qt::Key_sterling }, { Qt::Key_Q, Qt::Key_S, Qt::Key_D, Qt::Key_F, Qt::Key_G, Qt::Key_H, Qt::Key_J, Qt::Key_K, Qt::Key_L, Qt::Key_M, Qt::Key_Ugrave }, { Qt::Key_Shift, Qt::Key_W, Qt::Key_X, Qt::Key_C, Qt::Key_V, Qt::Key_B, Qt::Key_N, Qt::Key_Question, Qt::Key_Period, Qt::Key_Slash, Qt::Key_Backspace }, @@ -280,7 +280,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_currency }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_division, Qt::Key_multiply }, { 0x0111 /*d stroke*/, 0x0110 /*D stroke*/, LOWER( Qt::Key_Adiaeresis ), Qt::Key_Adiaeresis, LOWER( Qt::Key_Iacute ), Qt::Key_Iacute, 0x0142 /*l stroke*/, 0x0141 /*L stroke*/, Qt::Key_Dollar, Qt::Key_ssharp }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_AsciiTilde, Qt::Key_Minus, Qt::Key_Underscore, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_AsciiTilde, Qt::Key_Minus, Qt::Key_Underscore, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -305,7 +305,7 @@ { Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar }, { Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -358,7 +358,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_acute }, { Qt::Key_At, Qt::Key_Q, 0x0122 /*R cedilla*/, Qt::Key_W, Qt::Key_Y, Qt::Key_X, Qt::Key_Otilde, Qt::Key_Equal, 0x2013 /*en dash*/, Qt::Key_Question, Qt::Key_AsciiTilde }, { Qt::Key_registered, LOWER( Qt::Key_Q ), 0x0157 /*r cedilla*/, LOWER( Qt::Key_W ), LOWER( Qt::Key_Y ), LOWER( Qt::Key_X ), LOWER( Qt::Key_Otilde ), 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_QuoteDbl, Qt::Key_NumberSign }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -383,7 +383,7 @@ { Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0, Qt::Key_Equal }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_Percent, Qt::Key_Asterisk, Qt::Key_Plus, Qt::Key_Exclam }, { Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceLeft, Qt::Key_BraceRight, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiCircum, Qt::Key_NumberSign }, - { Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -408,7 +408,7 @@ { Qt::Key_paragraph, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_copyright, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar }, { Qt::Key_ssharp, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright }, - { Qt::Key_cent, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_cent, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_periodcentered, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -434,7 +434,7 @@ { Qt::Key_paragraph, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_copyright, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_cent, Qt::Key_unknown, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_periodcentered, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -461,7 +461,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_currency }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_division, Qt::Key_multiply }, { Qt::Key_section, 0x0111 /*d stroke*/, 0x0110 /*D stroke*/, Qt::Key_AsciiTilde, Qt::Key_Dollar, Qt::Key_ssharp }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -487,7 +487,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_AsciiCircum }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_AsciiTilde }, { Qt::Key_unknown, Qt::Key_unknown, Qt::Key_unknown, Qt::Key_unknown, Qt::Key_unknown, Qt::Key_section }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -512,7 +512,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_currency }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_division, Qt::Key_multiply }, { Qt::Key_section, 0x0111 /*d stroke*/, 0x0110 /*D stroke*/, 0x0142 /*l stroke*/, 0x0141 /*L stroke*/, Qt::Key_Dollar, Qt::Key_ssharp }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_AsciiTilde, Qt::Key_Minus, Qt::Key_Underscore, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_AsciiTilde, Qt::Key_Minus, Qt::Key_Underscore, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -540,7 +540,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_Slash }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_AsciiTilde, Qt::Key_NumberSign }, { }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -565,7 +565,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_currency }, { Qt::Key_At, Qt::Key_registered, 0x20AC /*Euro*/, Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_division, Qt::Key_multiply }, { Qt::Key_section, Qt::Key_AsciiTilde, 0x0142 /*l stroke*/, 0x0141 /*L stroke*/, Qt::Key_ssharp }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, @@ -615,7 +615,7 @@ { Qt::Key_degree, Qt::Key_twosuperior, Qt::Key_threesuperior, Qt::Key_sterling, Qt::Key_brokenbar, Qt::Key_notsign, Qt::Key_BraceLeft, Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_BraceRight, Qt::Key_Backslash, Qt::Key_QuoteDbl }, { Qt::Key_At, Qt::Key_registered, LOWER( Qt::Key_Eacute ), Qt::Key_Bar, Qt::Key_onequarter, Qt::Key_onehalf, Qt::Key_threequarters, LOWER( Qt::Key_I ), Qt::Key_AsciiTilde }, { LOWER( Qt::Key_AE ), 0x20AC /*Euro*/, Qt::Key_Dollar, Qt::Key_guillemotleft, Qt::Key_guillemotright, Qt::Key_NumberSign }, - { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_ssharp, Qt::Key_mu, Qt::Key_Backspace }, + { Qt::Key_Less, Qt::Key_Greater, Qt::Key_copyright, Qt::Key_ssharp, 0x0b5 /*Qt::Key_micro*/, Qt::Key_Backspace }, { Qt::Key_Mode_switch, Qt::Key_Space, Qt::Key_Left, Qt::Key_Right, Qt::Key_Return } }, }, From b441e29ef4926d13df19aa656c4f07d05134c45b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 18 Jan 2024 09:07:02 +0100 Subject: [PATCH 03/27] skins renamed to designsystems --- CMakeLists.txt | 2 +- {skins => designsystems}/CMakeLists.txt | 0 {skins => designsystems}/fluent2/CMakeLists.txt | 0 {skins => designsystems}/fluent2/QskFluent2Global.h | 0 {skins => designsystems}/fluent2/QskFluent2Skin.cpp | 0 {skins => designsystems}/fluent2/QskFluent2Skin.h | 0 .../fluent2/QskFluent2SkinFactory.cpp | 0 .../fluent2/QskFluent2SkinFactory.h | 0 .../fluent2/QskFluent2Theme.cpp | 0 {skins => designsystems}/fluent2/QskFluent2Theme.h | 0 {skins => designsystems}/fluent2/icons.qrc | 0 .../fluent2/icons/checkmark.svg | 0 .../fluent2/icons/combo-box-arrow-closed.svg | 0 .../fluent2/icons/combo-box-arrow-open.svg | 0 .../fluent2/icons/qvg/checkmark.qvg | Bin .../fluent2/icons/qvg/combo-box-arrow-closed.qvg | Bin .../fluent2/icons/qvg/combo-box-arrow-open.qvg | Bin .../fluent2/icons/qvg/segmented-button-check.qvg | Bin .../fluent2/icons/qvg/spin-box-arrow-down.qvg | Bin .../fluent2/icons/qvg/spin-box-arrow-up.qvg | Bin .../fluent2/icons/segmented-button-check.svg | 0 .../fluent2/icons/spin-box-arrow-down.svg | 0 .../fluent2/icons/spin-box-arrow-up.svg | 0 {skins => designsystems}/fluent2/metadata.json | 0 {skins => designsystems}/material3/CMakeLists.txt | 0 .../material3/QskMaterial3Global.h | 0 .../material3/QskMaterial3Skin.cpp | 0 .../material3/QskMaterial3Skin.h | 0 .../material3/QskMaterial3SkinFactory.cpp | 0 .../material3/QskMaterial3SkinFactory.h | 0 {skins => designsystems}/material3/icons.qrc | 0 .../material3/icons/check_small.svg | 0 .../material3/icons/combo-box-arrow-closed.svg | 0 .../material3/icons/combo-box-arrow-open.svg | 0 .../material3/icons/qvg/check_small.qvg | Bin .../material3/icons/qvg/combo-box-arrow-closed.qvg | Bin .../material3/icons/qvg/combo-box-arrow-open.qvg | Bin .../material3/icons/qvg/segmented-button-check.qvg | Bin .../material3/icons/segmented-button-check.svg | 0 {skins => designsystems}/material3/metadata.json | 0 {skins => designsystems}/squiek/CMakeLists.txt | 0 {skins => designsystems}/squiek/QskSquiekGlobal.h | 0 {skins => designsystems}/squiek/QskSquiekSkin.cpp | 0 {skins => designsystems}/squiek/QskSquiekSkin.h | 0 .../squiek/QskSquiekSkinFactory.cpp | 0 .../squiek/QskSquiekSkinFactory.h | 0 {skins => designsystems}/squiek/metadata.json | 0 support/CMakeLists.txt | 2 +- 48 files changed, 2 insertions(+), 2 deletions(-) rename {skins => designsystems}/CMakeLists.txt (100%) rename {skins => designsystems}/fluent2/CMakeLists.txt (100%) rename {skins => designsystems}/fluent2/QskFluent2Global.h (100%) rename {skins => designsystems}/fluent2/QskFluent2Skin.cpp (100%) rename {skins => designsystems}/fluent2/QskFluent2Skin.h (100%) rename {skins => designsystems}/fluent2/QskFluent2SkinFactory.cpp (100%) rename {skins => designsystems}/fluent2/QskFluent2SkinFactory.h (100%) rename {skins => designsystems}/fluent2/QskFluent2Theme.cpp (100%) rename {skins => designsystems}/fluent2/QskFluent2Theme.h (100%) rename {skins => designsystems}/fluent2/icons.qrc (100%) rename {skins => designsystems}/fluent2/icons/checkmark.svg (100%) rename {skins => designsystems}/fluent2/icons/combo-box-arrow-closed.svg (100%) rename {skins => designsystems}/fluent2/icons/combo-box-arrow-open.svg (100%) rename {skins => designsystems}/fluent2/icons/qvg/checkmark.qvg (100%) rename {skins => designsystems}/fluent2/icons/qvg/combo-box-arrow-closed.qvg (100%) rename {skins => designsystems}/fluent2/icons/qvg/combo-box-arrow-open.qvg (100%) rename {skins => designsystems}/fluent2/icons/qvg/segmented-button-check.qvg (100%) rename {skins => designsystems}/fluent2/icons/qvg/spin-box-arrow-down.qvg (100%) rename {skins => designsystems}/fluent2/icons/qvg/spin-box-arrow-up.qvg (100%) rename {skins => designsystems}/fluent2/icons/segmented-button-check.svg (100%) rename {skins => designsystems}/fluent2/icons/spin-box-arrow-down.svg (100%) rename {skins => designsystems}/fluent2/icons/spin-box-arrow-up.svg (100%) rename {skins => designsystems}/fluent2/metadata.json (100%) rename {skins => designsystems}/material3/CMakeLists.txt (100%) rename {skins => designsystems}/material3/QskMaterial3Global.h (100%) rename {skins => designsystems}/material3/QskMaterial3Skin.cpp (100%) rename {skins => designsystems}/material3/QskMaterial3Skin.h (100%) rename {skins => designsystems}/material3/QskMaterial3SkinFactory.cpp (100%) rename {skins => designsystems}/material3/QskMaterial3SkinFactory.h (100%) rename {skins => designsystems}/material3/icons.qrc (100%) rename {skins => designsystems}/material3/icons/check_small.svg (100%) rename {skins => designsystems}/material3/icons/combo-box-arrow-closed.svg (100%) rename {skins => designsystems}/material3/icons/combo-box-arrow-open.svg (100%) rename {skins => designsystems}/material3/icons/qvg/check_small.qvg (100%) rename {skins => designsystems}/material3/icons/qvg/combo-box-arrow-closed.qvg (100%) rename {skins => designsystems}/material3/icons/qvg/combo-box-arrow-open.qvg (100%) rename {skins => designsystems}/material3/icons/qvg/segmented-button-check.qvg (100%) rename {skins => designsystems}/material3/icons/segmented-button-check.svg (100%) rename {skins => designsystems}/material3/metadata.json (100%) rename {skins => designsystems}/squiek/CMakeLists.txt (100%) rename {skins => designsystems}/squiek/QskSquiekGlobal.h (100%) rename {skins => designsystems}/squiek/QskSquiekSkin.cpp (100%) rename {skins => designsystems}/squiek/QskSquiekSkin.h (100%) rename {skins => designsystems}/squiek/QskSquiekSkinFactory.cpp (100%) rename {skins => designsystems}/squiek/QskSquiekSkinFactory.h (100%) rename {skins => designsystems}/squiek/metadata.json (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 539979e7..e3978c24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ qsk_setup_build() qsk_setup_install() add_subdirectory(src) -add_subdirectory(skins) +add_subdirectory(designsystems) include(CMakePackageConfigHelpers) diff --git a/skins/CMakeLists.txt b/designsystems/CMakeLists.txt similarity index 100% rename from skins/CMakeLists.txt rename to designsystems/CMakeLists.txt diff --git a/skins/fluent2/CMakeLists.txt b/designsystems/fluent2/CMakeLists.txt similarity index 100% rename from skins/fluent2/CMakeLists.txt rename to designsystems/fluent2/CMakeLists.txt diff --git a/skins/fluent2/QskFluent2Global.h b/designsystems/fluent2/QskFluent2Global.h similarity index 100% rename from skins/fluent2/QskFluent2Global.h rename to designsystems/fluent2/QskFluent2Global.h diff --git a/skins/fluent2/QskFluent2Skin.cpp b/designsystems/fluent2/QskFluent2Skin.cpp similarity index 100% rename from skins/fluent2/QskFluent2Skin.cpp rename to designsystems/fluent2/QskFluent2Skin.cpp diff --git a/skins/fluent2/QskFluent2Skin.h b/designsystems/fluent2/QskFluent2Skin.h similarity index 100% rename from skins/fluent2/QskFluent2Skin.h rename to designsystems/fluent2/QskFluent2Skin.h diff --git a/skins/fluent2/QskFluent2SkinFactory.cpp b/designsystems/fluent2/QskFluent2SkinFactory.cpp similarity index 100% rename from skins/fluent2/QskFluent2SkinFactory.cpp rename to designsystems/fluent2/QskFluent2SkinFactory.cpp diff --git a/skins/fluent2/QskFluent2SkinFactory.h b/designsystems/fluent2/QskFluent2SkinFactory.h similarity index 100% rename from skins/fluent2/QskFluent2SkinFactory.h rename to designsystems/fluent2/QskFluent2SkinFactory.h diff --git a/skins/fluent2/QskFluent2Theme.cpp b/designsystems/fluent2/QskFluent2Theme.cpp similarity index 100% rename from skins/fluent2/QskFluent2Theme.cpp rename to designsystems/fluent2/QskFluent2Theme.cpp diff --git a/skins/fluent2/QskFluent2Theme.h b/designsystems/fluent2/QskFluent2Theme.h similarity index 100% rename from skins/fluent2/QskFluent2Theme.h rename to designsystems/fluent2/QskFluent2Theme.h diff --git a/skins/fluent2/icons.qrc b/designsystems/fluent2/icons.qrc similarity index 100% rename from skins/fluent2/icons.qrc rename to designsystems/fluent2/icons.qrc diff --git a/skins/fluent2/icons/checkmark.svg b/designsystems/fluent2/icons/checkmark.svg similarity index 100% rename from skins/fluent2/icons/checkmark.svg rename to designsystems/fluent2/icons/checkmark.svg diff --git a/skins/fluent2/icons/combo-box-arrow-closed.svg b/designsystems/fluent2/icons/combo-box-arrow-closed.svg similarity index 100% rename from skins/fluent2/icons/combo-box-arrow-closed.svg rename to designsystems/fluent2/icons/combo-box-arrow-closed.svg diff --git a/skins/fluent2/icons/combo-box-arrow-open.svg b/designsystems/fluent2/icons/combo-box-arrow-open.svg similarity index 100% rename from skins/fluent2/icons/combo-box-arrow-open.svg rename to designsystems/fluent2/icons/combo-box-arrow-open.svg diff --git a/skins/fluent2/icons/qvg/checkmark.qvg b/designsystems/fluent2/icons/qvg/checkmark.qvg similarity index 100% rename from skins/fluent2/icons/qvg/checkmark.qvg rename to designsystems/fluent2/icons/qvg/checkmark.qvg diff --git a/skins/fluent2/icons/qvg/combo-box-arrow-closed.qvg b/designsystems/fluent2/icons/qvg/combo-box-arrow-closed.qvg similarity index 100% rename from skins/fluent2/icons/qvg/combo-box-arrow-closed.qvg rename to designsystems/fluent2/icons/qvg/combo-box-arrow-closed.qvg diff --git a/skins/fluent2/icons/qvg/combo-box-arrow-open.qvg b/designsystems/fluent2/icons/qvg/combo-box-arrow-open.qvg similarity index 100% rename from skins/fluent2/icons/qvg/combo-box-arrow-open.qvg rename to designsystems/fluent2/icons/qvg/combo-box-arrow-open.qvg diff --git a/skins/fluent2/icons/qvg/segmented-button-check.qvg b/designsystems/fluent2/icons/qvg/segmented-button-check.qvg similarity index 100% rename from skins/fluent2/icons/qvg/segmented-button-check.qvg rename to designsystems/fluent2/icons/qvg/segmented-button-check.qvg diff --git a/skins/fluent2/icons/qvg/spin-box-arrow-down.qvg b/designsystems/fluent2/icons/qvg/spin-box-arrow-down.qvg similarity index 100% rename from skins/fluent2/icons/qvg/spin-box-arrow-down.qvg rename to designsystems/fluent2/icons/qvg/spin-box-arrow-down.qvg diff --git a/skins/fluent2/icons/qvg/spin-box-arrow-up.qvg b/designsystems/fluent2/icons/qvg/spin-box-arrow-up.qvg similarity index 100% rename from skins/fluent2/icons/qvg/spin-box-arrow-up.qvg rename to designsystems/fluent2/icons/qvg/spin-box-arrow-up.qvg diff --git a/skins/fluent2/icons/segmented-button-check.svg b/designsystems/fluent2/icons/segmented-button-check.svg similarity index 100% rename from skins/fluent2/icons/segmented-button-check.svg rename to designsystems/fluent2/icons/segmented-button-check.svg diff --git a/skins/fluent2/icons/spin-box-arrow-down.svg b/designsystems/fluent2/icons/spin-box-arrow-down.svg similarity index 100% rename from skins/fluent2/icons/spin-box-arrow-down.svg rename to designsystems/fluent2/icons/spin-box-arrow-down.svg diff --git a/skins/fluent2/icons/spin-box-arrow-up.svg b/designsystems/fluent2/icons/spin-box-arrow-up.svg similarity index 100% rename from skins/fluent2/icons/spin-box-arrow-up.svg rename to designsystems/fluent2/icons/spin-box-arrow-up.svg diff --git a/skins/fluent2/metadata.json b/designsystems/fluent2/metadata.json similarity index 100% rename from skins/fluent2/metadata.json rename to designsystems/fluent2/metadata.json diff --git a/skins/material3/CMakeLists.txt b/designsystems/material3/CMakeLists.txt similarity index 100% rename from skins/material3/CMakeLists.txt rename to designsystems/material3/CMakeLists.txt diff --git a/skins/material3/QskMaterial3Global.h b/designsystems/material3/QskMaterial3Global.h similarity index 100% rename from skins/material3/QskMaterial3Global.h rename to designsystems/material3/QskMaterial3Global.h diff --git a/skins/material3/QskMaterial3Skin.cpp b/designsystems/material3/QskMaterial3Skin.cpp similarity index 100% rename from skins/material3/QskMaterial3Skin.cpp rename to designsystems/material3/QskMaterial3Skin.cpp diff --git a/skins/material3/QskMaterial3Skin.h b/designsystems/material3/QskMaterial3Skin.h similarity index 100% rename from skins/material3/QskMaterial3Skin.h rename to designsystems/material3/QskMaterial3Skin.h diff --git a/skins/material3/QskMaterial3SkinFactory.cpp b/designsystems/material3/QskMaterial3SkinFactory.cpp similarity index 100% rename from skins/material3/QskMaterial3SkinFactory.cpp rename to designsystems/material3/QskMaterial3SkinFactory.cpp diff --git a/skins/material3/QskMaterial3SkinFactory.h b/designsystems/material3/QskMaterial3SkinFactory.h similarity index 100% rename from skins/material3/QskMaterial3SkinFactory.h rename to designsystems/material3/QskMaterial3SkinFactory.h diff --git a/skins/material3/icons.qrc b/designsystems/material3/icons.qrc similarity index 100% rename from skins/material3/icons.qrc rename to designsystems/material3/icons.qrc diff --git a/skins/material3/icons/check_small.svg b/designsystems/material3/icons/check_small.svg similarity index 100% rename from skins/material3/icons/check_small.svg rename to designsystems/material3/icons/check_small.svg diff --git a/skins/material3/icons/combo-box-arrow-closed.svg b/designsystems/material3/icons/combo-box-arrow-closed.svg similarity index 100% rename from skins/material3/icons/combo-box-arrow-closed.svg rename to designsystems/material3/icons/combo-box-arrow-closed.svg diff --git a/skins/material3/icons/combo-box-arrow-open.svg b/designsystems/material3/icons/combo-box-arrow-open.svg similarity index 100% rename from skins/material3/icons/combo-box-arrow-open.svg rename to designsystems/material3/icons/combo-box-arrow-open.svg diff --git a/skins/material3/icons/qvg/check_small.qvg b/designsystems/material3/icons/qvg/check_small.qvg similarity index 100% rename from skins/material3/icons/qvg/check_small.qvg rename to designsystems/material3/icons/qvg/check_small.qvg diff --git a/skins/material3/icons/qvg/combo-box-arrow-closed.qvg b/designsystems/material3/icons/qvg/combo-box-arrow-closed.qvg similarity index 100% rename from skins/material3/icons/qvg/combo-box-arrow-closed.qvg rename to designsystems/material3/icons/qvg/combo-box-arrow-closed.qvg diff --git a/skins/material3/icons/qvg/combo-box-arrow-open.qvg b/designsystems/material3/icons/qvg/combo-box-arrow-open.qvg similarity index 100% rename from skins/material3/icons/qvg/combo-box-arrow-open.qvg rename to designsystems/material3/icons/qvg/combo-box-arrow-open.qvg diff --git a/skins/material3/icons/qvg/segmented-button-check.qvg b/designsystems/material3/icons/qvg/segmented-button-check.qvg similarity index 100% rename from skins/material3/icons/qvg/segmented-button-check.qvg rename to designsystems/material3/icons/qvg/segmented-button-check.qvg diff --git a/skins/material3/icons/segmented-button-check.svg b/designsystems/material3/icons/segmented-button-check.svg similarity index 100% rename from skins/material3/icons/segmented-button-check.svg rename to designsystems/material3/icons/segmented-button-check.svg diff --git a/skins/material3/metadata.json b/designsystems/material3/metadata.json similarity index 100% rename from skins/material3/metadata.json rename to designsystems/material3/metadata.json diff --git a/skins/squiek/CMakeLists.txt b/designsystems/squiek/CMakeLists.txt similarity index 100% rename from skins/squiek/CMakeLists.txt rename to designsystems/squiek/CMakeLists.txt diff --git a/skins/squiek/QskSquiekGlobal.h b/designsystems/squiek/QskSquiekGlobal.h similarity index 100% rename from skins/squiek/QskSquiekGlobal.h rename to designsystems/squiek/QskSquiekGlobal.h diff --git a/skins/squiek/QskSquiekSkin.cpp b/designsystems/squiek/QskSquiekSkin.cpp similarity index 100% rename from skins/squiek/QskSquiekSkin.cpp rename to designsystems/squiek/QskSquiekSkin.cpp diff --git a/skins/squiek/QskSquiekSkin.h b/designsystems/squiek/QskSquiekSkin.h similarity index 100% rename from skins/squiek/QskSquiekSkin.h rename to designsystems/squiek/QskSquiekSkin.h diff --git a/skins/squiek/QskSquiekSkinFactory.cpp b/designsystems/squiek/QskSquiekSkinFactory.cpp similarity index 100% rename from skins/squiek/QskSquiekSkinFactory.cpp rename to designsystems/squiek/QskSquiekSkinFactory.cpp diff --git a/skins/squiek/QskSquiekSkinFactory.h b/designsystems/squiek/QskSquiekSkinFactory.h similarity index 100% rename from skins/squiek/QskSquiekSkinFactory.h rename to designsystems/squiek/QskSquiekSkinFactory.h diff --git a/skins/squiek/metadata.json b/designsystems/squiek/metadata.json similarity index 100% rename from skins/squiek/metadata.json rename to designsystems/squiek/metadata.json diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index ecd53385..c1f439c2 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -31,7 +31,7 @@ target_compile_definitions(${target} target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) if(ENABLE_ENSURE_SKINS) - target_include_directories(${target} PRIVATE ${QSK_SOURCE_DIR}/skins) + target_include_directories(${target} PRIVATE ${QSK_SOURCE_DIR}/designsystems) target_compile_definitions(${target} PRIVATE ENSURE_SKINS) target_link_libraries(${target} PRIVATE squiekskin material3skin fluent2skin) endif() From 9f9fafe9ef8194a5505f388e7716f3503bff6966 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 18 Jan 2024 09:51:35 +0100 Subject: [PATCH 04/27] using a struct instead of std::array --- designsystems/material3/QskMaterial3Skin.cpp | 163 ++++++++++++------- designsystems/material3/QskMaterial3Skin.h | 29 ++-- 2 files changed, 113 insertions(+), 79 deletions(-) diff --git a/designsystems/material3/QskMaterial3Skin.cpp b/designsystems/material3/QskMaterial3Skin.cpp index e548d72c..a0f72e7d 100644 --- a/designsystems/material3/QskMaterial3Skin.cpp +++ b/designsystems/material3/QskMaterial3Skin.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -1264,93 +1265,129 @@ void Editor::setupSubWindow() } QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme ) - : QskMaterial3Theme( colorScheme, - { // default Material colors: - 0xff6750A4, - 0xff625B71, - 0xff7D5260, - 0xffB3261E, - 0xff605D62, - 0xff605D66, - } ) + : QskMaterial3Theme( colorScheme, BaseColors() ) { } QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme, - std::array< QskHctColor, NumPaletteTypes > palettes ) - : m_palettes( palettes ) + const BaseColors& baseColors ) { if ( colorScheme == QskSkin::LightScheme ) { - primary = m_palettes[ Primary ].toned( 40 ).rgb(); - onPrimary = m_palettes[ Primary ].toned( 100 ).rgb(); - primaryContainer = m_palettes[ Primary ].toned( 90 ).rgb(); - onPrimaryContainer = m_palettes[ Primary ].toned( 10 ).rgb(); + { + const QskHctColor color( baseColors.primary ); - secondary = m_palettes[ Secondary ].toned( 40 ).rgb(); - onSecondary = m_palettes[ Secondary ].toned( 100 ).rgb(); - secondaryContainer = m_palettes[ Secondary ].toned( 90 ).rgb(); - onSecondaryContainer = m_palettes[ Secondary ].toned( 10 ).rgb(); + primary = color.toned( 40 ).rgb(); + onPrimary = color.toned( 100 ).rgb(); + primaryContainer = color.toned( 90 ).rgb(); + onPrimaryContainer = color.toned( 10 ).rgb(); + } - tertiary = m_palettes[ Tertiary ].toned( 40 ).rgb(); - onTertiary = m_palettes[ Tertiary ].toned( 100 ).rgb(); - tertiaryContainer = m_palettes[ Tertiary ].toned( 90 ).rgb(); - onTertiaryContainer = m_palettes[ Tertiary ].toned( 10 ).rgb(); + { + const QskHctColor color( baseColors.secondary ); - error = m_palettes[ Error ].toned( 40 ).rgb(); - onError = m_palettes[ Error ].toned( 100 ).rgb(); - errorContainer = m_palettes[ Error ].toned( 90 ).rgb(); - onErrorContainer = m_palettes[ Error ].toned( 10 ).rgb(); + secondary = color.toned( 40 ).rgb(); + onSecondary = color.toned( 100 ).rgb(); + secondaryContainer = color.toned( 90 ).rgb(); + onSecondaryContainer = color.toned( 10 ).rgb(); + } - background = m_palettes[ Neutral ].toned( 99 ).rgb(); - onBackground = m_palettes[ Neutral ].toned( 10 ).rgb(); - surface = m_palettes[ Neutral ].toned( 99 ).rgb(); - onSurface = m_palettes[ Neutral ].toned( 10 ).rgb(); + { + const QskHctColor color( baseColors.tertiary ); - surfaceVariant = m_palettes[ NeutralVariant ].toned( 90 ).rgb(); - onSurfaceVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb(); - outline = m_palettes[ NeutralVariant ].toned( 50 ).rgb(); - outlineVariant = m_palettes[ NeutralVariant ].toned( 80 ).rgb(); + tertiary = color.toned( 40 ).rgb(); + onTertiary = color.toned( 100 ).rgb(); + tertiaryContainer = color.toned( 90 ).rgb(); + onTertiaryContainer = color.toned( 10 ).rgb(); + } - surfaceContainerHighest = m_palettes[ NeutralVariant ].toned( 90 ).rgb(); + { + const QskHctColor color( baseColors.error ); + + error = color.toned( 40 ).rgb(); + onError = color.toned( 100 ).rgb(); + errorContainer = color.toned( 90 ).rgb(); + onErrorContainer = color.toned( 10 ).rgb(); + } + + { + const QskHctColor color( baseColors.neutral ); + + background = color.toned( 99 ).rgb(); + onBackground = color.toned( 10 ).rgb(); + surface = color.toned( 99 ).rgb(); + onSurface = color.toned( 10 ).rgb(); + shadow = color.toned( 0 ).rgb(); + } + + { + const QskHctColor color( baseColors.neutralVariant ); + + surfaceVariant = color.toned( 90 ).rgb(); + onSurfaceVariant = color.toned( 30 ).rgb(); + outline = color.toned( 50 ).rgb(); + outlineVariant = color.toned( 80 ).rgb(); + surfaceContainerHighest = color.toned( 90 ).rgb(); + } - shadow = m_palettes[ Neutral ].toned( 0 ).rgb(); } else if ( colorScheme == QskSkin::DarkScheme ) { - primary = m_palettes[ Primary ].toned( 80 ).rgb(); - onPrimary = m_palettes[ Primary ].toned( 20 ).rgb(); - primaryContainer = m_palettes[ Primary ].toned( 30 ).rgb(); - onPrimaryContainer = m_palettes[ Primary ].toned( 90 ).rgb(); + { + const QskHctColor color( baseColors.primary ); - secondary = m_palettes[ Secondary ].toned( 80 ).rgb(); - onSecondary = m_palettes[ Secondary ].toned( 20 ).rgb(); - secondaryContainer = m_palettes[ Secondary ].toned( 30 ).rgb(); - onSecondaryContainer = m_palettes[ Secondary ].toned( 90 ).rgb(); + primary = color.toned( 80 ).rgb(); + onPrimary = color.toned( 20 ).rgb(); + primaryContainer = color.toned( 30 ).rgb(); + onPrimaryContainer = color.toned( 90 ).rgb(); + } - tertiary = m_palettes[ Tertiary ].toned( 80 ).rgb(); - onTertiary = m_palettes[ Tertiary ].toned( 20 ).rgb(); - tertiaryContainer = m_palettes[ Tertiary ].toned( 30 ).rgb(); - onTertiaryContainer = m_palettes[ Tertiary ].toned( 90 ).rgb(); + { + const QskHctColor color( baseColors.secondary ); - error = m_palettes[ Error ].toned( 80 ).rgb(); - onError = m_palettes[ Error ].toned( 20 ).rgb(); - errorContainer = m_palettes[ Error ].toned( 30 ).rgb(); - onErrorContainer = m_palettes[ Error ].toned( 90 ).rgb(); + secondary = color.toned( 80 ).rgb(); + onSecondary = color.toned( 20 ).rgb(); + secondaryContainer = color.toned( 30 ).rgb(); + onSecondaryContainer = color.toned( 90 ).rgb(); + } - background = m_palettes[ Neutral ].toned( 10 ).rgb(); - onBackground = m_palettes[ Neutral ].toned( 90 ).rgb(); - surface = m_palettes[ Neutral ].toned( 10 ).rgb(); - onSurface = m_palettes[ Neutral ].toned( 80 ).rgb(); + { + const QskHctColor color( baseColors.tertiary ); - surfaceVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb(); - onSurfaceVariant = m_palettes[ NeutralVariant ].toned( 80 ).rgb(); - outline = m_palettes[ NeutralVariant ].toned( 60 ).rgb(); - outlineVariant = m_palettes[ NeutralVariant ].toned( 30 ).rgb(); + tertiary = color.toned( 80 ).rgb(); + onTertiary = color.toned( 20 ).rgb(); + tertiaryContainer = color.toned( 30 ).rgb(); + onTertiaryContainer = color.toned( 90 ).rgb(); + } - surfaceContainerHighest = m_palettes[ NeutralVariant ].toned( 22 ).rgb(); + { + const QskHctColor color( baseColors.error ); - shadow = m_palettes[ Neutral ].toned( 0 ).rgb(); + error = color.toned( 80 ).rgb(); + onError = color.toned( 20 ).rgb(); + errorContainer = color.toned( 30 ).rgb(); + onErrorContainer = color.toned( 90 ).rgb(); + } + + { + const QskHctColor color( baseColors.neutral ); + + background = color.toned( 10 ).rgb(); + onBackground = color.toned( 90 ).rgb(); + surface = color.toned( 10 ).rgb(); + onSurface = color.toned( 80 ).rgb(); + shadow = color.toned( 0 ).rgb(); + } + + { + const QskHctColor color( baseColors.neutralVariant ); + + surfaceVariant = color.toned( 30 ).rgb(); + onSurfaceVariant = color.toned( 80 ).rgb(); + outline = color.toned( 60 ).rgb(); + outlineVariant = color.toned( 30 ).rgb(); + surfaceContainerHighest = color.toned( 22 ).rgb(); + } } primary8 = QskRgb::toTransparentF( primary, 0.08 ); diff --git a/designsystems/material3/QskMaterial3Skin.h b/designsystems/material3/QskMaterial3Skin.h index 99ecc035..bcdf3325 100644 --- a/designsystems/material3/QskMaterial3Skin.h +++ b/designsystems/material3/QskMaterial3Skin.h @@ -8,30 +8,30 @@ #include "QskMaterial3Global.h" -#include -#include #include +#include #include -#include +#include class QSK_MATERIAL3_EXPORT QskMaterial3Theme { public: - enum PaletteType + class BaseColors { - Primary, - Secondary, - Tertiary, - Error, - Neutral, - NeutralVariant, + public: + BaseColors() = default; - NumPaletteTypes + QRgb primary = 0xff6750A4; + QRgb secondary = 0xff625B71; + QRgb tertiary = 0xff7D5260; + QRgb error = 0xffB3261E; + QRgb neutral = 0xff605D62; + QRgb neutralVariant = 0xff605D66; }; QskMaterial3Theme( QskSkin::ColorScheme ); - QskMaterial3Theme( QskSkin::ColorScheme, std::array< QskHctColor, NumPaletteTypes > ); + QskMaterial3Theme( QskSkin::ColorScheme, const BaseColors& ); QRgb primary; QRgb primary8; // ### rename to primaryHovered or so? @@ -94,9 +94,6 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Theme const qreal draggedOpacity = 0.16; QskBoxShapeMetrics shapeExtraSmallTop; - - private: - std::array< QskHctColor, NumPaletteTypes > m_palettes; }; class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin @@ -137,7 +134,7 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin private: void setupFonts(); - void setupGraphicFilters( const QskMaterial3Theme& palette ); + void setupGraphicFilters( const QskMaterial3Theme& ); void setGraphicColor( GraphicRole, QRgb ); }; From 02d76b199a2dce8552248081080e40875dbc3f02 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 19 Jan 2024 15:52:00 +0100 Subject: [PATCH 05/27] Qt/WASM seems to have no thread support --- src/common/QskMetaFunction.cpp | 4 ++++ src/common/QskMetaInvokable.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 56d04080..9b3bea0d 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -204,14 +204,18 @@ void QskMetaFunction::invoke( QObject* object, return; } +#if QT_CONFIG(thread) QSemaphore semaphore; +#endif auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argv, &semaphore ); QCoreApplication::postEvent( receiver, event ); +#if QT_CONFIG(thread) semaphore.acquire(); +#endif break; } diff --git a/src/common/QskMetaInvokable.cpp b/src/common/QskMetaInvokable.cpp index 1f73633d..64c118f0 100644 --- a/src/common/QskMetaInvokable.cpp +++ b/src/common/QskMetaInvokable.cpp @@ -192,14 +192,18 @@ static void qskInvokeMetaCall( return; } +#if QT_CONFIG(thread) QSemaphore semaphore; +#endif auto event = new MetaCallEvent( call, metaObject, offset, index, args, &semaphore ); QCoreApplication::postEvent( receiver, event ); +#if QT_CONFIG(thread) semaphore.acquire(); +#endif break; } From 83432af799e706ed67c6acc2000538d344b9d084 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 22 Jan 2024 14:10:46 +0100 Subject: [PATCH 06/27] =?UTF-8?q?better=20painter=20paths=20for=20>=3D=203?= =?UTF-8?q?60=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/QskArcMetrics.cpp | 58 ++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/src/common/QskArcMetrics.cpp b/src/common/QskArcMetrics.cpp index 956508ce..a7981827 100644 --- a/src/common/QskArcMetrics.cpp +++ b/src/common/QskArcMetrics.cpp @@ -119,10 +119,6 @@ QskArcMetrics QskArcMetrics::toAbsolute( qreal radius ) const noexcept QPainterPath QskArcMetrics::painterPath( const QRectF& ellipseRect ) const { - /* - We might want to have no connecting line between inner and - outer border. F.e. for 360° arcs. TODO ... - */ const auto sz = qMin( ellipseRect.width(), ellipseRect.height() ); qreal t = m_thickness; @@ -141,31 +137,49 @@ QPainterPath QskArcMetrics::painterPath( const QRectF& ellipseRect ) const if ( innerRect.isEmpty() ) { - // a pie - - path.arcMoveTo( ellipseRect, m_startAngle ); - path.arcTo( ellipseRect, m_startAngle, m_spanAngle ); - path.lineTo( ellipseRect.center() ); + if ( qAbs( m_spanAngle ) >= 360.0 ) + { + path.addEllipse( ellipseRect ); + } + else + { + // pie + path.arcMoveTo( ellipseRect, m_startAngle ); + path.arcTo( ellipseRect, m_startAngle, m_spanAngle ); + path.lineTo( ellipseRect.center() ); + path.closeSubpath(); + } } else { - /* - We need the end point of the inner arc to add the line that connects - the inner/outer arcs. As QPainterPath does not offer such a method - we insert a dummy arcMoveTo and grab the calculated position. - */ - path.arcMoveTo( innerRect, m_startAngle + m_spanAngle ); - const auto pos = path.currentPosition(); + if ( qAbs( m_spanAngle ) >= 360.0 ) + { + path.addEllipse( ellipseRect ); - path.arcMoveTo( ellipseRect, m_startAngle ); // replaces the dummy arcMoveTo above - path.arcTo( ellipseRect, m_startAngle, m_spanAngle ); + QPainterPath innerPath; + innerPath.addEllipse( innerRect ); + path -= innerPath; + } + else + { + /* + We need the end point of the inner arc to add the line that connects + the inner/outer arcs. As QPainterPath does not offer such a method + we insert a dummy arcMoveTo and grab the calculated position. + */ + path.arcMoveTo( innerRect, m_startAngle + m_spanAngle ); + const auto pos = path.currentPosition(); - path.lineTo( pos ); - path.arcTo( innerRect, m_startAngle + m_spanAngle, -m_spanAngle ); + path.arcMoveTo( ellipseRect, m_startAngle ); // replaces the dummy arcMoveTo above + path.arcTo( ellipseRect, m_startAngle, m_spanAngle ); + + path.lineTo( pos ); + path.arcTo( innerRect, m_startAngle + m_spanAngle, -m_spanAngle ); + + path.closeSubpath(); + } } - path.closeSubpath(); - return path; } From 158960fd802bcd07cef5bb57c1e718d0505a4a89 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 24 Jan 2024 17:34:58 +0100 Subject: [PATCH 07/27] dangling pointer crash ( skin changes ) fixed --- src/controls/QskQuickItem.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index aa106f08..492a3e94 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -951,6 +951,19 @@ QSGNode* QskQuickItem::updatePaintNode( QSGNode* node, UpdatePaintNodeData* data { delete node; node = nullptr; +#if 1 + /* + controls might find subnodes using qskPaintNode - not good + as d->paintNode is not updated before leaving here. TODO ... + + In the initial call we will always have a nullptr - even if + it has already been allocated. When deleting it we have a dangling pointer. + instead of the new one. + + To avoid creashes for the second situation we manually clear d->paintNode. + */ + d->paintNode = nullptr; +#endif d->clearPreviousNodes = false; } From 0bdc7f5f869f7adc1fd33eb43547175087abf832 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 24 Jan 2024 17:35:47 +0100 Subject: [PATCH 08/27] flickering fixed, when moving over the scroll bar handle --- src/controls/QskScrollView.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/controls/QskScrollView.cpp b/src/controls/QskScrollView.cpp index 3627cc99..3092b116 100644 --- a/src/controls/QskScrollView.cpp +++ b/src/controls/QskScrollView.cpp @@ -93,10 +93,12 @@ class QskScrollView::PrivateData } else { - subControls[0] = HorizontalScrollHandle;; + subControls[0] = HorizontalScrollHandle; subControls[1] = HorizontalScrollBar; } + const bool wasHovered = hasState( subControls[1], QskScrollView::Hovered ); + hoveredSubControl = subControl; auto oldStates = scrollView->skinStates(); @@ -106,7 +108,9 @@ class QskScrollView::PrivateData qSwap( oldStates, newStates ); scrollView->startHintTransitions( { subControls[0] }, oldStates, newStates ); - scrollView->startHintTransitions( { subControls[1] }, oldStates, newStates ); + + if ( wasHovered != hasState( subControls[1], QskScrollView::Hovered ) ) + scrollView->startHintTransitions( { subControls[1] }, oldStates, newStates ); } bool hasState( QskAspect::Subcontrol subControl, QskAspect::State state ) const @@ -120,6 +124,7 @@ class QskScrollView::PrivateData if ( subControl == stateSubcontrol ) return true; + // the scroll bar inherits pressed/hovered from the handle if ( subControl == VerticalScrollBar ) return stateSubcontrol == VerticalScrollHandle; From 99080bf265a43c1a1b8f15cf1135e0b43059fca8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 24 Jan 2024 17:36:31 +0100 Subject: [PATCH 09/27] page indicator added --- examples/gallery/main.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index 17a91c07..9edaf1b6 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -204,7 +205,7 @@ namespace Q_OBJECT public: - Header( QQuickItem* parent = nullptr ) + Header( int tabCount, QQuickItem* parent = nullptr ) : QskLinearBox( Qt::Horizontal, parent ) { setPaddingHint( QskBox::Panel, 5 ); @@ -215,6 +216,9 @@ namespace new FileButton( "File", this ); new SkinButton( "Skin", this ); + addStretch( 10 ); + m_pageIndicator = new QskPageIndicator( tabCount, this ); + m_pageIndicator->setCurrentIndex( 0 ); addStretch( 10 ); { @@ -236,9 +240,18 @@ namespace } } + public Q_SLOTS: + void setCurrentTab( int index ) + { + m_pageIndicator->setCurrentIndex( index ); + } + Q_SIGNALS: void enabledToggled( bool ); void drawerRequested(); + + private: + QskPageIndicator* m_pageIndicator; }; class MainView : public QskMainView @@ -247,20 +260,23 @@ namespace MainView( QQuickItem* parent = nullptr ) : QskMainView( parent ) { - auto header = new Header( this ); - auto tabView = new TabView( this ); tabView->addPage( "Buttons", new ButtonPage() ); tabView->addPage( "Labels", new LabelPage() ); tabView->addPage( "Inputs", new InputPage() ); - tabView->addPage( "Progress\nBars", new ProgressBarPage() ); + tabView->addPage( "Indicators", new ProgressBarPage() ); tabView->addPage( "Selectors", new SelectorPage() ); tabView->addPage( "Dialogs", new DialogPage() ); tabView->addPage( "ListBox", new ListBoxPage() ); + auto header = new Header( tabView->count(), this ); + connect( header, &Header::enabledToggled, tabView, &TabView::setPagesEnabled ); + connect( tabView, &TabView::currentIndexChanged, + header, &Header::setCurrentTab ); + auto drawer = new Drawer( tabView ); drawer->setEdge( Qt::RightEdge ); From ffa207e268293ce76a2895a7d9be5f616c3f5906 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 24 Jan 2024 17:42:32 +0100 Subject: [PATCH 10/27] Fusion skin - very first version --- designsystems/CMakeLists.txt | 1 + designsystems/fusion/CMakeLists.txt | 13 + designsystems/fusion/QskFusionGlobal.h | 25 + designsystems/fusion/QskFusionSkin.cpp | 1556 +++++++++++++++++ designsystems/fusion/QskFusionSkin.h | 34 + designsystems/fusion/QskFusionSkinFactory.cpp | 37 + designsystems/fusion/QskFusionSkinFactory.h | 28 + designsystems/fusion/icons.qrc | 8 + designsystems/fusion/icons/check_small.svg | 4 + .../fusion/icons/combo-box-arrow-closed.svg | 4 + .../fusion/icons/combo-box-arrow-open.svg | 4 + .../fusion/icons/qvg/check_small.qvg | Bin 0 -> 575 bytes .../icons/qvg/combo-box-arrow-closed.qvg | Bin 0 -> 515 bytes .../fusion/icons/qvg/combo-box-arrow-open.qvg | Bin 0 -> 659 bytes .../icons/qvg/segmented-button-check.qvg | Bin 0 -> 575 bytes .../fusion/icons/segmented-button-check.svg | 4 + designsystems/fusion/metadata.json | 5 + support/CMakeLists.txt | 2 +- support/SkinnyNamespace.cpp | 6 + 19 files changed, 1730 insertions(+), 1 deletion(-) create mode 100644 designsystems/fusion/CMakeLists.txt create mode 100644 designsystems/fusion/QskFusionGlobal.h create mode 100644 designsystems/fusion/QskFusionSkin.cpp create mode 100644 designsystems/fusion/QskFusionSkin.h create mode 100644 designsystems/fusion/QskFusionSkinFactory.cpp create mode 100644 designsystems/fusion/QskFusionSkinFactory.h create mode 100644 designsystems/fusion/icons.qrc create mode 100644 designsystems/fusion/icons/check_small.svg create mode 100644 designsystems/fusion/icons/combo-box-arrow-closed.svg create mode 100644 designsystems/fusion/icons/combo-box-arrow-open.svg create mode 100644 designsystems/fusion/icons/qvg/check_small.qvg create mode 100644 designsystems/fusion/icons/qvg/combo-box-arrow-closed.qvg create mode 100644 designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg create mode 100644 designsystems/fusion/icons/qvg/segmented-button-check.qvg create mode 100644 designsystems/fusion/icons/segmented-button-check.svg create mode 100644 designsystems/fusion/metadata.json diff --git a/designsystems/CMakeLists.txt b/designsystems/CMakeLists.txt index fc36f951..dd579bf4 100644 --- a/designsystems/CMakeLists.txt +++ b/designsystems/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(squiek) add_subdirectory(material3) add_subdirectory(fluent2) +add_subdirectory(fusion) diff --git a/designsystems/fusion/CMakeLists.txt b/designsystems/fusion/CMakeLists.txt new file mode 100644 index 00000000..deacfa55 --- /dev/null +++ b/designsystems/fusion/CMakeLists.txt @@ -0,0 +1,13 @@ +############################################################################ +# QSkinny - Copyright (C) The authors +# SPDX-License-Identifier: BSD-3-Clause +############################################################################ + +set(SOURCES + QskFusionGlobal.h QskFusionSkin.h QskFusionSkin.cpp + QskFusionSkinFactory.h QskFusionSkinFactory.cpp +) +qt_add_resources(SOURCES icons.qrc) + +qsk_add_plugin(fusionskin skins QskFusionSkinFactory ${SOURCES}) +set_target_properties(fusionskin PROPERTIES DEFINE_SYMBOL QSK_FUSION_MAKEDLL ) diff --git a/designsystems/fusion/QskFusionGlobal.h b/designsystems/fusion/QskFusionGlobal.h new file mode 100644 index 00000000..b9abd6cb --- /dev/null +++ b/designsystems/fusion/QskFusionGlobal.h @@ -0,0 +1,25 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#ifndef QSK_FUSION_GLOBAL_H +#define QSK_FUSION_GLOBAL_H + +#include "QskGlobal.h" + +#ifdef QSK_DLL + +#if defined( QSK_FUSION_MAKEDLL ) // create a DLL library +#define QSK_FUSION_EXPORT Q_DECL_EXPORT +#else // use a DLL library +#define QSK_FUSION_EXPORT Q_DECL_IMPORT +#endif + +#endif // QSK_DLL + +#ifndef QSK_FUSION_EXPORT +#define QSK_FUSION_EXPORT +#endif + +#endif diff --git a/designsystems/fusion/QskFusionSkin.cpp b/designsystems/fusion/QskFusionSkin.cpp new file mode 100644 index 00000000..6c6e0494 --- /dev/null +++ b/designsystems/fusion/QskFusionSkin.cpp @@ -0,0 +1,1556 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#include "QskFusionSkin.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +static const int qskDuration = 50; + +#if 1 +extern QPalette qt_fusionPalette(); +#endif + +namespace +{ + Q_DECL_UNUSED inline double operator ""_dp( long double value ) + { + return qskDpToPixels( static_cast< qreal >( value ) ); + } + + Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value ) + { + return qskDpToPixels( value ); + } + + inline constexpr QRgb rgbGray( int value ) + { + return qRgb( value, value, value ); + } + + class Palette + { + public: + Palette( QskSkin::ColorScheme colorScheme ) + { + using namespace QskRgb; + using P = QPalette; + + if ( colorScheme == QskSkin::DarkScheme ) + { + const auto text = rgbGray( 240 ); + const auto background = rgbGray( 50 ); + + const auto light = rgbGray( 75 ); + const auto mid = rgbGray( 38 ); + const auto midLight = rgbGray( 42 ); + const auto base = rgbGray( 36 ); + const auto dark = rgbGray( 33 ); + const auto darkDisabled = rgbGray( 190 ); + const auto highlight = qRgb(48, 140, 198); + const auto disabledText = rgbGray( 130 ); + const auto shadow = rgbGray( 25 ); + const auto disabledShadow = rgbGray( 36 ); + const auto disabledHighlight = rgbGray( 145 ); + const auto placeholder = toTransparent( text, 128 ); + + setRgb( P::WindowText, text ); + setRgb( P::Button, background ); + + setRgb( P::Light, light ); + setRgb( P::Midlight, midLight ); + setRgb( P::Dark, dark ); + setRgb( P::Mid, mid ); + + setRgb( P::Text, text ); + setRgb( P::BrightText, light ); + setRgb( P::ButtonText, text ); + + setRgb( P::Base, base ); + setRgb( P::Window, background ); + setRgb( P::Shadow, shadow ); + setRgb( P::AlternateBase, interpolated( base, background, 0.5 ) ); + + setRgb( P::Highlight, highlight ); + setRgb( P::HighlightedText, text ); + + setRgb( P::Link, highlight); + setRgb( P::LinkVisited, Magenta ); + + setRgb( P::ToolTipBase, qRgb( 255, 255, 220 ) ); + setRgb( P::ToolTipText, rgbGray( 0 ) ); + + setRgb( P::PlaceholderText, placeholder ); +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + setRgb( P::Accent, highlight ); +#endif + + // disabled colors + + setRgb( P::Disabled, P::Text, disabledText ); + setRgb( P::Disabled, P::WindowText, disabledText ); + setRgb( P::Disabled, P::ButtonText, disabledText ); + setRgb( P::Disabled, P::Base, background ); + setRgb( P::Disabled, P::Dark, darkDisabled ); + setRgb( P::Disabled, P::Shadow, disabledShadow ); + setRgb( P::Disabled, P::Highlight, disabledHighlight ); +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + setRgb( P::Disabled, P::Accent, disabledHighlight ); +#endif + } + else + { + const auto text = rgbGray( 0 ); + const auto background = rgbGray( 239 ); + + const auto dark = rgbGray( 159 ); + const auto mid = rgbGray( 184 ); + const auto midLight = rgbGray( 202 ); + const auto light = rgbGray( 255 ); + const auto shadow = rgbGray( 118 ); + + const auto base = rgbGray( 255 ); + const auto darkDisabled = rgbGray( 190 ); + const auto highlight = qRgb(48, 140, 198); + const auto hightlightedText = rgbGray( 255 ); + const auto disabledText = rgbGray( 190 ); + + const auto disabledShadow = rgbGray( 177 ); + const auto disabledHighlight = rgbGray( 145 ); + + setRgb( P::WindowText, text ); + setRgb( P::Button, background ); + + setRgb( P::Light, light ); + setRgb( P::Midlight, midLight ); + setRgb( P::Dark, dark ); + setRgb( P::Mid, mid ); + + setRgb( P::Text, text ); + setRgb( P::BrightText, light ); + setRgb( P::ButtonText, text ); + + setRgb( P::Base, base ); + setRgb( P::Window, background ); + setRgb( P::Shadow, shadow ); + setRgb( P::AlternateBase, interpolated( base, background, 0.5 ) ); + + setRgb( P::Highlight, highlight ); + setRgb( P::HighlightedText, hightlightedText ); + + setRgb( P::Link, Blue ); + setRgb( P::LinkVisited, Magenta ); + + setRgb( P::ToolTipBase, qRgb( 255, 255, 220 ) ); + setRgb( P::ToolTipText, rgbGray( 0 ) ); + + setRgb( P::PlaceholderText, toTransparent( text, 128 ) ); +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + setRgb( P::Accent, highlight ); +#endif + + // disabled colors + + setRgb( P::Disabled, P::Text, disabledText ); + setRgb( P::Disabled, P::WindowText, disabledText ); + setRgb( P::Disabled, P::ButtonText, disabledText ); + + setRgb( P::Disabled, P::Base, background ); + setRgb( P::Disabled, P::Dark, darkDisabled ); + setRgb( P::Disabled, P::Shadow, disabledShadow ); + + setRgb( P::Disabled, P::Highlight, disabledHighlight ); +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + setRgb( P::Disabled, P::Accent, disabledHighlight ); +#endif + } + + outline = QskRgb::darker( rgb( P::Window ), 140 ); + + button = rgb( P::Button ); + + { + auto c = QColor::fromRgba( button ); + const int val = qGray( button ); + c = c.lighter( 100 + qMax( 1, ( 180 - val ) / 6 ) ); + c.setHsv(c.hue(), c.saturation() * 0.75, c.value() ); + + button = c.rgba(); + } + + tabFrame = QskRgb::lighter( button, 104 ); + + highlightedOutline = rgb( QPalette::Highlight ); + + { + highlightedOutline = QskRgb::darker( highlightedOutline, 125 ); + + auto c = QColor::fromRgba( highlightedOutline ); + if ( c.value() > 160 ) + { + c.setHsl(c.hue(), c.saturation(), 160 ); + highlightedOutline = c.rgba(); + } + } + + error = QskRgb::DarkRed; // ???? + } + + QRgb rgb( QPalette::ColorRole role ) const + { + return rgb( QPalette::Normal, role ); + } + + QRgb rgb( QPalette::ColorGroup group, QPalette::ColorRole role ) const + { + Q_ASSERT( group >= 0 && group < 2 ); + return m_colors[group][role]; + } + + QRgb outline; + QRgb button; + QRgb tabFrame; + QRgb highlightedOutline; + QRgb error; + + private: + void setRgb( QPalette::ColorRole role, QRgb rgb ) + { + setRgb( QPalette::Active, role, rgb ); + setRgb( QPalette::Disabled, role, rgb ); + } + + void setRgb( QPalette::ColorGroup group, QPalette::ColorRole role, QRgb rgb ) + { + Q_ASSERT( group >= 0 && group < 2 ); + m_colors[group][role] = rgb; + } + + QRgb m_colors[ 2 ][ QPalette::NColorRoles ] = { }; + }; + + class Editor : private QskSkinHintTableEditor + { + public: + Editor( const Palette& palette, QskSkinHintTable* table ) + : QskSkinHintTableEditor( table ) + , m_pal( palette ) + { +#if 0 + for ( int i = 0; i < QPalette::NColorRoles; i++ ) + { + const auto role = static_cast< QPalette::ColorRole >( i ); + const auto rgb = m_pal.rgb( QPalette::Active, role ); + + qDebug() << role << qRed( rgb ) << qGreen( rgb ) << qBlue( rgb ); + } +#endif + } + + void setup(); + + private: + void setupBox(); + void setupCheckBox(); + void setupComboBox(); + void setupDialogButtonBox(); + void setupDrawer(); + void setupFocusIndicator(); + void setupGraphicLabel(); + void setupInputPanel(); + void setupVirtualKeyboard(); + void setupListView(); + void setupMenu(); + void setupPageIndicator(); + void setupPopup(); + void setupProgressBar(); + void setupProgressRing(); + void setupRadioBox(); + void setupPushButton(); + void setupScrollView(); + void setupSegmentedBar(); + void setupSeparator(); + void setupSubWindow(); + void setupSlider(); + void setupSpinBox(); + void setupSwitchButton(); + void setupTabButton(); + void setupTabBar(); + void setupTabView(); + void setupTextInput(); + void setupTextLabel(); + + QskGraphic symbol( const char* name ) const + { +#if 0 + const QString path = QStringLiteral( ":fusion/icons/qvg/" ) + + name + QStringLiteral( ".qvg" ); + + return QskGraphicIO::read( path ); +#endif + + QskGraphic graphic; + + if ( strcmp( name, "checkMark" ) == 0 ) + { + QPainterPath path; + path.moveTo( 0.11, 0.47 ); + path.lineTo( 0.5, 1.0); + path.lineTo( 1.0, 0.0 ); + + QPainter painter( &graphic ); + painter.setPen( QPen( Qt::black, 0.25 ) ); + painter.drawPath( path ); + } + + Q_ASSERT( !graphic.isEmpty() ); + return graphic; + } + + const Palette& m_pal; + }; +} + +void Editor::setup() +{ + setupBox(); + setupCheckBox(); + setupComboBox(); + setupDialogButtonBox(); + setupDrawer(); + setupFocusIndicator(); + setupGraphicLabel(); + setupInputPanel(); + setupVirtualKeyboard(); + setupListView(); + setupMenu(); + setupPageIndicator(); + setupPopup(); + setupProgressBar(); + setupProgressRing(); + setupPushButton(); + setupRadioBox(); + setupScrollView(); + setupSegmentedBar(); + setupSeparator(); + setupSlider(); + setupSpinBox(); + setupSubWindow(); + setupSwitchButton(); + setupTabButton(); + setupTabBar(); + setupTabView(); + setupTextLabel(); + setupTextInput(); +} + +void Editor::setupBox() +{ + using Q = QskBox; + + setGradient( Q::Panel, m_pal.rgb( QPalette::Window ) ); +} + +void Editor::setupCheckBox() +{ + using Q = QskCheckBox; + using A = QskAspect; + using P = QPalette; + + setSpacing( Q::Panel, 6_dp ); + + setStrutSize( Q::Box, 18_dp, 18_dp ); + setBoxShape( Q::Box, 2_dp ); + + setBoxBorderColors( Q::Box, m_pal.outline ); + setBoxBorderColors( Q::Box | Q::Error, m_pal.error ); + setBoxBorderMetrics( Q::Box, 1_dp ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + const auto rgb1 = m_pal.rgb( colorGroup, P::Base ); + const auto rgb2 = QskRgb::darker( m_pal.button, 110 ); + + const auto aspect = Q::Box | state; + + for ( auto state2 : { A::NoState, Q::Error } ) + { + setColor( aspect | state2, rgb1 ); + setColor( aspect | state2 | Q::Pressed, rgb2 ); + setColor( aspect | state2 | Q::Checked | Q::Pressed, rgb2 ); + } + } + + setGraphicRole( Q::Indicator, QskFusionSkin::GraphicNormal ); + setGraphicRole( Q::Indicator | Q::Disabled, QskFusionSkin::GraphicDisabled ); + setGraphicRole( Q::Indicator | Q::Error, QskFusionSkin::GraphicError ); + +#if 0 + // aligning/scaling of the symbols needs to be fixed in the skinlet TODO .. + + setPadding( Q::Box, 4_dp ); + const auto checkMark = symbol( "checkMark" ); +#else + setPadding( Q::Box, 2_dp ); + const auto checkMark = QskStandardSymbol::graphic( QskStandardSymbol::CheckMark ); +#endif + + for ( auto state : { QskAspect::NoState, Q::Disabled } ) + { + const auto aspect = Q::Indicator | Q::Checked | state; + + setSymbol( aspect, checkMark ); + setSymbol( aspect | Q::Error, checkMark ); + } + + // elide mode ElideRight or mirrored ElideLeft + setColor( Q::Text, m_pal.rgb( P::Normal, P::WindowText ) ); + setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::WindowText ) ); +} + +void Editor::setupComboBox() +{ + /* + Qt/Fusion combo box opens the menu aligned to to the top border. + -> Text/Panel/Icon are no visible, when the menus is open. TODO ... + */ + using Q = QskComboBox; + using P = QPalette; + + setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); + + setColor( Q::Text, m_pal.rgb( P::Normal, P::ButtonText ) ); + setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::ButtonText ) ); + + setStrutSize( Q::Panel, -1.0, 32_dp ); + + setBoxShape( Q::Panel, 2 ); + setBoxBorderMetrics( Q::Panel, 1_dp ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + + setPadding( Q::Panel, 8_dp, 4_dp, 8_dp, 4_dp ); + setSpacing( Q::Panel, 8_dp ); + + // should be similar for QskPushButton + auto rgbFill = m_pal.button; + + setVGradient( Q::Panel, QskRgb::lighter( rgbFill, 124 ), + QskRgb::lighter( rgbFill, 102 ) ); + setGradient( Q::Panel | Q::Pressed, QskRgb::darker( rgbFill, 110 ) ); + + setStrutSize( Q::Icon, 20_dp, 20_dp ); + setGraphicRole( Q::Icon | Q::Disabled, QskFusionSkin::GraphicDisabled ); + + setStrutSize( Q::StatusIndicator, 10_dp, 10_dp ); + setGraphicRole( Q::StatusIndicator | Q::Disabled, QskFusionSkin::GraphicDisabled ); + + setAlignment( Q::StatusIndicator, Qt::AlignRight | Qt::AlignVCenter ); + + setSymbol( Q::StatusIndicator, + QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) ); + + setSymbol( Q::StatusIndicator | Q::PopupOpen, + QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) ); +} + +void Editor::setupPopup() +{ + using Q = QskPopup; + using A = QskAspect; + + setHint( Q::Overlay | A::Style, true ); + setGradient( Q::Overlay, QskRgb::toTransparent( QskRgb::Black, 18 ) ); +} + +void Editor::setupMenu() +{ + using Q = QskMenu; + using A = QskAspect; + + setHint( Q::Overlay | A::Style, true ); + setGradient( Q::Overlay, QColor( 220, 220, 220, 100 ) ); + + setBoxShape( Q::Panel, 4_dp ); + setBoxBorderMetrics( Q::Panel, 1_dp ); + + auto rgbFill = m_pal.rgb( QPalette::Base ); + rgbFill = QskRgb::lighter( rgbFill, 108 ); + + setGradient( Q::Panel, rgbFill ); + + auto rgbBorder = m_pal.rgb( QPalette::Window ); + rgbBorder = QskRgb::darker( rgbBorder, 160 ); + + setBoxBorderColors( Q::Panel, rgbBorder ); + + const bool isCascading = qskMaybeDesktopPlatform(); + setHint( Q::Panel | A::Style, isCascading ); + + setMetric( Q::Separator | A::Size, 1_dp ); + setMargin( Q::Separator, QskMargins( 5_dp, 2_dp, 5_dp, 2_dp ) ); + setBoxShape( Q::Separator, 0 ); + setBoxBorderMetrics( Q::Separator, 0 ); + + setGradient( Q::Separator, qRgba( 0, 0, 0, 60 ) ); + + setPadding( Q::Segment, 4 ); + setSpacing( Q::Segment, 5 ); + setGradient( Q::Segment, Qt::transparent ); + + setGradient( Q::Cursor, m_pal.rgb( QPalette::Highlight ) ); + + setColor( Q::Text, m_pal.rgb( QPalette::Text ) ); + setColor( Q::Text | Q::Selected, m_pal.rgb( QPalette::HighlightedText ) ); + + setPadding( Q::Icon, 8_dp ); + + setGraphicRole( Q::Icon, QskFusionSkin::GraphicNormal ); + setGraphicRole( Q::Icon | Q::Disabled, QskFusionSkin::GraphicDisabled ); + setGraphicRole( Q::Icon | Q::Selected, QskFusionSkin::GraphicHighlighted ); + + setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic ); + setAnimation( Q::Panel | A::Position, 100 ); +} + +void Editor::setupGraphicLabel() +{ + using Q = QskGraphicLabel; + + setPadding( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); + setBoxShape( Q::Panel, 0 ); + setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) ); +} + +void Editor::setupTextLabel() +{ + using Q = QskTextLabel; + + setAlignment( Q::Text, Qt::AlignCenter ); + setColor( Q::Text, m_pal.rgb( QPalette::Active, QPalette::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.rgb( QPalette::Disabled, QPalette::Text ) ); + + setPadding( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); + setBoxShape( Q::Panel, 0 ); + setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) ); +} + +void Editor::setupTextInput() +{ + using Q = QskTextInput; + using A = QskAspect; + using P = QPalette; + + setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignTop ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + + setColor( Q::PanelSelected | state, m_pal.rgb( colorGroup, P::Highlight ) ); + setColor( Q::TextSelected | state, m_pal.rgb( colorGroup, P::HighlightedText ) ); + + QRgb rgb = m_pal.rgb( colorGroup, P::Base ); + + setGradient( Q::Panel | state, rgb ); + } + + setBoxBorderMetrics( Q::Panel, 1_dp ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + setBoxShape( Q::Panel, 2 ); + setPadding( Q::Panel, 4_dp ); +} + +void Editor::setupProgressBar() +{ + // indeterminate style is different: TODO ... + using Q = QskProgressBar; + using A = QskAspect; + using P = QPalette; + + for ( auto subControl : { Q::Groove, Q::Fill } ) + { + setMetric( subControl | A::Size, 24 ); + setPadding( subControl, 0 ); + setBoxShape( subControl, 2 ); + + setBoxBorderMetrics( subControl, 1 ); + } + + { + setBoxBorderColors( Q::Groove, m_pal.outline ); + setGradient( Q::Groove, m_pal.rgb( P::Normal, P::Base ) ); + setGradient( Q::Groove | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + } + + for ( auto state : { A::NoState, Q::Disabled } ) + { + using namespace QskRgb; + + const auto aspect = Q::Fill | state; + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + + setBoxBorderColors( aspect, darker( rgb, 140 ) ); + setVGradient( aspect, lighter( rgb, 120 ), rgb ); + } +} + +void Editor::setupProgressRing() +{ + using A = QskAspect; + using Q = QskProgressRing; + using P = QPalette; + + for ( auto subControl : { Q::Groove, Q::Fill } ) + { + setPadding( subControl, 0 ); + setBoxShape( subControl, 2 ); + setMetric( subControl | A::Border, 1 ); + setArcMetrics( subControl, 90, -360, 14 ); + } + + { + setColor( Q::Groove | A::Border, m_pal.outline ); + setGradient( Q::Groove, m_pal.rgb( P::Normal, P::Base ) ); + setGradient( Q::Groove | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + } + + { + setStrutSize( Q::Fill, { 80, 80 } ); + } + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto aspect = Q::Fill | state; + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + + setColor( aspect | A::Border, QskRgb::darker( rgb, 140 ) ); + setGradient( aspect, rgb ); + } +} + +void Editor::setupRadioBox() +{ + using Q = QskRadioBox; + using A = QskAspect; + using P = QPalette; + + setSpacing( Q::Panel, 10_dp ); + setSpacing( Q::Button, 10_dp ); + + setStrutSize( Q::CheckIndicatorPanel, 20_dp, 20_dp ); + + for ( auto subControl : { Q::CheckIndicatorPanel, Q::CheckIndicator, Q::Ripple } ) + setBoxShape( subControl, 100, Qt::RelativeSize ); // circular + + setBoxBorderMetrics( Q::CheckIndicatorPanel, 1_dp ); + + setPadding( Q::CheckIndicatorPanel, 6_dp ); + + setGradient( Q::Button, QskGradient() ); + + setColor( Q::Text, m_pal.rgb( P::Normal, P::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::Text ) ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto aspect = Q::CheckIndicatorPanel | state; + + const auto rgb1 = m_pal.rgb( colorGroup, P::Base ); + const auto rgb2 = m_pal.rgb( colorGroup, P::WindowText ); + const auto rgb3 = m_pal.rgb( colorGroup, P::Window ); + + setColor( aspect, rgb1 ); + setColor( aspect | Q::Pressed, QskRgb::interpolated( rgb2, rgb1, 0.85 ) ); + + setBoxBorderColors( aspect, QskRgb::darker( rgb3, 150 ) ); + } + + setBoxBorderMetrics( Q::CheckIndicator, 1 ); + setBoxBorderColors( Q::CheckIndicator, QskRgb::Transparent ); + setColor( Q::CheckIndicator, Qt::transparent); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + auto rgb = m_pal.rgb( colorGroup, P::Text ); + rgb = QskRgb::darker( rgb, 120 ); + + const auto aspect = Q::CheckIndicator | Q::Selected | state; + + setBoxBorderColors( aspect, QskRgb::toTransparent( rgb, 200 ) ); + setColor( aspect, QskRgb::toTransparent( rgb, 180 ) ); + } +} + +void Editor::setupFocusIndicator() +{ + /* + Qt/Fusion does not implement QStyle::CE_FocusFrame - probably because + the focus is indicated by coloring parts of the controls. So we invent + something using the focus color from the palette. + */ + using Q = QskFocusIndicator; + using A = QskAspect; + using P = QPalette; + + setBoxBorderMetrics( Q::Panel, 2 ); + setPadding( Q::Panel, 3 ); + setBoxShape( Q::Panel, 4 ); + + auto rgb = m_pal.rgb( P::Highlight ); + rgb = QskRgb::darker( rgb, 125 ); + + { + auto c = QColor::fromRgba( rgb ).toHsv(); + if ( c.value() > 160 ) + c.setHsl( c.hue(), c.saturation(), 160 ); + + rgb = c.rgba(); + } + + setBoxBorderColors( Q::Panel, rgb ); + setBoxBorderColors( Q::Panel | Q::Disabled, QskRgb::toTransparent( rgb, 0 ) ); + + setAnimation( Q::Panel | A::Color, 200 ); + setAnimation( Q::Panel | A::Color | Q::Disabled, 500 ); +} + +void Editor::setupSegmentedBar() +{ + /* + Qt does not have a segmented bar and we do not have any + specification from Qt/Fusion style. + Let's put something together from the spect of other controls + */ + + using A = QskAspect; + using Q = QskSegmentedBar; + using P = QPalette; + + const uint duration = 100; + + { + // Panel + + setPadding( Q::Panel, 0 ); + setSpacing( Q::Panel, 5_dp ); + + setGradient( Q::Panel, m_pal.rgb( P::Normal, P::Base ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + + setBoxBorderMetrics( Q::Panel, 1_dp ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + + const QSizeF strutSize( 100_dp, 16_dp ); + + setStrutSize( Q::Panel | A::Horizontal, strutSize ); + setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() ); + } + + { + // Segment + + setPadding( Q::Segment, QskMargins( 2_dp, 5_dp, 2_dp, 5_dp ) ); + setGradient( Q::Segment, QskGradient() ); + } + + { + // Cursor + setBoxBorderColors( Q::Cursor, m_pal.outline ); + + setGradient( Q::Cursor, m_pal.rgb( P::Normal, P::Highlight ) ); + setGradient( Q::Cursor | Q::Disabled, m_pal.rgb( P::Disabled, P::Highlight ) ); + setAnimation( Q::Cursor | A::Metric | A::Position, duration ); + } + + { + // Text + + setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + const auto aspect = Q::Text | state; + + setColor( aspect, m_pal.rgb( colorGroup, P::Text ) ); + setColor( aspect | Q::Selected, m_pal.rgb( colorGroup, P::HighlightedText ) ); + } + + setAnimation( Q::Text | A::Color, duration ); + } + + { + // Icon + + setGraphicRole( Q::Icon, QskFusionSkin::GraphicNormal ); + setGraphicRole( Q::Icon | Q::Disabled, QskFusionSkin::GraphicDisabled ); + setGraphicRole( Q::Icon | Q::Selected, QskFusionSkin::GraphicHighlighted ); + + setStrutSize( Q::Icon, -1, 24_dp ); + } +} + +void Editor::setupSeparator() +{ + using Q = QskSeparator; + using A = QskAspect; + + setMetric( Q::Panel | A::Size, 2_dp ); + setBoxShape( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); + setGradient( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) ); +} + +void Editor::setupPageIndicator() +{ + using Q = QskPageIndicator; + using A = QskAspect; + using P = QPalette; + + const auto extent = 8_dp; + setStrutSize( Q::Bullet, extent, extent ); + + // circles, without border + setBoxShape( Q::Bullet, 100, Qt::RelativeSize ); + setBoxBorderMetrics( Q::Bullet, 0 ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + using namespace QskRgb; + + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + auto rgb = m_pal.rgb( colorGroup, P::Shadow ); + + const auto aspect = Q::Bullet | state; + setGradient( aspect, toTransparentF( rgb, 0.45 ) ); + setGradient( aspect | Q::Selected, toTransparentF( rgb, 0.95 ) ); + + // Q::Pressed is missing -> 0.75 TODO ... + } + + setAnimation( Q::Bullet | A::Color, 100 ); + + setSpacing( Q::Panel, 4_dp ); + setGradient( Q::Panel, QskGradient() ); // invisible +} + +void Editor::setupPushButton() +{ + using Q = QskPushButton; + using A = QskAspect; + using P = QPalette; + + setStrutSize( Q::Panel, 40_dp, 8_dp ); + + setPadding( Q::Panel, 4 ); + setMetric( Q::Panel | A::Spacing, 4 ); + + setBoxBorderColors( Q::Panel, m_pal.outline ); + setBoxBorderMetrics( Q::Panel, 1 ); + setBoxShape( Q::Panel, 2 ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + auto rgb = m_pal.rgb( colorGroup, P::Button ); + rgb = QskRgb::lighter( rgb, 104 ); + + setGradient( Q::Panel | state, rgb ); + + for ( auto state2 : { Q::Pressed, Q::Checked } ) + setGradient( Q::Panel | state | state2, QskRgb::darker( rgb, 110 ) ); + + setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + } + + setGraphicRole( Q::Icon, QskFusionSkin::GraphicNormal ); + setGraphicRole( Q::Icon | Q::Disabled, QskFusionSkin::GraphicDisabled ); + + setStrutSize( Q::Icon, 22_dp, 22_dp ); +} + +void Editor::setupDialogButtonBox() +{ + using Q = QskDialogButtonBox; + using A = QskAspect; + using P = QPalette; + + setBoxShape( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); + setPadding( Q::Panel, 2_dp, 4_dp, 2_dp, 0_dp ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + setGradient( Q::Panel, m_pal.rgb( colorGroup, P::Base ) ); + } +} + +void Editor::setupDrawer() +{ + using Q = QskDrawer; + using A = QskAspect; + using P = QPalette; + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); + } + + setBoxBorderMetrics( Q::Panel, 1 ); + setBoxShape( Q::Panel, 2 ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + + setAnimation( Q::Panel | A::Position, 100 ); +} + +void Editor::setupSlider() +{ + using A = QskAspect; + using Q = QskSlider; + using P = QPalette; + + const qreal extent = 30_dp; + + // Panel + + setMetric( Q::Panel | A::Size, extent ); + setBoxShape( Q::Panel, 0 ); + setBoxBorderMetrics( Q::Panel, 0 ); + setGradient( Q::Panel, QskGradient() ); + + setPadding( Q::Panel | A::Horizontal, QskMargins( 0.5 * extent, 0 ) ); + setPadding( Q::Panel | A::Vertical, QskMargins( 0, 0.5 * extent ) ); + + // Groove, Fill + + for ( auto subControl : { Q::Groove, Q::Fill } ) + { + setPadding( subControl, 0 ); + + setBoxShape( subControl, 0 ); + setBoxBorderMetrics( subControl, 1_dp ); + + setMetric( subControl | A::Size, 6_dp ); + } + + { + setBoxBorderColors( Q::Groove, m_pal.outline ); + + auto rgb = m_pal.button; + + auto c = QColor::fromRgba( rgb ).toHsv(); + c.setHsv( c.hue(), qMin( 255, (int)( c.saturation() ) ), + qMin( 255, (int)( c.value() * 0.9 ) ) ); + + rgb = c.rgba(); + + setGradient( Q::Groove, QskRgb::darker( rgb, 110 ), + QskRgb::lighter( rgb, 110 ) ); + } + + { + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + + setGradient( Q::Fill | state, rgb ); + + auto rgbOutline = QskRgb::darker( rgb, 140 ); + if ( qGray( m_pal.outline ) <= qGray( rgbOutline ) ) + rgbOutline = m_pal.outline; + + setBoxBorderColors( Q::Fill | state, rgbOutline ); + } + } + + setBoxShape( Q::Handle, 2 ); + setBoxBorderMetrics( Q::Handle, 1 ); + setBoxBorderColors( Q::Handle, m_pal.outline ); + + setStrutSize( Q::Handle, 16_dp, 16_dp ); + + for ( auto state : { A::NoState, Q::Pressed } ) + { + using namespace QskRgb; + + auto rgb = m_pal.button; + if ( state == Q::Pressed ) + rgb = darker( rgb, 110 ); + + setGradient( Q::Handle | state, lighter( rgb, 124 ), lighter( rgb, 102 ) ); + } + + // move the handle smoothly, when using keys + setAnimation( Q::Handle | A::Metric | A::Position, 2 * qskDuration ); + setAnimation( Q::Handle | A::Metric | A::Position | Q::Pressed, 0 ); +} + +void Editor::setupSpinBox() +{ + using Q = QskSpinBox; + using A = QskAspect; + using P = QPalette; + + setHint( Q::Panel | A::Style, Q::UpDownControl ); + setSpacing( Q::Panel, 0_dp ); + setBoxShape( Q::Panel, 2_dp ); + setBoxBorderMetrics( Q::Panel, 0_dp ); + //setBoxBorderColors( Q::Panel, m_pal.outline ); + + setPadding( Q::TextPanel, 5_dp ); + setBoxShape( Q::TextPanel, 2, 0, 2, 0 ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + setGradient( Q::TextPanel | state, m_pal.rgb( colorGroup, P::Base ) ); + } + + setBoxBorderMetrics( Q::TextPanel, 1_dp ); + setBoxBorderColors( Q::TextPanel, m_pal.outline ); + + setBoxShape( Q::UpPanel, 0, 2_dp, 0, 0 ); + setBoxBorderMetrics( Q::UpPanel, 0_dp, 1_dp, 1_dp, 0_dp ); + + setBoxShape( Q::DownPanel, 0, 0, 0, 2_dp ); + setBoxBorderMetrics( Q::DownPanel, 0_dp, 0_dp, 1_dp, 1_dp ); + + for ( auto subControl : { Q::UpPanel, Q::DownPanel } ) + { + setBoxBorderColors( subControl, m_pal.outline ); + + setPadding( subControl, 4 ); + setStrutSize( subControl, 16, 8 ); + + // Qt/Fusion uses a linear gradient, TODO ... + + setGradient( subControl, QskRgb::lighter( m_pal.button, 102 ) ); + + const auto downState = ( subControl == Q::UpPanel ) + ? Q::Increasing : Q::Decreasing; + + setGradient( subControl | downState, QskRgb::darker( m_pal.button, 110 ) ); + + setAnimation( subControl | A::Metric, 100 ); + setAnimation( subControl | A::Color, 100 ); + } + + setSymbol( Q::UpIndicator, + QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) ); + + setSymbol( Q::DownIndicator, + QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) ); + + for ( auto subControl : { Q::UpIndicator, Q::DownIndicator } ) + { + setGraphicRole( subControl, QskFusionSkin::GraphicNormal ); + setGraphicRole( subControl | Q::Disabled, QskFusionSkin::GraphicDisabled ); + + setAlignment( subControl, Qt::AlignCenter ); + + setAnimation( subControl | A::Color, 100 ); + } +} + +void Editor::setupSwitchButton() +{ + // needs more fine tuning: TODO ... + + using A = QskAspect; + using Q = QskSwitchButton; + using P = QPalette; + + const qreal h = 22_dp; + const qreal w = 1.25 * h; + + setBoxShape( Q::Groove, 2_dp ); + setBoxBorderMetrics( Q::Groove, 1_dp ); + setStrutSize( Q::Groove | A::Horizontal, 2.0 * w, h ); + setStrutSize( Q::Groove | A::Vertical, h, 2.0 * w ); + + setBoxShape( Q::Handle, 2_dp ); + setBoxBorderMetrics( Q::Handle, 1_dp ); + setStrutSize( Q::Handle | A::Horizontal, w, h ); + setStrutSize( Q::Handle | A::Vertical, h, w ); + + // on/off is indicated by the position of the handle and the groove color + + { + auto rgb = m_pal.button; + + { + auto c = QColor::fromRgba( rgb ).toHsv(); + c.setHsv( c.hue(), qMin( 255, c.saturation() ), qMin< int >( 255, c.value() * 0.9 ) ); + rgb = c.rgba(); + } + + setGradient( Q::Groove, + QskRgb::darker( rgb, 110 ), QskRgb::lighter( rgb, 110 ) ); + } + + const auto highlightRgb = m_pal.rgb( P::Highlight ); + setGradient( Q::Groove | Q::Checked, + highlightRgb, QskRgb::lighter( highlightRgb, 120 ) ); + + setBoxBorderColors( Q::Groove, m_pal.outline ); + + setGradient( Q::Handle, QskRgb::lighter( m_pal.button, 104 ) ); + setGradient( Q::Handle | Q::Pressed, QskRgb::darker( m_pal.button, 110 ) ); + + for( auto state : { A::NoState, Q::Disabled } ) + { + auto aspect = Q::Handle | state; + + setPosition( aspect, 0 ); + setPosition( aspect | Q::Checked, 1 ); + } + + setAnimation( Q::Handle | A::Metric, qskDuration ); + setAnimation( Q::Groove | A::Color, qskDuration ); +} + +void Editor::setupTabButton() +{ + using Q = QskTabButton; + using A = QskAspect; + using P = QPalette; + + setStrutSize( Q::Panel, 30_dp, 16_dp ); + + setColor( Q::Text, m_pal.rgb( P::Text ) ); + + { + QskGradient g; + g.setLinearDirection( Qt::Vertical ); + g.setStops( + { + { 0.85, QskRgb::darker( m_pal.tabFrame, 108 ) }, + { 1.0, QskRgb::darker( m_pal.tabFrame, 116 ) } + } + ); + + setGradient( Q::Panel, g ); + } + + setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 110 ) ); + + for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } ) + { + setBoxBorderColors( Q::Panel | state, m_pal.outline ); + setVGradient( Q::Panel | state, + QskRgb::lighter( m_pal.tabFrame, 104 ), m_pal.tabFrame ); + } + + + for ( auto variation : { A::Left, A::Right, A::Top, A::Bottom } ) + { + const auto aspect = Q::Panel | variation; + + QskMargins margins0, margins1; + QskBoxBorderMetrics border( 1 ); + QskBoxShapeMetrics shape( 4 ); + + const int indent = 2; + + if ( variation == A::Top ) + { + margins0 = QskMargins( -1, indent, -1, -1 ); + margins1 = QskMargins( -1, 0, -1, -2 ); + + border.setWidthAt( Qt::BottomEdge, 0 ); + + shape.setRadius( Qt::BottomLeftCorner, 0 ); + shape.setRadius( Qt::BottomRightCorner, 0 ); + } + else if ( variation == A::Bottom ) + { + margins0 = QskMargins( -1, -1, -1, indent ); + margins1 = QskMargins( -1, -2, -1, 0 ); + + border.setWidthAt( Qt::TopEdge, 0 ); + + shape.setRadius( Qt::TopLeftCorner, 0 ); + shape.setRadius( Qt::TopRightCorner, 0 ); + } + else if ( variation == A::Left ) + { + margins0 = QskMargins( indent, -1, -1, -1 ); + margins1 = QskMargins( 0, -1, -2, 0 ); + + border.setWidthAt( Qt::RightEdge, 0 ); + + shape.setRadius( Qt::TopRightCorner, 0 ); + shape.setRadius( Qt::BottomRightCorner, 0 ); + } + else if ( variation == A::Right ) + { + margins0 = QskMargins( -1, -1, indent, -1 ); + margins1 = QskMargins( -2, -1, 0, 0 ); + + border.setWidthAt( Qt::LeftEdge, 0 ); + + shape.setRadius( Qt::TopLeftCorner, 0 ); + shape.setRadius( Qt::BottomLeftCorner, 0 ); + } + + setMargin( aspect, margins0 ); + + for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } ) + setMargin( aspect | state, margins1 ); + + setPadding( aspect, { 6, 4, 6, 4 } ); + + setBoxBorderMetrics( aspect, border ); + setBoxShape( aspect, shape ); + } + + QskAnimationHint animationHint( qskDuration ); + animationHint.updateFlags = QskAnimationHint::UpdateNode; + + setAnimation( Q::Panel | A::Color, animationHint ); + setAnimation( Q::Panel | A::Metric, animationHint ); + + // text + setAlignment( Q::Text, Qt::AlignCenter ); + setColor( Q::Text, m_pal.rgb( P::Active, P::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::Text ) ); +} + +void Editor::setupTabBar() +{ + using A = QskAspect; + using Q = QskTabBar; + + setBoxBorderMetrics( Q::Panel, 0 ); + + setMargin( Q::Panel, 0 ); + + const qreal vb = 1.0; // borderWidth of the view + const qreal pw = 1.0; // extra space for the negative padding of the buttons + + setPadding( Q::Panel | A::Top, pw, 0.0, pw, vb ); + setPadding( Q::Panel | A::Bottom, pw, vb, pw, 0.0 ); + setPadding( Q::Panel | A::Left, 0.0, pw, vb, pw ); + setPadding( Q::Panel | A::Right, vb, pw, 0.0, pw ); + + // when flicking + setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) ); +} + +void Editor::setupTabView() +{ + using Q = QskTabView; + + setBoxBorderMetrics( Q::Page, 1 ); + setBoxBorderColors( Q::Page, m_pal.outline ); + setGradient( Q::Page, m_pal.tabFrame ); +} + +void Editor::setupInputPanel() +{ + using Q = QskInputPanelBox; + using A = QskAspect; + using P = QPalette; + + setPadding( Q::Panel, 5 ); + + setBoxBorderMetrics( Q::Panel, 1 ); + setBoxShape( Q::Panel, 2 ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); + } +} + +void Editor::setupVirtualKeyboard() +{ + using A = QskAspect; + using Q = QskVirtualKeyboard; + using P = QPalette; + + setPadding( Q::Panel, 5 ); + setMetric( Q::Panel | A::Spacing, 5 ); + + setBoxBorderMetrics( Q::Panel, 0 ); + setBoxShape( Q::Panel, 2 ); + setBoxBorderColors( Q::Panel, m_pal.outline ); + + // Q::ButtonPanel, Q::Text + + setBoxBorderColors( Q::ButtonPanel, m_pal.outline ); + setBoxBorderMetrics( Q::ButtonPanel, 1 ); + setBoxShape( Q::ButtonPanel, 2 ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + auto rgb = m_pal.rgb( colorGroup, P::Button ); + rgb = QskRgb::lighter( rgb, 104 ); + + setGradient( Q::ButtonPanel | state, rgb ); + setGradient( Q::ButtonPanel | state | QskPushButton::Pressed, + QskRgb::darker( rgb, 110 ) ); + + setColor( Q::ButtonText | state, m_pal.rgb( colorGroup, QPalette::Text ) ); + } + + setAnimation( Q::ButtonPanel | A::Color, 100 ); +} + +void Editor::setupScrollView() +{ + // not sure - Qt/Quick and Qt/Widgets totally differ + + using Q = QskScrollView; + using A = QskAspect; + using P = QPalette; + + setMetric( Q::Panel | A::Spacing, 4 ); + setGradient( Q::Panel, QskGradient() ); + + setBoxBorderMetrics( Q::Viewport, 1 ); + setBoxBorderColors( Q::Viewport, m_pal.outline ); + setBoxShape( Q::Viewport, 2 ); + + setGradient( Q::Viewport, m_pal.rgb( P::Normal, P::Base ) ); + setGradient( Q::Viewport | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + + // scrollbars + + for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } ) + { + // The scrollbar is expanding, when being hovered/pressed + + const auto extent = 8_dp; + + setMetric( subControl | A::Size, extent ); + setBoxShape( subControl, 100, Qt::RelativeSize ); + + const qreal padding = extent - 0_dp; + + if ( subControl == Q::HorizontalScrollBar ) + setPadding( subControl, 0, padding, 0, 0 ); + else + setPadding( subControl, padding, 0, 0, 0 ); + + setPadding( subControl | Q::Hovered, 0 ); + setPadding( subControl | Q::Pressed, 0 ); + + setAnimation( subControl | A::Metric, 100 ); + } + + // scroll handles + + for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } ) + { + setBoxShape( subControl, 100, Qt::RelativeSize ); + + const auto handleExtent = 60.0; + + if ( subControl == Q::HorizontalScrollHandle ) + setStrutSize( subControl, handleExtent, 0.0 ); + else + setStrutSize( subControl, 0.0, handleExtent ); + + setGradient( subControl, m_pal.rgb( P::Mid ) ); + setGradient( subControl | Q::Hovered, m_pal.rgb( P::Mid ) ); + setGradient( subControl | Q::Pressed, m_pal.rgb( P::Dark ) ); + + setAnimation( subControl | A::Color, 100 ); + } +} + +void Editor::setupListView() +{ + /* + adopted to look like the Qt/Widgets listview- needs more work TODO ... + */ + using Q = QskListView; + using A = QskAspect; + using P = QPalette; + + // padding for each cell + setPadding( Q::Cell, QskMargins( 4, 0 ) ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + + setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + setColor( Q::Cell | state, m_pal.rgb( colorGroup, P::Base ) ); + + const auto rgb1 = m_pal.rgb( colorGroup, P::Highlight ); + const auto rgb2 = m_pal.rgb( colorGroup, P::HighlightedText ); + + const auto state1 = state | Q::Selected; + + for ( auto state2 : { A::NoState, Q::Hovered, Q::Pressed } ) + { + setColor( Q::Cell | state1 | state2, rgb1 ); + setColor( Q::Text | state1 | state2, rgb2 ); + } + } +} + +void Editor::setupSubWindow() +{ + using Q = QskSubWindow; + using A = QskAspect; + using P = QPalette; + + // Panel + + setPadding( Q::Panel, 5 ); + setBoxBorderMetrics( Q::Panel, 1 ); + setBoxShape( Q::Panel, 2 ); + + setBoxBorderColors( Q::Panel, m_pal.outline ); + + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); + } + + // TitleBarPanel + + setHint( Q::TitleBarPanel | QskAspect::Style, Q::TitleBar | Q::Title ); + setMargin( Q::TitleBarPanel, -1 ); + + setGradient( Q::TitleBarPanel, m_pal.rgb( P::Mid ) ); + setGradient( Q::TitleBarPanel | Q::Focused, m_pal.rgb( P::Highlight ) ); + setSpacing( Q::TitleBarPanel, 5 ); + setStrutSize( Q::TitleBarPanel, 0, 20 ); + setBoxShape( Q::TitleBarPanel, 2, 2, 0, 0 ); + + // TitleBarText + + setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter ); + setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap ); + + setColor( Q::TitleBarText | Q::Focused, m_pal.rgb( P::Normal, P::HighlightedText ) ); + setColor( Q::TitleBarText, m_pal.rgb( P::Normal, P::Text ) ); + +#if 1 + for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } ) + setAnimation( subControl | A::Color, 100 ); +#endif + + setAnimation( Q::Panel | A::Position, 100, QEasingCurve::OutCubic ); +} + +QskFusionSkin::QskFusionSkin( QskSkin::ColorScheme colorScheme, QObject* parent ) + : Inherited( parent ) +{ + setupFonts( QStringLiteral( "Roboto" ) ); + + const Palette palette( colorScheme ); + + setGraphicColor( GraphicNormal, + palette.rgb( QPalette::Active, QPalette::Text ) ); + + setGraphicColor( GraphicDisabled, + palette.rgb( QPalette::Disabled, QPalette::Text ) ); + + setGraphicColor( GraphicError, palette.error ); + setGraphicColor( GraphicHighlighted, palette.rgb( QPalette::HighlightedText ) ); + + Editor editor( palette, &hintTable() ); + editor.setup(); +} + +QskFusionSkin::~QskFusionSkin() +{ +} + +void QskFusionSkin::setGraphicColor( GraphicRole role, QRgb rgb ) +{ + QskColorFilter colorFilter; + colorFilter.setMask( QskRgb::RGBAMask ); + colorFilter.addColorSubstitution( QskRgb::Black, rgb ); + + setGraphicFilter( role, colorFilter ); +} + + +#include "moc_QskFusionSkin.cpp" diff --git a/designsystems/fusion/QskFusionSkin.h b/designsystems/fusion/QskFusionSkin.h new file mode 100644 index 00000000..479127c7 --- /dev/null +++ b/designsystems/fusion/QskFusionSkin.h @@ -0,0 +1,34 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#ifndef QSK_FUSION_SKIN_H +#define QSK_FUSION_SKIN_H + +#include "QskFusionGlobal.h" +#include + +class QSK_FUSION_EXPORT QskFusionSkin : public QskSkin +{ + Q_OBJECT + + using Inherited = QskSkin; + + public: + QskFusionSkin( QskSkin::ColorScheme, QObject* parent = nullptr ); + ~QskFusionSkin() override; + + enum GraphicRole + { + GraphicNormal, + GraphicDisabled, + GraphicHighlighted, + GraphicError + }; + + private: + void setGraphicColor( GraphicRole, QRgb ); +}; + +#endif diff --git a/designsystems/fusion/QskFusionSkinFactory.cpp b/designsystems/fusion/QskFusionSkinFactory.cpp new file mode 100644 index 00000000..87f0ab56 --- /dev/null +++ b/designsystems/fusion/QskFusionSkinFactory.cpp @@ -0,0 +1,37 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#include "QskFusionSkinFactory.h" +#include "QskFusionSkin.h" + +static const QStringList fusionSkinNames = + { QStringLiteral( "Fusion Light" ), QStringLiteral( "Fusion Dark" ) }; + +QskFusionSkinFactory::QskFusionSkinFactory( QObject* parent ) + : QskSkinFactory( parent ) +{ +} + +QskFusionSkinFactory::~QskFusionSkinFactory() +{ +} + +QStringList QskFusionSkinFactory::skinNames() const +{ + return fusionSkinNames; +} + +QskSkin* QskFusionSkinFactory::createSkin( const QString& skinName ) +{ + if ( QString::compare( skinName, fusionSkinNames[0], Qt::CaseInsensitive ) == 0 ) + return new QskFusionSkin( QskSkin::LightScheme ); + + if ( QString::compare( skinName, fusionSkinNames[1], Qt::CaseInsensitive ) == 0 ) + return new QskFusionSkin( QskSkin::DarkScheme ); + + return nullptr; +} + +#include "moc_QskFusionSkinFactory.cpp" diff --git a/designsystems/fusion/QskFusionSkinFactory.h b/designsystems/fusion/QskFusionSkinFactory.h new file mode 100644 index 00000000..50087980 --- /dev/null +++ b/designsystems/fusion/QskFusionSkinFactory.h @@ -0,0 +1,28 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#ifndef QSK_FUSION_SKIN_FACTORY_H +#define QSK_FUSION_SKIN_FACTORY_H + +#include "QskFusionGlobal.h" +#include + +class QSK_FUSION_EXPORT QskFusionSkinFactory : public QskSkinFactory +{ + Q_OBJECT +#if defined( QSK_FUSION_MAKEDLL ) + Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" ) + Q_INTERFACES( QskSkinFactory ) +#endif + + public: + QskFusionSkinFactory( QObject* parent = nullptr ); + ~QskFusionSkinFactory() override; + + QStringList skinNames() const override; + QskSkin* createSkin( const QString& skinName ) override; +}; + +#endif diff --git a/designsystems/fusion/icons.qrc b/designsystems/fusion/icons.qrc new file mode 100644 index 00000000..721eef43 --- /dev/null +++ b/designsystems/fusion/icons.qrc @@ -0,0 +1,8 @@ + + + icons/qvg/check_small.qvg + icons/qvg/combo-box-arrow-closed.qvg + icons/qvg/combo-box-arrow-open.qvg + icons/qvg/segmented-button-check.qvg + + diff --git a/designsystems/fusion/icons/check_small.svg b/designsystems/fusion/icons/check_small.svg new file mode 100644 index 00000000..e7a84071 --- /dev/null +++ b/designsystems/fusion/icons/check_small.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designsystems/fusion/icons/combo-box-arrow-closed.svg b/designsystems/fusion/icons/combo-box-arrow-closed.svg new file mode 100644 index 00000000..c288b426 --- /dev/null +++ b/designsystems/fusion/icons/combo-box-arrow-closed.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designsystems/fusion/icons/combo-box-arrow-open.svg b/designsystems/fusion/icons/combo-box-arrow-open.svg new file mode 100644 index 00000000..4138c2cd --- /dev/null +++ b/designsystems/fusion/icons/combo-box-arrow-open.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designsystems/fusion/icons/qvg/check_small.qvg b/designsystems/fusion/icons/qvg/check_small.qvg new file mode 100644 index 0000000000000000000000000000000000000000..ea738b8639303983a6c47ec95103ead792067a09 GIT binary patch literal 575 zcmWFx_I77rU|?ouVrB?nu>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3V%%2LXt64oYW0;4F~G2oYgma1fmd0<%D3_TSRL0Hz)!24g!&LFB+WadGXpH9 j0pY>S0E=PT3sS@g3gSyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3Xf!2>S~l5=cJ)Qy_xTK>)&b5JVD_hp>^=VbKdx#0UzjKzO*&!V3-%$Dolkh!mg= FOaM(JA&39~ literal 0 HcmV?d00001 diff --git a/designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg b/designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg new file mode 100644 index 0000000000000000000000000000000000000000..6ddcf6c00d3f7e4ae3978638ecbf65d960462dd9 GIT binary patch literal 659 zcmWFx_I77rU|?oua%Ko%u>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRMf;(i zK(+_OZh#7)%R4AQBpgH_G|a(39y>^c1w`0i0FglY0hj_2j1B@2wu2y&m^_4ytPYD_ hkRnDsi literal 0 HcmV?d00001 diff --git a/designsystems/fusion/icons/qvg/segmented-button-check.qvg b/designsystems/fusion/icons/qvg/segmented-button-check.qvg new file mode 100644 index 0000000000000000000000000000000000000000..fa0e1ce2b2e02e7cf03098703b1b56b2f3e179c4 GIT binary patch literal 575 zcmWFx_I77rU|?ouVrB?nu>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3V%%2Z8@`eF+W44hoLupL;^gf#QtzA3xcgxTkg4LHPfJuJ@Z(gT>bT|F7wgt>qwL zb@0;M<7yx=xL%d|Pfz-~iojx8^ + + + diff --git a/designsystems/fusion/metadata.json b/designsystems/fusion/metadata.json new file mode 100644 index 00000000..9c2912d4 --- /dev/null +++ b/designsystems/fusion/metadata.json @@ -0,0 +1,5 @@ +{ + "FactoryId": "FusionFactory", + "Skins": [ { "Name": "Fusion Light", "Scheme": "Light" }, + { "Name": "Fusion Dark", "Scheme": "Dark" } ] +} diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index c1f439c2..07e58e84 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -33,7 +33,7 @@ target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) if(ENABLE_ENSURE_SKINS) target_include_directories(${target} PRIVATE ${QSK_SOURCE_DIR}/designsystems) target_compile_definitions(${target} PRIVATE ENSURE_SKINS) - target_link_libraries(${target} PRIVATE squiekskin material3skin fluent2skin) + target_link_libraries(${target} PRIVATE squiekskin material3skin fluent2skin fusionskin) endif() set(HIDE_SYSTEM_FONTS ON) diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index 35fea3c7..a2f58184 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -49,9 +49,12 @@ static bool pluginPath = initPluginPath(); #if defined( ENSURE_SKINS ) +#if 0 #include +#endif #include #include + #include static void initSkins() { @@ -64,9 +67,12 @@ static bool pluginPath = initPluginPath(); we manually add them here. */ +#if 0 qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() ); +#endif qskSkinManager->registerFactory( "Material3Factory", new QskMaterial3SkinFactory() ); qskSkinManager->registerFactory( "Fluent2Factory", new QskFluent2SkinFactory() ); + qskSkinManager->registerFactory( "FusionFactory", new QskFusionSkinFactory() ); qWarning() << "Couldn't find skin plugins, adding some manually."; From 2c33949916925ae71d01981c91c2de2db0948ff3 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 24 Jan 2024 17:56:20 +0100 Subject: [PATCH 11/27] wrong version check fixed --- designsystems/fusion/QskFusionSkin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designsystems/fusion/QskFusionSkin.cpp b/designsystems/fusion/QskFusionSkin.cpp index 6c6e0494..fd843172 100644 --- a/designsystems/fusion/QskFusionSkin.cpp +++ b/designsystems/fusion/QskFusionSkin.cpp @@ -137,7 +137,7 @@ namespace setRgb( P::ToolTipText, rgbGray( 0 ) ); setRgb( P::PlaceholderText, placeholder ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) setRgb( P::Accent, highlight ); #endif @@ -150,7 +150,7 @@ namespace setRgb( P::Disabled, P::Dark, darkDisabled ); setRgb( P::Disabled, P::Shadow, disabledShadow ); setRgb( P::Disabled, P::Highlight, disabledHighlight ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) setRgb( P::Disabled, P::Accent, disabledHighlight ); #endif } @@ -201,7 +201,7 @@ namespace setRgb( P::ToolTipText, rgbGray( 0 ) ); setRgb( P::PlaceholderText, toTransparent( text, 128 ) ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) setRgb( P::Accent, highlight ); #endif @@ -216,7 +216,7 @@ namespace setRgb( P::Disabled, P::Shadow, disabledShadow ); setRgb( P::Disabled, P::Highlight, disabledHighlight ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) setRgb( P::Disabled, P::Accent, disabledHighlight ); #endif } From 459b1ae93b7e80a8a1d2b93301265089ad22a8a8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 25 Jan 2024 08:56:01 +0100 Subject: [PATCH 12/27] bye, bye squiek --- designsystems/CMakeLists.txt | 1 - designsystems/squiek/CMakeLists.txt | 10 - designsystems/squiek/QskSquiekGlobal.h | 25 - designsystems/squiek/QskSquiekSkin.cpp | 1279 ----------------- designsystems/squiek/QskSquiekSkin.h | 31 - designsystems/squiek/QskSquiekSkinFactory.cpp | 33 - designsystems/squiek/QskSquiekSkinFactory.h | 29 - designsystems/squiek/metadata.json | 4 - examples/iotdashboard/main.cpp | 5 +- playground/gradients/main.cpp | 2 +- support/CMakeLists.txt | 2 +- support/SkinnyNamespace.cpp | 6 - 12 files changed, 6 insertions(+), 1421 deletions(-) delete mode 100644 designsystems/squiek/CMakeLists.txt delete mode 100644 designsystems/squiek/QskSquiekGlobal.h delete mode 100644 designsystems/squiek/QskSquiekSkin.cpp delete mode 100644 designsystems/squiek/QskSquiekSkin.h delete mode 100644 designsystems/squiek/QskSquiekSkinFactory.cpp delete mode 100644 designsystems/squiek/QskSquiekSkinFactory.h delete mode 100644 designsystems/squiek/metadata.json diff --git a/designsystems/CMakeLists.txt b/designsystems/CMakeLists.txt index dd579bf4..f5b4653c 100644 --- a/designsystems/CMakeLists.txt +++ b/designsystems/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(squiek) add_subdirectory(material3) add_subdirectory(fluent2) add_subdirectory(fusion) diff --git a/designsystems/squiek/CMakeLists.txt b/designsystems/squiek/CMakeLists.txt deleted file mode 100644 index e7c873f6..00000000 --- a/designsystems/squiek/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -############################################################################ -# QSkinny - Copyright (C) The authors -# SPDX-License-Identifier: BSD-3-Clause -############################################################################ - -qsk_add_plugin(squiekskin skins QskSquiekSkinFactory - QskSquiekGlobal.h QskSquiekSkin.h QskSquiekSkin.cpp - QskSquiekSkinFactory.h QskSquiekSkinFactory.cpp -) -set_target_properties(squiekskin PROPERTIES DEFINE_SYMBOL QSK_SQUIEK_MAKEDLL) diff --git a/designsystems/squiek/QskSquiekGlobal.h b/designsystems/squiek/QskSquiekGlobal.h deleted file mode 100644 index 8ff5e4f7..00000000 --- a/designsystems/squiek/QskSquiekGlobal.h +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#ifndef QSK_SQUIEK_GLOBAL_H -#define QSK_SQUIEK_GLOBAL_H - -#include "QskGlobal.h" - -#ifdef QSK_DLL - -#if defined( QSK_SQUIEK_MAKEDLL ) // create a DLL library -#define QSK_SQUIEK_EXPORT Q_DECL_EXPORT -#else // use a DLL library -#define QSK_SQUIEK_EXPORT Q_DECL_IMPORT -#endif - -#endif // QSK_DLL - -#ifndef QSK_SQUIEK_EXPORT -#define QSK_SQUIEK_EXPORT -#endif - -#endif diff --git a/designsystems/squiek/QskSquiekSkin.cpp b/designsystems/squiek/QskSquiekSkin.cpp deleted file mode 100644 index c2e888c5..00000000 --- a/designsystems/squiek/QskSquiekSkin.cpp +++ /dev/null @@ -1,1279 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include "QskSquiekSkin.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const int qskDuration = 200; - -namespace -{ - Q_DECL_UNUSED inline double operator ""_dp( long double value ) - { - return qskDpToPixels( static_cast< qreal >( value ) ); - } - - Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value ) - { - return qskDpToPixels( value ); - } - - class ColorPalette - { - public: - ColorPalette( const QColor& themeColor = QskRgb::Silver ) - { - const bool isBright = themeColor.value() > 128; - - theme = themeColor; - - lighter110 = themeColor.lighter( 110 ); - lighter125 = themeColor.lighter( 125 ); - lighter135 = themeColor.lighter( 135 ); - lighter150 = themeColor.lighter( 150 ); - - darker125 = themeColor.darker( 125 ); - darker150 = themeColor.darker( 150 ); - darker200 = themeColor.darker( 200 ); - - using namespace QskRgb; - - if ( isBright ) - { - themeForeground = Black; - - contrasted = Gainsboro; - contrastedText = Black; - - highlighted = RoyalBlue; - highlightedText = White; - - base = White; - baseActive = Beige; - } - else - { - themeForeground = White; - - contrasted = DarkGrey; - contrastedText = White; - - highlighted = SlateGrey; - highlightedText = White; - - base = Black; - baseActive = base.lighter( 110 ); - } - } - - QColor theme; - QColor themeForeground; - - QColor lighter150; - QColor lighter135; - QColor lighter125; - QColor lighter110; - - QColor darker125; - QColor darker150; - QColor darker200; - - QColor base; - QColor baseActive; - - QColor contrasted; - QColor contrastedText; - - QColor highlighted; - QColor highlightedText; - }; - - class Editor : private QskSkinHintTableEditor - { - public: - Editor( QskSkinHintTable* table, const ColorPalette& palette ) - : QskSkinHintTableEditor( table ) - , m_pal( palette ) - { - } - - void setup(); - - private: - void setupControl(); - - void setupBox(); - void setupCheckBox(); - void setupComboBox(); - void setupDialogButtonBox(); - void setupDrawer(); - void setupFocusIndicator(); - void setupInputPanel(); - void setupInputPredictionBar(); - void setupVirtualKeyboard(); - void setupListView(); - void setupMenu(); - void setupPageIndicator(); - void setupPopup(); - void setupProgressBar(); - void setupProgressRing(); - void setupPushButton(); - void setupRadioBox(); - void setupScrollView(); - void setupSegmentedBar(); - void setupSeparator(); - void setupSlider(); - void setupSubWindow(); - void setupSpinBox(); - void setupSwitchButton(); - void setupTabButton(); - void setupTabBar(); - void setupTabView(); - void setupTextLabel(); - void setupTextInput(); - - enum PanelStyle - { - NoPanel, - Raised, - Sunken, - Plain, - Flat - }; - - void setSeparator( QskAspect ); - void setButton( QskAspect, PanelStyle, qreal border = 2.0 ); - void setPanel( QskAspect, PanelStyle ); - - const ColorPalette& m_pal; - }; - - enum ColorRole - { - DisabledSymbol = 1, - CursorSymbol - }; -} - -void Editor::setSeparator( QskAspect aspect ) -{ - setGradient( aspect, m_pal.lighter110, m_pal.darker125 ); - setBoxShape( aspect, 0 ); - setBoxBorderMetrics( aspect, 0 ); -} - -void Editor::setButton( QskAspect aspect, PanelStyle style, qreal border ) -{ -#if 1 - // Buttons shift ??? -#endif - QskBoxBorderColors borderColors; - - QskGradient gradient; - gradient.setLinearDirection( Qt::Vertical ); - - switch ( style ) - { - case Raised: - { - borderColors.setGradientAt( Qt::TopEdge | Qt::LeftEdge, m_pal.lighter135 ); - borderColors.setGradientAt( Qt::RightEdge | Qt::BottomEdge, m_pal.darker200 ); - gradient.setStops( m_pal.lighter125, m_pal.lighter110 ); - - break; - } - case Sunken: - { - borderColors.setGradientAt( Qt::TopEdge | Qt::LeftEdge, m_pal.darker200 ); - borderColors.setGradientAt( Qt::RightEdge | Qt::BottomEdge, m_pal.lighter135 ); - gradient.setStops( m_pal.lighter110, m_pal.lighter125 ); - - break; - } - case Plain: - { - borderColors.setGradients( m_pal.darker125 ); - gradient.setStops( m_pal.lighter125 ); - - break; - } - case Flat: - case NoPanel: - { - QColor noColor( m_pal.theme ); - noColor.setAlpha( 0 ); - - borderColors.setGradients( noColor ); - gradient.setStops( noColor ); - - if ( style == NoPanel ) - border = 0; - - break; - } - } - - setBoxBorderColors( aspect, borderColors ); - setGradient( aspect, gradient ); - setBoxShape( aspect, 4 ); - setBoxBorderMetrics( aspect, border ); -} - -void Editor::setPanel( QskAspect aspect, PanelStyle style ) -{ - setButton( aspect, style, 1 ); -} - -void Editor::setup() -{ - setupControl(); - - setupBox(); - setupCheckBox(); - setupComboBox(); - setupDialogButtonBox(); - setupDrawer(); - setupFocusIndicator(); - setupInputPanel(); - setupInputPredictionBar(); - setupVirtualKeyboard(); - setupListView(); - setupMenu(); - setupPageIndicator(); - setupPopup(); - setupProgressBar(); - setupProgressRing(); - setupPushButton(); - setupRadioBox(); - setupScrollView(); - setupSegmentedBar(); - setupSeparator(); - setupSlider(); - setupSubWindow(); - setupSpinBox(); - setupSwitchButton(); - setupTabButton(); - setupTabBar(); - setupTabView(); - setupTextLabel(); - setupTextInput(); -} - -void Editor::setupControl() -{ - using A = QskAspect; - using Q = QskControl; - - setPadding( A::NoSubcontrol, 4 ); - - setGradient( A::NoSubcontrol, m_pal.lighter135 ); - setColor( A::NoSubcontrol | A::StyleColor, m_pal.themeForeground ); - setColor( A::NoSubcontrol | A::StyleColor | Q::Disabled, m_pal.theme ); -} - -void Editor::setupBox() -{ - setPanel( QskBox::Panel, Plain ); -} - -void Editor::setupCheckBox() -{ - using A = QskAspect; - using Q = QskCheckBox; - - const qreal size = 26_dp; - - setSpacing( Q::Panel, 5_dp ); - - setStrutSize( Q::Box, size, size ); - - setPadding( Q::Box, 5_dp ); - setBoxShape( Q::Box, 3_dp ); - setBoxBorderMetrics( Q::Box, 1_dp ); - - setBoxBorderColors( Q::Box, m_pal.darker125 ); - setGradient( Q::Box, m_pal.lighter135 ); - setGradient( Q::Box | Q::Checked, m_pal.highlighted ); - - setGradient( Q::Box | Q::Disabled, m_pal.lighter110 ); - setBoxBorderColors( Q::Box, m_pal.theme ); - - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto symbol = QskStandardSymbol::graphic( QskStandardSymbol::CheckMark ); - - const auto aspect = Q::Indicator | Q::Checked | state; - - setSymbol( aspect, symbol ); - setSymbol( aspect | Q::Error, symbol ); - } - - setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap ); - - setHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken ); - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Disabled, m_pal.darker200 ); - - setAnimation( Q::Box | A::Color, qskDuration ); -} - -void Editor::setupComboBox() -{ - using Q = QskComboBox; - - setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Disabled, m_pal.darker200 ); - - setStrutSize( Q::Panel, -1.0, 56_dp ); - - setPadding( Q::Panel, 5 ); - setBoxBorderMetrics( Q::Panel, 2 ); - setBoxShape( Q::Panel, 4 ); - - setSpacing( Q::Panel, 8_dp ); - - const QColor c = m_pal.theme.lighter( 120 ); - - const QskBoxBorderColors borderColors( - c.darker( 170 ), c.darker( 170 ), - c.darker( 105 ), c.darker( 105 ) ); - - setBoxBorderColors( Q::Panel, borderColors ); - setGradient( Q::Panel, c ); - - setStrutSize( Q::Icon, 24_dp, 24_dp ); - setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol ); - - setStrutSize( Q::StatusIndicator, 15_dp, 15_dp ); - setGraphicRole( Q::StatusIndicator | Q::Disabled, DisabledSymbol ); - - setAlignment( Q::StatusIndicator, Qt::AlignRight | Qt::AlignVCenter ); - - setSymbol( Q::StatusIndicator, - QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) ); - setSymbol( Q::StatusIndicator | Q::PopupOpen, - QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) ); -} - -void Editor::setupPopup() -{ - using A = QskAspect; - using Q = QskPopup; - - setHint( Q::Overlay | A::Style, true ); - setGradient( Q::Overlay, qRgba( 220, 220, 220, 150 ) ); -} - -void Editor::setupMenu() -{ - using A = QskAspect; - using Q = QskMenu; - - setHint( Q::Overlay | A::Style, true ); - setGradient( Q::Overlay, QColor( 220, 220, 220, 100 ) ); - - setBoxShape( Q::Panel, 4_dp ); - setBoxBorderMetrics( Q::Panel, 1_dp ); - setBoxBorderColors( Q::Panel, m_pal.darker125 ); - - setGradient( Q::Panel, m_pal.lighter110 ); - - const bool isCascading = qskMaybeDesktopPlatform(); - setHint( Q::Panel | A::Style, isCascading ); - - setMetric( Q::Separator | A::Size, 2_dp ); - setSeparator( Q::Separator ); - setMargin( Q::Separator, 2 ); - - setPadding( Q::Segment, QskMargins( 2, 10, 2, 10 ) ); - setSpacing( Q::Segment, 5 ); - setGradient( Q::Segment, Qt::transparent ); - - setGradient( Q::Cursor, m_pal.highlighted ); - - setColor( Q::Text, m_pal.contrastedText ); - setColor( Q::Text | Q::Selected, m_pal.highlightedText ); - - setStrutSize( Q::Icon, 16, 16 ); - setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol ); - setGraphicRole( Q::Icon | Q::Selected, CursorSymbol ); - - setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic ); - setAnimation( Q::Panel | A::Position, 100 ); -} - -void Editor::setupTextLabel() -{ - using Q = QskTextLabel; - - setAlignment( Q::Text, Qt::AlignCenter ); - setColor( Q::Text, m_pal.themeForeground ); - - setPadding( Q::Panel, 5 ); - setBoxBorderMetrics( Q::Panel, 2 ); - setBoxShape( Q::Panel, 4 ); - - const QColor c = m_pal.base; - - const QskBoxBorderColors borderColors( - c.darker( 170 ), c.darker( 170 ), - c.darker( 105 ), c.darker( 105 ) ); - - setBoxBorderColors( Q::Panel, borderColors ); - setGradient( Q::Panel, c ); -} - -void Editor::setupTextInput() -{ - using A = QskAspect; - using Q = QskTextInput; - - setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignTop ); - - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::PanelSelected, m_pal.highlighted ); - setColor( Q::TextSelected, m_pal.highlightedText ); - - setPadding( Q::Panel, 5 ); - setBoxBorderMetrics( Q::Panel, 2 ); - setBoxShape( Q::Panel, 4 ); - - for ( auto state : { A::NoState, Q::ReadOnly, Q::Editing } ) - { - QColor c; - - if ( state == Q::ReadOnly ) - { - c = m_pal.theme.lighter( 120 ); - } - else if ( state == Q::Editing ) - { - c = m_pal.baseActive; - } - else - { - c = m_pal.base; - } - - const auto aspect = Q::Panel | state; - - const QskBoxBorderColors borderColors( - c.darker( 170 ), c.darker( 170 ), - c.darker( 105 ), c.darker( 105 ) ); - - setBoxBorderColors( aspect, borderColors ); - setGradient( aspect, c ); - } - - setAnimation( Q::Panel | A::Color, qskDuration ); -} - -void Editor::setupProgressBar() -{ - using A = QskAspect; - using Q = QskProgressBar; - - for ( auto subControl : { Q::Groove, Q::Fill } ) - { - setMetric( subControl | A::Size, 6 ); - setPadding( subControl, 0 ); - setBoxShape( subControl, 4 ); - } - - setGradient( Q::Groove, m_pal.lighter110 ); - setGradient( Q::Fill, m_pal.highlighted ); -} - -void Editor::setupProgressRing() -{ - using A = QskAspect; - using Q = QskProgressRing; - - for ( auto subControl : { Q::Groove, Q::Fill } ) - { - setMetric( subControl | A::Size, 6 ); - setPadding( subControl, 0 ); - setBoxShape( subControl, 4 ); - } - - setArcMetrics( Q::Groove, 90, -360, 6 ); - setGradient( Q::Groove, m_pal.lighter110 ); - - setStrutSize( Q::Fill, { 60, 60 } ); - setGradient( Q::Fill, m_pal.highlighted ); - setArcMetrics( Q::Fill, 90, -360, 6 ); -} - -void Editor::setupFocusIndicator() -{ - using Q = QskFocusIndicator; - using A = QskAspect; - - setPadding( Q::Panel, 5 ); - setBoxBorderMetrics( Q::Panel, 2 ); - setBoxShape( Q::Panel, 4 ); - setGradient( Q::Panel, Qt::transparent ); - - setBoxBorderColors( Q::Panel, m_pal.highlighted ); - setBoxBorderColors( Q::Panel | Q::Disabled, - QskRgb::toTransparent( m_pal.highlighted, 0 ) ); - - setAnimation( Q::Panel | A::Color, 200 ); - setAnimation( Q::Panel | A::Color | Q::Disabled, 500 ); -} - -void Editor::setupSeparator() -{ - using A = QskAspect; - using Q = QskSeparator; - - setMetric( Q::Panel | A::Size, 4 ); - setSeparator( Q::Panel ); -} - -void Editor::setupSegmentedBar() -{ - using A = QskAspect; - using Q = QskSegmentedBar; - - const uint duration = 100; - - { - // Panel - - setPadding( Q::Panel, 0 ); - setSpacing( Q::Panel, 5 ); - - setGradient( Q::Panel, m_pal.base ); - - setBoxBorderMetrics( Q::Panel, 2 ); - - const auto c = m_pal.base; - - const QskBoxBorderColors borderColors( - c.darker( 170 ), c.darker( 170 ), - c.darker( 105 ), c.darker( 105 ) ); - - setBoxBorderColors( Q::Panel, borderColors ); - - const QSizeF strutSize( 100_dp, 50_dp ); - - setStrutSize( Q::Panel | A::Horizontal, strutSize ); - setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() ); - } - - { - // Segment - - setPadding( Q::Segment, QskMargins( 2, 5, 2, 5 ) ); - setGradient( Q::Segment, QskGradient() ); - } - - { - // Cursor - setGradient( Q::Cursor, m_pal.highlighted ); - setBoxBorderColors( Q::Cursor, QColor( m_pal.highlighted ).darker( 120 ) ); - - setGradient( Q::Cursor | Q::Disabled, QColor( Qt::gray ).darker( 110 ) ); - setBoxBorderColors( Q::Cursor | Q::Disabled, Qt::gray ); - - setAnimation( Q::Cursor | A::Metric | A::Position, duration ); - } - - for( auto subControl : { Q::Panel, Q::Cursor } ) - setBoxShape( subControl, 3 ); - - { - // Text - - setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap ); - - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Selected, m_pal.highlightedText ); - - for( auto state : { A::NoState, Q::Selected } ) - setColor( Q::Text | state | Q::Disabled, m_pal.darker200 ); - - setAnimation( Q::Text | A::Color, duration ); - } - - { - // Icon - - setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol ); - setGraphicRole( Q::Icon | Q::Selected, CursorSymbol ); - setStrutSize( Q::Icon, -1, 30_dp ); - } -} - -void Editor::setupPageIndicator() -{ - using Q = QskPageIndicator; - - const auto extent = 8_dp; - setStrutSize( Q::Bullet, extent, extent ); - - // circles, without border - setBoxShape( Q::Bullet, 100, Qt::RelativeSize ); - setBoxBorderMetrics( Q::Bullet, 0 ); - - setGradient( Q::Bullet, m_pal.darker150 ); - setMargin( Q::Bullet, 1_dp ); - - setGradient( Q::Bullet | Q::Selected, m_pal.lighter150 ); - setMargin( Q::Bullet | Q::Selected, 0 ); - - setSpacing( Q::Panel, 3 ); - setPadding( Q::Panel, 0 ); - setGradient( Q::Panel, QskGradient() ); // invisible -} - -void Editor::setupPushButton() -{ - using A = QskAspect; - using Q = QskPushButton; - - // Panel - setHint( Q::Panel | QskAspect::Direction, Qsk::TopToBottom ); - setStrutSize( Q::Panel, 75_dp, 23_dp ); - - setMargin( Q::Panel, 0 ); - setPadding( Q::Panel, 10 ); - setMetric( Q::Panel | A::Spacing, 4 ); - - setButton( Q::Panel, Raised ); - setButton( Q::Panel | A::Header | Q::Hovered, Raised ); - - setButton( Q::Panel | A::Header, Flat ); - setButton( Q::Panel | A::Header | Q::Disabled, Flat ); - - for ( auto state : { Q::Pressed, Q::Checked } ) - { - setButton( Q::Panel | state, Sunken ); - setButton( Q::Panel | A::Header | state, Sunken ); - } - - setAnimation( Q::Panel | A::Color, qskDuration ); - setAnimation( Q::Panel | A::Metric, qskDuration ); - - // Text - - setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap ); - - setHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken ); - - setAlignment( Q::Text, Qt::AlignCenter ); - - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Disabled, m_pal.darker200 ); - - // Icon - setAlignment( Q::Icon, Qt::AlignCenter ); -} - -void Editor::setupRadioBox() -{ - using Q = QskRadioBox; - - setSpacing( Q::Panel, 10_dp ); - setSpacing( Q::Button, 10_dp ); - - setStrutSize( Q::CheckIndicatorPanel, 20_dp, 20_dp ); - - for ( auto subControl : { Q::CheckIndicatorPanel, Q::CheckIndicator, Q::Ripple } ) - setBoxShape( subControl, 100, Qt::RelativeSize ); // circular - - setBoxBorderMetrics( Q::CheckIndicatorPanel, 1_dp ); - - setBoxBorderColors( Q::CheckIndicatorPanel, m_pal.darker125 ); - setBoxBorderColors( Q::CheckIndicatorPanel | Q::Disabled, m_pal.theme ); - - setPadding( Q::CheckIndicatorPanel, 5_dp ); - - setGradient( Q::Button, QskGradient() ); - - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Disabled, m_pal.darker200 ); - - setColor( Q::Panel, m_pal.lighter125 ); - setColor( Q::Panel | Q::Disabled, m_pal.lighter125 ); - - setColor( Q::CheckIndicatorPanel | Q::Disabled, m_pal.lighter110 ); - - setColor( Q::CheckIndicator, Qt::transparent); - setColor( Q::CheckIndicator | Q::Selected, m_pal.themeForeground ); - setColor( Q::CheckIndicator | Q::Selected | Q::Disabled, m_pal.darker200 ); -} - -void Editor::setupDialogButtonBox() -{ - using Q = QskDialogButtonBox; - - setBoxBorderColors( Q::Panel, m_pal.theme ); - setGradient( Q::Panel, m_pal.lighter135 ); - setBoxBorderMetrics( Q::Panel, 0 ); - setBoxShape( Q::Panel, 2 ); -} - -void Editor::setupDrawer() -{ - using Q = QskDrawer; - using A = QskAspect; - - setPanel( Q::Panel, Plain ); - setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic ); -} - -void Editor::setupTabButton() -{ - using A = QskAspect; - using Q = QskTabButton; - - setStrutSize( Q::Panel, 30, 16 ); - - for ( auto variation : { A::Top, A::Bottom } ) - { - setVGradient( Q::Panel | variation, m_pal.lighter125, m_pal.lighter110 ); - - for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } ) - { - setGradient( Q::Panel | variation | state, m_pal.lighter125 ); - setColor( Q::Text | variation | state, m_pal.themeForeground ); - } - } - - for ( auto variation : { A::Left, A::Right } ) - { - setGradient( Q::Panel | variation, m_pal.lighter125 ); - - for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } ) - { - setGradient( Q::Panel | variation | state, m_pal.highlighted ); - setColor( Q::Text | variation | state, m_pal.highlightedText ); - } - } - - setBoxBorderColors( Q::Panel, m_pal.darker200 ); - - for ( auto variation : { A::Left, A::Right, A::Top, A::Bottom } ) - { - const auto aspect = Q::Panel | variation; - - QskMargins margins0, margins1; - QskBoxBorderMetrics border( 1 ); - QskBoxShapeMetrics shape( 4 ); - - const int indent = 4; - - if ( variation == A::Top ) - { - margins0 = QskMargins( -1, indent, -1, -1 ); - margins1 = QskMargins( -1, 0, -1, -2 ); - - border.setWidthAt( Qt::BottomEdge, 0 ); - - shape.setRadius( Qt::BottomLeftCorner, 0 ); - shape.setRadius( Qt::BottomRightCorner, 0 ); - } - else if ( variation == A::Bottom ) - { - margins0 = QskMargins( -1, -1, -1, indent ); - margins1 = QskMargins( -1, -2, -1, 0 ); - - border.setWidthAt( Qt::TopEdge, 0 ); - - shape.setRadius( Qt::TopLeftCorner, 0 ); - shape.setRadius( Qt::TopRightCorner, 0 ); - } - else if ( variation == A::Left ) - { - margins0 = QskMargins( indent, -1, -1, -1 ); - margins1 = QskMargins( 0, -1, -2, 0 ); - - border.setWidthAt( Qt::RightEdge, 0 ); - - shape.setRadius( Qt::TopRightCorner, 0 ); - shape.setRadius( Qt::BottomRightCorner, 0 ); - } - else if ( variation == A::Right ) - { - margins0 = QskMargins( -1, -1, indent, -1 ); - margins1 = QskMargins( -2, -1, 0, 0 ); - - border.setWidthAt( Qt::LeftEdge, 0 ); - - shape.setRadius( Qt::TopLeftCorner, 0 ); - shape.setRadius( Qt::BottomLeftCorner, 0 ); - } - - setMargin( aspect, margins0 ); - - for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } ) - setMargin( aspect | state, margins1 ); - - setPadding( aspect, { 6, 12, 6, 12 } ); - - setBoxBorderMetrics( aspect, border ); - setBoxShape( aspect, shape ); - } - - QskAnimationHint animationHint( qskDuration ); - animationHint.updateFlags = QskAnimationHint::UpdateNode; - - setAnimation( Q::Panel | A::Color, animationHint ); - setAnimation( Q::Panel | A::Metric, animationHint ); - - // text - setAlignment( Q::Text, Qt::AlignCenter ); - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Text | Q::Disabled, m_pal.darker200 ); -} - -void Editor::setupSlider() -{ - using A = QskAspect; - using Q = QskSlider; - - const qreal extent = 40; - - // Panel - - for ( auto variation : { A::Horizontal, A::Vertical } ) - { - const auto aspect = Q::Panel | variation; - - setMetric( aspect | A::Size, extent ); - setBoxBorderMetrics( aspect, 0 ); - setBoxShape( aspect, 0 ); - setGradient( aspect, QskGradient() ); - } - - setPadding( Q::Panel | A::Horizontal, QskMargins( 0.5 * extent, 0 ) ); - setPadding( Q::Panel | A::Vertical, QskMargins( 0, 0.5 * extent ) ); - - // Groove, Fill - - for ( auto variation : { A::Horizontal, A::Vertical } ) - { - for ( auto subControl : { Q::Groove, Q::Fill } ) - { - const auto aspect = subControl | variation; - - setMetric( aspect | A::Size, 0.3 * extent ); - setPadding( aspect, 0 ); - - setBoxBorderMetrics( aspect, 0 ); - setBoxShape( aspect, 0.1 * extent ); - } - - setGradient( Q::Groove | variation, m_pal.darker200 ); - setGradient( Q::Fill | variation, QskGradient() ); // no filling - } - - // Handle - - for ( auto variation : { A::Horizontal, A::Vertical } ) - { - const auto aspect = Q::Handle | variation; - - setButton( aspect, Raised, 1 ); - setBoxShape( aspect, 20.0, Qt::RelativeSize ); - setButton( aspect | Q::Pressed, Sunken, 1 ); - - const qreal sz = 0.75 * extent; - setStrutSize( aspect, sz, sz ); - } - - setAnimation( Q::Handle | A::Color, qskDuration ); -} - -void Editor::setupTabBar() -{ - using A = QskAspect; - using Q = QskTabBar; - - setBoxBorderMetrics( Q::Panel, 0 ); - - setMargin( Q::Panel, 0 ); - - const qreal vb = 1.0; // borderWidth of the view - const qreal pw = 1.0; // extra space for the negative padding of the buttons - - setPadding( Q::Panel | A::Top, pw, 0.0, pw, vb ); - setPadding( Q::Panel | A::Bottom, pw, vb, pw, 0.0 ); - setPadding( Q::Panel | A::Left, 0.0, pw, vb, pw ); - setPadding( Q::Panel | A::Right, vb, pw, 0.0, pw ); - - // when flicking - setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) ); -} - -void Editor::setupTabView() -{ - using A = QskAspect; - using Q = QskTabView; - - setPadding( Q::Page, 0 ); - setMargin( Q::Page, 0 ); - setPanel( Q::Page, Plain ); - - const qreal radius = 8.0; - setBoxShape( Q::Page | A::Top, 0, 0, radius, radius ); - setBoxShape( Q::Page | A::Bottom, radius, radius, 0, 0 ); - setBoxShape( Q::Page | A::Left, 0, radius, 0, radius ); - setBoxShape( Q::Page | A::Right, radius, 0, radius, 0 ); - - setAnimation( Q::Page, qskDuration ); -} - -void Editor::setupInputPanel() -{ - using Q = QskInputPanelBox; - - setPadding( Q::Panel, 5 ); - setPanel( Q::Panel, Raised ); -} - -void Editor::setupInputPredictionBar() -{ - using Q = QskInputPredictionBar; - - setPadding( Q::Panel, 5 ); - setPanel( Q::Panel, Flat ); - - setButton( Q::ButtonPanel, Flat ); - setButton( Q::ButtonPanel | QskPushButton::Pressed, Sunken ); - - setStrutSize( Q::ButtonPanel, 30_dp, 23_dp ); - - setColor( Q::ButtonText, m_pal.themeForeground ); - setColor( Q::ButtonText | QskPushButton::Disabled, m_pal.darker200 ); -} - -void Editor::setupVirtualKeyboard() -{ - using A = QskAspect; - using Q = QskVirtualKeyboard; - - setPadding( Q::Panel, 5 ); - setMetric( Q::Panel | A::Spacing, 5 ); - setPanel( Q::Panel, Raised ); - - setButton( Q::ButtonPanel, Raised ); - setButton( Q::ButtonPanel | QskPushButton::Pressed, Sunken ); - - setAnimation( Q::ButtonPanel | A::Color, qskDuration ); - - setColor( Q::ButtonText, m_pal.themeForeground ); - setColor( Q::ButtonText | QskPushButton::Disabled, m_pal.darker200 ); -} - -void Editor::setupScrollView() -{ - using A = QskAspect; - using Q = QskScrollView; - - setMetric( Q::Panel | A::Spacing, 4 ); - setGradient( Q::Panel, QskGradient() ); - - setBoxBorderMetrics( Q::Viewport, 2 ); - setBoxShape( Q::Viewport, 8 ); - - QColor fillColor( Qt::white ); - - const QskBoxBorderColors borderColors( - fillColor.darker( 170 ), fillColor.darker( 170 ), - fillColor.darker( 105 ), fillColor.darker( 105 ) ); - - setBoxBorderColors( Q::Viewport, borderColors ); - setGradient( Q::Viewport, fillColor ); - - // scroll bars - for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } ) - { - setMetric( subControl | A::Size, 14 ); - setPadding( subControl, 2 ); - setMargin( subControl, 0 ); - - setPanel( subControl, Sunken ); - setBoxShape( subControl, 100, Qt::RelativeSize ); - setBoxBorderMetrics( subControl, 1 ); - } - - // scrollbar handles - for ( auto subControl : { Q::HorizontalScrollHandle, Q::VerticalScrollHandle } ) - { - const qreal bw = 1.0; - - setButton( subControl, Raised, bw ); - setButton( subControl | Q::Pressed, Sunken, bw ); - setBoxShape( subControl, 100, Qt::RelativeSize ); - setBoxShape( subControl | Q::Pressed, 100, Qt::RelativeSize ); - - const auto extent = 40_dp; - - if ( subControl == Q::HorizontalScrollHandle ) - setStrutSize( subControl, extent, 0.0 ); - else - setStrutSize( subControl, 0.0, extent ); - - setAnimation( subControl | A::Color, qskDuration ); - } - - // when changing the position by QskScrollView::scrollTo - setAnimation( Q::Viewport | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) ); -} - -void Editor::setupListView() -{ - using A = QskAspect; - using Q = QskListView; - - // padding for each cell - setPadding( Q::Cell, QskMargins( 4, 8 ) ); - - setColor( Q::Text, m_pal.themeForeground ); - setColor( Q::Cell, Qt::white ); - - for ( auto state : { A::NoState, Q::Hovered, Q::Pressed } ) - { - setColor( Q::Cell | state | Q::Selected, m_pal.highlighted ); - setColor( Q::Text | state | Q::Selected, m_pal.highlightedText ); - } -} - -void Editor::setupSubWindow() -{ - using A = QskAspect; - using Q = QskSubWindow; - - const qreal radius = 5.0; - - // Panel - - setPadding( Q::Panel, 10 ); - setBoxBorderMetrics( Q::Panel, 2 ); - setBoxShape( Q::Panel, radius, radius, 0, 0, Qt::AbsoluteSize ); - - QskBoxBorderColors borderColors; - borderColors.setGradientAt( Qt::TopEdge | Qt::LeftEdge, m_pal.lighter125 ); - borderColors.setGradientAt( Qt::RightEdge | Qt::BottomEdge, m_pal.darker200 ); - - setBoxBorderColors( Q::Panel, borderColors ); - setGradient( Q::Panel, m_pal.lighter135 ); - - // TitleBarPanel - - setHint( Q::TitleBarPanel | QskAspect::Style, - Q::TitleBar | Q::Title | Q::Symbol ); - - setGradient( Q::TitleBarPanel | Q::Focused, m_pal.highlighted ); - setGradient( Q::TitleBarPanel, m_pal.contrasted ); - setSpacing( Q::TitleBarPanel, 5 ); - setStrutSize( Q::TitleBarPanel, 0, 20 ); - setBoxShape( Q::TitleBarPanel, radius, radius, 0, 0, Qt::AbsoluteSize ); - - // TitleBarText - - setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap ); - - setFontRole( Q::TitleBarText, QskSkin::SmallFont ); - setColor( Q::TitleBarText | Q::Focused, m_pal.highlightedText ); - setColor( Q::TitleBarText, m_pal.themeForeground ); - - setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter ); - -#if 1 - for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } ) - setAnimation( subControl | A::Color, qskDuration ); -#endif - - setAnimation( Q::Panel | A::Position, qskDuration, QEasingCurve::OutCubic ); -} - -void Editor::setupSpinBox() -{ - using A = QskAspect; - using Q = QskSpinBox; - - setHint( Q::Panel | A::Style, Q::UpDownControl ); - setSpacing( Q::Panel, 2 ); - - setPadding( Q::TextPanel, 5 ); - setBoxBorderMetrics( Q::TextPanel, 2 ); - setBoxShape( Q::TextPanel, 4 ); - - const auto c = m_pal.base; - - const QskBoxBorderColors borderColors( - c.darker( 170 ), c.darker( 170 ), - c.darker( 105 ), c.darker( 105 ) ); - - setBoxBorderColors( Q::TextPanel, borderColors ); - setGradient( Q::TextPanel, c ); - - for ( auto subControl : { Q::UpPanel, Q::DownPanel } ) - { - setButton( subControl, Raised, 1.0 ); - setPadding( subControl, 4 ); - setStrutSize( subControl, 20, 10 ); - setBoxShape( subControl, 0 ); - - const auto downState = ( subControl == Q::UpPanel ) - ? Q::Increasing : Q::Decreasing; - - setButton( subControl | downState, Sunken, 1.0 ); - - setAnimation( subControl | A::Metric, 100 ); - setAnimation( subControl | A::Color, 100 ); - } - - setSymbol( Q::UpIndicator, - QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) ); - - setSymbol( Q::DownIndicator, - QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) ); - - for ( auto subControl : { Q::UpIndicator, Q::DownIndicator } ) - { - setGraphicRole( subControl | Q::Disabled, DisabledSymbol ); - setAlignment( subControl, Qt::AlignCenter ); - - setAnimation( subControl | A::Color, 100 ); - } -} - -void Editor::setupSwitchButton() -{ - using A = QskAspect; - using Q = QskSwitchButton; - - const qreal radius = 15_dp; - const qreal handleSize = 2 * ( radius - 2 ); - - setBoxShape( Q::Groove, 100, Qt::RelativeSize ); - - const QSizeF grooveSize( 3.4 * radius, 2 * radius ); - setStrutSize( Q::Groove | A::Horizontal, grooveSize ); - setStrutSize( Q::Groove | A::Vertical, grooveSize.transposed() ); - - setGradient( Q::Groove, m_pal.theme ); - setGradient( Q::Groove | Q::Checked, m_pal.highlighted ); - setGradient( Q::Groove | Q::Disabled, m_pal.lighter150 ); - - setBoxBorderColors( Q::Groove | Q::Disabled, m_pal.theme ); - setBoxBorderMetrics( Q::Groove, 2 ); - setBoxBorderColors( Q::Groove, m_pal.darker200 ); - - setBoxShape( Q::Handle, 100, Qt::RelativeSize ); - setStrutSize( Q::Handle, handleSize, handleSize ); - - setVGradient( Q::Handle, m_pal.lighter150, m_pal.lighter110 ); - setGradient( Q::Handle | Q::Disabled, m_pal.lighter110 ); - - setBoxBorderMetrics( Q::Handle, 2 ); - setBoxBorderColors( Q::Handle, m_pal.darker200 ); - setBoxBorderColors( Q::Handle | Q::Disabled, m_pal.theme ); - - for( auto state : { A::NoState, Q::Disabled } ) - { - auto aspect = Q::Handle | state; - - setPosition( aspect, 0 ); - setPosition( aspect | Q::Checked, 1 ); - } - - setAnimation( Q::Handle | A::Metric, qskDuration ); - setAnimation( Q::Groove | A::Color, qskDuration ); -} - -class QskSquiekSkin::PrivateData -{ - public: - ColorPalette palette; -}; - -QskSquiekSkin::QskSquiekSkin( QObject* parent ) - : Inherited( parent ) - , m_data( new PrivateData() ) -{ - setupFonts( QStringLiteral( "DejaVuSans" ) ); - - const auto& pal = m_data->palette; - - addGraphicRole( DisabledSymbol, pal.darker200 ); - addGraphicRole( CursorSymbol, pal.highlightedText ); - - Editor editor( &hintTable(), pal ); - editor.setup(); -} - -QskSquiekSkin::~QskSquiekSkin() -{ -} - -void QskSquiekSkin::resetColors( const QColor& accent ) -{ - m_data->palette = ColorPalette( accent ); - - Editor editor( &hintTable(), m_data->palette ); - editor.setup(); -} - -void QskSquiekSkin::addGraphicRole( int role, const QColor& color ) -{ - QskColorFilter colorFilter; - colorFilter.addColorSubstitution( QskRgb::Black, color.rgba() ); - - setGraphicFilter( role, colorFilter ); -} - -#include "moc_QskSquiekSkin.cpp" diff --git a/designsystems/squiek/QskSquiekSkin.h b/designsystems/squiek/QskSquiekSkin.h deleted file mode 100644 index 0036a35f..00000000 --- a/designsystems/squiek/QskSquiekSkin.h +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#ifndef QSK_SQUIEK_SKIN_H -#define QSK_SQUIEK_SKIN_H - -#include "QskSquiekGlobal.h" -#include -#include - -class QSK_SQUIEK_EXPORT QskSquiekSkin : public QskSkin -{ - Q_OBJECT - - using Inherited = QskSkin; - - public: - QskSquiekSkin( QObject* parent = nullptr ); - ~QskSquiekSkin() override; - - private: - void resetColors( const QColor& accent ) override; - void addGraphicRole( int role, const QColor& ); - - class PrivateData; - std::unique_ptr< PrivateData > m_data; -}; - -#endif diff --git a/designsystems/squiek/QskSquiekSkinFactory.cpp b/designsystems/squiek/QskSquiekSkinFactory.cpp deleted file mode 100644 index d2c4711d..00000000 --- a/designsystems/squiek/QskSquiekSkinFactory.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include "QskSquiekSkinFactory.h" -#include "QskSquiekSkin.h" - -static const QString squiekSkinName = QStringLiteral( "Squiek" ); - -QskSquiekSkinFactory::QskSquiekSkinFactory( QObject* parent ) - : QskSkinFactory( parent ) -{ -} - -QskSquiekSkinFactory::~QskSquiekSkinFactory() -{ -} - -QStringList QskSquiekSkinFactory::skinNames() const -{ - return { squiekSkinName }; -} - -QskSkin* QskSquiekSkinFactory::createSkin( const QString& skinName ) -{ - if ( QString::compare( skinName, squiekSkinName, Qt::CaseInsensitive ) == 0 ) - return new QskSquiekSkin(); - - return nullptr; -} - -#include "moc_QskSquiekSkinFactory.cpp" diff --git a/designsystems/squiek/QskSquiekSkinFactory.h b/designsystems/squiek/QskSquiekSkinFactory.h deleted file mode 100644 index 42b71c86..00000000 --- a/designsystems/squiek/QskSquiekSkinFactory.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#ifndef QSK_SQUIEK_SKIN_FACTORY_H -#define QSK_SQUIEK_SKIN_FACTORY_H - -#include "QskSquiekGlobal.h" -#include - -class QSK_SQUIEK_EXPORT QskSquiekSkinFactory : public QskSkinFactory -{ - Q_OBJECT - -#if defined( QSK_SQUIEK_MAKEDLL ) - Q_PLUGIN_METADATA( IID QskSkinFactoryIID FILE "metadata.json" ) - Q_INTERFACES( QskSkinFactory ) -#endif - - public: - QskSquiekSkinFactory( QObject* parent = nullptr ); - ~QskSquiekSkinFactory() override; - - QStringList skinNames() const override; - QskSkin* createSkin( const QString& skinName ) override; -}; - -#endif diff --git a/designsystems/squiek/metadata.json b/designsystems/squiek/metadata.json deleted file mode 100644 index 94786db2..00000000 --- a/designsystems/squiek/metadata.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "FactoryId": "SquiekFactory", - "Skins": [ { "Name": "Squiek", "Scheme": "Unknown" } ] -} diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index 710b7ceb..ab2cb0b5 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -69,9 +69,12 @@ int main( int argc, char* argv[] ) // disable default skins qskSkinManager->setPluginPaths( QStringList() ); // no plugins +#if 1 + // we should find a better way: TODO ... qskSkinManager->unregisterFactory( "material3factory" ); - qskSkinManager->unregisterFactory( "squiekfactory" ); + qskSkinManager->unregisterFactory( "fusionfactory" ); qskSkinManager->unregisterFactory( "fluent2factory" ); +#endif qskSkinManager->registerFactory( QStringLiteral( "SampleSkinFactory" ), new SkinFactory() ); diff --git a/playground/gradients/main.cpp b/playground/gradients/main.cpp index 38f91695..2a3b721e 100644 --- a/playground/gradients/main.cpp +++ b/playground/gradients/main.cpp @@ -208,7 +208,7 @@ int main( int argc, char** argv ) Skinny::init(); // we need a skin SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugBackground ); - qskSetup->setSkin( "squiek" ); + qskSetup->setSkin( "fusion" ); QskWindow window; window.setColor( QskRgb::Wheat ); diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index 07e58e84..7d005444 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -33,7 +33,7 @@ target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) if(ENABLE_ENSURE_SKINS) target_include_directories(${target} PRIVATE ${QSK_SOURCE_DIR}/designsystems) target_compile_definitions(${target} PRIVATE ENSURE_SKINS) - target_link_libraries(${target} PRIVATE squiekskin material3skin fluent2skin fusionskin) + target_link_libraries(${target} PRIVATE material3skin fluent2skin fusionskin) endif() set(HIDE_SYSTEM_FONTS ON) diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index a2f58184..433a054d 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -49,9 +49,6 @@ static bool pluginPath = initPluginPath(); #if defined( ENSURE_SKINS ) -#if 0 - #include -#endif #include #include #include @@ -67,9 +64,6 @@ static bool pluginPath = initPluginPath(); we manually add them here. */ -#if 0 - qskSkinManager->registerFactory( "SquiekFactory", new QskSquiekSkinFactory() ); -#endif qskSkinManager->registerFactory( "Material3Factory", new QskMaterial3SkinFactory() ); qskSkinManager->registerFactory( "Fluent2Factory", new QskFluent2SkinFactory() ); qskSkinManager->registerFactory( "FusionFactory", new QskFusionSkinFactory() ); From 4fdfbf0f43bc3e5646ea2a6288bd27dc98bde61d Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 25 Jan 2024 14:30:41 +0100 Subject: [PATCH 13/27] fusion skin improvements --- designsystems/fusion/CMakeLists.txt | 7 +- designsystems/fusion/QskFusionPalette.cpp | 181 ++++++ designsystems/fusion/QskFusionPalette.h | 90 +++ designsystems/fusion/QskFusionSkin.cpp | 518 +++++------------- designsystems/fusion/icons.qrc | 8 - designsystems/fusion/icons/check_small.svg | 4 - .../fusion/icons/combo-box-arrow-closed.svg | 4 - .../fusion/icons/combo-box-arrow-open.svg | 4 - .../fusion/icons/qvg/check_small.qvg | Bin 575 -> 0 bytes .../icons/qvg/combo-box-arrow-closed.qvg | Bin 515 -> 0 bytes .../fusion/icons/qvg/combo-box-arrow-open.qvg | Bin 659 -> 0 bytes .../icons/qvg/segmented-button-check.qvg | Bin 575 -> 0 bytes .../fusion/icons/segmented-button-check.svg | 4 - 13 files changed, 405 insertions(+), 415 deletions(-) create mode 100644 designsystems/fusion/QskFusionPalette.cpp create mode 100644 designsystems/fusion/QskFusionPalette.h delete mode 100644 designsystems/fusion/icons.qrc delete mode 100644 designsystems/fusion/icons/check_small.svg delete mode 100644 designsystems/fusion/icons/combo-box-arrow-closed.svg delete mode 100644 designsystems/fusion/icons/combo-box-arrow-open.svg delete mode 100644 designsystems/fusion/icons/qvg/check_small.qvg delete mode 100644 designsystems/fusion/icons/qvg/combo-box-arrow-closed.qvg delete mode 100644 designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg delete mode 100644 designsystems/fusion/icons/qvg/segmented-button-check.qvg delete mode 100644 designsystems/fusion/icons/segmented-button-check.svg diff --git a/designsystems/fusion/CMakeLists.txt b/designsystems/fusion/CMakeLists.txt index deacfa55..379c292d 100644 --- a/designsystems/fusion/CMakeLists.txt +++ b/designsystems/fusion/CMakeLists.txt @@ -4,10 +4,11 @@ ############################################################################ set(SOURCES - QskFusionGlobal.h QskFusionSkin.h QskFusionSkin.cpp + QskFusionGlobal.h + QskFusionPalette.h QskFusionPalette.cpp + QskFusionSkin.h QskFusionSkin.cpp QskFusionSkinFactory.h QskFusionSkinFactory.cpp ) -qt_add_resources(SOURCES icons.qrc) qsk_add_plugin(fusionskin skins QskFusionSkinFactory ${SOURCES}) -set_target_properties(fusionskin PROPERTIES DEFINE_SYMBOL QSK_FUSION_MAKEDLL ) +set_target_properties(fusionskin PROPERTIES DEFINE_SYMBOL QSK_FUSION_MAKEDLL) diff --git a/designsystems/fusion/QskFusionPalette.cpp b/designsystems/fusion/QskFusionPalette.cpp new file mode 100644 index 00000000..aac94aed --- /dev/null +++ b/designsystems/fusion/QskFusionPalette.cpp @@ -0,0 +1,181 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#include "QskFusionPalette.h" +#include + +#if 0 +extern QPalette qt_fusionPalette(); +#endif + +namespace +{ + inline constexpr QRgb rgbGray( int value ) + { + return qRgb( value, value, value ); + } +} + +QskFusionPalette::QskFusionPalette( QskSkin::ColorScheme colorScheme ) +{ + using namespace QskRgb; + using P = QPalette; + + struct + { + QRgb base, background, text, disabledText, light, midLight, mid, dark, + darkDisabled, highlight, disabledHighlight, shadow, disabledShadow, + hightlightedText, link; + } colors; + + if ( colorScheme == QskSkin::DarkScheme ) + { + colors.base = rgbGray( 36 ); + colors.background = rgbGray( 50 ); + colors.text = rgbGray( 240 ); + colors.disabledText = rgbGray( 130 ); + colors.light = rgbGray( 75 ); + colors.midLight = rgbGray( 42 ); + colors.mid = rgbGray( 38 ); + colors.dark = rgbGray( 33 ); + colors.darkDisabled = rgbGray( 190 ); + colors.highlight = qRgb( 48, 140, 198 ); + colors.disabledHighlight = rgbGray( 145 ); + colors.shadow = rgbGray( 25 ); + colors.disabledShadow = rgbGray( 36 ); + colors.hightlightedText = colors.text; + colors.link = colors.highlight; + } + else + { + colors.base = White; + colors.background = rgbGray( 239 ); + colors.text = Black; + colors.disabledText = rgbGray( 190 ); + colors.light = White; + colors.midLight = rgbGray( 202 ); + colors.mid = rgbGray( 184 ); + colors.dark = rgbGray( 159 ); + colors.darkDisabled = rgbGray( 190 ); + colors.highlight = qRgb( 48, 140, 198 ); + colors.disabledHighlight = rgbGray( 145 ); + colors.shadow = rgbGray( 118 ); + colors.disabledShadow = rgbGray( 177 ); + colors.hightlightedText = White; + colors.link = Blue; + } + + setColor( P::WindowText, colors.text ); + setColor( P::Button, colors.background ); + + setColor( P::Light, colors.light ); + setColor( P::Midlight, colors.midLight ); + setColor( P::Dark, colors.dark ); + setColor( P::Mid, colors.mid ); + + setColor( P::Text, colors.text ); + setColor( P::BrightText, colors.light ); + setColor( P::ButtonText, colors.text ); + + setColor( P::Base, colors.base ); + setColor( P::Window, colors.background ); + setColor( P::Shadow, colors.shadow ); + setColor( P::AlternateBase, interpolated( colors.base, colors.background, 0.5 ) ); + + setColor( P::Highlight, colors.highlight ); + setColor( P::HighlightedText, colors.hightlightedText ); + + setColor( P::Link, colors.link); + setColor( P::LinkVisited, Magenta ); + + setColor( P::ToolTipBase, qRgb( 255, 255, 220 ) ); + setColor( P::ToolTipText, Black ); + + setColor( P::PlaceholderText, toTransparent( colors.text, 128 ) ); + + // disabled colors + + setColor( P::Disabled, P::Text, colors.disabledText ); + setColor( P::Disabled, P::WindowText, colors.disabledText ); + setColor( P::Disabled, P::ButtonText, colors.disabledText ); + + setColor( P::Disabled, P::Base, colors.background ); + setColor( P::Disabled, P::Dark, colors.darkDisabled ); + setColor( P::Disabled, P::Shadow, colors.disabledShadow ); + + setColor( P::Disabled, P::Highlight, colors.disabledHighlight ); + +#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) + setColor( P::Active, P::Accent, active( P::Highlight ) ); + setColor( P::Disabled, P::Accent, disabled( P::Highlight ) ); +#endif + + initExtraColors(); +} + +QskFusionPalette::QskFusionPalette( const QPalette& palette ) +{ + using P = QPalette; + + for ( int i = 0; i < 2; i++ ) + { + const auto group = static_cast< P::ColorGroup >( i ); + + for ( int j = 0; j < P::NColorRoles; j++ ) + { + const auto role = static_cast< P::ColorRole >( j ); + m_colors[ group ][ role ] = palette.color( group, role ).rgba(); + } + } + + initExtraColors(); +} + +QskFusionPalette::~QskFusionPalette() +{ +} + +void QskFusionPalette::initExtraColors() +{ + using P = QPalette; + + outline = QskRgb::darker( active( P::Window ), 140 ); + + button = active( P::Button ); + + { + auto c = QColor::fromRgba( button ); + const int val = qGray( button ); + c = c.lighter( 100 + qMax( 1, ( 180 - val ) / 6 ) ); + c.setHsv(c.hue(), c.saturation() * 0.75, c.value() ); + + button = c.rgba(); + } + + { + auto c = QColor::fromRgba( button ).toHsv(); + c.setHsv( c.hue(), qMin( 255, (int)( c.saturation() ) ), + qMin( 255, (int)( c.value() * 0.9 ) ) ); + + groove = c.rgba(); + } + + tabFrame = QskRgb::lighter( button, 104 ); + + highlightedOutline = active( QPalette::Highlight ); + + { + highlightedOutline = QskRgb::darker( highlightedOutline, 125 ); + + auto c = QColor::fromRgba( highlightedOutline ); + if ( c.value() > 160 ) + { + c.setHsl(c.hue(), c.saturation(), 160 ); + highlightedOutline = c.rgba(); + } + } + + error = QskRgb::DarkRed; // ???? +} diff --git a/designsystems/fusion/QskFusionPalette.h b/designsystems/fusion/QskFusionPalette.h new file mode 100644 index 00000000..6e03242c --- /dev/null +++ b/designsystems/fusion/QskFusionPalette.h @@ -0,0 +1,90 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#ifndef QSK_FUSION_PALETTE_H +#define QSK_FUSION_PALETTE_H + +#include "QskSkin.h" +#include "QskFusionGlobal.h" +#include "QskRgbValue.h" + +#include + +class QskFusionPalette +{ + public: + QskFusionPalette( QskSkin::ColorScheme = QskSkin::LightScheme ); + QskFusionPalette( const QPalette& ); + + ~QskFusionPalette(); + + QRgb active( QPalette::ColorRole ) const; + QRgb disabled( QPalette::ColorRole ) const; + + QRgb color( QPalette::ColorGroup, QPalette::ColorRole ) const; + + QRgb lighter( QPalette::ColorGroup, QPalette::ColorRole, int factor ) const; + QRgb darker( QPalette::ColorGroup, QPalette::ColorRole, int factor ) const; + + QRgb outline; + QRgb button; + QRgb groove; + QRgb tabFrame; + QRgb highlightedOutline; + QRgb error; + + private: + void initExtraColors(); + + void setColor( QPalette::ColorRole, QRgb ); + void setColor( QPalette::ColorGroup, QPalette::ColorRole, QRgb ); + + QRgb m_colors[ 2 ][ QPalette::NColorRoles ] = { }; +}; + +inline QRgb QskFusionPalette::color( + QPalette::ColorGroup group, QPalette::ColorRole role ) const +{ + Q_ASSERT( group >= 0 && group < 2 ); + return m_colors[group][role]; +} + +inline QRgb QskFusionPalette::lighter( QPalette::ColorGroup group, + QPalette::ColorRole role, int factor ) const +{ + return QskRgb::lighter( color( group, role ), factor ); +} + +inline QRgb QskFusionPalette::darker( QPalette::ColorGroup group, + QPalette::ColorRole role, int factor ) const +{ + return QskRgb::darker( color( group, role ), factor ); +} + +inline QRgb QskFusionPalette::active( QPalette::ColorRole role ) const +{ + return m_colors[ QPalette::Active ][ role ]; +} + +inline QRgb QskFusionPalette::disabled( QPalette::ColorRole role ) const +{ + return m_colors[ QPalette::Disabled ][ role ]; +} + +inline void QskFusionPalette::setColor( + QPalette::ColorRole role, QRgb rgb ) +{ + setColor( QPalette::Active, role, rgb ); + setColor( QPalette::Disabled, role, rgb ); +} + +inline void QskFusionPalette::setColor( + QPalette::ColorGroup group, QPalette::ColorRole role, QRgb rgb ) +{ + Q_ASSERT( group >= 0 && group < 2 ); + m_colors[group][role] = rgb; +} + +#endif diff --git a/designsystems/fusion/QskFusionSkin.cpp b/designsystems/fusion/QskFusionSkin.cpp index fd843172..aa5196bd 100644 --- a/designsystems/fusion/QskFusionSkin.cpp +++ b/designsystems/fusion/QskFusionSkin.cpp @@ -4,6 +4,7 @@ *****************************************************************************/ #include "QskFusionSkin.h" +#include "QskFusionPalette.h" #include @@ -51,22 +52,14 @@ #include #include -#include #include -#include -#include #include #include #include -#include static const int qskDuration = 50; -#if 1 -extern QPalette qt_fusionPalette(); -#endif - namespace { Q_DECL_UNUSED inline double operator ""_dp( long double value ) @@ -79,216 +72,10 @@ namespace return qskDpToPixels( value ); } - inline constexpr QRgb rgbGray( int value ) - { - return qRgb( value, value, value ); - } - - class Palette - { - public: - Palette( QskSkin::ColorScheme colorScheme ) - { - using namespace QskRgb; - using P = QPalette; - - if ( colorScheme == QskSkin::DarkScheme ) - { - const auto text = rgbGray( 240 ); - const auto background = rgbGray( 50 ); - - const auto light = rgbGray( 75 ); - const auto mid = rgbGray( 38 ); - const auto midLight = rgbGray( 42 ); - const auto base = rgbGray( 36 ); - const auto dark = rgbGray( 33 ); - const auto darkDisabled = rgbGray( 190 ); - const auto highlight = qRgb(48, 140, 198); - const auto disabledText = rgbGray( 130 ); - const auto shadow = rgbGray( 25 ); - const auto disabledShadow = rgbGray( 36 ); - const auto disabledHighlight = rgbGray( 145 ); - const auto placeholder = toTransparent( text, 128 ); - - setRgb( P::WindowText, text ); - setRgb( P::Button, background ); - - setRgb( P::Light, light ); - setRgb( P::Midlight, midLight ); - setRgb( P::Dark, dark ); - setRgb( P::Mid, mid ); - - setRgb( P::Text, text ); - setRgb( P::BrightText, light ); - setRgb( P::ButtonText, text ); - - setRgb( P::Base, base ); - setRgb( P::Window, background ); - setRgb( P::Shadow, shadow ); - setRgb( P::AlternateBase, interpolated( base, background, 0.5 ) ); - - setRgb( P::Highlight, highlight ); - setRgb( P::HighlightedText, text ); - - setRgb( P::Link, highlight); - setRgb( P::LinkVisited, Magenta ); - - setRgb( P::ToolTipBase, qRgb( 255, 255, 220 ) ); - setRgb( P::ToolTipText, rgbGray( 0 ) ); - - setRgb( P::PlaceholderText, placeholder ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) - setRgb( P::Accent, highlight ); -#endif - - // disabled colors - - setRgb( P::Disabled, P::Text, disabledText ); - setRgb( P::Disabled, P::WindowText, disabledText ); - setRgb( P::Disabled, P::ButtonText, disabledText ); - setRgb( P::Disabled, P::Base, background ); - setRgb( P::Disabled, P::Dark, darkDisabled ); - setRgb( P::Disabled, P::Shadow, disabledShadow ); - setRgb( P::Disabled, P::Highlight, disabledHighlight ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) - setRgb( P::Disabled, P::Accent, disabledHighlight ); -#endif - } - else - { - const auto text = rgbGray( 0 ); - const auto background = rgbGray( 239 ); - - const auto dark = rgbGray( 159 ); - const auto mid = rgbGray( 184 ); - const auto midLight = rgbGray( 202 ); - const auto light = rgbGray( 255 ); - const auto shadow = rgbGray( 118 ); - - const auto base = rgbGray( 255 ); - const auto darkDisabled = rgbGray( 190 ); - const auto highlight = qRgb(48, 140, 198); - const auto hightlightedText = rgbGray( 255 ); - const auto disabledText = rgbGray( 190 ); - - const auto disabledShadow = rgbGray( 177 ); - const auto disabledHighlight = rgbGray( 145 ); - - setRgb( P::WindowText, text ); - setRgb( P::Button, background ); - - setRgb( P::Light, light ); - setRgb( P::Midlight, midLight ); - setRgb( P::Dark, dark ); - setRgb( P::Mid, mid ); - - setRgb( P::Text, text ); - setRgb( P::BrightText, light ); - setRgb( P::ButtonText, text ); - - setRgb( P::Base, base ); - setRgb( P::Window, background ); - setRgb( P::Shadow, shadow ); - setRgb( P::AlternateBase, interpolated( base, background, 0.5 ) ); - - setRgb( P::Highlight, highlight ); - setRgb( P::HighlightedText, hightlightedText ); - - setRgb( P::Link, Blue ); - setRgb( P::LinkVisited, Magenta ); - - setRgb( P::ToolTipBase, qRgb( 255, 255, 220 ) ); - setRgb( P::ToolTipText, rgbGray( 0 ) ); - - setRgb( P::PlaceholderText, toTransparent( text, 128 ) ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) - setRgb( P::Accent, highlight ); -#endif - - // disabled colors - - setRgb( P::Disabled, P::Text, disabledText ); - setRgb( P::Disabled, P::WindowText, disabledText ); - setRgb( P::Disabled, P::ButtonText, disabledText ); - - setRgb( P::Disabled, P::Base, background ); - setRgb( P::Disabled, P::Dark, darkDisabled ); - setRgb( P::Disabled, P::Shadow, disabledShadow ); - - setRgb( P::Disabled, P::Highlight, disabledHighlight ); -#if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 0 ) - setRgb( P::Disabled, P::Accent, disabledHighlight ); -#endif - } - - outline = QskRgb::darker( rgb( P::Window ), 140 ); - - button = rgb( P::Button ); - - { - auto c = QColor::fromRgba( button ); - const int val = qGray( button ); - c = c.lighter( 100 + qMax( 1, ( 180 - val ) / 6 ) ); - c.setHsv(c.hue(), c.saturation() * 0.75, c.value() ); - - button = c.rgba(); - } - - tabFrame = QskRgb::lighter( button, 104 ); - - highlightedOutline = rgb( QPalette::Highlight ); - - { - highlightedOutline = QskRgb::darker( highlightedOutline, 125 ); - - auto c = QColor::fromRgba( highlightedOutline ); - if ( c.value() > 160 ) - { - c.setHsl(c.hue(), c.saturation(), 160 ); - highlightedOutline = c.rgba(); - } - } - - error = QskRgb::DarkRed; // ???? - } - - QRgb rgb( QPalette::ColorRole role ) const - { - return rgb( QPalette::Normal, role ); - } - - QRgb rgb( QPalette::ColorGroup group, QPalette::ColorRole role ) const - { - Q_ASSERT( group >= 0 && group < 2 ); - return m_colors[group][role]; - } - - QRgb outline; - QRgb button; - QRgb tabFrame; - QRgb highlightedOutline; - QRgb error; - - private: - void setRgb( QPalette::ColorRole role, QRgb rgb ) - { - setRgb( QPalette::Active, role, rgb ); - setRgb( QPalette::Disabled, role, rgb ); - } - - void setRgb( QPalette::ColorGroup group, QPalette::ColorRole role, QRgb rgb ) - { - Q_ASSERT( group >= 0 && group < 2 ); - m_colors[group][role] = rgb; - } - - QRgb m_colors[ 2 ][ QPalette::NColorRoles ] = { }; - }; - class Editor : private QskSkinHintTableEditor { public: - Editor( const Palette& palette, QskSkinHintTable* table ) + Editor( const QskFusionPalette& palette, QskSkinHintTable* table ) : QskSkinHintTableEditor( table ) , m_pal( palette ) { @@ -338,13 +125,6 @@ namespace QskGraphic symbol( const char* name ) const { -#if 0 - const QString path = QStringLiteral( ":fusion/icons/qvg/" ) - + name + QStringLiteral( ".qvg" ); - - return QskGraphicIO::read( path ); -#endif - QskGraphic graphic; if ( strcmp( name, "checkMark" ) == 0 ) @@ -363,7 +143,7 @@ namespace return graphic; } - const Palette& m_pal; + const QskFusionPalette& m_pal; }; } @@ -403,8 +183,10 @@ void Editor::setup() void Editor::setupBox() { using Q = QskBox; + using P = QPalette; - setGradient( Q::Panel, m_pal.rgb( QPalette::Window ) ); + setGradient( Q::Panel, m_pal.active( P::Window ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Window ) ); } void Editor::setupCheckBox() @@ -424,9 +206,9 @@ void Editor::setupCheckBox() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - const auto rgb1 = m_pal.rgb( colorGroup, P::Base ); + const auto rgb1 = m_pal.color( colorGroup, P::Base ); const auto rgb2 = QskRgb::darker( m_pal.button, 110 ); const auto aspect = Q::Box | state; @@ -462,8 +244,8 @@ void Editor::setupCheckBox() } // elide mode ElideRight or mirrored ElideLeft - setColor( Q::Text, m_pal.rgb( P::Normal, P::WindowText ) ); - setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::WindowText ) ); + setColor( Q::Text, m_pal.active( P::WindowText ) ); + setColor( Q::Text | Q::Disabled, m_pal.disabled( P::WindowText ) ); } void Editor::setupComboBox() @@ -477,8 +259,8 @@ void Editor::setupComboBox() setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter ); - setColor( Q::Text, m_pal.rgb( P::Normal, P::ButtonText ) ); - setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::ButtonText ) ); + setColor( Q::Text, m_pal.active( P::ButtonText ) ); + setColor( Q::Text | Q::Disabled, m_pal.disabled( P::ButtonText ) ); setStrutSize( Q::Panel, -1.0, 32_dp ); @@ -492,8 +274,10 @@ void Editor::setupComboBox() // should be similar for QskPushButton auto rgbFill = m_pal.button; - setVGradient( Q::Panel, QskRgb::lighter( rgbFill, 124 ), + setVGradient( Q::Panel, + QskRgb::lighter( rgbFill, 124 ), QskRgb::lighter( rgbFill, 102 ) ); + setGradient( Q::Panel | Q::Pressed, QskRgb::darker( rgbFill, 110 ) ); setStrutSize( Q::Icon, 20_dp, 20_dp ); @@ -524,6 +308,7 @@ void Editor::setupMenu() { using Q = QskMenu; using A = QskAspect; + using P = QPalette; setHint( Q::Overlay | A::Style, true ); setGradient( Q::Overlay, QColor( 220, 220, 220, 100 ) ); @@ -531,15 +316,13 @@ void Editor::setupMenu() setBoxShape( Q::Panel, 4_dp ); setBoxBorderMetrics( Q::Panel, 1_dp ); - auto rgbFill = m_pal.rgb( QPalette::Base ); - rgbFill = QskRgb::lighter( rgbFill, 108 ); + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - setGradient( Q::Panel, rgbFill ); - - auto rgbBorder = m_pal.rgb( QPalette::Window ); - rgbBorder = QskRgb::darker( rgbBorder, 160 ); - - setBoxBorderColors( Q::Panel, rgbBorder ); + setGradient( Q::Panel | state, m_pal.lighter( colorGroup, P::Base, 108 ) ); + setBoxBorderColors( Q::Panel | state, m_pal.darker( colorGroup, P::Window, 160 ) ); + } const bool isCascading = qskMaybeDesktopPlatform(); setHint( Q::Panel | A::Style, isCascading ); @@ -555,10 +338,16 @@ void Editor::setupMenu() setSpacing( Q::Segment, 5 ); setGradient( Q::Segment, Qt::transparent ); - setGradient( Q::Cursor, m_pal.rgb( QPalette::Highlight ) ); + for ( auto state : { A::NoState, Q::Disabled } ) + { + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - setColor( Q::Text, m_pal.rgb( QPalette::Text ) ); - setColor( Q::Text | Q::Selected, m_pal.rgb( QPalette::HighlightedText ) ); + setGradient( Q::Cursor | state, m_pal.color( colorGroup, P::Highlight ) ); + + setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) ); + setColor( Q::Text | state | Q::Selected, + m_pal.color( colorGroup, P::HighlightedText ) ); + } setPadding( Q::Icon, 8_dp ); @@ -585,8 +374,8 @@ void Editor::setupTextLabel() using Q = QskTextLabel; setAlignment( Q::Text, Qt::AlignCenter ); - setColor( Q::Text, m_pal.rgb( QPalette::Active, QPalette::Text ) ); - setColor( Q::Text | Q::Disabled, m_pal.rgb( QPalette::Disabled, QPalette::Text ) ); + setColor( Q::Text, m_pal.color( QPalette::Active, QPalette::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.color( QPalette::Disabled, QPalette::Text ) ); setPadding( Q::Panel, 0 ); setBoxBorderMetrics( Q::Panel, 0 ); @@ -604,15 +393,14 @@ void Editor::setupTextInput() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - setColor( Q::PanelSelected | state, m_pal.rgb( colorGroup, P::Highlight ) ); - setColor( Q::TextSelected | state, m_pal.rgb( colorGroup, P::HighlightedText ) ); + setGradient( Q::Panel | state, m_pal.color( colorGroup, P::Base ) ); + setColor( Q::PanelSelected | state, m_pal.color( colorGroup, P::Highlight ) ); - QRgb rgb = m_pal.rgb( colorGroup, P::Base ); + setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) ); + setColor( Q::TextSelected | state, m_pal.color( colorGroup, P::HighlightedText ) ); - setGradient( Q::Panel | state, rgb ); } setBoxBorderMetrics( Q::Panel, 1_dp ); @@ -639,21 +427,19 @@ void Editor::setupProgressBar() { setBoxBorderColors( Q::Groove, m_pal.outline ); - setGradient( Q::Groove, m_pal.rgb( P::Normal, P::Base ) ); - setGradient( Q::Groove | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + setGradient( Q::Groove, m_pal.active( P::Base ) ); + setGradient( Q::Groove | Q::Disabled, m_pal.disabled( P::Base ) ); } for ( auto state : { A::NoState, Q::Disabled } ) { - using namespace QskRgb; - const auto aspect = Q::Fill | state; - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + const auto rgb = m_pal.color( colorGroup, P::Highlight ); - setBoxBorderColors( aspect, darker( rgb, 140 ) ); - setVGradient( aspect, lighter( rgb, 120 ), rgb ); + setBoxBorderColors( aspect, QskRgb::darker( rgb, 140 ) ); + setVGradient( aspect, QskRgb::lighter( rgb, 120 ), rgb ); } } @@ -673,8 +459,8 @@ void Editor::setupProgressRing() { setColor( Q::Groove | A::Border, m_pal.outline ); - setGradient( Q::Groove, m_pal.rgb( P::Normal, P::Base ) ); - setGradient( Q::Groove | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + setGradient( Q::Groove, m_pal.active( P::Base ) ); + setGradient( Q::Groove | Q::Disabled, m_pal.disabled( P::Base ) ); } { @@ -684,9 +470,9 @@ void Editor::setupProgressRing() for ( auto state : { A::NoState, Q::Disabled } ) { const auto aspect = Q::Fill | state; - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + const auto rgb = m_pal.color( colorGroup, P::Highlight ); setColor( aspect | A::Border, QskRgb::darker( rgb, 140 ) ); setGradient( aspect, rgb ); @@ -713,22 +499,21 @@ void Editor::setupRadioBox() setGradient( Q::Button, QskGradient() ); - setColor( Q::Text, m_pal.rgb( P::Normal, P::Text ) ); - setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::Text ) ); + setColor( Q::Text, m_pal.active( P::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.disabled( P::Text ) ); for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; const auto aspect = Q::CheckIndicatorPanel | state; - const auto rgb1 = m_pal.rgb( colorGroup, P::Base ); - const auto rgb2 = m_pal.rgb( colorGroup, P::WindowText ); - const auto rgb3 = m_pal.rgb( colorGroup, P::Window ); + const auto rgb1 = m_pal.color( colorGroup, P::Base ); + const auto rgb2 = m_pal.color( colorGroup, P::WindowText ); setColor( aspect, rgb1 ); setColor( aspect | Q::Pressed, QskRgb::interpolated( rgb2, rgb1, 0.85 ) ); - setBoxBorderColors( aspect, QskRgb::darker( rgb3, 150 ) ); + setBoxBorderColors( aspect, m_pal.darker( colorGroup, P::Window, 150 ) ); } setBoxBorderMetrics( Q::CheckIndicator, 1 ); @@ -737,10 +522,9 @@ void Editor::setupRadioBox() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - auto rgb = m_pal.rgb( colorGroup, P::Text ); - rgb = QskRgb::darker( rgb, 120 ); + auto rgb = m_pal.darker( colorGroup, P::Text, 120 ); const auto aspect = Q::CheckIndicator | Q::Selected | state; @@ -758,25 +542,14 @@ void Editor::setupFocusIndicator() */ using Q = QskFocusIndicator; using A = QskAspect; - using P = QPalette; setBoxBorderMetrics( Q::Panel, 2 ); setPadding( Q::Panel, 3 ); setBoxShape( Q::Panel, 4 ); - auto rgb = m_pal.rgb( P::Highlight ); - rgb = QskRgb::darker( rgb, 125 ); - - { - auto c = QColor::fromRgba( rgb ).toHsv(); - if ( c.value() > 160 ) - c.setHsl( c.hue(), c.saturation(), 160 ); - - rgb = c.rgba(); - } - - setBoxBorderColors( Q::Panel, rgb ); - setBoxBorderColors( Q::Panel | Q::Disabled, QskRgb::toTransparent( rgb, 0 ) ); + setBoxBorderColors( Q::Panel, m_pal.highlightedOutline ); + setBoxBorderColors( Q::Panel | Q::Disabled, + QskRgb::toTransparent( m_pal.highlightedOutline, 0 ) ); setAnimation( Q::Panel | A::Color, 200 ); setAnimation( Q::Panel | A::Color | Q::Disabled, 500 ); @@ -802,8 +575,8 @@ void Editor::setupSegmentedBar() setPadding( Q::Panel, 0 ); setSpacing( Q::Panel, 5_dp ); - setGradient( Q::Panel, m_pal.rgb( P::Normal, P::Base ) ); - setGradient( Q::Panel | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + setGradient( Q::Panel, m_pal.active( P::Base ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Base ) ); setBoxBorderMetrics( Q::Panel, 1_dp ); setBoxBorderColors( Q::Panel, m_pal.outline ); @@ -825,8 +598,9 @@ void Editor::setupSegmentedBar() // Cursor setBoxBorderColors( Q::Cursor, m_pal.outline ); - setGradient( Q::Cursor, m_pal.rgb( P::Normal, P::Highlight ) ); - setGradient( Q::Cursor | Q::Disabled, m_pal.rgb( P::Disabled, P::Highlight ) ); + setGradient( Q::Cursor, m_pal.active( P::Highlight ) ); + setGradient( Q::Cursor | Q::Disabled, m_pal.disabled( P::Highlight ) ); + setAnimation( Q::Cursor | A::Metric | A::Position, duration ); } @@ -837,12 +611,12 @@ void Editor::setupSegmentedBar() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; const auto aspect = Q::Text | state; - setColor( aspect, m_pal.rgb( colorGroup, P::Text ) ); - setColor( aspect | Q::Selected, m_pal.rgb( colorGroup, P::HighlightedText ) ); + setColor( aspect, m_pal.color( colorGroup, P::Text ) ); + setColor( aspect | Q::Selected, m_pal.color( colorGroup, P::HighlightedText ) ); } setAnimation( Q::Text | A::Color, duration ); @@ -887,8 +661,8 @@ void Editor::setupPageIndicator() { using namespace QskRgb; - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - auto rgb = m_pal.rgb( colorGroup, P::Shadow ); + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; + auto rgb = m_pal.color( colorGroup, P::Shadow ); const auto aspect = Q::Bullet | state; setGradient( aspect, toTransparentF( rgb, 0.45 ) ); @@ -920,17 +694,16 @@ void Editor::setupPushButton() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - auto rgb = m_pal.rgb( colorGroup, P::Button ); - rgb = QskRgb::lighter( rgb, 104 ); + const auto rgb = m_pal.lighter( colorGroup, P::Button, 104 ); setGradient( Q::Panel | state, rgb ); for ( auto state2 : { Q::Pressed, Q::Checked } ) setGradient( Q::Panel | state | state2, QskRgb::darker( rgb, 110 ) ); - setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); + setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) ); } setGraphicRole( Q::Icon, QskFusionSkin::GraphicNormal ); @@ -942,18 +715,14 @@ void Editor::setupPushButton() void Editor::setupDialogButtonBox() { using Q = QskDialogButtonBox; - using A = QskAspect; using P = QPalette; setBoxShape( Q::Panel, 0 ); setBoxBorderMetrics( Q::Panel, 0 ); setPadding( Q::Panel, 2_dp, 4_dp, 2_dp, 0_dp ); - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - setGradient( Q::Panel, m_pal.rgb( colorGroup, P::Base ) ); - } + setGradient( Q::Panel, m_pal.active( P::Base ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Base ) ); } void Editor::setupDrawer() @@ -962,11 +731,8 @@ void Editor::setupDrawer() using A = QskAspect; using P = QPalette; - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); - } + setGradient( Q::Panel, m_pal.active( P::Window ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Window ) ); setBoxBorderMetrics( Q::Panel, 1 ); setBoxShape( Q::Panel, 2 ); @@ -1007,25 +773,17 @@ void Editor::setupSlider() { setBoxBorderColors( Q::Groove, m_pal.outline ); - - auto rgb = m_pal.button; - - auto c = QColor::fromRgba( rgb ).toHsv(); - c.setHsv( c.hue(), qMin( 255, (int)( c.saturation() ) ), - qMin( 255, (int)( c.value() * 0.9 ) ) ); - - rgb = c.rgba(); - - setGradient( Q::Groove, QskRgb::darker( rgb, 110 ), - QskRgb::lighter( rgb, 110 ) ); + setGradient( Q::Groove, + QskRgb::darker( m_pal.groove, 110 ), + QskRgb::lighter( m_pal.groove, 110 ) ); } { for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - const auto rgb = m_pal.rgb( colorGroup, P::Highlight ); + const auto rgb = m_pal.color( colorGroup, P::Highlight ); setGradient( Q::Fill | state, rgb ); @@ -1045,13 +803,13 @@ void Editor::setupSlider() for ( auto state : { A::NoState, Q::Pressed } ) { - using namespace QskRgb; - auto rgb = m_pal.button; if ( state == Q::Pressed ) - rgb = darker( rgb, 110 ); + rgb = QskRgb::darker( rgb, 110 ); - setGradient( Q::Handle | state, lighter( rgb, 124 ), lighter( rgb, 102 ) ); + setGradient( Q::Handle | state, + QskRgb::lighter( rgb, 124 ), + QskRgb::lighter( rgb, 102 ) ); } // move the handle smoothly, when using keys @@ -1074,13 +832,8 @@ void Editor::setupSpinBox() setPadding( Q::TextPanel, 5_dp ); setBoxShape( Q::TextPanel, 2, 0, 2, 0 ); - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - - setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); - setGradient( Q::TextPanel | state, m_pal.rgb( colorGroup, P::Base ) ); - } + setColor( Q::Text, m_pal.active( P::Text ) ); + setGradient( Q::TextPanel | Q::Disabled, m_pal.disabled( P::Base ) ); setBoxBorderMetrics( Q::TextPanel, 1_dp ); setBoxBorderColors( Q::TextPanel, m_pal.outline ); @@ -1151,23 +904,19 @@ void Editor::setupSwitchButton() // on/off is indicated by the position of the handle and the groove color + setGradient( Q::Groove, + QskRgb::darker( m_pal.groove, 110 ), + QskRgb::lighter( m_pal.groove, 110 ) ); + + for( auto state : { A::NoState, Q::Disabled } ) { - auto rgb = m_pal.button; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - { - auto c = QColor::fromRgba( rgb ).toHsv(); - c.setHsv( c.hue(), qMin( 255, c.saturation() ), qMin< int >( 255, c.value() * 0.9 ) ); - rgb = c.rgba(); - } - - setGradient( Q::Groove, - QskRgb::darker( rgb, 110 ), QskRgb::lighter( rgb, 110 ) ); + const auto rgb = m_pal.color( colorGroup, P::Highlight ); + setGradient( Q::Groove | state | Q::Checked, + rgb, QskRgb::lighter( rgb, 120 ) ); } - const auto highlightRgb = m_pal.rgb( P::Highlight ); - setGradient( Q::Groove | Q::Checked, - highlightRgb, QskRgb::lighter( highlightRgb, 120 ) ); - setBoxBorderColors( Q::Groove, m_pal.outline ); setGradient( Q::Handle, QskRgb::lighter( m_pal.button, 104 ) ); @@ -1193,7 +942,8 @@ void Editor::setupTabButton() setStrutSize( Q::Panel, 30_dp, 16_dp ); - setColor( Q::Text, m_pal.rgb( P::Text ) ); + setColor( Q::Text, m_pal.active( P::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.disabled( P::Text ) ); { QskGradient g; @@ -1288,8 +1038,8 @@ void Editor::setupTabButton() // text setAlignment( Q::Text, Qt::AlignCenter ); - setColor( Q::Text, m_pal.rgb( P::Active, P::Text ) ); - setColor( Q::Text | Q::Disabled, m_pal.rgb( P::Disabled, P::Text ) ); + setColor( Q::Text, m_pal.active( P::Text ) ); + setColor( Q::Text | Q::Disabled, m_pal.disabled( P::Text ) ); } void Editor::setupTabBar() @@ -1325,7 +1075,6 @@ void Editor::setupTabView() void Editor::setupInputPanel() { using Q = QskInputPanelBox; - using A = QskAspect; using P = QPalette; setPadding( Q::Panel, 5 ); @@ -1334,11 +1083,8 @@ void Editor::setupInputPanel() setBoxShape( Q::Panel, 2 ); setBoxBorderColors( Q::Panel, m_pal.outline ); - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); - } + setGradient( Q::Panel, m_pal.active( P::Window ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Window ) ); } void Editor::setupVirtualKeyboard() @@ -1362,16 +1108,16 @@ void Editor::setupVirtualKeyboard() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - auto rgb = m_pal.rgb( colorGroup, P::Button ); + auto rgb = m_pal.color( colorGroup, P::Button ); rgb = QskRgb::lighter( rgb, 104 ); setGradient( Q::ButtonPanel | state, rgb ); setGradient( Q::ButtonPanel | state | QskPushButton::Pressed, QskRgb::darker( rgb, 110 ) ); - setColor( Q::ButtonText | state, m_pal.rgb( colorGroup, QPalette::Text ) ); + setColor( Q::ButtonText | state, m_pal.color( colorGroup, QPalette::Text ) ); } setAnimation( Q::ButtonPanel | A::Color, 100 ); @@ -1392,8 +1138,8 @@ void Editor::setupScrollView() setBoxBorderColors( Q::Viewport, m_pal.outline ); setBoxShape( Q::Viewport, 2 ); - setGradient( Q::Viewport, m_pal.rgb( P::Normal, P::Base ) ); - setGradient( Q::Viewport | Q::Disabled, m_pal.rgb( P::Disabled, P::Base ) ); + setGradient( Q::Viewport, m_pal.active( P::Base ) ); + setGradient( Q::Viewport | Q::Disabled, m_pal.disabled( P::Base ) ); // scrollbars @@ -1432,9 +1178,9 @@ void Editor::setupScrollView() else setStrutSize( subControl, 0.0, handleExtent ); - setGradient( subControl, m_pal.rgb( P::Mid ) ); - setGradient( subControl | Q::Hovered, m_pal.rgb( P::Mid ) ); - setGradient( subControl | Q::Pressed, m_pal.rgb( P::Dark ) ); + setGradient( subControl, m_pal.active( P::Mid ) ); + setGradient( subControl | Q::Hovered, m_pal.active( P::Mid ) ); + setGradient( subControl | Q::Pressed, m_pal.active( P::Dark ) ); setAnimation( subControl | A::Color, 100 ); } @@ -1454,20 +1200,20 @@ void Editor::setupListView() for ( auto state : { A::NoState, Q::Disabled } ) { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; + const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; - setColor( Q::Text | state, m_pal.rgb( colorGroup, P::Text ) ); - setColor( Q::Cell | state, m_pal.rgb( colorGroup, P::Base ) ); - - const auto rgb1 = m_pal.rgb( colorGroup, P::Highlight ); - const auto rgb2 = m_pal.rgb( colorGroup, P::HighlightedText ); + setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) ); + setColor( Q::Cell | state, m_pal.color( colorGroup, P::Base ) ); const auto state1 = state | Q::Selected; for ( auto state2 : { A::NoState, Q::Hovered, Q::Pressed } ) { - setColor( Q::Cell | state1 | state2, rgb1 ); - setColor( Q::Text | state1 | state2, rgb2 ); + setColor( Q::Cell | state1 | state2, + m_pal.color( colorGroup, P::Highlight ) ); + + setColor( Q::Text | state1 | state2, + m_pal.color( colorGroup, P::HighlightedText ) ); } } } @@ -1486,19 +1232,16 @@ void Editor::setupSubWindow() setBoxBorderColors( Q::Panel, m_pal.outline ); - for ( auto state : { A::NoState, Q::Disabled } ) - { - const auto colorGroup = ( state == A::NoState ) ? P::Normal : P::Disabled; - setGradient( Q::Panel | state, m_pal.rgb( colorGroup, P::Window ) ); - } + setGradient( Q::Panel, m_pal.active( P::Window ) ); + setGradient( Q::Panel | Q::Disabled, m_pal.disabled( P::Window ) ); // TitleBarPanel setHint( Q::TitleBarPanel | QskAspect::Style, Q::TitleBar | Q::Title ); setMargin( Q::TitleBarPanel, -1 ); - setGradient( Q::TitleBarPanel, m_pal.rgb( P::Mid ) ); - setGradient( Q::TitleBarPanel | Q::Focused, m_pal.rgb( P::Highlight ) ); + setGradient( Q::TitleBarPanel, m_pal.active( P::Mid ) ); + setGradient( Q::TitleBarPanel | Q::Focused, m_pal.active( P::Highlight ) ); setSpacing( Q::TitleBarPanel, 5 ); setStrutSize( Q::TitleBarPanel, 0, 20 ); setBoxShape( Q::TitleBarPanel, 2, 2, 0, 0 ); @@ -1508,8 +1251,8 @@ void Editor::setupSubWindow() setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter ); setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap ); - setColor( Q::TitleBarText | Q::Focused, m_pal.rgb( P::Normal, P::HighlightedText ) ); - setColor( Q::TitleBarText, m_pal.rgb( P::Normal, P::Text ) ); + setColor( Q::TitleBarText, m_pal.active( P::Text ) ); + setColor( Q::TitleBarText | Q::Focused, m_pal.active( P::HighlightedText ) ); #if 1 for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } ) @@ -1522,18 +1265,17 @@ void Editor::setupSubWindow() QskFusionSkin::QskFusionSkin( QskSkin::ColorScheme colorScheme, QObject* parent ) : Inherited( parent ) { + using P = QPalette; + setupFonts( QStringLiteral( "Roboto" ) ); - const Palette palette( colorScheme ); + const QskFusionPalette palette( colorScheme ); - setGraphicColor( GraphicNormal, - palette.rgb( QPalette::Active, QPalette::Text ) ); - - setGraphicColor( GraphicDisabled, - palette.rgb( QPalette::Disabled, QPalette::Text ) ); + setGraphicColor( GraphicNormal, palette.active( P::Text ) ); + setGraphicColor( GraphicDisabled, palette.disabled( P::Text ) ); setGraphicColor( GraphicError, palette.error ); - setGraphicColor( GraphicHighlighted, palette.rgb( QPalette::HighlightedText ) ); + setGraphicColor( GraphicHighlighted, palette.active( P::HighlightedText ) ); Editor editor( palette, &hintTable() ); editor.setup(); diff --git a/designsystems/fusion/icons.qrc b/designsystems/fusion/icons.qrc deleted file mode 100644 index 721eef43..00000000 --- a/designsystems/fusion/icons.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - icons/qvg/check_small.qvg - icons/qvg/combo-box-arrow-closed.qvg - icons/qvg/combo-box-arrow-open.qvg - icons/qvg/segmented-button-check.qvg - - diff --git a/designsystems/fusion/icons/check_small.svg b/designsystems/fusion/icons/check_small.svg deleted file mode 100644 index e7a84071..00000000 --- a/designsystems/fusion/icons/check_small.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/designsystems/fusion/icons/combo-box-arrow-closed.svg b/designsystems/fusion/icons/combo-box-arrow-closed.svg deleted file mode 100644 index c288b426..00000000 --- a/designsystems/fusion/icons/combo-box-arrow-closed.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/designsystems/fusion/icons/combo-box-arrow-open.svg b/designsystems/fusion/icons/combo-box-arrow-open.svg deleted file mode 100644 index 4138c2cd..00000000 --- a/designsystems/fusion/icons/combo-box-arrow-open.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/designsystems/fusion/icons/qvg/check_small.qvg b/designsystems/fusion/icons/qvg/check_small.qvg deleted file mode 100644 index ea738b8639303983a6c47ec95103ead792067a09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 575 zcmWFx_I77rU|?ouVrB?nu>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3V%%2LXt64oYW0;4F~G2oYgma1fmd0<%D3_TSRL0Hz)!24g!&LFB+WadGXpH9 j0pY>S0E=PT3sS@g3gSyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3Xf!2>S~l5=cJ)Qy_xTK>)&b5JVD_hp>^=VbKdx#0UzjKzO*&!V3-%$Dolkh!mg= FOaM(JA&39~ diff --git a/designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg b/designsystems/fusion/icons/qvg/combo-box-arrow-open.qvg deleted file mode 100644 index 6ddcf6c00d3f7e4ae3978638ecbf65d960462dd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 659 zcmWFx_I77rU|?oua%Ko%u>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRMf;(i zK(+_OZh#7)%R4AQBpgH_G|a(39y>^c1w`0i0FglY0hj_2j1B@2wu2y&m^_4ytPYD_ hkRnDsi diff --git a/designsystems/fusion/icons/qvg/segmented-button-check.qvg b/designsystems/fusion/icons/qvg/segmented-button-check.qvg deleted file mode 100644 index fa0e1ce2b2e02e7cf03098703b1b56b2f3e179c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 575 zcmWFx_I77rU|?ouVrB?nu>SyL0|6uB|Njsc16&NoN2g(W(8XbVn7ji_0GXzRML_e} zL3V%%2Z8@`eF+W44hoLupL;^gf#QtzA3xcgxTkg4LHPfJuJ@Z(gT>bT|F7wgt>qwL zb@0;M<7yx=xL%d|Pfz-~iojx8^ - - - From 63cb58ef4aadf57be3a393a8f9630c61691f29e9 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 19 Jan 2024 09:05:43 +0100 Subject: [PATCH 14/27] Build for WebAssembly including building everything statically etc. Resolves #372 --- cmake/QskBuildFunctions.cmake | 18 +++++++++++++++--- qmlexport/CMakeLists.txt | 7 ++++++- src/CMakeLists.txt | 17 ++++++++++------- src/common/QskMetaFunction.cpp | 11 ++++++++--- src/common/QskMetaInvokable.cpp | 20 +++++++++++++------- src/nodes/QskTreeNode.cpp | 2 +- 6 files changed, 53 insertions(+), 22 deletions(-) diff --git a/cmake/QskBuildFunctions.cmake b/cmake/QskBuildFunctions.cmake index ca679293..ebc20a23 100644 --- a/cmake/QskBuildFunctions.cmake +++ b/cmake/QskBuildFunctions.cmake @@ -47,10 +47,16 @@ function(qsk_add_plugin target TYPE CLASS_NAME) # So for the moment better don't do: # qt6_add_plugin(${target} SHARED ${CLASS_NAME} ) - if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) - qt6_add_library(${target} SHARED ) + if(BUILD_QSKDLL) + set(library_type SHARED) else() - add_library(${target} SHARED ) + set(library_type STATIC) + endif() + + if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + qt6_add_library(${target} ${library_type}) + else() + add_library(${target} ${library_type}) endif() set_target_properties(${target} PROPERTIES @@ -118,4 +124,10 @@ function(qsk_add_shaders target) qt6_add_shaders( ${target} "qskshaders" BATCHABLE PRECOMPILE QUIET PREFIX "/qskinny/shaders" ${ARGV} OUTPUTS ${outfiles} ) + # pass on OUTPUT_TARGETS to the caller of this function + cmake_parse_arguments(PARSE_ARGV 1 arg "" "OUTPUT_TARGETS" "") + if (arg_OUTPUT_TARGETS) + set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE) + endif() + endfunction() diff --git a/qmlexport/CMakeLists.txt b/qmlexport/CMakeLists.txt index e1b78483..f0ea7541 100644 --- a/qmlexport/CMakeLists.txt +++ b/qmlexport/CMakeLists.txt @@ -17,7 +17,12 @@ set(SOURCES QskQml.cpp) set(target qskqmlexport) -qsk_add_library(${target} SHARED ${SOURCES} ${HEADERS}) + +if(BUILD_QSKDLL) + qsk_add_library(${target} SHARED ${SOURCES} ${HEADERS}) +else() + qsk_add_library(${target} STATIC ${SOURCES} ${HEADERS}) +endif() target_link_libraries(${target} PRIVATE qskinny) target_include_directories(${target} PUBLIC diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87f89b12..29aca47d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -482,17 +482,14 @@ set(target qskinny) if(BUILD_QSKDLL) qsk_add_library(${target} SHARED ${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}) + target_compile_definitions(${target} PUBLIC QSK_DLL ) + set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_MAKEDLL) else() qsk_add_library(${target} STATIC ${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}) endif() -if(BUILD_QSKDLL) - target_compile_definitions(${target} PUBLIC QSK_DLL ) - set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_MAKEDLL) -endif() - if (QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) - qsk_add_shaders( ${target} FILES ${SHADERS} ) + qsk_add_shaders( ${target} FILES ${SHADERS} OUTPUT_TARGETS shader_target) endif() target_include_directories(${target} PUBLIC @@ -542,8 +539,14 @@ set_target_properties(${target} PROPERTIES # packaging set(PACKAGE_NAME ${PROJECT_NAME}) +set(exported_targets ${target}) +if(NOT BUILD_QSKDLL) + list(APPEND exported_targets ${shader_target}) +endif() + + # setup destination file paths for qskinny target -install(TARGETS ${target} EXPORT ${PACKAGE_NAME}Targets +install(TARGETS ${exported_targets} EXPORT ${PACKAGE_NAME}Targets LIBRARY DESTINATION ${QSK_INSTALL_LIBS} ARCHIVE DESTINATION ${QSK_INSTALL_LIBS} RUNTIME DESTINATION ${QSK_INSTALL_LIBS} diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 9b3bea0d..45f7e7cb 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -7,7 +7,9 @@ #include #include +#if QT_CONFIG(thread) #include +#endif #include QSK_QT_PRIVATE_BEGIN @@ -188,6 +190,8 @@ void QskMetaFunction::invoke( QObject* object, ? Qt::QueuedConnection : Qt::DirectConnection; } + const auto argc = parameterCount() + 1; // return value + arguments + switch ( invokeType ) { case Qt::DirectConnection: @@ -206,10 +210,13 @@ void QskMetaFunction::invoke( QObject* object, #if QT_CONFIG(thread) QSemaphore semaphore; -#endif auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argv, &semaphore ); +#else + auto event = new QMetaCallEvent( + m_functionCall, nullptr, 0, argc ); +#endif QCoreApplication::postEvent( receiver, event ); @@ -224,8 +231,6 @@ void QskMetaFunction::invoke( QObject* object, if ( receiver.isNull() ) return; - const auto argc = parameterCount() + 1; // return value + arguments - auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argc ); auto types = event->types(); diff --git a/src/common/QskMetaInvokable.cpp b/src/common/QskMetaInvokable.cpp index 64c118f0..27828c3b 100644 --- a/src/common/QskMetaInvokable.cpp +++ b/src/common/QskMetaInvokable.cpp @@ -9,7 +9,9 @@ #include #include #include +#if QT_CONFIG(thread) #include +#endif #include QSK_QT_PRIVATE_BEGIN @@ -163,6 +165,12 @@ static void qskInvokeMetaCall( ? Qt::QueuedConnection : Qt::DirectConnection; } +#if 1 + // should be doable without QMetaMethod. TODO ... + const auto method = metaObject->method( offset + index ); +#endif + const int argc = method.parameterCount() + 1; + switch ( invokeType ) { case Qt::DirectConnection: @@ -194,11 +202,15 @@ static void qskInvokeMetaCall( #if QT_CONFIG(thread) QSemaphore semaphore; -#endif auto event = new MetaCallEvent( call, metaObject, offset, index, args, &semaphore ); +#else + auto event = new MetaCallEvent( call, metaObject, + offset, index, argc ); +#endif + QCoreApplication::postEvent( receiver, event ); #if QT_CONFIG(thread) @@ -216,12 +228,6 @@ static void qskInvokeMetaCall( if ( call == QMetaObject::InvokeMetaMethod ) { -#if 1 - // should be doable without QMetaMethod. TODO ... - const auto method = metaObject->method( offset + index ); -#endif - const int argc = method.parameterCount() + 1; - event = new MetaCallEvent( call, metaObject, offset, index, argc ); /* diff --git a/src/nodes/QskTreeNode.cpp b/src/nodes/QskTreeNode.cpp index a3f70f23..82f4c5eb 100644 --- a/src/nodes/QskTreeNode.cpp +++ b/src/nodes/QskTreeNode.cpp @@ -5,7 +5,7 @@ #include "QskTreeNode.h" -static constexpr auto extraFlag = +static const auto extraFlag = static_cast< QSGNode::Flag >( QSGNode::IsVisitableNode << 1 ); static inline QSGNode* qskCheckedNode( const QSGNode* node, QSGNode::NodeType type ) From 7ab5c50b3d9666f184e95ef1aa24fa3b81188896 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 29 Jan 2024 12:21:46 +0100 Subject: [PATCH 15/27] using nullptr for QSemaphore instead of a different call --- src/common/QskMetaFunction.cpp | 8 +++----- src/common/QskMetaInvokable.cpp | 16 +++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 45f7e7cb..8ad62073 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -7,9 +7,7 @@ #include #include -#if QT_CONFIG(thread) #include -#endif #include QSK_QT_PRIVATE_BEGIN @@ -190,8 +188,6 @@ void QskMetaFunction::invoke( QObject* object, ? Qt::QueuedConnection : Qt::DirectConnection; } - const auto argc = parameterCount() + 1; // return value + arguments - switch ( invokeType ) { case Qt::DirectConnection: @@ -215,7 +211,7 @@ void QskMetaFunction::invoke( QObject* object, m_functionCall, nullptr, 0, argv, &semaphore ); #else auto event = new QMetaCallEvent( - m_functionCall, nullptr, 0, argc ); + m_functionCall, nullptr, 0, argv, nullptr ); #endif QCoreApplication::postEvent( receiver, event ); @@ -231,6 +227,8 @@ void QskMetaFunction::invoke( QObject* object, if ( receiver.isNull() ) return; + const auto argc = parameterCount() + 1; // return value + arguments + auto event = new QMetaCallEvent( m_functionCall, nullptr, 0, argc ); auto types = event->types(); diff --git a/src/common/QskMetaInvokable.cpp b/src/common/QskMetaInvokable.cpp index 27828c3b..cc372bbc 100644 --- a/src/common/QskMetaInvokable.cpp +++ b/src/common/QskMetaInvokable.cpp @@ -9,9 +9,7 @@ #include #include #include -#if QT_CONFIG(thread) #include -#endif #include QSK_QT_PRIVATE_BEGIN @@ -165,12 +163,6 @@ static void qskInvokeMetaCall( ? Qt::QueuedConnection : Qt::DirectConnection; } -#if 1 - // should be doable without QMetaMethod. TODO ... - const auto method = metaObject->method( offset + index ); -#endif - const int argc = method.parameterCount() + 1; - switch ( invokeType ) { case Qt::DirectConnection: @@ -208,7 +200,7 @@ static void qskInvokeMetaCall( #else auto event = new MetaCallEvent( call, metaObject, - offset, index, argc ); + offset, index, args, nullptr ); #endif QCoreApplication::postEvent( receiver, event ); @@ -228,6 +220,12 @@ static void qskInvokeMetaCall( if ( call == QMetaObject::InvokeMetaMethod ) { +#if 1 + // should be doable without QMetaMethod. TODO ... + const auto method = metaObject->method( offset + index ); +#endif + const int argc = method.parameterCount() + 1; + event = new MetaCallEvent( call, metaObject, offset, index, argc ); /* From 4a628bd72d786a97c707f51baa7b1095d9923f4d Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 29 Jan 2024 12:42:30 +0100 Subject: [PATCH 16/27] QskFusionSkin focus settings + using Qt's metaobject system to avoid some boilerplate code --- designsystems/fusion/QskFusionSkin.cpp | 181 +++++++++++-------- designsystems/material3/QskMaterial3Skin.cpp | 97 ++++------ 2 files changed, 144 insertions(+), 134 deletions(-) diff --git a/designsystems/fusion/QskFusionSkin.cpp b/designsystems/fusion/QskFusionSkin.cpp index aa5196bd..d356e59d 100644 --- a/designsystems/fusion/QskFusionSkin.cpp +++ b/designsystems/fusion/QskFusionSkin.cpp @@ -60,8 +60,24 @@ static const int qskDuration = 50; +/* + QskFocusIndicator has this nice autohide concept, that supersedes + the Qt/Quick visualFocus. How to do the same with the built-in focus + indication of the skins. TODO ... + */ +// #define SHOW_FOCUS + namespace { + class Combination : public QskStateCombination + { + public: + constexpr Combination( const QskAspect::States states ) + : QskStateCombination( CombinationNoState, states ) + { + } + }; + Q_DECL_UNUSED inline double operator ""_dp( long double value ) { return qskDpToPixels( static_cast< qreal >( value ) ); @@ -74,54 +90,51 @@ namespace class Editor : private QskSkinHintTableEditor { + Q_GADGET + public: Editor( const QskFusionPalette& palette, QskSkinHintTable* table ) : QskSkinHintTableEditor( table ) , m_pal( palette ) { -#if 0 - for ( int i = 0; i < QPalette::NColorRoles; i++ ) - { - const auto role = static_cast< QPalette::ColorRole >( i ); - const auto rgb = m_pal.rgb( QPalette::Active, role ); - - qDebug() << role << qRed( rgb ) << qGreen( rgb ) << qBlue( rgb ); - } -#endif } - void setup(); + void setup() + { + for ( int i = 0; i < staticMetaObject.methodCount(); i++ ) + staticMetaObject.method( i ).invokeOnGadget( this ); + } private: - void setupBox(); - void setupCheckBox(); - void setupComboBox(); - void setupDialogButtonBox(); - void setupDrawer(); - void setupFocusIndicator(); - void setupGraphicLabel(); - void setupInputPanel(); - void setupVirtualKeyboard(); - void setupListView(); - void setupMenu(); - void setupPageIndicator(); - void setupPopup(); - void setupProgressBar(); - void setupProgressRing(); - void setupRadioBox(); - void setupPushButton(); - void setupScrollView(); - void setupSegmentedBar(); - void setupSeparator(); - void setupSubWindow(); - void setupSlider(); - void setupSpinBox(); - void setupSwitchButton(); - void setupTabButton(); - void setupTabBar(); - void setupTabView(); - void setupTextInput(); - void setupTextLabel(); + Q_INVOKABLE void setupBox(); + Q_INVOKABLE void setupCheckBox(); + Q_INVOKABLE void setupComboBox(); + Q_INVOKABLE void setupDialogButtonBox(); + Q_INVOKABLE void setupDrawer(); + Q_INVOKABLE void setupFocusIndicator(); + Q_INVOKABLE void setupGraphicLabel(); + Q_INVOKABLE void setupInputPanel(); + Q_INVOKABLE void setupVirtualKeyboard(); + Q_INVOKABLE void setupListView(); + Q_INVOKABLE void setupMenu(); + Q_INVOKABLE void setupPageIndicator(); + Q_INVOKABLE void setupPopup(); + Q_INVOKABLE void setupProgressBar(); + Q_INVOKABLE void setupProgressRing(); + Q_INVOKABLE void setupRadioBox(); + Q_INVOKABLE void setupPushButton(); + Q_INVOKABLE void setupScrollView(); + Q_INVOKABLE void setupSegmentedBar(); + Q_INVOKABLE void setupSeparator(); + Q_INVOKABLE void setupSubWindow(); + Q_INVOKABLE void setupSlider(); + Q_INVOKABLE void setupSpinBox(); + Q_INVOKABLE void setupSwitchButton(); + Q_INVOKABLE void setupTabButton(); + Q_INVOKABLE void setupTabBar(); + Q_INVOKABLE void setupTabView(); + Q_INVOKABLE void setupTextInput(); + Q_INVOKABLE void setupTextLabel(); QskGraphic symbol( const char* name ) const { @@ -147,39 +160,6 @@ namespace }; } -void Editor::setup() -{ - setupBox(); - setupCheckBox(); - setupComboBox(); - setupDialogButtonBox(); - setupDrawer(); - setupFocusIndicator(); - setupGraphicLabel(); - setupInputPanel(); - setupVirtualKeyboard(); - setupListView(); - setupMenu(); - setupPageIndicator(); - setupPopup(); - setupProgressBar(); - setupProgressRing(); - setupPushButton(); - setupRadioBox(); - setupScrollView(); - setupSegmentedBar(); - setupSeparator(); - setupSlider(); - setupSpinBox(); - setupSubWindow(); - setupSwitchButton(); - setupTabButton(); - setupTabBar(); - setupTabView(); - setupTextLabel(); - setupTextInput(); -} - void Editor::setupBox() { using Q = QskBox; @@ -204,6 +184,11 @@ void Editor::setupCheckBox() setBoxBorderColors( Q::Box | Q::Error, m_pal.error ); setBoxBorderMetrics( Q::Box, 1_dp ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Box | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Error, Q::Hovered, Q::Pressed, Q::Checked } ) ); +#endif + for ( auto state : { A::NoState, Q::Disabled } ) { const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; @@ -268,6 +253,11 @@ void Editor::setupComboBox() setBoxBorderMetrics( Q::Panel, 1_dp ); setBoxBorderColors( Q::Panel, m_pal.outline ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed } ) ); +#endif + setPadding( Q::Panel, 8_dp, 4_dp, 8_dp, 4_dp ); setSpacing( Q::Panel, 8_dp ); @@ -404,7 +394,12 @@ void Editor::setupTextInput() } setBoxBorderMetrics( Q::Panel, 1_dp ); + setBoxBorderColors( Q::Panel, m_pal.outline ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline ); +#endif + setBoxShape( Q::Panel, 2 ); setPadding( Q::Panel, 4_dp ); } @@ -516,6 +511,11 @@ void Editor::setupRadioBox() setBoxBorderColors( aspect, m_pal.darker( colorGroup, P::Window, 150 ) ); } +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::CheckIndicatorPanel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed, Q::Selected } ) ); +#endif + setBoxBorderMetrics( Q::CheckIndicator, 1 ); setBoxBorderColors( Q::CheckIndicator, QskRgb::Transparent ); setColor( Q::CheckIndicator, Qt::transparent); @@ -679,6 +679,10 @@ void Editor::setupPageIndicator() void Editor::setupPushButton() { + /* + QC2/Fusion offers flat/highlighted. We could the emphasis variations to + have the same: TODO ... + */ using Q = QskPushButton; using A = QskAspect; using P = QPalette; @@ -689,6 +693,12 @@ void Editor::setupPushButton() setMetric( Q::Panel | A::Spacing, 4 ); setBoxBorderColors( Q::Panel, m_pal.outline ); + +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed, Q::Checked } ) ); +#endif + setBoxBorderMetrics( Q::Panel, 1 ); setBoxShape( Q::Panel, 2 ); @@ -799,6 +809,11 @@ void Editor::setupSlider() setBoxBorderMetrics( Q::Handle, 1 ); setBoxBorderColors( Q::Handle, m_pal.outline ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Handle | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed } ) ); +#endif + setStrutSize( Q::Handle, 16_dp, 16_dp ); for ( auto state : { A::NoState, Q::Pressed } ) @@ -838,6 +853,12 @@ void Editor::setupSpinBox() setBoxBorderMetrics( Q::TextPanel, 1_dp ); setBoxBorderColors( Q::TextPanel, m_pal.outline ); +#ifdef SHOW_FOCUS + // not correct, we need the border around text and buttons. TODO ... + setBoxBorderColors( Q::TextPanel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Increasing, Q::Decreasing, Q::Hovered } ) ); +#endif + setBoxShape( Q::UpPanel, 0, 2_dp, 0, 0 ); setBoxBorderMetrics( Q::UpPanel, 0_dp, 1_dp, 1_dp, 0_dp ); @@ -922,6 +943,11 @@ void Editor::setupSwitchButton() setGradient( Q::Handle, QskRgb::lighter( m_pal.button, 104 ) ); setGradient( Q::Handle | Q::Pressed, QskRgb::darker( m_pal.button, 110 ) ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Handle | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed, Q::Checked } ) ); +#endif + for( auto state : { A::NoState, Q::Disabled } ) { auto aspect = Q::Handle | state; @@ -967,6 +993,10 @@ void Editor::setupTabButton() QskRgb::lighter( m_pal.tabFrame, 104 ), m_pal.tabFrame ); } +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, Q::Pressed, Q::Checked } ) ); +#endif for ( auto variation : { A::Left, A::Right, A::Top, A::Bottom } ) { @@ -1106,6 +1136,11 @@ void Editor::setupVirtualKeyboard() setBoxBorderMetrics( Q::ButtonPanel, 1 ); setBoxShape( Q::ButtonPanel, 2 ); +#ifdef SHOW_FOCUS + setBoxBorderColors( Q::ButtonPanel | Q::Focused, m_pal.highlightedOutline, + Combination( { Q::Hovered, QskPushButton::Pressed } ) ); +#endif + for ( auto state : { A::NoState, Q::Disabled } ) { const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled; @@ -1294,5 +1329,5 @@ void QskFusionSkin::setGraphicColor( GraphicRole role, QRgb rgb ) setGraphicFilter( role, colorFilter ); } - #include "moc_QskFusionSkin.cpp" +#include "QskFusionSkin.moc" diff --git a/designsystems/material3/QskMaterial3Skin.cpp b/designsystems/material3/QskMaterial3Skin.cpp index a0f72e7d..c9b868d5 100644 --- a/designsystems/material3/QskMaterial3Skin.cpp +++ b/designsystems/material3/QskMaterial3Skin.cpp @@ -73,6 +73,8 @@ namespace class Editor : private QskSkinHintTableEditor { + Q_GADGET + public: Editor( QskSkinHintTable* table, const QskMaterial3Theme& palette ) : QskSkinHintTableEditor( table ) @@ -80,37 +82,41 @@ namespace { } - void setup(); + void setup() + { + for ( int i = 0; i < staticMetaObject.methodCount(); i++ ) + staticMetaObject.method( i ).invokeOnGadget( this ); + } private: - void setupBox(); - void setupCheckBox(); - void setupComboBox(); - void setupDialogButtonBox(); - void setupDrawer(); - void setupFocusIndicator(); - void setupInputPanel(); - void setupVirtualKeyboard(); - void setupListView(); - void setupMenu(); - void setupPageIndicator(); - void setupPopup(); - void setupProgressBar(); - void setupProgressRing(); - void setupRadioBox(); - void setupPushButton(); - void setupScrollView(); - void setupSegmentedBar(); - void setupSeparator(); - void setupSubWindow(); - void setupSlider(); - void setupSpinBox(); - void setupSwitchButton(); - void setupTabButton(); - void setupTabBar(); - void setupTabView(); - void setupTextInput(); - void setupTextLabel(); + Q_INVOKABLE void setupBox(); + Q_INVOKABLE void setupCheckBox(); + Q_INVOKABLE void setupComboBox(); + Q_INVOKABLE void setupDialogButtonBox(); + Q_INVOKABLE void setupDrawer(); + Q_INVOKABLE void setupFocusIndicator(); + Q_INVOKABLE void setupInputPanel(); + Q_INVOKABLE void setupVirtualKeyboard(); + Q_INVOKABLE void setupListView(); + Q_INVOKABLE void setupMenu(); + Q_INVOKABLE void setupPageIndicator(); + Q_INVOKABLE void setupPopup(); + Q_INVOKABLE void setupProgressBar(); + Q_INVOKABLE void setupProgressRing(); + Q_INVOKABLE void setupRadioBox(); + Q_INVOKABLE void setupPushButton(); + Q_INVOKABLE void setupScrollView(); + Q_INVOKABLE void setupSegmentedBar(); + Q_INVOKABLE void setupSeparator(); + Q_INVOKABLE void setupSubWindow(); + Q_INVOKABLE void setupSlider(); + Q_INVOKABLE void setupSpinBox(); + Q_INVOKABLE void setupSwitchButton(); + Q_INVOKABLE void setupTabButton(); + Q_INVOKABLE void setupTabBar(); + Q_INVOKABLE void setupTabView(); + Q_INVOKABLE void setupTextInput(); + Q_INVOKABLE void setupTextLabel(); QskGraphic symbol( const char* name ) const { @@ -149,38 +155,6 @@ namespace } } -void Editor::setup() -{ - setupBox(); - setupCheckBox(); - setupComboBox(); - setupDialogButtonBox(); - setupDrawer(); - setupFocusIndicator(); - setupInputPanel(); - setupVirtualKeyboard(); - setupListView(); - setupMenu(); - setupPageIndicator(); - setupPopup(); - setupProgressBar(); - setupProgressRing(); - setupPushButton(); - setupRadioBox(); - setupScrollView(); - setupSegmentedBar(); - setupSeparator(); - setupSlider(); - setupSpinBox(); - setupSubWindow(); - setupSwitchButton(); - setupTabButton(); - setupTabBar(); - setupTabView(); - setupTextLabel(); - setupTextInput(); -} - void Editor::setupCheckBox() { // skin hints are ordered according to @@ -1468,3 +1442,4 @@ void QskMaterial3Skin::setupGraphicFilters( const QskMaterial3Theme& palette ) } #include "moc_QskMaterial3Skin.cpp" +#include "QskMaterial3Skin.moc" From 57ebeec2df2252dabc0d75dd8f5646ef6897a51b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 29 Jan 2024 13:37:25 +0100 Subject: [PATCH 17/27] obsolete methods removed --- src/controls/QskSkin.cpp | 4 ---- src/controls/QskSkin.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index e93fbec6..465253ab 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -407,8 +407,4 @@ QskSkinlet* QskSkin::skinlet( const QMetaObject* metaObject ) return &defaultSkinlet; } -void QskSkin::resetColors( const QColor& ) -{ -} - #include "moc_QskSkin.cpp" diff --git a/src/controls/QskSkin.h b/src/controls/QskSkin.h index 5bd9d799..cf347448 100644 --- a/src/controls/QskSkin.h +++ b/src/controls/QskSkin.h @@ -64,8 +64,6 @@ class QSK_EXPORT QskSkin : public QObject template< typename Control, typename Skinlet > void declareSkinlet(); - virtual void resetColors( const QColor& accent ); - void setSkinHint( QskAspect, const QVariant& hint ); const QVariant& skinHint( QskAspect ) const; From af2eb74ea1a3656b6103126c42bad8da18ca203b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 29 Jan 2024 16:09:25 +0100 Subject: [PATCH 18/27] missing ifdefs added --- src/common/QskMetaFunction.cpp | 5 ++++- src/common/QskMetaInvokable.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 8ad62073..1e8991a6 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -7,9 +7,12 @@ #include #include -#include #include +#if QT_CONFIG(thread) +#include +#endif + QSK_QT_PRIVATE_BEGIN #include QSK_QT_PRIVATE_END diff --git a/src/common/QskMetaInvokable.cpp b/src/common/QskMetaInvokable.cpp index cc372bbc..09a576f0 100644 --- a/src/common/QskMetaInvokable.cpp +++ b/src/common/QskMetaInvokable.cpp @@ -9,9 +9,12 @@ #include #include #include -#include #include +#if QT_CONFIG(thread) +#include +#endif + QSK_QT_PRIVATE_BEGIN #include QSK_QT_PRIVATE_END From 0aff128eecc80fa88cb4104a21efc6fbd8898de2 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 10:09:14 +0100 Subject: [PATCH 19/27] obsolete qml bindings of QskSetup removed --- qmlexport/CMakeLists.txt | 2 -- qmlexport/QskMainQml.cpp | 69 --------------------------------------- qmlexport/QskMainQml.h | 66 ------------------------------------- qmlexport/QskQml.cpp | 2 -- src/controls/QskSetup.cpp | 6 ---- src/controls/QskSetup.h | 2 -- 6 files changed, 147 deletions(-) delete mode 100644 qmlexport/QskMainQml.cpp delete mode 100644 qmlexport/QskMainQml.h diff --git a/qmlexport/CMakeLists.txt b/qmlexport/CMakeLists.txt index f0ea7541..a4660b24 100644 --- a/qmlexport/CMakeLists.txt +++ b/qmlexport/CMakeLists.txt @@ -7,13 +7,11 @@ set(HEADERS QskQmlGlobal.h QskShortcutQml.h QskLayoutQml.h - QskMainQml.h QskQml.h) set(SOURCES QskShortcutQml.cpp QskLayoutQml.cpp - QskMainQml.cpp QskQml.cpp) set(target qskqmlexport) diff --git a/qmlexport/QskMainQml.cpp b/qmlexport/QskMainQml.cpp deleted file mode 100644 index 05cb69e8..00000000 --- a/qmlexport/QskMainQml.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include "QskMainQml.h" -#include -#include - -static void qskRegisterConverter() -{ - QMetaType::registerConverter< int, QskSetupFlagsQml >(); -} - -Q_CONSTRUCTOR_FUNCTION( qskRegisterConverter ) - -QskMain::QskMain( QObject* parent ) - : QObject( parent ) -{ - // how to supress warnings about a missing skinListChanged - // as we don't have it ?? - - connect( setup(), &QskSetup::skinChanged, - this, &QskMain::skinChanged, Qt::QueuedConnection ); - - connect( setup(), &QskSetup::itemUpdateFlagsChanged, - this, &QskMain::itemUpdateFlagsChanged, Qt::QueuedConnection ); -} - -QStringList QskMain::skinList() const -{ - auto manager = QskSkinManager::instance(); - return manager ? manager->skinNames() : QStringList(); -} - -QQmlListProperty< QObject > QskMain::data() -{ -#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) - using SizeType = qsizetype; -#else - using SizeType = int; -#endif - - return QQmlListProperty< QObject >( - this, nullptr, - []( QQmlListProperty< QObject >* property, QObject* value ) - { - auto main = static_cast< QskMain* >( property->object ); - main->m_data.append( value ); - }, - []( QQmlListProperty< QObject >* property ) - { - auto main = static_cast< const QskMain* >( property->object ); - return static_cast< SizeType >( main->m_data.count() ); - }, - []( QQmlListProperty< QObject >* property, SizeType index ) - { - auto main = static_cast< const QskMain* >( property->object ); - return main->m_data.at( index ); - }, - []( QQmlListProperty< QObject >* property ) - { - auto main = static_cast< QskMain* >( property->object ); - main->m_data.clear(); - } - ); -} - -#include "moc_QskMainQml.cpp" diff --git a/qmlexport/QskMainQml.h b/qmlexport/QskMainQml.h deleted file mode 100644 index 438a4e6e..00000000 --- a/qmlexport/QskMainQml.h +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#ifndef QSK_SETUP_QML_H -#define QSK_SETUP_QML_H - -#include "QskQmlGlobal.h" - -#include - -#include -#include - -class QskSetupFlagsQml : public QskQuickItem::UpdateFlags -{ - Q_GADGET - - public: - template< typename ... Args > - QskSetupFlagsQml( Args&&... args ) - : QskQuickItem::UpdateFlags( std::forward< Args >( args ) ... ) - { - } - - Q_INVOKABLE int valueOf() const { return int( *this ); } -}; - -class QskMain : public QObject -{ - public: - Q_OBJECT - - Q_PRIVATE_PROPERTY( setup(), QString skin READ skinName - WRITE setSkin NOTIFY skinChanged ) - - Q_PROPERTY( QStringList skinList READ skinList NOTIFY skinListChanged ) - - Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsQml itemUpdateFlags - READ itemUpdateFlags WRITE setItemUpdateFlags NOTIFY itemUpdateFlagsChanged ) - - Q_PROPERTY( QQmlListProperty< QObject > data READ data ) - Q_CLASSINFO( "DefaultProperty", "data" ) - - public: - QskMain( QObject* parent = nullptr ); - - QStringList skinList() const; - QQmlListProperty< QObject > data(); - - Q_SIGNALS: - void skinListChanged(); // never emitted - void skinChanged(); - void inputPanelChanged(); - void itemUpdateFlagsChanged(); - - private: - static inline QskSetup* setup() { return QskSetup::instance(); } - - QObjectList m_data; -}; - -Q_DECLARE_METATYPE( QskSetupFlagsQml ) - -#endif diff --git a/qmlexport/QskQml.cpp b/qmlexport/QskQml.cpp index b8c2c20a..e5581aad 100644 --- a/qmlexport/QskQml.cpp +++ b/qmlexport/QskQml.cpp @@ -8,7 +8,6 @@ #include "QskLayoutQml.h" #include "QskShortcutQml.h" -#include "QskMainQml.h" #include #include @@ -196,7 +195,6 @@ void QskQml::registerTypes() qmlRegisterUncreatableType< QskSkin >( QSK_MODULE_NAME, 1, 0, "Skin", QString() ); qRegisterMetaType< QskSkin* >(); - registerObject< QskMain >(); registerObject< QskShortcutQml >( "Shortcut" ); registerObject< QskWindow >(); diff --git a/src/controls/QskSetup.cpp b/src/controls/QskSetup.cpp index 8fcf0319..25727ddb 100644 --- a/src/controls/QskSetup.cpp +++ b/src/controls/QskSetup.cpp @@ -285,10 +285,4 @@ bool QskSetup::eventFilter( QObject* object, QEvent* event ) return false; } -QskSetup* QskSetup::qmlAttachedProperties( QObject* ) -{ - return QskSetup::instance(); -} - -Q_DECLARE_METATYPE( QskSkin* ) #include "moc_QskSetup.cpp" diff --git a/src/controls/QskSetup.h b/src/controls/QskSetup.h index 1ea4c7f0..d824b0c2 100644 --- a/src/controls/QskSetup.h +++ b/src/controls/QskSetup.h @@ -49,8 +49,6 @@ class QSK_EXPORT QskSetup : public QObject static void setup(); static void cleanup(); - static QskSetup* qmlAttachedProperties( QObject* ); - Q_SIGNALS: void skinChanged( QskSkin* ); void itemUpdateFlagsChanged(); From 38e00addd648b49106116992c9ba76ba8bdff6c8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 10:43:27 +0100 Subject: [PATCH 20/27] code moved from QskSetup to QskSkinManager --- examples/gallery/main.cpp | 5 +-- examples/iotdashboard/main.cpp | 14 +++--- examples/mycontrols/main.cpp | 6 +-- examples/qvgviewer/MainWindow.cpp | 6 +-- playground/gradients/main.cpp | 4 +- src/controls/QskGraphicLabel.cpp | 4 +- src/controls/QskPushButton.cpp | 4 +- src/controls/QskQuickItem.cpp | 5 ++- src/controls/QskSetup.cpp | 58 ++----------------------- src/controls/QskSetup.h | 7 --- src/controls/QskSkinManager.cpp | 72 +++++++++++++++++++++++++++---- src/controls/QskSkinManager.h | 10 ++++- src/controls/QskSkinnable.cpp | 4 +- src/controls/QskWindow.cpp | 4 +- support/SkinnyNamespace.cpp | 19 ++++---- 15 files changed, 112 insertions(+), 110 deletions(-) diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index 9edaf1b6..7ca7e09d 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include @@ -159,7 +158,7 @@ namespace for ( const auto& name : names ) menu->addOption( QUrl(), name ); - if ( const auto index = names.indexOf( qskSetup->skinName() ) ) + if ( const auto index = names.indexOf( qskSkinManager->skinName() ) ) menu->setCurrentIndex( index ); connect( menu, &QskMenu::triggered, this, &SkinButton::changeSkin ); @@ -170,7 +169,7 @@ namespace const auto names = qskSkinManager->skinNames(); if ( ( index >= 0 ) && ( index < names.size() ) - && ( index != names.indexOf( qskSetup->skinName() ) ) ) + && ( index != names.indexOf( qskSkinManager->skinName() ) ) ) { Skinny::setSkin( index, 500 ); } diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index ab2cb0b5..46410360 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -79,7 +79,7 @@ int main( int argc, char* argv[] ) qskSkinManager->registerFactory( QStringLiteral( "SampleSkinFactory" ), new SkinFactory() ); - qskSetup->setSkin( "DaytimeSkin" ); + qskSkinManager->setSkin( "DaytimeSkin" ); #ifdef USE_SHORTCUTS // With CTRL-B you can rotate a couple of visual debug modes @@ -92,13 +92,13 @@ int main( int argc, char* argv[] ) for( int i = 1; i < argc; i++ ) { - if( argv[i] == QStringLiteral("--screenshot") && i + 1 < argc ) - { - QTimer::singleShot( 500, &window, [&app, &window, filename = QString(argv[i + 1])]() - { auto image = window.grabWindow(); image.save(filename); } ); + if( argv[i] == QStringLiteral( "--screenshot" ) && i + 1 < argc ) + { + QTimer::singleShot( 500, &window, [&app, &window, filename = QString(argv[i + 1])]() + { auto image = window.grabWindow(); image.save(filename); } ); - break; - } + break; + } } return app.exec(); diff --git a/examples/mycontrols/main.cpp b/examples/mycontrols/main.cpp index c57914f7..5c7dfab9 100644 --- a/examples/mycontrols/main.cpp +++ b/examples/mycontrols/main.cpp @@ -102,11 +102,11 @@ class Window : public QskWindow private: void setAlternativeSkin( bool on ) { - auto oldSkin = qskSetup->skin(); - if ( oldSkin->parent() == qskSetup ) + auto oldSkin = qskSkinManager->skin(); + if ( oldSkin->parent() == qskSkinManager ) oldSkin->setParent( nullptr ); // otherwise setSkin deletes it - auto newSkin = qskSetup->setSkin( alternativeSkin( on ) ); + auto newSkin = qskSkinManager->setSkin( alternativeSkin( on ) ); QskSkinTransition transition; diff --git a/examples/qvgviewer/MainWindow.cpp b/examples/qvgviewer/MainWindow.cpp index 33269930..001c6c87 100644 --- a/examples/qvgviewer/MainWindow.cpp +++ b/examples/qvgviewer/MainWindow.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -92,10 +92,10 @@ MainWindow::MainWindow() connect( invertButton, &QskPushButton::toggled, label, &GraphicLabel::setDarknessMode ); - connect( qskSetup, &QskSetup::skinChanged, + connect( qskSkinManager, &QskSkinManager::skinChanged, this, &MainWindow::setGraphicRoles ); - setGraphicRoles( qskSetup->skin() ); + setGraphicRoles( qskSkinManager->skin() ); } void MainWindow::setGraphicRoles( QskSkin* skin ) diff --git a/playground/gradients/main.cpp b/playground/gradients/main.cpp index 2a3b721e..e952c8f2 100644 --- a/playground/gradients/main.cpp +++ b/playground/gradients/main.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -208,7 +208,7 @@ int main( int argc, char** argv ) Skinny::init(); // we need a skin SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugBackground ); - qskSetup->setSkin( "fusion" ); + qskSkinManager->setSkin( "fusion" ); QskWindow window; window.setColor( QskRgb::Wheat ); diff --git a/src/controls/QskGraphicLabel.cpp b/src/controls/QskGraphicLabel.cpp index 39a1802a..0f05e4dc 100644 --- a/src/controls/QskGraphicLabel.cpp +++ b/src/controls/QskGraphicLabel.cpp @@ -8,7 +8,7 @@ #include "QskColorFilter.h" #include "QskGraphic.h" #include "QskGraphicProvider.h" -#include "QskSetup.h" +#include "QskSkinManager.h" #include "QskSkin.h" QSK_SUBCONTROL( QskGraphicLabel, Panel ) @@ -309,7 +309,7 @@ void QskGraphicLabel::changeEvent( QEvent* event ) { if ( event->type() == QEvent::StyleChange ) { - if ( !m_data->source.isEmpty() && qskSetup->skin()->hasGraphicProvider() ) + if ( !m_data->source.isEmpty() && qskSkinManager->skin()->hasGraphicProvider() ) { // we might need to reload from a different skin m_data->isSourceDirty = true; diff --git a/src/controls/QskPushButton.cpp b/src/controls/QskPushButton.cpp index 3d866cc7..f6f8370c 100644 --- a/src/controls/QskPushButton.cpp +++ b/src/controls/QskPushButton.cpp @@ -9,7 +9,7 @@ #include "QskBoxShapeMetrics.h" #include "QskGraphic.h" #include "QskGraphicProvider.h" -#include "QskSetup.h" +#include "QskSkinManager.h" #include "QskSkin.h" #include "QskSkinlet.h" #include "QskTextOptions.h" @@ -275,7 +275,7 @@ void QskPushButton::changeEvent( QEvent* event ) case QEvent::StyleChange: { if ( !m_data->iconSource.isEmpty() && - qskSetup->skin()->hasGraphicProvider() ) + qskSkinManager->skin()->hasGraphicProvider() ) { // we might need to reload from a different skin m_data->isIconSourceDirty = true; diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index 492a3e94..204a2334 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -8,6 +8,7 @@ #include "QskQuick.h" #include "QskEvent.h" #include "QskSetup.h" +#include "QskSkinManager.h" #include "QskSkin.h" #include "QskDirtyItemFilter.h" @@ -76,8 +77,8 @@ namespace We would also need to send QEvent::StyleChange, when a window has a new skin. TODO ... */ - QObject::connect( qskSetup, &QskSetup::skinChanged, - qskSetup, [ this ] { updateSkin(); } ); + QObject::connect( qskSkinManager, &QskSkinManager::skinChanged, + qskSkinManager, [ this ] { updateSkin(); } ); } inline void insert( QskQuickItem* item ) diff --git a/src/controls/QskSetup.cpp b/src/controls/QskSetup.cpp index 25727ddb..9ba906d6 100644 --- a/src/controls/QskSetup.cpp +++ b/src/controls/QskSetup.cpp @@ -7,12 +7,11 @@ #include "QskControl.h" #include "QskControlPrivate.h" #include "QskGraphicProviderMap.h" -#include "QskSkin.h" #include "QskSkinManager.h" +#include "QskSkin.h" #include "QskWindow.h" #include -#include #include QskSetup* QskSetup::s_instance = nullptr; @@ -81,9 +80,6 @@ class QskSetup::PrivateData { } - QString skinName; - QPointer< QskSkin > skin; - QskGraphicProviderMap graphicProviders; QskQuickItem::UpdateFlags itemUpdateFlags; }; @@ -152,53 +148,6 @@ bool QskSetup::testItemUpdateFlag( QskQuickItem::UpdateFlag flag ) return m_data->itemUpdateFlags.testFlag( flag ); } -QskSkin* QskSetup::setSkin( const QString& skinName ) -{ - if ( m_data->skin && ( skinName == m_data->skinName ) ) - return m_data->skin; - - auto skin = QskSkinManager::instance()->createSkin( skinName ); - if ( skin == nullptr ) - return nullptr; - - if ( skin->parent() == nullptr ) - skin->setParent( this ); - - const auto oldSkin = m_data->skin; - - m_data->skin = skin; - m_data->skinName = skinName; - - if ( oldSkin ) - { - Q_EMIT skinChanged( skin ); - - if ( oldSkin->parent() == this ) - delete oldSkin; - } - - return m_data->skin; -} - -QString QskSetup::skinName() const -{ - return m_data->skinName; -} - -QskSkin* QskSetup::skin() -{ - if ( m_data->skin == nullptr ) - { - m_data->skin = QskSkinManager::instance()->createSkin( QString() ); - Q_ASSERT( m_data->skin ); - - m_data->skin->setParent( this ); - m_data->skinName = m_data->skin->objectName(); - } - - return m_data->skin; -} - void QskSetup::addGraphicProvider( const QString& providerId, QskGraphicProvider* provider ) { m_data->graphicProviders.insert( providerId, provider ); @@ -206,10 +155,9 @@ void QskSetup::addGraphicProvider( const QString& providerId, QskGraphicProvider QskGraphicProvider* QskSetup::graphicProvider( const QString& providerId ) const { - if ( m_data->skin ) + if ( auto skin = qskSkinManager->skin() ) { - QskGraphicProvider* provider = m_data->skin->graphicProvider( providerId ); - if ( provider ) + if ( auto provider = skin->graphicProvider( providerId ) ) return provider; } diff --git a/src/controls/QskSetup.h b/src/controls/QskSetup.h index d824b0c2..d541a614 100644 --- a/src/controls/QskSetup.h +++ b/src/controls/QskSetup.h @@ -12,7 +12,6 @@ #include #include -class QskSkin; class QQuickItem; class QskGraphicProvider; @@ -38,11 +37,6 @@ class QSK_EXPORT QskSetup : public QObject void resetItemUpdateFlag( QskQuickItem::UpdateFlag ); bool testItemUpdateFlag( QskQuickItem::UpdateFlag ); - QskSkin* setSkin( const QString& ); - QString skinName() const; - - QskSkin* skin(); - void addGraphicProvider( const QString& providerId, QskGraphicProvider* ); QskGraphicProvider* graphicProvider( const QString& providerId ) const; @@ -50,7 +44,6 @@ class QSK_EXPORT QskSetup : public QObject static void cleanup(); Q_SIGNALS: - void skinChanged( QskSkin* ); void itemUpdateFlagsChanged(); private: diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index ae4cc662..c3c4d92c 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -5,6 +5,7 @@ #include "QskSkinManager.h" #include "QskSkinFactory.h" +#include "QskSkin.h" #include #include @@ -20,13 +21,6 @@ #include #endif -static inline QStringList qskSplitPath( const QString& s ) -{ - const auto separator = QDir::listSeparator(); - - return s.split( separator, Qt::SkipEmptyParts ); -} - /* We could use QFactoryLoader, but as it is again a "private" class and does a couple of hardcoded things we don't need ( like always resolving @@ -48,7 +42,8 @@ static QStringList qskPathList( const char* envName ) if ( env.isEmpty() ) return QStringList(); - return qskSplitPath( QFile::decodeName( env ) ); + const auto name = QFile::decodeName( env ); + return name.split( QDir::listSeparator(), Qt::SkipEmptyParts ); } static inline QString qskResolvedPath( const QString& path ) @@ -406,6 +401,8 @@ class QskSkinManager::PrivateData QStringList pluginPaths; FactoryMap factoryMap; + QPointer< QskSkin > skin; + bool pluginsRegistered : 1; }; @@ -540,7 +537,64 @@ QskSkin* QskSkinManager::createSkin( const QString& skinName ) const } } - return factory ? factory->createSkin( name ) : nullptr; + QskSkin* skin = nullptr; + + if ( factory ) + { + skin = factory->createSkin( name ); + if ( skin ) + skin->setObjectName( name ); + } + + return skin; +} + +QskSkin* QskSkinManager::setSkin( const QString& name ) +{ + if ( m_data->skin && ( m_data->skin->objectName() == name ) ) + return m_data->skin; + + auto skin = createSkin( name ); + if ( skin == nullptr ) + return nullptr; + + if ( skin->parent() == nullptr ) + skin->setParent( this ); + + const auto oldSkin = m_data->skin; + + m_data->skin = skin; + + if ( oldSkin ) + { + Q_EMIT skinChanged( skin ); + + if ( oldSkin->parent() == this ) + delete oldSkin; + } + + return m_data->skin; +} + +QString QskSkinManager::skinName() const +{ + if ( m_data->skin ) + return m_data->skin->objectName(); + + return QString(); +} + +QskSkin* QskSkinManager::skin() +{ + if ( m_data->skin == nullptr ) + { + m_data->skin = createSkin( QString() ); + Q_ASSERT( m_data->skin ); + + m_data->skin->setParent( this ); + } + + return m_data->skin; } #include "moc_QskSkinManager.cpp" diff --git a/src/controls/QskSkinManager.h b/src/controls/QskSkinManager.h index 74563854..8a3d1b63 100644 --- a/src/controls/QskSkinManager.h +++ b/src/controls/QskSkinManager.h @@ -39,7 +39,15 @@ class QSK_EXPORT QskSkinManager : public QObject QStringList skinNames() const; - QskSkin* createSkin( const QString& skinName ) const; + QskSkin* createSkin( const QString& name ) const; + + QskSkin* skin(); + + QskSkin* setSkin( const QString& ); + QString skinName() const; + + Q_SIGNALS: + void skinChanged( QskSkin* ); protected: QskSkinManager(); diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 3931dd9d..cf73ea7c 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -12,7 +12,7 @@ #include "QskControl.h" #include "QskHintAnimator.h" #include "QskMargins.h" -#include "QskSetup.h" +#include "QskSkinManager.h" #include "QskSkin.h" #include "QskSkinHintTable.h" #include "QskSkinTransition.h" @@ -1520,7 +1520,7 @@ QskSkin* QskSkinnable::effectiveSkin() const skin = qskEffectiveSkin( item->window() ); } - return skin ? skin : qskSetup->skin(); + return skin ? skin : qskSkinManager->skin(); } QskAspect::Variation QskSkinnable::effectiveVariation() const diff --git a/src/controls/QskWindow.cpp b/src/controls/QskWindow.cpp index 431e9da9..d94067f2 100644 --- a/src/controls/QskWindow.cpp +++ b/src/controls/QskWindow.cpp @@ -662,7 +662,7 @@ void QskWindow::enforceSkin() // let's create a default skin on the GUI thread - whatever it is // good for. - ( void ) qskSetup->skin(); + ( void ) qskSkinManager->skin(); qskEnforcedSkin = true; } @@ -718,7 +718,7 @@ QskSkin* qskEffectiveSkin( const QQuickWindow* window ) return skin; } - return qskSetup->skin(); + return qskSkinManager->skin(); } #include "moc_QskWindow.cpp" diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index 433a054d..2e9908c2 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -5,7 +5,6 @@ #include "SkinnyNamespace.h" -#include #include #include #include @@ -13,13 +12,13 @@ #include #include +#include #define STRINGIFY(x) #x #define STRING(x) STRINGIFY(x) #if defined( PLUGIN_PATH ) -#include #include #define STRINGIFY(x) #x @@ -74,7 +73,7 @@ static bool pluginPath = initPluginPath(); } if ( !skinNames.isEmpty() ) - qskSetup->setSkin( skinNames[0] ); + qskSkinManager->setSkin( skinNames[0] ); } Q_COREAPP_STARTUP_FUNCTION( initSkins ) @@ -136,7 +135,7 @@ void Skinny::changeSkin( QskAnimationHint hint ) const auto names = qskSkinManager->skinNames(); if ( names.size() > 1 ) { - auto index = names.indexOf( qskSetup->skinName() ); + auto index = names.indexOf( qskSkinManager->skinName() ); index = ( index + 1 ) % names.size(); setSkin( index, hint ); @@ -149,14 +148,14 @@ void Skinny::setSkin( int index, QskAnimationHint hint ) if ( names.size() <= 1 ) return; - if ( index == names.indexOf( qskSetup->skinName() ) ) + if ( index == names.indexOf( qskSkinManager->skinName() ) ) return; - auto oldSkin = qskSetup->skin(); - if ( oldSkin->parent() == qskSetup ) + auto oldSkin = qskSkinManager->skin(); + if ( oldSkin->parent() == qskSkinManager ) oldSkin->setParent( nullptr ); // otherwise setSkin deletes it - if ( auto newSkin = qskSetup->setSkin( names[ index ] ) ) + if ( auto newSkin = qskSkinManager->setSkin( names[ index ] ) ) { QskSkinTransition transition; @@ -174,7 +173,7 @@ void Skinny::setSkin( int index, QskAnimationHint hint ) void Skinny::changeFonts( int increment ) { - auto skin = qskSetup->skin(); + auto skin = qskSkinManager->skin(); const auto fonts = skin->fonts(); @@ -199,7 +198,7 @@ void Skinny::changeFonts( int increment ) skin->setFont( role, font ); } - Q_EMIT qskSetup->skinChanged( skin ); + Q_EMIT qskSkinManager->skinChanged( skin ); } void Skinny::init() From 34e8dd9d65a50aa63f9b566a0277a408a11e4f9b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 10:58:04 +0100 Subject: [PATCH 21/27] missing include added --- support/SkinnyNamespace.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index 2e9908c2..7a447f79 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #define STRINGIFY(x) #x #define STRING(x) STRINGIFY(x) From 9ca02d7f1cff7bf8fbde5c5ce090d07e649a9257 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 13:04:38 +0100 Subject: [PATCH 22/27] moving away from std::unordered_map towards QHash. For transitions between color schemes we need to copy out hash tables, what is way much easier with the COW concept of the Qt containers. Also: according to https://tessil.github.io/2016/08/29/benchmark-hopscotch-map.html QHash seems to be faster in the most relevant category "Random full reads: execution time (integers)" --- examples/mycontrols/main.cpp | 20 ++-- src/controls/QskSkin.cpp | 51 +++++---- src/controls/QskSkin.h | 6 +- src/controls/QskSkinHintTable.cpp | 61 ++++++++--- src/controls/QskSkinHintTable.h | 22 ++-- src/controls/QskSkinTransition.cpp | 161 +++++++++++++---------------- src/controls/QskSkinTransition.h | 19 ++-- support/SkinnyNamespace.cpp | 26 ++--- 8 files changed, 178 insertions(+), 188 deletions(-) diff --git a/examples/mycontrols/main.cpp b/examples/mycontrols/main.cpp index 5c7dfab9..216ce3be 100644 --- a/examples/mycontrols/main.cpp +++ b/examples/mycontrols/main.cpp @@ -102,22 +102,14 @@ class Window : public QskWindow private: void setAlternativeSkin( bool on ) { - auto oldSkin = qskSkinManager->skin(); - if ( oldSkin->parent() == qskSkinManager ) - oldSkin->setParent( nullptr ); // otherwise setSkin deletes it - - auto newSkin = qskSkinManager->setSkin( alternativeSkin( on ) ); - QskSkinTransition transition; + transition.setSourceSkin( qskSkinManager->skin() ); - transition.setSourceSkin( oldSkin ); - transition.setTargetSkin( newSkin ); - transition.setAnimation( QskAnimationHint( 600, QEasingCurve::Linear ) ); - - transition.process(); - - if ( oldSkin->parent() == nullptr ) - delete oldSkin; + if ( auto skin = qskSkinManager->setSkin( alternativeSkin( on ) ) ) + { + transition.setTargetSkin( skin ); + transition.run( 600 ); + } } QString alternativeSkin( bool on ) const diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 465253ab..0d42201d 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -21,7 +21,6 @@ #include #include -#include #include "QskBox.h" #include "QskBoxSkinlet.h" @@ -104,6 +103,8 @@ #include "QskStatusIndicator.h" #include "QskStatusIndicatorSkinlet.h" +#include + static inline QskSkinlet* qskNewSkinlet( const QMetaObject* metaObject, QskSkin* skin ) { const QByteArray signature = metaObject->className() + QByteArrayLiteral( "(QskSkin*)" ); @@ -137,19 +138,19 @@ namespace } const QMetaObject* metaObject; - QskSkinlet* skinlet; + QskSkinlet* skinlet; // mutable ??? }; } class QskSkin::PrivateData { public: - std::unordered_map< const QMetaObject*, SkinletData > skinletMap; + QHash< const QMetaObject*, SkinletData > skinletMap; QskSkinHintTable hintTable; - std::unordered_map< int, QFont > fonts; - std::unordered_map< int, QskColorFilter > graphicFilters; + QHash< int, QFont > fonts; + QHash< int, QskColorFilter > graphicFilters; QskGraphicProviderMap graphicProviders; }; @@ -229,9 +230,9 @@ void QskSkin::declareSkinlet( const QMetaObject* metaObject, const auto it = m_data->skinletMap.find( metaObject ); - if ( it != m_data->skinletMap.cend() ) + if ( it != m_data->skinletMap.end() ) { - auto& entry = it->second; + auto& entry = it.value(); if ( entry.metaObject != skinletMetaObject ) { entry.metaObject = skinletMetaObject; @@ -276,18 +277,18 @@ void QskSkin::setFont( int fontRole, const QFont& font ) void QskSkin::resetFont( int fontRole ) { - m_data->fonts.erase( fontRole ); + m_data->fonts.remove( fontRole ); } QFont QskSkin::font( int fontRole ) const { - auto it = m_data->fonts.find( fontRole ); - if ( it != m_data->fonts.cend() ) - return it->second; + auto it = m_data->fonts.constFind( fontRole ); + if ( it != m_data->fonts.constEnd() ) + return it.value(); - it = m_data->fonts.find( QskSkin::DefaultFont ); - if ( it != m_data->fonts.cend() ) - return it->second; + it = m_data->fonts.constFind( QskSkin::DefaultFont ); + if ( it != m_data->fonts.constEnd() ) + return it.value(); return QGuiApplication::font(); } @@ -299,16 +300,12 @@ void QskSkin::setGraphicFilter( int graphicRole, const QskColorFilter& colorFilt void QskSkin::resetGraphicFilter( int graphicRole ) { - m_data->graphicFilters.erase( graphicRole ); + m_data->graphicFilters.remove( graphicRole ); } QskColorFilter QskSkin::graphicFilter( int graphicRole ) const { - auto it = m_data->graphicFilters.find( graphicRole ); - if ( it != m_data->graphicFilters.cend() ) - return it->second; - - return QskColorFilter(); + return m_data->graphicFilters.value( graphicRole ); } const QskSkinHintTable& QskSkin::hintTable() const @@ -321,12 +318,12 @@ QskSkinHintTable& QskSkin::hintTable() return m_data->hintTable; } -const std::unordered_map< int, QFont >& QskSkin::fonts() const +const QHash< int, QFont >& QskSkin::fonts() const { return m_data->fonts; } -const std::unordered_map< int, QskColorFilter >& QskSkin::graphicFilters() const +const QHash< int, QskColorFilter >& QskSkin::graphicFilters() const { return m_data->graphicFilters; } @@ -375,9 +372,9 @@ const QMetaObject* QskSkin::skinletMetaObject( const QMetaObject* metaObject ) c { while ( metaObject ) { - auto it = m_data->skinletMap.find( metaObject ); - if ( it != m_data->skinletMap.cend() ) - return it->second.metaObject; + auto it = m_data->skinletMap.constFind( metaObject ); + if ( it != m_data->skinletMap.constEnd() ) + return it.value().metaObject; metaObject = metaObject->superClass(); } @@ -390,9 +387,9 @@ QskSkinlet* QskSkin::skinlet( const QMetaObject* metaObject ) while ( metaObject ) { auto it = m_data->skinletMap.find( metaObject ); - if ( it != m_data->skinletMap.cend() ) + if ( it != m_data->skinletMap.end() ) { - auto& entry = it->second; + auto& entry = it.value(); if ( entry.skinlet == nullptr ) entry.skinlet = qskNewSkinlet( entry.metaObject, this ); diff --git a/src/controls/QskSkin.h b/src/controls/QskSkin.h index cf347448..95b1cbfe 100644 --- a/src/controls/QskSkin.h +++ b/src/controls/QskSkin.h @@ -13,7 +13,6 @@ #include #include -#include class QskSkinnable; class QskSkinlet; @@ -25,6 +24,7 @@ class QskGraphicProvider; class QskSkinHintTable; class QVariant; +template< typename Key, typename T > class QHash; class QSK_EXPORT QskSkin : public QObject { @@ -91,8 +91,8 @@ class QSK_EXPORT QskSkin : public QObject const QskSkinHintTable& hintTable() const; QskSkinHintTable& hintTable(); - const std::unordered_map< int, QFont >& fonts() const; - const std::unordered_map< int, QskColorFilter >& graphicFilters() const; + const QHash< int, QFont >& fonts() const; + const QHash< int, QskColorFilter >& graphicFilters() const; private: void declareSkinlet( const QMetaObject* metaObject, diff --git a/src/controls/QskSkinHintTable.cpp b/src/controls/QskSkinHintTable.cpp index cd0d1482..145e6989 100644 --- a/src/controls/QskSkinHintTable.cpp +++ b/src/controls/QskSkinHintTable.cpp @@ -11,20 +11,19 @@ const QVariant QskSkinHintTable::invalidHint; inline const QVariant* qskResolvedHint( QskAspect aspect, - const std::unordered_map< QskAspect, QVariant >& hints, - QskAspect* resolvedAspect ) + const QHash< QskAspect, QVariant >& hints, QskAspect* resolvedAspect ) { auto a = aspect; Q_FOREVER { - auto it = hints.find( aspect ); - if ( it != hints.cend() ) + auto it = hints.constFind( aspect ); + if ( it != hints.constEnd() ) { if ( resolvedAspect ) *resolvedAspect = aspect; - return &it->second; + return &it.value(); } #if 1 @@ -74,17 +73,53 @@ QskSkinHintTable::QskSkinHintTable() { } +QskSkinHintTable::QskSkinHintTable( const QskSkinHintTable& other ) + : m_animatorCount( other.m_animatorCount ) + , m_states( other.m_states ) +{ + if ( other.m_hints ) + { + /* + A previous implementation was using STL containers - however: + + according to https://tessil.github.io/2016/08/29/benchmark-hopscotch-map.html + QHash does slightly faster lookups than std::unordered_map in the category + "Random full reads: execution time (integers)", that is the most relevant one + in our use case. + + Considering, that the "copy on write" strategy of QHash makes the implementation + of copy/assignment operators much easier ( needed in QskSkinTransition ) we prefer + using the Qt container over the STL counterparts. + */ + m_hints = new QHash< QskAspect, QVariant >( *other.m_hints ); + } +} + QskSkinHintTable::~QskSkinHintTable() { delete m_hints; } -const std::unordered_map< QskAspect, QVariant >& QskSkinHintTable::hints() const +QskSkinHintTable& QskSkinHintTable::operator=( const QskSkinHintTable& other ) +{ + m_animatorCount = ( other.m_animatorCount ); + m_states = other.m_states; + + delete m_hints; + m_hints = nullptr; + + if ( other.m_hints ) + m_hints = new QHash< QskAspect, QVariant >( *other.m_hints ); + + return *this; +} + +const QHash< QskAspect, QVariant >& QskSkinHintTable::hints() const { if ( m_hints ) return *m_hints; - static std::unordered_map< QskAspect, QVariant > dummyHints; + static QHash< QskAspect, QVariant > dummyHints; return dummyHints; } @@ -93,7 +128,7 @@ const std::unordered_map< QskAspect, QVariant >& QskSkinHintTable::hints() const bool QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint ) { if ( m_hints == nullptr ) - m_hints = new HintMap(); + m_hints = new QHash< QskAspect, QVariant >(); auto it = m_hints->find( aspect ); if ( it == m_hints->end() ) @@ -111,9 +146,9 @@ bool QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint ) return true; } - if ( it->second != skinHint ) + if ( it.value() != skinHint ) { - it->second = skinHint; + it.value() = skinHint; return true; } @@ -127,7 +162,7 @@ bool QskSkinHintTable::removeHint( QskAspect aspect ) if ( m_hints == nullptr ) return false; - const bool erased = m_hints->erase( aspect ); + const bool erased = m_hints->remove( aspect ); if ( erased ) { @@ -153,7 +188,7 @@ QVariant QskSkinHintTable::takeHint( QskAspect aspect ) auto it = m_hints->find( aspect ); if ( it != m_hints->end() ) { - const auto value = it->second; + const auto value = it.value(); m_hints->erase( it ); if ( aspect.isAnimator() ) @@ -214,7 +249,7 @@ QskAspect QskSkinHintTable::resolvedAnimator( auto it = m_hints->find( aspect ); if ( it != m_hints->cend() ) { - hint = it->second.value< QskAnimationHint >(); + hint = it.value().value< QskAnimationHint >(); return aspect; } diff --git a/src/controls/QskSkinHintTable.h b/src/controls/QskSkinHintTable.h index 006ec57f..1602f760 100644 --- a/src/controls/QskSkinHintTable.h +++ b/src/controls/QskSkinHintTable.h @@ -9,7 +9,7 @@ #include "QskAspect.h" #include -#include +#include class QskAnimationHint; @@ -17,8 +17,11 @@ class QSK_EXPORT QskSkinHintTable { public: QskSkinHintTable(); + QskSkinHintTable( const QskSkinHintTable& ); ~QskSkinHintTable(); + QskSkinHintTable& operator=( const QskSkinHintTable& ); + bool setAnimation( QskAspect, QskAnimationHint ); QskAnimationHint animation( QskAspect ) const; @@ -33,7 +36,7 @@ class QSK_EXPORT QskSkinHintTable bool hasHint( QskAspect ) const; - const std::unordered_map< QskAspect, QVariant >& hints() const; + const QHash< QskAspect, QVariant >& hints() const; bool hasAnimators() const; bool hasHints() const; @@ -53,12 +56,10 @@ class QSK_EXPORT QskSkinHintTable bool isResolutionMatching( QskAspect, QskAspect ) const; private: - Q_DISABLE_COPY( QskSkinHintTable ) static const QVariant invalidHint; - typedef std::unordered_map< QskAspect, QVariant > HintMap; - HintMap* m_hints = nullptr; + QHash< QskAspect, QVariant >* m_hints = nullptr; unsigned short m_animatorCount = 0; QskAspect::States m_states; @@ -81,19 +82,16 @@ inline bool QskSkinHintTable::hasAnimators() const inline bool QskSkinHintTable::hasHint( QskAspect aspect ) const { - if ( m_hints != nullptr ) - return m_hints->find( aspect ) != m_hints->cend(); - - return false; + return m_hints && m_hints->contains( aspect ); } inline const QVariant& QskSkinHintTable::hint( QskAspect aspect ) const { if ( m_hints != nullptr ) { - auto it = m_hints->find( aspect ); - if ( it != m_hints->cend() ) - return it->second; + auto it = m_hints->constFind( aspect ); + if ( it != m_hints->constEnd() ) + return it.value(); } return invalidHint; diff --git a/src/controls/QskSkinTransition.cpp b/src/controls/QskSkinTransition.cpp index 8b6776a0..f2c35565 100644 --- a/src/controls/QskSkinTransition.cpp +++ b/src/controls/QskSkinTransition.cpp @@ -16,10 +16,15 @@ #include #include #include +#include -#include #include +static bool qskHasHintTable( const QskSkin* skin, const QskSkinHintTable& hintTable ) +{ + return skin->hintTable().hints().isSharedWith( hintTable.hints() ); +} + static void qskSendStyleEventRecursive( QQuickItem* item ) { QEvent event( QEvent::StyleChange ); @@ -31,11 +36,11 @@ static void qskSendStyleEventRecursive( QQuickItem* item ) } static void qskAddCandidates( const QskSkinTransition::Type mask, - const QskSkin* skin, QSet< QskAspect >& candidates ) + const QHash< QskAspect, QVariant >& hints, QSet< QskAspect >& candidates ) { - for ( const auto& entry : skin->hintTable().hints() ) + for ( auto it = hints.constBegin(); it != hints.constEnd(); ++it ) { - const auto aspect = entry.first.trunk(); + const auto aspect = it.key().trunk(); if ( aspect.isAnimator() ) continue; @@ -127,11 +132,11 @@ namespace QVariant animatedGraphicFilter( int graphicRole ) const; void addGraphicFilterAnimators( const QskAnimationHint&, - const QskSkin*, const QskSkin* ); + const QHash< int, QskColorFilter >&, const QHash< int, QskColorFilter >& ); void addItemAspects( QQuickItem*, const QskAnimationHint&, const QSet< QskAspect >&, - const QskSkin*, const QskSkin* ); + const QskSkinHintTable&, const QskSkinHintTable& ); void update(); @@ -142,7 +147,7 @@ namespace void addHints( const QskControl*, const QskAnimationHint&, const QSet< QskAspect >& candidates, - const QskSkin* skin1, const QskSkin* skin2 ); + const QskSkinHintTable&, const QskSkinHintTable& ); void storeAnimator( const QskControl*, const QskAspect, const QVariant&, const QVariant&, QskAnimationHint ); @@ -150,8 +155,8 @@ namespace void storeUpdateInfo( const QskControl*, QskAspect ); QQuickWindow* m_window; - std::unordered_map< QskAspect, HintAnimator > m_animatorMap; - std::unordered_map< int, QskVariantAnimator > m_graphicFilterAnimatorMap; + QHash< QskAspect, HintAnimator > m_animatorMap; + QHash< int, QskVariantAnimator > m_graphicFilterAnimatorMap; std::vector< UpdateInfo > m_updateInfos; // vector: for fast iteration }; @@ -203,24 +208,24 @@ inline const QQuickWindow* WindowAnimator::window() const void WindowAnimator::start() { for ( auto& it : m_animatorMap ) - it.second.start(); + it.start(); for ( auto& it : m_graphicFilterAnimatorMap ) - it.second.start(); + it.start(); } bool WindowAnimator::isRunning() const { if ( !m_animatorMap.empty() ) { - const auto& animator = m_animatorMap.begin()->second; + const auto& animator = m_animatorMap.constBegin().value(); if ( animator.isRunning() ) return true; } if ( !m_graphicFilterAnimatorMap.empty() ) { - const auto& animator = m_graphicFilterAnimatorMap.begin()->second; + const auto& animator = m_graphicFilterAnimatorMap.constBegin().value(); if ( animator.isRunning() ) return true; } @@ -230,10 +235,10 @@ bool WindowAnimator::isRunning() const inline QVariant WindowAnimator::animatedHint( QskAspect aspect ) const { - auto it = m_animatorMap.find( aspect ); - if ( it != m_animatorMap.cend() ) + auto it = m_animatorMap.constFind( aspect ); + if ( it != m_animatorMap.constEnd() ) { - const auto& animator = it->second; + const auto& animator = it.value(); if ( animator.isRunning() ) return animator.currentValue(); } @@ -243,10 +248,10 @@ inline QVariant WindowAnimator::animatedHint( QskAspect aspect ) const inline QVariant WindowAnimator::animatedGraphicFilter( int graphicRole ) const { - auto it = m_graphicFilterAnimatorMap.find( graphicRole ); - if ( it != m_graphicFilterAnimatorMap.cend() ) + auto it = m_graphicFilterAnimatorMap.constFind( graphicRole ); + if ( it != m_graphicFilterAnimatorMap.constEnd() ) { - const auto& animator = it->second; + const auto& animator = it.value(); if ( animator.isRunning() ) return animator.currentValue(); } @@ -254,22 +259,21 @@ inline QVariant WindowAnimator::animatedGraphicFilter( int graphicRole ) const return QVariant(); } -void WindowAnimator::addGraphicFilterAnimators( const QskAnimationHint& animatorHint, - const QskSkin* skin1, const QskSkin* skin2 ) +void WindowAnimator::addGraphicFilterAnimators( + const QskAnimationHint& animatorHint, + const QHash< int, QskColorFilter >& filters1, + const QHash< int, QskColorFilter >& filters2 ) { const QskColorFilter noFilter; - const auto& filter1 = skin1->graphicFilters(); - const auto& filter2 = skin2->graphicFilters(); - - for ( auto it2 = filter2.begin(); it2 != filter2.end(); ++it2 ) + for ( auto it2 = filters2.constBegin(); it2 != filters2.constEnd(); ++it2 ) { - auto it1 = filter1.find( it2->first ); - if ( it1 == filter1.cend() ) - it1 = filter1.find( 0 ); + auto it1 = filters1.constFind( it2.key() ); + if ( it1 == filters1.constEnd() ) + it1 = filters1.constFind( 0 ); - const auto& f1 = ( it1 != filter1.cend() ) ? it1->second : noFilter; - const auto& f2 = it2->second; + const auto& f1 = ( it1 != filters1.constEnd() ) ? it1.value() : noFilter; + const auto& f2 = it2.value(); if ( f1 != f2 ) { @@ -280,23 +284,24 @@ void WindowAnimator::addGraphicFilterAnimators( const QskAnimationHint& animator animator.setStartValue( QVariant::fromValue( f1 ) ); animator.setEndValue( QVariant::fromValue( f2 ) ); - m_graphicFilterAnimatorMap.emplace( it2->first, animator ); + m_graphicFilterAnimatorMap.emplace( it2.key(), animator ); } } } void WindowAnimator::addItemAspects( QQuickItem* item, const QskAnimationHint& animatorHint, const QSet< QskAspect >& candidates, - const QskSkin* skin1, const QskSkin* skin2 ) + const QskSkinHintTable& table1, const QskSkinHintTable& table2 ) { if ( !item->isVisible() ) return; if ( auto control = qskControlCast( item ) ) { - if ( control->isInitiallyPainted() && ( control->effectiveSkin() == skin2 ) ) + if ( control->isInitiallyPainted() && + qskHasHintTable( control->effectiveSkin(), table2 ) ) { - addHints( control, animatorHint, candidates, skin1, skin2 ); + addHints( control, animatorHint, candidates, table1, table2 ); #if 1 /* As it is hard to identify which controls depend on the animated @@ -310,7 +315,7 @@ void WindowAnimator::addItemAspects( QQuickItem* item, const auto children = item->childItems(); for ( auto child : children ) - addItemAspects( child, animatorHint, candidates, skin1, skin2 ); + addItemAspects( child, animatorHint, candidates, table1, table2 ); } void WindowAnimator::update() @@ -333,15 +338,12 @@ void WindowAnimator::update() void WindowAnimator::addHints( const QskControl* control, const QskAnimationHint& animatorHint, const QSet< QskAspect >& candidates, - const QskSkin* skin1, const QskSkin* skin2 ) + const QskSkinHintTable& table1, const QskSkinHintTable& table2 ) { const auto subControls = control->subControls(); const auto& localTable = control->hintTable(); - const auto& table1 = skin1->hintTable(); - const auto& table2 = skin2->hintTable(); - for ( auto aspect : candidates ) { if ( !isControlAffected( control, subControls, aspect ) ) @@ -548,8 +550,12 @@ void ApplicationAnimator::cleanup( QQuickWindow* window ) class QskSkinTransition::PrivateData { public: - QskSkin* skins[ 2 ] = {}; - QskAnimationHint animationHint; + struct + { + QskSkinHintTable hintTable; + QHash< int, QskColorFilter > graphicFilters; + } tables[ 2 ]; + Type mask = QskSkinTransition::AllTypes; }; @@ -572,57 +578,38 @@ QskSkinTransition::Type QskSkinTransition::mask() const return m_data->mask; } -void QskSkinTransition::setSourceSkin( QskSkin* skin ) +void QskSkinTransition::setSourceSkin( const QskSkin* skin ) { - m_data->skins[ 0 ] = skin; + auto& tables = m_data->tables[ 0 ]; + + tables.hintTable = skin->hintTable(); + tables.graphicFilters = skin->graphicFilters(); } -QskSkin* QskSkinTransition::sourceSkin() const +void QskSkinTransition::setTargetSkin( const QskSkin* skin ) { - return m_data->skins[ 0 ]; + auto& tables = m_data->tables[ 1 ]; + + tables.hintTable = skin->hintTable(); + tables.graphicFilters = skin->graphicFilters(); } -void QskSkinTransition::setTargetSkin( QskSkin* skin ) -{ - m_data->skins[ 1 ] = skin; -} - -QskSkin* QskSkinTransition::targetSkin() const -{ - return m_data->skins[ 1 ]; -} - -void QskSkinTransition::setAnimation( QskAnimationHint animationHint ) -{ - m_data->animationHint = animationHint; -} - -QskAnimationHint QskSkinTransition::animation() const -{ - return m_data->animationHint; -} - -void QskSkinTransition::updateSkin( QskSkin*, QskSkin* ) -{ - // nop -} - -void QskSkinTransition::process() +void QskSkinTransition::run( const QskAnimationHint& animationHint ) { qskApplicationAnimator->reset(); - auto skin1 = m_data->skins[ 0 ]; - auto skin2 = m_data->skins[ 1 ]; + const auto& table1 = m_data->tables[ 0 ].hintTable; + const auto& table2 = m_data->tables[ 1 ].hintTable; + + const auto& graphicFilters1 = m_data->tables[ 0 ].graphicFilters; + const auto& graphicFilters2 = m_data->tables[ 1 ].graphicFilters; QSet< QskAspect > candidates; - if ( skin1 && skin2 ) + if ( ( animationHint.duration > 0 ) && ( m_data->mask != 0 ) ) { - if ( ( m_data->animationHint.duration > 0 ) && ( m_data->mask != 0 ) ) - { - qskAddCandidates( m_data->mask, skin1, candidates ); - qskAddCandidates( m_data->mask, skin2, candidates ); - } + qskAddCandidates( m_data->mask, table1.hints(), candidates ); + qskAddCandidates( m_data->mask, table2.hints(), candidates ); } if ( !candidates.isEmpty() ) @@ -635,17 +622,18 @@ void QskSkinTransition::process() { if ( auto w = qobject_cast< QQuickWindow* >( window ) ) { - if ( !w->isVisible() || ( qskEffectiveSkin( w ) != skin2 ) ) - { + if ( !w->isVisible() ) + continue; + + if ( !qskHasHintTable( qskEffectiveSkin( w ), table2 ) ) continue; - } auto animator = new WindowAnimator( w ); if ( doGraphicFilter ) { - animator->addGraphicFilterAnimators( - m_data->animationHint, skin1, skin2 ); + animator->addGraphicFilterAnimators( animationHint, + graphicFilters1, graphicFilters2 ); doGraphicFilter = false; } @@ -656,7 +644,7 @@ void QskSkinTransition::process() */ animator->addItemAspects( w->contentItem(), - m_data->animationHint, candidates, skin1, skin2 ); + animationHint, candidates, table1, table2 ); qskApplicationAnimator->add( animator ); } @@ -664,9 +652,6 @@ void QskSkinTransition::process() qskApplicationAnimator->start(); } - - // apply the changes - updateSkin( skin1, skin2 ); } bool QskSkinTransition::isRunning() diff --git a/src/controls/QskSkinTransition.h b/src/controls/QskSkinTransition.h index 79598897..58d5da6f 100644 --- a/src/controls/QskSkinTransition.h +++ b/src/controls/QskSkinTransition.h @@ -9,10 +9,12 @@ #include "QskAspect.h" #include -class QskSkin; class QskAnimationHint; +class QskSkin; + class QQuickWindow; class QVariant; +template< typename Key, typename T > class QHash; class QSK_EXPORT QskSkinTransition { @@ -28,27 +30,18 @@ class QSK_EXPORT QskSkinTransition QskSkinTransition(); virtual ~QskSkinTransition(); - void setSourceSkin( QskSkin* ); - QskSkin* sourceSkin() const; - - void setTargetSkin( QskSkin* ); - QskSkin* targetSkin() const; - - void setAnimation( QskAnimationHint ); - QskAnimationHint animation() const; + void setSourceSkin( const QskSkin* ); + void setTargetSkin( const QskSkin* ); void setMask( Type ); Type mask() const; - void process(); + void run( const QskAnimationHint& ); static bool isRunning(); static QVariant animatedHint( const QQuickWindow*, QskAspect ); static QVariant animatedGraphicFilter( const QQuickWindow*, int graphicRole ); - protected: - virtual void updateSkin( QskSkin*, QskSkin* ); - private: Q_DISABLE_COPY( QskSkinTransition ) diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index 7a447f79..1fd93d00 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -152,23 +152,13 @@ void Skinny::setSkin( int index, QskAnimationHint hint ) if ( index == names.indexOf( qskSkinManager->skinName() ) ) return; - auto oldSkin = qskSkinManager->skin(); - if ( oldSkin->parent() == qskSkinManager ) - oldSkin->setParent( nullptr ); // otherwise setSkin deletes it + QskSkinTransition transition; + transition.setSourceSkin( qskSkinManager->skin() ); - if ( auto newSkin = qskSkinManager->setSkin( names[ index ] ) ) + if ( auto skin = qskSkinManager->setSkin( names[ index ] ) ) { - QskSkinTransition transition; - - //transition.setMask( QskAspect::Color ); // Metrics are flickering -> TODO - transition.setSourceSkin( oldSkin ); - transition.setTargetSkin( newSkin ); - transition.setAnimation( hint ); - - transition.process(); - - if ( oldSkin->parent() == nullptr ) - delete oldSkin; + transition.setTargetSkin( skin ); + transition.run( hint ); } } @@ -178,10 +168,10 @@ void Skinny::changeFonts( int increment ) const auto fonts = skin->fonts(); - for ( auto it = fonts.begin(); it != fonts.end(); ++it ) + for ( auto it = fonts.constBegin(); it != fonts.constEnd(); ++it ) { - auto role = it->first; - auto font = it->second; + auto role = it.key(); + auto font = it.value(); if ( font.pixelSize() > 0 ) { From c1fdb03563b3a1eb6641ab1ac0896448497a2462 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 13:30:58 +0100 Subject: [PATCH 23/27] Qt5 incompatibility fixed --- src/controls/QskSkinHintTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls/QskSkinHintTable.cpp b/src/controls/QskSkinHintTable.cpp index 145e6989..6c68dcbf 100644 --- a/src/controls/QskSkinHintTable.cpp +++ b/src/controls/QskSkinHintTable.cpp @@ -133,7 +133,7 @@ bool QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint ) auto it = m_hints->find( aspect ); if ( it == m_hints->end() ) { - m_hints->emplace( aspect, skinHint ); + m_hints->insert( aspect, skinHint ); if ( aspect.isAnimator() ) { From 26ba1201142558d73b9278140f9c33c4c9688d5c Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 13:32:36 +0100 Subject: [PATCH 24/27] QskGraphicProviderMap::clear added --- src/graphic/QskGraphicProviderMap.cpp | 10 +++++++--- src/graphic/QskGraphicProviderMap.h | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/graphic/QskGraphicProviderMap.cpp b/src/graphic/QskGraphicProviderMap.cpp index b60112bf..6121e169 100644 --- a/src/graphic/QskGraphicProviderMap.cpp +++ b/src/graphic/QskGraphicProviderMap.cpp @@ -28,9 +28,13 @@ QskGraphicProviderMap::QskGraphicProviderMap() QskGraphicProviderMap::~QskGraphicProviderMap() { - const auto& hashTab = m_data->hashTab; - for ( auto it = hashTab.constBegin(); it != hashTab.constEnd(); ++it ) - delete it.value(); + qDeleteAll( m_data->hashTab ); +} + +void QskGraphicProviderMap::clear() +{ + qDeleteAll( m_data->hashTab ); + m_data->hashTab.clear(); } void QskGraphicProviderMap::insert( diff --git a/src/graphic/QskGraphicProviderMap.h b/src/graphic/QskGraphicProviderMap.h index 30952172..8fd2211b 100644 --- a/src/graphic/QskGraphicProviderMap.h +++ b/src/graphic/QskGraphicProviderMap.h @@ -23,8 +23,9 @@ class QskGraphicProviderMap void remove( const QString& providerId ); void remove( QskGraphicProvider* ); - QskGraphicProvider* take( const QString& providerId ); + void clear(); + QskGraphicProvider* take( const QString& providerId ); QskGraphicProvider* provider( const QString& providerId ) const; int size() const; From 3873e07765c7e8bcce149216f9b97514468a5d14 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 14:41:38 +0100 Subject: [PATCH 25/27] Qt5 incompatibilities fixed --- src/controls/QskSkin.cpp | 2 +- src/controls/QskSkinTransition.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 0d42201d..1d9952bc 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -243,7 +243,7 @@ void QskSkin::declareSkinlet( const QMetaObject* metaObject, } else { - m_data->skinletMap.emplace( metaObject, skinletMetaObject ); + m_data->skinletMap.insert( metaObject, skinletMetaObject ); } } diff --git a/src/controls/QskSkinTransition.cpp b/src/controls/QskSkinTransition.cpp index f2c35565..131440ec 100644 --- a/src/controls/QskSkinTransition.cpp +++ b/src/controls/QskSkinTransition.cpp @@ -284,7 +284,7 @@ void WindowAnimator::addGraphicFilterAnimators( animator.setStartValue( QVariant::fromValue( f1 ) ); animator.setEndValue( QVariant::fromValue( f2 ) ); - m_graphicFilterAnimatorMap.emplace( it2.key(), animator ); + m_graphicFilterAnimatorMap.insert( it2.key(), animator ); } } } @@ -435,7 +435,7 @@ inline void WindowAnimator::storeAnimator( const QskControl* control, const QskA { if ( m_animatorMap.find( aspect ) == m_animatorMap.cend() ) { - m_animatorMap.emplace( aspect, + m_animatorMap.insert( aspect, HintAnimator( control, aspect, value1, value2, hint ) ); } } From 5aa46b3ccc30c2462fdf344246b22584f2c6412d Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 14:52:40 +0100 Subject: [PATCH 26/27] Qt::ColorScheme handling added to QskSkin - no more multiple skins for dark/light. --- designsystems/fluent2/QskFluent2Skin.cpp | 41 +++++++++ designsystems/fluent2/QskFluent2Skin.h | 8 +- .../fluent2/QskFluent2SkinFactory.cpp | 76 +--------------- designsystems/fluent2/metadata.json | 3 +- designsystems/fusion/QskFusionSkin.cpp | 18 ++-- designsystems/fusion/QskFusionSkin.h | 5 +- designsystems/fusion/QskFusionSkinFactory.cpp | 12 +-- designsystems/fusion/metadata.json | 3 +- designsystems/material3/QskMaterial3Skin.cpp | 40 ++++---- designsystems/material3/QskMaterial3Skin.h | 5 +- .../material3/QskMaterial3SkinFactory.cpp | 17 +--- designsystems/material3/metadata.json | 3 +- examples/iotdashboard/Skin.cpp | 80 ++++++++-------- examples/iotdashboard/Skin.h | 31 +------ examples/iotdashboard/main.cpp | 60 +----------- examples/mycontrols/MySkin.cpp | 8 +- examples/mycontrols/main.cpp | 3 +- playground/dials/CMakeLists.txt | 2 +- playground/dials/Skin.cpp | 70 ++++++++++++++ playground/dials/{SkinFactory.h => Skin.h} | 11 +-- playground/dials/SkinFactory.cpp | 91 ------------------- playground/dials/main.cpp | 9 +- src/controls/QskSkin.cpp | 31 +++++++ src/controls/QskSkin.h | 12 +++ src/controls/QskSkinManager.cpp | 82 +++++++++-------- src/controls/QskSkinManager.h | 6 +- support/SkinnyNamespace.cpp | 17 ++++ support/SkinnyNamespace.h | 1 + support/SkinnyShortcut.cpp | 7 ++ support/SkinnyShortcut.h | 14 +-- 30 files changed, 366 insertions(+), 400 deletions(-) create mode 100644 playground/dials/Skin.cpp rename playground/dials/{SkinFactory.h => Skin.h} (61%) delete mode 100644 playground/dials/SkinFactory.cpp diff --git a/designsystems/fluent2/QskFluent2Skin.cpp b/designsystems/fluent2/QskFluent2Skin.cpp index 240c23d7..4ba40a5a 100644 --- a/designsystems/fluent2/QskFluent2Skin.cpp +++ b/designsystems/fluent2/QskFluent2Skin.cpp @@ -1965,6 +1965,47 @@ QskFluent2Skin::~QskFluent2Skin() { } +void QskFluent2Skin::initHints() +{ + struct + { + QskFluent2Theme::BaseColors baseColors; + QskFluent2Theme::AccentColors accentColors; + } colors[2]; + + if( colorScheme() != QskSkin::DarkScheme ) + { + colors[0].baseColors = { rgbGray( 243 ), rgbGray( 249 ), rgbGray( 238 ) }; + colors[0].accentColors = { 0xff0078d4, 0xff005eb7, 0xff003d92, 0xff001968 }; + + colors[1].baseColors = { rgbGray( 249 ), rgbGray( 249 ), rgbGray( 238 ) }; + colors[1].accentColors = colors[0].accentColors; + } + else + { + colors[0].baseColors = { rgbGray( 32 ), rgbGray( 40 ), rgbGray( 28 ) }; + colors[0].accentColors = { 0xff0078d4, 0xff0093f9, 0xff60ccfe, 0xff98ecfe }; + + colors[1].baseColors = { rgbGray( 40 ), rgbGray( 44 ), rgbGray( 28 ) }; + colors[1].accentColors = colors[0].accentColors; + } + + setupFonts(); + + Editor editor( &hintTable() ); + editor.setupMetrics(); + + const QskFluent2Theme themeBody( colorScheme(), + colors[0].baseColors, colors[0].accentColors ); + + const QskFluent2Theme themeHeader( colorScheme(), + colors[1].baseColors, colors[1].accentColors ); + + addTheme( QskAspect::Body, themeBody ); + addTheme( QskAspect::Header, themeHeader ); + addTheme( QskAspect::Footer, themeHeader ); +} + void QskFluent2Skin::setupFonts() { static QString fontName( QStringLiteral( "Segoe UI Variable" ) ); diff --git a/designsystems/fluent2/QskFluent2Skin.h b/designsystems/fluent2/QskFluent2Skin.h index c0be6488..239a73a8 100644 --- a/designsystems/fluent2/QskFluent2Skin.h +++ b/designsystems/fluent2/QskFluent2Skin.h @@ -21,9 +21,6 @@ class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin QskFluent2Skin( QObject* parent = nullptr ); ~QskFluent2Skin() override; - void addTheme( QskAspect::Section, const QskFluent2Theme& ); - void setup(); - enum GraphicRole { GraphicRoleFillColorTextDisabled, @@ -49,7 +46,12 @@ class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin static constexpr QskAspect::Variation Standard = QskAspect::NoVariation; static constexpr QskAspect::Variation Accent = QskAspect::Large; + protected: + void initHints() override; + private: + void addTheme( QskAspect::Section, const QskFluent2Theme& ); + void setupFonts(); void setupGraphicFilters( const QskFluent2Theme& ); void setGraphicColor( GraphicRole, QRgb ); diff --git a/designsystems/fluent2/QskFluent2SkinFactory.cpp b/designsystems/fluent2/QskFluent2SkinFactory.cpp index b9beb18d..10331b83 100644 --- a/designsystems/fluent2/QskFluent2SkinFactory.cpp +++ b/designsystems/fluent2/QskFluent2SkinFactory.cpp @@ -5,18 +5,8 @@ #include "QskFluent2SkinFactory.h" #include "QskFluent2Skin.h" -#include "QskFluent2Theme.h" -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 ); - } -} +static const QString name = QStringLiteral( "Fluent2" ); QskFluent2SkinFactory::QskFluent2SkinFactory( QObject* parent ) : QskSkinFactory( parent ) @@ -29,71 +19,15 @@ QskFluent2SkinFactory::~QskFluent2SkinFactory() QStringList QskFluent2SkinFactory::skinNames() const { - return { nameLight, nameDark }; + return { name }; } QskSkin* QskFluent2SkinFactory::createSkin( const QString& skinName ) { - QskSkin::ColorScheme colorScheme; + if ( QString::compare( skinName, name, Qt::CaseInsensitive ) == 0 ) + return new QskFluent2Skin(); - if ( QString::compare( skinName, nameLight, Qt::CaseInsensitive ) == 0 ) - { - colorScheme = QskSkin::LightScheme; - } - else if ( QString::compare( skinName, nameDark, Qt::CaseInsensitive ) == 0 ) - { - colorScheme = QskSkin::DarkScheme; - } - else - { - 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; + return nullptr; } #include "moc_QskFluent2SkinFactory.cpp" diff --git a/designsystems/fluent2/metadata.json b/designsystems/fluent2/metadata.json index 6eb6982c..26b35df1 100644 --- a/designsystems/fluent2/metadata.json +++ b/designsystems/fluent2/metadata.json @@ -1,5 +1,4 @@ { "FactoryId": "Fluent2Factory", - "Skins": [ { "Name": "Fluent2 Light", "Scheme": "Light" }, - { "Name": "Fluent2 Dark", "Scheme": "Dark" } ] + "Skins": [ "Fluent2" ] } diff --git a/designsystems/fusion/QskFusionSkin.cpp b/designsystems/fusion/QskFusionSkin.cpp index d356e59d..c26e4215 100644 --- a/designsystems/fusion/QskFusionSkin.cpp +++ b/designsystems/fusion/QskFusionSkin.cpp @@ -1297,14 +1297,24 @@ void Editor::setupSubWindow() setAnimation( Q::Panel | A::Position, 100, QEasingCurve::OutCubic ); } -QskFusionSkin::QskFusionSkin( QskSkin::ColorScheme colorScheme, QObject* parent ) +QskFusionSkin::QskFusionSkin( QObject* parent ) : Inherited( parent ) { +} + +QskFusionSkin::~QskFusionSkin() +{ +} + +void QskFusionSkin::initHints() +{ + clearHints(); + using P = QPalette; setupFonts( QStringLiteral( "Roboto" ) ); - const QskFusionPalette palette( colorScheme ); + const QskFusionPalette palette( colorScheme() ); setGraphicColor( GraphicNormal, palette.active( P::Text ) ); setGraphicColor( GraphicDisabled, palette.disabled( P::Text ) ); @@ -1316,10 +1326,6 @@ QskFusionSkin::QskFusionSkin( QskSkin::ColorScheme colorScheme, QObject* parent editor.setup(); } -QskFusionSkin::~QskFusionSkin() -{ -} - void QskFusionSkin::setGraphicColor( GraphicRole role, QRgb rgb ) { QskColorFilter colorFilter; diff --git a/designsystems/fusion/QskFusionSkin.h b/designsystems/fusion/QskFusionSkin.h index 479127c7..c3feb9e7 100644 --- a/designsystems/fusion/QskFusionSkin.h +++ b/designsystems/fusion/QskFusionSkin.h @@ -16,7 +16,7 @@ class QSK_FUSION_EXPORT QskFusionSkin : public QskSkin using Inherited = QskSkin; public: - QskFusionSkin( QskSkin::ColorScheme, QObject* parent = nullptr ); + QskFusionSkin( QObject* parent = nullptr ); ~QskFusionSkin() override; enum GraphicRole @@ -27,6 +27,9 @@ class QSK_FUSION_EXPORT QskFusionSkin : public QskSkin GraphicError }; + protected: + void initHints() override; + private: void setGraphicColor( GraphicRole, QRgb ); }; diff --git a/designsystems/fusion/QskFusionSkinFactory.cpp b/designsystems/fusion/QskFusionSkinFactory.cpp index 87f0ab56..5962e2f4 100644 --- a/designsystems/fusion/QskFusionSkinFactory.cpp +++ b/designsystems/fusion/QskFusionSkinFactory.cpp @@ -6,8 +6,7 @@ #include "QskFusionSkinFactory.h" #include "QskFusionSkin.h" -static const QStringList fusionSkinNames = - { QStringLiteral( "Fusion Light" ), QStringLiteral( "Fusion Dark" ) }; +static const QString name = QStringLiteral( "Fusion" ); QskFusionSkinFactory::QskFusionSkinFactory( QObject* parent ) : QskSkinFactory( parent ) @@ -20,16 +19,13 @@ QskFusionSkinFactory::~QskFusionSkinFactory() QStringList QskFusionSkinFactory::skinNames() const { - return fusionSkinNames; + return { name }; } QskSkin* QskFusionSkinFactory::createSkin( const QString& skinName ) { - if ( QString::compare( skinName, fusionSkinNames[0], Qt::CaseInsensitive ) == 0 ) - return new QskFusionSkin( QskSkin::LightScheme ); - - if ( QString::compare( skinName, fusionSkinNames[1], Qt::CaseInsensitive ) == 0 ) - return new QskFusionSkin( QskSkin::DarkScheme ); + if ( QString::compare( skinName, name, Qt::CaseInsensitive ) == 0 ) + return new QskFusionSkin(); return nullptr; } diff --git a/designsystems/fusion/metadata.json b/designsystems/fusion/metadata.json index 9c2912d4..3071216f 100644 --- a/designsystems/fusion/metadata.json +++ b/designsystems/fusion/metadata.json @@ -1,5 +1,4 @@ { "FactoryId": "FusionFactory", - "Skins": [ { "Name": "Fusion Light", "Scheme": "Light" }, - { "Name": "Fusion Dark", "Scheme": "Dark" } ] + "Skins": [ "Fusion" ] } diff --git a/designsystems/material3/QskMaterial3Skin.cpp b/designsystems/material3/QskMaterial3Skin.cpp index c9b868d5..2f3ac9e0 100644 --- a/designsystems/material3/QskMaterial3Skin.cpp +++ b/designsystems/material3/QskMaterial3Skin.cpp @@ -76,9 +76,9 @@ namespace Q_GADGET public: - Editor( QskSkinHintTable* table, const QskMaterial3Theme& palette ) + Editor( QskSkinHintTable* table, const QskMaterial3Theme& theme ) : QskSkinHintTableEditor( table ) - , m_pal( palette ) + , m_pal( theme ) { } @@ -1393,14 +1393,9 @@ QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme, shapeExtraSmallTop = QskBoxShapeMetrics( 4_dp, 4_dp, 0, 0 ); } -QskMaterial3Skin::QskMaterial3Skin( const QskMaterial3Theme& palette, QObject* parent ) +QskMaterial3Skin::QskMaterial3Skin( QObject* parent ) : Inherited( parent ) { - setupFonts(); - setupGraphicFilters( palette ); - - Editor editor( &hintTable(), palette ); - editor.setup(); } QskMaterial3Skin::~QskMaterial3Skin() @@ -1429,16 +1424,27 @@ void QskMaterial3Skin::setGraphicColor( GraphicRole role, QRgb rgb ) setGraphicFilter( role, colorFilter ); } -void QskMaterial3Skin::setupGraphicFilters( const QskMaterial3Theme& palette ) +void QskMaterial3Skin::setupGraphicFilters( const QskMaterial3Theme& theme ) { - setGraphicColor( GraphicRoleOnPrimary, palette.onPrimary ); - setGraphicColor( GraphicRoleOnSecondaryContainer, palette.onSecondaryContainer ); - setGraphicColor( GraphicRoleOnError, palette.onError ); - setGraphicColor( GraphicRoleOnSurface, palette.onSurface ); - setGraphicColor( GraphicRoleOnSurface38, palette.onSurface38 ); - setGraphicColor( GraphicRoleOnSurfaceVariant, palette.onSurfaceVariant ); - setGraphicColor( GraphicRolePrimary, palette.primary ); - setGraphicColor( GraphicRoleSurface, palette.surface ); + setGraphicColor( GraphicRoleOnPrimary, theme.onPrimary ); + setGraphicColor( GraphicRoleOnSecondaryContainer, theme.onSecondaryContainer ); + setGraphicColor( GraphicRoleOnError, theme.onError ); + setGraphicColor( GraphicRoleOnSurface, theme.onSurface ); + setGraphicColor( GraphicRoleOnSurface38, theme.onSurface38 ); + setGraphicColor( GraphicRoleOnSurfaceVariant, theme.onSurfaceVariant ); + setGraphicColor( GraphicRolePrimary, theme.primary ); + setGraphicColor( GraphicRoleSurface, theme.surface ); +} + +void QskMaterial3Skin::initHints() +{ + const QskMaterial3Theme theme( colorScheme() ); + + setupFonts(); + setupGraphicFilters( theme ); + + Editor editor( &hintTable(), theme ); + editor.setup(); } #include "moc_QskMaterial3Skin.cpp" diff --git a/designsystems/material3/QskMaterial3Skin.h b/designsystems/material3/QskMaterial3Skin.h index bcdf3325..95a89310 100644 --- a/designsystems/material3/QskMaterial3Skin.h +++ b/designsystems/material3/QskMaterial3Skin.h @@ -103,7 +103,7 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin using Inherited = QskSkin; public: - QskMaterial3Skin( const QskMaterial3Theme&, QObject* parent = nullptr ); + QskMaterial3Skin( QObject* parent = nullptr ); ~QskMaterial3Skin() override; enum GraphicRole @@ -132,6 +132,9 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin static constexpr QskAspect::Variation Outlined = QskAspect::Small; static constexpr QskAspect::Variation Text = QskAspect::Tiny; + protected: + void initHints() override; + private: void setupFonts(); void setupGraphicFilters( const QskMaterial3Theme& ); diff --git a/designsystems/material3/QskMaterial3SkinFactory.cpp b/designsystems/material3/QskMaterial3SkinFactory.cpp index 16c2f6dd..3f3e6653 100644 --- a/designsystems/material3/QskMaterial3SkinFactory.cpp +++ b/designsystems/material3/QskMaterial3SkinFactory.cpp @@ -6,8 +6,7 @@ #include "QskMaterial3SkinFactory.h" #include "QskMaterial3Skin.h" -static const QString materialLightSkinName = QStringLiteral( "Material3 Light" ); -static const QString materialDarkSkinName = QStringLiteral( "Material3 Dark" ); +static const QString name = QStringLiteral( "Material3" ); QskMaterial3SkinFactory::QskMaterial3SkinFactory( QObject* parent ) : QskSkinFactory( parent ) @@ -20,21 +19,13 @@ QskMaterial3SkinFactory::~QskMaterial3SkinFactory() QStringList QskMaterial3SkinFactory::skinNames() const { - return { materialLightSkinName, materialDarkSkinName }; + return { name }; } QskSkin* QskMaterial3SkinFactory::createSkin( const QString& skinName ) { - if ( QString::compare( skinName, materialLightSkinName, Qt::CaseInsensitive ) == 0 ) - { - QskMaterial3Theme theme( QskSkin::LightScheme ); - return new QskMaterial3Skin( theme ); - } - else if ( QString::compare( skinName, materialDarkSkinName, Qt::CaseInsensitive ) == 0 ) - { - QskMaterial3Theme theme( QskSkin::DarkScheme ); - return new QskMaterial3Skin( theme ); - } + if ( QString::compare( skinName, name, Qt::CaseInsensitive ) == 0 ) + return new QskMaterial3Skin(); return nullptr; } diff --git a/designsystems/material3/metadata.json b/designsystems/material3/metadata.json index ef789842..8fc2ab9d 100644 --- a/designsystems/material3/metadata.json +++ b/designsystems/material3/metadata.json @@ -1,5 +1,4 @@ { "FactoryId": "Material3Factory", - "Skins": [ { "Name": "Material3 Light", "Scheme": "Light" }, - { "Name": "Material3 Dark", "Scheme": "Dark" } ] + "Skins": [ "Material3" ] } diff --git a/examples/iotdashboard/Skin.cpp b/examples/iotdashboard/Skin.cpp index f369c58f..24392fe6 100644 --- a/examples/iotdashboard/Skin.cpp +++ b/examples/iotdashboard/Skin.cpp @@ -57,23 +57,27 @@ namespace } } -Skin::Skin( const Palette& palette, QObject* parent ) +Skin::Skin( QObject* parent ) : QskSkin( parent ) { + setObjectName( "iot" ); + declareSkinlet< CircularProgressBar, CircularProgressBarSkinlet >(); declareSkinlet< Diagram, DiagramSkinlet >(); declareSkinlet< LightDisplay, LightDisplaySkinlet >(); declareSkinlet< StorageBar, StorageBarSkinlet >(); - initHints( palette ); + setColorScheme( LightScheme ); } Skin::~Skin() { } -void Skin::initHints( const Palette& palette ) +void Skin::initHints() { + const auto palette = Skin::palette( colorScheme() ); + QFontDatabase db; db.addApplicationFont( ":/fonts/ProximaNova-Regular.otf" ); // ### use fontconfig @@ -311,39 +315,41 @@ void Skin::initHints( const Palette& palette ) } } -Skin::Palette DaytimeSkin::palette() const +Skin::Palette Skin::palette( QskSkin::ColorScheme colorScheme ) const { - return { - 0xff6d7bfb, - 0xfffbfbfb, - Qt::white, - 0xfff7f7f7, - 0xffe5e5e5, - 0xfff4f4f4, - Qt::black, - 0xffe5e5e5, - 0xffc4c4c4, - { { { 0.0, 0xffff3122 }, { 0.2, 0xfffeeeb7 }, { 0.3, 0xffa7b0ff }, { 0.5, 0xff6776ff }, - { 1.0, Qt::black } } }, - 0x10000000, - 0xffdddddd - }; -} - -Skin::Palette NighttimeSkin::palette() const -{ - return { - 0xff2937A7, - 0xff040404, - Qt::black, - 0xff0a0a0a, - 0xff1a1a1a, - 0xff0c0c0c, - Qt::white, - 0xff4a4a4a, - 0xff555555, - { { { 0.0, 0xff991100 }, { 0.2, 0xff9a7a57 }, { 0.5, 0xff3726af }, { 1.0, Qt::black } } }, - 0x10ffffff, - 0xff222222 - }; + if ( colorScheme == DarkScheme ) + { + return { + 0xff2937A7, + 0xff040404, + Qt::black, + 0xff0a0a0a, + 0xff1a1a1a, + 0xff0c0c0c, + Qt::white, + 0xff4a4a4a, + 0xff555555, + { { { 0.0, 0xff991100 }, { 0.2, 0xff9a7a57 }, { 0.5, 0xff3726af }, { 1.0, Qt::black } } }, + 0x10ffffff, + 0xff222222 + }; + } + else + { + return { + 0xff6d7bfb, + 0xfffbfbfb, + Qt::white, + 0xfff7f7f7, + 0xffe5e5e5, + 0xfff4f4f4, + Qt::black, + 0xffe5e5e5, + 0xffc4c4c4, + { { { 0.0, 0xffff3122 }, { 0.2, 0xfffeeeb7 }, { 0.3, 0xffa7b0ff }, { 0.5, 0xff6776ff }, + { 1.0, Qt::black } } }, + 0x10000000, + 0xffdddddd + }; + } } diff --git a/examples/iotdashboard/Skin.h b/examples/iotdashboard/Skin.h index b692f2e0..1b0d18d1 100644 --- a/examples/iotdashboard/Skin.h +++ b/examples/iotdashboard/Skin.h @@ -27,7 +27,7 @@ class Skin : public QskSkin QRgb deviceGraphic; }; - Skin( const Palette& palette, QObject* parent = nullptr ); + Skin( QObject* parent = nullptr ); ~Skin() override; enum SkinFontRole @@ -36,29 +36,8 @@ class Skin : public QskSkin }; private: - void initHints( const Palette& palette ); -}; - -class DaytimeSkin : public Skin -{ - public: - DaytimeSkin( QObject* parent = nullptr ) - : Skin( palette(), parent ) - { - } - - private: - Palette palette() const; -}; - -class NighttimeSkin : public Skin -{ - public: - NighttimeSkin( QObject* parent = nullptr ) - : Skin( palette(), parent ) - { - } - - private: - Palette palette() const; + void initHints() override; + + Palette palette( ColorScheme ) const; + void initHints( const Palette& ); }; diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index 46410360..bbd0ddaa 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -11,50 +11,15 @@ #include #endif +#include #include #include -#include -#include #include #include #include #include -namespace -{ - class SkinFactory : public QskSkinFactory - { - Q_OBJECT - - public: - SkinFactory( QObject* parent = nullptr ) - : QskSkinFactory( parent ) - { - } - - QStringList skinNames() const override - { - return { "DaytimeSkin", "NighttimeSkin" }; - } - - QskSkin* createSkin( const QString& skinName ) override - { - if( skinName == "DaytimeSkin" ) - { - return new DaytimeSkin; - } - - if( skinName == "NighttimeSkin" ) - { - return new NighttimeSkin; - } - - return nullptr; - } - }; -} - int main( int argc, char* argv[] ) { #ifdef ITEM_STATISTICS @@ -64,27 +29,14 @@ int main( int argc, char* argv[] ) QGuiApplication app( argc, argv ); qskSetup->setItemUpdateFlag( QskQuickItem::PreferRasterForTextures, true ); + qskSkinManager->setSkin( new Skin() ); Qsk::addGraphicProvider( QString(), new GraphicProvider() ); - // disable default skins - qskSkinManager->setPluginPaths( QStringList() ); // no plugins -#if 1 - // we should find a better way: TODO ... - qskSkinManager->unregisterFactory( "material3factory" ); - qskSkinManager->unregisterFactory( "fusionfactory" ); - qskSkinManager->unregisterFactory( "fluent2factory" ); -#endif - - qskSkinManager->registerFactory( - QStringLiteral( "SampleSkinFactory" ), new SkinFactory() ); - - qskSkinManager->setSkin( "DaytimeSkin" ); - #ifdef USE_SHORTCUTS - // With CTRL-B you can rotate a couple of visual debug modes - SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground | - SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); + SkinnyShortcut::enable( SkinnyShortcut::ChangeColorScheme + | SkinnyShortcut::DebugBackground | SkinnyShortcut::DebugStatistics + | SkinnyShortcut::Quit ); #endif MainWindow window; @@ -103,5 +55,3 @@ int main( int argc, char* argv[] ) return app.exec(); } - -#include "main.moc" diff --git a/examples/mycontrols/MySkin.cpp b/examples/mycontrols/MySkin.cpp index fadc8d79..eb0f6176 100644 --- a/examples/mycontrols/MySkin.cpp +++ b/examples/mycontrols/MySkin.cpp @@ -179,8 +179,8 @@ namespace { class SkinBlue : public MySkin { - public: - SkinBlue() + protected: + void initHints() override { using namespace QskRgb; @@ -201,8 +201,8 @@ namespace class SkinPink : public MySkin { - public: - SkinPink() + protected: + void initHints() override { using namespace QskRgb; diff --git a/examples/mycontrols/main.cpp b/examples/mycontrols/main.cpp index 216ce3be..425c953c 100644 --- a/examples/mycontrols/main.cpp +++ b/examples/mycontrols/main.cpp @@ -17,8 +17,9 @@ #include #include #include -#include +#include #include +#include #include diff --git a/playground/dials/CMakeLists.txt b/playground/dials/CMakeLists.txt index a7da047e..6af239ad 100644 --- a/playground/dials/CMakeLists.txt +++ b/playground/dials/CMakeLists.txt @@ -4,7 +4,7 @@ ############################################################################ set(SOURCES - SkinFactory.h SkinFactory.cpp + Skin.h Skin.cpp Dial.h Dial.cpp DialSkinlet.h DialSkinlet.cpp Dashboard.h Dashboard.cpp diff --git a/playground/dials/Skin.cpp b/playground/dials/Skin.cpp new file mode 100644 index 00000000..7a0e79f9 --- /dev/null +++ b/playground/dials/Skin.cpp @@ -0,0 +1,70 @@ +/****************************************************************************** + * QSkinny - Copyright (C) The authors + * SPDX-License-Identifier: BSD-3-Clause + *****************************************************************************/ + +#include "Skin.h" +#include "Dial.h" +#include "DialSkinlet.h" + +#include +#include +#include +#include +#include + +static inline QFont qskFont( qreal pointSize ) +{ + QFont font( "Roboto" ); + font.setPointSizeF( pointSize / qskDpToPixels( 1.0 ) ); + return font; +} + +Skin::Skin() +{ + declareSkinlet< Dial, DialSkinlet >(); + initHints(); +} + +void Skin::initHints() +{ + using namespace QskRgb; + + setFont( QskSkin::DefaultFont, qskFont( 13 ) ); + setFont( QskSkin::LargeFont, qskFont( 20 ) ); + + const auto rgb1 = qRgb( 1, 16, 27 ); // Maastricht blue + const auto rgb2 = qRgb( 255, 0, 22 ); // Ruddy + const auto rgb3 = qRgb( 41, 234, 212 ); // Turquoise + const auto rgb4 = qRgb( 253, 255, 252 ); // baby powder + + QskSkinHintTableEditor ed( &hintTable() ); + + ed.setColor( QskTextLabel::Text, rgb4 ); + + { + using Q = Dial; + + ed.setBoxBorderMetrics( Q::Panel, 2 ); + ed.setBoxShape( Q::Panel, 100, Qt::RelativeSize ); + ed.setGradient( Q::Panel, rgb1 ); + ed.setBoxBorderColors( Q::Panel, rgb3 ); + + ed.setBoxBorderMetrics( Q::Knob, 2 ); + ed.setStrutSize( Q::Knob, 30, 30 ); + ed.setBoxShape( Q::Knob, 100, Qt::RelativeSize ); + + QskGradient gradient( rgb2, rgb1 ); + gradient.setLinearDirection( 0.0, 0.0, 1.0, 1.0 ); + ed.setGradient( Q::Knob, gradient ); + + ed.setMetric( Q::Needle | QskAspect::Size, 2 ); + ed.setMetric( Q::Needle | QskAspect::Margin, 10 ); + ed.setColor( Q::Needle, rgb2 ); + + ed.setSpacing( Q::TickLabels, 4 ); + ed.setStrutSize( Q::TickLabels, 2, 15 ); + ed.setColor( Q::TickLabels, rgb4 ); + ed.setFontRole( Q::TickLabels, QskSkin::SmallFont ); + } +} diff --git a/playground/dials/SkinFactory.h b/playground/dials/Skin.h similarity index 61% rename from playground/dials/SkinFactory.h rename to playground/dials/Skin.h index 8d6209df..b874f037 100644 --- a/playground/dials/SkinFactory.h +++ b/playground/dials/Skin.h @@ -5,13 +5,12 @@ #pragma once -#include +#include -class SkinFactory : public QskSkinFactory +class Skin : public QskSkin { - Q_OBJECT - public: - QStringList skinNames() const override; - QskSkin* createSkin( const QString& ) override; + Skin(); + + void initHints() override; }; diff --git a/playground/dials/SkinFactory.cpp b/playground/dials/SkinFactory.cpp deleted file mode 100644 index c03ef792..00000000 --- a/playground/dials/SkinFactory.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************** - * QSkinny - Copyright (C) The authors - * SPDX-License-Identifier: BSD-3-Clause - *****************************************************************************/ - -#include "SkinFactory.h" - -#include "Dial.h" -#include "DialSkinlet.h" - -#include -#include -#include -#include -#include -#include - -namespace -{ - inline QFont qskFont( qreal pointSize ) - { - QFont font( "Roboto" ); - font.setPointSizeF( pointSize / qskDpToPixels( 1.0 ) ); - return font; - } - - class Skin : public QskSkin - { - public: - Skin() - { - using namespace QskRgb; - - declareSkinlet< Dial, DialSkinlet >(); - - setFont( QskSkin::DefaultFont, qskFont( 13 ) ); - setFont( QskSkin::LargeFont, qskFont( 20 ) ); - - const auto rgb1 = qRgb( 1, 16, 27 ); // Maastricht blue - const auto rgb2 = qRgb( 255, 0, 22 ); // Ruddy - const auto rgb3 = qRgb( 41, 234, 212 ); // Turquoise - const auto rgb4 = qRgb( 253, 255, 252 ); // baby powder - - QskSkinHintTableEditor ed( &hintTable() ); - - ed.setColor( QskTextLabel::Text, rgb4 ); - - { - using Q = Dial; - - ed.setBoxBorderMetrics( Q::Panel, 2 ); - ed.setBoxShape( Q::Panel, 100, Qt::RelativeSize ); - ed.setGradient( Q::Panel, rgb1 ); - ed.setBoxBorderColors( Q::Panel, rgb3 ); - - ed.setBoxBorderMetrics( Q::Knob, 2 ); - ed.setStrutSize( Q::Knob, 30, 30 ); - ed.setBoxShape( Q::Knob, 100, Qt::RelativeSize ); - - QskGradient gradient( rgb2, rgb1 ); - gradient.setLinearDirection( 0.0, 0.0, 1.0, 1.0 ); - ed.setGradient( Q::Knob, gradient ); - - ed.setMetric( Q::Needle | QskAspect::Size, 2 ); - ed.setMetric( Q::Needle | QskAspect::Margin, 10 ); - ed.setColor( Q::Needle, rgb2 ); - - ed.setSpacing( Q::TickLabels, 4 ); - ed.setStrutSize( Q::TickLabels, 2, 15 ); - ed.setColor( Q::TickLabels, rgb4 ); - ed.setFontRole( Q::TickLabels, QskSkin::SmallFont ); - } - } - }; - -} - -QStringList SkinFactory::skinNames() const -{ - return { "Skin" }; -} - -QskSkin* SkinFactory::createSkin( const QString& skinName ) -{ - if ( skinName == "Skin" ) - return new Skin(); - - return nullptr; -} - -#include "moc_SkinFactory.cpp" diff --git a/playground/dials/main.cpp b/playground/dials/main.cpp index be866f01..3b214049 100644 --- a/playground/dials/main.cpp +++ b/playground/dials/main.cpp @@ -4,7 +4,7 @@ *****************************************************************************/ #include "Dashboard.h" -#include "SkinFactory.h" +#include "Skin.h" #include @@ -44,12 +44,11 @@ int main( int argc, char** argv ) QskObjectCounter counter( true ); #endif - qskSkinManager->setPluginPaths( QStringList() ); // no skin plugins - qskSkinManager->registerFactory( QStringLiteral( "sample" ), new SkinFactory() ); - QGuiApplication app( argc, argv ); + qskSkinManager->setSkin( new Skin() ); - SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); + SkinnyShortcut::enable( SkinnyShortcut::DebugBackground | + SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); Window window; window.show(); diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 1d9952bc..7961d541 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -153,6 +153,8 @@ class QskSkin::PrivateData QHash< int, QskColorFilter > graphicFilters; QskGraphicProviderMap graphicProviders; + + int colorScheme = -1; // uninitialized }; QskSkin::QskSkin( QObject* parent ) @@ -213,6 +215,27 @@ QskSkin::~QskSkin() { } +QskSkin::ColorScheme QskSkin::colorScheme() const +{ + if ( m_data->colorScheme < 0 ) + return QskSkin::UnknownScheme; + + return static_cast< QskSkin::ColorScheme >( m_data->colorScheme ); +} + +void QskSkin::setColorScheme( ColorScheme colorScheme ) +{ + if ( colorScheme == m_data->colorScheme ) + return; + + m_data->colorScheme = colorScheme; + + clearHints(); + initHints(); + + Q_EMIT colorSchemeChanged( colorScheme ); +} + void QskSkin::setSkinHint( QskAspect aspect, const QVariant& skinHint ) { m_data->hintTable.setHint( aspect, skinHint ); @@ -344,6 +367,14 @@ bool QskSkin::hasGraphicProvider() const return m_data->graphicProviders.size() > 0; } +void QskSkin::clearHints() +{ + m_data->hintTable.clear(); + m_data->fonts.clear(); + m_data->graphicFilters.clear(); + m_data->graphicProviders.clear(); +} + QString QskSkin::dialogButtonText( int action ) const { const auto theme = qskPlatformTheme(); diff --git a/src/controls/QskSkin.h b/src/controls/QskSkin.h index 95b1cbfe..f70636b4 100644 --- a/src/controls/QskSkin.h +++ b/src/controls/QskSkin.h @@ -94,6 +94,18 @@ class QSK_EXPORT QskSkin : public QObject const QHash< int, QFont >& fonts() const; const QHash< int, QskColorFilter >& graphicFilters() const; + ColorScheme colorScheme() const; + + public Q_SLOTS: + void setColorScheme( ColorScheme ); + + Q_SIGNALS: + void colorSchemeChanged( ColorScheme ); + + protected: + void clearHints(); + virtual void initHints() = 0; + private: void declareSkinlet( const QMetaObject* metaObject, const QMetaObject* skinletMetaObject ); diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index c3c4d92c..24f3d003 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -74,8 +74,6 @@ namespace const QLatin1String TokenData( "MetaData" ); const QLatin1String TokenFactoryId( "FactoryId" ); const QLatin1String TokenSkins( "Skins" ); - const QLatin1String TokenName( "Name" ); - const QLatin1String TokenScheme( "Scheme" ); const QLatin1String InterfaceId( QskSkinFactoryIID ); @@ -95,42 +93,7 @@ namespace const auto skins = factoryData.value( TokenSkins ).toArray(); for ( const auto& skin : skins ) - { - const auto& skinObject = skin.toObject(); - const auto& name = skinObject.value( TokenName ).toString(); - -#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) - const auto& schemeString = skinObject.value( TokenScheme ).toString(); - Qt::ColorScheme scheme; - - if( schemeString == QStringLiteral( "Light" ) ) - { - scheme = Qt::ColorScheme::Light; - } - else if( schemeString == QStringLiteral( "Dark" ) ) - { - scheme = Qt::ColorScheme::Dark; - } - else - { - scheme = Qt::ColorScheme::Unknown; - } - - const auto systemScheme = QGuiApplication::styleHints()->colorScheme(); - - if( scheme == systemScheme ) - { - m_skinNames.prepend( name ); - } - else - { - m_skinNames.append( name ); - } -#else - Q_UNUSED( TokenScheme ) - m_skinNames += name; -#endif - } + m_skinNames += skin.toString(); } return !m_skinNames.isEmpty(); @@ -518,7 +481,8 @@ QStringList QskSkinManager::skinNames() const return m_data->factoryMap.skinNames(); } -QskSkin* QskSkinManager::createSkin( const QString& skinName ) const +QskSkin* QskSkinManager::createSkin( + const QString& skinName, QskSkin::ColorScheme colorScheme ) const { m_data->ensurePlugins(); @@ -543,18 +507,56 @@ QskSkin* QskSkinManager::createSkin( const QString& skinName ) const { skin = factory->createSkin( name ); if ( skin ) + { skin->setObjectName( name ); + + if ( colorScheme == QskSkin::UnknownScheme ) + { +#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) + colorScheme = static_cast< QskSkin::ColorScheme >( + QGuiApplication::styleHints()->colorScheme() ); +#else + colorScheme = QskSkin::LightScheme; +#endif + } + + skin->setColorScheme( colorScheme ); + } } return skin; } +void QskSkinManager::setSkin( QskSkin* skin ) +{ + if ( m_data->skin == skin ) + return; + + if ( skin && skin->parent() == nullptr ) + skin->setParent( this ); + + const auto oldSkin = m_data->skin; + m_data->skin = skin; + + if ( oldSkin ) + { + if ( oldSkin->parent() == this ) + delete oldSkin; + } + + Q_EMIT skinChanged( skin ); +} + QskSkin* QskSkinManager::setSkin( const QString& name ) { if ( m_data->skin && ( m_data->skin->objectName() == name ) ) return m_data->skin; - auto skin = createSkin( name ); + auto colorScheme = QskSkin::UnknownScheme; + if ( m_data->skin ) + colorScheme = m_data->skin->colorScheme(); + + auto skin = createSkin( name, colorScheme ); if ( skin == nullptr ) return nullptr; diff --git a/src/controls/QskSkinManager.h b/src/controls/QskSkinManager.h index 8a3d1b63..d3992293 100644 --- a/src/controls/QskSkinManager.h +++ b/src/controls/QskSkinManager.h @@ -7,11 +7,11 @@ #define QSK_SKIN_MANAGER_H #include "QskGlobal.h" +#include "QskSkin.h" #include #include -class QskSkin; class QskSkinFactory; #if defined( qskSkinManager ) @@ -39,8 +39,10 @@ class QSK_EXPORT QskSkinManager : public QObject QStringList skinNames() const; - QskSkin* createSkin( const QString& name ) const; + QskSkin* createSkin( const QString& skinName, + QskSkin::ColorScheme = QskSkin::UnknownScheme ) const; + void setSkin( QskSkin* ); QskSkin* skin(); QskSkin* setSkin( const QString& ); diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index 1fd93d00..ae84756c 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -162,6 +162,23 @@ void Skinny::setSkin( int index, QskAnimationHint hint ) } } +void Skinny::changeColorScheme( QskAnimationHint hint ) +{ + auto skin = qskSkinManager->skin(); + + QskSkinTransition transition; + transition.setMask( QskSkinTransition::Color ); + transition.setSourceSkin( skin ); + + const auto colorScheme = ( skin->colorScheme() == QskSkin::LightScheme ) + ? QskSkin::DarkScheme : QskSkin::LightScheme; + + skin->setColorScheme( colorScheme ); + + transition.setTargetSkin( skin ); + transition.run( hint ); +} + void Skinny::changeFonts( int increment ) { auto skin = qskSkinManager->skin(); diff --git a/support/SkinnyNamespace.h b/support/SkinnyNamespace.h index 0aeda789..1ee27fc6 100644 --- a/support/SkinnyNamespace.h +++ b/support/SkinnyNamespace.h @@ -11,6 +11,7 @@ namespace Skinny { SKINNY_EXPORT void changeSkin( QskAnimationHint hint = 500 ); + SKINNY_EXPORT void changeColorScheme( QskAnimationHint hint = 500 ); SKINNY_EXPORT void setSkin( int index, QskAnimationHint hint = 500 ); SKINNY_EXPORT void changeFonts( int increment ); SKINNY_EXPORT void init(); diff --git a/support/SkinnyShortcut.cpp b/support/SkinnyShortcut.cpp index d7bbff01..006a69bd 100644 --- a/support/SkinnyShortcut.cpp +++ b/support/SkinnyShortcut.cpp @@ -38,6 +38,13 @@ void SkinnyShortcut::enable( Types types ) cout << "CTRL-S to change the skin." << endl; } + if ( types & ChangeColorScheme ) + { + QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL | Qt::Key_L ), + false, &s_shortcut, [] { Skinny::changeColorScheme(); } ); + cout << "CTRL-L to change the color scheme." << endl; + } + if ( types & ChangeFonts ) { QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL | Qt::Key_F ), diff --git a/support/SkinnyShortcut.h b/support/SkinnyShortcut.h index 84587d7e..4de823a6 100644 --- a/support/SkinnyShortcut.h +++ b/support/SkinnyShortcut.h @@ -15,14 +15,16 @@ class SKINNY_EXPORT SkinnyShortcut : public QObject public: enum Type { - Quit = 1 << 0, - RotateSkin = 1 << 1, - ChangeFonts = 1 << 2, - DebugBackground = 1 << 3, - DebugStatistics = 1 << 4, + Quit = 1 << 0, + RotateSkin = 1 << 1, + ChangeColorScheme = 1 << 2, + ChangeFonts = 1 << 3, + DebugBackground = 1 << 4, + DebugStatistics = 1 << 5, DebugShortcuts = DebugBackground | DebugStatistics, - AllShortcuts = Quit | RotateSkin | ChangeFonts | DebugBackground | DebugStatistics + AllShortcuts = Quit | RotateSkin | ChangeColorScheme + | ChangeFonts | DebugBackground | DebugStatistics }; Q_ENUM( Type ) From 59c2e8ca33e45475889b700a841059b4786cecc9 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 30 Jan 2024 16:46:01 +0100 Subject: [PATCH 27/27] handling QStyleHints::colorSchemeChanged --- examples/gallery/main.cpp | 2 +- src/controls/QskQuickItem.cpp | 3 + src/controls/QskSkin.cpp | 21 ++++++- src/controls/QskSkinManager.cpp | 99 ++++++++++++++++++++++----------- src/controls/QskSkinManager.h | 5 ++ support/SkinnyNamespace.cpp | 43 +++----------- support/SkinnyNamespace.h | 5 +- 7 files changed, 105 insertions(+), 73 deletions(-) diff --git a/examples/gallery/main.cpp b/examples/gallery/main.cpp index 7ca7e09d..26878e3c 100644 --- a/examples/gallery/main.cpp +++ b/examples/gallery/main.cpp @@ -171,7 +171,7 @@ namespace if ( ( index >= 0 ) && ( index < names.size() ) && ( index != names.indexOf( qskSkinManager->skinName() ) ) ) { - Skinny::setSkin( index, 500 ); + qskSkinManager->setSkin( names[index] ); } } }; diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index 204a2334..75e7b8ae 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -79,6 +79,9 @@ namespace */ QObject::connect( qskSkinManager, &QskSkinManager::skinChanged, qskSkinManager, [ this ] { updateSkin(); } ); + + QObject::connect( qskSkinManager, &QskSkinManager::colorSchemeChanged, + qskSkinManager, [ this ] { updateSkin(); } ); } inline void insert( QskQuickItem* item ) diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 7961d541..e2fb11db 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -13,6 +13,8 @@ #include "QskSkinHintTable.h" #include "QskStandardSymbol.h" #include "QskPlatform.h" +#include "QskSkinManager.h" +#include "QskSkinTransition.h" #include "QskMargins.h" @@ -230,8 +232,23 @@ void QskSkin::setColorScheme( ColorScheme colorScheme ) m_data->colorScheme = colorScheme; - clearHints(); - initHints(); + const auto transitionHint = qskSkinManager->transitionHint(); + if ( transitionHint.isValid() ) + { + QskSkinTransition transition; + transition.setSourceSkin( this ); + + clearHints(); + initHints(); + + transition.setTargetSkin( this ); + transition.run( transitionHint ); + } + else + { + clearHints(); + initHints(); + } Q_EMIT colorSchemeChanged( colorScheme ); } diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index 24f3d003..f1b9f8f7 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -6,6 +6,8 @@ #include "QskSkinManager.h" #include "QskSkinFactory.h" #include "QskSkin.h" +#include "QskSkinTransition.h" +#include "QskAnimationHint.h" #include #include @@ -21,16 +23,31 @@ #include #endif -/* - We could use QFactoryLoader, but as it is again a "private" class - and does a couple of hardcoded things we don't need ( like always resolving - from the application library path ) we prefer having our own code. - */ namespace { class SkinManager final : public QskSkinManager { + public: + SkinManager() + { +#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) + connect( QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, + this, &SkinManager::updateColorScheme ); +#endif + } + + private: +#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 ) + void updateColorScheme( Qt::ColorScheme scheme ) + { + if ( QGuiApplication::desktopSettingsAware() ) + { + skin()->setColorScheme( + static_cast< QskSkin::ColorScheme >( scheme ) ); + } + } +#endif }; } @@ -53,6 +70,11 @@ static inline QString qskResolvedPath( const QString& path ) namespace { + /* + We could use QFactoryLoader, but as it is again a "private" class + and does a couple of hardcoded things we don't need ( like always resolving + from the application library path ) we prefer having our own code. + */ class FactoryLoader final : public QPluginLoader { public: @@ -365,6 +387,7 @@ class QskSkinManager::PrivateData FactoryMap factoryMap; QPointer< QskSkin > skin; + QskAnimationHint transitionHint = 500; bool pluginsRegistered : 1; }; @@ -532,47 +555,49 @@ void QskSkinManager::setSkin( QskSkin* skin ) if ( m_data->skin == skin ) return; - if ( skin && skin->parent() == nullptr ) - skin->setParent( this ); - const auto oldSkin = m_data->skin; m_data->skin = skin; + if ( skin ) + { + if ( skin->parent() == nullptr ) + skin->setParent( this ); + + connect( skin, &QskSkin::colorSchemeChanged, + this, &QskSkinManager::colorSchemeChanged ); + } + if ( oldSkin ) { - if ( oldSkin->parent() == this ) - delete oldSkin; + disconnect( oldSkin, &QskSkin::colorSchemeChanged, + this, &QskSkinManager::colorSchemeChanged ); } Q_EMIT skinChanged( skin ); + + if ( skin && oldSkin && m_data->transitionHint.isValid() ) + { + QskSkinTransition transition; + transition.setSourceSkin( oldSkin ); + transition.setTargetSkin( skin ); + transition.run( m_data->transitionHint ); + } + + if ( oldSkin && oldSkin->parent() == this ) + delete oldSkin; } QskSkin* QskSkinManager::setSkin( const QString& name ) { - if ( m_data->skin && ( m_data->skin->objectName() == name ) ) - return m_data->skin; - - auto colorScheme = QskSkin::UnknownScheme; - if ( m_data->skin ) - colorScheme = m_data->skin->colorScheme(); - - auto skin = createSkin( name, colorScheme ); - if ( skin == nullptr ) - return nullptr; - - if ( skin->parent() == nullptr ) - skin->setParent( this ); - - const auto oldSkin = m_data->skin; - - m_data->skin = skin; - - if ( oldSkin ) + if ( !( m_data->skin && ( m_data->skin->objectName() == name ) ) ) { - Q_EMIT skinChanged( skin ); + auto colorScheme = QskSkin::UnknownScheme; + if ( m_data->skin ) + colorScheme = m_data->skin->colorScheme(); - if ( oldSkin->parent() == this ) - delete oldSkin; + auto skin = createSkin( name, colorScheme ); + if ( skin ) + setSkin( skin ); } return m_data->skin; @@ -599,4 +624,14 @@ QskSkin* QskSkinManager::skin() return m_data->skin; } +void QskSkinManager::setTransitionHint( const QskAnimationHint& hint ) +{ + m_data->transitionHint = hint; +} + +QskAnimationHint QskSkinManager::transitionHint() const +{ + return m_data->transitionHint; +} + #include "moc_QskSkinManager.cpp" diff --git a/src/controls/QskSkinManager.h b/src/controls/QskSkinManager.h index d3992293..188951cc 100644 --- a/src/controls/QskSkinManager.h +++ b/src/controls/QskSkinManager.h @@ -13,6 +13,7 @@ #include class QskSkinFactory; +class QskAnimationHint; #if defined( qskSkinManager ) #undef qskSkinManager @@ -48,8 +49,12 @@ class QSK_EXPORT QskSkinManager : public QObject QskSkin* setSkin( const QString& ); QString skinName() const; + void setTransitionHint( const QskAnimationHint& ); + QskAnimationHint transitionHint() const; + Q_SIGNALS: void skinChanged( QskSkin* ); + void colorSchemeChanged( QskSkin::ColorScheme ); protected: QskSkinManager(); diff --git a/support/SkinnyNamespace.cpp b/support/SkinnyNamespace.cpp index ae84756c..498d4c3d 100644 --- a/support/SkinnyNamespace.cpp +++ b/support/SkinnyNamespace.cpp @@ -7,8 +7,6 @@ #include #include -#include -#include #include #include @@ -131,7 +129,7 @@ static bool pluginPath = initPluginPath(); Q_COREAPP_STARTUP_FUNCTION( initFonts ) -void Skinny::changeSkin( QskAnimationHint hint ) +void Skinny::changeSkin() { const auto names = qskSkinManager->skinNames(); if ( names.size() > 1 ) @@ -139,46 +137,21 @@ void Skinny::changeSkin( QskAnimationHint hint ) auto index = names.indexOf( qskSkinManager->skinName() ); index = ( index + 1 ) % names.size(); - setSkin( index, hint ); + qskSkinManager->setSkin( names[ index ] ); } } -void Skinny::setSkin( int index, QskAnimationHint hint ) +void Skinny::changeColorScheme() { - const auto names = qskSkinManager->skinNames(); - if ( names.size() <= 1 ) - return; - - if ( index == names.indexOf( qskSkinManager->skinName() ) ) - return; - - QskSkinTransition transition; - transition.setSourceSkin( qskSkinManager->skin() ); - - if ( auto skin = qskSkinManager->setSkin( names[ index ] ) ) + if ( auto skin = qskSkinManager->skin() ) { - transition.setTargetSkin( skin ); - transition.run( hint ); + const auto colorScheme = ( skin->colorScheme() == QskSkin::LightScheme ) + ? QskSkin::DarkScheme : QskSkin::LightScheme; + + skin->setColorScheme( colorScheme ); } } -void Skinny::changeColorScheme( QskAnimationHint hint ) -{ - auto skin = qskSkinManager->skin(); - - QskSkinTransition transition; - transition.setMask( QskSkinTransition::Color ); - transition.setSourceSkin( skin ); - - const auto colorScheme = ( skin->colorScheme() == QskSkin::LightScheme ) - ? QskSkin::DarkScheme : QskSkin::LightScheme; - - skin->setColorScheme( colorScheme ); - - transition.setTargetSkin( skin ); - transition.run( hint ); -} - void Skinny::changeFonts( int increment ) { auto skin = qskSkinManager->skin(); diff --git a/support/SkinnyNamespace.h b/support/SkinnyNamespace.h index 1ee27fc6..1bbafc27 100644 --- a/support/SkinnyNamespace.h +++ b/support/SkinnyNamespace.h @@ -10,9 +10,8 @@ namespace Skinny { - SKINNY_EXPORT void changeSkin( QskAnimationHint hint = 500 ); - SKINNY_EXPORT void changeColorScheme( QskAnimationHint hint = 500 ); - SKINNY_EXPORT void setSkin( int index, QskAnimationHint hint = 500 ); + SKINNY_EXPORT void changeSkin(); + SKINNY_EXPORT void changeColorScheme(); SKINNY_EXPORT void changeFonts( int increment ); SKINNY_EXPORT void init(); }