From 6f73ccff2f88bb39bfa9c3acd76d652363869bba Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 20 Dec 2021 12:53:35 +0800 Subject: [PATCH] use svg icons for editor gutter --- RedPandaIDE/icons.qrc | 9 ++- RedPandaIDE/iconsmanager.cpp | 31 +++++---- RedPandaIDE/iconsmanager.h | 4 +- RedPandaIDE/images/editor/bookmark.png | Bin 218 -> 0 bytes RedPandaIDE/images/editor/bookmark.svg | 47 +++++++++++++ RedPandaIDE/images/editor/breakpoint.png | Bin 2064 -> 0 bytes RedPandaIDE/images/editor/currentline.png | Bin 2031 -> 0 bytes RedPandaIDE/images/editor/currentline.svg | 72 ++++++++++++++++++++ RedPandaIDE/images/editor/syntaxerror.png | Bin 2063 -> 0 bytes RedPandaIDE/images/editor/syntaxerror.svg | 58 ++++++++++++++++ RedPandaIDE/images/editor/syntaxwarning.png | Bin 2050 -> 0 bytes RedPandaIDE/images/editor/syntaxwarning.svg | 50 ++++++++++++++ RedPandaIDE/mainwindow.cpp | 2 +- 13 files changed, 253 insertions(+), 20 deletions(-) delete mode 100644 RedPandaIDE/images/editor/bookmark.png create mode 100644 RedPandaIDE/images/editor/bookmark.svg delete mode 100644 RedPandaIDE/images/editor/breakpoint.png delete mode 100644 RedPandaIDE/images/editor/currentline.png create mode 100644 RedPandaIDE/images/editor/currentline.svg delete mode 100644 RedPandaIDE/images/editor/syntaxerror.png create mode 100644 RedPandaIDE/images/editor/syntaxerror.svg delete mode 100644 RedPandaIDE/images/editor/syntaxwarning.png create mode 100644 RedPandaIDE/images/editor/syntaxwarning.svg diff --git a/RedPandaIDE/icons.qrc b/RedPandaIDE/icons.qrc index e686bf63..2143c062 100644 --- a/RedPandaIDE/icons.qrc +++ b/RedPandaIDE/icons.qrc @@ -450,10 +450,6 @@ images/newlook64/087-update.png images/newlook64/088-watch.png images/newlook64/089-watch-tm.png - images/editor/breakpoint.png - images/editor/currentline.png - images/editor/syntaxerror.png - images/editor/syntaxwarning.png images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico @@ -486,10 +482,13 @@ images/classparser/var_private.ico images/classparser/var_protected.ico images/classparser/var_public.ico - images/editor/bookmark.png images/newlook24/091-openproblemanswer.png images/newlook24/092-runallproblemcases.png images/newlook24/093-pause.png images/editor/breakpoint.svg + images/editor/bookmark.svg + images/editor/currentline.svg + images/editor/syntaxerror.svg + images/editor/syntaxwarning.svg diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index 374f5457..45d92281 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -7,23 +7,18 @@ IconsManager* pIconsManager; IconsManager::IconsManager(QObject *parent) : QObject(parent) { - updateIcons(24); + updateEditorGuttorIcons(24); + mFolder = std::make_shared(":/icons/images/newlook24/090-explorer.png"); } -void IconsManager::updateIcons(int size) +void IconsManager::updateEditorGuttorIcons(int size) { - QSvgRenderer renderer(QString(":/icons/images/editor/breakpoint.svg")); - mBreakpoint = std::make_shared(size,size); - mBreakpoint->fill(Qt::transparent); - QPainter painter(mBreakpoint.get()); - renderer.render(&painter,mBreakpoint->rect()); - - mSyntaxError = std::make_shared(":/icons/images/editor/syntaxerror.png"); - mSyntaxWarning = std::make_shared(":/icons/images/editor/syntaxwarning.png"); - mActiveBreakpoint = std::make_shared(":/icons/images/editor/currentline.png"); - mBookmark = std::make_shared(":/icons/images/editor/bookmark.png"); - mFolder = std::make_shared(":/icons/images/newlook24/090-explorer.png"); + mBreakpoint = createSVGIcon(":/icons/images/editor/breakpoint.svg",size,size); + mSyntaxError = createSVGIcon(":/icons/images/editor/syntaxerror.svg",size,size); + mSyntaxWarning = createSVGIcon(":/icons/images/editor/syntaxwarning.svg",size,size); + mActiveBreakpoint = createSVGIcon(":/icons/images/editor/currentline.svg",size,size); + mBookmark = createSVGIcon(":/icons/images/editor/bookmark.svg",size,size); } const PIcon &IconsManager::syntaxError() const @@ -55,3 +50,13 @@ const PIcon &IconsManager::folder() const { return mFolder; } + +PIcon IconsManager::createSVGIcon(const QString &filename, int width, int height) +{ + QSvgRenderer renderer(filename); + PIcon icon = std::make_shared(width,height); + icon->fill(Qt::transparent); + QPainter painter(icon.get()); + renderer.render(&painter,icon->rect()); + return icon; +} diff --git a/RedPandaIDE/iconsmanager.h b/RedPandaIDE/iconsmanager.h index 5f3d87ab..2eb74544 100644 --- a/RedPandaIDE/iconsmanager.h +++ b/RedPandaIDE/iconsmanager.h @@ -12,7 +12,7 @@ class IconsManager : public QObject public: explicit IconsManager(QObject *parent = nullptr); - void updateIcons(int size); + void updateEditorGuttorIcons(int size); const PIcon &syntaxError() const; @@ -25,6 +25,8 @@ public: const PIcon &bookmark() const; const PIcon &folder() const; + + PIcon createSVGIcon(const QString& filename, int width, int height); private: PIcon mSyntaxError; PIcon mSyntaxWarning; diff --git a/RedPandaIDE/images/editor/bookmark.png b/RedPandaIDE/images/editor/bookmark.png deleted file mode 100644 index 066ace31be019f413d02d0dfbee23c81f9399859..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMpkR-u zi(`mI@7u|Dc@Gj-!%8;O9T3 zQUS5$9EzPM&&mA$vQAg&l!x-~{TuGd9F5yv>6C48>5RBd@BH2`jJj77V?R$%i~_og N!PC{xWt~$(696DIQpErO diff --git a/RedPandaIDE/images/editor/bookmark.svg b/RedPandaIDE/images/editor/bookmark.svg new file mode 100644 index 00000000..c66f8c02 --- /dev/null +++ b/RedPandaIDE/images/editor/bookmark.svg @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git a/RedPandaIDE/images/editor/breakpoint.png b/RedPandaIDE/images/editor/breakpoint.png deleted file mode 100644 index 968cbb4070aa846a31e27df18d7df0db0d331a6f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2064 zcmb_dO>f*p7t^2@!I3Hy|&2`CA-^XrEG}Ol^PJLI-VKtT3LHs z+sSUifkFjR54}(!L@SW`2T+?+RU`@(aDyI@Di8-yxj_&T^pXRD@qRU>Nr-@zydKXy z^SmGPyz`!$o1NO*cc_o!xV^>c{5*RrRu_?ph4B~ov4+J6JQ72`;nn=eYGj2buf@j6v?TCNNW7R8CK7}ELTQfA z(U9<3N*57OH9ljefSy)ObCg$PU`VndfwTy8OO-7};oCofSqrga&F7D`ZLzPcP>tij zlB9aQo~ox)G^|L#G)+lXBt;P!LX1}Y7&b&d8tO3QNrXZ-h+XRQ2_v-WQk)f-r>zjY zpiApV?KH83NeviCASEXuHGvp)alukpYZ}K$A~oU>KaLm{bg@B|#x$zZZK%7;_ZeWR zEtR@9w)DmGx+bEyu*||}CuB=>R9*>)G*2SB6e3bsW^N88(F9g5Brv97nbKP4pyoO* z^SNAdFeZQGgzIBkkB)BIL-H^tSwWE%Aj-O^sAbu-RMS$-5!tY0xdkmz>^dtCK!I!l z!%A!SL78eWjNw0mF|r&QdXUBJday#Iz^@2=HobhlKpihdMBACY1{E3o{eTo+ra;XtJ7j_8>= z;+6ic>*m^~E1n6YImP-$GVC@i_R(#5#Am4rSws7-KXryR!;8iIMApvVlwg2kI z!1^E-4m^Ihuy*U(z|c)Ja^R0EqZ^NWb6)PdYMy7F RpGkUlu`rweaPrg}e*q}&k>CIT diff --git a/RedPandaIDE/images/editor/currentline.png b/RedPandaIDE/images/editor/currentline.png deleted file mode 100644 index b5cd253a9450f3efde5f5ed29dff19c66e68f631..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2031 zcmb_dOKjXk7&fAUHjoM=-~dRtPLL9XS&!|p*S5N?lHDb{5*t?OiiBIop7E}gwa3`r z>}Dw_s#GY40u@5y(j(&5qH?5CLE^vxiBuf8@sK!h<4_5~3C8d2&V&gxPAPw9fyJWbe@j`1hIHe_;MQ7FAwO1mXA>*?ZsnOUIuQga@DY z8=L87?FHLqK@Jn<&|EKwI9d=+p6*51-J+@J(54?2q+dS0DTzKQNE><$)}kV9`IUZ5 z&-B+CZhyF=lobsqhK-=Ds^aL8xVM;i_Im00kuTmWNUb!DY+3Gh zySc8GV{ubfEX$IiDyu5s2$1ZADei$VnHyUu(Zr4YDD_z=W)`u-I%z@Tkq%P`qKVls z8PUWElY2Oll^o1c8UTqq!9|_8J#bE3nYL*_!!+SoWrB@bEM-ZH9bkGgeTM^1ZLK!( zv2QFvFmaKj(5JNnADYw{sU%fwsaycS5;p z2u|@of{AN;EDkWw*$;4&%2C*q#0isjk+oUO9rNh4>G5i@SdW?KxA{b}zPch-%SA)6 z3?6(=8H8J_+0`&fap=-&sUUHFa=uS&-SaG+S|;#R#{s5+bYOX!2P~)|WH<;riZNba zVs0l>LAHKa5QMqh#$Vw%P=h*g3;>BifNmlRutW1eS5?y_3W6Bnv9%XtpVuUAPg~8R zBHSWUh)J=o0Syxb6b*U6K@+S-G#d8z;p0%AN9(&S%8lMbB}4BC^U^Mk>2i~EcNihc2gc9BZ5mHy5aAf} z6N$!2LGof2h(pmhK_sSZ)X5Zdpv44l-@BjMoS38&A z{ + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/images/editor/syntaxerror.png b/RedPandaIDE/images/editor/syntaxerror.png deleted file mode 100644 index 9d674113d30c73fbf0f5385ca4ec50b0cf51f0d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2063 zcmb_dO>Epm6y6{xX;GpcI3U^z-o-E@_#NT`I=@p!yzW$kfo zC%efBatorMNc@NcDiY#WQ2CWg1@sV!0~B#U>Y;)I2aq^Wq)2c}8Sfuknv@7w$?NgV zoA15%&G+W5S7xS04m^AylgW&frmb22KA1kk`}qGOTemQO?GLA)i8Gne&GZ?1b$s+t zCUgH`uey*dluseT{492uO|vaOn6c)-A zp~xaC7+F&yKsSUO%mP!>Av`9i3dqY!UIv;3Or$GFRfX6n(8 zh!p)cQ?42ZC-@(Y9fDjI`IzVI`M5^qFsO+_pGj0?4Hj|7JUVS~zEmt$BIbGxz7Wq& zofJxwMH4`i2cHG)aLZ*>3gQF@gqEy=$oa{7o`V!@Lz}9$WJ91zP}Nl_4|G#52rgZAgHcL@`yv)-{kSzbz&-?Zy0;R zwC3b6aIx0s^A0}JQph7i>y^U4a zEB{^B?X`g`o(rTs#rsA&>^Cg_(QkP);8aDtp*B+CH@6K0#-l{$H?9kKAH?Lm*wrV~5{g`0BUQ9~qDCe|__hGcT?s_`=ccm((B4Z`SB1N49UG3*TQ{99syNj-)NS MG&y6vck=AopOxvDpa1{> diff --git a/RedPandaIDE/images/editor/syntaxerror.svg b/RedPandaIDE/images/editor/syntaxerror.svg new file mode 100644 index 00000000..9a98c818 --- /dev/null +++ b/RedPandaIDE/images/editor/syntaxerror.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + diff --git a/RedPandaIDE/images/editor/syntaxwarning.png b/RedPandaIDE/images/editor/syntaxwarning.png deleted file mode 100644 index d8d319a69e0c395f1d7055822bdeaa41ad05fc68..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2050 zcmb_dL2TSa6g7=RL)1o`I0UL%ZV!dl>lxeY^-Q~s(%sN3uxUtFN_qfwJf7XPvi3N( zlif|F914{{6hu_z0Lle{;DYE8svat&hzs1Hr*hzeIFTZOdO(OW-ra0dnuG{g$?NgV zpZEWN|NWUarzX!H92yytB~JrPb^h$U%wJ$)WqJwE)j zB<+93tIQ^|<(Dw!eulW*VVRa63TsI^HQEXZonwjYu$mX-mAf}@DYED0m6>cAl*0n6 zdlO3$JHIqpp-XcVxytBi`BV!F0G}m9ZuyNM#;v^4!Np>nPHT$XF-hj~%2?`9o-I$w z1s*Xuo3T_1&8(b58E6?MLMLP$KwAU01`QQj*aTSD<=#&b-Xgb(r;E?`e2K5TQcsc) zYg)6}%ruP*k7^o32x&mqbX^q|YTOPI(o%!?$R;XWqe&2^wMeMJ3`kSz7`n7?7cNANj&ql4tigO1B(boCecQ0k6CT(34$%GOha3oM z%jLe0ZDaBMzKb{+UleKd2-(&;uCzm@O|zIUM3jv$iZG9)*@Ua zMlOvPEQl--dPPbLtWLedKCRJ_SF;c{wPA$f=hLI}2BPKlI#iGpZUN4gs@SjB$(_O-F$0XR7DbN%pF z-?m0Z<8vRKxD&j8uacQ~V}9+}$47rt+K2YNyMFrQt6y#m8-?N;E-kElcv<>o_?^Mx z`u8t>@bc}AAD)|@`?PU=?dmIEymdgj6W(iI;TMfdLw|fe@WQ^*k6$kj-8^}8<-IG1 yR$l+)wcl4~l#S(~r!I}$UHk6ZPk&yYUzYB-LH*W+8{ee2bZLCD_}Q6@m;VCf+>Xfr diff --git a/RedPandaIDE/images/editor/syntaxwarning.svg b/RedPandaIDE/images/editor/syntaxwarning.svg new file mode 100644 index 00000000..9800847e --- /dev/null +++ b/RedPandaIDE/images/editor/syntaxwarning.svg @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 91c75497..7dda72c9 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -321,7 +321,7 @@ void MainWindow::updateForEncodingInfo() { void MainWindow::updateEditorSettings() { - pIconsManager->updateIcons(pointToPixel(pSettings->editor().fontSize())); + pIconsManager->updateEditorGuttorIcons(pointToPixel(pSettings->editor().fontSize())); mEditorList->applySettings(); }