X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=gui%2Fconjugation.cpp;fp=gui%2Fconjugation.cpp;h=b37ed8a388d029a1d900c0e9ec9b9ae2d994551e;hb=c25153fb17c4f0782b9ffc7206427a63ce096903;hp=ab4013a64fbdc628958cf325f7d4427748dc0018;hpb=0f544c4b78f242a3ac985c69874c6e41493cb8f0;p=mverbiste diff --git a/gui/conjugation.cpp b/gui/conjugation.cpp index ab4013a..b37ed8a 100644 --- a/gui/conjugation.cpp +++ b/gui/conjugation.cpp @@ -201,3 +201,44 @@ createTableCellText(verbiste::FrenchVerbDictionary &fvd, } return persons; } + + +/** + * Qt version of createTableCellText() above. + * Return a vertor of QStrings, which are conjugations. + **/ +QVector qgetConjugates(verbiste::FrenchVerbDictionary &fvd, + const VVS &tense, + const string &lowerCaseUTF8UserText, + const string &openMark, + const string &closeMark) +{ + string userTextWOAccents = fvd.removeUTF8Accents(lowerCaseUTF8UserText); + QVector persons(0); + for (VVS::const_iterator it = tense.begin(); it != tense.end(); it++) + { + const VS &person = *it; + QString ver; + +// if (it != tense.begin()) +// persons += "\n"; + + for (VS::const_iterator i = person.begin(); i != person.end(); i++) + { + if (i != person.begin()) + ver.append(", "); + + string inflection = fvd.removeUTF8Accents(removePronoun(*i)); + if (inflection == userTextWOAccents) { + const std::string wrapped = openMark + *i + closeMark; + ver.append(QString::fromUtf8(wrapped.c_str())); + } + else { + const char *str = (*i).c_str(); + ver.append(QString::fromUtf8(str)); + } + } + persons.append(ver); + } + return persons; +}