void ClassAnalyzer::postProcessBaseClasses() { // append namespace prefixes if needed for (auto it = m_classes.begin(); it != m_classes.end(); it++) { if (!it->baseClasses().isEmpty()) { QStringList baseClasses = it->baseClasses(); for (auto it2 = baseClasses.begin(); it2 != baseClasses.end(); it2++) { QStringList splittedBaseClassName = it2->split("::"); for (auto it3 = m_classes.begin(); it3 != m_classes.end(); it3++) { QStringList splittedClassName = it3->name().split("::"); // check from back to front if (splittedClassName.last() == splittedBaseClassName.last()) { QString fullName = splittedClassName.last(); splittedClassName.removeLast(); QStringList splitted = it->name().split("::"); while(!splitted.isEmpty()) { splitted.removeLast(); if (splittedClassName == splitted) { for (auto it4 = splitted.rbegin(); it4 != splitted.rend(); it4++) { fullName.prepend("::"); fullName.prepend(*it4); } break; } } *it2 = fullName; } } } it->setBaseClasses(baseClasses); } } }
void KeyboardPage::guessLayout( const QStringList& langParts ) { const KeyboardLayoutModel* klm = dynamic_cast< KeyboardLayoutModel* >( ui->listLayout->model() ); bool foundCountryPart = false; for ( auto countryPart = langParts.rbegin(); !foundCountryPart && countryPart != langParts.rend(); ++countryPart ) { cDebug() << " .. looking for locale part" << *countryPart; for ( int i = 0; i < klm->rowCount(); ++i ) { QModelIndex idx = klm->index( i ); QString name = idx.isValid() ? idx.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString() : QString(); if ( idx.isValid() && ( name.compare( *countryPart, Qt::CaseInsensitive ) == 0 ) ) { cDebug() << " .. matched" << name; ui->listLayout->setCurrentIndex( idx ); foundCountryPart = true; break; } } if ( foundCountryPart ) { ++countryPart; if ( countryPart != langParts.rend() ) { cDebug() << "Next level:" << *countryPart; for (int variantnumber = 0; variantnumber < ui->listVariant->count(); ++variantnumber) { LayoutItem *variantdata = dynamic_cast< LayoutItem* >( ui->listVariant->item( variantnumber ) ); if ( variantdata && (variantdata->data.compare( *countryPart, Qt::CaseInsensitive ) == 0) ) { ui->listVariant->setCurrentItem( variantdata ); cDebug() << " .. matched variant" << variantdata->data << ' ' << variantdata->text(); } } } } } }