Skip to content

Commit

Permalink
Add summary (fixes #149)
Browse files Browse the repository at this point in the history
  • Loading branch information
namazso committed Jul 14, 2023
1 parent 88b5250 commit a01640d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions Localization/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"EXPORT_BTN": "Export…",
"SUMFILE": "Interpreted as sumfile.",
"DONE": "Done!",
"SUMMARY": "Summary",
"PROCESSING": "Processing…",
"HASHES": "Hashes",
"CLIPBOARD": "To clipboard",
Expand Down
36 changes: 24 additions & 12 deletions OpenHashTab/MainDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,7 @@ void MainDialog::UpdateDefaultStatus(bool force_reset) {

if (!_temporary_status) {
const auto msg = _finished ? IDS_DONE : IDS_PROCESSING;
wchar_t done[64];
swprintf_s(
done,
L"%s (%u/%u/%u/%u)",
utl::GetString(msg).c_str(),
_count_match,
_count_mismatch,
_count_unknown,
_count_error
);
SetWindowTextW(_hwnd_STATIC_PROCESSING, done);
SetWindowTextW(_hwnd_STATIC_PROCESSING, utl::GetString(msg).c_str());
}
}

Expand All @@ -331,7 +321,8 @@ INT_PTR MainDialog::DlgProc(UINT msg, WPARAM wparam, LPARAM lparam) {
{ &MainDialog::OnSettingsClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_SETTINGS, BN_CLICKED) },
{ &MainDialog::OnExportClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_EXPORT, BN_CLICKED) },
{ &MainDialog::OnCancelClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_CANCEL, BN_CLICKED) },
{ &MainDialog::OnVTClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_VT, BN_CLICKED) }
{ &MainDialog::OnVTClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_VT, BN_CLICKED) },
{ &MainDialog::OnSummaryClicked, WM_COMMAND, wnd::Match_wlh, MAKELONG(IDC_BUTTON_SUMMARY, BN_CLICKED) },
};
// clang-format on

Expand All @@ -348,6 +339,7 @@ INT_PTR MainDialog::OnInitDialog(UINT, WPARAM, LPARAM) {

utl::SetFontForChildren(_hwnd, _font.get());

utl::SetIconButton(_hwnd_BUTTON_SUMMARY, IDI_ICON_SUM);
utl::SetIconButton(_hwnd_BUTTON_VT, IDI_ICON_VT);
utl::SetIconButton(_hwnd_BUTTON_SETTINGS, IDI_ICON_COG);

Expand Down Expand Up @@ -472,6 +464,8 @@ INT_PTR MainDialog::OnAllFilesFinished(UINT, WPARAM, LPARAM) {
if (detail::GetMachineSettingDWORD("ForceDisableVT", 0) == 0)
Button_Enable(_hwnd_BUTTON_VT, true);

Button_Enable(_hwnd_BUTTON_SUMMARY, true);

Edit_Enable(_hwnd_EDIT_HASH, true);

ShowWindow(_hwnd_PROGRESS, 0);
Expand Down Expand Up @@ -619,6 +613,24 @@ INT_PTR MainDialog::OnVTClicked(UINT, WPARAM, LPARAM) {
return FALSE;
}

INT_PTR MainDialog::OnSummaryClicked(UINT, WPARAM, LPARAM) {
wchar_t msg[512];
swprintf_s(
msg,
L"%s: %u\r\n%s: %u\r\n%s: %u\r\n%s: %u",
utl::GetString(IDS_MATCH_GROUP).c_str(),
_count_match,
utl::GetString(IDS_MISMATCH_GROUP).c_str(),
_count_mismatch,
utl::GetString(IDS_UNKNOWN_GROUP).c_str(),
_count_unknown,
utl::GetString(IDS_ERROR_GROUP).c_str(),
_count_error
);
MessageBoxW(_hwnd, msg, utl::GetString(IDS_SUMMARY).c_str(), MB_OK);
return TRUE;
}

INT_PTR MainDialog::OnClose(UINT, WPARAM, LPARAM) {
// we should never ever receive WM_CLOSE when running as a property sheet, so DestroyWindow is safe here
DestroyWindow(_hwnd);
Expand Down
2 changes: 2 additions & 0 deletions OpenHashTab/MainDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MainDialog
MAKE_IDC_MEMBER(_hwnd, ALGORITHM_LIST);
MAKE_IDC_MEMBER(_hwnd, PROGRESS);
MAKE_IDC_MEMBER(_hwnd, BUTTON_VT);
MAKE_IDC_MEMBER(_hwnd, BUTTON_SUMMARY);

unsigned _count_error{};
unsigned _count_match{};
Expand Down Expand Up @@ -95,6 +96,7 @@ class MainDialog
INT_PTR OnExportClicked(UINT, WPARAM, LPARAM);
INT_PTR OnCancelClicked(UINT, WPARAM, LPARAM);
INT_PTR OnVTClicked(UINT, WPARAM, LPARAM);
INT_PTR OnSummaryClicked(UINT, WPARAM, LPARAM);
INT_PTR OnClose(UINT, WPARAM, LPARAM);
INT_PTR OnNeedAdjust(UINT, WPARAM, LPARAM);
INT_PTR OnHashEditChanged(UINT, WPARAM, LPARAM);
Expand Down
6 changes: 4 additions & 2 deletions OpenHashTab/OpenHashTab.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ BEGIN

// First row: is sumfile, processing/done, VT button, Settings button
LTEXT "",IDC_STATIC_SUMFILE,6,152,98,12
RTEXT "IDS_PROCESSING",IDC_STATIC_PROCESSING,104,152,80,12
RTEXT "IDS_PROCESSING",IDC_STATIC_PROCESSING,104,152,62,12
PUSHBUTTON "E",IDC_BUTTON_SUMMARY,168,150,16,16,BS_ICON | WS_DISABLED
PUSHBUTTON "V",IDC_BUTTON_VT,186,150,16,16,BS_ICON | WS_DISABLED
PUSHBUTTON "S",IDC_BUTTON_SETTINGS,204,150,16,16,BS_ICON | WS_DISABLED

Expand Down Expand Up @@ -158,8 +159,9 @@ END
// Icon with the lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "icon.ico"
IDI_ICON_VT ICON "virustotal_icon.ico"
IDI_ICON_VT ICON "vt.ico"
IDI_ICON_COG ICON "cog.ico"
IDI_ICON_SUM ICON "sum.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION CI_VERSION_MAJOR,CI_VERSION_MINOR,CI_VERSION_PATCH,0
Expand Down
3 changes: 3 additions & 0 deletions OpenHashTab/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@
#define IDC_UNKNOWN_GROUP 263
#define IDC_UNKNOWN_SAMPLE 264
#define IDC_CHECK_DISPLAY_MONOSPACE 265
#define IDC_BUTTON_SUMMARY 266

#define IDD_OPENHASHTAB_PROPPAGE 300
#define IDD_SETTINGS 301

#define IDI_ICON1 310
#define IDI_ICON_COG 311
#define IDI_ICON_VT 312
#define IDI_ICON_SUM 313

#define IDM_COPY_EVERYTHING 320
#define IDM_COPY_FILE 321
Expand Down Expand Up @@ -131,3 +133,4 @@
#define IDS_VT_NOT_FOUND 451
#define IDS_VT_NO_COMPATIBLE 452
#define IDS_DISPLAY_MONOSPACE 453
#define IDS_SUMMARY 454
Binary file added OpenHashTab/sum.ico
Binary file not shown.
File renamed without changes.

0 comments on commit a01640d

Please sign in to comment.