YATISH
Yet Another TIme SHeet
/home/nicolas/sources/yatish/yatishFrame.cpp
Go to the documentation of this file.
1 /***************************************************************
2  * Name: yatishFrame.cpp
3  * Purpose: Code for Application Frame
4  * Author: Nicolas PĂ©renne (nicolas.perenne@eif-services.eu)
5  * Created: 2020-02-11
6  * Copyright: EIF-services (https://www.eif-services.eu)
7  * License: GPLv3
8  **************************************************************/
9 
10 #include "wx_pch.h"
11 #include "yatishFrame.h"
12 #include "yatish.xpm"
13 #include "yatish_recording.xpm"
14 // just to make sure poedit will extract the string expected by wxWidgets...
15 const char * not_used = _("translator-credits");
16 // ...when a locale is defined and wxAboutDialogInfo::AddTranslator() is not called
17 
18 //(*InternalHeaders(yatishFrame)
19 #include <wx/intl.h>
20 #include <wx/string.h>
21 //*)
22 
23 //(*IdInit(yatishFrame)
24 const long yatishFrame::idChoiceProject = wxNewId();
25 const long yatishFrame::idChoiceTask = wxNewId();
26 const long yatishFrame::idChoiceTool = wxNewId();
27 const long yatishFrame::idButtonStart = wxNewId();
28 const long yatishFrame::idButtonStop = wxNewId();
29 const long yatishFrame::idPanelCurrent = wxNewId();
30 const long yatishFrame::idChoiceTable = wxNewId();
31 const long yatishFrame::idDatePicker1 = wxNewId();
32 const long yatishFrame::idDatePicker2 = wxNewId();
33 const long yatishFrame::idButtonPDF = wxNewId();
34 const long yatishFrame::idListCtrl = wxNewId();
35 const long yatishFrame::idPanelList = wxNewId();
36 const long yatishFrame::idPanelChart = wxNewId();
37 const long yatishFrame::idNotebook = wxNewId();
38 const long yatishFrame::idTextCtrl = wxNewId();
39 const long yatishFrame::idFileConnect = wxNewId();
40 const long yatishFrame::idFileUpdate = wxNewId();
41 const long yatishFrame::idFileUpload = wxNewId();
42 const long yatishFrame::idFileDownload = wxNewId();
43 const long yatishFrame::idFileQuit = wxNewId();
44 const long yatishFrame::idEditActivity = wxNewId();
45 const long yatishFrame::idEditTable = wxNewId();
46 const long yatishFrame::idEditChart = wxNewId();
47 const long yatishFrame::idEditNew = wxNewId();
48 const long yatishFrame::idEditReset = wxNewId();
49 const long yatishFrame::idEditToday = wxNewId();
50 const long yatishFrame::idEditThisweek = wxNewId();
51 const long yatishFrame::idEditThismonth = wxNewId();
52 const long yatishFrame::idEditYesterday = wxNewId();
53 const long yatishFrame::idEditLastweek = wxNewId();
54 const long yatishFrame::idEditLastmonth = wxNewId();
55 const long yatishFrame::idEditSettings = wxNewId();
56 const long yatishFrame::idHelpUser = wxNewId();
57 const long yatishFrame::idHelpAbout = wxNewId();
58 const long yatishFrame::idStatusBar = wxNewId();
59 const long yatishFrame::idTimer = wxNewId();
60 //*)
61 
62 BEGIN_EVENT_TABLE (yatishFrame, wxFrame)
63  //(*EventTable(yatishFrame)
64  //*)
65  EVT_UPDATE_UI(idEditActivity, yatishFrame::OnMenuitemEditActivityUpdate)
66  EVT_UPDATE_UI(idEditTable, yatishFrame::OnMenuitemEditTableUpdate)
67  EVT_UPDATE_UI(idEditChart, yatishFrame::OnMenuitemEditChartUpdate)
68  EVT_UPDATE_UI(idEditNew, yatishFrame::OnMenuitemEditNewUpdate)
69  EVT_UPDATE_UI(idEditReset, yatishFrame::OnMenuitemEditResetUpdate)
70  EVT_UPDATE_UI_RANGE(idEditToday, idEditLastmonth, yatishFrame::OnMenuitemEditTodayUpdate)
71 END_EVENT_TABLE()
72 
73 yatishFrame::yatishFrame (wxWindow* parent, wxWindowID id) {
74  //(*Initialize(yatishFrame)
75  wxBoxSizer* BoxSizer2;
76  wxBoxSizer* BoxSizer3;
77  wxBoxSizer* BoxSizer4;
78  wxBoxSizer* BoxSizer5;
79  wxMenu* Menu1;
80  wxMenu* Menu2;
81  wxMenu* Menu3;
82  wxMenuBar* menuBar;
83  wxMenuItem* menuitemEditActivity;
84  wxMenuItem* menuitemEditChart;
85  wxMenuItem* menuitemEditLastmonth;
86  wxMenuItem* menuitemEditLastweek;
87  wxMenuItem* menuitemEditNew;
88  wxMenuItem* menuitemEditReset;
89  wxMenuItem* menuitemEditSettings;
90  wxMenuItem* menuitemEditTable;
91  wxMenuItem* menuitemEditThismonth;
92  wxMenuItem* menuitemEditThisweek;
93  wxMenuItem* menuitemEditToday;
94  wxMenuItem* menuitemEditYesteday;
95  wxMenuItem* menuitemFileQuit;
96  wxMenuItem* menuitemHelpAbout;
97  wxMenuItem* menuitemHelpUser;
98  wxPanel* panelChart;
99  wxPanel* panelCurrent;
100  wxPanel* panelList;
101  wxStaticBoxSizer* StaticBoxSizer1;
102  wxStaticBoxSizer* StaticBoxSizer2;
103  wxStaticBoxSizer* StaticBoxSizer3;
104  wxStaticText* StaticText1;
105 
106  Create(parent, wxID_ANY, _("YATiSh"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
107  BoxSizer1 = new wxBoxSizer(wxVERTICAL);
108  notebook = new wxNotebook(this, idNotebook, wxDefaultPosition, wxDefaultSize, 0, _T("idNotebook"));
109  panelCurrent = new wxPanel(notebook, idPanelCurrent, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelCurrent"));
110  BoxSizer2 = new wxBoxSizer(wxVERTICAL);
111  BoxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
112  StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, panelCurrent, _("Select project, task and tool"));
113  choiceProject = new wxChoice(panelCurrent, idChoiceProject, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceProject"));
114  StaticBoxSizer1->Add(choiceProject, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
115  choiceTask = new wxChoice(panelCurrent, idChoiceTask, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTask"));
116  StaticBoxSizer1->Add(choiceTask, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
117  choiceTool = new wxChoice(panelCurrent, idChoiceTool, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTool"));
118  StaticBoxSizer1->Add(choiceTool, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
119  BoxSizer2->Add(StaticBoxSizer1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
120  BoxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
121  BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
122  buttonStart = new wxButton(panelCurrent, idButtonStart, _("&RECORD"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonStart"));
123  BoxSizer3->Add(buttonStart, 1, wxALL|wxEXPAND, 5);
124  buttonStop = new wxButton(panelCurrent, idButtonStop, _("&STOP"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonStop"));
125  BoxSizer3->Add(buttonStop, 1, wxALL|wxEXPAND, 5);
126  BoxSizer2->Add(BoxSizer3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
127  BoxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
128  panelCurrent->SetSizer(BoxSizer2);
129  BoxSizer2->Fit(panelCurrent);
130  BoxSizer2->SetSizeHints(panelCurrent);
131  panelList = new wxPanel(notebook, idPanelList, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelList"));
132  BoxSizer4 = new wxBoxSizer(wxVERTICAL);
133  BoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
134  StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, panelList, _("Table"));
135  choiceTable = new wxChoice(panelList, idChoiceTable, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTable"));
136  choiceTable->Append(_("Client"));
137  choiceTable->Append(_("Task"));
138  choiceTable->Append(_("Tool"));
139  choiceTable->Append(_("Project"));
140  choiceTable->Append(_("Activity"));
141  choiceTable->SetSelection( choiceTable->Append(_("Timeslot")) );
142  StaticBoxSizer2->Add(choiceTable, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
143  BoxSizer5->Add(StaticBoxSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
144  StaticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, panelList, _("Date interval (inclusive)"));
145  datePicker1 = new wxDatePickerCtrl(panelList, idDatePicker1, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker1"));
146  StaticBoxSizer3->Add(datePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
147  datePicker2 = new wxDatePickerCtrl(panelList, idDatePicker2, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker2"));
148  StaticBoxSizer3->Add(datePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
149  BoxSizer5->Add(StaticBoxSizer3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
150  BoxSizer5->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
151  buttonPDF = new wxButton(panelList, idButtonPDF, _("Export PDF"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonPDF"));
152  BoxSizer5->Add(buttonPDF, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
153  BoxSizer4->Add(BoxSizer5, 0, wxALL|wxEXPAND, 5);
154  listCtrl = new wxListCtrl(panelList, idListCtrl, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL, wxDefaultValidator, _T("idListCtrl"));
155  BoxSizer4->Add(listCtrl, 1, wxALL|wxEXPAND, 5);
156  panelList->SetSizer(BoxSizer4);
157  BoxSizer4->Fit(panelList);
158  BoxSizer4->SetSizeHints(panelList);
159  panelChart = new wxPanel(notebook, idPanelChart, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelChart"));
160  StaticText1 = new wxStaticText(panelChart, wxID_ANY, _("Coming soon..."), wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY"));
161  notebook->AddPage(panelCurrent, _("Current activity"), false);
162  notebook->AddPage(panelList, _("List/Edit"), false);
163  notebook->AddPage(panelChart, _("Charts"), false);
164  BoxSizer1->Add(notebook, 3, wxALL|wxEXPAND, 0);
165  textCtrl = new wxTextCtrl(this, idTextCtrl, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY, wxDefaultValidator, _T("idTextCtrl"));
166  BoxSizer1->Add(textCtrl, 1, wxALL|wxEXPAND, 5);
167  SetSizer(BoxSizer1);
168  menuBar = new wxMenuBar();
169  Menu1 = new wxMenu();
170  menuitemFileConnect = new wxMenuItem(Menu1, idFileConnect, _("&Connect\tCtrl-C"), _("Connect to a (remote) MySQL/MariaDB server"), wxITEM_NORMAL);
171  Menu1->Append(menuitemFileConnect);
172  menuitemFileUpdate = new wxMenuItem(Menu1, idFileUpdate, _("&Update\tCtrl-U"), _("Update remote database"), wxITEM_NORMAL);
173  Menu1->Append(menuitemFileUpdate);
174  menuitemFileUpdate->Enable(false);
175  menuitemFileUpload = new wxMenuItem(Menu1, idFileUpload, _("Up&load"), _("Replace remote data (by local)"), wxITEM_NORMAL);
176  Menu1->Append(menuitemFileUpload);
177  menuitemFileUpload->Enable(false);
178  menuitemFileDownload = new wxMenuItem(Menu1, idFileDownload, _("&Download"), _("Replace local data (by remote)"), wxITEM_NORMAL);
179  Menu1->Append(menuitemFileDownload);
180  menuitemFileDownload->Enable(false);
181  Menu1->AppendSeparator();
182  menuitemFileQuit = new wxMenuItem(Menu1, idFileQuit, _("&Quit\tCtrl-Q"), wxEmptyString, wxITEM_NORMAL);
183  Menu1->Append(menuitemFileQuit);
184  menuBar->Append(Menu1, _("&File"));
185  Menu2 = new wxMenu();
186  menuitemEditActivity = new wxMenuItem(Menu2, idEditActivity, _("&Activity\tCtrl-A"), _("Start/stop current activity"), wxITEM_NORMAL);
187  Menu2->Append(menuitemEditActivity);
188  menuitemEditTable = new wxMenuItem(Menu2, idEditTable, _("&Tables\tCtrl-T"), _("Edit any table"), wxITEM_NORMAL);
189  Menu2->Append(menuitemEditTable);
190  menuitemEditChart = new wxMenuItem(Menu2, idEditChart, _("&Charts\tCtrl-G"), _("Look at various charts"), wxITEM_NORMAL);
191  Menu2->Append(menuitemEditChart);
192  Menu2->AppendSeparator();
193  menuitemEditNew = new wxMenuItem(Menu2, idEditNew, _("&New record...\tCtrl-N"), _("Add a record to the currently selected table"), wxITEM_NORMAL);
194  Menu2->Append(menuitemEditNew);
195  menuitemEditReset = new wxMenuItem(Menu2, idEditReset, _("&Reset filter\tCtrl-R"), _("Reset the viewing filter"), wxITEM_NORMAL);
196  Menu2->Append(menuitemEditReset);
197  Menu2->AppendSeparator();
198  menuitemEditToday = new wxMenuItem(Menu2, idEditToday, _("Today"), _("Time interval to show: today"), wxITEM_NORMAL);
199  Menu2->Append(menuitemEditToday);
200  menuitemEditThisweek = new wxMenuItem(Menu2, idEditThisweek, _("This week"), _("Time interval to show: this week"), wxITEM_NORMAL);
201  Menu2->Append(menuitemEditThisweek);
202  menuitemEditThismonth = new wxMenuItem(Menu2, idEditThismonth, _("This month"), _("Time interval to show: this month"), wxITEM_NORMAL);
203  Menu2->Append(menuitemEditThismonth);
204  menuitemEditYesteday = new wxMenuItem(Menu2, idEditYesterday, _("Yesterday"), _("Time interval to show: yesterday"), wxITEM_NORMAL);
205  Menu2->Append(menuitemEditYesteday);
206  menuitemEditLastweek = new wxMenuItem(Menu2, idEditLastweek, _("Last week"), _("Time interval to show: last week"), wxITEM_NORMAL);
207  Menu2->Append(menuitemEditLastweek);
208  menuitemEditLastweek->Enable(false);
209  menuitemEditLastmonth = new wxMenuItem(Menu2, idEditLastmonth, _("Last month"), _("Time interval to show: last month"), wxITEM_NORMAL);
210  Menu2->Append(menuitemEditLastmonth);
211  Menu2->AppendSeparator();
212  menuitemEditSettings = new wxMenuItem(Menu2, idEditSettings, _("&Settings...\tCtrl-S"), _("Set user preferences"), wxITEM_NORMAL);
213  Menu2->Append(menuitemEditSettings);
214  menuBar->Append(Menu2, _("&Edit"));
215  Menu3 = new wxMenu();
216  menuitemHelpUser = new wxMenuItem(Menu3, idHelpUser, _("&User guide\tF1"), wxEmptyString, wxITEM_NORMAL);
217  Menu3->Append(menuitemHelpUser);
218  menuitemHelpAbout = new wxMenuItem(Menu3, idHelpAbout, _("&About..."), wxEmptyString, wxITEM_NORMAL);
219  Menu3->Append(menuitemHelpAbout);
220  menuBar->Append(Menu3, _("&Help"));
221  SetMenuBar(menuBar);
222  statusBar = new wxStatusBar(this, idStatusBar, 0, _T("idStatusBar"));
223  int __wxStatusBarWidths_1[3] = { 65, 85, -1 };
224  int __wxStatusBarStyles_1[3] = { wxSB_RAISED, wxSB_RAISED, wxSB_NORMAL };
225  statusBar->SetFieldsCount(3,__wxStatusBarWidths_1);
226  statusBar->SetStatusStyles(3,__wxStatusBarStyles_1);
227  SetStatusBar(statusBar);
228  timer.SetOwner(this, idTimer);
229  BoxSizer1->Fit(this);
230  BoxSizer1->SetSizeHints(this);
231 
232  Connect(idButtonStart,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&yatishFrame::OnButtonStartClick);
233  Connect(idButtonStop,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&yatishFrame::OnButtonStopClick);
234  Connect(idChoiceTable,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&yatishFrame::OnChoiceTableSelect);
235  Connect(idDatePicker1,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker1Changed);
236  Connect(idDatePicker2,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker2Changed);
237  Connect(idListCtrl,wxEVT_COMMAND_LIST_KEY_DOWN,(wxObjectEventFunction)&yatishFrame::OnListKeyDown);
238  Connect(idListCtrl,wxEVT_COMMAND_LIST_COL_CLICK,(wxObjectEventFunction)&yatishFrame::OnListColumnClick);
239  Connect(idNotebook,wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnNotebookPageChanged);
240  Connect(idFileConnect,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileConnectSelected);
241  Connect(idFileUpdate,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileUpdateSelected);
242  Connect(idFileUpload,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileUploadSelected);
243  Connect(idFileDownload,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileDownloadSelected);
244  Connect(idFileQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnQuit);
245  Connect(idEditActivity,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditActivitySelected);
246  Connect(idEditTable,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditTableSelected);
247  Connect(idEditChart,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditChartSelected);
248  Connect(idEditNew,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditNewSelected);
249  Connect(idEditReset,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditResetSelected);
250  Connect(idEditToday,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditTodaySelected);
251  Connect(idEditThisweek,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditThisweekSelected);
252  Connect(idEditThismonth,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditThismonthSelected);
253  Connect(idEditYesterday,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditYestedaySelected);
254  Connect(idEditLastweek,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditLastweekSelected);
255  Connect(idEditLastmonth,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditLastmonthSelected);
256  Connect(idEditSettings,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditSettingsSelected);
257  Connect(idHelpUser,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnHelp);
258  Connect(idHelpAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnAbout);
259  Connect(idTimer,wxEVT_TIMER,(wxObjectEventFunction)&yatishFrame::OnTimerTrigger);
260  Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&yatishFrame::OnClose);
261  //*)
262  datePicker1->Bind(wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu1, this);
263  datePicker2->Bind(wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu2, this);
264  listCtrl->Bind(wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu3, this);
265  SetIcon ( wxIcon (yatish_xpm) );
266  yatishHelp.Initialize (wxStandardPaths::Get().GetDataDir() + wxFILE_SEP_PATH + "yatish");
267  buttonStop->Disable(); clockStart = wxDateTime::Now();
268  UpdateClock(); UpdateStatus (mysql_off); SetStatusBarPane (2);
269  masterDB.SetLimit (settings.limitRow, settings.rowLimit);
270  if (settings.log2text)
271  defaultLog = wxLog::SetActiveTarget( new wxLogTextCtrl (textCtrl) );
272  else {
273  textCtrl->Hide(); BoxSizer1->Fit (this); BoxSizer1->SetSizeHints (this);
274  }
275  ResetChoices(); ResetPickers(); UpdateColumns();
276  SetStatusText (wxEmptyString, 2); // don't show SUM|AVG on startup
277  // take care of previously ill-terminated yatish jobs
278  switch ( masterDB.RunningTimeslots() ) {
279  case -1:
280  case 0:
281  break;
282  case 1:
283  Recording();
284  break;
285  default:
286  wxLogError (_("Several yatish were inappropriately terminated!") );
287  }
288  buttonPDF->Disable(); panelChart->Hide(); // Coming soon...
289  slaveDB = nullptr;
290 }
291 
293  //(*Destroy(yatishFrame)
294  //*)
295 }
296 
298  wxDateTime now = wxDateTime::Now();
299  wxTimeSpan elapsed = now - clockStart;
300  SetStatusText ( elapsed.Format() );
301 }
302 
304  switch (status) {
305  case mysql_on:
306  SetStatusText ("MySQL ON", 1);
307  break;
308  case mysql_off:
309  SetStatusText ("MySQL OFF", 1);
310  break;
311  default:
312  SetStatusText ("MySQL ERR", 1);
313  }
314 }
315 
317  bool choiceOK;
319  choiceOK = masterDB.FillChoice (choiceTask, task_tid);
320  choiceOK = masterDB.FillChoice (choiceTool, tool_tid);
321  if (!choiceOK) wxLogError ("Reset of choices failed for panel #1");
322  if ( choiceProject->IsEmpty() || choiceTask->IsEmpty() || choiceTool->IsEmpty() )
323  buttonStart->Disable(); // in case the database is not populated yet
324  else
325  buttonStart->Enable ( !buttonStop->IsEnabled() );
326  long lastActivityID = masterDB.LastActivity();
327  if (lastActivityID == wxNOT_FOUND) {
328  choiceProject->SetSelection (0);
329  choiceTask ->SetSelection (0);
330  choiceTool ->SetSelection (0);
331  } else {
332  choiceProject->SetSelection (masterDB.ChoiceSelector (project_tid, lastActivityID) );
333  choiceTask ->SetSelection (masterDB.ChoiceSelector (task_tid, lastActivityID) );
334  choiceTool ->SetSelection (masterDB.ChoiceSelector (tool_tid, lastActivityID) );
335  }
336 }
337 
339  listCtrl->DeleteAllColumns();
340  // Now we rely on the fact that choiceTable was initialized
341  // in the same order as tableID is defined:
342  tableID tid = (tableID) choiceTable->GetSelection();
343  // (same assumption each time we will use the trick).
344  switch (tid) {
345  case timeslot_tid:
346  listCtrl->AppendColumn(_("Date") );
347  listCtrl->AppendColumn(_("Duration") );
348  listCtrl->AppendColumn(_("Project") );
349  listCtrl->AppendColumn(_("Client") );
350  listCtrl->AppendColumn(_("Task") );
351  listCtrl->AppendColumn(_("Tool") );
352  break;
353  case activity_tid:
354  listCtrl->AppendColumn(_("Project") );
355  listCtrl->AppendColumn(_("Client") );
356  listCtrl->AppendColumn(_("Task") );
357  listCtrl->AppendColumn(_("Tool") );
358  break;
359  case project_tid:
360  listCtrl->AppendColumn(_("Name") );
361  listCtrl->AppendColumn(_("Client") );
362  break;
363  default:
364  listCtrl->AppendColumn(_("Name") );
365  }
366  UpdateRows (tid);
367 }
368 
370  listCtrl->Freeze(); // or Hide()...
371  listCtrl->DeleteAllItems();
372  if ( !masterDB.FillList (listCtrl, tid) )
373  wxLogError ("Updating listCrl failed (panel #2)");
374  for (int col = 0; col < listCtrl->GetColumnCount(); col++)
375  listCtrl->SetColumnWidth (col, wxLIST_AUTOSIZE_USEHEADER);
376  listCtrl->Thaw(); // or Show()...
377  SetStatusText (masterDB.FilteredTotal(), 2);
378 }
379 
381  datePicker1->SetValue ( masterDB.First() );
382  datePicker2->SetValue ( masterDB.Last() );
383  masterDB.SetFirstDay ( datePicker1->GetValue() );
384  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
385 }
386 
388  bool b = menuitemFileConnect->IsEnabled();
389  menuitemFileConnect ->Enable (!b);
390  menuitemFileUpdate ->Enable ( b);
391  menuitemFileUpload ->Enable ( b);
392  menuitemFileDownload->Enable ( b);
393 }
394 
396  if (settings.log2text) {
397  defaultLog = wxLog::SetActiveTarget( new wxLogTextCtrl (textCtrl) );
398  textCtrl->Show(); BoxSizer1->Fit (this); BoxSizer1->SetSizeHints (this);
399  } else {
400  delete wxLog::SetActiveTarget (defaultLog);
401  textCtrl->Hide(); BoxSizer1->Fit (this); BoxSizer1->SetSizeHints (this);
402  }
403 }
404 
405 // Handlers...
406 
407 void yatishFrame::OnQuit (wxCommandEvent& event) {
408  Close();
409 }
410 
411 void yatishFrame::OnClose (wxCloseEvent& event) {
412  if ( yatishHelp.GetFrame() ) yatishHelp.GetFrame()->Close (true);
413  if (settings.log2text) delete wxLog::SetActiveTarget (defaultLog);
414  delete slaveDB;
415  Destroy();
416 }
417 
418 void yatishFrame::OnTimerTrigger (wxTimerEvent& event) {
419  UpdateClock();
420 }
421 
422 // ...menus
423 
424 void yatishFrame::OnMenuitemFileConnectSelected(wxCommandEvent& event) {
425  delete slaveDB;
426  slaveDB = new yatishDBmysql;
427  if ( slaveDB->IsOk() ) {
428  ToggleConnect();
430  } else
432 }
433 
434 void yatishFrame::OnMenuitemFileUpdateSelected (wxCommandEvent& event) {
435  if ( buttonStop->IsEnabled() ) {
436  wxMessageBox (_("Please stop the current activity"),
437  _("Update refused"), wxOK);
438  return;
439  }
440  int err = slaveDB->Commit();
441  if (err == 2006 || err == 2013) {
442  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
444  ToggleConnect();
445  }
446 }
447 
448 void yatishFrame::OnMenuitemFileUploadSelected (wxCommandEvent& event) {
449  if ( wxMessageBox ( _("Remote data (if any) will be\noverwritten by local ones."),
450  _("Are you sure?"),
451  wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
452  == wxCANCEL ) return;
453  SetStatusText (_("Please wait, working..."), 2);
454  int err = slaveDB->Upload();
455  SetStatusText (wxEmptyString, 2);
456  if (err == 2006 || err == 2013) {
457  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
459  ToggleConnect();
460  }
461 }
462 
463 void yatishFrame::OnMenuitemFileDownloadSelected (wxCommandEvent& event) {
464  if ( wxMessageBox ( _("Local data (if any) will be\noverwritten by remote ones."),
465  _("Are you sure?"),
466  wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
467  == wxCANCEL ) return;
468  SetStatusText (_("Please wait, working..."), 2);
469  int err = slaveDB->Download();
470  SetStatusText (wxEmptyString, 2);
471  if (err == 2006 || err == 2013) {
472  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
474  ToggleConnect();
475  } else {
476  int page = notebook->GetSelection();
477  if (page == 0) ResetChoices();
478  if (page == 1) {
479  ResetPickers();
480  UpdateRows ( (tableID) choiceTable->GetSelection() );
481  }
482  }
483 }
484 
485 
486 void yatishFrame::OnMenuitemEditActivitySelected(wxCommandEvent& event) {
487  notebook->SetSelection (0);
488 }
489 void yatishFrame::OnMenuitemEditActivityUpdate (wxUpdateUIEvent& event) {
490  event.Enable (notebook->GetSelection() != 0);
491 }
492 void yatishFrame::OnMenuitemEditTableSelected (wxCommandEvent& event) {
493  notebook->SetSelection (1);
494 }
495 void yatishFrame::OnMenuitemEditTableUpdate (wxUpdateUIEvent& event) {
496  event.Enable (notebook->GetSelection() != 1);
497 }
498 void yatishFrame::OnMenuitemEditChartSelected(wxCommandEvent& event) {
499  notebook->SetSelection (2);
500 }
501 void yatishFrame::OnMenuitemEditChartUpdate (wxUpdateUIEvent& event) {
502  //event.Enable (notebook->GetSelection() != 2); // Coming soon...
503  event.Enable (false);
504 }
505 
506 void yatishFrame::OnMenuitemEditNewSelected (wxCommandEvent& event) {
507  int dlgEnd = wxID_CANCEL;
508  tableID tid = (tableID) choiceTable->GetSelection();
509  if (tid == client_tid || tid == task_tid || tid == tool_tid) {
510  yatishDlgName dlg (&masterDB, tid);
511  dlgEnd = dlg.ShowModal();
512  } else if (tid == project_tid) {
513  yatishDlgProject dlg (&masterDB);
514  dlgEnd = dlg.ShowModal();
515  } else if (tid == activity_tid) {
517  dlgEnd = dlg.ShowModal();
518  } else { // tid == timeslot_tid
520  dlgEnd = dlg.ShowModal();
521  }
522  if (dlgEnd != wxID_CANCEL) {
523  datePicker2->SetValue ( masterDB.Last() );
524  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
525  UpdateRows (tid);
526  }
527 }
528 
529 void yatishFrame::OnMenuitemEditNewUpdate (wxUpdateUIEvent& event) {
530  event.Enable (notebook->GetSelection() == 1);
531 }
532 
533 void yatishFrame::OnMenuitemEditResetSelected (wxCommandEvent& event) {
535  ResetPickers();
536  UpdateRows ( (tableID) choiceTable->GetSelection() );
537 }
538 
539 void yatishFrame::OnMenuitemEditResetUpdate (wxUpdateUIEvent& event) {
540  tableID tid = (tableID) choiceTable->GetSelection();
541  bool filterAvailable = ( tid == project_tid || tid == activity_tid || tid == timeslot_tid );
542  event.Enable (notebook->GetSelection() == 1 && filterAvailable);
543 }
544 
545 void yatishFrame::OnMenuitemEditTodaySelected(wxCommandEvent& event) {
546  wxDateTime dt = wxDateTime::Today();
547  datePicker2->SetValue (dt);
548  datePicker1->SetValue (dt);
549  masterDB.SetFirstDay ( datePicker1->GetValue() );
550  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
552 }
553 
554 void yatishFrame::OnMenuitemEditTodayUpdate (wxUpdateUIEvent& event) {
555  tableID tid = (tableID) choiceTable->GetSelection();
556  event.Enable (notebook->GetSelection() == 1 && tid == timeslot_tid);
557 }
558 
559 void yatishFrame::OnMenuitemEditThisweekSelected(wxCommandEvent& event) {
560  wxDateTime dt = wxDateTime::Today();
561  datePicker2->SetValue (dt);
562  dt.SetToPrevWeekDay (wxDateTime::Mon);
563  datePicker1->SetValue (dt);
564  masterDB.SetFirstDay ( datePicker1->GetValue() );
565  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
567 }
568 
569 void yatishFrame::OnMenuitemEditThismonthSelected(wxCommandEvent& event) {
570  wxDateTime dt = wxDateTime::Today();
571  datePicker2->SetValue (dt);
572  dt.SetDay (1);
573  datePicker1->SetValue (dt);
574  masterDB.SetFirstDay ( datePicker1->GetValue() );
575  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
577 }
578 
579 void yatishFrame::OnMenuitemEditYestedaySelected(wxCommandEvent& event) {
580  wxDateTime dt = wxDateTime::Today();
581  dt -= wxDateSpan::Day();
582  datePicker2->SetValue (dt);
583  datePicker1->SetValue (dt);
584  masterDB.SetFirstDay ( datePicker1->GetValue() );
585  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
587 }
588 
589 void yatishFrame::OnMenuitemEditLastweekSelected(wxCommandEvent& event) {
590  wxDateTime dt = wxDateTime::Today();
591  dt -= wxDateSpan::Week();
592  dt.SetToNextWeekDay (wxDateTime::Sun);
593  datePicker2->SetValue (dt);
594  dt.SetToPrevWeekDay (wxDateTime::Mon);
595  datePicker1->SetValue (dt);
596  masterDB.SetFirstDay ( datePicker1->GetValue() );
597  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
599 }
600 
601 void yatishFrame::OnMenuitemEditLastmonthSelected(wxCommandEvent& event) {
602  wxDateTime dt = wxDateTime::Today();
603  dt -= wxDateSpan::Month();
604  dt.SetToLastMonthDay();
605  datePicker2->SetValue (dt);
606  dt.SetDay (1);
607  datePicker1->SetValue (dt);
608  masterDB.SetFirstDay ( datePicker1->GetValue() );
609  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
611 }
612 
613 void yatishFrame::OnContextMenu1(wxContextMenuEvent& event) {
614  wxMenu menu;
615  menu.Append ( idEditToday, _("Today"), _("Time interval to show: today") );
616  menu.Append ( idEditThisweek, _("This week"), _("Time interval to show: this week") );
617  menu.Append ( idEditThismonth, _("This month"), _("Time interval to show: this month") );
618  PopupMenu (&menu);
619 }
620 
621 void yatishFrame::OnContextMenu2(wxContextMenuEvent& event) {
622  wxMenu menu;
623  menu.Append ( idEditYesterday, _("Yesterday"), _("Time interval to show: yesterday") );
624  menu.Append ( idEditLastweek, _("Last week"), _("Time interval to show: last week") );
625  menu.Append ( idEditLastmonth, _("Last month"), _("Time interval to show: last month") );
626  PopupMenu (&menu);
627 }
628 
629 void yatishFrame::OnContextMenu3(wxContextMenuEvent& event) {
630  wxMenu menu;
631  menu.Append ( idEditNew, _("New record..."), _("Add a record to the currently selected table") );
632  menu.Append ( idEditReset, _("Reset filter"), _("Reset the viewing filter") );
633  //wxPoint pos = ScreenToClient ( event.GetPosition() );
634  //PopupMenu (&menu, pos);
635  PopupMenu (&menu);
636 }
637 
638 void yatishFrame::OnMenuitemEditSettingsSelected (wxCommandEvent& event) {
639  yatishSettings dlg;
640  dlg.Set (settings);
641  if (dlg.ShowModal() == wxID_CANCEL) return;
642  bool oldLog = settings.log2text;
643  dlg.Get (settings);
644  if (settings.log2text != oldLog) ToggleLog();
646  tableID tid = (tableID) choiceTable->GetSelection();
647  if (notebook->GetSelection() == 1) UpdateRows (tid);
648 }
649 
650 void yatishFrame::OnHelp (wxCommandEvent& event) {
651  yatishHelp.DisplayContents();
652 }
653 
654 void yatishFrame::OnAbout (wxCommandEvent& event) {
655  wxAboutDialogInfo info;
656  info.SetName ("Yatish");
657  info.SetVersion ("0.2");
658  wxString what (_("Yet Another TIme SHeet\n"
659  "Time tracking for freelancers/homeworkers\n"
660  "Built with:\n") );
661  what << wxVERSION_STRING;
662  what << "\n+wxDatabase\n+Code::Blocks\n+wxSmith";
663  info.SetDescription (what);
664  info.SetCopyright ("(C) 2020 EIF-services");
665  info.SetLicence ("This program is free software:\n"
666  "you can redistribute it and/or modify it\n"
667  "under the terms of the GNU General Public License\n"
668  "as published by the Free Software Foundation,\n"
669  "either version 3 of the License, or (at your option) any later version.\n"
670  "This program is distributed in the hope that it will be useful,\n"
671  "but WITHOUT ANY WARRANTY; without even the implied warranty\n"
672  "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
673  "See the GNU General Public License for more details.\n"
674  "You should have received a copy of the GNU General Public License\n"
675  "along with this program. If not, see https://www.gnu.org/licenses/");
676  info.SetWebSite("https://www.eif-services.eu/yatish");
677  wxString me (L"Nicolas P\u00E9renne <nicolas.perenne@eif-services.eu>");
678  info.AddDeveloper (me);
679  wxAboutBox (info, this);
680 }
681 
682 // ...controls
683 
684 void yatishFrame::OnNotebookPageChanged (wxNotebookEvent& event) {
685  if (event.GetSelection() == 0) {
686  SetStatusText (wxEmptyString, 2); // don't show SUM|AVG
687  ResetChoices();
688  }
689  if (event.GetSelection() == 1) {
691  ResetPickers();
692  UpdateRows ( (tableID) choiceTable->GetSelection() );
693  }
694 }
695 
696 void yatishFrame::OnButtonStartClick (wxCommandEvent& event) {
697  if ( !masterDB.StartTimeslot ( choiceProject->GetSelection(),
698  choiceTask->GetSelection(),
699  choiceTool->GetSelection() ) ) {
700  wxLogError ("Timeslot could not be started");
701  return;
702  }
703  Recording();
704 }
705 
708  clockStart = wxDateTime::Now();
709  UpdateClock();
710  timer.Start (1000);
711  buttonStart->Disable();
712  buttonStop->Enable();
713  SetIcon ( wxIcon (yatish_recording_xpm) );
714 }
715 
716 void yatishFrame::OnButtonStopClick (wxCommandEvent& event) {
717  if ( !masterDB.StopTimeslot() ) {
718  wxLogError ("Timeslot could not be stopped");
719  return;
720  }
721  timer.Stop();
722  buttonStop->Disable();
723  buttonStart->Enable();
724  SetIcon ( wxIcon (yatish_xpm) );
725 }
726 
727 void yatishFrame::OnChoiceTableSelect (wxCommandEvent& event) {
729  if (event.GetSelection() == timeslot_tid) {
730  datePicker1->Enable();
731  datePicker2->Enable();
732  } else {
733  datePicker1->Disable();
734  datePicker2->Disable();
735  }
736  UpdateColumns();
737 }
738 
739 void yatishFrame::OnDatePicker1Changed (wxDateEvent& event) {
740  masterDB.SetFirstDay ( datePicker1->GetValue() );
742 }
743 
744 void yatishFrame::OnDatePicker2Changed (wxDateEvent& event) {
745  masterDB.SetLastDay ( datePicker2->GetValue() + wxDateSpan::Day() );
747 }
748 
749 void yatishFrame::OnListColumnClick (wxListEvent& event) {
750  tableID tid = (tableID) choiceTable->GetSelection();
751  if (tid == client_tid || tid == task_tid || tid == tool_tid)
752  return;
753  int project_col = -1,
754  client_col = -1,
755  task_col = -1,
756  tool_col = -1;
757  if (tid == timeslot_tid) {
758  project_col = 2;
759  client_col = 3;
760  task_col = 4;
761  tool_col = 5;
762  }
763  if (tid == activity_tid) {
764  project_col = 0;
765  client_col = 1;
766  task_col = 2;
767  tool_col = 3;
768  }
769  if (tid == project_tid)
770  client_col = 1;
771  int col = event.GetColumn();
772  int ret = wxID_CANCEL;
773  if (col == project_col) {
775  ret = dlg.ShowModal();
776  }
777  if (col == client_col) {
779  ret = dlg.ShowModal();
780  }
781  if (col == task_col) {
783  ret = dlg.ShowModal();
784  }
785  if (col == tool_col) {
787  ret = dlg.ShowModal();
788  }
789  if (ret == wxID_OK) {
790  UpdateRows (tid);
791  ResetPickers();
792  }
793 }
794 
795 void yatishFrame::OnListKeyDown (wxListEvent& event) {
796  if ( !wxGetKeyState (WXK_SHIFT) ) {
797  event.Skip();
798  return;
799  }
800  tableID tid = (tableID) choiceTable->GetSelection();
801  long row_id = event.GetIndex(), sql_id = listCtrl->GetItemData (row_id);
802  switch ( event.GetKeyCode() ) {
803  case 'E':
804  { int dlgEnd = wxID_CANCEL;
805  if (tid == client_tid || tid == task_tid || tid == tool_tid) {
806  yatishDlgName dlg (&masterDB, tid, sql_id);
807  dlgEnd = dlg.ShowModal();
808  } else if (tid == project_tid) {
809  yatishDlgProject dlg (&masterDB, sql_id);
810  dlgEnd = dlg.ShowModal();
811  } else if (tid == activity_tid) {
812  yatishDlgActivity dlg (&masterDB, sql_id);
813  dlgEnd = dlg.ShowModal();
814  } else { // tid == timeslot_tid
815  if ( listCtrl->GetItemText (row_id, 1) .IsEmpty() ) {
816  wxMessageBox (_("Won't edit the current activity\n(first close it)."),
817  _("Change selection"), wxOK);
818  } else {
819  yatishDlgTimeslot dlg (&masterDB, sql_id);
820  dlgEnd = dlg.ShowModal();
821  }
822  }
823  if (dlgEnd != wxID_CANCEL) UpdateRows (tid); }
824  break;
825  case 'D':
826  if ( masterDB.Delete (tid, sql_id) ) UpdateRows (tid);
827  break;
828  default:
829  event.Skip();
830  }
831 }
void OnMenuitemEditLastweekSelected(wxCommandEvent &event)
wxNotebook * notebook
Definition: yatishFrame.h:163
mysqlStatus
Definition: yatishFrame.h:43
void OnMenuitemEditTableUpdate(wxUpdateUIEvent &)
wxDatePickerCtrl * datePicker1
Definition: yatishFrame.h:156
void OnMenuitemFileDownloadSelected(wxCommandEvent &event)
Interacts with yatish tables in a MySQL/MariaDB database.
Definition: yatishDBmysql.h:19
bool StopTimeslot()
Stops current timeslot.
static const long idHelpUser
Definition: yatishFrame.h:142
static const long idEditSettings
Definition: yatishFrame.h:141
static const long idHelpAbout
Definition: yatishFrame.h:143
wxDateTime First()
Obtains the minimum time in column start from currently selected rows of table yatish_timeslot.
void OnQuit(wxCommandEvent &event)
static const long idNotebook
Definition: yatishFrame.h:123
int Download()
Downloads slaveDB into masterDB.
static const long idEditToday
Definition: yatishFrame.h:135
void Recording()
static const long idPanelCurrent
Definition: yatishFrame.h:115
static const long idFileDownload
Definition: yatishFrame.h:128
static const long idEditLastmonth
Definition: yatishFrame.h:140
static const long idEditChart
Definition: yatishFrame.h:132
static const long idTimer
Definition: yatishFrame.h:145
static const long idEditReset
Definition: yatishFrame.h:134
static const long idEditLastweek
Definition: yatishFrame.h:139
void OnMenuitemFileConnectSelected(wxCommandEvent &event)
void OnMenuitemFileUploadSelected(wxCommandEvent &event)
void OnHelp(wxCommandEvent &event)
void OnContextMenu3(wxContextMenuEvent &)
void OnMenuitemEditThisweekSelected(wxCommandEvent &event)
void SetLastDay(const wxDateTime &)
Sets private member lastDay (for future SQL queries).
static const long idButtonStop
Definition: yatishFrame.h:114
wxHtmlHelpController yatishHelp
Definition: yatishFrame.h:56
void ResetPickers()
void OnMenuitemEditActivityUpdate(wxUpdateUIEvent &)
yatishDBmysql * slaveDB
Definition: yatishFrame.h:59
wxChoice * choiceTool
Definition: yatishFrame.h:155
static const long idChoiceTable
Definition: yatishFrame.h:116
long LastActivity()
Reads the last activity_id in yatish_timeslot.
wxMenuItem * menuitemFileUpdate
Definition: yatishFrame.h:161
void OnMenuitemEditYestedaySelected(wxCommandEvent &event)
void OnMenuitemEditTodayUpdate(wxUpdateUIEvent &)
void OnListColumnClick(wxListEvent &event)
static const long idPanelChart
Definition: yatishFrame.h:122
void Get(Settings &)
void OnDatePicker2Changed(wxDateEvent &event)
void OnChoiceTableSelect(wxCommandEvent &event)
static const long idButtonStart
Definition: yatishFrame.h:113
static const long idFileConnect
Definition: yatishFrame.h:125
void OnMenuitemEditTableSelected(wxCommandEvent &event)
wxChoice * choiceTask
Definition: yatishFrame.h:154
void OnMenuitemEditNewSelected(wxCommandEvent &event)
static const long idButtonPDF
Definition: yatishFrame.h:119
Settings settings
Definition: yatishFrame.h:54
static const long idEditThisweek
Definition: yatishFrame.h:136
void OnDatePicker1Changed(wxDateEvent &event)
void OnAbout(wxCommandEvent &event)
wxButton * buttonStart
Definition: yatishFrame.h:150
void SetLimit(bool b, int i)
void UpdateClock()
wxTextCtrl * textCtrl
Definition: yatishFrame.h:165
wxString FilteredTotal()
Writes the total and average durations of currently viewed timeslots.
bool StartTimeslot(int, int, int)
Starts a new row in the timeslot table.
static const long idFileUpload
Definition: yatishFrame.h:127
void OnMenuitemEditSettingsSelected(wxCommandEvent &event)
void OnMenuitemEditActivitySelected(wxCommandEvent &event)
yatishDBsqlite masterDB
Definition: yatishFrame.h:58
static const long idChoiceTask
Definition: yatishFrame.h:111
void OnMenuitemEditThismonthSelected(wxCommandEvent &event)
void SetFirstDay(const wxDateTime &)
Sets private member firstDay (for future SQL queries).
bool Delete(tableID, long)
Marks a local record for deletion.
bool log2text
void OnButtonStartClick(wxCommandEvent &event)
void OnContextMenu2(wxContextMenuEvent &)
tableID
Definition: yatishDB.h:20
void UpdateStatus(mysqlStatus)
static const long idStatusBar
Definition: yatishFrame.h:144
wxDatePickerCtrl * datePicker2
Definition: yatishFrame.h:157
wxDateTime clockStart
Definition: yatishFrame.h:57
static const long idDatePicker2
Definition: yatishFrame.h:118
static const long idEditActivity
Definition: yatishFrame.h:130
wxChoice * choiceProject
Definition: yatishFrame.h:152
void OnMenuitemFileUpdateSelected(wxCommandEvent &event)
wxChoice * choiceTable
Definition: yatishFrame.h:153
int ChoiceSelector(tableID, long)
Finds the proper index for selection in a wxChoice.
static const long idEditTable
Definition: yatishFrame.h:131
wxTimer timer
Definition: yatishFrame.h:166
void OnClose(wxCloseEvent &event)
static const long idChoiceTool
Definition: yatishFrame.h:112
bool FillList(wxListCtrl *, tableID)
Fills a wxListCtrl.
static const long idFileUpdate
Definition: yatishFrame.h:126
void OnNotebookPageChanged(wxNotebookEvent &event)
const char * not_used
Definition: yatishFrame.cpp:15
static const long idEditThismonth
Definition: yatishFrame.h:137
void OnListKeyDown(wxListEvent &event)
int Upload()
Uploads masterDB into slaveDB.
void ToggleLog()
void ToggleConnect()
void UpdateRows(tableID)
void OnMenuitemEditChartUpdate(wxUpdateUIEvent &)
wxMenuItem * menuitemFileDownload
Definition: yatishFrame.h:160
wxListCtrl * listCtrl
Definition: yatishFrame.h:158
static const long idPanelList
Definition: yatishFrame.h:121
int Commit()
Updates slaveDB with records of masterDB where the sync field is not &#39;S&#39;.
bool limitRow
void Set(Settings &)
wxBoxSizer * BoxSizer1
Definition: yatishFrame.h:148
wxDateTime Last()
Obtains the maximum time in column start from currently selected rows of table yatish_timeslot.
static const long idEditYesterday
Definition: yatishFrame.h:138
void OnMenuitemEditLastmonthSelected(wxCommandEvent &event)
void OnMenuitemEditResetSelected(wxCommandEvent &event)
static const long idFileQuit
Definition: yatishFrame.h:129
wxMenuItem * menuitemFileUpload
Definition: yatishFrame.h:162
wxButton * buttonStop
Definition: yatishFrame.h:151
wxLog * defaultLog
Definition: yatishFrame.h:55
void OnMenuitemEditTodaySelected(wxCommandEvent &event)
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
static const long idDatePicker1
Definition: yatishFrame.h:117
void OnContextMenu1(wxContextMenuEvent &)
void UpdateColumns()
static const long idEditNew
Definition: yatishFrame.h:133
static const long idChoiceProject
Definition: yatishFrame.h:110
void OnTimerTrigger(wxTimerEvent &event)
static const long idListCtrl
Definition: yatishFrame.h:120
void OnMenuitemEditResetUpdate(wxUpdateUIEvent &)
void OnButtonStopClick(wxCommandEvent &event)
void OnMenuitemEditNewUpdate(wxUpdateUIEvent &)
void OnMenuitemEditChartSelected(wxCommandEvent &event)
void ResetChoices()
wxMenuItem * menuitemFileConnect
Definition: yatishFrame.h:159
static const long idTextCtrl
Definition: yatishFrame.h:124