/*************************************************************************** * Copyright 2008 Robert Gruber * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "cvsannotatejob.h" #include #include #include #include #include #include CvsAnnotateJob::CvsAnnotateJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) : CvsJob(parent, verbosity) { } CvsAnnotateJob::~CvsAnnotateJob() { } QVariant CvsAnnotateJob::fetchResults() { // Convert job's output into KDevelop::VcsAnnotation KDevelop::VcsAnnotation annotateInfo; parseOutput(output(), getDirectory(), annotateInfo); QList lines; for(int i=0; i < annotateInfo.lineCount(); i++) { KDevelop::VcsAnnotationLine line = annotateInfo.line(i); lines.append( qVariantFromValue( line ) ); } return lines; } void CvsAnnotateJob::parseOutput(const QString& jobOutput, const QString& workingDirectory, KDevelop::VcsAnnotation& annotateInfo) { // each annotation line looks like this: // 1.1 (kdedev 10-Nov-07): #include static QRegExp re("([^\\s]+)\\s+\\(([^\\s]+)\\s+([^\\s]+)\\):\\s(.*)"); // the file is pomoted like this: // Annotations for main.cpp static QRegExp reFile("Annotations for\\s(.*)"); QStringList lines = jobOutput.split('\n'); QString filename; for (int i=0, linenumber=0; i