13 #include "yatish_recording.xpm"
15 const char *
not_used = _(
"translator-credits");
20 #include <wx/string.h>
89 wxBoxSizer* boxSizer2;
90 wxBoxSizer* boxSizer3;
91 wxBoxSizer* boxSizer4;
92 wxBoxSizer* boxSizer5;
93 wxBoxSizer* boxSizer7;
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;
118 wxStaticBoxSizer* staticBoxSizer1;
119 wxStaticBoxSizer* staticBoxSizer2;
120 wxStaticBoxSizer* staticBoxSizer3;
121 wxStaticBoxSizer* staticBoxSizer4;
122 wxStaticBoxSizer* staticBoxSizer5;
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);
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"));
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);
306 Connect(idFileQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&
yatishFrame::OnQuit);
321 Connect(idHelpUser,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&
yatishFrame::OnHelp);
330 SetIcon ( wxIcon (yatish_xpm) );
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) );
338 textCtrl->Hide(); boxSizer1->SetSizeHints (
this);
340 ResetChoices(); ResetPickersT(); UpdateColumns();
341 SetStatusText (wxEmptyString, 2);
343 switch ( masterDB.RunningTimeslots() ) {
351 wxLogError (_(
"Several yatish were inappropriately terminated!") );
355 selectedActivityID = 0l;
361 wxDateTime now = wxDateTime::Now();
363 SetStatusText ( elapsed.Format() );
369 SetStatusText (
"MySQL ON", 1);
372 SetStatusText (
"MySQL OFF", 1);
375 SetStatusText (
"MySQL ERR", 1);
384 if (!choiceOK) wxLogError (
"Reset of choices failed for panel #1");
390 if (lastActivityID == wxNOT_FOUND) {
410 listCtrl->AppendColumn(_(
"Duration") );
411 listCtrl->AppendColumn(_(
"Project") );
412 listCtrl->AppendColumn(_(
"Client") );
417 listCtrl->AppendColumn(_(
"Project") );
418 listCtrl->AppendColumn(_(
"Client") );
424 listCtrl->AppendColumn(_(
"Client") );
436 wxLogError (
"Updating listCrl failed (panel #2)");
437 for (
int col = 0; col <
listCtrl->GetColumnCount(); col++)
438 listCtrl->SetColumnWidth (col, wxLIST_AUTOSIZE_USEHEADER);
465 boxSizer6->GetItem (1) ->DeleteWindows();
497 boxSizer6->Add (
dynamic_cast <wxWindow *
> (
plot), 1, wxALL|wxEXPAND, 5);
531 if (
help.GetFrame() )
help.GetFrame()->Close (
true);
543 switch ( event.GetSelection() ) {
545 SetStatusText (wxEmptyString, 2);
573 wxMessageBox (_(
"Please stop the current activity"),
574 _(
"Update refused"), wxOK);
578 if (err == 2006 || err == 2013) {
579 wxLogMessage (_(
"MySQL connection timed out: try to reconnect...") );
583 wxMessageBox (_(
"done."), _(
"Database update:"), wxOK);
587 if ( wxMessageBox ( _(
"Remote data (if any) will be\noverwritten by local ones."),
589 wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
590 == wxCANCEL )
return;
591 SetStatusText (_(
"Please wait, working..."), 2);
593 SetStatusText (wxEmptyString, 2);
594 if (err == 2006 || err == 2013) {
595 wxLogMessage (_(
"MySQL connection timed out: try to reconnect...") );
599 wxMessageBox (_(
"done."), _(
"Database upload:"), wxOK);
604 if ( wxMessageBox ( _(
"Local data (if any) will be\noverwritten by remote ones."),
606 wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
607 == wxCANCEL )
return;
610 SetStatusText (_(
"Please wait, working..."), 2);
612 SetStatusText (wxEmptyString, 2);
613 if (err == 2006 || err == 2013) {
614 wxLogMessage (_(
"MySQL connection timed out: try to reconnect...") );
618 wxMessageBox (_(
"done."), _(
"Database download:"), wxOK);
619 int page =
notebook->GetSelection();
632 event.Enable (
notebook->GetSelection() != 0);
638 event.Enable (
notebook->GetSelection() != 1);
644 event.Enable (
notebook->GetSelection() != 2);
648 int dlgEnd = wxID_CANCEL;
652 dlgEnd = dlg.ShowModal();
655 dlgEnd = dlg.ShowModal();
658 dlgEnd = dlg.ShowModal();
661 dlgEnd = dlg.ShowModal();
663 if (dlgEnd != wxID_CANCEL) {
671 event.Enable (
notebook->GetSelection() == 1);
675 if (
notebook->GetSelection() == 1) {
688 bool filterTavailable = (
notebook->GetSelection() == 1);
689 if (filterTavailable) {
693 event.Enable (filterTavailable ||
notebook->GetSelection() == 2);
702 wxDateTime dt = wxDateTime::Today();
710 wxDateTime dt = wxDateTime::Today();
712 dt.SetToPrevWeekDay (wxDateTime::Mon);
719 wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
721 if (
notebook->GetSelection() == 1) {
739 wxDateTime dt1 = wxDateTime::Today(), dt2 = dt1;
740 dt1.SetMonth (wxDateTime::Jan); dt1.SetDay (1);
741 if (
notebook->GetSelection() == 1) {
760 wxDateTime dt = wxDateTime::Today();
761 dt -= wxDateSpan::Day();
769 wxDateTime dt = wxDateTime::Today();
770 dt -= wxDateSpan::Week();
771 dt.SetToNextWeekDay (wxDateTime::Sun);
773 dt.SetToPrevWeekDay (wxDateTime::Mon);
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) {
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) {
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") );
831 menu.Append (
idTimeThismonth, _(
"This month"), _(
"Time interval to show: this month") );
832 menu.Append (
idTimeThisyear, _(
"This year"), _(
"Time interval to show: this year") );
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") );
845 menu.Append (
idTimeLastmonth, _(
"Last month"), _(
"Time interval to show: last month") );
846 menu.Append (
idTimeLastyear, _(
"Last year"), _(
"Time interval to show: last year") );
853 if (dlg.ShowModal() == wxID_CANCEL)
return;
864 help.DisplayContents();
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"
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);
903 wxLogError (
"Timeslot could not be started");
915 SetIcon ( wxIcon (yatish_recording_xpm) );
920 wxLogError (
"Timeslot could not be stopped");
926 SetIcon ( wxIcon (yatish_xpm) );
954 int project_col = -1,
972 int col =
event.GetColumn();
973 int ret = wxID_CANCEL;
974 if (col == project_col) {
976 ret = dlg.ShowModal();
978 if (col == client_col) {
980 ret = dlg.ShowModal();
982 if (col == task_col) {
984 ret = dlg.ShowModal();
986 if (col == tool_col) {
988 ret = dlg.ShowModal();
994 if ( !wxGetKeyState (WXK_SHIFT) ) {
999 long row_id =
event.GetIndex(), sql_id =
listCtrl->GetItemData (row_id);
1000 switch ( event.GetKeyCode() ) {
1002 {
int dlgEnd = wxID_CANCEL;
1005 dlgEnd = dlg.ShowModal();
1008 dlgEnd = dlg.ShowModal();
1011 dlgEnd = dlg.ShowModal();
1013 if (
listCtrl->GetItemText (row_id, 1) .IsEmpty() ) {
1014 wxMessageBox (_(
"Won't edit the current activity\n(first close it)."),
1015 _(
"Change selection"), wxOK);
1018 dlgEnd = dlg.ShowModal();
1021 if (dlgEnd != wxID_CANCEL)
UpdateRows (tid); }
1024 if ( wxMessageBox ( _(
"Deleting a record..."),
1026 wxICON_EXCLAMATION|wxOK|wxCANCEL|wxCANCEL_DEFAULT )
1027 == wxCANCEL )
break;
1038 wxMessageBox (_(
"Can't start a new activity\n(first close the current one)."),
1039 _(
"Stop current activity"), wxOK);
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;
1083 wxLogMessage (_(
"This plot is not provided by the current library.\n"
1084 "Choose another one in the Settings (Ctrl-P).") );
1099 event.Enable (
false);
1101 event.Enable (
true);
Pie chart for panel #3 using wxCharts.
Time series for panel #3 using wxCharts.
Interacts with yatish tables in a MySQL/MariaDB database.
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:
void OnMenuitemTimeLastweekSelected(wxCommandEvent &event)
static const long idTimer
void OnHelp(wxCommandEvent &event)
static const long idHelpUser
void OnMenuitemFileUpdateSelected(wxCommandEvent &event)
void OnContextMenu1(wxContextMenuEvent &)
void OnButtonPDFClick(wxCommandEvent &event)
static const long idTimeLastmonth
static const long idHelpAbout
wxDatePickerCtrl * datePicker3
static const long idFileUpload
static const long idNotebook
static const long idListActivityRecord
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
void OnListKeyDown(wxListEvent &event)
wxMenuItem * menuitemFileUpload
wxMenuItem * menuitemFileUpdate
static const long idChoiceAggregate
void OnMenuitemEditActivitySelected(wxCommandEvent &event)
void OnQuit(wxCommandEvent &event)
static const long idFileDownload
static const long idFileConnect
void OnMenuitemTimeYesterdaySelected(wxCommandEvent &event)
static const long idStatusBar
wxMenuItem * menuitemFileConnect
static const long idTimeThisweek
wxChoice * choiceAggregate
void OnMenuitemEditChartSelected(wxCommandEvent &event)
void OnAbout(wxCommandEvent &event)
void OnNotebookPageChanged(wxNotebookEvent &event)
static const long idButtonStop
void OnChoiceAggregateSelect(wxCommandEvent &event)
static const long idEditTable
void OnClose(wxCloseEvent &event)
static const long idChoiceTask
void OnListItemRightClick(wxListEvent &event)
static const long idChoiceProject
void OnMenuitemEditTableUpdate(wxUpdateUIEvent &)
void OnDatePicker3Changed(wxDateEvent &event)
static const long idPanelChart
void OnMenuitemEditResetUpdate(wxUpdateUIEvent &)
wxMenuItem * menuitemFileDownload
static const long idPanelCurrent
void OnDatePicker1Changed(wxDateEvent &event)
void OnMenuitemFileDownloadSelected(wxCommandEvent &event)
void OnMenuitemTimeTodaySelected(wxCommandEvent &event)
void OnMenuitemEditTableSelected(wxCommandEvent &event)
static const long idTimeToday
void OnMenuitemFileUploadSelected(wxCommandEvent &event)
static const long idDatePicker1
void OnMenuitemTimeLastmonthSelected(wxCommandEvent &event)
void OnMenuitemTimeThismonthSelected(wxCommandEvent &event)
static const long idDatePicker2
static const long idTimeLastweek
wxHtmlHelpController help
wxDatePickerCtrl * datePicker2
static const long idListActivityListTimeslot
static const long idDatePicker3
void OnTimerTrigger(wxTimerEvent &event)
void OnMenuitemEditSettingsSelected(wxCommandEvent &event)
void OnMenuitemEditActivityUpdate(wxUpdateUIEvent &)
void OnMenuitemFileConnectSelected(wxCommandEvent &event)
static const long idFileUpdate
void OnDatePicker2Changed(wxDateEvent &event)
static const long idEditSettings
void OnListActivityListTimeslot(wxCommandEvent &event)
static const long idChoiceTool
static const long idEditActivity
wxDatePickerCtrl * datePicker4
void OnButtonStartClick(wxCommandEvent &event)
void OnMenuitemTimeLastyearSelected(wxCommandEvent &event)
static const long idEditReset
static const long idButtonPDF
static const long idFileQuit
void OnMenuitemTimeTodayUpdate(wxUpdateUIEvent &)
void OnMenuitemEditNewSelected(wxCommandEvent &event)
void OnMenuitemEditChartUpdate(wxUpdateUIEvent &)
static const long idTimeYesterday
void OnContextMenu4(wxContextMenuEvent &)
void OnContextMenu2(wxContextMenuEvent &)
wxDatePickerCtrl * datePicker1
static const long idListCtrl
static const long idEditChart
static const long idButtonStart
void OnChoiceClusterUpdate(wxUpdateUIEvent &)
static const long idChoiceTable
static const long idTimeThismonth
static const long idDatePicker4
static const long idTimeLastyear
static const long idChoiceChart
static const long idTimeThisyear
void OnChoiceChartSelect(wxCommandEvent &event)
void OnMenuitemEditNewUpdate(wxUpdateUIEvent &)
static const long idEditNew
void UpdateStatus(mysqlStatus)
void OnListActivityRecord(wxCommandEvent &event)
void OnButtonStopClick(wxCommandEvent &event)
static const long idPanelList
void OnContextMenu3(wxContextMenuEvent &)
static const long idChoiceCluster
void OnMenuitemTimeThisweekSelected(wxCommandEvent &event)
void OnMenuitemEditResetSelected(wxCommandEvent &event)
Pie chart for panel #3 using wxFreeChart.
Time series for panel #3 using wxFreeChart.
Time series for panel #3 using wxMathPlot.
Exports a PDF reflecting the current state of panel #2.
virtual void PlotData(ClusterType, AggregateType)=0
Plotting interface for yatishFrame:
void SetLastDay(const wxDateTime &dt)
virtual wxString TotalFormatted()
void SetFirstDay(const wxDateTime &dt)
A dialog to modify YATiSh 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...
#define UNFORTUNATE_TRICK
ClusterType
Same order as yatishFrame::choiceCluster.
PlotType
Same order as yatishFrame::choiceChart.
AggregateType
Same order as yatishFrame::choiceAggregate (except invalid of course).