Move directories, fix a bug into month generation (tree), add tooltips
This commit is contained in:
87
src/model/User.cpp
Normal file
87
src/model/User.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "User.h"
|
||||
|
||||
User::~User()
|
||||
{
|
||||
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
|
||||
|
||||
for (it = _operations.begin(); it != _operations.end(); it++)
|
||||
{
|
||||
if (_operations[it->first])
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Category User::GetCategory(wxString catId)
|
||||
{
|
||||
Category cat;
|
||||
std::vector<Category>::iterator it;
|
||||
|
||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||
if (it->id == catId)
|
||||
return *it;
|
||||
|
||||
cat.id = wxT("0");
|
||||
cat.parent = wxT("0");
|
||||
cat.name = _("Unknown");
|
||||
cat.font = wxT("");
|
||||
cat.color = wxColour(0xFF, 0xFF, 0xFF);
|
||||
|
||||
return cat;
|
||||
}
|
||||
|
||||
wxString User::GetCategoryName(wxString catId)
|
||||
{
|
||||
std::vector<Category>::iterator it;
|
||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||
if (it->id == catId)
|
||||
return it->name;
|
||||
|
||||
return _("Unknown") ;
|
||||
}
|
||||
|
||||
wxString User::GetCategoryId(wxString catName)
|
||||
{
|
||||
std::vector<Category>::iterator it;
|
||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||
if (it->name == catName)
|
||||
return it->id;
|
||||
|
||||
return wxT("0") ;
|
||||
}
|
||||
|
||||
wxString User::GetAccountName(wxString accountId)
|
||||
{
|
||||
std::vector<Account>::iterator it;
|
||||
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
||||
if (it->id == accountId)
|
||||
return it->name;
|
||||
|
||||
return _("Unknown") ;
|
||||
}
|
||||
|
||||
wxString User::GetAccountId(wxString accountName)
|
||||
{
|
||||
std::vector<Account>::iterator it;
|
||||
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
||||
if (it->name == accountName)
|
||||
return it->id;
|
||||
|
||||
return wxT("0") ;
|
||||
}
|
||||
|
||||
int User::GetCategoriesNumber()
|
||||
{
|
||||
return _categories.size();
|
||||
}
|
||||
|
||||
int User::GetAccountsNumber()
|
||||
{
|
||||
return _accounts.size();
|
||||
}
|
||||
|
||||
int User::GetOperationsNumber(int month, int year)
|
||||
{
|
||||
return (*_operations[year])[month].size();
|
||||
}
|
||||
Reference in New Issue
Block a user