void ClangDiagnosticConfigsWidget::syncClangTidyWidgets(const ClangDiagnosticConfig &config) { disconnectClangTidyItemChanged(); ClangDiagnosticConfig::TidyMode tidyMode = config.clangTidyMode(); m_tidyChecks->tidyMode->setCurrentIndex(static_cast<int>(tidyMode)); switch (tidyMode) { case ClangDiagnosticConfig::TidyMode::Disabled: case ClangDiagnosticConfig::TidyMode::File: m_tidyChecks->checksString->setVisible(false); m_tidyChecks->checksListWrapper->setCurrentIndex(1); break; case ClangDiagnosticConfig::TidyMode::ChecksString: m_tidyChecks->checksString->setVisible(true); m_tidyChecks->checksListWrapper->setCurrentIndex(1); m_tidyChecks->checksString->setText(config.clangTidyChecksString()); break; case ClangDiagnosticConfig::TidyMode::ChecksPrefixList: m_tidyChecks->checksString->setVisible(false); m_tidyChecks->checksListWrapper->setCurrentIndex(0); syncTidyChecksList(config); break; } m_tidyChecksWidget->setEnabled(!config.isReadOnly()); connectClangTidyItemChanged(); }
QString ClangDiagnosticConfigsModel::displayNameWithBuiltinIndication(const ClangDiagnosticConfig &config) { return config.isReadOnly() ? QCoreApplication::translate("ClangDiagnosticConfigsModel", "%1 [built-in]") .arg(config.displayName()) : config.displayName(); }
void ClangDiagnosticConfigsWidget::syncClazyWidgets(const ClangDiagnosticConfig &config) { const QString clazyChecks = config.clazyChecks(); QRadioButton *button = m_clazyChecks->clazyRadioDisabled; if (clazyChecks.isEmpty()) button = m_clazyChecks->clazyRadioDisabled; else if (clazyChecks == "level0") button = m_clazyChecks->clazyRadioLevel0; else if (clazyChecks == "level1") button = m_clazyChecks->clazyRadioLevel1; else if (clazyChecks == "level2") button = m_clazyChecks->clazyRadioLevel2; else if (clazyChecks == "level3") button = m_clazyChecks->clazyRadioLevel3; button->setChecked(true); m_clazyChecksWidget->setEnabled(!config.isReadOnly()); }
void ClangDiagnosticConfigsWidget::syncTidyChecksList(const ClangDiagnosticConfig &config) { const QString tidyChecks = config.clangTidyChecksPrefixes(); for (int row = 0; row < m_tidyChecks->checksPrefixesList->count(); ++row) { QListWidgetItem *item = m_tidyChecks->checksPrefixesList->item(row); Qt::ItemFlags flags = item->flags(); flags |= Qt::ItemIsUserCheckable; if (config.isReadOnly()) flags &= ~Qt::ItemIsEnabled; else flags |= Qt::ItemIsEnabled; item->setFlags(flags); if (tidyChecks.indexOf(item->text()) != -1) item->setCheckState(Qt::Checked); else item->setCheckState(Qt::Unchecked); } }