Nicer tab close icon

This commit is contained in:
Kovid Goyal 2020-01-16 11:19:25 +05:30
parent d70363d408
commit 785c4ae4df
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 103 additions and 4 deletions

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="300px"
width="300px"
fill="#eeeeee"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg4"
sodipodi:docname="close-for-light-theme.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1400"
id="namedview6"
showgrid="false"
inkscape:zoom="0.78666667"
inkscape:cx="-171.61017"
inkscape:cy="150"
inkscape:window-x="0"
inkscape:window-y="40"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" /><path
d="m 29.082441,32.408474 0.675796,-0.664406 c 2.800483,-2.751801 7.338729,-2.751801 10.139212,0 l 8.831365,8.681779 8.83061,-8.682521 c 2.800483,-2.751801 7.341746,-2.751801 10.139212,0 l 0.675796,0.664407 c 2.800483,2.753284 2.800483,7.216525 0,9.969809 l -8.829856,8.682521 8.83061,8.681038 c 2.800484,2.752543 2.800484,7.215784 0,9.969068 l -0.675796,0.664407 c -2.797466,2.752542 -7.338729,2.752542 -10.139212,0 l -8.831364,-8.681038 -8.830611,8.681038 c -2.800483,2.752542 -7.338728,2.752542 -10.139211,0 l -0.675797,-0.664407 c -2.800483,-2.753284 -2.800483,-7.216525 0,-9.969068 l 8.829856,-8.681038 -8.83061,-8.681779 c -2.800483,-2.753284 -2.800483,-7.216526 0,-9.96981 z m 19.646373,55.727119 c -20.827509,0 -37.711865,-16.599788 -37.711865,-37.07553 0,-20.476483 16.884356,-37.077012 37.711865,-37.077012 20.827508,0 37.711864,16.600529 37.711864,37.077012 0,20.475742 -16.884356,37.07553 -37.711864,37.07553 z"
id="path2"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:0.74785435" /></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="300px"
width="300px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg4"
sodipodi:docname="close-for-light-theme.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1400"
id="namedview6"
showgrid="false"
inkscape:zoom="0.78666667"
inkscape:cx="-171.61017"
inkscape:cy="150"
inkscape:window-x="0"
inkscape:window-y="40"
inkscape:window-maximized="0"
inkscape:current-layer="svg4" /><path
d="m 29.082441,32.408474 0.675796,-0.664406 c 2.800483,-2.751801 7.338729,-2.751801 10.139212,0 l 8.831365,8.681779 8.83061,-8.682521 c 2.800483,-2.751801 7.341746,-2.751801 10.139212,0 l 0.675796,0.664407 c 2.800483,2.753284 2.800483,7.216525 0,9.969809 l -8.829856,8.682521 8.83061,8.681038 c 2.800484,2.752543 2.800484,7.215784 0,9.969068 l -0.675796,0.664407 c -2.797466,2.752542 -7.338729,2.752542 -10.139212,0 l -8.831364,-8.681038 -8.830611,8.681038 c -2.800483,2.752542 -7.338728,2.752542 -10.139211,0 l -0.675797,-0.664407 c -2.800483,-2.753284 -2.800483,-7.216525 0,-9.969068 l 8.829856,-8.681038 -8.83061,-8.681779 c -2.800483,-2.753284 -2.800483,-7.216526 0,-9.96981 z m 19.646373,55.727119 c -20.827509,0 -37.711865,-16.599788 -37.711865,-37.07553 0,-20.476483 16.884356,-37.077012 37.711865,-37.077012 20.827508,0 37.711864,16.600529 37.711864,37.077012 0,20.475742 -16.884356,37.07553 -37.711864,37.07553 z"
id="path2"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:0.74785435" /></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1120,10 +1120,9 @@ class Application(QApplication):
transient_scroller = 0
if isosx:
transient_scroller = plugins['cocoa'][0].transient_scroller()
try:
self.pi.load_style(icon_map, transient_scroller)
except TypeError:
self.pi.load_style(icon_map)
icon_map[QStyle.SP_CustomBase + 1] = I('close-for-light-theme.png')
icon_map[QStyle.SP_CustomBase + 2] = I('close-for-dark-theme.png')
self.pi.load_style(icon_map, transient_scroller)
def _send_file_open_events(self):
with self._file_open_lock:

View File

@ -180,6 +180,10 @@ class CalibreStyle: public QProxyStyle {
}
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0) const {
if (standardIcon == QStyle::SP_DialogCloseButton) {
bool is_dark_theme = QApplication::instance()->property("is_dark_theme").toBool();
return QIcon(icon_map.value(QStyle::SP_CustomBase + (is_dark_theme ? 2 : 1)));
}
if (icon_map.contains(standardIcon)) return QIcon(icon_map.value(standardIcon));
return QProxyStyle::standardIcon(standardIcon, option, widget);
}