diff options
author | Gerald Combs <gerald@wireshark.org> | 2014-09-23 13:35:10 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2014-09-23 22:32:53 +0000 |
commit | 31e86998fbaaa4e82e0c502249671025c587ef50 (patch) | |
tree | 632b25070763766d51bbc2d291b3022f8ec47352 | |
parent | 3a85a5eb96aff95b1711961708b863a556d461f1 (diff) |
Qt: Add zoom and column resize actions.
Plumb signals and slots for changing the text size in the main window.
Remove the bold font code from WiresharkApplication. It was only used in
ByteViewText. Adjust the icons a bit.
Bug: When we change the font preferences the packet list stops drawing
cached strings. I haven't been able to track down the cause.
Change-Id: I609d740c9f26265628fa4b7de1b75b0e56651387
Reviewed-on: https://code.wireshark.org/review/4269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
36 files changed, 337 insertions, 177 deletions
diff --git a/image/toolbar.qrc b/image/toolbar.qrc index da3ca10d4e..9234cc1b59 100644 --- a/image/toolbar.qrc +++ b/image/toolbar.qrc @@ -24,6 +24,10 @@ <file>toolbar/16x16/x-capture-start.png</file> <file>toolbar/16x16/x-capture-stop.png</file> <file>toolbar/16x16/x-colorize-packets.png</file> + <file>toolbar/16x16/x-resize-columns.png</file> + <file>toolbar/16x16/zoom-in.png</file> + <file>toolbar/16x16/zoom-original.png</file> + <file>toolbar/16x16/zoom-out.png</file> <file>toolbar/24x24/edit-find.png</file> <file>toolbar/24x24/go-first.png</file> <file>toolbar/24x24/go-jump.png</file> @@ -39,5 +43,9 @@ <file>toolbar/24x24/x-capture-start.png</file> <file>toolbar/24x24/x-capture-stop.png</file> <file>toolbar/24x24/x-colorize-packets.png</file> + <file>toolbar/24x24/x-resize-columns.png</file> + <file>toolbar/24x24/zoom-in.png</file> + <file>toolbar/24x24/zoom-original.png</file> + <file>toolbar/24x24/zoom-out.png</file> </qresource> </RCC> diff --git a/image/toolbar/16x16/x-resize-columns.png b/image/toolbar/16x16/x-resize-columns.png Binary files differindex d938e7407d..9249967abd 100644 --- a/image/toolbar/16x16/x-resize-columns.png +++ b/image/toolbar/16x16/x-resize-columns.png diff --git a/image/toolbar/16x16/x-resize-columns.svg b/image/toolbar/16x16/x-resize-columns.svg index eab2b56c58..51bf1cf3eb 100644 --- a/image/toolbar/16x16/x-resize-columns.svg +++ b/image/toolbar/16x16/x-resize-columns.svg @@ -60,7 +60,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -127,7 +127,7 @@ style="fill:#204a87;stroke:#888a85;stroke-width:1px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" /> <path sodipodi:type="star" - style="fill:#3465a4;fill-opacity:1;stroke:#204a87;stroke-width:3.77817893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#3465a4;fill-opacity:1;stroke:#3465a4;stroke-width:3.77817893000000016;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path4292" sodipodi:sides="3" sodipodi:cx="28" @@ -163,7 +163,7 @@ sodipodi:cx="28" sodipodi:sides="3" id="path4590" - style="fill:#3465a4;fill-opacity:1;stroke:#204a87;stroke-width:3.77817893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#3465a4;fill-opacity:1;stroke:#3465a4;stroke-width:3.77817893000000016;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:type="star" inkscape:transform-center-y="-3.5440869e-05" /> </g> diff --git a/image/toolbar/16x16/zoom-in.png b/image/toolbar/16x16/zoom-in.png Binary files differindex 4b2d18290c..1be8ecf308 100644 --- a/image/toolbar/16x16/zoom-in.png +++ b/image/toolbar/16x16/zoom-in.png diff --git a/image/toolbar/16x16/zoom-in.svg b/image/toolbar/16x16/zoom-in.svg index 9b4453e6f7..9604c17452 100644 --- a/image/toolbar/16x16/zoom-in.svg +++ b/image/toolbar/16x16/zoom-in.svg @@ -15,7 +15,7 @@ version="1.1" inkscape:version="0.48.2 r9819" sodipodi:docname="zoom-in.svg" - inkscape:export-filename="edit-find.png" + inkscape:export-filename="zoom-in.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <defs @@ -35,14 +35,14 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="32.125" + inkscape:zoom="30.9375" inkscape:cx="8" inkscape:cy="8" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" + inkscape:window-width="1239" + inkscape:window-height="664" inkscape:window-x="132" inkscape:window-y="882" inkscape:window-maximized="0"> @@ -102,15 +102,15 @@ <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="7" + width="5" height="1" - x="3" + x="4" y="1042.3622" /> <rect y="-7" - x="1039.3622" + x="1040.3622" height="1" - width="7" + width="5" id="rect3762" style="fill:#2e3436;stroke:none" transform="matrix(0,1,-1,0,0,0)" /> diff --git a/image/toolbar/16x16/zoom-original.png b/image/toolbar/16x16/zoom-original.png Binary files differindex fbe95e11c5..8ccb181cee 100644 --- a/image/toolbar/16x16/zoom-original.png +++ b/image/toolbar/16x16/zoom-original.png diff --git a/image/toolbar/16x16/zoom-original.svg b/image/toolbar/16x16/zoom-original.svg index 22b89524c5..ef8541e6a9 100644 --- a/image/toolbar/16x16/zoom-original.svg +++ b/image/toolbar/16x16/zoom-original.svg @@ -35,14 +35,14 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="32.125" + inkscape:zoom="31.6875" inkscape:cx="8" inkscape:cy="8" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" + inkscape:window-width="1301" + inkscape:window-height="676" inkscape:window-x="132" inkscape:window-y="882" inkscape:window-maximized="0"> @@ -62,7 +62,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -102,15 +102,15 @@ <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="7" + width="5" height="1" - x="3" + x="4" y="1041.3622" /> <rect y="1043.3622" - x="3" + x="4" height="1" - width="7" + width="5" id="rect3816" style="fill:#2e3436;stroke:none" /> </g> diff --git a/image/toolbar/16x16/zoom-out.png b/image/toolbar/16x16/zoom-out.png Binary files differindex fa295789ae..8c83b38026 100644 --- a/image/toolbar/16x16/zoom-out.png +++ b/image/toolbar/16x16/zoom-out.png diff --git a/image/toolbar/16x16/zoom-out.svg b/image/toolbar/16x16/zoom-out.svg index 9c0af8f6b0..d56b57f608 100644 --- a/image/toolbar/16x16/zoom-out.svg +++ b/image/toolbar/16x16/zoom-out.svg @@ -15,7 +15,7 @@ version="1.1" inkscape:version="0.48.2 r9819" sodipodi:docname="zoom-out.svg" - inkscape:export-filename="zoom-in.png" + inkscape:export-filename="zoom-out.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <defs @@ -35,14 +35,14 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="32.125" + inkscape:zoom="30.8125" inkscape:cx="8" inkscape:cy="8" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" + inkscape:window-width="1241" + inkscape:window-height="662" inkscape:window-x="132" inkscape:window-y="882" inkscape:window-maximized="0"> @@ -102,9 +102,9 @@ <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="7" + width="5" height="1" - x="3" + x="4" y="1042.3622" /> </g> </svg> diff --git a/image/toolbar/24x24/x-capture-start.png b/image/toolbar/24x24/x-capture-start.png Binary files differindex 0b3ffd476a..dbffe63ab6 100644 --- a/image/toolbar/24x24/x-capture-start.png +++ b/image/toolbar/24x24/x-capture-start.png diff --git a/image/toolbar/24x24/x-capture-start.svg b/image/toolbar/24x24/x-capture-start.svg index ec9f569134..099c716f4c 100644 --- a/image/toolbar/24x24/x-capture-start.svg +++ b/image/toolbar/24x24/x-capture-start.svg @@ -58,10 +58,10 @@ inkscape:collect="always" xlink:href="#linearGradient5075" id="linearGradient5081" - x1="15" - y1="4" - x2="18" - y2="11.5" + x1="10" + y1="6.5" + x2="12.5" + y2="14" gradientUnits="userSpaceOnUse" /></defs> <path fill="#FFFFFF" @@ -74,13 +74,13 @@ inkscape:guide-bbox="true" inkscape:window-maximized="0" inkscape:window-height="837" - inkscape:cy="11.54297" - inkscape:cx="15.291385" - inkscape:window-x="206" + inkscape:cy="12" + inkscape:cx="17.508885" + inkscape:window-x="0" id="base" - inkscape:window-y="0" + inkscape:window-y="759" showgrid="true" - inkscape:zoom="24.101265"> + inkscape:zoom="27.833333"> <inkscape:grid type="xygrid" diff --git a/image/toolbar/24x24/x-resize-columns.png b/image/toolbar/24x24/x-resize-columns.png Binary files differindex 56b404fb0a..4ed0ac9c9c 100644 --- a/image/toolbar/24x24/x-resize-columns.png +++ b/image/toolbar/24x24/x-resize-columns.png diff --git a/image/toolbar/24x24/x-resize-columns.svg b/image/toolbar/24x24/x-resize-columns.svg index 9b08891b10..fd8f79bcc8 100644 --- a/image/toolbar/24x24/x-resize-columns.svg +++ b/image/toolbar/24x24/x-resize-columns.svg @@ -27,16 +27,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="23.291667" - inkscape:cx="11.248658" + inkscape:zoom="23.170984" + inkscape:cx="13.544453" inkscape:cy="12" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="1028" - inkscape:window-height="728" - inkscape:window-x="132" - inkscape:window-y="821" + inkscape:window-width="1278" + inkscape:window-height="725" + inkscape:window-x="98" + inkscape:window-y="800" inkscape:window-maximized="0" showguides="true" inkscape:guide-bbox="true"> @@ -140,12 +140,12 @@ inkscape:connector-curvature="0" /> <path style="fill:#888a85;stroke:#888a85;stroke-width:1px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" - d="m 12.5,1029.8622 c 0,21 0,21 0,21" + d="m 14.5,1029.8622 c 0,21 0,21 0,21" id="path4546" inkscape:connector-curvature="0" /> <path sodipodi:type="star" - style="fill:#3465a4;fill-opacity:1;stroke:#204a87;stroke-width:3.77799654;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#3465a4;fill-opacity:1;stroke:#3465a4;stroke-width:3.77799654;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path4292" sodipodi:sides="3" sodipodi:cx="28" @@ -158,17 +158,17 @@ inkscape:rounded="1" inkscape:randomized="0" d="M 28,14 C 17.607695,14 17.607695,14 22.803847,5.0000001 28,-4 28,-4 33.196152,4.9999999 38.392305,14 38.392305,14 28,14 z" - transform="matrix(0,0.36782069,0.19047619,0,12.833333,1025.8965)" + transform="matrix(0,0.36782069,0.19047619,0,14.833333,1025.8965)" inkscape:transform-center-x="0.35719799" inkscape:transform-center-y="-3.6850305e-05" /> <path inkscape:connector-curvature="0" id="path4548" - d="m 5.4999996,1029.8604 c 0,21.0018 0,21.0018 0,21.0018" + d="m 6.4999994,1029.8604 c 0,21.0018 0,21.0018 0,21.0018" style="fill:#888a85;stroke:#888a85;stroke-width:1px;stroke-linecap:square;stroke-linejoin:miter;stroke-opacity:1" /> <path inkscape:transform-center-x="-0.35719839" - transform="matrix(0,0.36781774,-0.19047619,0,5.1666667,1025.8956)" + transform="matrix(0,0.36781774,-0.19047619,0,6.1666667,1025.8956)" d="M 28,14 C 17.607695,14 17.607695,14 22.803847,5.0000001 28,-4 28,-4 33.196152,4.9999999 38.392305,14 38.392305,14 28,14 z" inkscape:randomized="0" inkscape:rounded="1" @@ -181,7 +181,7 @@ sodipodi:cx="28" sodipodi:sides="3" id="path4550" - style="fill:#3465a4;fill-opacity:1;stroke:#204a87;stroke-width:3.7780118;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#3465a4;fill-opacity:1;stroke:#3465a4;stroke-width:3.7780118;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:type="star" inkscape:transform-center-y="-4.3803627e-05" /> </g> diff --git a/image/toolbar/24x24/zoom-in.png b/image/toolbar/24x24/zoom-in.png Binary files differindex b792c9c691..dc596faa4e 100644 --- a/image/toolbar/24x24/zoom-in.png +++ b/image/toolbar/24x24/zoom-in.png diff --git a/image/toolbar/24x24/zoom-in.svg b/image/toolbar/24x24/zoom-in.svg index 4c140e2ffe..bae0b0748d 100644 --- a/image/toolbar/24x24/zoom-in.svg +++ b/image/toolbar/24x24/zoom-in.svg @@ -15,7 +15,7 @@ version="1.1" inkscape:version="0.48.2 r9819" sodipodi:docname="zoom-in.svg" - inkscape:export-filename="edit-find.png" + inkscape:export-filename="zoom-in.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <defs @@ -35,16 +35,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="21.416667" - inkscape:cx="12" + inkscape:zoom="21.541667" + inkscape:cx="11.46994" inkscape:cy="12" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" - inkscape:window-x="285" - inkscape:window-y="790" + inkscape:window-width="1147" + inkscape:window-height="686" + inkscape:window-x="1837" + inkscape:window-y="214" inkscape:window-maximized="0"> <inkscape:grid type="xygrid" @@ -72,47 +72,52 @@ id="layer1" transform="translate(0,-1028.3622)"> <g - id="g3759" - transform="matrix(0.67307799,-0.67353235,0.67334032,0.67379466,-697.89982,353.9867)"> + id="g3043" + transform="matrix(0.70712074,-0.70710678,0.70712074,0.70710678,-735.46474,319.5415)"> <rect - ry="1.0495892" - rx="1.0504072" - y="1042.3622" - x="16.5" - height="9" - width="3" + transform="matrix(0.99999995,-3.1484358e-4,-3.6143743e-4,0.99999993,0,0)" + ry="0.99980539" + rx="1.0001751" + y="1042.9893" + x="17.949001" + height="7.9997311" + width="2.8565922" id="rect2987" - style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:1.04999804;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:0.99999022;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> <path inkscape:connector-curvature="0" id="path3757" - d="m 18,1030.3622 c 0,13 0,13 0,13" - style="fill:none;stroke:#2e3436;stroke-width:2.09999609;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + d="M 19.004176,1030.9788 C 19,1043.3622 19,1043.3622 19,1043.3622" + style="fill:none;stroke:#2e3436;stroke-width:1.99998021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> </g> <path sodipodi:type="arc" - style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.59280384;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.67774409;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2985" sodipodi:cx="7" sodipodi:cy="6.5" sodipodi:rx="5" sodipodi:ry="4.5" d="m 12,6.5 a 5,4.5 0 1 1 -10,0 5,4.5 0 1 1 10,0 z" - transform="matrix(1.3854093,-0.80046638,0.88874043,1.5404982,-5.9746781,1033.4462)" /> + transform="matrix(1.2122332,-0.69988316,0.77764788,1.3469257,-4.0403435,1034.0064)" /> <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="11" + width="7" height="1" - x="4" - y="1037.3622" /> + x="6" + y="1037.3622" + rx="0.5" + ry="0.5" /> <rect y="-10" - x="1032.3622" + x="1034.3622" height="1" - width="11.000004" + width="7.0000296" id="rect3762" style="fill:#2e3436;stroke:none" - transform="matrix(0,1,-1,0,0,0)" /> + transform="matrix(0,1,-1,0,0,0)" + rx="0.5" + ry="0.5" /> </g> </svg> diff --git a/image/toolbar/24x24/zoom-original.png b/image/toolbar/24x24/zoom-original.png Binary files differindex f02c8ab327..57cbf4cc00 100644 --- a/image/toolbar/24x24/zoom-original.png +++ b/image/toolbar/24x24/zoom-original.png diff --git a/image/toolbar/24x24/zoom-original.svg b/image/toolbar/24x24/zoom-original.svg index a74693fda5..5f7c85a258 100644 --- a/image/toolbar/24x24/zoom-original.svg +++ b/image/toolbar/24x24/zoom-original.svg @@ -35,16 +35,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="21.416667" + inkscape:zoom="22.041667" inkscape:cx="12" inkscape:cy="12" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" - inkscape:window-x="285" - inkscape:window-y="790" + inkscape:window-width="1255" + inkscape:window-height="698" + inkscape:window-x="87" + inkscape:window-y="784" inkscape:window-maximized="0"> <inkscape:grid type="xygrid" @@ -62,7 +62,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -72,46 +72,51 @@ id="layer1" transform="translate(0,-1028.3622)"> <g - id="g3759" - transform="matrix(0.67307799,-0.67353235,0.67334032,0.67379466,-697.89982,353.9867)"> + id="g3043" + transform="matrix(0.70712074,-0.70710678,0.70712074,0.70710678,-735.46474,319.5415)"> <rect - ry="1.0495892" - rx="1.0504072" - y="1042.3622" - x="16.5" - height="9" - width="3" + transform="matrix(0.99999995,-3.1484358e-4,-3.6143743e-4,0.99999993,0,0)" + ry="0.99980539" + rx="1.0001751" + y="1042.9893" + x="17.949001" + height="7.9997311" + width="2.8565922" id="rect2987" - style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:1.04999804;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:0.99999022;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> <path inkscape:connector-curvature="0" id="path3757" - d="m 18,1030.3622 c 0,13 0,13 0,13" - style="fill:none;stroke:#2e3436;stroke-width:2.09999609;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + d="M 19.004176,1030.9788 C 19,1043.3622 19,1043.3622 19,1043.3622" + style="fill:none;stroke:#2e3436;stroke-width:1.99998021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> </g> <path sodipodi:type="arc" - style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.59280384;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.67774415;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2985" sodipodi:cx="7" sodipodi:cy="6.5" sodipodi:rx="5" sodipodi:ry="4.5" - d="m 12,6.5 a 5,4.5 0 1 1 -10,0 5,4.5 0 1 1 10,0 z" - transform="matrix(1.3854093,-0.80046638,0.88874043,1.5404982,-5.9746781,1033.4462)" /> + d="M 12,6.5 C 12,8.9852814 9.7614237,11 7,11 4.2385763,11 2,8.9852814 2,6.5 2,4.0147186 4.2385763,2 7,2 c 2.7614237,0 5,2.0147186 5,4.5 z" + transform="matrix(1.2122332,-0.69988313,0.77764791,1.3469257,-4.0403436,1034.0064)" /> <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="11" + width="7" height="1" - x="4" - y="1035.3622" /> + x="6" + y="1036.3623" + rx="0.5" + ry="0.5" /> <rect - y="1039.3622" - x="4" + y="1038.3623" + x="6" height="1" - width="11" + width="7" id="rect4485" - style="fill:#2e3436;stroke:none" /> + style="fill:#2e3436;stroke:none" + rx="0.5" + ry="0.5" /> </g> </svg> diff --git a/image/toolbar/24x24/zoom-out.png b/image/toolbar/24x24/zoom-out.png Binary files differindex 52f95d8de5..f4c9f69ddc 100644 --- a/image/toolbar/24x24/zoom-out.png +++ b/image/toolbar/24x24/zoom-out.png diff --git a/image/toolbar/24x24/zoom-out.svg b/image/toolbar/24x24/zoom-out.svg index 179273f21c..354f18f40d 100644 --- a/image/toolbar/24x24/zoom-out.svg +++ b/image/toolbar/24x24/zoom-out.svg @@ -15,7 +15,7 @@ version="1.1" inkscape:version="0.48.2 r9819" sodipodi:docname="zoom-out.svg" - inkscape:export-filename="zoom-in.png" + inkscape:export-filename="zoom-out.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <defs @@ -35,16 +35,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="21.416667" + inkscape:zoom="23.583333" inkscape:cx="12" inkscape:cy="12" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="931" - inkscape:window-height="683" - inkscape:window-x="285" - inkscape:window-y="790" + inkscape:window-width="1312" + inkscape:window-height="735" + inkscape:window-x="1750" + inkscape:window-y="260" inkscape:window-maximized="0"> <inkscape:grid type="xygrid" @@ -72,39 +72,42 @@ id="layer1" transform="translate(0,-1028.3622)"> <g - id="g3759" - transform="matrix(0.67307799,-0.67353235,0.67334032,0.67379466,-697.89982,353.9867)"> + id="g3043" + transform="matrix(0.70712074,-0.70710678,0.70712074,0.70710678,-735.46474,319.5415)"> <rect - ry="1.0495892" - rx="1.0504072" - y="1042.3622" - x="16.5" - height="9" - width="3" + transform="matrix(0.99999995,-3.1484358e-4,-3.6143743e-4,0.99999993,0,0)" + ry="0.99980539" + rx="1.0001751" + y="1042.9893" + x="17.949001" + height="7.9997311" + width="2.8565922" id="rect2987" - style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:1.04999804;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + style="fill:#2e3436;fill-opacity:1;stroke:#2e3436;stroke-width:0.99999022;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> <path inkscape:connector-curvature="0" id="path3757" - d="m 18,1030.3622 c 0,13 0,13 0,13" - style="fill:none;stroke:#2e3436;stroke-width:2.09999609;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + d="M 19.004176,1030.9788 C 19,1043.3622 19,1043.3622 19,1043.3622" + style="fill:none;stroke:#2e3436;stroke-width:1.99998021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> </g> <path sodipodi:type="arc" - style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.59280384;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + style="fill:#eeeeec;fill-opacity:1;stroke:#2e3436;stroke-width:0.67774409;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="path2985" sodipodi:cx="7" sodipodi:cy="6.5" sodipodi:rx="5" sodipodi:ry="4.5" - d="m 12,6.5 a 5,4.5 0 1 1 -10,0 5,4.5 0 1 1 10,0 z" - transform="matrix(1.3854093,-0.80046638,0.88874043,1.5404982,-5.9746781,1033.4462)" /> + d="M 12,6.5 C 12,8.9852814 9.7614237,11 7,11 4.2385763,11 2,8.9852814 2,6.5 2,4.0147186 4.2385763,2 7,2 c 2.7614237,0 5,2.0147186 5,4.5 z" + transform="matrix(1.2122332,-0.69988318,0.77764791,1.3469257,-4.0403436,1034.0064)" /> <rect style="fill:#2e3436;stroke:none" id="rect3760" - width="11" - height="1" - x="4" - y="1037.3622" /> + width="7" + height="0.99997389" + x="5.999999" + y="1037.3619" + rx="0.5" + ry="0.5" /> </g> </svg> diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp index 541b89b80e..04b3008b13 100644 --- a/ui/qt/byte_view_tab.cpp +++ b/ui/qt/byte_view_tab.cpp @@ -35,6 +35,8 @@ void ByteViewTab::addTab(const char *name, tvbuff_t *tvb, proto_tree *tree, QTre ByteViewText *byte_view_text = new ByteViewText(this, tvb, tree, protoTree, encoding); byte_view_text->setAccessibleName(name); + byte_view_text->setMonospaceFont(mono_font_); + connect(this, SIGNAL(monospaceFontChanged(QFont)), byte_view_text, SLOT(setMonospaceFont(QFont))); QTabWidget::addTab(byte_view_text, name); } @@ -181,6 +183,13 @@ void ByteViewTab::setCaptureFile(capture_file *cf) cap_file_ = cf; } +void ByteViewTab::setMonospaceFont(const QFont &mono_font) +{ + mono_font_ = mono_font; + emit monospaceFontChanged(mono_font_); + update(); +} + /* * Editor modelines * diff --git a/ui/qt/byte_view_tab.h b/ui/qt/byte_view_tab.h index b71ecd37bb..89c2008d3c 100644 --- a/ui/qt/byte_view_tab.h +++ b/ui/qt/byte_view_tab.h @@ -44,16 +44,19 @@ public: private: void setTabsVisible(); capture_file *cap_file_; + QFont mono_font_; protected: void tabInserted(int index); void tabRemoved(int index); signals: + void monospaceFontChanged(const QFont &mono_font); public slots: void protoTreeItemChanged(QTreeWidgetItem *current); void setCaptureFile(capture_file *cf); + void setMonospaceFont(const QFont &mono_font); }; #endif // BYTE_VIEW_TAB_H diff --git a/ui/qt/byte_view_text.cpp b/ui/qt/byte_view_text.cpp index 559dee1bbf..7920b55d52 100644 --- a/ui/qt/byte_view_text.cpp +++ b/ui/qt/byte_view_text.cpp @@ -122,6 +122,14 @@ void ByteViewText::renderBytes() setUpdatesEnabled(true); } +void ByteViewText::setMonospaceFont(const QFont &mono_font) +{ + mono_normal_font_ = mono_font; + mono_bold_font_ = QFont(mono_font); + mono_bold_font_.setBold(true); + renderBytes(); +} + // Private #define BYTE_VIEW_SEP 8 /* insert a space every BYTE_VIEW_SEP bytes */ @@ -285,7 +293,7 @@ void ByteViewText::setState(ByteViewText::highlight_state state) QPalette pal = wsApp->palette(); moveCursor(QTextCursor::End); - setCurrentFont(wsApp->monospaceFont()); + setCurrentFont(mono_normal_font_); setTextColor(pal.text().color()); setTextBackgroundColor(pal.base().color()); @@ -295,7 +303,7 @@ void ByteViewText::setState(ByteViewText::highlight_state state) break; case StateField: if (bold_highlight_) { - setCurrentFont(wsApp->monospaceFont(true)); + setCurrentFont(mono_bold_font_); } else { setTextColor(pal.base().color()); setTextBackgroundColor(pal.text().color()); diff --git a/ui/qt/byte_view_text.h b/ui/qt/byte_view_text.h index 65b8be6e93..f4f9ef378b 100644 --- a/ui/qt/byte_view_text.h +++ b/ui/qt/byte_view_text.h @@ -54,6 +54,9 @@ public: void setFieldAppendixHighlight(int start, int end); void renderBytes(); +public slots: + void setMonospaceFont(const QFont &mono_font); + private: typedef enum { StateNormal, @@ -72,6 +75,8 @@ private: tvbuff_t *tvb_; proto_tree *proto_tree_; QTreeWidget *tree_widget_; + QFont mono_normal_font_; + QFont mono_bold_font_; gboolean bold_highlight_; diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index a589914cea..ce51981129 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -113,8 +113,10 @@ MainWindow::MainWindow(QWidget *parent) : //Otherwise unexpected problems may occur setFeaturesEnabled(false); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(setFeaturesEnabled())); + connect(wsApp, SIGNAL(appInitialized()), this, SLOT(zoomText())); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(layoutPanes())); + connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(zoomText())); connect(wsApp, SIGNAL(recentFilesRead()), this, SLOT(loadWindowGeometry())); @@ -170,9 +172,13 @@ MainWindow::MainWindow(QWidget *parent) : main_ui_->actionViewColorizePacketList->setChecked(recent.packet_list_colorize); // main_ui_->actionViewAutoScroll->setIcon(StockIcon("x-stay-last")); -// main_ui_->actionViewZoomIn->setIcon(StockIcon("zoom-in")); -// main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out")); -// main_ui_->actionViewZoomOriginal->setIcon(StockIcon("zoom-original")); + QList<QKeySequence> zi_seq = main_ui_->actionViewZoomIn->shortcuts(); + zi_seq << QKeySequence(Qt::CTRL + Qt::Key_Equal); + main_ui_->actionViewZoomIn->setIcon(StockIcon("zoom-in")); + main_ui_->actionViewZoomIn->setShortcuts(zi_seq); + main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out")); + main_ui_->actionViewNormalSize->setIcon(StockIcon("zoom-original")); + main_ui_->actionViewResizeColumns->setIcon(StockIcon("x-resize-columns")); // In Qt4 multiple toolbars and "pretty" are mutually exculsive on OS X. If // unifiedTitleAndToolBarOnMac is enabled everything ends up in the same row. @@ -286,6 +292,13 @@ MainWindow::MainWindow(QWidget *parent) : connect(this, SIGNAL(setCaptureFile(capture_file*)), byte_view_tab_, SLOT(setCaptureFile(capture_file*))); + connect(this, SIGNAL(monospaceFontChanged(QFont)), + packet_list_, SLOT(setMonospaceFont(QFont))); + connect(this, SIGNAL(monospaceFontChanged(QFont)), + proto_tree_, SLOT(setMonospaceFont(QFont))); + connect(this, SIGNAL(monospaceFontChanged(QFont)), + byte_view_tab_, SLOT(setMonospaceFont(QFont))); + connect(main_ui_->actionGoNextPacket, SIGNAL(triggered()), packet_list_, SLOT(goNextPacket())); connect(main_ui_->actionGoPreviousPacket, SIGNAL(triggered()), @@ -1537,12 +1550,6 @@ void MainWindow::setForCapturedPackets(bool have_captured_packets) main_ui_->actionEditFindPacket->setEnabled(have_captured_packets); main_ui_->actionEditFindNext->setEnabled(have_captured_packets); main_ui_->actionEditFindPrevious->setEnabled(have_captured_packets); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomIn", -// have_captured_packets); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ZoomOut", -// have_captured_packets); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NormalSize", -// have_captured_packets); main_ui_->actionGoGoToPacket->setEnabled(have_captured_packets); main_ui_->actionGoPreviousPacket->setEnabled(have_captured_packets); @@ -1550,6 +1557,11 @@ void MainWindow::setForCapturedPackets(bool have_captured_packets) main_ui_->actionGoFirstPacket->setEnabled(have_captured_packets); main_ui_->actionGoLastPacket->setEnabled(have_captured_packets); + main_ui_->actionViewZoomIn->setEnabled(have_captured_packets); + main_ui_->actionViewZoomOut->setEnabled(have_captured_packets); + main_ui_->actionViewNormalSize->setEnabled(have_captured_packets); + main_ui_->actionViewResizeColumns->setEnabled(have_captured_packets); + // set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/PreviousPacketInConversation", // have_captured_packets); // set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/GoMenu/NextPacketInConversation", @@ -1573,8 +1585,6 @@ void MainWindow::setMenusForFileSet(bool enable_list_files) { void MainWindow::updateForUnsavedChanges() { setTitlebarForCaptureFile(); setMenusForCaptureFile(); -// set_toolbar_for_capture_file(cf); - } void MainWindow::changeEvent(QEvent* event) @@ -1590,9 +1600,7 @@ void MainWindow::changeEvent(QEvent* event) default: break; } - } - QMainWindow::changeEvent(event); } diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 66d0259021..b46ca24e43 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -106,6 +106,7 @@ private: MainWelcome *main_welcome_; DisplayFilterCombo *df_combo_box_; capture_file *cap_file_; + QFont mono_font_; // XXX - packet_list_, proto_tree_, and byte_view_tab_ should // probably be full-on values instead of pointers. PacketList *packet_list_; @@ -163,6 +164,7 @@ signals: void setCaptureFile(capture_file *cf); void setDissectedCaptureFile(capture_file *cf); void displayFilterSuccess(bool success); + void monospaceFontChanged(const QFont &mono_font); public slots: // in main_window_slots.cpp @@ -277,7 +279,12 @@ private slots: void on_actionEditConfigurationProfiles_triggered(); void on_actionEditPreferences_triggered(); + void zoomText(); + void on_actionViewZoomIn_triggered(); + void on_actionViewZoomOut_triggered(); + void on_actionViewNormalSize_triggered(); void on_actionViewColorizePacketList_triggered(bool checked); + void on_actionViewResizeColumns_triggered(); void on_actionViewReload_triggered(); void on_actionViewToolbarMainToolbar_triggered(); void on_actionViewToolbarDisplayFilter_triggered(); diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index 41154df429..f091c98a48 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -239,6 +239,14 @@ <addaction name="actionViewToolbarMainToolbar"/> <addaction name="actionViewToolbarDisplayFilter"/> </widget> + <widget class="QMenu" name="menuZoom"> + <property name="title"> + <string>Zoom</string> + </property> + <addaction name="actionViewZoomIn"/> + <addaction name="actionViewZoomOut"/> + <addaction name="actionViewNormalSize"/> + </widget> <addaction name="separator"/> <addaction name="actionViewExpandSubtrees"/> <addaction name="actionViewExpandAll"/> @@ -246,7 +254,9 @@ <addaction name="separator"/> <addaction name="actionViewColorizePacketList"/> <addaction name="separator"/> - <addaction name="actionViewZoomIn"/> + <addaction name="menuZoom"/> + <addaction name="separator"/> + <addaction name="actionViewResizeColumns"/> <addaction name="separator"/> <addaction name="actionViewReload"/> <addaction name="menuToolbars"/> @@ -499,6 +509,11 @@ <addaction name="actionGoLastPacket"/> <addaction name="separator"/> <addaction name="actionViewColorizePacketList"/> + <addaction name="separator"/> + <addaction name="actionViewZoomIn"/> + <addaction name="actionViewZoomOut"/> + <addaction name="actionViewNormalSize"/> + <addaction name="actionViewResizeColumns"/> </widget> <widget class="MainStatusBar" name="statusBar"/> <widget class="QToolBar" name="displayFilterToolBar"> @@ -1743,7 +1758,7 @@ <string>Colorize Packet List</string> </property> <property name="toolTip"> - <string>Color packets according to the coloring rules</string> + <string>Draw packets using your coloring rules</string> </property> </action> <action name="actionViewZoomIn"> @@ -1754,7 +1769,34 @@ <string>Enlarge the main window text</string> </property> <property name="shortcut"> - <string>Meta++</string> + <string>Ctrl++</string> + </property> + </action> + <action name="actionViewZoomOut"> + <property name="text"> + <string>Zoom Out</string> + </property> + <property name="shortcut"> + <string>Ctrl+-</string> + </property> + </action> + <action name="actionViewNormalSize"> + <property name="text"> + <string>Normal Size</string> + </property> + <property name="shortcut"> + <string>Ctrl+0</string> + </property> + </action> + <action name="actionViewResizeColumns"> + <property name="text"> + <string>Resize Columns</string> + </property> + <property name="toolTip"> + <string>Resize packet list columns to fit contents</string> + </property> + <property name="shortcut"> + <string>Ctrl+Shift+R</string> </property> </action> </widget> diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index ea5fc246de..b58e7e1caf 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1677,6 +1677,36 @@ void MainWindow::on_actionEditPreferences_triggered() // View Menu +void MainWindow::zoomText() +{ + // Scale by 10%, rounding to nearest half point, minimum 1 point. + // XXX Small sizes repeat. It might just be easier to create a map of multipliers. + mono_font_ = QFont(wsApp->monospaceFont()); + qreal zoom_size = wsApp->monospaceFont().pointSize() * 2 * qPow(1.1, recent.gui_zoom_level); + zoom_size = qRound(zoom_size) / 2.0; + zoom_size = qMax(zoom_size, 1.0); + mono_font_.setPointSizeF(zoom_size); + emit monospaceFontChanged(mono_font_); +} + +void MainWindow::on_actionViewZoomIn_triggered() +{ + recent.gui_zoom_level++; + zoomText(); +} + +void MainWindow::on_actionViewZoomOut_triggered() +{ + recent.gui_zoom_level--; + zoomText(); +} + +void MainWindow::on_actionViewNormalSize_triggered() +{ + recent.gui_zoom_level = 0; + zoomText(); +} + void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) { recent.packet_list_colorize = checked; color_filters_enable(checked); @@ -1684,6 +1714,13 @@ void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) { packet_list_->update(); } +void MainWindow::on_actionViewResizeColumns_triggered() +{ + for (int col = 0; col < packet_list_->packetListModel()->columnCount(); col++) { + packet_list_->resizeColumnToContents(col); + } +} + void MainWindow::on_actionViewReload_triggered() { cf_reload(&cfile); diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 2964a978b6..bb593ad0ed 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -418,9 +418,9 @@ void PacketList::showEvent (QShowEvent *event) { fmt = get_column_format(i); long_str = get_column_width_string(fmt, i); if (long_str) { - col_width = wsApp->monospaceTextSize(long_str); + col_width = packet_list_model_->columnTextSize(long_str); } else { - col_width = wsApp->monospaceTextSize(MIN_COL_WIDTH_STR); + col_width = packet_list_model_->columnTextSize(MIN_COL_WIDTH_STR); } setColumnWidth(i, col_width); } @@ -790,6 +790,11 @@ void PacketList::setCaptureFile(capture_file *cf) packet_list_model_->setCaptureFile(cf); } +void PacketList::setMonospaceFont(const QFont &mono_font) +{ + packet_list_model_->setMonospaceFont(mono_font); +} + void PacketList::goNextPacket(void) { setCurrentIndex(moveCursor(MoveDown, Qt::NoModifier)); } diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index c957b7eb41..36d98ca05e 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -79,6 +79,7 @@ signals: public slots: void setCaptureFile(capture_file *cf); + void setMonospaceFont(const QFont &mono_font); void goNextPacket(); void goPreviousPacket(); void goFirstPacket(); diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index cc034a5af7..0de133d440 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -33,6 +33,7 @@ #include "wireshark_application.h" #include <QColor> +#include <QFontMetrics> #include <QModelIndex> PacketListModel::PacketListModel(QObject *parent, capture_file *cf) : @@ -121,6 +122,19 @@ void PacketListModel::resetColorized() endResetModel(); } +int PacketListModel::columnTextSize(const char *str) +{ + QFontMetrics fm(mono_font_); + + return fm.width(str); +} + +void PacketListModel::setMonospaceFont(const QFont &mono_font) +{ + mono_font_ = mono_font; + recreateVisibleRows(); +} + int PacketListModel::rowCount(const QModelIndex &parent) const { if (parent.column() >= prefs.num_cols) @@ -150,7 +164,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const switch (role) { case Qt::FontRole: - return wsApp->monospaceFont(); + return mono_font_; case Qt::TextAlignmentRole: switch(recent_get_column_xalign(index.column())) { case COLUMN_XALIGN_RIGHT: diff --git a/ui/qt/packet_list_model.h b/ui/qt/packet_list_model.h index f245c111c7..3775f1958a 100644 --- a/ui/qt/packet_list_model.h +++ b/ui/qt/packet_list_model.h @@ -62,18 +62,20 @@ public: int visibleIndexOf(frame_data *fdata) const; void resetColumns(); void resetColorized(); + int columnTextSize(const char *str); signals: public slots: + void setMonospaceFont(const QFont &mono_font); private: capture_file *cap_file_; + QFont mono_font_; QList<QString> col_names_; QVector<PacketListRecord *> visible_rows_; QVector<PacketListRecord *> physical_rows_; QMap<int, int> number_to_row_; - QFont pl_font_; int header_height_; }; diff --git a/ui/qt/packet_list_record.h b/ui/qt/packet_list_record.h index c1042118bf..18fd3d90ba 100644 --- a/ui/qt/packet_list_record.h +++ b/ui/qt/packet_list_record.h @@ -43,6 +43,7 @@ public: QVariant columnString(capture_file *cap_file, int column); frame_data *frameData(); + int columnTextSize(const char *str); static void resetColumns(column_info *cinfo); void resetColorized(); diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 058292287d..eefa999986 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -26,13 +26,12 @@ #include <epan/ftypes/ftypes.h> #include <epan/prefs.h> -#include "wireshark_application.h" +#include <QApplication> +#include <QContextMenuEvent> +#include <QDesktopServices> #include <QHeaderView> #include <QTreeWidgetItemIterator> -#include <QDesktopServices> #include <QUrl> -#include <QContextMenuEvent> -#include <QMainWindow> QColor expert_color_comment ( 0xb7, 0xf7, 0x74 ); /* Green */ QColor expert_color_chat ( 0x80, 0xb7, 0xf7 ); /* light blue */ @@ -257,9 +256,16 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event) decode_as_->setData(QVariant()); } +void ProtoTree::setMonospaceFont(const QFont &mono_font) +{ + mono_font_ = mono_font; + setFont(mono_font_); + update(); +} + void ProtoTree::fillProtocolTree(proto_tree *protocol_tree) { clear(); - setFont(wsApp->monospaceFont()); + setFont(mono_font_); proto_tree_children_foreach(protocol_tree, proto_tree_draw_node, invisibleRootItem()); } diff --git a/ui/qt/proto_tree.h b/ui/qt/proto_tree.h index d9ea36cde0..6f7bd0d678 100644 --- a/ui/qt/proto_tree.h +++ b/ui/qt/proto_tree.h @@ -46,6 +46,7 @@ protected: private: QMenu ctx_menu_; QAction *decode_as_; + QFont mono_font_; signals: void protoItemSelected(QString &); @@ -54,6 +55,7 @@ signals: void relatedFrame(int); public slots: + void setMonospaceFont(const QFont &mono_font); void updateSelectionStatus(QTreeWidgetItem*); void expand(const QModelIndex & index); void collapse(const QModelIndex & index); diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 89a70dec3f..e809db302d 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -335,9 +335,9 @@ void WiresharkApplication::helpTopicAction(topic_action_e action) void WiresharkApplication::setMonospaceFont(const char *font_string) { if (font_string && strlen(font_string) > 0) { - mono_regular_font_.fromString(font_string); - mono_bold_font_ = QFont(mono_regular_font_); - mono_bold_font_.setBold(true); + mono_font_.fromString(font_string); +// mono_bold_font_ = QFont(mono_regular_font_); +// mono_bold_font_.setBold(true); return; } @@ -365,33 +365,23 @@ void WiresharkApplication::setMonospaceFont(const char *font_string) { substitutes << x11_alt_fonts << win_default_font << win_alt_font << osx_default_font << osx_alt_font << fallback_fonts; #endif - mono_regular_font_.setFamily(default_font); - mono_regular_font_.insertSubstitutions(default_font, substitutes); - mono_regular_font_.setPointSize(wsApp->font().pointSize() + font_size_adjust); - mono_regular_font_.setBold(false); + mono_font_.setFamily(default_font); + mono_font_.insertSubstitutions(default_font, substitutes); + mono_font_.setPointSize(wsApp->font().pointSize() + font_size_adjust); + mono_font_.setBold(false); - mono_bold_font_ = QFont(mono_regular_font_); - mono_bold_font_.setBold(true); +// mono_bold_font_ = QFont(mono_font_); +// mono_bold_font_.setBold(true); g_free(prefs.gui_qt_font_name); - prefs.gui_qt_font_name = g_strdup(mono_regular_font_.toString().toUtf8().constData()); + prefs.gui_qt_font_name = g_strdup(mono_font_.toString().toUtf8().constData()); } -int WiresharkApplication::monospaceTextSize(const char *str, bool bold) +int WiresharkApplication::monospaceTextSize(const char *str) { - QFontMetrics *fm; + QFontMetrics fm(mono_font_); - if (bold) - fm = new QFontMetrics(mono_bold_font_); - else - fm = new QFontMetrics(mono_regular_font_); - - return fm->width(str); -} - -QFont WiresharkApplication::monospaceFont(bool bold) -{ - return bold ? mono_bold_font_ : mono_regular_font_; + return fm.width(str); } void WiresharkApplication::setConfigurationProfile(const gchar *profile_name) diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h index cdfac6c7ae..a56d6c6c7f 100644 --- a/ui/qt/wireshark_application.h +++ b/ui/qt/wireshark_application.h @@ -85,9 +85,9 @@ public: void setLastOpenDir(const char *dir_name); void setLastOpenDir(QString *dir_str); void helpTopicAction(topic_action_e action); - QFont monospaceFont(bool bold = false); + const QFont monospaceFont() const { return mono_font_; } void setMonospaceFont(const char *font_string); - int monospaceTextSize(const char *str, bool bold = false); + int monospaceTextSize(const char *str); void setConfigurationProfile(const gchar *profile_name); bool isInitialized() { return initialized_; } const QIcon &normalIcon() const { return normal_icon_; } @@ -95,8 +95,7 @@ public: private: bool initialized_; - QFont mono_regular_font_; - QFont mono_bold_font_; + QFont mono_font_; QTimer recent_timer_; QTimer addr_resolv_timer_; QTimer tap_update_timer_; |