summaryrefslogtreecommitdiffstats
path: root/vcs/subversion/svn_blamewidget.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /vcs/subversion/svn_blamewidget.cpp
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'vcs/subversion/svn_blamewidget.cpp')
-rw-r--r--vcs/subversion/svn_blamewidget.cpp135
1 files changed, 135 insertions, 0 deletions
diff --git a/vcs/subversion/svn_blamewidget.cpp b/vcs/subversion/svn_blamewidget.cpp
new file mode 100644
index 00000000..5d186177
--- /dev/null
+++ b/vcs/subversion/svn_blamewidget.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2007 Dukju Ahn (dukjuahn@gmail.com)
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ */
+
+#include "svn_blamewidget.h"
+#include "subversion_widget.h"
+#include <qmap.h>
+#include <qlistview.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qstringlist.h>
+#include <qfont.h>
+
+#include <klocale.h>
+#include <kmessagebox.h>
+
+SvnBlameWidget::SvnBlameWidget( QWidget *parent, const char* name, bool modal, WFlags f )
+ :QWidget( parent )
+{
+ m_layout = new QVBoxLayout( this, 1, 1 );
+ m_layout->setMargin(1);
+
+ m_listView = new QListView( this );
+ outView()->setAllColumnsShowFocus( TRUE );
+ outView()->addColumn( i18n("Line") );
+ outView()->addColumn( i18n("Rev") );
+ outView()->addColumn( i18n("Date") );
+ outView()->addColumn( i18n("Author") );
+ outView()->addColumn( i18n("Content") );
+
+ m_layout->addWidget( m_listView );
+}
+SvnBlameWidget::~SvnBlameWidget()
+{}
+
+void SvnBlameWidget::copyBlameData( QValueList<SvnBlameHolder> *blamelist )
+{
+ m_blamelist = *blamelist;
+}
+
+void SvnBlameWidget::show()
+{
+ outView()->clear();
+ outView()->setSortColumn(0);
+
+ QFont f = outView()->font();
+ f.setFixedPitch( true );
+ outView()->setFont( f );
+
+ QValueList<SvnBlameHolder>::Iterator it;
+
+ for( it = m_blamelist.begin(); it != m_blamelist.end(); ++it ){
+
+ SvnBlameHolder holder = *it;
+ SvnIntSortListItem *item = new SvnIntSortListItem(outView());
+
+ QString prettyDate = holder.date.left(16).replace(10, 1, ' ');
+
+ item->setText(0, QString::number( holder.line+1 ) );
+ item->setText(1, QString::number(holder.rev) );
+ item->setText(2, prettyDate );
+ item->setText(3, holder.author );
+ item->setText(4, holder.content );
+
+ }
+ outView()->sort();
+ QWidget::show();
+}
+
+QListView* SvnBlameWidget::outView()
+{
+ return m_listView;
+}
+
+/////////////////////////////////////////////////////////////
+
+SvnBlameFileSelectDlg::SvnBlameFileSelectDlg( QWidget *parent )
+ : QDialog( parent )
+{
+ m_selected = "";
+ setCaption( i18n("Select one file to view annotation") );
+
+ m_layout = new QGridLayout( this, 2, 2 );
+ m_view = new QListView( this );
+ m_view->addColumn( i18n("files") );
+ m_okBtn = new QPushButton( i18n("OK"), this );
+ m_cancelBtn = new QPushButton( i18n("Cancel"), this );
+ m_layout->addMultiCellWidget( m_view, 0, 0, 0, 1 );
+ m_layout->addWidget( m_okBtn, 1, 0 );
+ m_layout->addWidget( m_cancelBtn, 1, 1 );
+
+ connect( m_okBtn, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( m_cancelBtn, SIGNAL(clicked()), this, SLOT(reject()) );
+}
+SvnBlameFileSelectDlg::~SvnBlameFileSelectDlg()
+{}
+
+void SvnBlameFileSelectDlg::setCandidate( QStringList *list )
+{
+ for( QValueList<QString>::iterator it = list->begin(); it != list->end(); ++it ){
+ QListViewItem *item = new QListViewItem( m_view, *it );
+ }
+}
+
+QString SvnBlameFileSelectDlg::selected()
+{
+ return m_selected;
+}
+
+void SvnBlameFileSelectDlg::accept()
+{
+ while( true ){
+ QListViewItem *item = m_view->currentItem();
+ if( item ){
+ m_selected = item->text(0);
+ break;
+ }
+ else{
+ KMessageBox::error( this, i18n("Select file from list to view annotation") );
+ }
+ }
+ QDialog::accept();
+}
+
+#include "svn_blamewidget.moc"