feat(mining): migrate the Windows Defender antivirus-help dialog to reference design
Bring renderAntivirusHelpDialog onto the reference design and remove its hardcoded
English (the last Wave-1 modal):
- struct-form BeginOverlayDialog(OverlayDialogSpec{BlurFloat, cardWidth 560,
idSuffix antivirus}) replacing the legacy positional overload
- the hardcoded "Windows Defender Blocked Miner" title and all 10 step/intro/bullet
strings -> TR() (11 new av_* keys + reuse `close`; 8-lang translations, Windows
env vars / xmrig.exe kept literal, menu names localized)
- 2 StyledButton -> TactileButton, drop the footer divider, dp-scale the button widths
- CJK subset rebuilt (glyphs 1741->1751; kept — new glyphs are used)
NOTE: this dialog is inside #ifdef _WIN32, so the Linux build compiles it out and
cannot verify it — needs a Windows build to compile-check. The edits mirror the
already-verified daemon-update-prompt / migrate-to-seed struct-overlay pattern and
leave the ShellExecuteA call untouched. i18n.cpp + the daemon prompt (cross-platform)
build + ctest + hygiene clean on Linux.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
49
src/app.cpp
49
src/app.cpp
@@ -3820,42 +3820,43 @@ void App::renderAntivirusHelpDialog()
|
||||
#ifdef _WIN32
|
||||
if (!pending_antivirus_dialog_) return;
|
||||
|
||||
if (!ui::material::BeginOverlayDialog("Windows Defender Blocked Miner", &pending_antivirus_dialog_, 560.0f, 0.94f)) {
|
||||
ui::material::OverlayDialogSpec ov;
|
||||
ov.title = TR("av_title"); ov.p_open = &pending_antivirus_dialog_;
|
||||
ov.style = ui::material::OverlayStyle::BlurFloat;
|
||||
ov.cardWidth = 560.0f; ov.idSuffix = "antivirus";
|
||||
if (!ui::material::BeginOverlayDialog(ov)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::TextWrapped(
|
||||
"Mining software is often flagged as potentially unwanted. "
|
||||
"Follow these steps to enable pool mining:");
|
||||
|
||||
const float dp = ui::Layout::dpiScale();
|
||||
|
||||
ImGui::TextWrapped("%s", TR("av_intro"));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingSm()));
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, "Step 1: Add Exclusion");
|
||||
ImGui::BulletText("Open Windows Security > Virus & threat protection");
|
||||
ImGui::BulletText("Click Manage settings > Exclusions > Add or remove");
|
||||
ImGui::BulletText("Add folder: %%APPDATA%%\\ObsidianDragon\\");
|
||||
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, TR("av_step1"));
|
||||
ImGui::BulletText("%s", TR("av_step1_b1"));
|
||||
ImGui::BulletText("%s", TR("av_step1_b2"));
|
||||
ImGui::BulletText("%s", TR("av_step1_b3"));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingSm()));
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, "Step 2: Restore from Quarantine (if needed)");
|
||||
ImGui::BulletText("Windows Security > Protection history");
|
||||
ImGui::BulletText("Find xmrig.exe and click Restore");
|
||||
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, TR("av_step2"));
|
||||
ImGui::BulletText("%s", TR("av_step2_b1"));
|
||||
ImGui::BulletText("%s", TR("av_step2_b2"));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingSm()));
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, "Step 3: Restart wallet and try again");
|
||||
|
||||
ui::material::Type().text(ui::material::TypeStyle::Subtitle2, TR("av_step3"));
|
||||
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingMd()));
|
||||
ImGui::Separator();
|
||||
ImGui::Dummy(ImVec2(0, ui::Layout::spacingSm()));
|
||||
|
||||
float btnW = 160.0f;
|
||||
if (ui::material::StyledButton("Open Windows Security", ImVec2(btnW, 0))) {
|
||||
|
||||
float btnW = 160.0f * dp;
|
||||
if (ui::material::TactileButton(TR("av_open_security"), ImVec2(btnW, 0))) {
|
||||
// Open Windows Security app to the exclusions page
|
||||
ShellExecuteA(NULL, "open", "windowsdefender://threat", NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ui::material::StyledButton("Close", ImVec2(100.0f, 0))) {
|
||||
if (ui::material::TactileButton(TR("close"), ImVec2(100.0f * dp, 0))) {
|
||||
pending_antivirus_dialog_ = false;
|
||||
}
|
||||
|
||||
|
||||
ui::material::EndOverlayDialog();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1940,6 +1940,18 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["explorer_txid"] = "TxID:";
|
||||
strings_["explorer_prev_block"] = "Previous block";
|
||||
strings_["explorer_next_block"] = "Next block";
|
||||
// --- Antivirus (Windows Defender) help dialog (Windows-only) ---
|
||||
strings_["av_title"] = "Windows Defender Blocked Miner";
|
||||
strings_["av_intro"] = "Mining software is often flagged as potentially unwanted. Follow these steps to enable pool mining:";
|
||||
strings_["av_step1"] = "Step 1: Add Exclusion";
|
||||
strings_["av_step1_b1"] = "Open Windows Security > Virus & threat protection";
|
||||
strings_["av_step1_b2"] = "Click Manage settings > Exclusions > Add or remove";
|
||||
strings_["av_step1_b3"] = "Add folder: %APPDATA%\\ObsidianDragon\\";
|
||||
strings_["av_step2"] = "Step 2: Restore from Quarantine (if needed)";
|
||||
strings_["av_step2_b1"] = "Windows Security > Protection history";
|
||||
strings_["av_step2_b2"] = "Find xmrig.exe and click Restore";
|
||||
strings_["av_step3"] = "Step 3: Restart wallet and try again";
|
||||
strings_["av_open_security"] = "Open Windows Security";
|
||||
strings_["explorer_invalid_query"] = "Enter a block height or 64-character hash";
|
||||
strings_["explorer_invalid_response"] = "Invalid response from daemon";
|
||||
strings_["explorer_hash_not_found"] = "No block or transaction found for this hash";
|
||||
|
||||
Reference in New Issue
Block a user