Bumped copyright dates for 2013
[barry.git] / desktop / src / Mode_Sync.h
blobead987395133dc22989d6139fc8a4d5be98cac83
1 ///
2 /// \file Mode_Sync.h
3 /// Mode derived class for syncing
4 ///
6 /*
7 Copyright (C) 2009-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYDESKTOP_MODE_SYNC_H__
23 #define __BARRYDESKTOP_MODE_SYNC_H__
25 #include "Mode.h"
26 #include "deviceset.h"
27 #include "configui.h"
28 #include "wxi18n.h"
30 class SyncMode : public wxEvtHandler, public Mode
32 private:
33 DECLARE_EVENT_TABLE() // sets to protected:
35 private:
36 wxWindow *m_parent;
38 std::auto_ptr<DeviceSet> m_device_set;
39 ConfigUI::ptr m_cui;
41 // window controls
42 std::auto_ptr<wxBoxSizer> m_topsizer;
43 std::auto_ptr<wxButton> m_sync_now_button;
44 std::auto_ptr<wxButton> m_configure_button;
45 std::auto_ptr<wxButton> m_run_app_button;
46 std::auto_ptr<wxButton> m_1way_reset_button;
47 std::auto_ptr<wxListCtrl> m_device_list;
48 std::auto_ptr<wxStaticText> m_label[4];
50 protected:
51 static std::string Timestamp(time_t last_sync);
53 int GetMaxTimestampWidth(wxWindow *win);
54 void FillDeviceList();
55 void UpdateButtons();
56 DeviceSet::subset_type GetSelectedDevices();
57 void ReselectDevices(const DeviceSet::subset_type &set);
58 void ConfigureDevice(int device_index);
59 void ConfigureDevice(DeviceEntry &entry);
60 void CheckConfigured(DeviceSet::subset_type &subset);
61 void RefillList();
62 int GetSelectedDevice(); // returns index, or -1 if none or
63 // more than one selected... also
64 // handles the message box
65 int GetAuthoritativeSide(int device_index);
66 bool ZapConflicts(int device_index, int authoritative_side);
67 void RewriteConfig(int device_index);
68 bool WarnAbout1WayReset();
70 public:
71 SyncMode(wxWindow *parent);
72 ~SyncMode();
74 // virtual override events (derived from Mode)
75 wxString GetTitleText() const { return _W("Barry Sync"); }
77 // window events
78 void OnSyncNow(wxCommandEvent &event);
79 void OnConfigure(wxCommandEvent &event);
80 void OnRunApp(wxCommandEvent &event);
81 void On1WayReset(wxCommandEvent &event);
82 void OnListSelChange(wxListEvent &event);//to keep track of button state
83 void OnConfigureDevice(wxListEvent &event);
86 #endif