| 1645 | } |
| 1646 | |
| 1647 | void ProgressDialog::Beep() const |
| 1648 | { |
| 1649 | int after; |
| 1650 | bool should; |
| 1651 | wxString name; |
| 1652 | |
| 1653 | gPrefs->Read(wxT("/GUI/BeepOnCompletion"), &should, false); |
| 1654 | gPrefs->Read(wxT("/GUI/BeepAfterDuration"), &after, 60); |
| 1655 | gPrefs->Read(wxT("/GUI/BeepFileName"), &name, {}); |
| 1656 | |
| 1657 | if (should && wxGetUTCTimeMillis().GetValue() - mStartTime > after * 1000) |
| 1658 | { |
| 1659 | wxBusyCursor busy; |
| 1660 | wxSound s; |
| 1661 | |
| 1662 | if (name.empty()) |
| 1663 | { |
| 1664 | #ifdef __WXOSX_COCOA__ |
| 1665 | // wxSound::Create(size_t,const void*) isn't implemented; |
| 1666 | // use the system beep function. |
| 1667 | NSBeep(); |
| 1668 | #else |
| 1669 | s.Create(sizeof(beep), beep); |
| 1670 | #endif |
| 1671 | } |
| 1672 | else |
| 1673 | { |
| 1674 | s.Create(name); |
| 1675 | } |
| 1676 | |
| 1677 | if (s.IsOk()) |
| 1678 | { |
| 1679 | s.Play(wxSOUND_SYNC); |
| 1680 | } |
| 1681 | } |
| 1682 | } |
| 1683 | |
| 1684 | // Confirm action taken by user. |
| 1685 | // Returns TRUE if the user confirms Yes |