Qt: add reset layout button to toolbar

This commit is contained in:
Chuck Craft 2024-07-19 16:27:39 -05:00
parent 902df16bc3
commit d976b3d848
46 changed files with 666 additions and 423 deletions

View File

@ -4400,6 +4400,7 @@ if(SHELLCHECK_EXECUTABLE)
add_custom_command(TARGET shellcheck POST_BUILD
COMMAND shellcheck --external-sources
resources/stock_icons/svg-to-png.sh
resources/stock_icons/layouts-to-png.sh
packaging/appimage/Logray-AppRun.in
packaging/appimage/Wireshark-AppRun.in
"packaging/macosx/ChmodBPF/root/Library/Application Support/Wireshark/ChmodBPF/ChmodBPF"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1021 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -96,6 +96,18 @@
<file>stock_icons/16x16/x-colorize-packets.png</file>
<file>stock_icons/16x16/x-colorize-packets@2x.png</file>
<file>stock_icons/16x16/x-hide-ro.png</file>
<file>stock_icons/16x16/x-reset-layout_1.png</file>
<file>stock_icons/16x16/x-reset-layout_1@2x.png</file>
<file>stock_icons/16x16/x-reset-layout_2.png</file>
<file>stock_icons/16x16/x-reset-layout_2@2x.png</file>
<file>stock_icons/16x16/x-reset-layout_3.png</file>
<file>stock_icons/16x16/x-reset-layout_3@2x.png</file>
<file>stock_icons/16x16/x-reset-layout_4.png</file>
<file>stock_icons/16x16/x-reset-layout_4@2x.png</file>
<file>stock_icons/16x16/x-reset-layout_5.png</file>
<file>stock_icons/16x16/x-reset-layout_5@2x.png</file>
<file>stock_icons/16x16/x-reset-layout_6.png</file>
<file>stock_icons/16x16/x-reset-layout_6@2x.png</file>
<file>stock_icons/16x16/x-reset.template.png</file>
<file>stock_icons/16x16/x-reset.template@2x.png</file>
<file>stock_icons/16x16/x-resize-columns.png</file>
@ -147,6 +159,18 @@
<file>stock_icons/24x24/x-colorize-packets.png</file>
<file>stock_icons/24x24/x-colorize-packets@2x.png</file>
<file>stock_icons/24x24/x-hide-ro.png</file>
<file>stock_icons/24x24/x-reset-layout_1.png</file>
<file>stock_icons/24x24/x-reset-layout_1@2x.png</file>
<file>stock_icons/24x24/x-reset-layout_2.png</file>
<file>stock_icons/24x24/x-reset-layout_2@2x.png</file>
<file>stock_icons/24x24/x-reset-layout_3.png</file>
<file>stock_icons/24x24/x-reset-layout_3@2x.png</file>
<file>stock_icons/24x24/x-reset-layout_4.png</file>
<file>stock_icons/24x24/x-reset-layout_4@2x.png</file>
<file>stock_icons/24x24/x-reset-layout_5.png</file>
<file>stock_icons/24x24/x-reset-layout_5@2x.png</file>
<file>stock_icons/24x24/x-reset-layout_6.png</file>
<file>stock_icons/24x24/x-reset-layout_6@2x.png</file>
<file>stock_icons/24x24/x-resize-columns.png</file>
<file>stock_icons/24x24/x-resize-columns@2x.png</file>
<file>stock_icons/24x24/x-stay-last.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View File

@ -0,0 +1,140 @@
#!/bin/bash
# layouts-to-png
# Convert SVG files to 1x and 2x PNGs. Dump a list of Qt resource
# file entries upon successful completion.
#
# Copyright 2014 Gerald Combs <gerald [AT] wireshark.org>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
# COMMON_ARGS="--export-area-page"
#SVGCLEANER=$( type -p svgcleaner )
# Running on WSL. Set as needed for Mac/linux.
INKSCAPE_EXE="inkscape.com"
ICONS="
layout_1
layout_2
layout_3
layout_4
layout_5
layout_6
"
if [ -n "$*" ] ; then
ICONS="$*"
fi
QRC_FILES=""
for SIZE in 16x16 24x24 ; do
WIDTH=${SIZE/x*/}
HEIGHT=${SIZE/*x/}
SIZE_DIR=${SIZE}
TWO_X_WIDTH=$(( WIDTH * 2 ))
TWO_X_HEIGHT=$(( HEIGHT * 2 ))
ONE_X_ARGS="--export-width=${WIDTH} --export-height=${HEIGHT}"
TWO_X_ARGS="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
echo "Converting $SIZE_DIR"
cd $SIZE_DIR || exit 1
for ICON in $ICONS ; do
echo "Converting $ICON"
ONE_X_SVG="../../layouts.svg"
TWO_X_SVG=$ONE_X_SVG
ICONNAME="x-reset-$ICON"
ONE_X_PNG=${ICONNAME}.png
TWO_X_PNG=${ICONNAME}@2x.png
if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
--export-filename="$ONE_X_PNG" $ONE_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${SIZE_DIR}/${ONE_X_PNG}"
fi
if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
--export-filename="$TWO_X_PNG" $TWO_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${SIZE_DIR}/${TWO_X_PNG}"
fi
done
cd ..
done
for QRC_FILE in $QRC_FILES ; do
echo " <file>stock_icons/${QRC_FILE}</file>"
done
echo "--------------------------------------"
QRC_FILES=""
for SIZE in 48x48 96x96 ; do
WIDTH=${SIZE/x*/}
HEIGHT=${SIZE/*x/}
OUT_DIR=".."
TWO_X_WIDTH=$(( WIDTH * 2 ))
TWO_X_HEIGHT=$(( HEIGHT * 2 ))
ONE_X_ARGS="--export-width=${WIDTH} --export-height=${HEIGHT}"
TWO_X_ARGS="--export-width=${TWO_X_WIDTH} --export-height=${TWO_X_HEIGHT}"
echo "Converting $OUT_DIR"
for ICON in $ICONS ; do
echo "Converting $ICON"
ONE_X_SVG=${OUT_DIR}/layouts.svg
TWO_X_SVG=$ONE_X_SVG
ICONNAME="$ICON"
ONE_X_PNG=${OUT_DIR}/${ICONNAME}.png
TWO_X_PNG=${OUT_DIR}/${ICONNAME}@2x.png
if [ "$ONE_X_SVG" -nt "$ONE_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $ONE_X_ARGS --export-id="$ICON" \
--export-filename="$ONE_X_PNG" $ONE_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${ICONNAME}.png"
fi
if [ "$TWO_X_SVG" -nt "$TWO_X_PNG" ] ; then
# shellcheck disable=SC2086
$INKSCAPE_EXE $COMMON_ARGS $TWO_X_ARGS --export-id="$ICON" \
--export-filename="$TWO_X_PNG" $TWO_X_SVG || exit 1
QRC_FILES="${QRC_FILES} ${ICONNAME}@2x.png"
fi
done
done
for QRC_FILE in $QRC_FILES ; do
echo " <file>${QRC_FILE}</file>"
done
#
# Editor modelines - https://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 4
# tab-width: 8
# indent-tabs-mode: nil
# End:
#
# vi: set shiftwidth=4 tabstop=8 expandtab:
# :indentSize=4:tabSize=8:noTabs=true:
#

View File

@ -2043,6 +2043,7 @@ void LograyMainWindow::initMainToolbarIcons()
main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out"));
main_ui_->actionViewNormalSize->setIcon(StockIcon("zoom-original"));
main_ui_->actionViewResizeColumns->setIcon(StockIcon("x-resize-columns"));
main_ui_->actionViewResetLayout->setIcon(StockIcon("x-reset-layout_2"));
main_ui_->actionViewReload->setIcon(StockIcon("x-capture-file-reload"));
main_ui_->actionNewDisplayFilterExpression->setIcon(StockIcon("list-add"));

View File

@ -559,6 +559,7 @@
<addaction name="actionViewZoomOut"/>
<addaction name="actionViewNormalSize"/>
<addaction name="actionViewResizeColumns"/>
<addaction name="actionViewResetLayout"/>
</widget>
<widget class="MainStatusBar" name="statusBar"/>
<widget class="QToolBar" name="displayFilterToolBar">
@ -1562,7 +1563,7 @@
<string>Reset Layout</string>
</property>
<property name="toolTip">
<string>Reset appearance layout to default size</string>
<string>Reset layout to default size</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+W</string>

View File

@ -330,6 +330,16 @@ void LograyMainWindow::layoutToolbars()
}
}
static const char* layout_icons[] = {
NULL,
"x-reset-layout_5",
"x-reset-layout_2",
"x-reset-layout_1",
"x-reset-layout_4",
"x-reset-layout_3",
"x-reset-layout_6"
};
void LograyMainWindow::updatePreferenceActions()
{
main_ui_->actionViewPacketList->setEnabled(prefs_has_layout_pane_content(layout_pane_content_plist));
@ -339,6 +349,9 @@ void LograyMainWindow::updatePreferenceActions()
main_ui_->actionViewNameResolutionPhysical->setChecked(gbl_resolv_flags.mac_name);
main_ui_->actionViewNameResolutionNetwork->setChecked(gbl_resolv_flags.network_name);
main_ui_->actionViewNameResolutionTransport->setChecked(gbl_resolv_flags.transport_name);
if (prefs.gui_layout_type > 0)
main_ui_->actionViewResetLayout->setIcon(StockIcon(layout_icons[prefs.gui_layout_type]));
}
void LograyMainWindow::updateRecentActions()

View File

@ -2086,6 +2086,7 @@ void WiresharkMainWindow::initMainToolbarIcons()
main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out"));
main_ui_->actionViewNormalSize->setIcon(StockIcon("zoom-original"));
main_ui_->actionViewResizeColumns->setIcon(StockIcon("x-resize-columns"));
main_ui_->actionViewResetLayout->setIcon(StockIcon("x-reset-layout_2"));
main_ui_->actionViewReload->setIcon(StockIcon("x-capture-file-reload"));
main_ui_->actionNewDisplayFilterExpression->setIcon(StockIcon("list-add"));

View File

@ -787,6 +787,7 @@
<addaction name="actionViewZoomOut"/>
<addaction name="actionViewNormalSize"/>
<addaction name="actionViewResizeColumns"/>
<addaction name="actionViewResetLayout"/>
</widget>
<widget class="MainStatusBar" name="statusBar"/>
<widget class="QToolBar" name="displayFilterToolBar">
@ -2203,7 +2204,7 @@
<string>Reset Layout</string>
</property>
<property name="toolTip">
<string>Reset appearance layout to default size</string>
<string>Reset layout to default size</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+W</string>

View File

@ -366,6 +366,16 @@ void WiresharkMainWindow::layoutToolbars()
}
}
static const char* layout_icons[] = {
NULL,
"x-reset-layout_5",
"x-reset-layout_2",
"x-reset-layout_1",
"x-reset-layout_4",
"x-reset-layout_3",
"x-reset-layout_6"
};
void WiresharkMainWindow::updatePreferenceActions()
{
main_ui_->actionViewPacketList->setEnabled(prefs_has_layout_pane_content(layout_pane_content_plist));
@ -376,6 +386,9 @@ void WiresharkMainWindow::updatePreferenceActions()
main_ui_->actionViewNameResolutionPhysical->setChecked(gbl_resolv_flags.mac_name);
main_ui_->actionViewNameResolutionNetwork->setChecked(gbl_resolv_flags.network_name);
main_ui_->actionViewNameResolutionTransport->setChecked(gbl_resolv_flags.transport_name);
if (prefs.gui_layout_type > 0)
main_ui_->actionViewResetLayout->setIcon(StockIcon(layout_icons[prefs.gui_layout_type]));
}
void WiresharkMainWindow::updateRecentActions()