YATiSh
Yet Another TIme SHeet
yatishFrame.cpp
Go to the documentation of this file.
1 /********************************************************************
2  * Name: yatishFrame.cpp
3  * Purpose: Implements the main 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/yatish)
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::idChoiceChart = wxNewId();
37 const long yatishFrame::idChoiceAggregate = wxNewId();
38 const long yatishFrame::idChoiceCluster = wxNewId();
39 const long yatishFrame::idDatePicker3 = wxNewId();
40 const long yatishFrame::idDatePicker4 = wxNewId();
41 const long yatishFrame::idPanelChart = wxNewId();
42 const long yatishFrame::idNotebook = wxNewId();
43 const long yatishFrame::idTextCtrl = wxNewId();
44 const long yatishFrame::idFileConnect = wxNewId();
45 const long yatishFrame::idFileUpdate = wxNewId();
46 const long yatishFrame::idFileUpload = wxNewId();
47 const long yatishFrame::idFileDownload = wxNewId();
48 const long yatishFrame::idFileQuit = wxNewId();
49 const long yatishFrame::idEditActivity = wxNewId();
50 const long yatishFrame::idEditTable = wxNewId();
51 const long yatishFrame::idEditChart = wxNewId();
52 const long yatishFrame::idEditNew = wxNewId();
53 const long yatishFrame::idEditReset = wxNewId();
54 const long yatishFrame::idEditSettings = wxNewId();
55 const long yatishFrame::idTimeToday = wxNewId();
56 const long yatishFrame::idTimeThisweek = wxNewId();
57 const long yatishFrame::idTimeThismonth = wxNewId();
58 const long yatishFrame::idTimeThisyear = wxNewId();
59 const long yatishFrame::idTimeYesterday = wxNewId();
60 const long yatishFrame::idTimeLastweek = wxNewId();
61 const long yatishFrame::idTimeLastmonth = wxNewId();
62 const long yatishFrame::idTimeLastyear = wxNewId();
63 const long yatishFrame::idHelpUser = wxNewId();
64 const long yatishFrame::idHelpAbout = wxNewId();
65 const long yatishFrame::idStatusBar = wxNewId();
66 const long yatishFrame::idTimer = wxNewId();
67 //*)
68 
69 const long yatishFrame::idListActivityRecord = wxNewId();
70 const long yatishFrame::idListActivityListTimeslot = wxNewId();
71 
72 BEGIN_EVENT_TABLE (yatishFrame, wxFrame)
73  //(*EventTable(yatishFrame)
74  //*)
75  EVT_MENU(idListActivityRecord, yatishFrame::OnListActivityRecord)
76  EVT_MENU(idListActivityListTimeslot, yatishFrame::OnListActivityListTimeslot)
77  EVT_UPDATE_UI(idEditActivity, yatishFrame::OnMenuitemEditActivityUpdate)
78  EVT_UPDATE_UI(idEditTable, yatishFrame::OnMenuitemEditTableUpdate)
79  EVT_UPDATE_UI(idEditChart, yatishFrame::OnMenuitemEditChartUpdate)
80  EVT_UPDATE_UI(idEditNew, yatishFrame::OnMenuitemEditNewUpdate)
81  EVT_UPDATE_UI(idEditReset, yatishFrame::OnMenuitemEditResetUpdate)
82  EVT_UPDATE_UI_RANGE(idTimeToday, idTimeLastyear, yatishFrame::OnMenuitemTimeTodayUpdate)
83  EVT_UPDATE_UI(idChoiceAggregate, yatishFrame::OnChoiceAggregateUpdate)
84  EVT_UPDATE_UI(idChoiceCluster, yatishFrame::OnChoiceClusterUpdate)
85 END_EVENT_TABLE()
86 
87 yatishFrame::yatishFrame (wxWindow * parent, wxWindowID id) {
88  //(*Initialize(yatishFrame)
89  wxBoxSizer* boxSizer2;
90  wxBoxSizer* boxSizer3;
91  wxBoxSizer* boxSizer4;
92  wxBoxSizer* boxSizer5;
93  wxBoxSizer* boxSizer7;
94  wxMenu* menu1;
95  wxMenu* menu2;
96  wxMenu* menu3;
97  wxMenu* menu4;
98  wxMenuBar* menuBar;
99  wxMenuItem* menuitemEditActivity;
100  wxMenuItem* menuitemEditChart;
101  wxMenuItem* menuitemEditLastmonth;
102  wxMenuItem* menuitemEditLastweek;
103  wxMenuItem* menuitemEditLastyear;
104  wxMenuItem* menuitemEditNew;
105  wxMenuItem* menuitemEditReset;
106  wxMenuItem* menuitemEditSettings;
107  wxMenuItem* menuitemEditTable;
108  wxMenuItem* menuitemEditThismonth;
109  wxMenuItem* menuitemEditThisweek;
110  wxMenuItem* menuitemEditThisyear;
111  wxMenuItem* menuitemEditToday;
112  wxMenuItem* menuitemEditYesteday;
113  wxMenuItem* menuitemFileQuit;
114  wxMenuItem* menuitemHelpAbout;
115  wxMenuItem* menuitemHelpUser;
116  wxPanel* panelCurrent;
117  wxPanel* panelList;
118  wxStaticBoxSizer* staticBoxSizer1;
119  wxStaticBoxSizer* staticBoxSizer2;
120  wxStaticBoxSizer* staticBoxSizer3;
121  wxStaticBoxSizer* staticBoxSizer4;
122  wxStaticBoxSizer* staticBoxSizer5;
123 
124  Create(parent, wxID_ANY, _("YATiSh"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
125  boxSizer1 = new wxBoxSizer(wxVERTICAL);
126  notebook = new wxNotebook(this, idNotebook, wxDefaultPosition, wxDefaultSize, 0, _T("idNotebook"));
127  panelCurrent = new wxPanel(notebook, idPanelCurrent, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelCurrent"));
128  boxSizer2 = new wxBoxSizer(wxVERTICAL);
129  boxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
130  staticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, panelCurrent, _("Select project, task and tool"));
131  choiceProject = new wxChoice(panelCurrent, idChoiceProject, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceProject"));
132  staticBoxSizer1->Add(choiceProject, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
133  choiceTask = new wxChoice(panelCurrent, idChoiceTask, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTask"));
134  staticBoxSizer1->Add(choiceTask, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
135  choiceTool = new wxChoice(panelCurrent, idChoiceTool, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTool"));
136  staticBoxSizer1->Add(choiceTool, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
137  boxSizer2->Add(staticBoxSizer1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
138  boxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
139  boxSizer3 = new wxBoxSizer(wxHORIZONTAL);
140  buttonStart = new wxButton(panelCurrent, idButtonStart, _("&RECORD"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonStart"));
141  boxSizer3->Add(buttonStart, 1, wxALL|wxEXPAND, 5);
142  buttonStop = new wxButton(panelCurrent, idButtonStop, _("&STOP"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonStop"));
143  boxSizer3->Add(buttonStop, 1, wxALL|wxEXPAND, 5);
144  boxSizer2->Add(boxSizer3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
145  boxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
146  panelCurrent->SetSizer(boxSizer2);
147  boxSizer2->Fit(panelCurrent);
148  boxSizer2->SetSizeHints(panelCurrent);
149  panelList = new wxPanel(notebook, idPanelList, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelList"));
150  boxSizer4 = new wxBoxSizer(wxVERTICAL);
151  boxSizer5 = new wxBoxSizer(wxHORIZONTAL);
152  staticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, panelList, _("Table"));
153  choiceTable = new wxChoice(panelList, idChoiceTable, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceTable"));
154  choiceTable->Append(_("Client"));
155  choiceTable->Append(_("Task"));
156  choiceTable->Append(_("Tool"));
157  choiceTable->Append(_("Project"));
158  choiceTable->Append(_("Activity"));
159  choiceTable->SetSelection( choiceTable->Append(_("Timeslot")) );
160  staticBoxSizer2->Add(choiceTable, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
161  boxSizer5->Add(staticBoxSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
162  staticBoxSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, panelList, _("Date interval (inclusive)"));
163  datePicker1 = new wxDatePickerCtrl(panelList, idDatePicker1, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker1"));
164  staticBoxSizer3->Add(datePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
165  datePicker2 = new wxDatePickerCtrl(panelList, idDatePicker2, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker2"));
166  staticBoxSizer3->Add(datePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
167  boxSizer5->Add(staticBoxSizer3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
168  boxSizer5->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
169  buttonPDF = new wxButton(panelList, idButtonPDF, _("E&xport PDF"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("idButtonPDF"));
170  boxSizer5->Add(buttonPDF, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
171  boxSizer4->Add(boxSizer5, 0, wxALL|wxEXPAND, 5);
172  listCtrl = new wxListCtrl(panelList, idListCtrl, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL, wxDefaultValidator, _T("idListCtrl"));
173  boxSizer4->Add(listCtrl, 1, wxALL|wxEXPAND, 5);
174  panelList->SetSizer(boxSizer4);
175  boxSizer4->Fit(panelList);
176  boxSizer4->SetSizeHints(panelList);
177  panelChart = new wxPanel(notebook, idPanelChart, wxDefaultPosition, wxDefaultSize, 0, _T("idPanelChart"));
178  boxSizer6 = new wxBoxSizer(wxVERTICAL);
179  boxSizer7 = new wxBoxSizer(wxHORIZONTAL);
180  staticBoxSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, panelChart, _("Chart type | Temporal aggregation"));
181  choiceChart = new wxChoice(panelChart, idChoiceChart, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceChart"));
182  choiceChart->SetSelection( choiceChart->Append(_("Time series")) );
183  choiceChart->Append(_("Pie chart"));
184  staticBoxSizer4->Add(choiceChart, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
185  choiceAggregate = new wxChoice(panelChart, idChoiceAggregate, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceAggregate"));
186  choiceAggregate->SetSelection( choiceAggregate->Append(_("Hours (total)")) );
187  choiceAggregate->Append(_("Days (worked)"));
188  choiceAggregate->Append(_("Hours/day (max)"));
189  choiceAggregate->Append(_("Time range (max)"));
190  choiceAggregate->Append(_("Minutes/timeslot (average)"));
191  staticBoxSizer4->Add(choiceAggregate, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
192  boxSizer7->Add(staticBoxSizer4, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
193  staticBoxSizer5 = new wxStaticBoxSizer(wxHORIZONTAL, panelChart, _("Data clustering | Date interval"));
194  choiceCluster = new wxChoice(panelChart, idChoiceCluster, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("idChoiceCluster"));
195  choiceCluster->Append(_("Clients"));
196  choiceCluster->Append(_("Projects"));
197  choiceCluster->Append(_("Tasks"));
198  choiceCluster->Append(_("Tools"));
199  choiceCluster->SetSelection( choiceCluster->Append(_("None")) );
200  staticBoxSizer5->Add(choiceCluster, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
201  datePicker3 = new wxDatePickerCtrl(panelChart, idDatePicker3, wxDefaultDateTime, wxPoint(-1,-1), wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker3"));
202  staticBoxSizer5->Add(datePicker3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
203  datePicker4 = new wxDatePickerCtrl(panelChart, idDatePicker4, wxDefaultDateTime, wxPoint(-1,-1), wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T("idDatePicker4"));
204  staticBoxSizer5->Add(datePicker4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
205  boxSizer7->Add(staticBoxSizer5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
206  boxSizer6->Add(boxSizer7, 0, wxALL|wxEXPAND, 5);
207  panelChart->SetSizer(boxSizer6);
208  boxSizer6->Fit(panelChart);
209  boxSizer6->SetSizeHints(panelChart);
210  notebook->AddPage(panelCurrent, _("Current activity"), false);
211  notebook->AddPage(panelList, _("List/Edit"), false);
212  notebook->AddPage(panelChart, _("Charts"), false);
213  boxSizer1->Add(notebook, 3, wxALL|wxEXPAND, 0);
214  textCtrl = new wxTextCtrl(this, idTextCtrl, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY, wxDefaultValidator, _T("idTextCtrl"));
215  boxSizer1->Add(textCtrl, 1, wxALL|wxEXPAND, 5);
216  SetSizer(boxSizer1);
217  menuBar = new wxMenuBar();
218  menu1 = new wxMenu();
219  menuitemFileConnect = new wxMenuItem(menu1, idFileConnect, _("&Connect\tCtrl-C"), _("Connect to a (remote) MySQL/MariaDB server"), wxITEM_NORMAL);
220  menu1->Append(menuitemFileConnect);
221  menuitemFileUpdate = new wxMenuItem(menu1, idFileUpdate, _("&Update\tCtrl-U"), _("Update remote database"), wxITEM_NORMAL);
222  menu1->Append(menuitemFileUpdate);
223  menuitemFileUpdate->Enable(false);
224  menuitemFileUpload = new wxMenuItem(menu1, idFileUpload, _("Up&load"), _("Replace remote data (by local)"), wxITEM_NORMAL);
225  menu1->Append(menuitemFileUpload);
226  menuitemFileUpload->Enable(false);
227  menuitemFileDownload = new wxMenuItem(menu1, idFileDownload, _("&Download"), _("Replace local data (by remote)"), wxITEM_NORMAL);
228  menu1->Append(menuitemFileDownload);
229  menuitemFileDownload->Enable(false);
230  menu1->AppendSeparator();
231  menuitemFileQuit = new wxMenuItem(menu1, idFileQuit, _("&Quit\tCtrl-Q"), wxEmptyString, wxITEM_NORMAL);
232  menu1->Append(menuitemFileQuit);
233  menuBar->Append(menu1, _("&File"));
234  menu2 = new wxMenu();
235  menuitemEditActivity = new wxMenuItem(menu2, idEditActivity, _("&Activity\tCtrl-A"), _("Start/stop current activity"), wxITEM_NORMAL);
236  menu2->Append(menuitemEditActivity);
237  menuitemEditTable = new wxMenuItem(menu2, idEditTable, _("&Tables\tCtrl-T"), _("Edit any table"), wxITEM_NORMAL);
238  menu2->Append(menuitemEditTable);
239  menuitemEditChart = new wxMenuItem(menu2, idEditChart, _("&Charts\tCtrl-G"), _("Look at various charts"), wxITEM_NORMAL);
240  menu2->Append(menuitemEditChart);
241  menu2->AppendSeparator();
242  menuitemEditNew = new wxMenuItem(menu2, idEditNew, _("&New record...\tCtrl-N"), _("Add a record to the currently selected table"), wxITEM_NORMAL);
243  menu2->Append(menuitemEditNew);
244  menuitemEditReset = new wxMenuItem(menu2, idEditReset, _("&Reset filter\tCtrl-R"), _("Reset the viewing filter"), wxITEM_NORMAL);
245  menu2->Append(menuitemEditReset);
246  menu2->AppendSeparator();
247  menuitemEditSettings = new wxMenuItem(menu2, idEditSettings, _("&Settings...\tCtrl-S"), _("Set user preferences"), wxITEM_NORMAL);
248  menu2->Append(menuitemEditSettings);
249  menuBar->Append(menu2, _("&Edit"));
250  menu3 = new wxMenu();
251  menuitemEditToday = new wxMenuItem(menu3, idTimeToday, _("Today"), _("Time interval to show: today"), wxITEM_NORMAL);
252  menu3->Append(menuitemEditToday);
253  menuitemEditThisweek = new wxMenuItem(menu3, idTimeThisweek, _("This week"), _("Time interval to show: this week"), wxITEM_NORMAL);
254  menu3->Append(menuitemEditThisweek);
255  menuitemEditThismonth = new wxMenuItem(menu3, idTimeThismonth, _("This month"), _("Time interval to show: this month"), wxITEM_NORMAL);
256  menu3->Append(menuitemEditThismonth);
257  menuitemEditThisyear = new wxMenuItem(menu3, idTimeThisyear, _("This year"), _("Time interval to show: this year"), wxITEM_NORMAL);
258  menu3->Append(menuitemEditThisyear);
259  menu3->AppendSeparator();
260  menuitemEditYesteday = new wxMenuItem(menu3, idTimeYesterday, _("Yesterday"), _("Time interval to show: yesterday"), wxITEM_NORMAL);
261  menu3->Append(menuitemEditYesteday);
262  menuitemEditLastweek = new wxMenuItem(menu3, idTimeLastweek, _("Last week"), _("Time interval to show: last week"), wxITEM_NORMAL);
263  menu3->Append(menuitemEditLastweek);
264  menuitemEditLastweek->Enable(false);
265  menuitemEditLastmonth = new wxMenuItem(menu3, idTimeLastmonth, _("Last month"), _("Time interval to show: last month"), wxITEM_NORMAL);
266  menu3->Append(menuitemEditLastmonth);
267  menuitemEditLastyear = new wxMenuItem(menu3, idTimeLastyear, _("Last year"), _("Time interval to show: last year"), wxITEM_NORMAL);
268  menu3->Append(menuitemEditLastyear);
269  menuBar->Append(menu3, _("&Time"));
270  menu4 = new wxMenu();
271  menuitemHelpUser = new wxMenuItem(menu4, idHelpUser, _("&User guide\tF1"), wxEmptyString, wxITEM_NORMAL);
272  menu4->Append(menuitemHelpUser);
273  menuitemHelpAbout = new wxMenuItem(menu4, idHelpAbout, _("&About..."), wxEmptyString, wxITEM_NORMAL);
274  menu4->Append(menuitemHelpAbout);
275  menuBar->Append(menu4, _("&Help"));
276  SetMenuBar(menuBar);
277  statusBar = new wxStatusBar(this, idStatusBar, 0, _T("idStatusBar"));
278  int __wxStatusBarWidths_1[3] = { 65, 85, -1 };
279  int __wxStatusBarStyles_1[3] = { wxSB_RAISED, wxSB_RAISED, wxSB_NORMAL };
280  statusBar->SetFieldsCount(3,__wxStatusBarWidths_1);
281  statusBar->SetStatusStyles(3,__wxStatusBarStyles_1);
282  SetStatusBar(statusBar);
283  timer.SetOwner(this, idTimer);
284  boxSizer1->Fit(this);
285  boxSizer1->SetSizeHints(this);
286 
287  Connect(idButtonStart,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&yatishFrame::OnButtonStartClick);
288  Connect(idButtonStop,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&yatishFrame::OnButtonStopClick);
289  Connect(idChoiceTable,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&yatishFrame::OnChoiceTableSelect);
290  Connect(idDatePicker1,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker1Changed);
291  Connect(idDatePicker2,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker2Changed);
292  Connect(idButtonPDF,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&yatishFrame::OnButtonPDFClick);
293  Connect(idListCtrl,wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,(wxObjectEventFunction)&yatishFrame::OnListItemRightClick);
294  Connect(idListCtrl,wxEVT_COMMAND_LIST_KEY_DOWN,(wxObjectEventFunction)&yatishFrame::OnListKeyDown);
295  Connect(idListCtrl,wxEVT_COMMAND_LIST_COL_CLICK,(wxObjectEventFunction)&yatishFrame::OnListColumnClick);
296  Connect(idChoiceChart,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&yatishFrame::OnChoiceChartSelect);
297  Connect(idChoiceAggregate,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&yatishFrame::OnChoiceAggregateSelect);
298  Connect(idChoiceCluster,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&yatishFrame::OnChoiceClusterSelect);
299  Connect(idDatePicker3,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker3Changed);
300  Connect(idDatePicker4,wxEVT_DATE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnDatePicker4Changed);
301  Connect(idNotebook,wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&yatishFrame::OnNotebookPageChanged);
302  Connect(idFileConnect,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileConnectSelected);
303  Connect(idFileUpdate,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileUpdateSelected);
304  Connect(idFileUpload,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileUploadSelected);
305  Connect(idFileDownload,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemFileDownloadSelected);
306  Connect(idFileQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnQuit);
307  Connect(idEditActivity,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditActivitySelected);
308  Connect(idEditTable,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditTableSelected);
309  Connect(idEditChart,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditChartSelected);
310  Connect(idEditNew,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditNewSelected);
311  Connect(idEditReset,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditResetSelected);
312  Connect(idEditSettings,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemEditSettingsSelected);
313  Connect(idTimeToday,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeTodaySelected);
314  Connect(idTimeThisweek,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeThisweekSelected);
315  Connect(idTimeThismonth,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeThismonthSelected);
316  Connect(idTimeThisyear,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeThisyearSelected);
317  Connect(idTimeYesterday,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeYesterdaySelected);
318  Connect(idTimeLastweek,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeLastweekSelected);
319  Connect(idTimeLastmonth,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeLastmonthSelected);
320  Connect(idTimeLastyear,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnMenuitemTimeLastyearSelected);
321  Connect(idHelpUser,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnHelp);
322  Connect(idHelpAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&yatishFrame::OnAbout);
323  Connect(idTimer,wxEVT_TIMER,(wxObjectEventFunction)&yatishFrame::OnTimerTrigger);
324  Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&yatishFrame::OnClose);
325  //*)
326  datePicker1->Bind (wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu1, this);
327  datePicker2->Bind (wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu2, this);
328  datePicker3->Bind (wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu3, this);
329  datePicker4->Bind (wxEVT_CONTEXT_MENU, &yatishFrame::OnContextMenu4, this);
330  SetIcon ( wxIcon (yatish_xpm) ); // no effect in Ubuntu Jammy Jellyfish
331  help.Initialize (wxStandardPaths::Get().GetDataDir() + wxFILE_SEP_PATH + "yatish");
332  buttonStop->Disable(); clockStart = wxDateTime::Now();
333  UpdateClock(); UpdateStatus (mysql_off); SetStatusBarPane (2);
334  masterDB.SetLimit (settings.limitRow, settings.rowLimit);
335  if (settings.log2text)
336  defaultLog = wxLog::SetActiveTarget( new wxLogTextCtrl (textCtrl) );
337  else {
338  textCtrl->Hide(); boxSizer1->SetSizeHints (this);
339  }
340  ResetChoices(); ResetPickersT(); UpdateColumns();
341  SetStatusText (wxEmptyString, 2);
342  // take care of previously ill-terminated yatish jobs
343  switch ( masterDB.RunningTimeslots() ) {
344  case -1:
345  case 0:
346  break;
347  case 1:
348  Recording();
349  break;
350  default:
351  wxLogError (_("Several yatish were inappropriately terminated!") );
352  }
353  slaveDB = nullptr;
354  plot = nullptr;
355  selectedActivityID = 0l;
356  currentChartLib = wxMathPlot;
357  currentPlotType = timeSeries;
358 }
359 
361  wxDateTime now = wxDateTime::Now();
362  wxTimeSpan elapsed = now - clockStart;
363  SetStatusText ( elapsed.Format() );
364 }
365 
367  switch (status) {
368  case mysql_on:
369  SetStatusText ("MySQL ON", 1);
370  break;
371  case mysql_off:
372  SetStatusText ("MySQL OFF", 1);
373  break;
374  default:
375  SetStatusText ("MySQL ERR", 1);
376  }
377 }
378 
380  bool choiceOK;
382  choiceOK = masterDB.FillChoice (choiceTask, task_tid);
383  choiceOK = masterDB.FillChoice (choiceTool, tool_tid);
384  if (!choiceOK) wxLogError ("Reset of choices failed for panel #1");
385  if ( choiceProject->IsEmpty() || choiceTask->IsEmpty() || choiceTool->IsEmpty() )
386  buttonStart->Disable(); // in case the database is not populated yet
387  else
388  buttonStart->Enable ( !buttonStop->IsEnabled() );
389  long lastActivityID = masterDB.LastActivity();
390  if (lastActivityID == wxNOT_FOUND) {
391  choiceProject->SetSelection (0);
392  choiceTask ->SetSelection (0);
393  choiceTool ->SetSelection (0);
394  } else {
395  choiceProject->SetSelection (masterDB.ChoiceSelector (project_tid, lastActivityID) );
396  choiceTask ->SetSelection (masterDB.ChoiceSelector (task_tid, lastActivityID) );
397  choiceTool ->SetSelection (masterDB.ChoiceSelector (tool_tid, lastActivityID) );
398  }
399 }
400 
402  listCtrl->DeleteAllColumns();
403  // Now we rely on the fact that choiceTable was initialized
404  // in the same order as tableID is defined:
405  tableID tid = (tableID) choiceTable->GetSelection();
406  // (same assumption each time we will use the trick).
407  switch (tid) {
408  case timeslot_tid:
409  listCtrl->AppendColumn(_("Date") );
410  listCtrl->AppendColumn(_("Duration") );
411  listCtrl->AppendColumn(_("Project") );
412  listCtrl->AppendColumn(_("Client") );
413  listCtrl->AppendColumn(_("Task") );
414  listCtrl->AppendColumn(_("Tool") );
415  break;
416  case activity_tid:
417  listCtrl->AppendColumn(_("Project") );
418  listCtrl->AppendColumn(_("Client") );
419  listCtrl->AppendColumn(_("Task") );
420  listCtrl->AppendColumn(_("Tool") );
421  break;
422  case project_tid:
423  listCtrl->AppendColumn(_("Name") );
424  listCtrl->AppendColumn(_("Client") );
425  break;
426  default:
427  listCtrl->AppendColumn(_("Name") );
428  }
429  UpdateRows (tid);
430 }
431 
433  listCtrl->Freeze(); // or Hide()...
434  listCtrl->DeleteAllItems();
435  if ( !masterDB.FillList (listCtrl, tid) )
436  wxLogError ("Updating listCrl failed (panel #2)");
437  for (int col = 0; col < listCtrl->GetColumnCount(); col++)
438  listCtrl->SetColumnWidth (col, wxLIST_AUTOSIZE_USEHEADER);
439  listCtrl->Thaw(); // or Show()...
440  SetStatusText (masterDB.FilteredTotalFormatted(), 2);
441 }
442 
445  wxDateTime first = masterDB.First(), last = masterDB.Last();
446  datePicker1->SetValue (first);
447  datePicker2->SetValue (last );
448  masterDB.SetFirstDay (first);
449  masterDB.SetLastDay (last );
450 }
453  wxDateTime first = masterDB.First(), last = masterDB.Last();
454  datePicker3->SetValue (first);
455  datePicker4->SetValue (last );
456  plot->SetFirstDay (first);
457  plot->SetLastDay (last );
458 }
459 
461  if (plot) {
462  if (settings.lib == currentChartLib && choiceChart->GetSelection() == currentPlotType)
463  return;
464  else {
465  boxSizer6->GetItem (1) ->DeleteWindows();
466  boxSizer6->Detach (1);
467  boxSizer6->Layout();
468  }
469  }
470  if (settings.lib == wxMathPlot) {
471  choiceChart->SetSelection (timeSeries);
475  } else if (settings.lib == wxFreeChart) {
476  if (choiceChart->GetSelection() == timeSeries) {
479  } else {
482  }
484  } else { //settings.lib == wxCharts
485  if (choiceChart->GetSelection() == timeSeries) {
488  } else {
491  }
493  }
494  ResetPickersG();
495  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
496  (AggregateType)choiceAggregate->GetSelection() );
497  boxSizer6->Add (dynamic_cast <wxWindow *> (plot), 1, wxALL|wxEXPAND, 5);
498  boxSizer6->Layout();
499  boxSizer1->SetSizeHints (this);
501  SetStatusText (plot->TotalFormatted(), 2);
502 }
503 
505  bool b = menuitemFileConnect->IsEnabled();
506  menuitemFileConnect ->Enable (!b);
507  menuitemFileUpdate ->Enable ( b);
508  menuitemFileUpload ->Enable ( b);
509  menuitemFileDownload->Enable ( b);
510 }
511 
513  if (settings.log2text) {
514  defaultLog = wxLog::SetActiveTarget( new wxLogTextCtrl (textCtrl) );
515  textCtrl->Show(); boxSizer1->SetSizeHints (this);
516  } else {
517  delete wxLog::SetActiveTarget (defaultLog);
518  textCtrl->Hide(); boxSizer1->SetSizeHints (this);
519  }
520 }
521 
522 /********
523  Handlers
524  ********/
525 
526 void yatishFrame::OnQuit (wxCommandEvent& event) {
527  Close();
528 }
529 
530 void yatishFrame::OnClose (wxCloseEvent& event) {
531  if ( help.GetFrame() ) help.GetFrame()->Close (true);
532  if (settings.log2text) delete wxLog::SetActiveTarget (defaultLog);
533  delete slaveDB;
534  delete plot;
535  Destroy();
536 }
537 
538 void yatishFrame::OnTimerTrigger (wxTimerEvent& event) {
539  UpdateClock();
540 }
541 
542 void yatishFrame::OnNotebookPageChanged (wxNotebookEvent& event) {
543  switch ( event.GetSelection() ) {
544  case 0:
545  SetStatusText (wxEmptyString, 2);
546  ResetChoices();
547  break;
548  case 1:
549  ResetPickersT();
550  UpdateRows ( (tableID) choiceTable->GetSelection() );
551  break;
552  case 2:
553  NewPlot();
554  }
555 }
556 
557 /*************
558  Menu handlers
559  *************/
560 
561 void yatishFrame::OnMenuitemFileConnectSelected (wxCommandEvent& event) {
562  delete slaveDB;
563  slaveDB = new yatishDBmysql;
564  if ( slaveDB->IsOk() ) {
565  ToggleConnect();
567  } else
569 }
570 
571 void yatishFrame::OnMenuitemFileUpdateSelected (wxCommandEvent& event) {
572  if ( buttonStop->IsEnabled() ) {
573  wxMessageBox (_("Please stop the current activity"),
574  _("Update refused"), wxOK);
575  return;
576  }
577  int err = slaveDB->Commit();
578  if (err == 2006 || err == 2013) {
579  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
581  ToggleConnect();
582  } else
583  wxMessageBox (_("done."), _("Database update:"), wxOK);
584 }
585 
586 void yatishFrame::OnMenuitemFileUploadSelected (wxCommandEvent& event) {
587  if ( wxMessageBox ( _("Remote data (if any) will be\noverwritten by local ones."),
588  _("Are you sure?"),
589  wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
590  == wxCANCEL ) return;
591  SetStatusText (_("Please wait, working..."), 2);
592  int err = slaveDB->Upload();
593  SetStatusText (wxEmptyString, 2);
594  if (err == 2006 || err == 2013) {
595  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
597  ToggleConnect();
598  } else
599  wxMessageBox (_("done."), _("Database upload:"), wxOK);
600 }
601 
603 void yatishFrame::OnMenuitemFileDownloadSelected (wxCommandEvent& event) {
604  if ( wxMessageBox ( _("Local data (if any) will be\noverwritten by remote ones."),
605  _("Are you sure?"),
606  wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
607  == wxCANCEL ) return;
608  wxBusyCursor wait; // Ubuntu: didn't work before Jammy Jellyfish
609  // (but the cursor is static until Download() has finished, and is reset when moving out of the window)
610  SetStatusText (_("Please wait, working..."), 2); // applied _after_ Download() in Ubuntu Jammy Jellyfish...
611  int err = slaveDB->Download();
612  SetStatusText (wxEmptyString, 2); // ...thus the message above is never seen!
613  if (err == 2006 || err == 2013) {
614  wxLogMessage (_("MySQL connection timed out: try to reconnect...") );
616  ToggleConnect();
617  } else {
618  wxMessageBox (_("done."), _("Database download:"), wxOK);
619  int page = notebook->GetSelection();
620  if (page == 0) ResetChoices();
621  if (page == 1) {
622  ResetPickersT();
623  UpdateRows ( (tableID) choiceTable->GetSelection() );
624  }
625  }
626 }
627 
628 void yatishFrame::OnMenuitemEditActivitySelected (wxCommandEvent& event) {
629  notebook->SetSelection (0);
630 }
631 void yatishFrame::OnMenuitemEditActivityUpdate (wxUpdateUIEvent& event) {
632  event.Enable (notebook->GetSelection() != 0);
633 }
634 void yatishFrame::OnMenuitemEditTableSelected (wxCommandEvent& event) {
635  notebook->SetSelection (1);
636 }
637 void yatishFrame::OnMenuitemEditTableUpdate (wxUpdateUIEvent& event) {
638  event.Enable (notebook->GetSelection() != 1);
639 }
640 void yatishFrame::OnMenuitemEditChartSelected (wxCommandEvent& event) {
641  notebook->SetSelection (2);
642 }
643 void yatishFrame::OnMenuitemEditChartUpdate (wxUpdateUIEvent& event) {
644  event.Enable (notebook->GetSelection() != 2);
645 }
646 
647 void yatishFrame::OnMenuitemEditNewSelected (wxCommandEvent& event) {
648  int dlgEnd = wxID_CANCEL;
649  tableID tid = (tableID) choiceTable->GetSelection();
650  if (tid == client_tid || tid == task_tid || tid == tool_tid) {
651  yatishDlgName dlg (&masterDB, tid);
652  dlgEnd = dlg.ShowModal();
653  } else if (tid == project_tid) {
654  yatishDlgProject dlg (&masterDB);
655  dlgEnd = dlg.ShowModal();
656  } else if (tid == activity_tid) {
658  dlgEnd = dlg.ShowModal();
659  } else { // tid == timeslot_tid
661  dlgEnd = dlg.ShowModal();
662  }
663  if (dlgEnd != wxID_CANCEL) {
664  datePicker2->SetValue ( masterDB.Last() );
665  masterDB.SetLastDay ( datePicker2->GetValue() );
666  UpdateRows (tid);
667  }
668 }
669 
670 void yatishFrame::OnMenuitemEditNewUpdate (wxUpdateUIEvent& event) {
671  event.Enable (notebook->GetSelection() == 1);
672 }
673 
674 void yatishFrame::OnMenuitemEditResetSelected (wxCommandEvent& event) {
675  if (notebook->GetSelection() == 1) {
676  ResetPickersT();
677  UpdateRows ( (tableID) choiceTable->GetSelection() );
678  } else {
679  ResetPickersG();
680  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
681  (AggregateType)choiceAggregate->GetSelection() );
683  SetStatusText (plot->TotalFormatted(), 2);
684  }
685 }
686 
687 void yatishFrame::OnMenuitemEditResetUpdate (wxUpdateUIEvent& event) {
688  bool filterTavailable = (notebook->GetSelection() == 1);
689  if (filterTavailable) {
690  tableID tid = (tableID) choiceTable->GetSelection();
691  filterTavailable = filterTavailable && ( tid == project_tid || tid == activity_tid || tid == timeslot_tid );
692  }
693  event.Enable (filterTavailable || notebook->GetSelection() == 2);
694 }
695 
696 void yatishFrame::OnMenuitemTimeTodayUpdate (wxUpdateUIEvent& event) {
697  tableID tid = (tableID) choiceTable->GetSelection();
698  event.Enable ( (notebook->GetSelection() == 1 && tid == timeslot_tid) || notebook->GetSelection() == 2 );
699 }
700 
701 void yatishFrame::OnMenuitemTimeTodaySelected (wxCommandEvent& event) {
702  wxDateTime dt = wxDateTime::Today();
703  datePicker2->SetValue (dt);
704  datePicker1->SetValue (dt);
705  masterDB.SetFirstDay ( datePicker1->GetValue() );
706  masterDB.SetLastDay ( datePicker2->GetValue() );
708 }
709 void yatishFrame::OnMenuitemTimeThisweekSelected (wxCommandEvent& event) {
710  wxDateTime dt = wxDateTime::Today();
711  datePicker2->SetValue (dt);
712  dt.SetToPrevWeekDay (wxDateTime::Mon);
713  datePicker1->SetValue (dt);
714  masterDB.SetFirstDay ( datePicker1->GetValue() );
715  masterDB.SetLastDay ( datePicker2->GetValue() );
717 }
718 void yatishFrame::OnMenuitemTimeThismonthSelected (wxCommandEvent& event) {
719  wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
720  dt1.SetDay (1);
721  if (notebook->GetSelection() == 1) {
722  datePicker2->SetValue (dt2);
723  datePicker1->SetValue (dt1);
724  masterDB.SetFirstDay ( datePicker1->GetValue() );
725  masterDB.SetLastDay ( datePicker2->GetValue() );
727  } else {
728  datePicker4->SetValue (dt2);
729  datePicker3->SetValue (dt1);
730  plot->SetFirstDay ( datePicker3->GetValue() );
731  plot->SetLastDay ( datePicker4->GetValue() );
732  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
733  (AggregateType)choiceAggregate->GetSelection() );
735  SetStatusText (plot->TotalFormatted(), 2);
736  }
737 }
738 void yatishFrame::OnMenuitemTimeThisyearSelected (wxCommandEvent& event) {
739  wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
740  dt1.SetMonth (wxDateTime::Jan); dt1.SetDay (1);
741  if (notebook->GetSelection() == 1) {
742  datePicker2->SetValue (dt2);
743  datePicker1->SetValue (dt1);
744  masterDB.SetFirstDay ( datePicker1->GetValue() );
745  masterDB.SetLastDay ( datePicker2->GetValue() );
747  } else {
748  datePicker4->SetValue (dt2);
749  datePicker3->SetValue (dt1);
750  plot->SetFirstDay ( datePicker3->GetValue() );
751  plot->SetLastDay ( datePicker4->GetValue() );
752  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
753  (AggregateType)choiceAggregate->GetSelection() );
755  SetStatusText (plot->TotalFormatted(), 2);
756  }
757 }
758 
759 void yatishFrame::OnMenuitemTimeYesterdaySelected (wxCommandEvent& event) {
760  wxDateTime dt = wxDateTime::Today();
761  dt -= wxDateSpan::Day();
762  datePicker2->SetValue (dt);
763  datePicker1->SetValue (dt);
764  masterDB.SetFirstDay ( datePicker1->GetValue() );
765  masterDB.SetLastDay ( datePicker2->GetValue() );
767 }
768 void yatishFrame::OnMenuitemTimeLastweekSelected (wxCommandEvent& event) {
769  wxDateTime dt = wxDateTime::Today();
770  dt -= wxDateSpan::Week();
771  dt.SetToNextWeekDay (wxDateTime::Sun);
772  datePicker2->SetValue (dt);
773  dt.SetToPrevWeekDay (wxDateTime::Mon);
774  datePicker1->SetValue (dt);
775  masterDB.SetFirstDay ( datePicker1->GetValue() );
776  masterDB.SetLastDay ( datePicker2->GetValue() );
778 }
779 void yatishFrame::OnMenuitemTimeLastmonthSelected (wxCommandEvent& event) {
780  wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
781  dt1 -= wxDateSpan::Month(); dt1.SetDay (1);
782  dt2 -= wxDateSpan::Month(); dt2.SetToLastMonthDay();
783  if (notebook->GetSelection() == 1) {
784  datePicker2->SetValue (dt2);
785  datePicker1->SetValue (dt1);
786  masterDB.SetFirstDay ( datePicker1->GetValue() );
787  masterDB.SetLastDay ( datePicker2->GetValue() );
789  } else {
790  datePicker4->SetValue (dt2);
791  datePicker3->SetValue (dt1);
792  plot->SetFirstDay ( datePicker3->GetValue() );
793  plot->SetLastDay ( datePicker4->GetValue() );
794  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
795  (AggregateType)choiceAggregate->GetSelection() );
797  SetStatusText (plot->TotalFormatted(), 2);
798  }
799 }
800 void yatishFrame::OnMenuitemTimeLastyearSelected (wxCommandEvent& event) {
801  wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
802  dt1 -= wxDateSpan::Year(); dt1.SetMonth (wxDateTime::Jan); dt1.SetDay (1);
803  dt2 -= wxDateSpan::Year(); dt2.SetMonth (wxDateTime::Dec); dt2.SetToLastMonthDay();
804  if (notebook->GetSelection() == 1) {
805  datePicker2->SetValue (dt2);
806  datePicker1->SetValue (dt1);
807  masterDB.SetFirstDay ( datePicker1->GetValue() );
808  masterDB.SetLastDay ( datePicker2->GetValue() );
810  } else {
811  datePicker4->SetValue (dt2);
812  datePicker3->SetValue (dt1);
813  plot->SetFirstDay ( datePicker3->GetValue() );
814  plot->SetLastDay ( datePicker4->GetValue() );
815  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
816  (AggregateType)choiceAggregate->GetSelection() );
818  SetStatusText (plot->TotalFormatted(), 2);
819  }
820 }
821 
822 void yatishFrame::OnContextMenu1 (wxContextMenuEvent& event) {
823  wxMenu menu;
824  menu.Append ( idTimeToday, _("Today"), _("Time interval to show: today") );
825  menu.Append ( idTimeThisweek, _("This week"), _("Time interval to show: this week") );
826  menu.Append ( idTimeThismonth, _("This month"), _("Time interval to show: this month") );
827  PopupMenu (&menu);
828 }
829 void yatishFrame::OnContextMenu3 (wxContextMenuEvent& event) {
830  wxMenu menu;
831  menu.Append ( idTimeThismonth, _("This month"), _("Time interval to show: this month") );
832  menu.Append ( idTimeThisyear, _("This year"), _("Time interval to show: this year") );
833  PopupMenu (&menu);
834 }
835 
836 void yatishFrame::OnContextMenu2 (wxContextMenuEvent& event) {
837  wxMenu menu;
838  menu.Append ( idTimeYesterday, _("Yesterday"), _("Time interval to show: yesterday") );
839  menu.Append ( idTimeLastweek, _("Last week"), _("Time interval to show: last week") );
840  menu.Append ( idTimeLastmonth, _("Last month"), _("Time interval to show: last month") );
841  PopupMenu (&menu);
842 }
843 void yatishFrame::OnContextMenu4 (wxContextMenuEvent& event) {
844  wxMenu menu;
845  menu.Append ( idTimeLastmonth, _("Last month"), _("Time interval to show: last month") );
846  menu.Append ( idTimeLastyear, _("Last year"), _("Time interval to show: last year") );
847  PopupMenu (&menu);
848 }
849 
850 void yatishFrame::OnMenuitemEditSettingsSelected (wxCommandEvent& event) {
851  yatishSettings dlg;
852  dlg.Set (settings);
853  if (dlg.ShowModal() == wxID_CANCEL) return;
854  bool oldLog = settings.log2text;
855  dlg.Get (settings);
856  if (settings.log2text != oldLog) ToggleLog();
858  tableID tid = (tableID) choiceTable->GetSelection();
859  if (notebook->GetSelection() == 1) UpdateRows (tid);
860  if (notebook->GetSelection() == 2) NewPlot();
861 }
862 
863 void yatishFrame::OnHelp (wxCommandEvent& event) {
864  help.DisplayContents();
865 }
866 
867 void yatishFrame::OnAbout (wxCommandEvent& event) {
868  wxAboutDialogInfo info;
869  info.SetName ("Yatish");
870  info.SetVersion ("V0.4");
871  wxString what (_("Yet Another TIme SHeet\n"
872  "Time tracking for freelancers/homeworkers\n\n"
873  "Built with:\n") );
874  what << wxVERSION_STRING;
875  what << "\nCode::Blocks\twxSmith\nwxDatabase\twxPdfDocument\nwxMathPlot\twxFreeChart\twxCharts";
876  info.SetDescription (what);
877  info.SetCopyright ("(C) 2020-2023 EIF-services");
878  info.SetLicence ("This program is free software:\n"
879  "you can redistribute it and/or modify it\n"
880  "under the terms of the GNU General Public License\n"
881  "as published by the Free Software Foundation,\n"
882  "either version 3 of the License, or (at your option) any later version.\n"
883  "This program is distributed in the hope that it will be useful,\n"
884  "but WITHOUT ANY WARRANTY; without even the implied warranty\n"
885  "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
886  "See the GNU General Public License for more details.\n"
887  "You should have received a copy of the GNU General Public License\n"
888  "along with this program. If not, see https://www.gnu.org/licenses/");
889  info.SetWebSite("https://www.eif-services.eu/yatish");
890  wxString me (L"Nicolas P\u00E9renne <nicolas.perenne@eif-services.eu>");
891  info.AddDeveloper (me);
892  wxAboutBox (info, this);
893 }
894 
895 /****************
896  Control handlers
897  ****************/
898 
899 void yatishFrame::OnButtonStartClick (wxCommandEvent& event) {
900  if ( !masterDB.StartTimeslot ( choiceProject->GetSelection(),
901  choiceTask->GetSelection(),
902  choiceTool->GetSelection() ) ) {
903  wxLogError ("Timeslot could not be started");
904  return;
905  }
906  Recording();
907 }
908 
910  clockStart = wxDateTime::Now();
911  UpdateClock();
912  timer.Start (1000);
913  buttonStart->Disable();
914  buttonStop->Enable();
915  SetIcon ( wxIcon (yatish_recording_xpm) ); // no effect in Ubuntu Jammy Jellyfish
916 }
917 
918 void yatishFrame::OnButtonStopClick (wxCommandEvent& event) {
919  if ( !masterDB.StopTimeslot() ) {
920  wxLogError ("Timeslot could not be stopped");
921  return;
922  }
923  timer.Stop();
924  buttonStop->Disable();
925  buttonStart->Enable();
926  SetIcon ( wxIcon (yatish_xpm) ); // no effect in Ubuntu Jammy Jellyfish
927 }
928 
929 void yatishFrame::OnChoiceTableSelect (wxCommandEvent& event) {
931  if (event.GetSelection() == timeslot_tid) {
932  datePicker1->Enable();
933  datePicker2->Enable();
934  } else {
935  datePicker1->Disable();
936  datePicker2->Disable();
937  }
938  UpdateColumns();
939 }
940 
941 void yatishFrame::OnDatePicker1Changed (wxDateEvent& event) {
942  masterDB.SetFirstDay ( datePicker1->GetValue() );
944 }
945 void yatishFrame::OnDatePicker2Changed (wxDateEvent& event) {
946  masterDB.SetLastDay ( datePicker2->GetValue() );
948 }
949 
950 void yatishFrame::OnListColumnClick (wxListEvent& event) {
951  tableID tid = (tableID) choiceTable->GetSelection();
952  if (tid == client_tid || tid == task_tid || tid == tool_tid)
953  return;
954  int project_col = -1,
955  client_col = -1,
956  task_col = -1,
957  tool_col = -1;
958  if (tid == timeslot_tid) {
959  project_col = 2;
960  client_col = 3;
961  task_col = 4;
962  tool_col = 5;
963  }
964  if (tid == activity_tid) {
965  project_col = 0;
966  client_col = 1;
967  task_col = 2;
968  tool_col = 3;
969  }
970  if (tid == project_tid)
971  client_col = 1;
972  int col = event.GetColumn();
973  int ret = wxID_CANCEL;
974  if (col == project_col) {
976  ret = dlg.ShowModal();
977  }
978  if (col == client_col) {
980  ret = dlg.ShowModal();
981  }
982  if (col == task_col) {
984  ret = dlg.ShowModal();
985  }
986  if (col == tool_col) {
988  ret = dlg.ShowModal();
989  }
990  if (ret == wxID_OK) UpdateRows (tid);
991 }
992 
993 void yatishFrame::OnListKeyDown (wxListEvent& event) {
994  if ( !wxGetKeyState (WXK_SHIFT) ) {
995  event.Skip();
996  return;
997  }
998  tableID tid = (tableID) choiceTable->GetSelection();
999  long row_id = event.GetIndex(), sql_id = listCtrl->GetItemData (row_id);
1000  switch ( event.GetKeyCode() ) {
1001  case 'E':
1002  { int dlgEnd = wxID_CANCEL;
1003  if (tid == client_tid || tid == task_tid || tid == tool_tid) {
1004  yatishDlgName dlg (&masterDB, tid, sql_id);
1005  dlgEnd = dlg.ShowModal();
1006  } else if (tid == project_tid) {
1007  yatishDlgProject dlg (&masterDB, sql_id);
1008  dlgEnd = dlg.ShowModal();
1009  } else if (tid == activity_tid) {
1010  yatishDlgActivity dlg (&masterDB, sql_id);
1011  dlgEnd = dlg.ShowModal();
1012  } else { // tid == timeslot_tid
1013  if ( listCtrl->GetItemText (row_id, 1) .IsEmpty() ) {
1014  wxMessageBox (_("Won't edit the current activity\n(first close it)."),
1015  _("Change selection"), wxOK);
1016  } else {
1017  yatishDlgTimeslot dlg (&masterDB, sql_id);
1018  dlgEnd = dlg.ShowModal();
1019  }
1020  }
1021  if (dlgEnd != wxID_CANCEL) UpdateRows (tid); }
1022  break;
1023  case 'D':
1024  if ( wxMessageBox ( _("Deleting a record..."),
1025  _("Are you sure?"),
1026  wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
1027  == wxCANCEL ) break;
1028  if ( masterDB.Delete (tid, sql_id) ) UpdateRows (tid);
1029  break;
1030  default:
1031  event.Skip();
1032  }
1033 }
1034 
1035 void yatishFrame::OnListActivityRecord (wxCommandEvent& event) {
1036  wxASSERT (selectedActivityID);
1037  if ( buttonStop->IsEnabled() ) {
1038  wxMessageBox (_("Can't start a new activity\n(first close the current one)."),
1039  _("Stop current activity"), wxOK);
1040  return;
1041  }
1042  int projectChoice = masterDB.ChoiceSelector (project_tid, selectedActivityID),
1045  choiceProject->SetSelection (projectChoice);
1046  choiceTask ->SetSelection (taskChoice);
1047  choiceTool ->SetSelection (toolChoice);
1048  notebook->ChangeSelection (0);
1049  masterDB.StartTimeslot (projectChoice, taskChoice, toolChoice);
1050  Recording();
1051 }
1052 void yatishFrame::OnListActivityListTimeslot (wxCommandEvent& event) {
1053  wxASSERT (selectedActivityID);
1054  datePicker1->Enable(); datePicker2->Enable(); ResetPickersT();
1056  choiceTable->SetSelection (timeslot_tid);
1057  UpdateColumns();
1058 }
1059 void yatishFrame::OnListItemRightClick(wxListEvent& event) {
1060  if (choiceTable->GetSelection() != activity_tid) return;
1061  selectedActivityID = listCtrl->GetItemData ( event.GetIndex() );
1062  wxMenu menu;
1063  menu.Append ( idListActivityRecord, _("Record") );
1064  menu.Append ( idListActivityListTimeslot, _("List") );
1065  PopupMenu (&menu);
1066 }
1067 
1068 void yatishFrame::OnButtonPDFClick (wxCommandEvent& event) {
1069  wxFileDialog pdfDlg (this, _("Specify the PDF file to be written"),
1070  wxStandardPaths::Get().GetDocumentsDir(), "yatish.pdf",
1071  "PDF|*.pdf", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
1072  if (pdfDlg.ShowModal() == wxID_CANCEL) return;
1073  yatishPDF test ( settings, listCtrl, masterDB, pdfDlg.GetPath() );
1074 }
1075 
1076 /**************************
1077  Control handlers: panel #3
1078  **************************/
1079 
1080 void yatishFrame::OnChoiceChartSelect (wxCommandEvent& event) {
1081  PlotType plotType = (PlotType)event.GetSelection();
1082  if (currentChartLib == wxMathPlot && plotType == pieChart) {
1083  wxLogMessage (_("This plot is not provided by the current library.\n"
1084  "Choose another one in the Settings (Ctrl-P).") );
1085  choiceChart->SetSelection (timeSeries);
1086  return;
1087  }
1088  if (plotType == currentPlotType) return;
1089  if (choiceCluster->GetCount() == 5) { // we can't wait for OnChoiceClusterUpdate() to be called
1090  if (choiceCluster->GetSelection() == 4) choiceCluster->Select (projectClusters);
1091  choiceCluster->Delete (4);
1092  }
1093  NewPlot();
1094 }
1095 
1096 void yatishFrame::OnChoiceAggregateUpdate (wxUpdateUIEvent& event) {
1097  if (choiceChart->GetSelection() == pieChart || choiceCluster->GetSelection() != none) {
1098  choiceAggregate->SetSelection (hoursTotal);
1099  event.Enable (false);
1100  } else
1101  event.Enable (true);
1102 }
1103 void yatishFrame::OnChoiceAggregateSelect (wxCommandEvent& event) {
1104  plot->PlotData ( none, (AggregateType)event.GetSelection() );
1106 }
1107 
1108 void yatishFrame::OnChoiceClusterUpdate (wxUpdateUIEvent& event) {
1109  if (choiceCluster->GetCount() == 4 && choiceChart->GetSelection() == timeSeries)
1110  choiceCluster->Append (_("None") );
1111  if (choiceCluster->GetCount() == 5 && choiceChart->GetSelection() == pieChart) {
1112  if (choiceCluster->GetSelection() == 4) choiceCluster->Select (projectClusters);
1113  choiceCluster->Delete (4);
1114  }
1115 }
1116 void yatishFrame::OnChoiceClusterSelect (wxCommandEvent& event) {
1117  choiceAggregate->SetSelection ( hoursTotal );
1118  plot->PlotData ( (ClusterType)event.GetSelection(), hoursTotal );
1120 }
1121 
1122 void yatishFrame::OnDatePicker3Changed (wxDateEvent& event) {
1123  plot->SetFirstDay ( event.GetDate() );
1124  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
1125  (AggregateType)choiceAggregate->GetSelection() );
1127  SetStatusText (plot->TotalFormatted(), 2);
1128 }
1129 void yatishFrame::OnDatePicker4Changed (wxDateEvent& event) {
1130  plot->SetLastDay ( event.GetDate() );
1131  plot->PlotData ( (ClusterType)choiceCluster->GetSelection(),
1132  (AggregateType)choiceAggregate->GetSelection() );
1134  SetStatusText (plot->TotalFormatted(), 2);
1135 }
Pie chart for panel #3 using wxCharts.
Definition: yatishPlot.h:160
Time series for panel #3 using wxCharts.
Definition: yatishPlot.h:138
Interacts with yatish tables in a MySQL/MariaDB database.
Definition: yatishDBmysql.h:18
int Download()
Downloads slaveDB into masterDB.
int Upload()
Uploads masterDB into slaveDB.
int Commit()
Updates slaveDB with records of masterDB where the sync field is not 'S'.
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
void SetLimit(bool b, int i)
void SetFirstDay(const wxDateTime &)
Sets private member firstDay (for future SQL queries).
bool FillList(wxListCtrl *, tableID)
Fills a wxListCtrl.
wxString FilteredTotalFormatted()
Writes the total and average durations of currently viewed timeslots.
wxDateTime Last()
Obtains the maximum time in column start from currently selected rows of table yatish_timeslot.
wxDateTime First()
Obtains the minimum time in column start from currently selected rows of table yatish_timeslot.
void SetLastDay(const wxDateTime &)
Sets private member lastDay (for future SQL queries).
bool Delete(tableID, long)
Marks a local record for deletion.
void AddToFilter(tableID, int)
Adds a condition to the WHERE clause of FillList().
bool StartTimeslot(int, int, int)
Starts a new row in the timeslot table.
int ChoiceSelector(tableID, long)
Finds the proper index for selection in a wxChoice.
bool StopTimeslot()
Stops current timeslot.
long LastActivity()
Reads the last activity_id in yatish_timeslot.
Main Yatish frame; apart from menus, status bar, etc. this (large!) class:
Definition: yatishFrame.h:55
void OnMenuitemTimeLastweekSelected(wxCommandEvent &event)
long selectedActivityID
Definition: yatishFrame.h:68
static const long idTimer
Definition: yatishFrame.h:178
void OnHelp(wxCommandEvent &event)
static const long idHelpUser
Definition: yatishFrame.h:175
void OnMenuitemFileUpdateSelected(wxCommandEvent &event)
void OnContextMenu1(wxContextMenuEvent &)
void NewPlot()
void OnButtonPDFClick(wxCommandEvent &event)
static const long idTimeLastmonth
Definition: yatishFrame.h:173
static const long idHelpAbout
Definition: yatishFrame.h:176
wxDatePickerCtrl * datePicker3
Definition: yatishFrame.h:197
void ToggleLog()
wxChoice * choiceTool
Definition: yatishFrame.h:194
static const long idFileUpload
Definition: yatishFrame.h:158
static const long idNotebook
Definition: yatishFrame.h:154
static const long idListActivityRecord
Definition: yatishFrame.h:180
wxChoice * choiceProject
Definition: yatishFrame.h:191
void OnDatePicker4Changed(wxDateEvent &event)
void OnChoiceTableSelect(wxCommandEvent &event)
void OnMenuitemTimeThisyearSelected(wxCommandEvent &event)
void OnChoiceAggregateUpdate(wxUpdateUIEvent &)
void OnListColumnClick(wxListEvent &event)
void OnChoiceClusterSelect(wxCommandEvent &event)
static const long idTextCtrl
Definition: yatishFrame.h:155
void OnListKeyDown(wxListEvent &event)
wxMenuItem * menuitemFileUpload
Definition: yatishFrame.h:203
wxMenuItem * menuitemFileUpdate
Definition: yatishFrame.h:202
static const long idChoiceAggregate
Definition: yatishFrame.h:149
void OnMenuitemEditActivitySelected(wxCommandEvent &event)
void OnQuit(wxCommandEvent &event)
yatishDBsqlite masterDB
Definition: yatishFrame.h:63
static const long idFileDownload
Definition: yatishFrame.h:159
static const long idFileConnect
Definition: yatishFrame.h:156
void OnMenuitemTimeYesterdaySelected(wxCommandEvent &event)
static const long idStatusBar
Definition: yatishFrame.h:177
wxMenuItem * menuitemFileConnect
Definition: yatishFrame.h:200
static const long idTimeThisweek
Definition: yatishFrame.h:168
wxChoice * choiceAggregate
Definition: yatishFrame.h:188
wxDateTime clockStart
Definition: yatishFrame.h:62
void OnMenuitemEditChartSelected(wxCommandEvent &event)
void OnAbout(wxCommandEvent &event)
void OnNotebookPageChanged(wxNotebookEvent &event)
static const long idButtonStop
Definition: yatishFrame.h:140
ChartLib currentChartLib
Definition: yatishFrame.h:66
void OnChoiceAggregateSelect(wxCommandEvent &event)
static const long idEditTable
Definition: yatishFrame.h:162
void OnClose(wxCloseEvent &event)
void Recording()
static const long idChoiceTask
Definition: yatishFrame.h:137
void UpdateColumns()
wxBoxSizer * boxSizer1
Definition: yatishFrame.h:183
void OnListItemRightClick(wxListEvent &event)
static const long idChoiceProject
Definition: yatishFrame.h:136
void OnMenuitemEditTableUpdate(wxUpdateUIEvent &)
void ResetPickersT()
void OnDatePicker3Changed(wxDateEvent &event)
wxChoice * choiceTask
Definition: yatishFrame.h:193
static const long idPanelChart
Definition: yatishFrame.h:153
void OnMenuitemEditResetUpdate(wxUpdateUIEvent &)
wxBoxSizer * boxSizer6
Definition: yatishFrame.h:184
wxMenuItem * menuitemFileDownload
Definition: yatishFrame.h:201
static const long idPanelCurrent
Definition: yatishFrame.h:141
void OnDatePicker1Changed(wxDateEvent &event)
void OnMenuitemFileDownloadSelected(wxCommandEvent &event)
void OnMenuitemTimeTodaySelected(wxCommandEvent &event)
wxChoice * choiceChart
Definition: yatishFrame.h:189
void OnMenuitemEditTableSelected(wxCommandEvent &event)
static const long idTimeToday
Definition: yatishFrame.h:167
void OnMenuitemFileUploadSelected(wxCommandEvent &event)
static const long idDatePicker1
Definition: yatishFrame.h:143
void OnMenuitemTimeLastmonthSelected(wxCommandEvent &event)
void OnMenuitemTimeThismonthSelected(wxCommandEvent &event)
static const long idDatePicker2
Definition: yatishFrame.h:144
static const long idTimeLastweek
Definition: yatishFrame.h:172
wxHtmlHelpController help
Definition: yatishFrame.h:61
Settings settings
Definition: yatishFrame.h:59
wxDatePickerCtrl * datePicker2
Definition: yatishFrame.h:196
static const long idListActivityListTimeslot
Definition: yatishFrame.h:181
void ResetChoices()
wxPanel * panelChart
Definition: yatishFrame.h:205
static const long idDatePicker3
Definition: yatishFrame.h:151
void OnTimerTrigger(wxTimerEvent &event)
void OnMenuitemEditSettingsSelected(wxCommandEvent &event)
void OnMenuitemEditActivityUpdate(wxUpdateUIEvent &)
wxButton * buttonStart
Definition: yatishFrame.h:186
wxTextCtrl * textCtrl
Definition: yatishFrame.h:207
void OnMenuitemFileConnectSelected(wxCommandEvent &event)
static const long idFileUpdate
Definition: yatishFrame.h:157
wxButton * buttonStop
Definition: yatishFrame.h:187
void UpdateClock()
void OnDatePicker2Changed(wxDateEvent &event)
static const long idEditSettings
Definition: yatishFrame.h:166
wxListCtrl * listCtrl
Definition: yatishFrame.h:199
void OnListActivityListTimeslot(wxCommandEvent &event)
static const long idChoiceTool
Definition: yatishFrame.h:138
wxChoice * choiceTable
Definition: yatishFrame.h:192
static const long idEditActivity
Definition: yatishFrame.h:161
wxDatePickerCtrl * datePicker4
Definition: yatishFrame.h:198
void OnButtonStartClick(wxCommandEvent &event)
void OnMenuitemTimeLastyearSelected(wxCommandEvent &event)
static const long idEditReset
Definition: yatishFrame.h:165
static const long idButtonPDF
Definition: yatishFrame.h:145
void ResetPickersG()
static const long idFileQuit
Definition: yatishFrame.h:160
void OnMenuitemTimeTodayUpdate(wxUpdateUIEvent &)
wxTimer timer
Definition: yatishFrame.h:208
void OnMenuitemEditNewSelected(wxCommandEvent &event)
void OnMenuitemEditChartUpdate(wxUpdateUIEvent &)
static const long idTimeYesterday
Definition: yatishFrame.h:171
void OnContextMenu4(wxContextMenuEvent &)
void OnContextMenu2(wxContextMenuEvent &)
wxDatePickerCtrl * datePicker1
Definition: yatishFrame.h:195
static const long idListCtrl
Definition: yatishFrame.h:146
wxChoice * choiceCluster
Definition: yatishFrame.h:190
static const long idEditChart
Definition: yatishFrame.h:163
wxLog * defaultLog
Definition: yatishFrame.h:60
wxNotebook * notebook
Definition: yatishFrame.h:204
static const long idButtonStart
Definition: yatishFrame.h:139
void OnChoiceClusterUpdate(wxUpdateUIEvent &)
PlotType currentPlotType
Definition: yatishFrame.h:67
void ToggleConnect()
static const long idChoiceTable
Definition: yatishFrame.h:142
static const long idTimeThismonth
Definition: yatishFrame.h:169
static const long idDatePicker4
Definition: yatishFrame.h:152
static const long idTimeLastyear
Definition: yatishFrame.h:174
yatishDBmysql * slaveDB
Definition: yatishFrame.h:64
static const long idChoiceChart
Definition: yatishFrame.h:148
static const long idTimeThisyear
Definition: yatishFrame.h:170
void OnChoiceChartSelect(wxCommandEvent &event)
void OnMenuitemEditNewUpdate(wxUpdateUIEvent &)
static const long idEditNew
Definition: yatishFrame.h:164
void UpdateStatus(mysqlStatus)
void OnListActivityRecord(wxCommandEvent &event)
void OnButtonStopClick(wxCommandEvent &event)
static const long idPanelList
Definition: yatishFrame.h:147
void OnContextMenu3(wxContextMenuEvent &)
static const long idChoiceCluster
Definition: yatishFrame.h:150
void OnMenuitemTimeThisweekSelected(wxCommandEvent &event)
void UpdateRows(tableID)
void OnMenuitemEditResetSelected(wxCommandEvent &event)
yatishPlot * plot
Definition: yatishFrame.h:65
Pie chart for panel #3 using wxFreeChart.
Definition: yatishPlot.h:116
Time series for panel #3 using wxFreeChart.
Definition: yatishPlot.h:97
Time series for panel #3 using wxMathPlot.
Definition: yatishPlot.h:80
Exports a PDF reflecting the current state of panel #2.
Definition: yatishPDF.h:20
virtual void PlotData(ClusterType, AggregateType)=0
Plotting interface for yatishFrame:
void SetLastDay(const wxDateTime &dt)
Definition: yatishPlot.h:39
virtual wxString TotalFormatted()
Definition: yatishPlot.h:53
void SetFirstDay(const wxDateTime &dt)
Definition: yatishPlot.h:38
A dialog to modify YATiSh settings.
void Get(Settings &)
void Set(Settings &)
int rowLimit
...to rowLimit lines.
ChartLib lib
A ChartLib enumerates the graphic libraries available for panel #3.
bool log2text
If True, error/warning messages will be forwarded to the bottom of the main frame.
bool limitRow
If True, the listing in panel #2 will be limited...
tableID
Definition: yatishDB.h:13
@ tool_tid
Definition: yatishDB.h:16
@ task_tid
Definition: yatishDB.h:15
@ timeslot_tid
Definition: yatishDB.h:19
@ client_tid
Definition: yatishDB.h:14
@ project_tid
Definition: yatishDB.h:17
@ activity_tid
Definition: yatishDB.h:18
const char * not_used
Definition: yatishFrame.cpp:15
#define UNFORTUNATE_TRICK
Definition: yatishFrame.h:47
mysqlStatus
Definition: yatishFrame.h:40
@ mysql_off
Definition: yatishFrame.h:41
@ mysql_on
Definition: yatishFrame.h:42
@ mysql_err
Definition: yatishFrame.h:43
@ wxCharts
@ wxFreeChart
@ wxMathPlot
ClusterType
Same order as yatishFrame::choiceCluster.
Definition: yatishTypes.h:58
@ none
Definition: yatishTypes.h:63
@ projectClusters
Definition: yatishTypes.h:60
PlotType
Same order as yatishFrame::choiceChart.
Definition: yatishTypes.h:41
@ timeSeries
Definition: yatishTypes.h:42
@ pieChart
Definition: yatishTypes.h:43
AggregateType
Same order as yatishFrame::choiceAggregate (except invalid of course).
Definition: yatishTypes.h:47
@ hoursTotal
Definition: yatishTypes.h:49