Example #1
0
void GitEditor::setPlainTextFiltered(const QString &text)
{
    QString modText = text;
    GitPlugin *plugin = GitPlugin::instance();
    // If desired, filter out the date from annotation
    switch (contentType())
    {
    case VcsBase::AnnotateOutput: {
        const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey);
        if (omitAnnotationDate)
            modText = removeAnnotationDate(text);
        break;
    }
    case VcsBase::DiffOutput: {
        if (modText.isEmpty()) {
            modText = QLatin1String("No difference to HEAD");
        } else {
            const QFileInfo fi(source());
            const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
            modText = plugin->gitClient()->extendedShowDescription(workingDirectory, modText);
        }
        break;
    }
    default:
        break;
    }

    setPlainText(modText);
}
void GitEditor::setPlainTextDataFiltered(const QByteArray &a)
{
    // If desired, filter out the date from annotation
    const bool omitAnnotationDate = contentType() == VCSBase::AnnotateOutput
                                    && GitPlugin::instance()->settings().omitAnnotationDate;
    if (omitAnnotationDate) {
        QString text = codec()->toUnicode(a);
        removeAnnotationDate(&text);
        setPlainText(text);
    } else {
        setPlainTextData(a);
    }
}