Setup accessors for user's preferences
This commit is contained in:
parent
ea7491aff7
commit
74ca6a2285
|
@ -30,8 +30,7 @@ std::vector<ExportEngine*> * KissCount::_exportEngines;
|
||||||
|
|
||||||
KissCount::KissCount(int& argc, char** argv) : QApplication(argc, argv), _user(0)
|
KissCount::KissCount(int& argc, char** argv) : QApplication(argc, argv), _user(0)
|
||||||
{
|
{
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8"));
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
|
||||||
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
|
|
||||||
|
|
||||||
_wxUI = new wxUI(this, "KissCount");
|
_wxUI = new wxUI(this, "KissCount");
|
||||||
|
|
||||||
|
@ -417,7 +416,7 @@ void KissCount::KillMe()
|
||||||
|
|
||||||
void KissCount::SetLanguage(QString language)
|
void KissCount::SetLanguage(QString language)
|
||||||
{
|
{
|
||||||
_user->_preferences["language"] = language;
|
_user->SetLanguage(language);
|
||||||
_db->UpdatePreference(_user, "language");
|
_db->UpdatePreference(_user, "language");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,21 @@ QString User::GetLanguage()
|
||||||
// return (wxLanguage)val;
|
// return (wxLanguage)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void User::SetLanguage(QString language)
|
||||||
|
{
|
||||||
|
_preferences["language"] = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
int User::GetDefaultCurrency()
|
||||||
|
{
|
||||||
|
return _preferences["defaultCurrency"].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void User::SetDefaultCurrency(int currency)
|
||||||
|
{
|
||||||
|
_preferences["defaultCurrency"] = QString(currency);
|
||||||
|
}
|
||||||
|
|
||||||
void User::LinkOrUnlinkOperation(Operation& op)
|
void User::LinkOrUnlinkOperation(Operation& op)
|
||||||
{
|
{
|
||||||
std::vector<Operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
|
|
|
@ -88,7 +88,11 @@ public:
|
||||||
int GetOperationsNumber(int month, int year);
|
int GetOperationsNumber(int month, int year);
|
||||||
|
|
||||||
QString GetLanguage();
|
QString GetLanguage();
|
||||||
|
void SetLanguage(QString language);
|
||||||
|
int GetDefaultCurrency();
|
||||||
|
void SetDefaultCurrency(int currency);
|
||||||
|
|
||||||
|
|
||||||
void LinkOrUnlinkOperation(Operation& op);
|
void LinkOrUnlinkOperation(Operation& op);
|
||||||
|
|
||||||
void Group(const Operation& op);
|
void Group(const Operation& op);
|
||||||
|
|
|
@ -240,7 +240,7 @@ void wxUI::LoadUser()
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (user->_preferences["language"].size())
|
if (user->GetLanguage().size())
|
||||||
SetLanguage(user->GetLanguage());
|
SetLanguage(user->GetLanguage());
|
||||||
else
|
else
|
||||||
SetLanguage(SupportedLanguages::languages[0].name);
|
SetLanguage(SupportedLanguages::languages[0].name);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user