From 0788ec7f48cff1313b216d694f9753d2c9087390 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 6 Apr 2016 23:16:17 +0200 Subject: [PATCH] GlslEditor: Remove duplicated icons This change makes GlslCompletionAssist reuse the equivalent icons from CPlusPlus, and adds specific ones for "Attribute", "Uniform" and "Varying". Change-Id: Ic8860274a9f421d28cfec86ed0d1badb7e1cf92e Reviewed-by: Alessandro Portale --- share/qtcreator/themes/dark.creatortheme | 3 + share/qtcreator/themes/default.creatortheme | 3 + .../qtcreator/themes/defaultflat.creatortheme | 3 + src/libs/utils/theme/theme.h | 3 + .../glsleditor/glslcompletionassist.cpp | 86 +++++++++++++----- src/plugins/glsleditor/glslcompletionassist.h | 11 --- src/plugins/glsleditor/glsleditor.qrc | 9 -- src/plugins/glsleditor/images/attribute.png | Bin 456 -> 0 bytes src/plugins/glsleditor/images/const.png | Bin 478 -> 0 bytes src/plugins/glsleditor/images/func.png | Bin 583 -> 0 bytes src/plugins/glsleditor/images/keyword.png | Bin 341 -> 0 bytes src/plugins/glsleditor/images/other.png | Bin 377 -> 0 bytes src/plugins/glsleditor/images/type.png | Bin 573 -> 0 bytes src/plugins/glsleditor/images/uniform.png | Bin 461 -> 0 bytes src/plugins/glsleditor/images/var.png | Bin 530 -> 0 bytes src/plugins/glsleditor/images/varying.png | Bin 457 -> 0 bytes 16 files changed, 77 insertions(+), 41 deletions(-) delete mode 100644 src/plugins/glsleditor/images/attribute.png delete mode 100644 src/plugins/glsleditor/images/const.png delete mode 100644 src/plugins/glsleditor/images/func.png delete mode 100644 src/plugins/glsleditor/images/keyword.png delete mode 100644 src/plugins/glsleditor/images/other.png delete mode 100644 src/plugins/glsleditor/images/type.png delete mode 100644 src/plugins/glsleditor/images/uniform.png delete mode 100644 src/plugins/glsleditor/images/var.png delete mode 100644 src/plugins/glsleditor/images/varying.png diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 0935680bde8..bc94ac1e19f 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -78,6 +78,9 @@ IconsCodeModelFunctionColor=ffd34373 IconsCodeModelVariableColor=ff2bbbcc IconsCodeModelEnumColor=ffc0b550 IconsCodeModelMacroColor=ff477ba0 +IconsCodeModelAttributeColor=ff316511 +IconsCodeModelUniformColor=ff994899 +IconsCodeModelVaryingColor=ffa08833 IconsCodeModelOverlayBackgroundColor=88000000 IconsCodeModelOverlayForegroundColor=ffdcdcdc InfoBarBackground=ff505000 diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index 690f4407d72..b6dcbcca124 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -72,6 +72,9 @@ IconsCodeModelFunctionColor=fff36393 IconsCodeModelVariableColor=ff2bbbcc IconsCodeModelEnumColor=ffc0b550 IconsCodeModelMacroColor=ff476ba0 +IconsCodeModelAttributeColor=ff316511 +IconsCodeModelUniformColor=ff994899 +IconsCodeModelVaryingColor=ffa08833 IconsCodeModelOverlayBackgroundColor=70ffffff IconsCodeModelOverlayForegroundColor=ff232425 InfoBarBackground=ffffffe1 diff --git a/share/qtcreator/themes/defaultflat.creatortheme b/share/qtcreator/themes/defaultflat.creatortheme index a3bc13a8204..c8d51b6ca7b 100644 --- a/share/qtcreator/themes/defaultflat.creatortheme +++ b/share/qtcreator/themes/defaultflat.creatortheme @@ -82,6 +82,9 @@ IconsCodeModelFunctionColor=ffd34373 IconsCodeModelVariableColor=ff2bbbcc IconsCodeModelEnumColor=ffc0b550 IconsCodeModelMacroColor=ff476ba0 +IconsCodeModelAttributeColor=ff316511 +IconsCodeModelUniformColor=ff994899 +IconsCodeModelVaryingColor=ffa08833 IconsCodeModelOverlayBackgroundColor=70ffffff IconsCodeModelOverlayForegroundColor=ff232425 InfoBarBackground=ffffffe1 diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index 8dd54e5a79c..a3a9861d561 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -160,6 +160,9 @@ public: IconsCodeModelVariableColor, IconsCodeModelEnumColor, IconsCodeModelMacroColor, + IconsCodeModelAttributeColor, + IconsCodeModelUniformColor, + IconsCodeModelVaryingColor, IconsCodeModelOverlayBackgroundColor, IconsCodeModelOverlayForegroundColor, diff --git a/src/plugins/glsleditor/glslcompletionassist.cpp b/src/plugins/glsleditor/glslcompletionassist.cpp index e75bfb97a21..9be913279e7 100644 --- a/src/plugins/glsleditor/glslcompletionassist.cpp +++ b/src/plugins/glsleditor/glslcompletionassist.cpp @@ -41,7 +41,9 @@ #include #include #include +#include +#include #include #include @@ -138,6 +140,57 @@ static bool checkStartOfIdentifier(const QString &word) return false; } +enum IconTypes { + IconTypeAttribute, + IconTypeUniform, + IconTypeKeyword, + IconTypeVarying, + IconTypeConst, + IconTypeVariable, + IconTypeType, + IconTypeFunction, + IconTypeOther +}; + +static QIcon glslIcon(IconTypes iconType) +{ + using namespace CPlusPlus; + using namespace Utils; + + const QString member = QLatin1String(":/codemodel/images/member.png"); + + switch (iconType) { + case IconTypeType: + return Icons::iconForType(Icons::ClassIconType); + case IconTypeConst: + return Icons::iconForType(Icons::EnumeratorIconType); + case IconTypeKeyword: + return Icons::iconForType(Icons::KeywordIconType); + case IconTypeFunction: + return Icons::iconForType(Icons::FuncPublicIconType); + case IconTypeVariable: + return Icons::iconForType(Icons::VarPublicIconType); + case IconTypeAttribute: { + static const QIcon icon = + Icon({{member, Theme::IconsCodeModelAttributeColor}}, Icon::Tint).icon(); + return icon; + } + case IconTypeUniform: { + static const QIcon icon = + Icon({{member, Theme::IconsCodeModelUniformColor}}, Icon::Tint).icon(); + return icon; + } + case IconTypeVarying: { + static const QIcon icon = + Icon({{member, Theme::IconsCodeModelVaryingColor}}, Icon::Tint).icon(); + return icon; + } + case IconTypeOther: + default: + return Icons::iconForType(Icons::NamespaceIconType); + } +} + // ---------------------------- // GlslCompletionAssistProvider // ---------------------------- @@ -223,15 +276,6 @@ int GlslFunctionHintProposalModel::activeArgument(const QString &prefix) const // ----------------------------- GlslCompletionAssistProcessor::GlslCompletionAssistProcessor() : m_startPosition(0) - , m_keywordIcon(QLatin1String(":/glsleditor/images/keyword.png")) - , m_varIcon(QLatin1String(":/glsleditor/images/var.png")) - , m_functionIcon(QLatin1String(":/glsleditor/images/func.png")) - , m_typeIcon(QLatin1String(":/glsleditor/images/type.png")) - , m_constIcon(QLatin1String(":/glsleditor/images/const.png")) - , m_attributeIcon(QLatin1String(":/glsleditor/images/attribute.png")) - , m_uniformIcon(QLatin1String(":/glsleditor/images/uniform.png")) - , m_varyingIcon(QLatin1String(":/glsleditor/images/varying.png")) - , m_otherIcon(QLatin1String(":/glsleditor/images/other.png")) {} GlslCompletionAssistProcessor::~GlslCompletionAssistProcessor() @@ -385,9 +429,9 @@ IAssistProposal *GlslCompletionAssistProcessor::perform(const AssistInterface *i 0 }; for (int index = 0; attributeNames[index]; ++index) - m_completions << createCompletionItem(QString::fromLatin1(attributeNames[index]), m_attributeIcon); + m_completions << createCompletionItem(QString::fromLatin1(attributeNames[index]), glslIcon(IconTypeAttribute)); for (int index = 0; uniformNames[index]; ++index) - m_completions << createCompletionItem(QString::fromLatin1(uniformNames[index]), m_uniformIcon); + m_completions << createCompletionItem(QString::fromLatin1(uniformNames[index]), glslIcon(IconTypeUniform)); } } @@ -395,7 +439,7 @@ IAssistProposal *GlslCompletionAssistProcessor::perform(const AssistInterface *i QStringList keywords = GLSL::Lexer::keywords(languageVariant(m_interface->mimeType())); // m_keywordCompletions.clear(); for (int index = 0; index < keywords.size(); ++index) - m_completions << createCompletionItem(keywords.at(index), m_keywordIcon); + m_completions << createCompletionItem(keywords.at(index), glslIcon(IconTypeKeyword)); // m_keywordVariant = languageVariant(m_interface->mimeType()); // } @@ -408,23 +452,23 @@ IAssistProposal *GlslCompletionAssistProcessor::perform(const AssistInterface *i if (var) { int storageType = var->qualifiers() & GLSL::QualifiedTypeAST::StorageMask; if (storageType == GLSL::QualifiedTypeAST::Attribute) - icon = m_attributeIcon; + icon = glslIcon(IconTypeAttribute); else if (storageType == GLSL::QualifiedTypeAST::Uniform) - icon = m_uniformIcon; + icon = glslIcon(IconTypeUniform); else if (storageType == GLSL::QualifiedTypeAST::Varying) - icon = m_varyingIcon; + icon = glslIcon(IconTypeVarying); else if (storageType == GLSL::QualifiedTypeAST::Const) - icon = m_constIcon; + icon = glslIcon(IconTypeConst); else - icon = m_varIcon; + icon = glslIcon(IconTypeVariable); } else if (s->asArgument()) { - icon = m_varIcon; + icon = glslIcon(IconTypeVariable); } else if (s->asFunction() || s->asOverloadSet()) { - icon = m_functionIcon; + icon = glslIcon(IconTypeFunction); } else if (s->asStruct()) { - icon = m_typeIcon; + icon = glslIcon(IconTypeType); } else { - icon = m_otherIcon; + icon = glslIcon(IconTypeOther); } if (specialMembers.contains(s->name())) m_completions << createCompletionItem(s->name(), icon, SpecialMemberOrder); diff --git a/src/plugins/glsleditor/glslcompletionassist.h b/src/plugins/glsleditor/glslcompletionassist.h index 8cc29e6c772..ca1bd84a441 100644 --- a/src/plugins/glsleditor/glslcompletionassist.h +++ b/src/plugins/glsleditor/glslcompletionassist.h @@ -34,7 +34,6 @@ #include -#include #include #include @@ -107,16 +106,6 @@ private: int m_startPosition; QScopedPointer m_interface; - - QIcon m_keywordIcon; - QIcon m_varIcon; - QIcon m_functionIcon; - QIcon m_typeIcon; - QIcon m_constIcon; - QIcon m_attributeIcon; - QIcon m_uniformIcon; - QIcon m_varyingIcon; - QIcon m_otherIcon; }; class GlslCompletionAssistInterface : public TextEditor::AssistInterface diff --git a/src/plugins/glsleditor/glsleditor.qrc b/src/plugins/glsleditor/glsleditor.qrc index 3455048e006..cb1c737c9a1 100644 --- a/src/plugins/glsleditor/glsleditor.qrc +++ b/src/plugins/glsleditor/glsleditor.qrc @@ -2,14 +2,5 @@ GLSLEditor.mimetypes.xml images/glslfile.png - images/keyword.png - images/var.png - images/func.png - images/type.png - images/const.png - images/attribute.png - images/uniform.png - images/varying.png - images/other.png diff --git a/src/plugins/glsleditor/images/attribute.png b/src/plugins/glsleditor/images/attribute.png deleted file mode 100644 index fe2bdc36fddf0d90445e2e8031bf0f08bda4eaaa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7`#oJ8Lo7}w|M>i!pIKGH z=YvPVgTsfKxMI%#OtrLUxS90gQwtA6w%;4BAKPDjX!?JH=U_TR%;%}?&;RFJZG2RJ zv1iHuKSnFs9vCsWer|hw`k%hN!Snx3cZ2^O-}ZBXMAKOYk+ZM+bbs!zxZm@?w43Xn zyV>sl<(dY6@@FmiGC#cQv9KBQgIW5v7QgFX{)_xSd-}A0{aGLXypPTMd0*52|NhWj zzv}NANKRmkZ+x|M0&hdMUHSJT|F1oL`d`@U?|=5|R{y^182-+mzxelkrO>bY{WzSA zH*p`B_4ropf7v~IKGz>>;n+~jyz1@0-J&!9Y(IJBPyVzuf8y06q+E^fFid#Xp|-t# z!34ioe81$cz2GV{Izopr0CsEQS^xk5 diff --git a/src/plugins/glsleditor/images/const.png b/src/plugins/glsleditor/images/const.png deleted file mode 100644 index 25fc49c6598a8a99c11ec688b4dc1d3153427507..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 478 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFgAF)IEGZ*S`uvSaX3NX-=&so8)r99RuEa(t@lcV zt7~(z){TRjQ+VIYzpb7B);-}e12g-Jy)~0Qf4DJ+`$F~Ggz{olrWIkUPd@sT z&9%NUn%xA2ZO!}m diff --git a/src/plugins/glsleditor/images/func.png b/src/plugins/glsleditor/images/func.png deleted file mode 100644 index e515e76e61f64cd285a4c67aaf1feaca38e84f8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 583 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFuwG3aSW-rwPf;ne_=8*t(SefQ)*P zb?LGu$8#o55~m|Nf;^OLtp2*l?ken-c)zdVfewq)a{<0Nk|KS4O3#gZpH%mrW)A;- z;^6c32Uvek&;D9+Tc+oe;&k1DE9||yR_p5PS*5OK=?PwN=b-1uxs0h>l<(Z}P`efy zefw5HU#_;uL&hE_*VR`9^WM5#{%n)``*~mR!X3;uxtF({YrXxo@#W%e)@wpDMRVyg(t+=|IKD z3DYBA=*n`P6L=A(bwOzjzvqMQjt6spRIdJQ+;D&KBEx0jUXf{ed%iC&KDX|5l|8FO z@~>^V>}ySDNPf17XXL4zcYj;1_XL&zugJBgyVfxqGc!1GXmlN7@@RO%cIJ+O@eE0q zFSE|B6y5XvadD1-;Ivf79>L%H`j<02pTlaatwrFCAcLT%(dkY5R;_Z6 qy~ActNay&yX(9sy1B0ilpUXO@geCxM7=F+I diff --git a/src/plugins/glsleditor/images/other.png b/src/plugins/glsleditor/images/other.png deleted file mode 100644 index 18d2941572e8a62e65954c4900aa9b1bdf21766f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 377 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFiLy6IEGZ*Ix_iuR*QkavB$4s1;Qh%qW#5+J}}mB z-cOJ}vigVEZ;xoPssdFx7ftW?UG3XX0TnT)4fydl%Dv1_lNOPgg&ebxsLQ0H~IsW&i*H diff --git a/src/plugins/glsleditor/images/type.png b/src/plugins/glsleditor/images/type.png deleted file mode 100644 index 88432d2cb10c43de91fdb7ec7989285090747b0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 573 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFy8lcaSW-rHD&U7Z)r!7A7c1La z{;|7iR0MxnBB1-_-NG+Rn%d*M_`hbX5?}g{q1WDV;;+^0j)n^ymn@CY`k`znSZ2PF z<#AvBvAYx2*mv;D8SnmVXMF$rJswWQfSmWYPCR&c=kFTnSt6b`sYT4^cSj{|uztCD zzEbHfy(cmMwEI5perEsk^8vNc>w6l?_O{-e#~-rfnd9a6hqssxmG-TrmX1VLRDt@-S;0n$p|^fJTZA|z#Y43>k17uZ1?uQiQv)x zHm&QWc>N@m=!e%7A0C^2KquaVHSb@m1m|j*J>4qWy6)=}{_)zV#?OkA4iBBWJWl+> z71fDyJZ!Dz?!~(gzB?oLPwaht4wvQiz&20OpIm%v>pOS)*G8D|N| zl}uaa;eCe=9aXL4~&vMP;?~fH37#J8lUHx3vIVCg!04d1;cmMzZ diff --git a/src/plugins/glsleditor/images/uniform.png b/src/plugins/glsleditor/images/uniform.png deleted file mode 100644 index 075e875dd217093d383b0346a2c3919f59e3103f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 461 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7r+B(JhFF|V{_*>{KC`NX zPe-xGgTseD#c-WZwM?~VxS90gQwtA6_B);zzsf5PKKy@!=U_TR%;&?O`Tx(4D17w) z%M!`|sTQdLJO@)5x}H5g-S^+#;Q4|7cZ19R=YP(0He{L2s4=Tw&+=RS`<~kW;$k|# z?mxNr$Nv6?2lb1BF4b%Dt@OXa(~wHkKjKmFhNtMdQl zE0_PbpK593`N0*U-#;q0N*2-`r*SKR6`#fBT7+ z1E$Km8P@E)yZ!I|r*o(O|L*R?V7>j+x?lAZJum*}IeX^6=c$wbo0l{PnjGe3$jmFr z{>9Gqa@~S=|9RK-Ca5?6nZ0h}M|(%ZkNfwBFtnxZU_21;cgw<3Ws8>Ab6)+M9yO)$ z@9b66zS;ZPz1zQi34hqx6LA8}l0i99Jm2!C`I+4~Ik714|6Y~7g;{R>tcIBj6cu_G zWOPmF{qbJ&VQ0AUwhR&GqwD8S`Cnho$=@`qP*r7v;v|_#ET)frPB}13bX?>)#L$-M WBmZcZ>U;(U1_n=8KbLh*2~7auq~|vP diff --git a/src/plugins/glsleditor/images/var.png b/src/plugins/glsleditor/images/var.png deleted file mode 100644 index 089cfb45e5fc0f9629c508538ffc5886f79f84c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 530 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7BuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFmCa5aSW-rwdC?yeP%}yh7a4f#%9jSn3C~GRyvt4t9|UUV9)9lg(_P%6y;WRoapT#oq4NW@ zV;<~YwqH!+p+|y_%%c_24KEJu@fX-9R`|Egy`61`NMM5`+ZWSo&J}4=-87~m! z=`dd{wWzFWTYFmCVlu~%_V!wv^UJ&E{#;dIa71>$fQ2Zhiu`7UQ$`Z2*mkvfYCd7i z+E8yC&)LuOrC7S0f5M@_&P56#x)}*slUN?To0nvCt?Su5{o|j7A2*)6Czto`4;RNG z{~z~WS=1K(KXB}uP*;VSkyOUZcaNs&uXEhIY*m!{>^UZEzoC{Z#Js87Tf61SCI`_wrFRUvvX^Tu(+E5I^!N-z9_0$*Zb8%U zDT#Lv37zOn3H|d|Emlc+-iX*k|x`^>bP0l+XkK26N@* diff --git a/src/plugins/glsleditor/images/varying.png b/src/plugins/glsleditor/images/varying.png deleted file mode 100644 index a6e3e12c6d55b7f951598ae2e5d3961a3b994ee7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 457 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7CwRIzhFF|V{_*=eKeMWY zj|WHbgTsfof@036s#@4H+)R4$sfC9j``s$8ALSL#oBrS6Ihf86^ZBs#^Z)a2?0@vX z=iHM2MvqpsJuqT${rs`^^gsC;|>0|ed^Bz5>00rM9v=nrt@=u{^y?m-OEJ& zn-{#g{>~EfE`0xCGZ`%&j#mAdw^hi8cpWqf? z;#zUy-}fyO53H7qHtA}7bp5{LtNrb!iD!2R3EdFz6g)JmP%U)