Add calendar to AccountPanel
This commit is contained in:
parent
fc9b06c507
commit
98513c1ca9
|
@ -49,13 +49,11 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare
|
||||||
// ColorScheme* colorScheme = new ColorScheme(wxUI::categoryColors, WXSIZEOF(wxUI::categoryColors));
|
// ColorScheme* colorScheme = new ColorScheme(wxUI::categoryColors, WXSIZEOF(wxUI::categoryColors));
|
||||||
|
|
||||||
// _pie = new PiePlot();
|
// _pie = new PiePlot();
|
||||||
// _calendar = new wxCalendarCtrl(this, CALENDAR_ID, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize,
|
_calendar = new QCalendarWidget(this);
|
||||||
// wxCAL_MONDAY_FIRST | wxCAL_NO_MONTH_CHANGE | wxCAL_SEQUENTIAL_MONTH_SELECTION);
|
_calendar->setGridVisible(false);
|
||||||
// _calendar->EnableMonthChange(false);
|
_calendar->setFirstDayOfWeek(Qt::Monday);
|
||||||
// _calendar->EnableYearChange(false);
|
_calendar->setNavigationBarVisible(false);
|
||||||
// _calendar->EnableHolidayDisplay(false);
|
|
||||||
// _calendar->Enable(false);
|
|
||||||
|
|
||||||
_accounts = new QString[user->GetAccountsNumber()];
|
_accounts = new QString[user->GetAccountsNumber()];
|
||||||
for (i=0,
|
for (i=0,
|
||||||
accountIt = user->_accounts.begin();
|
accountIt = user->_accounts.begin();
|
||||||
|
@ -131,10 +129,10 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, pare
|
||||||
hbox->addLayout(vbox3);
|
hbox->addLayout(vbox3);
|
||||||
// // hbox->Add(vbox3, 0, wxGROW|wxALL, 2);
|
// // hbox->Add(vbox3, 0, wxGROW|wxALL, 2);
|
||||||
// hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2);
|
// hbox2->Add(_accountsGrid, 0, wxGROW|wxALL, 2);
|
||||||
// hbox2->Add(_calendar, 0, wxALL, 2);
|
hbox2->addWidget(_calendar);
|
||||||
// vbox2->Add(hbox2, 0);
|
vbox2->addLayout(hbox2);
|
||||||
// vbox2->Add(_grid, 0, wxGROW|wxALL, 2);
|
// vbox2->Add(_grid, 0, wxGROW|wxALL, 2);
|
||||||
// hbox->Add(vbox2, 0, wxGROW|wxALL, 2);
|
hbox->addLayout(vbox2);
|
||||||
// vbox->Add(_statsGrid, 0, wxGROW);
|
// vbox->Add(_statsGrid, 0, wxGROW);
|
||||||
// vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10);
|
// vbox->Add(chart, 0, wxALIGN_CENTER_HORIZONTAL|wxUP, 10);
|
||||||
// hbox->Add(vbox, 0, wxGROW|wxALL, 2);
|
// hbox->Add(vbox, 0, wxGROW|wxALL, 2);
|
||||||
|
@ -234,7 +232,7 @@ void AccountPanel::InitStatsGrid(User* user)
|
||||||
// _statsGrid->SetCellAlignment(BALANCE, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
// _statsGrid->SetCellAlignment(BALANCE, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
// _statsGrid->SetCellAlignment(NON_FIX, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
// _statsGrid->SetCellAlignment(NON_FIX, 1, wxALIGN_RIGHT, wxALIGN_CENTRE);
|
||||||
}
|
}
|
||||||
#include <iostream>
|
|
||||||
void AccountPanel::ChangeUser()
|
void AccountPanel::ChangeUser()
|
||||||
{
|
{
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
|
@ -327,8 +325,9 @@ void AccountPanel::ShowMonth(int month, int year)
|
||||||
// DEFAULT_FONT(font);
|
// DEFAULT_FONT(font);
|
||||||
// std::vector<Category>::iterator categoryIt;
|
// std::vector<Category>::iterator categoryIt;
|
||||||
// std::map<unsigned int, std::vector<Operation> >::iterator monthIt;
|
// std::map<unsigned int, std::vector<Operation> >::iterator monthIt;
|
||||||
// wxDateTime curDate;
|
QDate curDate = QDate::currentDate();
|
||||||
// curDate.SetToCurrent();
|
QDate dateStart = QDate::currentDate();
|
||||||
|
QDate dateEnd = QDate::currentDate();
|
||||||
|
|
||||||
// if (month == -1)
|
// if (month == -1)
|
||||||
// {
|
// {
|
||||||
|
@ -358,7 +357,6 @@ void AccountPanel::ShowMonth(int month, int year)
|
||||||
// _curYear = year;
|
// _curYear = year;
|
||||||
// _curMonth = month;
|
// _curMonth = month;
|
||||||
// _wxUI->SetTitle(user->_name + wxT(" - ") + wxUI::months[month] + wxT(" ") + wxString::Format(wxT("%d"), year));
|
// _wxUI->SetTitle(user->_name + wxT(" - ") + wxUI::months[month] + wxT(" ") + wxString::Format(wxT("%d"), year));
|
||||||
// _calendar->Enable(true);
|
|
||||||
|
|
||||||
// if (_grid->GetNumberRows() > 1)
|
// if (_grid->GetNumberRows() > 1)
|
||||||
// _grid->DeleteRows(1, _grid->GetNumberRows()-1);
|
// _grid->DeleteRows(1, _grid->GetNumberRows()-1);
|
||||||
|
@ -370,15 +368,15 @@ void AccountPanel::ShowMonth(int month, int year)
|
||||||
|
|
||||||
// InitAccountsGrid(user, month, year);
|
// InitAccountsGrid(user, month, year);
|
||||||
|
|
||||||
// _calendar->EnableMonthChange(true);
|
dateStart.setDate(dateStart.year(), dateStart.month(), 1);
|
||||||
// _calendar->EnableYearChange(true);
|
dateEnd.setDate(dateEnd.year(), dateEnd.month(), dateStart.daysInMonth());
|
||||||
// if (curDate.GetMonth() == month && curDate.GetYear() == year)
|
_calendar->setDateRange(dateStart, dateEnd);
|
||||||
// _calendar->SetDate(curDate) ;
|
if ((curDate.month()-1) == month && curDate.year() == year)
|
||||||
// else if (curDate.GetMonth() > month || curDate.GetYear() > year)
|
_calendar->showToday();
|
||||||
// _calendar->SetDate(curDate.GetLastMonthDay((wxDateTime::Month)month, year));
|
else if ((curDate.month()-1) > month || curDate.year() > year)
|
||||||
// else if (curDate.GetMonth() < month || curDate.GetYear() < year)
|
_calendar->setSelectedDate (dateEnd) ;
|
||||||
// _calendar->SetDate(wxDateTime(1, (wxDateTime::Month)month, year));
|
else if ((curDate.month()-1) < month || curDate.year() < year)
|
||||||
|
_calendar->setSelectedDate(dateStart) ;
|
||||||
// _calendar->EnableMonthChange(false);
|
// _calendar->EnableMonthChange(false);
|
||||||
// _calendar->EnableYearChange(false);
|
// _calendar->EnableYearChange(false);
|
||||||
// _calendar->SetSize(_calendar->GetMinSize());
|
// _calendar->SetSize(_calendar->GetMinSize());
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
// #include <wx/radiobox.h>
|
// #include <wx/radiobox.h>
|
||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
#include <QCalendarWidget>
|
||||||
|
|
||||||
#include "view.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTreeWidget *_tree;
|
QTreeWidget *_tree;
|
||||||
// wxCalendarCtrl* _calendar;
|
QCalendarWidget* _calendar;
|
||||||
// GridAccount* _grid;
|
// GridAccount* _grid;
|
||||||
// wxGrid *_statsGrid, *_accountsGrid;
|
// wxGrid *_statsGrid, *_accountsGrid;
|
||||||
// PiePlot* _pie;
|
// PiePlot* _pie;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user