diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
commit | 460091fb0b2ff114cc741372f15bb43b702ea3b1 (patch) | |
tree | 0562c2eda4c66969c6e6d0910080db9f5b0def3e /RealtimeSync/main_dlg.h | |
parent | 5.15 (diff) | |
download | FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.gz FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.bz2 FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.zip |
5.16
Diffstat (limited to 'RealtimeSync/main_dlg.h')
-rw-r--r-- | RealtimeSync/main_dlg.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/RealtimeSync/main_dlg.h b/RealtimeSync/main_dlg.h index f5fed970..5a028f3a 100644 --- a/RealtimeSync/main_dlg.h +++ b/RealtimeSync/main_dlg.h @@ -12,6 +12,7 @@ #include <memory> #include <wx+/file_drop.h> #include "../ui/dir_name.h" +#include <zen/async_task.h> namespace xmlAccess { @@ -50,7 +51,7 @@ private: void addFolder(const wxString& dirname, bool addFront = false); void addFolder(const std::vector<wxString>& newFolders, bool addFront = false); - void removeAddFolder(int pos); //keep it an int, allow negative values! + void removeAddFolder(size_t pos); void clearAddFolders(); static const wxString& lastConfigFileName(); @@ -59,6 +60,17 @@ private: std::vector<DirectoryPanel*> dirNamesExtra; //additional pairs to the standard pair wxString currentConfigFileName; + + void onProcessAsyncTasks(wxEvent& event); + + template <class Fun, class Fun2> + void processAsync(Fun doAsync, Fun2 evalOnGui) { asyncTasks.add(doAsync, evalOnGui); timerForAsyncTasks.Start(50); /*timer interval in [ms] */ } + template <class Fun, class Fun2> + void processAsync2(Fun doAsync, Fun2 evalOnGui) { asyncTasks.add2(doAsync, evalOnGui); timerForAsyncTasks.Start(50); /*timer interval in [ms] */ } + + //schedule and run long-running tasks asynchronously, but process results on GUI queue + zen::AsyncTasks asyncTasks; + wxTimer timerForAsyncTasks; //don't use wxWidgets idle handling => repeated idle requests/consumption hogs 100% cpu! }; #endif // REALTIMESYNCMAIN_H |