Sort categories with translated names
This commit is contained in:
parent
d206d5b051
commit
3e89eb7279
|
@ -147,11 +147,11 @@ QPixmap BackgroundAttributes::pixmap() const
|
||||||
QDebug operator<<(QDebug dbg, const KDChart::BackgroundAttributes& ba)
|
QDebug operator<<(QDebug dbg, const KDChart::BackgroundAttributes& ba)
|
||||||
{
|
{
|
||||||
dbg << "KDChart::BackgroundAttributes("
|
dbg << "KDChart::BackgroundAttributes("
|
||||||
<< "visible="<<ba.isVisible()
|
<< "visible="<<ba.isVisible()
|
||||||
<< "brush="<<ba.brush()
|
<< "brush="<<ba.brush()
|
||||||
<< "pixmapmode="<<ba.pixmapMode()
|
<< "pixmapmode="<<ba.pixmapMode()
|
||||||
<< "pixmap="<<ba.pixmap()
|
// << "pixmap="<<ba.pixmap()
|
||||||
<< ")";
|
<< ")";
|
||||||
return dbg;
|
return dbg;
|
||||||
}
|
}
|
||||||
#endif /* QT_NO_DEBUG_STREAM */
|
#endif /* QT_NO_DEBUG_STREAM */
|
||||||
|
|
|
@ -76,6 +76,7 @@ void KissCount::LoadUser(const QString& user)
|
||||||
{
|
{
|
||||||
if (_user) delete _user;
|
if (_user) delete _user;
|
||||||
_user = _db->LoadUser(user) ;
|
_user = _db->LoadUser(user) ;
|
||||||
|
|
||||||
if (_user)
|
if (_user)
|
||||||
_wxUI->LoadUser();
|
_wxUI->LoadUser();
|
||||||
}
|
}
|
||||||
|
@ -504,6 +505,9 @@ QFont KissCount::ExtractFont(QString strFont)
|
||||||
weight = list[3].toInt();
|
weight = list[3].toInt();
|
||||||
faceName = list[4];
|
faceName = list[4];
|
||||||
|
|
||||||
|
(void) family;
|
||||||
|
(void) style;
|
||||||
|
|
||||||
return QFont(faceName, pointSize, weight);
|
return QFont(faceName, pointSize, weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
struct Category
|
struct Category
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
@ -38,7 +40,7 @@ struct Category
|
||||||
if (cat1.fix_cost) return true;
|
if (cat1.fix_cost) return true;
|
||||||
if (cat2.fix_cost) return false;
|
if (cat2.fix_cost) return false;
|
||||||
|
|
||||||
return cat1.name < cat2.name;
|
return QApplication::translate("", cat1.name.toStdString().c_str()) < QApplication::translate("", cat2.name.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator == (int catId)
|
bool operator == (int catId)
|
||||||
|
|
|
@ -35,6 +35,8 @@ User::~User()
|
||||||
void User::InvalidateOperations()
|
void User::InvalidateOperations()
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
std::vector<Category>::iterator it2;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (it = _operations.begin(); it != _operations.end(); it++)
|
for (it = _operations.begin(); it != _operations.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +50,11 @@ void User::InvalidateOperations()
|
||||||
|
|
||||||
std::sort(_accounts.begin(), _accounts.end(), Account());
|
std::sort(_accounts.begin(), _accounts.end(), Account());
|
||||||
std::sort(_categories.begin(), _categories.end(), Category());
|
std::sort(_categories.begin(), _categories.end(), Category());
|
||||||
|
|
||||||
|
for (i=0, it2=_categories.begin(); it2 !=_categories.end(); it2++, i++)
|
||||||
|
{
|
||||||
|
_categoriesFonts[i] = KissCount::ExtractFont(it2->font);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Category User::GetCategory(int catId)
|
Category User::GetCategory(int catId)
|
||||||
|
|
|
@ -238,12 +238,20 @@ void wxUI::LoadPanels()
|
||||||
void wxUI::LoadUser()
|
void wxUI::LoadUser()
|
||||||
{
|
{
|
||||||
User* user = _kiss->GetUser();
|
User* user = _kiss->GetUser();
|
||||||
|
int i;
|
||||||
|
|
||||||
if (user->_preferences["language"].size())
|
if (user->_preferences["language"].size())
|
||||||
SetLanguage(user->GetLanguage());
|
SetLanguage(user->GetLanguage());
|
||||||
else
|
else
|
||||||
SetLanguage(SupportedLanguages::languages[0].name);
|
SetLanguage(SupportedLanguages::languages[0].name);
|
||||||
|
|
||||||
|
// Sort with translated names
|
||||||
|
std::sort(user->_categories.begin(), user->_categories.end(), Category());
|
||||||
|
for (i=0; i < (int)user->_categories.size(); i++)
|
||||||
|
{
|
||||||
|
user->_categoriesFonts[i] = KissCount::ExtractFont(user->_categories[i].font);
|
||||||
|
}
|
||||||
|
|
||||||
LoadPanels();
|
LoadPanels();
|
||||||
|
|
||||||
if (_panels.size())
|
if (_panels.size())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user