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

vcs

vcsdiffwidget.cpp

00001 /***************************************************************************
00002  *   This file is part of KDevelop                                         *
00003  *   Copyright 2007 Andreas Pakulat <apaku@gmx.de>                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
00019  ***************************************************************************/
00020 
00021 #include "vcsdiffwidget.h"
00022 
00023 #include <QLabel>
00024 
00025 #include <ktextedit.h>
00026 #include <kdebug.h>
00027 
00028 #include <interfaces/icore.h>
00029 #include <interfaces/iruncontroller.h>
00030 
00031 #include "../vcsjob.h"
00032 #include "../vcsrevision.h"
00033 #include "../vcsdiff.h"
00034 
00035 #include "ui_vcsdiffwidget.h"
00036 
00037 namespace KDevelop
00038 {
00039 
00040 class VcsDiffWidgetPrivate
00041 {
00042 public:
00043     Ui::VcsDiffWidget* m_ui;
00044     VcsJob* m_job;
00045     void diffReady( KDevelop::VcsJob* job )
00046     {
00047         if( job != m_job )
00048             return;
00049         KDevelop::VcsDiff diff = qVariantValue<KDevelop::VcsDiff>( m_job->fetchResults() );
00050 
00051         kDebug() << "diff:" << diff.leftTexts().count();
00052         foreach( KDevelop::VcsLocation l, diff.leftTexts().keys() )
00053         {
00054             kDebug() << "diff:" << l.localUrl() << l.repositoryServer();
00055         }
00056         kDebug() << "diff:" << diff.diff();
00057         kDebug() << "diff:" << diff.type();
00058         kDebug() << "diff:" << diff.contentType();
00059         m_ui->diffDisplay->setPlainText( diff.diff() );
00060         m_ui->diffDisplay->setReadOnly( true );
00061 
00062     }
00063 
00064 };
00065 
00066 VcsDiffWidget::VcsDiffWidget( KDevelop::VcsJob* job, QWidget* parent )
00067     : QWidget( parent ), d(new VcsDiffWidgetPrivate)
00068 {
00069     d->m_job = job;
00070     d->m_ui = new Ui::VcsDiffWidget();
00071     d->m_ui->setupUi( this );
00072     connect( d->m_job, SIGNAL( resultsReady( KDevelop::VcsJob *) ),
00073              this, SLOT( diffReady( KDevelop::VcsJob* ) ) );
00074     ICore::self()->runController()->registerJob( d->m_job );
00075 }
00076 
00077 VcsDiffWidget::~VcsDiffWidget()
00078 {
00079     delete d->m_ui;
00080     delete d;
00081 }
00082 
00083 void VcsDiffWidget::setRevisions( const KDevelop::VcsRevision& first,
00084                                   const KDevelop::VcsRevision& second )
00085 {
00086     d->m_ui->revLabel->setText( i18n("Difference between revision %1 and %2:",
00087                        first.prettyValue(),
00088                        second.prettyValue() ) );
00089 }
00090 
00091 }
00092 
00093 #include "vcsdiffwidget.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
  •   codegen
  •   duchain
  •   editor
  • outputview
  •     interfaces
  • 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