+ allow to get user friendly names for navigation styles

This commit is contained in:
wmayer
2016-03-10 18:37:48 +01:00
parent 5b156b2380
commit 3f79dfffb6
4 changed files with 59 additions and 29 deletions

View File

@@ -177,20 +177,15 @@ void DlgSettings3DViewImp::changeEvent(QEvent *e)
void DlgSettings3DViewImp::retranslate()
{
std::vector<Base::Type> types;
Base::Type::getAllDerivedFrom(UserNavigationStyle::getClassTypeId(), types);
comboNavigationStyle->clear();
QRegExp rx(QString::fromLatin1("^\\w+::(\\w+)Navigation\\w+$"));
for (std::vector<Base::Type>::iterator it = types.begin(); it != types.end(); ++it) {
if (*it != UserNavigationStyle::getClassTypeId()) {
QString data = QString::fromLatin1(it->getName());
QString name = data.mid(data.indexOf(QLatin1String("::"))+2);
if (rx.indexIn(data) > -1) {
name = tr("%1 navigation").arg(rx.cap(1));
}
comboNavigationStyle->addItem(name, data);
}
// add submenu at the end to select navigation style
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
for (std::map<Base::Type, std::string>::iterator it = styles.begin(); it != styles.end(); ++it) {
QByteArray data(it->first.getName());
QString name = QApplication::translate(it->first.getName(), it->second.c_str());
comboNavigationStyle->addItem(name, data);
}
}