| 181 | } |
| 182 | |
| 183 | VcsEventWidget::VcsEventWidget( const QUrl& url, const VcsRevision& rev, KDevelop::IBasicVersionControl* iface, QWidget* parent ) |
| 184 | : QWidget(parent) |
| 185 | , d_ptr(new VcsEventWidgetPrivate(this)) |
| 186 | { |
| 187 | Q_D(VcsEventWidget); |
| 188 | |
| 189 | d->m_iface = iface; |
| 190 | d->m_url = url; |
| 191 | d->m_ui = new Ui::VcsEventWidget(); |
| 192 | d->m_ui->setupUi(this); |
| 193 | |
| 194 | d->m_logModel = new VcsEventLogModel(iface, rev, url, this); |
| 195 | d->m_ui->eventView->setModel( d->m_logModel ); |
| 196 | d->m_ui->eventView->sortByColumn(0, Qt::DescendingOrder); |
| 197 | d->m_ui->eventView->setContextMenuPolicy( Qt::CustomContextMenu ); |
| 198 | QHeaderView* header = d->m_ui->eventView->header(); |
| 199 | header->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); |
| 200 | header->setSectionResizeMode( 1, QHeaderView::Stretch ); |
| 201 | header->setSectionResizeMode( 2, QHeaderView::ResizeToContents ); |
| 202 | header->setSectionResizeMode( 3, QHeaderView::ResizeToContents ); |
| 203 | // Select first row as soon as the model got populated |
| 204 | connect(d->m_logModel, &QAbstractItemModel::rowsInserted, this, [this]() { |
| 205 | Q_D(VcsEventWidget); |
| 206 | auto view = d->m_ui->eventView; |
| 207 | view->setCurrentIndex(view->model()->index(0, 0)); |
| 208 | }); |
| 209 | |
| 210 | d->m_detailModel = new VcsItemEventModel(this); |
| 211 | d->m_ui->itemEventView->setModel( d->m_detailModel ); |
| 212 | |
| 213 | connect(d->m_ui->eventView, &QTreeView::clicked, this, [this] (const QModelIndex& index) { |
| 214 | Q_D(VcsEventWidget); |
| 215 | d->eventViewClicked(index); |
| 216 | }); |
| 217 | connect(d->m_ui->eventView->selectionModel(), &QItemSelectionModel::currentRowChanged, |
| 218 | this, [this] (const QModelIndex& start, const QModelIndex& end) { |
| 219 | Q_D(VcsEventWidget); |
| 220 | d->currentRowChanged(start, end); |
| 221 | }); |
| 222 | connect(d->m_ui->eventView, &QTreeView::customContextMenuRequested, |
| 223 | this, [this] (const QPoint& point) { |
| 224 | Q_D(VcsEventWidget); |
| 225 | d->eventViewCustomContextMenuRequested(point); |
| 226 | }); |
| 227 | |
| 228 | connect(d->m_ui->message, &QTextBrowser::anchorClicked, |
| 229 | this, [&] (const QUrl& url) { QDesktopServices::openUrl(url); }); |
| 230 | } |
| 231 | |
| 232 | VcsEventWidget::~VcsEventWidget() |
| 233 | { |
nothing calls this directly
no test coverage detected