Use new emacs indentation rules (4 spaces instead of tabs and braces position)~

This commit is contained in:
2010-08-26 21:28:15 +02:00
parent 4583dae912
commit ceb942e3ee
41 changed files with 3913 additions and 3913 deletions

View File

@@ -1,20 +1,20 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ACCOUNT_H
@@ -25,12 +25,12 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
#include <wx/wx.h>
class Account {
public:
wxString id;
wxString name;
wxString number;
bool shared;
bool _default;
public:
wxString id;
wxString name;
wxString number;
bool shared;
bool _default;
};
#endif

View File

@@ -1,20 +1,20 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CATEGORY_H
@@ -22,12 +22,12 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
class Category
{
public:
wxString id;
wxString parent;
wxString name;
wxColour color;
wxString font;
public:
wxString id;
wxString parent;
wxString name;
wxColour color;
wxString font;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,20 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_H
@@ -34,58 +34,58 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
class Database
{
public:
Database(const char* filename);
public:
Database(const char* filename);
std::list<wxString> GetUsers();
bool IsValidUser(const wxString& user, const wxString& password);
std::list<wxString> GetUsers();
bool IsValidUser(const wxString& user, const wxString& password);
User* LoadUser(const wxString& name);
void LoadYear(User* user, int year);
User* LoadUser(const wxString& name);
void LoadYear(User* user, int year);
void UpdateOperation(Operation& op);
wxString AddOperation(User* user, Operation& op);
void DeleteOperation(Operation& op);
void DeleteOperations(User* user, int month, int year);
double GetAccountAmount(const wxString& id, int month, int year);
void SetAccountAmount(int month, int year, const wxString& accountId, double amount);
void UpdateOperation(Operation& op);
wxString AddOperation(User* user, Operation& op);
void DeleteOperation(Operation& op);
void DeleteOperations(User* user, int month, int year);
double GetAccountAmount(const wxString& id, int month, int year);
void SetAccountAmount(int month, int year, const wxString& accountId, double amount);
wxString AddAccount(User* user, Account& ac);
void UpdateAccount(Account& ac);
void DeleteAccount(Account& ac);
wxString AddAccount(User* user, Account& ac);
void UpdateAccount(Account& ac);
void DeleteAccount(Account& ac);
wxString AddCategory(User* user, Category& category);
void UpdateCategory(Category& category);
void DeleteCategory(User* user, Category& category);
wxString AddCategory(User* user, Category& category);
void UpdateCategory(Category& category);
void DeleteCategory(User* user, Category& category);
std::map<int, std::vector<int> > GetAllOperations(User* user);
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
std::map<int, std::vector<int> > GetAllOperations(User* user);
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
void ChangePassword(User* user, const wxString& password);
bool UserExists(const wxString& name);
void ChangeName(User* user, const wxString& name);
void NewUser(const wxString& name);
void ChangePassword(User* user, const wxString& password);
bool UserExists(const wxString& name);
void ChangeName(User* user, const wxString& name);
void NewUser(const wxString& name);
void UpdatePreference(User* user, const wxString& preference);
void UpdatePreference(User* user, const wxString& preference);
std::vector<Operation>* Search(User* user, wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo,
wxString* amountFrom, wxString* amountTo,
std::vector<wxString> categories, std::vector<wxString> accounts);
std::vector<Operation>* Search(User* user, wxString* description, wxDateTime* dateFrom, wxDateTime* dateTo,
wxString* amountFrom, wxString* amountTo,
std::vector<wxString> categories, std::vector<wxString> accounts);
void GetStats(User* user, const wxString& monthFrom, const wxString& yearFrom, const wxString& monthTo,
const wxString& yearTo, std::map<wxString, std::map<int, std::map<int, double> > >* accountAmounts,
std::map<wxString, double>* categories);
void GetStats(User* user, const wxString& monthFrom, const wxString& yearFrom, const wxString& monthTo,
const wxString& yearTo, std::map<wxString, std::map<int, std::map<int, double> > >* accountAmounts,
std::map<wxString, double>* categories);
void KillMe(User* user);
bool GetOperation(const wxString& id, Operation* op);
std::map<wxString, double>* GetNotChecked(User* user, int month, int year);
void KillMe(User* user);
bool GetOperation(const wxString& id, Operation* op);
std::map<wxString, double>* GetNotChecked(User* user, int month, int year);
private:
wxSQLite3Database _db;
private:
wxSQLite3Database _db;
void CreateDatabase();
wxString HashPassword(const wxString& password);
void LinkOrUnlinkOperation(Operation& op);
void CreateDatabase();
wxString HashPassword(const wxString& password);
void LinkOrUnlinkOperation(Operation& op);
};
#endif

View File

@@ -1,40 +1,40 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPERATION_H
#define OPERATION_H
class Operation {
public:
wxString id;
wxString parent;
unsigned int day;
unsigned int month;
unsigned int year;
double amount;
wxString description;
wxString category;
bool fix_cost;
wxString account;
bool checked;
wxString transfert;
wxString formula;
public:
wxString id;
wxString parent;
unsigned int day;
unsigned int month;
unsigned int year;
double amount;
wxString description;
wxString category;
bool fix_cost;
wxString account;
bool checked;
wxString transfert;
wxString formula;
} ;
#endif

View File

@@ -1,150 +1,150 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#include "User.h"
User::~User()
{
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
for (it = _operations.begin(); it != _operations.end(); it++)
for (it = _operations.begin(); it != _operations.end(); it++)
{
if (_operations[it->first])
if (_operations[it->first])
{
delete it->second;
delete it->second;
}
}
}
Category User::GetCategory(wxString& catId)
{
Category cat;
std::vector<Category>::iterator it;
Category cat;
std::vector<Category>::iterator it;
for (it=_categories.begin(); it !=_categories.end(); it++)
if (it->id == catId)
return *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);
cat.id = wxT("0");
cat.parent = wxT("0");
cat.name = _("Unknown");
cat.font = wxT("");
cat.color = wxColour(0xFF, 0xFF, 0xFF);
return cat;
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;
std::vector<Category>::iterator it;
for (it=_categories.begin(); it !=_categories.end(); it++)
if (it->id == catId)
return it->name;
return _("Unknown") ;
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;
std::vector<Category>::iterator it;
for (it=_categories.begin(); it !=_categories.end(); it++)
if (it->name == catName)
return it->id;
return wxT("0") ;
return wxT("0") ;
}
wxString User::GetAccountName(const wxString& accountId)
{
std::vector<Account>::iterator it;
for (it=_accounts.begin(); it !=_accounts.end(); it++)
if (it->id == accountId)
return it->name;
std::vector<Account>::iterator it;
for (it=_accounts.begin(); it !=_accounts.end(); it++)
if (it->id == accountId)
return it->name;
return _("Unknown") ;
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;
std::vector<Account>::iterator it;
for (it=_accounts.begin(); it !=_accounts.end(); it++)
if (it->name == accountName)
return it->id;
return wxT("0") ;
return wxT("0") ;
}
int User::GetCategoriesNumber()
{
return _categories.size();
return _categories.size();
}
int User::GetAccountsNumber()
{
return _accounts.size();
return _accounts.size();
}
int User::GetOperationsNumber(int month, int year)
{
return (*_operations[year])[month].size();
return (*_operations[year])[month].size();
}
wxLanguage User::GetLanguage()
{
wxString res = _preferences[wxT("language")];
long val;
wxString res = _preferences[wxT("language")];
long val;
if (!res.Length())
return wxLANGUAGE_ENGLISH ;
if (!res.Length())
return wxLANGUAGE_ENGLISH ;
res.ToLong(&val);
res.ToLong(&val);
return (wxLanguage)val;
return (wxLanguage)val;
}
void User::LinkOrUnlinkOperation(Operation& op)
{
std::vector<Operation>::iterator it;
std::vector<Operation>::iterator it;
// Not Linked
if (!op.transfert.Length())
// Not Linked
if (!op.transfert.Length())
{
for (it = (*_operations[op.year])[op.month].begin(); it != (*_operations[op.year])[op.month].end(); it++)
for (it = (*_operations[op.year])[op.month].begin(); it != (*_operations[op.year])[op.month].end(); it++)
{
if (it->id != op.id && it->transfert == op.id)
if (it->id != op.id && it->transfert == op.id)
{
it->transfert = wxT("");
return;
it->transfert = wxT("");
return;
}
}
}
// Linked
else
// Linked
else
{
for (it = (*_operations[op.year])[op.month].begin(); it != (*_operations[op.year])[op.month].end(); it++)
for (it = (*_operations[op.year])[op.month].begin(); it != (*_operations[op.year])[op.month].end(); it++)
{
if (it->id != op.id && it->id == op.transfert)
if (it->id != op.id && it->id == op.transfert)
{
it->transfert = op.id;
return;
it->transfert = op.id;
return;
}
}
op.transfert = wxT("");
op.transfert = wxT("");
}
}

