Skip to content

Commit d507ff9

Browse files
authored
Merge pull request #593 from drowe67/ms-reset-confirmation
Confirm reset before actually doing so.
2 parents 5253a12 + 56a04a3 commit d507ff9

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

USER_MANUAL.md

+2
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,9 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
917917
1. Bugfixes:
918918
* Fix bug preventing frequency updates from being properly suppressed when frequency control is in focus. (PR #585)
919919
* Fix bug preventing 60 meter frequencies from using USB with DIGU/DIGL disabled. (PR #589)
920+
* Fix bug preventing FreeDV Reporter window from closing after resetting configuration to defaults. (PR #593)
920921
2. Enhancements:
922+
* Add confirmation dialog box before actually resetting configuration to defaults. (PR #593)
921923
* Add ability to double-click FreeDV Reporter entries to change the radio's frequency. (PR #592)
922924

923925
## V1.9.4 October 2023

src/ongui.cpp

+33-10
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ bool MainFrame::OpenHamlibRig() {
335335
};
336336

337337
wxGetApp().rigFrequencyController->onRigConnected += [&](IRigController*) {
338-
if (wxGetApp().rigFrequencyController && wxGetApp().appConfiguration.rigControlConfiguration.hamlibEnableFreqModeChanges)
338+
if (wxGetApp().rigFrequencyController &&
339+
wxGetApp().appConfiguration.rigControlConfiguration.hamlibEnableFreqModeChanges &&
340+
wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency > 0)
339341
{
340342
wxGetApp().rigFrequencyController->setFrequency(wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency);
341343
wxGetApp().rigFrequencyController->setMode(getCurrentMode_());
@@ -564,16 +566,37 @@ void MainFrame::OnTop(wxCommandEvent& event)
564566
//-------------------------------------------------------------------------
565567
void MainFrame::OnDeleteConfig(wxCommandEvent&)
566568
{
567-
if(pConfig->DeleteAll())
568-
{
569-
wxLogMessage(wxT("Config file/registry key successfully deleted."));
570-
571-
// Resets all configuration to defaults.
572-
loadConfiguration_();
573-
}
574-
else
569+
wxMessageDialog messageDialog(
570+
this, "Would you like to restore configuration to defaults?", wxT("Restore Defaults"),
571+
wxYES_NO | wxICON_QUESTION | wxCENTRE);
572+
573+
auto answer = messageDialog.ShowModal();
574+
if (answer == wxID_YES)
575575
{
576-
wxLogError(wxT("Deleting config file/registry key failed."));
576+
if(pConfig->DeleteAll())
577+
{
578+
wxLogMessage(wxT("Config file/registry key successfully deleted."));
579+
580+
if (wxGetApp().m_sharedReporterObject)
581+
{
582+
wxGetApp().m_sharedReporterObject = nullptr;
583+
}
584+
585+
if (m_reporterDialog != nullptr)
586+
{
587+
m_reporterDialog->setReporter(nullptr);
588+
m_reporterDialog->Close();
589+
m_reporterDialog->Destroy();
590+
m_reporterDialog = nullptr;
591+
}
592+
593+
// Resets all configuration to defaults.
594+
loadConfiguration_();
595+
}
596+
else
597+
{
598+
wxLogError(wxT("Deleting config file/registry key failed."));
599+
}
577600
}
578601
}
579602

0 commit comments

Comments
 (0)