aboutsummaryrefslogtreecommitdiffstats
path: root/ui/win32
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-09-08 14:31:03 -0700
committerGerald Combs <gerald@wireshark.org>2016-09-09 21:43:01 +0000
commit559bb375c1542f6556b4afc260345eb6a988025b (patch)
treee52123c1688942bfc05dc5789bea89562a71b357 /ui/win32
parentecd82d08a1479849cb6d4ebb93422b0f96470704 (diff)
Remove name resolution from the file dialogs.
A single name resolution checkbox was added to the file dialog way back in 2000 in g0f7cf64. At that time it was needed because resolution was synchronous and could drastically affect your load time. Since then we've added asynchronous name resolution and more recently made it mandatory (ge005bc8). We've also added more name resolution checkboxes and other controls. Remove the name resolution checkboxes. You can just as easily change resolution options before or after opening a file and they take up valuable real estate. Combine the size and packets in the Qt and Win32 dialogs and pretty-print the size. Combine the start and elapsed times in the Qt, Win32, and GTK+ dialogs. This lets us shrink the custom areas of the file dialogs even further. Make the default file type combo item more descriptive. Change-Id: Id770adc0f284a4c7f08ee5a7db84f8435f4bf907 Reviewed-on: https://code.wireshark.org/review/17597 Tested-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/win32')
-rw-r--r--ui/win32/file_dlg_win32.c75
-rw-r--r--ui/win32/file_dlg_win32.h22
2 files changed, 36 insertions, 61 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 90aa684dae..ab4c92bfa7 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -38,7 +38,6 @@
#include "wsutil/unicode-utils.h"
#include "wsutil/filesystem.h"
-#include "epan/addr_resolv.h"
#include "epan/prefs.h"
#include "epan/color_filters.h"
@@ -1121,9 +1120,11 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
int err = 0;
gchar *err_info;
TCHAR string_buff[PREVIEW_STR_MAX];
+ TCHAR first_buff[PREVIEW_STR_MAX];
gint64 data_offset;
guint packet = 0;
gint64 filesize;
+ gchar *size_str;
time_t ti_time;
struct tm *ti_tm;
guint elapsed_time;
@@ -1134,14 +1135,14 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
double cur_time;
gboolean is_breaked = FALSE;
- for (i = EWFD_PTX_FORMAT; i <= EWFD_PTX_ELAPSED; i++) {
+ for (i = EWFD_PTX_FORMAT; i <= EWFD_PTX_START_ELAPSED; i++) {
cur_ctrl = GetDlgItem(of_hwnd, i);
if (cur_ctrl) {
EnableWindow(cur_ctrl, FALSE);
}
}
- for (i = EWFD_PTX_FORMAT; i <= EWFD_PTX_ELAPSED; i++) {
+ for (i = EWFD_PTX_FORMAT; i <= EWFD_PTX_START_ELAPSED; i++) {
cur_ctrl = GetDlgItem(of_hwnd, i);
if (cur_ctrl) {
SetWindowText(cur_ctrl, _T("-"));
@@ -1170,7 +1171,7 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
}
/* Success! */
- for (i = EWFD_PT_FORMAT; i <= EWFD_PTX_ELAPSED; i++) {
+ for (i = EWFD_PT_FORMAT; i <= EWFD_PTX_START_ELAPSED; i++) {
cur_ctrl = GetDlgItem(of_hwnd, i);
if (cur_ctrl) {
EnableWindow(cur_ctrl, TRUE);
@@ -1183,9 +1184,8 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
/* Size */
filesize = wtap_file_size(wth, &err);
- utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%" G_GINT64_FORMAT " bytes", filesize);
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_SIZE);
- SetWindowText(cur_ctrl, string_buff);
+ // Windows Explorer uses IEC.
+ size_str = format_size(filesize, format_size_unit_bytes|format_size_prefix_iec);
time(&time_preview);
while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
@@ -1212,8 +1212,10 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
}
if(err != 0) {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("error after reading %u packets"), packet);
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS);
+ utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%s, error after %u packets",
+ size_str, packet);
+ g_free(size_str);
+ cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_SIZE);
SetWindowText(cur_ctrl, string_buff);
wtap_close(wth);
return TRUE;
@@ -1221,18 +1223,21 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
/* Packets */
if(is_breaked) {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("more than %u packets (preview timeout)"), packet);
+ utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%s, timed out at %u packets",
+ size_str, packet);
} else {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%u"), packet);
+ utf_8to16_snprintf(string_buff, PREVIEW_STR_MAX, "%s, %u packets",
+ size_str, packet);
}
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS);
+ g_free(size_str);
+ cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_SIZE);
SetWindowText(cur_ctrl, string_buff);
- /* First packet */
+ /* First packet / elapsed time */
ti_time = (long)start_time;
ti_tm = localtime( &ti_time );
if(ti_tm) {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX,
+ StringCchPrintf(first_buff, PREVIEW_STR_MAX,
_T("%04d-%02d-%02d %02d:%02d:%02d"),
ti_tm->tm_year + 1900,
ti_tm->tm_mon + 1,
@@ -1241,24 +1246,21 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
ti_tm->tm_min,
ti_tm->tm_sec);
} else {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("?"));
+ StringCchPrintf(first_buff, PREVIEW_STR_MAX, _T("?"));
}
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_FIRST_PKT);
- SetWindowText(cur_ctrl, string_buff);
- /* Elapsed time */
elapsed_time = (unsigned int)(stop_time-start_time);
if(elapsed_time/86400) {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%02u days %02u:%02u:%02u"),
- elapsed_time/86400, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%s / %02u days %02u:%02u:%02u"),
+ first_buff, elapsed_time/86400, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
} else {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%02u:%02u:%02u"),
- elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%s / %02u:%02u:%02u"),
+ first_buff, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
}
if(is_breaked) {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("unknown"));
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%s / unknown"), first_buff);
}
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_ELAPSED);
+ cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_START_ELAPSED);
SetWindowText(cur_ctrl, string_buff);
wtap_close(wth);
@@ -1349,22 +1351,12 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
}
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FORMAT_TYPE);
- SendMessage(cur_ctrl, CB_ADDSTRING, 0, (WPARAM) _T("Automatic"));
+ SendMessage(cur_ctrl, CB_ADDSTRING, 0, (WPARAM) _T("Automatically detect file type"));
for (i = 0; open_routines[i].name != NULL; i += 1) {
SendMessage(cur_ctrl, CB_ADDSTRING, 0, (WPARAM) utf_8to16(open_routines[i].name));
}
SendMessage(cur_ctrl, CB_SETCURSEL, 0, 0);
- /* Fill in our resolution values */
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
- SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags.mac_name, 0);
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_NET_NR_CB);
- SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags.network_name, 0);
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_TRANS_NR_CB);
- SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags.transport_name, 0);
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_EXTERNAL_NR_CB);
- SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags.use_external_net_name_resolver, 0);
-
preview_set_file_info(of_hwnd, NULL);
break;
case WM_NOTIFY:
@@ -1379,19 +1371,6 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FORMAT_TYPE);
g_format_type = (unsigned int) SendMessage(cur_ctrl, CB_GETCURSEL, 0, 0);
- /* Fetch our resolution values */
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
- if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gbl_resolv_flags.mac_name = TRUE;
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_NET_NR_CB);
- if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gbl_resolv_flags.network_name = TRUE;
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_TRANS_NR_CB);
- if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gbl_resolv_flags.transport_name = TRUE;
- cur_ctrl = GetDlgItem(of_hwnd, EWFD_EXTERNAL_NR_CB);
- if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gbl_resolv_flags.use_external_net_name_resolver = TRUE;
break;
case CDN_SELCHANGE:
/* This _almost_ works correctly. We need to handle directory
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index f26c1e6951..16f4bb5780 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -156,19 +156,15 @@ void file_set_save_marked_sensitive();
/* Note: The preview title (PT) and text (PTX) MUST have sequential IDs;
they're used in a for loop. EWFD_PT_FILENAME MUST be first, and
EWFD_PTX_ELAPSED MUST be last. (so why don't we just use an enum? */
-#define EWFD_PT_FORMAT 1006
-#define EWFD_PT_SIZE 1007
-#define EWFD_PT_PACKETS 1008
-#define EWFD_PT_FIRST_PKT 1009
-#define EWFD_PT_ELAPSED 1010
-
-#define EWFD_PTX_FORMAT 1011
-#define EWFD_PTX_SIZE 1012
-#define EWFD_PTX_PACKETS 1013
-#define EWFD_PTX_FIRST_PKT 1014
-#define EWFD_PTX_ELAPSED 1015
-
-#define EWFD_FORMAT_TYPE 1016
+#define EWFD_PT_FORMAT 1006
+#define EWFD_PT_SIZE 1007
+#define EWFD_PT_START_ELAPSED 1008
+
+#define EWFD_PTX_FORMAT 1009
+#define EWFD_PTX_SIZE 1010
+#define EWFD_PTX_START_ELAPSED 1011
+
+#define EWFD_FORMAT_TYPE 1020
/* Save as and export dialog defines */
#define EWFD_GZIP_CB 1040