View File

@@ -1,20 +1,20 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef USER_H
@@ -31,27 +31,27 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
class User
{
public:
~User();
public:
~User();
wxString _id;
wxString _name;
wxString _password;
std::vector<Account> _accounts;
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* > _operations;
std::vector<Category> _categories;
std::map<wxString, wxString> _preferences;
wxString _id;
wxString _name;
wxString _password;
std::vector<Account> _accounts;
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* > _operations;
std::vector<Category> _categories;
std::map<wxString, wxString> _preferences;
Category GetCategory(wxString& catId);
wxString GetCategoryName(wxString& catId);
wxString GetCategoryId(wxString& catName);
wxString GetAccountName(const wxString& accountId);
wxString GetAccountId(wxString& accountName);
int GetCategoriesNumber();
int GetAccountsNumber();
int GetOperationsNumber(int month, int year);
wxLanguage GetLanguage();
void LinkOrUnlinkOperation(Operation& op);
Category GetCategory(wxString& catId);
wxString GetCategoryName(wxString& catId);
wxString GetCategoryId(wxString& catName);
wxString GetAccountName(const wxString& accountId);
wxString GetAccountId(wxString& accountName);
int GetCategoriesNumber();
int GetAccountsNumber();
int GetOperationsNumber(int month, int year);
wxLanguage GetLanguage();
void LinkOrUnlinkOperation(Operation& op);
};
#endif

View File

@@ -1,20 +1,20 @@
/*
Copyright 2010 Grégory Soutadé
Copyright 2010 Grégory Soutadé
This file is part of KissCount.
This file is part of KissCount.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
KissCount is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODEL_H