summaryrefslogtreecommitdiff
path: root/wx+/popup_dlg.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2021-12-06 13:37:35 +0000
committerB. Stack <bgstack15@gmail.com>2021-12-06 13:37:35 +0000
commitf142f32c8d2b53f305cb72cb5953e3394d6a6243 (patch)
tree2999df8f80b28d0f7f60a84b7f75d613e280bba1 /wx+/popup_dlg.cpp
parentMerge branch 'b11.14' into 'master' (diff)
parentadd upstream 11.15 (diff)
downloadFreeFileSync-11.15.tar.gz
FreeFileSync-11.15.tar.bz2
FreeFileSync-11.15.zip
Merge branch 'b11.15' into 'master'11.15
add upstream 11.15 See merge request opensource-tracking/FreeFileSync!39
Diffstat (limited to 'wx+/popup_dlg.cpp')
-rw-r--r--wx+/popup_dlg.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp
index 88ed590b..3d4077c3 100644
--- a/wx+/popup_dlg.cpp
+++ b/wx+/popup_dlg.cpp
@@ -6,14 +6,17 @@
#include "popup_dlg.h"
#include <zen/basic_math.h>
+#include <zen/utf.h>
#include <wx/app.h>
#include <wx/display.h>
+#include <wx/sound.h>
#include "no_flicker.h"
#include "font_size.h"
#include "image_resources.h"
#include "popup_dlg_generated.h"
#include "std_button_layout.h"
#include "taskbar.h"
+ #include "window_tools.h"
using namespace zen;
@@ -194,6 +197,27 @@ public:
Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent& event) { onLocalKeyEvent(event); }); //dialog-specific local key events
+ //play sound reminder when waiting for user confirmation
+ if (!cfg.soundFileAlertPending.empty())
+ {
+ timer_.Bind(wxEVT_TIMER, [this, parent, alertSoundPath = cfg.soundFileAlertPending](wxTimerEvent& event)
+ {
+ //wxWidgets shows modal error dialog by default => "no, wxWidgets, NO!"
+ wxLog* oldLogTarget = wxLog::SetActiveTarget(new wxLogStderr); //transfer and receive ownership!
+ ZEN_ON_SCOPE_EXIT(delete wxLog::SetActiveTarget(oldLogTarget));
+
+ wxSound::Play(utfTo<wxString>(alertSoundPath), wxSOUND_ASYNC);
+
+ RequestUserAttention(wxUSER_ATTENTION_INFO);
+ /* wxUSER_ATTENTION_INFO: flashes window 3 times, unconditionally
+ wxUSER_ATTENTION_ERROR: flashes without limit, but *only* if not in foreground (FLASHW_TIMERNOFG) :( */
+ if (parent)
+ if (auto tlw = dynamic_cast<wxTopLevelWindow*>(&getRootWindow(*parent)))
+ tlw->RequestUserAttention(wxUSER_ATTENTION_INFO); //top-level window needed for the taskbar flash!
+ });
+ timer_.Start(60'000 /*unit: [ms]*/);
+ }
+
//------------------------------------------------------------------------------
StdButtons stdBtns;
stdBtns.setAffirmative(m_buttonAccept);
@@ -312,6 +336,7 @@ private:
bool* checkBoxValue_;
const ConfirmationButton3 buttonToDisableWhenChecked_;
std::unique_ptr<Taskbar> taskbar_;
+ wxTimer timer_;
};
//########################################################################################
bgstack15