1 // timers.h - Timers subroutines header.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
24 #include <wx/mstream.h>
27 #include <wx/filename.h>
28 #include <wx/tokenzr.h>
30 #include "../actmgr/frmActivityMgr.h"
31 #include "../contacteditor/frmContactEditor.h"
32 #include "../connobject/ConnectionObject.h"
33 #include "../frmContact.h"
34 #include "../frmMain.h"
35 #include "../bitmaps.h"
37 #include "../common/preferences.h"
38 #include "../common/etag.h"
39 #include "../common/dirs.h"
46 struct frmContactEditor;
48 class wxActTimer : public wxTimer
51 int intActivityProgress = 0;
52 wxStaticBitmap *bmpActivity;
53 wxBitmap *SleepBitmapPtr;
56 wxActTimer():wxTimer()
60 void SetBitmap(wxStaticBitmap *ActMgr);
62 void StartAnimation();
64 void SetSleepBitmap(wxBitmap *SleepBitmap);
65 void SetupPointer(void *frmMainPtrIn);
69 class wxActProcessTimer : public wxTimer
73 int intActivityProgress = 0;
74 wxStaticBitmap *bmpActivity;
77 wxActProcessTimer():wxTimer()
81 void SetupPointers(void *ActMgr);
85 class wxActListProcTimer : public wxTimer
89 std::map<int,int> *ActListPtr = nullptr;
90 std::map<int,long> *ActListUIPtr = nullptr;
91 std::map<int,wxString> *ActListDetailPtr = nullptr;
92 wxListCtrl *lstActivityPtr = nullptr;
93 wxStaticText *lblDetailsPtr = nullptr;
94 bool *TasksActivePtr = nullptr;
95 wxGauge *GauProgressPtr = nullptr;
96 void *ActMgrPtr = nullptr;
97 int intActivityTotal = 0;
98 int intActivityCompleted = 0;
99 wxActTimer *ActTimerPtr = nullptr;
100 wxActProcessTimer *ActProcessTimerPtr = nullptr;
101 std::map<int,wxDateTime> *ActListFinDTPtr = nullptr;
102 std::map<int,ConnectionObject*> *ActListConnObjectsPtr = nullptr;
103 bool ClearupProcessed = FALSE;
105 wxActListProcTimer():wxTimer()
109 void SetupPointers(std::map<int,int> *ActList, std::map<int,long> *ActListUI,
110 std::map<int,wxString> *ActListDetail, bool *TasksActive,
111 wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress,
112 void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer,
113 std::map<int,wxDateTime> *ActListFinDT, std::map<int,ConnectionObject*> *ActListConnObjects);
114 void EnableClearup();
118 class wxETagProcessTimer : public wxTimer
121 int intActivityProgress = 0;
122 std::map<wxString,ETagDB> ETagDBList;
124 std::mutex ReloadLock;
126 wxETagProcessTimer():wxTimer()
131 ETagDB* GetPointer(wxString Filename);
132 void ReloadAccounts();
136 class wxContactFileMonitorTimer : public wxTimer
139 bool FileStatus = FALSE;
141 frmContactEditor *frmCEPtr;
142 wxDateTime FileDateTime;
144 wxContactFileMonitorTimer():wxTimer()
148 void SetFilename(wxString FilenameInc);
149 void SetupPointers(frmContactEditor *frmCEPtrInc);
150 void UpdateTimestamp();
153 class wxContactWindowMonitor : public wxTimer
156 std::map<wxString, void*> *ContactWindowListPtr;
158 wxContactWindowMonitor():wxTimer()
162 void SetupPointers(std::map<wxString, void*> *ContactWindowListPtrInc);
165 class wxAccountSyncTimer : public wxTimer
169 wxString AccNameFull;
175 wxAccountSyncTimer():wxTimer()
179 void SetupData(wxString AccNameInc, wxString AccNameFull);
180 void SetupPointers(void *frmMainPtrInc,
181 void *frmACtMgrPtr, ETagDB *ETagDBPtrInc);
185 void SleepFor(unsigned long longSleepNanoSecs);