summaryrefslogtreecommitdiff
path: root/ui/guiStatusHandler.h
blob: eb06710293ce0da7aa1ba71099fef8891fc2dce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef GUISTATUSHANDLER_H_INCLUDED
#define GUISTATUSHANDLER_H_INCLUDED

#include "../library/statusHandler.h"
#include <wx/event.h>
#include "../library/errorLogging.h"

class SyncStatus;
class MainDialog;
class wxWindow;
class wxCommandEvent;


//classes handling sync and compare error as well as status information
class CompareStatusHandler : private wxEvtHandler, public StatusHandler
{
public:
    CompareStatusHandler(MainDialog* dlg);
    ~CompareStatusHandler();

    virtual void updateStatusText(const Zstring& text);
    virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID);
    virtual void updateProcessedData(int objectsProcessed, wxLongLong dataProcessed);
    virtual void forceUiRefresh();

    virtual ErrorHandler::Response reportError(const wxString& text);
    virtual void reportFatalError(const wxString& errorMessage);
    virtual void reportWarning(const wxString& warningMessage, bool& warningActive);

private:
    void OnAbortCompare(wxCommandEvent& event); //handle abort button click
    virtual void abortThisProcess();

    MainDialog* mainDialog;
    bool ignoreErrors;
    Process currentProcess;
};


class SyncStatusHandler : public StatusHandler
{
public:
    SyncStatusHandler(wxWindow* dlg, bool ignoreAllErrors);
    ~SyncStatusHandler();

    virtual void updateStatusText(const Zstring& text);
    virtual void initNewProcess(int objectsTotal, wxLongLong dataTotal, Process processID);
    virtual void updateProcessedData(int objectsProcessed, wxLongLong dataProcessed);
    virtual void forceUiRefresh();

    virtual ErrorHandler::Response reportError(const wxString& text);
    virtual void reportFatalError(const wxString& errorMessage);
    virtual void reportWarning(const wxString& warningMessage, bool& warningActive);

private:
    virtual void abortThisProcess();

    SyncStatus* syncStatusFrame;
    bool ignoreErrors;
    FreeFileSync::ErrorLogging errorLog;
};


#endif // GUISTATUSHANDLER_H_INCLUDED
bgstack15