MCPcopy Create free account
hub / github.com/KDE/kdevelop / fillLanguageCombobox

Method fillLanguageCombobox

kdevplatform/shell/sourceformatterselectionedit.cpp:723–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721}
722
723void SourceFormatterSelectionEditPrivate::fillLanguageCombobox()
724{
725 // Move the languages not supported by KDevelop to the bottom of the combobox.
726 // Use std::array to avoid extra memory allocations.
727
728 constexpr std::array unsupportedLanguages{
729 QLatin1String("C#", 2),
730 QLatin1String("Java", 4),
731 };
732 Q_ASSERT(std::is_sorted(unsupportedLanguages.cbegin(), unsupportedLanguages.cend()));
733 std::array<QString, unsupportedLanguages.size()> skippedLanguages{};
734
735 for (const auto& lang : languages) {
736 const QString& name = lang.name();
737 const auto unsupportedIt = std::find(unsupportedLanguages.cbegin(), unsupportedLanguages.cend(), name);
738 if (unsupportedIt == unsupportedLanguages.cend()) {
739 ui.cbLanguages->addItem(name);
740 } else {
741 skippedLanguages[unsupportedIt - unsupportedLanguages.cbegin()] = name;
742 }
743 }
744
745 for (const auto& name : skippedLanguages) {
746 if (!name.isEmpty()) {
747 ui.cbLanguages->addItem(name);
748 }
749 }
750}
751
752void SourceFormatterSelectionEditPrivate::addMimeTypes(const SourceFormatterStyle::MimeList& mimeTypes,
753 FormatterData& formatter)

Callers 1

resetUiMethod · 0.80

Calls 4

sizeMethod · 0.45
nameMethod · 0.45
addItemMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected