• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

vcs

vcsannotationwidget.cpp

00001 /***************************************************************************
00002  *   This file is part of KDevelop                                         *
00003  *   Copyright 2007 Dukju Ahn <dukjuahn@gmail.com>                         *
00004  *   Copyright 2007 Andreas Pakulat <apaku@gmx.de>                         *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU Library General Public License as       *
00008  *   published by the Free Software Foundation; either version 2 of the    *
00009  *   License, or (at your option) any later version.                       *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this program; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
00020  ***************************************************************************/
00021 
00022 #include "vcsannotationwidget.h"
00023 
00024 #include <QSortFilterProxyModel>
00025 #include <QHeaderView>
00026 
00027 #include <kdebug.h>
00028 
00029 #include <interfaces/icore.h>
00030 #include <interfaces/iruncontroller.h>
00031 
00032 #include "../vcsjob.h"
00033 #include "../models/vcsannotationmodel.h"
00034 #include "../vcsannotation.h"
00035 #include "ui_vcsannotationwidget.h"
00036 
00037 namespace KDevelop
00038 {
00039 class VcsAnnotationWidgetPrivate
00040 {
00041 public:
00042     VcsAnnotationModel* m_model;
00043     KDevelop::VcsJob* m_job;
00044     Ui::VcsAnnotationWidget* m_ui;
00045     void addAnnotations(KDevelop::VcsJob* job)
00046     {
00047         if( job == m_job )
00048         {
00049             QList<QVariant> result = job->fetchResults().toList();
00050             QList<KDevelop::VcsAnnotationLine> lines;
00051             foreach( QVariant v, result )
00052             {
00053                 if( v.canConvert<KDevelop::VcsAnnotationLine>() )
00054                 {
00055                     lines << v.value<KDevelop::VcsAnnotationLine>();
00056                 }
00057             }
00058             m_model->addLines( lines );
00059         }
00060 
00061     }
00062 };
00063 
00064 VcsAnnotationWidget::VcsAnnotationWidget( const KUrl& url, KDevelop::VcsJob* job, QWidget* parent )
00065     : QWidget( parent ), d( new VcsAnnotationWidgetPrivate)
00066 {
00067     d->m_job = job;
00068     d->m_ui = new Ui::VcsAnnotationWidget();
00069     d->m_ui->setupUi( this );
00070     d->m_model = new VcsAnnotationModel( url );
00071     d->m_ui->annotations->setModel( d->m_model );
00072     QHeaderView* header = d->m_ui->annotations->horizontalHeader();
00073     header->setResizeMode(0, QHeaderView::ResizeToContents );
00074     header->setResizeMode(1, QHeaderView::ResizeToContents );
00075 //     header->setResizeMode(2, QHeaderView::ResizeToContents );
00076 //     header->setResizeMode(3, QHeaderView::ResizeToContents );
00077     header->setResizeMode(2, QHeaderView::Stretch );
00078 //     annotations->setIndentation(-7);
00079     connect( d->m_job, SIGNAL( resultsReady( KDevelop::VcsJob* ) ),
00080              this, SLOT( addAnnotations( KDevelop::VcsJob* ) ) );
00081     d->m_job->setAutoDelete(false);
00082     ICore::self()->runController()->registerJob( d->m_job );
00083 }
00084 
00085 VcsAnnotationWidget::~VcsAnnotationWidget()
00086 {
00087     delete d->m_model;
00088     delete d->m_ui;
00089     delete d;
00090 }
00091 
00092 }
00093 
00094 #include "vcsannotationwidget.moc"

vcs

Skip menu "vcs"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   duchain
  •   editor
  • outputview
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal