summaryrefslogtreecommitdiff
path: root/Application.h
blob: eb20978339e58130ce7495e0f54377e5af8cf6a4 (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
65
66
67
68
69
70
71
72
73
74
75
76
/***************************************************************
 * Name:      FreeFileSyncApp.h
 * Purpose:   Defines Application Class
 * Author:    ZenJu (zhnmju123@gmx.de)
 * Created:   2008-07-16
 * Copyright: ZenJu ()
 * License:
 **************************************************************/

#ifndef FREEFILESYNCAPP_H
#define FREEFILESYNCAPP_H

#include <wx/app.h>
#include <wx/cmdline.h>
#include <wx/ffile.h>
#include "FreeFileSync.h"
#include "ui/smallDialogs.h"
#include "library/misc.h"
#include <wx/stopwatch.h>

class Application : public wxApp
{
public:
    bool OnInit();
    int  OnRun();
    int  OnExit();

    void initialize();
    bool ProcessIdle(); //virtual method

    //methods for writing logs
    void logInit();
    void logWrite(const wxString& logText, const wxString& problemType = wxEmptyString);
    void logClose(const wxString& finalText);

private:
    void parseCommandline();

    bool applicationRunsOnCommandLineWithoutWindows;
    wxFFile logFile;
    wxStopWatch totalTime;
    CustomLocale programLanguage;

    int returnValue;
};


class CommandLineStatusUpdater : public StatusUpdater
{
public:
    CommandLineStatusUpdater(Application* application, bool continueOnError, bool silent);
    ~CommandLineStatusUpdater();

    void updateStatusText(const wxString& text);
    void initNewProcess(int objectsTotal, double dataTotal, int processID);
    void updateProcessedData(int objectsProcessed, double dataProcessed);
    int reportError(const wxString& text);
    void forceUiRefresh();

    void noSynchronizationNeeded();

private:
    void abortThisProcess();

    Application* app;
    SyncStatus* syncStatusFrame;
    bool continueErrors;
    bool silentMode;

    wxArrayString unhandledErrors;   //list of non-resolved errors
    int currentProcess;
    bool synchronizationNeeded;
};


#endif // FREEFILESYNCAPP_H
bgstack15