void ClangDiagnosticConfigsWidget::onRemoveButtonClicked()
{
    m_diagnosticConfigsModel.removeConfigWithId(currentConfigId());
    emit customConfigsChanged(customConfigs());

    syncConfigChooserToModel();
}
void ClangDiagnosticConfigsWidget::onDiagnosticOptionsEdited()
{
    const QString diagnosticOptions
            = m_ui->diagnosticOptionsTextEdit->document()->toPlainText().trimmed();
    const QStringList updatedCommandLine
            = diagnosticOptions.trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);

    ClangDiagnosticConfig updatedConfig = currentConfig();
    updatedConfig.setCommandLineOptions(updatedCommandLine);

    m_diagnosticConfigsModel.appendOrUpdate(updatedConfig);
    emit customConfigsChanged(customConfigs());
}
void ClangDiagnosticConfigsWidget::onCopyButtonClicked()
{
    const ClangDiagnosticConfig &config = currentConfig();

    bool diaglogAccepted = false;
    const QString newName = QInputDialog::getText(this,
                                                  tr("Copy Diagnostic Configuration"),
                                                  tr("Diagnostic configuration name:"),
                                                  QLineEdit::Normal,
                                                  tr("%1 (Copy)").arg(config.displayName()),
                                                  &diaglogAccepted);
    if (diaglogAccepted) {
        const ClangDiagnosticConfig customConfig = createCustomConfig(config, newName);
        m_diagnosticConfigsModel.appendOrUpdate(customConfig);
        emit customConfigsChanged(customConfigs());

        syncConfigChooserToModel(customConfig.id());
        m_ui->diagnosticOptionsTextEdit->setFocus();
    }
}
void ClangDiagnosticConfigsWidget::updateConfig(const ClangDiagnosticConfig &config)
{
    m_diagnosticConfigsModel.appendOrUpdate(config);
    emit customConfigsChanged(customConfigs());
}