Code: Select all
void
ProgressDialog::Beep()
{
int after;
bool should;
wxString name;
gPrefs->Read(wxT("/GUI/BeepOnCompletion"), &should, false);
gPrefs->Read(wxT("/GUI/BeepAfterDuration"), &after, 60);
gPrefs->Read(wxT("/GUI/BeepFileName"), &name, wxEmptyString);
if (should && wxGetLocalTimeMillis().GetValue() - mStartTime > after * 1000)
{
wxBusyCursor busy;
wxSound s;
if (name.IsEmpty()) {
s.Create(sizeof(beep), beep);
}
else {
s.Create(name);
}
if (s.IsOk())
{
s.Play(wxSOUND_SYNC);
}
}
}Unfortunately, this relies on a member variable which is specific to this ProgressDialog, and no other dialogs seem to have it – a minor hassle. The real problem is that only BeepOnCompletion is exposed to the user (via Preferences); neither BeepAfterDuration nor BeepFileName are exposed and can only be manipulated by using a text editor on the configuration file.