summaryrefslogtreecommitdiff
path: root/ui/batch_config.h
blob: 88d5e4eb2ca57d73fb5888055d46353b0a1fe4ec (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html       *
// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de)                    *
// **************************************************************************
//
#ifndef BATCHCONFIG_H_INCLUDED
#define BATCHCONFIG_H_INCLUDED

#include "gui_generated.h"
#include "../library/process_xml.h"


namespace ffs3
{
class DirectoryName;
}

class DirectoryPairBatch;
class DirectoryPairBatchFirst;


class BatchDialog: public BatchDlgGenerated
{
    friend class BatchFileDropEvent;
    template <class GuiPanel>
    friend class FolderPairCallback;

public:
    BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg);
    BatchDialog(wxWindow* window, const wxString& filename);
    ~BatchDialog();

    enum
    {
        BATCH_FILE_SAVED = 15
    };

private:
    void init();

    virtual void OnCmpSettings(        wxCommandEvent& event);
    virtual void OnSyncSettings(       wxCommandEvent& event);
    virtual void OnConfigureFilter(    wxCommandEvent& event);

    virtual void OnHelp(               wxCommandEvent& event);

    void OnGlobalFilterOpenContext(wxCommandEvent& event);
    void OnGlobalFilterRemConfirm(wxCommandEvent& event);
    virtual void OnCheckSilent(        wxCommandEvent& event);
    virtual void OnChangeMaxLogCountTxt(wxCommandEvent& event);
    virtual void OnClose(              wxCloseEvent&   event);
    virtual void OnCancel(             wxCommandEvent& event);
    virtual void OnSaveBatchJob(       wxCommandEvent& event);
    virtual void OnLoadBatchJob(       wxCommandEvent& event);
    virtual void OnAddFolderPair(      wxCommandEvent& event);
    virtual void OnRemoveFolderPair(   wxCommandEvent& event);
    virtual void OnRemoveTopFolderPair(wxCommandEvent& event);

    void addFolderPair(const std::vector<ffs3::FolderPairEnh>& newPairs, bool addFront = false);
    void removeAddFolderPair(const int pos);
    void clearAddFolderPairs();

    void updateGuiForFolderPair();

    void updateGui(); //re-evaluate gui after config changes

    void showNotebookpage(wxWindow* page, const wxString& pageName, bool show);

    //error handling
    xmlAccess::OnError getSelectionHandleError() const;
    void setSelectionHandleError(const xmlAccess::OnError value);
    void OnChangeErrorHandling(wxCommandEvent& event);
    void updateToolTipErrorHandling(const xmlAccess::OnError value);

    bool saveBatchFile(const wxString& filename);
    void loadBatchFile(const wxString& filename);
    void loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg);

    xmlAccess::XmlBatchConfig getCurrentConfiguration() const;

    boost::shared_ptr<DirectoryPairBatchFirst> firstFolderPair; //always bound!!!
    std::vector<DirectoryPairBatch*> additionalFolderPairs;

    //used when saving batch file
    wxString proposedBatchFileName;

    xmlAccess::XmlBatchConfig localBatchCfg;

    std::auto_ptr<wxMenu> contextMenu;

    std::auto_ptr<ffs3::DirectoryName> logfileDir;
};

#endif // BATCHCONFIG_H_INCLUDED
bgstack15