diff --git a/Makefile b/Makefile index bfcfbf8..b2e700d 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ OBJS=$(SOURCES:.cpp=.o) all: kc clean: - rm -f *.o model/*.o view/*.o controller/*.o kc + rm -f *~ *.o model/*.o model/*~ view/*.o view/*~ controller/*.o controller/*~ kc %.o : model/%.cpp view/%.cpp controller/%.cpp %.cpp $(CXX) $(CXXFLAGS) $< -c diff --git a/controller/KissCount.cpp b/controller/KissCount.cpp index 97805ed..0392ec4 100644 --- a/controller/KissCount.cpp +++ b/controller/KissCount.cpp @@ -2,7 +2,7 @@ KissCount::KissCount() : _user(NULL) { - _wxUI = new wxUI(this, _("KissCount"), wxPoint(50, 50), wxSize(1024, 768)); + _wxUI = new wxUI(this, wxT("KissCount"), wxPoint(50, 50), wxSize(1024, 768)); _wxUI->Show(true); _wxUI->Centre(); @@ -221,7 +221,7 @@ void KissCount::ChangeName(wxString name) void KissCount::NewUser(wxString name) { wxDateTime curDate; - struct Account ac = {_(""), _("Account 1"), _(""), false, true}; + struct Account ac = {wxT(""), wxT("Account 1"), wxT(""), false, true}; _db->NewUser(name); if (_user) delete _user; diff --git a/model/Account.cpp b/model/Account.cpp deleted file mode 100755 index b235d8d..0000000 --- a/model/Account.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Account.h" - - -Account::~Account() -{ - -} diff --git a/model/Account.h b/model/Account.h deleted file mode 100755 index 149fada..0000000 --- a/model/Account.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ACCOUNT_H -#define ACCOUNT_H - -#include -#include -#include - -class Account -{ -public: - ~Account(); - - wxString _id; - wxString _name; - wxString _number; - int _amount; - bool _shared; - bool _default; -}; - -#endif diff --git a/model/Database.cpp b/model/Database.cpp index 8d77fbf..6ad929a 100644 --- a/model/Database.cpp +++ b/model/Database.cpp @@ -46,8 +46,8 @@ static inline wxString DoubleToString(double d) { wxString res; - res = wxString::Format(_("%.2lf"), d); - res.Replace(_(","), _(".")); + res = wxString::Format(wxT("%.2lf"), d); + res.Replace(wxT(","), wxT(".")); return res; } @@ -63,7 +63,7 @@ Database::Database() CreateDatabase(); } else - _db.Open(_(BDD_FILE)); + _db.Open(wxT(BDD_FILE)); bdd_file.close(); } @@ -74,7 +74,7 @@ void Database::CreateDatabase() std::string line; wxString wxline; - wxMessageBox(_("No database found, creating a new one"), _("KissCount"), wxICON_EXCLAMATION | wxOK ); + wxMessageBox(_("No database found, creating a new one"), wxT("KissCount"), wxICON_EXCLAMATION | wxOK ); init_script.open(INIT_SCRIPT); @@ -84,14 +84,14 @@ void Database::CreateDatabase() throw "init.sql not found, aborting"; } - _db.Open(_(BDD_FILE)); + _db.Open(wxT(BDD_FILE)); do { getline(init_script, line); wxline = wxString(line.c_str(), wxConvUTF8); wxline.Trim(false); - if (!wxline.Length() || wxline.StartsWith(_("--"))) continue; + if (!wxline.Length() || wxline.StartsWith(wxT("--"))) continue; if (!_db.CheckSyntax(wxline)) { std::cout << line << " is invalid !\n" ; @@ -136,7 +136,7 @@ std::list Database::GetUsers() // Check whether value exists in table wxSQLite3ResultSet set ; - req = _("SELECT name FROM user ORDER BY name"); + req = wxT("SELECT name FROM user ORDER BY name"); EXECUTE_SQL_QUERY(req, set, res); while (set.NextRow()) @@ -154,7 +154,7 @@ bool Database::IsValidUser(wxString user, wxString password) wxString req; wxSQLite3ResultSet set; - req = _("SELECT name FROM user WHERE name='") + user + _("' AND password='") + HashPassword(password) + _("'"); + req = wxT("SELECT name FROM user WHERE name='") + user + wxT("' AND password='") + HashPassword(password) + wxT("'"); EXECUTE_SQL_QUERY(req, set, false); @@ -174,7 +174,7 @@ User* Database::LoadUser(wxString name) std::vector::iterator it; - req = _("SELECT * FROM user WHERE name='") + name + _("'"); + req = wxT("SELECT * FROM user WHERE name='") + name + wxT("'"); EXECUTE_SQL_QUERY(req, set, NULL); @@ -183,23 +183,23 @@ User* Database::LoadUser(wxString name) user = new User(); - user->_id = set.GetAsString(_("id")); - user->_name = set.GetAsString(_("name")); - user->_password = _("") ; // Security reasons set.GetAsString("password"); + user->_id = set.GetAsString(wxT("id")); + user->_name = set.GetAsString(wxT("name")); + user->_password = wxT("") ; // Security reasons set.GetAsString("password"); set.Finalize(); - req = _("SELECT * FROM account WHERE user='") + user->_id + _("' ORDER BY default_account DESC, name ASC"); + req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); while (set.NextRow()) { - account.id = set.GetAsString(_("id")); - account.name = set.GetAsString(_("name")); - account.number = set.GetAsString(_("number")); - account.shared = set.GetBool(_("shared")); - account._default = set.GetBool(_("default_account")); + account.id = set.GetAsString(wxT("id")); + account.name = set.GetAsString(wxT("name")); + account.number = set.GetAsString(wxT("number")); + account.shared = set.GetBool(wxT("shared")); + account._default = set.GetBool(wxT("default_account")); user->_accounts.push_back(account); } set.Finalize(); @@ -207,36 +207,36 @@ User* Database::LoadUser(wxString name) if (!user->_accounts.empty()) { it = user->_accounts.begin(); - req = _("SELECT DISTINCT year FROM operation WHERE account IN('") + it->id; + req = wxT("SELECT DISTINCT year FROM operation WHERE account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("'"); - req += _(" ORDER BY year ASC"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("'"); + req += wxT(" ORDER BY year ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); while (set.NextRow()) { - user->_operations[set.GetInt(_("year"))] = NULL; + user->_operations[set.GetInt(wxT("year"))] = NULL; } set.Finalize(); } - req = _("SELECT * FROM category WHERE user='") + user->_id + _("' ORDER BY name ASC"); + req = wxT("SELECT * FROM category WHERE user='") + user->_id + wxT("' ORDER BY name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); while (set.NextRow()) { - category.id = set.GetAsString(_("id")); - category.parent = set.GetAsString(_("parent")); - category.name = set.GetAsString(_("name")); - category.color = wxColour(set.GetAsString(_("color"))); - category.font = set.GetAsString(_("font")); - if (category.name != _("Fixe")) + category.id = set.GetAsString(wxT("id")); + category.parent = set.GetAsString(wxT("parent")); + category.name = set.GetAsString(wxT("name")); + category.color = wxColour(set.GetAsString(wxT("color"))); + category.font = set.GetAsString(wxT("font")); + if (category.name != wxT("Fixe")) user->_categories.push_back(category); else user->_categories.insert(user->_categories.begin(), category); @@ -244,11 +244,11 @@ User* Database::LoadUser(wxString name) set.Finalize(); - req = _("SELECT name, value FROM preference WHERE user='") + user->_id + _("' ORDER BY value ASC"); + req = wxT("SELECT name, value FROM preference WHERE user='") + user->_id + wxT("' ORDER BY value ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); while (set.NextRow()) - user->_preferences[set.GetAsString(_("name"))] = set.GetAsString(_("value")); + user->_preferences[set.GetAsString(wxT("name"))] = set.GetAsString(wxT("value")); set.Finalize(); @@ -267,32 +267,32 @@ void Database::LoadYear(User* user, int year) if (!user->_accounts.size()) return; it = user->_accounts.begin(); - req = _("SELECT * FROM operation WHERE (account IN('") + it->id; + req = wxT("SELECT * FROM operation WHERE (account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("')"); - req += _(" AND year='") + wxString::Format(_("%d"), year) + _("'"); - req += _(" ORDER BY fix_cost DESC, year,month,day ASC"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("')"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), year) + wxT("'"); + req += wxT(" ORDER BY fix_cost DESC, year,month,day ASC"); EXECUTE_SQL_QUERY(req, set, ); while (set.NextRow()) { operation op; - op.id = set.GetAsString(_("id")); - op.account = set.GetAsString(_("account")); - op.day = set.GetInt(_("day")); - op.month = set.GetInt(_("month")); - op.year = set.GetInt(_("year")); - op.amount = set.GetDouble(_("amount")); - op.description = set.GetAsString(_("description")); - op.category = set.GetAsString(_("category")); - op.fix_cost = set.GetBool(_("fix_cost")); - op.checked = set.GetBool(_("checked")); + op.id = set.GetAsString(wxT("id")); + op.account = set.GetAsString(wxT("account")); + op.day = set.GetInt(wxT("day")); + op.month = set.GetInt(wxT("month")); + op.year = set.GetInt(wxT("year")); + op.amount = set.GetDouble(wxT("amount")); + op.description = set.GetAsString(wxT("description")); + op.category = set.GetAsString(wxT("category")); + op.fix_cost = set.GetBool(wxT("fix_cost")); + op.checked = set.GetBool(wxT("checked")); (*user->_operations[op.year])[op.month].push_back(op); } @@ -305,15 +305,15 @@ double Database::GetAccountAmount(wxString id, int month, int year) wxString req; double res; - req = _("SELECT amount FROM account_amount WHERE account='") + id ; - req += _("' AND month='") + wxString::Format(_("%d"), month); - req += _("' AND year='") + wxString::Format(_("%d"), year); - req += _("'"); + req = wxT("SELECT amount FROM account_amount WHERE account='") + id ; + req += wxT("' AND month='") + wxString::Format(wxT("%d"), month); + req += wxT("' AND year='") + wxString::Format(wxT("%d"), year); + req += wxT("'"); EXECUTE_SQL_QUERY(req , set, 0.0); if (set.NextRow()) - res = set.GetDouble(_("amount")); + res = set.GetDouble(wxT("amount")); else { SetAccountAmount(month, year, id, 0.0); @@ -328,19 +328,19 @@ double Database::GetAccountAmount(wxString id, int month, int year) void Database::UpdateOperation(struct operation op) { wxString req; - req = _("UPDATE operation SET ") ; - req += _("account='") + op.account + _("'"); - req += _(", year='") + wxString::Format(_("%d"), op.year) + _("'"); - req += _(", month='") + wxString::Format(_("%d"), op.month) + _("'"); - req += _(", day='") + wxString::Format(_("%d"), op.day) + _("'"); - req += _(", amount='") + DoubleToString(op.amount) + _("'"); - req += _(", description=\"") + op.description + _("\""); - req += _(", category='") + op.category + _("'"); + req = wxT("UPDATE operation SET ") ; + req += wxT("account='") + op.account + wxT("'"); + req += wxT(", year='") + wxString::Format(wxT("%d"), op.year) + wxT("'"); + req += wxT(", month='") + wxString::Format(wxT("%d"), op.month) + wxT("'"); + req += wxT(", day='") + wxString::Format(wxT("%d"), op.day) + wxT("'"); + req += wxT(", amount='") + DoubleToString(op.amount) + wxT("'"); + req += wxT(", description=\"") + op.description + wxT("\""); + req += wxT(", category='") + op.category + wxT("'"); if (op.checked) - req += _(", checked='1'"); + req += wxT(", checked='1'"); else - req += _(", checked='0'"); - req += _(" WHERE id='") + op.id + _("'"); + req += wxT(", checked='0'"); + req += wxT(" WHERE id='") + op.id + wxT("'"); //std::cout << req.mb_str() << "\n"; EXECUTE_SQL_UPDATE(req, ); @@ -352,44 +352,44 @@ wxString Database::AddOperation(User* user, struct operation op) wxString req, res; wxSQLite3ResultSet set; - req = _("INSERT INTO operation ('user', 'account', 'year', 'month', 'day', 'amount', 'description', 'category', 'fix_cost') VALUES ('") ; - req += user->_id + _("'"); - req += _(", '") + op.account + _("'"); - req += _(", '") + wxString::Format(_("%d"), op.year) + _("'"); - req += _(", '") + wxString::Format(_("%d"), op.month) + _("'"); - req += _(", '") + wxString::Format(_("%d"), op.day) + _("'"); - req += _(", '") + DoubleToString(op.amount) + _("'"); - req += _(", \"") + op.description + _("\""); - req += _(", '") + op.category + _("'"); + req = wxT("INSERT INTO operation ('user', 'account', 'year', 'month', 'day', 'amount', 'description', 'category', 'fix_cost') VALUES ('") ; + req += user->_id + wxT("'"); + req += wxT(", '") + op.account + wxT("'"); + req += wxT(", '") + wxString::Format(wxT("%d"), op.year) + wxT("'"); + req += wxT(", '") + wxString::Format(wxT("%d"), op.month) + wxT("'"); + req += wxT(", '") + wxString::Format(wxT("%d"), op.day) + wxT("'"); + req += wxT(", '") + DoubleToString(op.amount) + wxT("'"); + req += wxT(", \"") + op.description + wxT("\""); + req += wxT(", '") + op.category + wxT("'"); if (op.fix_cost) - req += _(", '1'") ; + req += wxT(", '1'") ; else - req += _(", '0'") ; - req += _(")"); + req += wxT(", '0'") ; + req += wxT(")"); - EXECUTE_SQL_UPDATE(req, _("0")); + EXECUTE_SQL_UPDATE(req, wxT("0")); - req = _("SELECT id FROM operation WHERE "); - req += _("user='") + user->_id + _("'"); - req += _(" AND account='") + op.account + _("'"); - req += _(" AND year='") + wxString::Format(_("%d"), op.year) + _("'"); - req += _(" AND month='") + wxString::Format(_("%d"), op.month) + _("'"); - req += _(" AND day='") + wxString::Format(_("%d"), op.day) + _("'"); - req += _(" AND amount='") + DoubleToString(op.amount) + _("'"); - req += _(" AND description=\"") + op.description + _("\""); - req += _(" AND category='") + op.category + _("'"); + req = wxT("SELECT id FROM operation WHERE "); + req += wxT("user='") + user->_id + wxT("'"); + req += wxT(" AND account='") + op.account + wxT("'"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), op.year) + wxT("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), op.month) + wxT("'"); + req += wxT(" AND day='") + wxString::Format(wxT("%d"), op.day) + wxT("'"); + req += wxT(" AND amount='") + DoubleToString(op.amount) + wxT("'"); + req += wxT(" AND description=\"") + op.description + wxT("\""); + req += wxT(" AND category='") + op.category + wxT("'"); if (op.fix_cost) - req += _(" AND fix_cost='1'") ; + req += wxT(" AND fix_cost='1'") ; else - req += _(" AND fix_cost='0'") ; - req += _("ORDER BY ID DESC") ; + req += wxT(" AND fix_cost='0'") ; + req += wxT("ORDER BY ID DESC") ; - EXECUTE_SQL_QUERY(req , set, _("0")); + EXECUTE_SQL_QUERY(req , set, wxT("0")); if (set.NextRow()) - res = set.GetAsString(_("id")); + res = set.GetAsString(wxT("id")); else - res = _("0"); + res = wxT("0"); set.Finalize(); @@ -399,7 +399,7 @@ wxString Database::AddOperation(User* user, struct operation op) void Database::DeleteOperation(struct operation op) { wxString req; - req = _("DELETE FROM operation WHERE id='") + op.id + _("'"); + req = wxT("DELETE FROM operation WHERE id='") + op.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -410,31 +410,31 @@ void Database::DeleteOperations(User* user, int month, int year) std::vector::iterator it; it = user->_accounts.begin(); - req = _("DELETE FROM account_amount WHERE account IN('") + it->id; + req = wxT("DELETE FROM account_amount WHERE account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" AND year='") + wxString::Format(_("%d"), year) + _("'"); + req += wxT("')"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), year) + wxT("'"); if (month != -1) - req += _(" AND month='") + wxString::Format(_("%d"), month) + _("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), month) + wxT("'"); EXECUTE_SQL_UPDATE(req, ); it = user->_accounts.begin(); - req = _("DELETE FROM operation WHERE (account IN('") + it->id; + req = wxT("DELETE FROM operation WHERE (account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("')"); - req += _(" AND year='") + wxString::Format(_("%d"), year) + _("'"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("')"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), year) + wxT("'"); if (month != -1) - req += _(" AND month='") + wxString::Format(_("%d"), month) + _("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), month) + wxT("'"); EXECUTE_SQL_UPDATE(req, ); @@ -443,22 +443,22 @@ void Database::DeleteOperations(User* user, int month, int year) void Database::SetAccountAmount(int month, int year, wxString accountId, double amount) { wxString req; - req = _("UPDATE account_amount SET ") ; - req += _("amount='") + DoubleToString(amount) + _("'"); - req += _(" WHERE account='") + accountId + _("'"); - req += _(" AND year='") + wxString::Format(_("%d"), year) + _("'"); - req += _(" AND month='") + wxString::Format(_("%d"), month) + _("'"); + req = wxT("UPDATE account_amount SET ") ; + req += wxT("amount='") + DoubleToString(amount) + wxT("'"); + req += wxT(" WHERE account='") + accountId + wxT("'"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), year) + wxT("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), month) + wxT("'"); try { if (!_db.ExecuteUpdate(req)) { - req = _("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; - req += accountId + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), year) + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), month) + _("'"); - req += _(" ,'") + DoubleToString(amount) + _("'"); - req += _(")"); + req = wxT("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; + req += accountId + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), year) + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), month) + wxT("'"); + req += wxT(" ,'") + DoubleToString(amount) + wxT("'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); } } @@ -475,31 +475,31 @@ wxString Database::AddAccount(User* user, struct Account ac) wxString req, res; wxSQLite3ResultSet set; - req = _("INSERT INTO account ('user', 'name', 'number', 'shared', 'default_account') VALUES ('") ; - req += user->_id + _("'"); - req += _(", '") + ac.name + _("'"); - req += _(", '") + ac.number + _("'"); + req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'default_account') VALUES ('") ; + req += user->_id + wxT("'"); + req += wxT(", '") + ac.name + wxT("'"); + req += wxT(", '") + ac.number + wxT("'"); if (ac.shared) - req += _(", '1'") ; + req += wxT(", '1'") ; else - req += _(", '0'") ; + req += wxT(", '0'") ; if (ac._default) - req += _(", '1'") ; + req += wxT(", '1'") ; else - req += _(", '0'") ; - req += _(")"); + req += wxT(", '0'") ; + req += wxT(")"); - EXECUTE_SQL_UPDATE(req, _("0")); + EXECUTE_SQL_UPDATE(req, wxT("0")); - req = _("SELECT id FROM account WHERE name='") + ac.name + _("'") ; - req += _("AND user='") + user->_id + _("'"); + req = wxT("SELECT id FROM account WHERE name='") + ac.name + wxT("'") ; + req += wxT("AND user='") + user->_id + wxT("'"); - EXECUTE_SQL_QUERY(req , set, _("0")); + EXECUTE_SQL_QUERY(req , set, wxT("0")); if (set.NextRow()) - res = set.GetAsString(_("id")); + res = set.GetAsString(wxT("id")); else - res = _("0"); + res = wxT("0"); set.Finalize(); @@ -509,18 +509,18 @@ wxString Database::AddAccount(User* user, struct Account ac) void Database::UpdateAccount(struct Account ac) { wxString req; - req = _("UPDATE account SET ") ; - req += _("name='") + ac.name + _("'"); - req += _(", number='") + ac.number + _("'"); + req = wxT("UPDATE account SET ") ; + req += wxT("name='") + ac.name + wxT("'"); + req += wxT(", number='") + ac.number + wxT("'"); if (ac.shared) - req += _(", shared='1'"); + req += wxT(", shared='1'"); else - req += _(", shared='0'"); + req += wxT(", shared='0'"); if (ac._default) - req += _(", default_account='1'"); + req += wxT(", default_account='1'"); else - req += _(", default_account='0'"); - req += _(" WHERE id='") + ac.id + _("'"); + req += wxT(", default_account='0'"); + req += wxT(" WHERE id='") + ac.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -528,7 +528,7 @@ void Database::UpdateAccount(struct Account ac) void Database::DeleteAccount(struct Account ac) { wxString req; - req = _("DELETE FROM account WHERE id='") + ac.id + _("'"); + req = wxT("DELETE FROM account WHERE id='") + ac.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -539,30 +539,30 @@ wxString Database::AddCategory(User* user, struct category category) wxSQLite3ResultSet set; wxString color; - color = _("#") ; - color += wxString::Format(_("%02X"), category.color.Red()); - color += wxString::Format(_("%02X"), category.color.Green()); - color += wxString::Format(_("%02X"), category.color.Blue()); + color = wxT("#") ; + color += wxString::Format(wxT("%02X"), category.color.Red()); + color += wxString::Format(wxT("%02X"), category.color.Green()); + color += wxString::Format(wxT("%02X"), category.color.Blue()); - req = _("INSERT INTO category ('user', 'parent', 'name', 'color', font) VALUES ('") ; - req += user->_id + _("'"); - req += _(", '") + category.parent + _("'"); - req += _(", '") + category.name + _("'"); - req += _(", '") + color + _("'"); - req += _(", '") + category.font + _("'"); - req += _(")"); + req = wxT("INSERT INTO category ('user', 'parent', 'name', 'color', font) VALUES ('") ; + req += user->_id + wxT("'"); + req += wxT(", '") + category.parent + wxT("'"); + req += wxT(", '") + category.name + wxT("'"); + req += wxT(", '") + color + wxT("'"); + req += wxT(", '") + category.font + wxT("'"); + req += wxT(")"); - EXECUTE_SQL_UPDATE(req, _("0")); + EXECUTE_SQL_UPDATE(req, wxT("0")); - req = _("SELECT id FROM preference WHERE user='") + user->_id + _("'") ; - req += _(" AND name='") + category.name + _("'"); + req = wxT("SELECT id FROM preference WHERE user='") + user->_id + wxT("'") ; + req += wxT(" AND name='") + category.name + wxT("'"); - EXECUTE_SQL_QUERY(req , set, _("0")); + EXECUTE_SQL_QUERY(req , set, wxT("0")); if (set.NextRow()) - res = set.GetAsString(_("id")); + res = set.GetAsString(wxT("id")); else - res = _("0"); + res = wxT("0"); set.Finalize(); @@ -574,17 +574,17 @@ void Database::UpdateCategory(struct category category) wxString req; wxString color; - color = _("#") ; - color += wxString::Format(_("%02X"), category.color.Red()); - color += wxString::Format(_("%02X"), category.color.Green()); - color += wxString::Format(_("%02X"), category.color.Blue()); + color = wxT("#") ; + color += wxString::Format(wxT("%02X"), category.color.Red()); + color += wxString::Format(wxT("%02X"), category.color.Green()); + color += wxString::Format(wxT("%02X"), category.color.Blue()); - req = _("UPDATE category SET") ; - req += _(" parent='") + category.parent + _("'"); - req += _(", name='") + category.name + _("'"); - req += _(", color='") + color + _("'"); - req += _(", font='") + category.font + _("'"); - req += _(" WHERE id='") + category.id + _("'"); + req = wxT("UPDATE category SET") ; + req += wxT(" parent='") + category.parent + wxT("'"); + req += wxT(", name='") + category.name + wxT("'"); + req += wxT(", color='") + color + wxT("'"); + req += wxT(", font='") + category.font + wxT("'"); + req += wxT(" WHERE id='") + category.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -593,13 +593,13 @@ void Database::DeleteCategory(User* user, struct category category) { wxString req; - req = _("DELETE FROM category WHERE id='") + category.id + _("'"); + req = wxT("DELETE FROM category WHERE id='") + category.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); - req = _("UPDATE category SET") ; - req += _(" parent='0'"); - req += _(" WHERE parent='") + category.id + _("'"); + req = wxT("UPDATE category SET") ; + req += wxT(" parent='0'"); + req += wxT(" WHERE parent='") + category.id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -615,39 +615,39 @@ std::map > Database::GetAllOperations(User* user) if (!user->_accounts.empty()) { it = user->_accounts.begin(); - req = _("SELECT DISTINCT year FROM operation WHERE account IN('") + it->id; + req = wxT("SELECT DISTINCT year FROM operation WHERE account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("'"); - req += _(" ORDER BY year ASC"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("'"); + req += wxT(" ORDER BY year ASC"); EXECUTE_SQL_QUERY(req, set, res); while (set.NextRow()) { - year = set.GetInt(_("year")); + year = set.GetInt(wxT("year")); it = user->_accounts.begin(); - req = _("SELECT DISTINCT month FROM operation WHERE (account IN('") + it->id; + req = wxT("SELECT DISTINCT month FROM operation WHERE (account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("')"); - req += _(" AND year='") + set.GetAsString(_("year")) + _("'"); - req += _(" ORDER BY month ASC"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("')"); + req += wxT(" AND year='") + set.GetAsString(wxT("year")) + wxT("'"); + req += wxT(" ORDER BY month ASC"); EXECUTE_SQL_QUERY(req, set2, res); while (set2.NextRow()) { - res[year].push_back(set2.GetInt(_("month"))); + res[year].push_back(set2.GetInt(wxT("month"))); } set2.Finalize(); } @@ -668,12 +668,12 @@ void Database::GenerateMonth(User* user, int monthFrom, int yearFrom, int monthT { for (it = user->_accounts.begin(); it != user->_accounts.end(); it++) { - req = _("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; - req += it->id + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), yearTo) + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), monthTo) + _("'"); - req += _(" ,'0.0'"); - req += _(")"); + req = wxT("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; + req += it->id + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), yearTo) + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), monthTo) + wxT("'"); + req += wxT(" ,'0.0'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); } @@ -683,32 +683,32 @@ void Database::GenerateMonth(User* user, int monthFrom, int yearFrom, int monthT for (it = user->_accounts.begin(); it != user->_accounts.end(); it++) { amount = 0.0; - req = _("SELECT amount FROM operation WHERE") ; - req += _(" account='") + it->id + _("'"); - req += _(" AND year='") + wxString::Format(_("%d"), yearFrom) + _("'"); - req += _(" AND month='") + wxString::Format(_("%d"), monthFrom) + _("'"); + req = wxT("SELECT amount FROM operation WHERE") ; + req += wxT(" account='") + it->id + wxT("'"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), yearFrom) + wxT("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), monthFrom) + wxT("'"); EXECUTE_SQL_QUERY(req, set, ); while (set.NextRow()) - amount += set.GetDouble(_("amount")); + amount += set.GetDouble(wxT("amount")); - req = _("SELECT amount FROM account_amount WHERE") ; - req += _(" account='") + it->id + _("'"); - req += _(" AND year='") + wxString::Format(_("%d"), yearFrom) + _("'"); - req += _(" AND month='") + wxString::Format(_("%d"), monthFrom) + _("'"); + req = wxT("SELECT amount FROM account_amount WHERE") ; + req += wxT(" account='") + it->id + wxT("'"); + req += wxT(" AND year='") + wxString::Format(wxT("%d"), yearFrom) + wxT("'"); + req += wxT(" AND month='") + wxString::Format(wxT("%d"), monthFrom) + wxT("'"); EXECUTE_SQL_QUERY(req, set, ); if (set.NextRow()) - amount += set.GetDouble(_("amount")); + amount += set.GetDouble(wxT("amount")); - req = _("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; - req += it->id + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), yearTo) + _("'"); - req += _(" ,'") + wxString::Format(_("%d"), monthTo) + _("'"); - req += _(" ,'") + DoubleToString(amount) + _("'"); - req += _(")"); + req = wxT("INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('") ; + req += it->id + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), yearTo) + wxT("'"); + req += wxT(" ,'") + wxString::Format(wxT("%d"), monthTo) + wxT("'"); + req += wxT(" ,'") + DoubleToString(amount) + wxT("'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); } @@ -718,9 +718,9 @@ void Database::ChangePassword(User* user, wxString password) { wxString req; - req = _("UPDATE user SET ") ; - req += _("password='") + HashPassword(password) + _("'"); - req += _(" WHERE name='") + user->_name + _("'"); + req = wxT("UPDATE user SET ") ; + req += wxT("password='") + HashPassword(password) + wxT("'"); + req += wxT(" WHERE name='") + user->_name + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -731,7 +731,7 @@ bool Database::UserExists(wxString name) wxString req; bool res=false; - req = _("SELECT name FROM user WHERE name='") + name + _("'") ; + req = wxT("SELECT name FROM user WHERE name='") + name + wxT("'") ; EXECUTE_SQL_QUERY(req , set, false); @@ -749,9 +749,9 @@ void Database::ChangeName(User* user, wxString name) { wxString req; - req = _("UPDATE user SET ") ; - req += _("name='") + name + _("'"); - req += _(" WHERE name='") + user->_name + _("'"); + req = wxT("UPDATE user SET ") ; + req += wxT("name='") + name + wxT("'"); + req += wxT(" WHERE name='") + user->_name + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } @@ -761,53 +761,53 @@ void Database::NewUser(wxString name) wxString req, id; wxSQLite3ResultSet set; - req = _("INSERT INTO user ('name', 'password') VALUES ('") ; - req += name + _("'"); - req += _(", '") + HashPassword(_("")) + _("'"); - req += _(")"); + req = wxT("INSERT INTO user ('name', 'password') VALUES ('") ; + req += name + wxT("'"); + req += wxT(", '") + HashPassword(wxT("")) + wxT("'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); - req = _("SELECT id FROM user WHERE "); - req += _("name='") + name + _("'"); + req = wxT("SELECT id FROM user WHERE "); + req += wxT("name='") + name + wxT("'"); EXECUTE_SQL_QUERY(req , set, ); set.NextRow(); - id = set.GetAsString(_("id")); + id = set.GetAsString(wxT("id")); set.Finalize(); - req = _("SELECT * FROM default_preference"); + req = wxT("SELECT * FROM default_preference"); EXECUTE_SQL_QUERY(req, set,); while (set.NextRow()) { - req = _("INSERT INTO preference ('user', 'name', 'value') VALUES ('") ; - req += id + _("'"); - req += _(", '") + set.GetAsString(_("type")) + _("'"); - req += _(", '") + set.GetAsString(_("value")) + _("'"); - req += _(")"); + req = wxT("INSERT INTO preference ('user', 'name', 'value') VALUES ('") ; + req += id + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("type")) + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("value")) + wxT("'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); } set.Finalize(); - req = _("SELECT * FROM default_category"); + req = wxT("SELECT * FROM default_category"); EXECUTE_SQL_QUERY(req, set,); while (set.NextRow()) { - req = _("INSERT INTO category ('user', 'parent', 'name', 'color', 'font') VALUES ('") ; - req += id + _("'"); - req += _(", '") + set.GetAsString(_("parent")) + _("'"); - req += _(", '") + set.GetAsString(_("name")) + _("'"); - req += _(", '") + set.GetAsString(_("color")) + _("'"); - req += _(", '") + set.GetAsString(_("font")) + _("'"); - req += _(")"); + req = wxT("INSERT INTO category ('user', 'parent', 'name', 'color', 'font') VALUES ('") ; + req += id + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("parent")) + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("name")) + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("color")) + wxT("'"); + req += wxT(", '") + set.GetAsString(wxT("font")) + wxT("'"); + req += wxT(")"); EXECUTE_SQL_UPDATE(req, ); } @@ -825,41 +825,41 @@ void Database::KillMe(User* user) wxString req; std::vector::iterator it; - req = _("DELETE FROM preference WHERE user='") + user->_id + _("'"); + req = wxT("DELETE FROM preference WHERE user='") + user->_id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); if (!user->_accounts.empty()) { it = user->_accounts.begin(); - req = _("DELETE FROM account_amount WHERE account IN('") + it->id; + req = wxT("DELETE FROM account_amount WHERE account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); + req += wxT("')"); EXECUTE_SQL_UPDATE(req, ); it = user->_accounts.begin(); - req = _("DELETE FROM operation WHERE account IN('") + it->id; + req = wxT("DELETE FROM operation WHERE account IN('") + it->id; it++; for (;it != user->_accounts.end(); it++) { - req += _("', '") + it->id ; + req += wxT("', '") + it->id ; } - req += _("')"); - req += _(" OR user='") + user->_id + _("')"); + req += wxT("')"); + req += wxT(" OR user='") + user->_id + wxT("')"); EXECUTE_SQL_UPDATE(req, ); } - req = _("DELETE FROM account WHERE user='") + user->_id + _("'"); + req = wxT("DELETE FROM account WHERE user='") + user->_id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); - req = _("DELETE FROM category WHERE user='") + user->_id + _("'"); + req = wxT("DELETE FROM category WHERE user='") + user->_id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); - req = _("DELETE FROM user WHERE id='") + user->_id + _("'"); + req = wxT("DELETE FROM user WHERE id='") + user->_id + wxT("'"); EXECUTE_SQL_UPDATE(req, ); } diff --git a/model/User.cpp b/model/User.cpp index a5cdb58..95f9eb0 100644 --- a/model/User.cpp +++ b/model/User.cpp @@ -23,10 +23,10 @@ struct category User::GetCategory(wxString catId) if (it->id == catId) return *it; - cat.id = _("0"); - cat.parent = _("0"); + cat.id = wxT("0"); + cat.parent = wxT("0"); cat.name = _("Unknown"); - cat.font = _(""); + cat.font = wxT(""); cat.color = wxColour(0xFF, 0xFF, 0xFF); return cat; @@ -49,7 +49,7 @@ wxString User::GetCategoryId(wxString catName) if (it->name == catName) return it->id; - return _("0") ; + return wxT("0") ; } wxString User::GetAccountName(wxString accountId) @@ -69,7 +69,7 @@ wxString User::GetAccountId(wxString accountName) if (it->name == accountName) return it->id; - return _("0") ; + return wxT("0") ; } int User::GetCategoriesNumber() diff --git a/model/model.h b/model/model.h index 43aae4a..3600e49 100644 --- a/model/model.h +++ b/model/model.h @@ -2,7 +2,6 @@ #define MODEL_H #include "User.h" -#include "Preferences.h" #include "Database.h" #endif diff --git a/view/AccountPanel.cpp b/view/AccountPanel.cpp index 1d22dd5..4c6b25c 100644 --- a/view/AccountPanel.cpp +++ b/view/AccountPanel.cpp @@ -43,7 +43,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(* wxColour(0xFF, 0x93, 0x0E), wxColour(0xC5, 0x00, 0x0D), wxColour(0x00, 0x84, 0xD1)}; - wxBitmap bitmap(_(DELETE_ICON)); + wxBitmap bitmap(wxT(DELETE_ICON)); SetSizer(hbox); @@ -217,7 +217,7 @@ void AccountPanel::ChangeUser() InitStatsGrid(user); _tree.DeleteAllItems(); - rootNode = _tree.AddRoot(_("")); + rootNode = _tree.AddRoot(wxT("")); curDate.SetToCurrent(); for(it = user->_operations.begin(); it != user->_operations.end(); it++) @@ -328,7 +328,7 @@ void AccountPanel::ShowMonth(int month, int year) _curYear = year; _curMonth = month; - _wxUI->SetTitle(user->_name + _(" - ") + months[month] + _(" ") + wxString::Format(wxT("%d"), year)); + _wxUI->SetTitle(user->_name + wxT(" - ") + months[month] + wxT(" ") + wxString::Format(wxT("%d"), year)); _calendar->Enable(true); if (_grid->GetNumberRows() > 1) @@ -427,7 +427,7 @@ void AccountPanel::InsertOperation(User* user, operation* op, int line, bool fix g = ((color.Green()*1.5) >= 0xFF) ? 0xFF : color.Green()*1.5 ; b = ((color.Blue()*1.5) >= 0xFF) ? 0xFF : color.Blue()*1.5 ; color.Set(r, g, b, color.Alpha()); - _grid->SetCellValue(line, CHECKED, _("1")); + _grid->SetCellValue(line, CHECKED, wxT("1")); } SET_ROW_COLOR(line, color); @@ -600,21 +600,21 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) inModification = true ; if (event.GetCol() == DEBIT) - _grid->SetCellValue(event.GetRow(), CREDIT, _("")); + _grid->SetCellValue(event.GetRow(), CREDIT, wxT("")); else if (event.GetCol() == CREDIT) - _grid->SetCellValue(event.GetRow(), DEBIT, _("")); + _grid->SetCellValue(event.GetRow(), DEBIT, wxT("")); value = _grid->GetCellValue(event.GetRow(), DESCRIPTION); - if (value != _("")) + if (value != wxT("")) { new_op.description = value; op_complete--; } value = _grid->GetCellValue(event.GetRow(), DATE); - if (value != _("")) + if (value != wxT("")) { - date.ParseFormat(value, _("%d/%m/%Y")); + date.ParseFormat(value, wxT("%d/%m/%Y")); new_op.day = date.GetDay()-1; new_op.month = date.GetMonth(); new_op.year = date.GetYear(); @@ -622,7 +622,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) } value = _grid->GetCellValue(event.GetRow(), DEBIT); - if (value != _("")) + if (value != wxT("")) { value.ToDouble(&new_op.amount); new_op.amount *= -1.0; @@ -630,28 +630,28 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) } value = _grid->GetCellValue(event.GetRow(), CREDIT); - if (value != _("")) + if (value != wxT("")) { value.ToDouble(&new_op.amount); op_complete--; } value = _grid->GetCellValue(event.GetRow(), CATEGORY); - if (value != _("")) + if (value != wxT("")) { new_op.category = user->GetCategoryId(value); op_complete--; } value = _grid->GetCellValue(event.GetRow(), ACCOUNT); - if (value != _("")) + if (value != wxT("")) { new_op.account = user->GetAccountId(value); op_complete--; } value = _grid->GetCellValue(event.GetRow(), CHECKED); - if (value != _("") && value != _("0")) + if (value != wxT("") && value != wxT("0")) new_op.checked = true; else new_op.checked = false; @@ -674,10 +674,10 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) if (col == DELETE) { - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_op.description, _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_op.description, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { - _grid->SetCellValue(event.GetRow(), event.GetCol(), _("0")); + _grid->SetCellValue(event.GetRow(), event.GetCol(), wxT("0")); inModification = false; return; } @@ -728,7 +728,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) for(i=0; iSetCellValue(event.GetRow(), i, _("")); + _grid->SetCellValue(event.GetRow(), i, wxT("")); } new_op.id = _kiss->AddOperation(new_op); } @@ -774,7 +774,7 @@ void AccountPanel::OnOperationModified(wxGridEvent& event) for(i=0; iSetCellValue(event.GetRow(), i, _("")); + _grid->SetCellValue(event.GetRow(), i, wxT("")); } new_op.id = _kiss->AddOperation(new_op); } @@ -958,12 +958,12 @@ void AccountPanel::OnMenuDelete(wxCommandEvent& event) message = _("Are you sure want to delete "); if (month != -1) - message += months[month] + _(" "); - message += wxString::Format(_("%d"), year); + message += months[month] + wxT(" "); + message += wxString::Format(wxT("%d"), year); message += _(" operations ?"); - wxMessageDialog dialog(_wxUI, message, _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, message, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) return; @@ -1063,7 +1063,7 @@ void AccountPanel::GenerateMonth(int month, int year) void AccountPanel::OnShow(wxShowEvent& event) { if (_curMonth != -1) - _wxUI->SetTitle(_kiss->GetUser()->_name + _(" - ") + months[_curMonth] + _(" ") + wxString::Format(wxT("%d"), _curYear)); + _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear)); else _wxUI->SetTitle(_kiss->GetUser()->_name); } diff --git a/view/AccountPanel.h b/view/AccountPanel.h index cc83a74..ef86797 100644 --- a/view/AccountPanel.h +++ b/view/AccountPanel.h @@ -14,7 +14,7 @@ #define OWN_YELLOW wxColour(0xFF, 0xFF, 0x99) #define OWN_GREEN wxColour(0x3D, 0xEB, 0x3D) -#define DEFAULT_FONT_NAME _("Liberation Sans") +#define DEFAULT_FONT_NAME wxT("Liberation Sans") #define DEFAULT_FONT_SIZE 12 #define DEFAULT_FONT(font_name) wxFont font_name(DEFAULT_FONT_SIZE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, DEFAULT_FONT_NAME); diff --git a/view/ButtonPanel.cpp b/view/ButtonPanel.cpp index c8a460c..beda9c7 100644 --- a/view/ButtonPanel.cpp +++ b/view/ButtonPanel.cpp @@ -11,10 +11,10 @@ END_EVENT_TABLE() ButtonPanel::ButtonPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent) { wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); - _account = new wxBitmapButton(this, ID_BUTTON_ACCOUNT, wxBitmap(_(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128)); - _stats = new wxBitmapButton(this, ID_BUTTON_STATS, wxBitmap(_(STATS_ICON)), wxDefaultPosition, wxSize(128, 128)); - _prefs = new wxBitmapButton(this, ID_BUTTON_PREFS, wxBitmap(_(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128)); - _changeUser = new wxBitmapButton(this, ID_BUTTON_CHANGE_USER, wxBitmap(_(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128)); + _account = new wxBitmapButton(this, ID_BUTTON_ACCOUNT, wxBitmap(wxT(ACCOUNT_ICON)), wxDefaultPosition, wxSize(128, 128)); + _stats = new wxBitmapButton(this, ID_BUTTON_STATS, wxBitmap(wxT(STATS_ICON)), wxDefaultPosition, wxSize(128, 128)); + _prefs = new wxBitmapButton(this, ID_BUTTON_PREFS, wxBitmap(wxT(PREFS_ICON)), wxDefaultPosition, wxSize(128, 128)); + _changeUser = new wxBitmapButton(this, ID_BUTTON_CHANGE_USER, wxBitmap(wxT(CHANGE_USER_ICON)), wxDefaultPosition, wxSize(128, 128)); SetSizer(hbox); diff --git a/view/CalendarEditor.cpp b/view/CalendarEditor.cpp index dfba033..164c99a 100644 --- a/view/CalendarEditor.cpp +++ b/view/CalendarEditor.cpp @@ -10,7 +10,7 @@ CalendarEditor::CalendarEditor(int day, int month, int year) : _day(day), _month _days = new wxString[_maxDay]; for (i=0; i<_maxDay; i++) - _days[i] = wxString::Format(_("%d"), i+1) ; + _days[i] = wxString::Format(wxT("%d"), i+1) ; _editor = new wxChoice(); } @@ -27,7 +27,7 @@ void CalendarEditor::BeginEdit(int row, int col, wxGrid *grid) // if (!grid->GetCellValue(row, col).Len()) return; - // if (date.ParseFormat(grid->GetCellValue(row, col), _("%d/%m/%Y"), dateDef)) + // if (date.ParseFormat(grid->GetCellValue(row, col), wxT("%d/%m/%Y"), dateDef)) // _calendar->SetDate(wxDateTime(_day, _month, _year)); } diff --git a/view/GenerateDialog.cpp b/view/GenerateDialog.cpp index a10f8d2..b96285d 100644 --- a/view/GenerateDialog.cpp +++ b/view/GenerateDialog.cpp @@ -44,12 +44,12 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea _ops = _kiss->GetAllOperations(); - _yearFrom->Append(_("")); - _monthFrom->Append(_("")); + _yearFrom->Append(wxT("")); + _monthFrom->Append(wxT("")); for(i=1, it = _ops.begin(); it != _ops.end(); it++, i++) { - _yearFrom->Append(wxString::Format(_("%d"), it->first)); + _yearFrom->Append(wxString::Format(wxT("%d"), it->first)); if (year == it->first) toSelect = i; } @@ -79,7 +79,7 @@ GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int yea } for(i=2000; i<=2050; i++) - _yearTo->Append(wxString::Format(_("%d"), i)); + _yearTo->Append(wxString::Format(wxT("%d"), i)); if (year == -1) { @@ -127,9 +127,9 @@ void GenerateDialog::OnYearFromChange(wxCommandEvent& event) _monthFrom->Clear(); - if (years == _("")) + if (years == wxT("")) { - _monthFrom->Append(_("")); + _monthFrom->Append(wxT("")); return; } @@ -174,7 +174,7 @@ void GenerateDialog::OnOK(wxCommandEvent& event) { int monthFrom, yearFrom, monthTo, yearTo, i; - if (_yearFrom->GetString(_yearFrom->GetCurrentSelection()) == _("")) + if (_yearFrom->GetString(_yearFrom->GetCurrentSelection()) == wxT("")) { monthFrom = -1; yearFrom = -1; diff --git a/view/PasswordDialog.cpp b/view/PasswordDialog.cpp index c6a1977..51b126c 100644 --- a/view/PasswordDialog.cpp +++ b/view/PasswordDialog.cpp @@ -62,7 +62,7 @@ void PasswordDialog::OnOK(wxCommandEvent& event) _kiss->ChangePassword(_newPassword->GetLineText(0)); - wxMessageBox(_("Password changed"), _("KissCount"), wxICON_INFORMATION | wxOK); + wxMessageBox(_("Password changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK); Close(); } diff --git a/view/PreferencesPanel.cpp b/view/PreferencesPanel.cpp index 141b1d4..43782db 100644 --- a/view/PreferencesPanel.cpp +++ b/view/PreferencesPanel.cpp @@ -112,8 +112,8 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolEditor ()); _accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); - _accountsGrid->SetCellValue(curLine, ACCOUNT_SHARED, (it->shared)?_("1"):_("0")); - _accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?_("1"):_("0")); + _accountsGrid->SetCellValue(curLine, ACCOUNT_SHARED, (it->shared)?wxT("1"):wxT("0")); + _accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?wxT("1"):wxT("0")); _accountsGrid->SetCellAlignment(curLine, ACCOUNT_SHARED, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); @@ -192,27 +192,27 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) inModification = true; value = _accountsGrid->GetCellValue(row, ACCOUNT_NAME); - if (value != _("")) + if (value != wxT("")) { new_account.name = value; op_complete--; } value = _accountsGrid->GetCellValue(row, ACCOUNT_NUMBER); - if (value != _("")) + if (value != wxT("")) { new_account.number = value; op_complete--; } value = _accountsGrid->GetCellValue(row, ACCOUNT_SHARED); - if (value != _("") && value != _("0")) + if (value != wxT("") && value != wxT("0")) new_account.shared = true; else new_account.shared = false; value = _accountsGrid->GetCellValue(row, ACCOUNT_DEFAULT); - if (value != _("") && value != _("0")) + if (value != wxT("") && value != wxT("0")) new_account._default = true; else new_account._default = false; @@ -230,7 +230,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) { account._default = false; _kiss->UpdateAccount(account); - _accountsGrid->SetCellValue(i, ACCOUNT_DEFAULT, _("")); + _accountsGrid->SetCellValue(i, ACCOUNT_DEFAULT, wxT("")); break; } } @@ -249,13 +249,13 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) if (user->_accounts.size() == 1) { wxMessageBox(_("It must be at least one account !"), _("Error"), wxICON_ERROR | wxOK); - _accountsGrid->SetCellValue(row, col, _("0")); + _accountsGrid->SetCellValue(row, col, wxT("0")); return; } - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+new_account.name, _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+new_account.name, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { - _accountsGrid->SetCellValue(row, col, _("0")); + _accountsGrid->SetCellValue(row, col, wxT("0")); } else { @@ -279,7 +279,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) return ; } - if (user->GetAccountId(new_account.name) != _("0")) + if (user->GetAccountId(new_account.name) != wxT("0")) { wxMessageBox(_("Account ")+new_account.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK ); inModification = false; @@ -303,7 +303,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) if (!user->GetAccountsNumber()) { new_account._default = true; - _accountsGrid->SetCellValue(row, ACCOUNT_DEFAULT, _("1")); + _accountsGrid->SetCellValue(row, ACCOUNT_DEFAULT, wxT("1")); } _accountsGrid->AutoSizeColumns(true); @@ -336,15 +336,15 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) inModification = true; value = _categoriesGrid->GetCellValue(row, CATEGORY_NAME); - if (value != _("")) + if (value != wxT("")) { new_cat.name = value; op_complete--; } new_cat.color = _categoriesGrid->GetCellBackgroundColour(row, col); - new_cat.font = _(""); - new_cat.parent = _("0"); + new_cat.font = wxT(""); + new_cat.parent = wxT("0"); // Categories modification if (user->GetCategoriesNumber() && row < user->GetCategoriesNumber()) @@ -352,10 +352,10 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) new_cat.id = user->_categories[row].id; if (col == CATEGORY_DELETE) { - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_cat.name, _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, _("Are you sure want to delete : \n")+new_cat.name, wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { - _categoriesGrid->SetCellValue(row, col, _("0")); + _categoriesGrid->SetCellValue(row, col, wxT("0")); } else { @@ -379,7 +379,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) return ; } - if (user->GetCategoryId(new_cat.name) != _("0")) + if (user->GetCategoryId(new_cat.name) != wxT("0")) { wxMessageBox(_("Category ")+new_cat.name+_(" already exists"), _("Error"), wxICON_ERROR | wxOK ); inModification = false; @@ -433,9 +433,9 @@ void PreferencesPanel::OnChangeName(wxCommandEvent& event) _kiss->ChangeName(name); - wxMessageBox(_("Name changed"), _("KissCount"), wxICON_INFORMATION | wxOK); + wxMessageBox(_("Name changed"), wxT("KissCount"), wxICON_INFORMATION | wxOK); _wxUI->NeedReload(); - _wxUI->SetTitle(_kiss->GetUser()->_name + _(" - ") +_("Preferences")); + _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") +_("Preferences")); } void PreferencesPanel::OnChangePassword(wxCommandEvent& event) @@ -453,7 +453,7 @@ void PreferencesPanel::OnKillMe(wxCommandEvent& event) { User* user = _kiss->GetUser(); - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" profil ?"), _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" profil ?"), wxT("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { return; diff --git a/view/UsersDialog.cpp b/view/UsersDialog.cpp index 9152918..8098eba 100644 --- a/view/UsersDialog.cpp +++ b/view/UsersDialog.cpp @@ -77,7 +77,7 @@ void UsersDialog::OnCancel(wxCommandEvent& event) void UsersDialog::OnNewUser(wxCommandEvent& event) { wxString name; - wxTextEntryDialog u(this, _(""), _("New User")); + wxTextEntryDialog u(this, wxT(""), _("New User")); if (u.ShowModal() == wxID_CANCEL) return; diff --git a/view/wxUI.cpp b/view/wxUI.cpp index 744e428..7f98aa5 100644 --- a/view/wxUI.cpp +++ b/view/wxUI.cpp @@ -15,17 +15,17 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS ButtonPanel* buttons = new ButtonPanel(_kiss, this); // wxMenu *menuFile = new wxMenu; - // menuFile->Append( ID_About, _("&About...") ); + // menuFile->Append( ID_About, wxT("&About...") ); // menuFile->AppendSeparator(); - // menuFile->Append( ID_Quit, _("E&xit") ); + // menuFile->Append( ID_Quit, wxT("E&xit") ); // wxMenuBar *menuBar = new wxMenuBar; - // menuBar->Append( menuFile, _("&File") ); + // menuBar->Append( menuFile, wxT("&File") ); // SetMenuBar( menuBar ); // CreateStatusBar(); - // SetStatusText( _("Welcome to wxWidgets!") ); + // SetStatusText( wxT("Welcome to wxWidgets!") ); SetSizer(_hbox);