Skip to content

Commit

Permalink
Merge pull request #5531 from vomikan/master
Browse files Browse the repository at this point in the history
fix(#5530): time picker for grm
  • Loading branch information
vomikan committed Jan 12, 2023
2 parents 0e25db9 + 6466cca commit e9384e6
Show file tree
Hide file tree
Showing 38 changed files with 4,368 additions and 4,276 deletions.
256 changes: 129 additions & 127 deletions po/ar_SA.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/be_BY.po

Large diffs are not rendered by default.

258 changes: 130 additions & 128 deletions po/bg_BG.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/ca_ES.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/cs_CZ.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/de_DE.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/el_GR.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/en_GB.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/es_ES.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/fr_FR.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/he_IL.po

Large diffs are not rendered by default.

262 changes: 132 additions & 130 deletions po/hr_HR.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/hu_HU.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/id_ID.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/it_IT.po

Large diffs are not rendered by default.

258 changes: 130 additions & 128 deletions po/ja_JP.po

Large diffs are not rendered by default.

258 changes: 130 additions & 128 deletions po/lt_LT.po

Large diffs are not rendered by default.

254 changes: 128 additions & 126 deletions po/mmex.pot

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/nl_NL.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/pl_PL.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/pt_BR.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/ro_RO.po

Large diffs are not rendered by default.

260 changes: 131 additions & 129 deletions po/ru_RU.po

Large diffs are not rendered by default.

260 changes: 131 additions & 129 deletions po/sk_SK.po

Large diffs are not rendered by default.

258 changes: 130 additions & 128 deletions po/sq_AL.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/sr.po

Large diffs are not rendered by default.

262 changes: 132 additions & 130 deletions po/sv_SE.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/ta_IN.po

Large diffs are not rendered by default.

260 changes: 131 additions & 129 deletions po/tr_TR.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/uk_UA.po

Large diffs are not rendered by default.

258 changes: 130 additions & 128 deletions po/vi_VN.po

Large diffs are not rendered by default.

264 changes: 133 additions & 131 deletions po/zh_CN.po

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions po/zh_TW.po

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions src/mmreportspanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ EVT_CHOICE(ID_CHOICE_YEAR, mmReportsPanel::OnYearChanged)
EVT_CHOICE(ID_CHOICE_BUDGET, mmReportsPanel::OnBudgetChanged)
EVT_CHOICE(ID_CHOICE_ACCOUNTS, mmReportsPanel::OnAccountChanged)
EVT_DATE_CHANGED(wxID_ANY, mmReportsPanel::OnStartEndDateChanged)
EVT_TIME_CHANGED(wxID_ANY, mmReportsPanel::OnStartEndDateChanged)
EVT_CHOICE(ID_CHOICE_CHART, mmReportsPanel::OnChartChanged)
EVT_SPINCTRL(ID_CHOICE_FORWARD_MONTHS, mmReportsPanel::OnForwardMonthsChangedSpin)
EVT_TEXT_ENTER(ID_CHOICE_FORWARD_MONTHS, mmReportsPanel::OnForwardMonthsChangedText)
Expand All @@ -55,6 +56,7 @@ mmReportsPanel::mmReportsPanel(
, m_date_ranges(nullptr)
, m_start_date(nullptr)
, m_end_date(nullptr)
, m_time(nullptr)
, m_accounts(nullptr)
, m_chart(nullptr)
, cleanup_(cleanupReport)
Expand Down Expand Up @@ -254,7 +256,7 @@ void mmReportsPanel::CreateControls()
else if (rp & rb_->RepParams::SINGLE_DATE)
{
wxStaticText* itemStaticTextH1 = new wxStaticText(itemPanel3
, wxID_ANY, _("Date"));
, wxID_ANY, _("Date:"));
mmSetOwnFont(itemStaticTextH1, GetFont().Larger());
itemBoxSizerHeader->Add(itemStaticTextH1, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(5);
Expand All @@ -264,15 +266,13 @@ void mmReportsPanel::CreateControls()
m_start_date->SetValue(wxDateTime::Today());
m_start_date->Enable(true);

m_end_date = nullptr;

itemBoxSizerHeader->Add(m_start_date, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(30);
}
else if (rp & rb_->RepParams::MONTHES)
{
wxStaticText* itemStaticTextH1 = new wxStaticText(itemPanel3
, wxID_ANY, _("Date"));
, wxID_ANY, _("Date:"));
mmSetOwnFont(itemStaticTextH1, GetFont().Larger());
itemBoxSizerHeader->Add(itemStaticTextH1, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(5);
Expand All @@ -285,6 +285,20 @@ void mmReportsPanel::CreateControls()
itemBoxSizerHeader->AddSpacer(30);
}

if (rp & rb_->RepParams::TIME)
{
wxStaticText* itemStaticTextH1 = new wxStaticText(itemPanel3
, wxID_ANY, _("Time:"));
mmSetOwnFont(itemStaticTextH1, GetFont().Larger());
itemBoxSizerHeader->Add(itemStaticTextH1, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(5);

m_time = new wxTimePickerCtrl(itemPanel3, ID_CHOICE_TIME);

itemBoxSizerHeader->Add(m_time, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(30);
}

if (rp & rb_->RepParams::ONLY_YEARS)
{
cleanupmem_ = true;
Expand Down Expand Up @@ -346,8 +360,8 @@ void mmReportsPanel::CreateControls()
itemBoxSizerHeader->Add(itemStaticTextH1, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1);
itemBoxSizerHeader->AddSpacer(5);
m_accounts = new wxChoice(itemPanel3, ID_CHOICE_ACCOUNTS);
m_accounts->Append(_("All Accounts"));
m_accounts->Append(_("Specific Accounts"));
m_accounts->Append(_("All Accounts:"));
m_accounts->Append(_("Specific Accounts:"));
for (const auto& e : Model_Account::instance().TYPE_CHOICES)
{
if (e.first != Model_Account::INVESTMENT) {
Expand Down
3 changes: 3 additions & 0 deletions src/mmreportspanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "mmSimpleDialogs.h"
#include "reports/reportbase.h"
#include <wx/spinctrl.h>
#include <wx/timectrl.h>

class mmGUIFrame;
class mmDateRange;
Expand Down Expand Up @@ -64,6 +65,7 @@ class mmReportsPanel : public mmPanelBase
ID_CHOICE_ACCOUNTS,
ID_CHOICE_START_DATE,
ID_CHOICE_END_DATE,
ID_CHOICE_TIME,
ID_CHOICE_YEAR,
ID_CHOICE_BUDGET,
ID_CHOICE_CHART,
Expand All @@ -75,6 +77,7 @@ class mmReportsPanel : public mmPanelBase
std::vector<wxSharedPtr<mmDateRange>> m_all_date_ranges;
wxChoice* m_date_ranges = nullptr;
mmDatePickerCtrl *m_start_date = nullptr, *m_end_date = nullptr;
wxTimePickerCtrl *m_time = nullptr;
wxWebView * browser_ = nullptr;
mmPrintableBase* rb_ = nullptr;
wxChoice* m_accounts = nullptr;
Expand Down
14 changes: 10 additions & 4 deletions src/model/Model_Report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ const std::vector<Model_Report::Values> Model_Report::SqlPlaceHolders()
const wxString def_date = wxDateTime::Today().FormatISODate();

const std::vector<Model_Report::Values> v = {
{"&begin_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_START_DATE, _("Begin date: ")},
{"&single_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_START_DATE, _("Date: ")},
{"&end_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_END_DATE, _("End date: ")},
{"&only_years", "wxChoice", def_date, mmReportsPanel::RepPanel::ID_CHOICE_YEAR, _("Year: ")},
{"&begin_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_START_DATE, _("Begin date:")},
{"&single_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_START_DATE, _("Date:")},
{"&end_date", "mmDatePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_END_DATE, _("End date:")},
{"&single_time", "wxTimePickerCtrl", def_date, mmReportsPanel::RepPanel::ID_CHOICE_TIME, _("Time:")},
{"&only_years", "wxChoice", def_date, mmReportsPanel::RepPanel::ID_CHOICE_YEAR, _("Year:")},
};
return v;
};
Expand Down Expand Up @@ -206,6 +207,11 @@ bool Model_Report::PrepareSQL(wxString& sql, std::map <wxString, wxString>& rep_
mmDatePickerCtrl* date = static_cast<mmDatePickerCtrl*>(w);
value = date->GetValue().FormatISODate();
}
if (w && entry.type == "wxTimePickerCtrl")
{
wxTimePickerCtrl* time = static_cast<wxTimePickerCtrl*>(w);
value = time->GetValue().ToUTC().FormatISOTime();
}
if (w && entry.type == "wxChoice")
{
wxChoice* year = static_cast<wxChoice*>(w);
Expand Down
4 changes: 3 additions & 1 deletion src/reports/reportbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ mmPrintableBase::mmPrintableBase(const wxString& title)

mmPrintableBase::~mmPrintableBase()
{

}

void mmPrintableBase::setReportParameters(int id)
Expand Down Expand Up @@ -349,6 +348,9 @@ int mmGeneralReport::report_parameters()
else if (content.Contains("&only_years"))
params |= ONLY_YEARS;

if (content.Contains("&single_time"))
params |= TIME;

return params;
}

Expand Down
13 changes: 7 additions & 6 deletions src/reports/reportbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ class mmPrintableBase
NONE = 0
, SINGLE_DATE = 1
, DATE_RANGE = 2
, MONTHES = 4
, BUDGET_DATES = 8
, ONLY_YEARS = 16
, ACCOUNTS_LIST = 32
, CHART = 64
, FORWARD_MONTHS = 128
, TIME = 4
, MONTHES = 8
, BUDGET_DATES = 16
, ONLY_YEARS = 32
, ACCOUNTS_LIST = 64
, CHART = 128
, FORWARD_MONTHS = 256
};

enum Reports {
Expand Down

0 comments on commit e9384e6

Please sign in to comment.