Changeset View
Changeset View
Standalone View
Standalone View
plugins/standardoutputview/outputwidget.cpp
Show First 20 Lines • Show All 468 Lines • ▼ Show 20 Line(s) | 467 | { | |||
---|---|---|---|---|---|
469 | auto view = outputView(); | 469 | auto view = outputView(); | ||
470 | if( ! view || ! iface ) | 470 | if( ! view || ! iface ) | ||
471 | return; | 471 | return; | ||
472 | activateIndex(index, view, iface); | 472 | activateIndex(index, view, iface); | ||
473 | } | 473 | } | ||
474 | 474 | | |||
475 | QTreeView* OutputWidget::createListView(int id) | 475 | QTreeView* OutputWidget::createListView(int id) | ||
476 | { | 476 | { | ||
477 | auto createHelper = [&]() -> QTreeView* { | 477 | auto createHelper = [&]() -> QSharedPointer<QTreeView> { | ||
478 | KDevelop::FocusedTreeView* listview = new KDevelop::FocusedTreeView(this); | 478 | KDevelop::FocusedTreeView* listview = new KDevelop::FocusedTreeView(this); | ||
479 | listview->setEditTriggers( QAbstractItemView::NoEditTriggers ); | 479 | listview->setEditTriggers( QAbstractItemView::NoEditTriggers ); | ||
480 | listview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //Always enable the scrollbar, so it doesn't flash around | 480 | listview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //Always enable the scrollbar, so it doesn't flash around | ||
481 | listview->setHeaderHidden(true); | 481 | listview->setHeaderHidden(true); | ||
482 | listview->setUniformRowHeights(true); | 482 | listview->setUniformRowHeights(true); | ||
483 | listview->setRootIsDecorated(false); | 483 | listview->setRootIsDecorated(false); | ||
484 | listview->setSelectionMode( QAbstractItemView::ContiguousSelection ); | 484 | listview->setSelectionMode( QAbstractItemView::ContiguousSelection ); | ||
485 | 485 | | |||
486 | if (data->outputdata.value(id)->behaviour & KDevelop::IOutputView::AutoScroll) { | 486 | if (data->outputdata.value(id)->behaviour & KDevelop::IOutputView::AutoScroll) { | ||
487 | listview->setAutoScrollAtEnd(true); | 487 | listview->setAutoScrollAtEnd(true); | ||
488 | } | 488 | } | ||
489 | 489 | | |||
490 | connect(listview, &QTreeView::activated, this, &OutputWidget::activate); | 490 | connect(listview, &QTreeView::activated, this, &OutputWidget::activate); | ||
491 | connect(listview, &QTreeView::clicked, this, &OutputWidget::activate); | 491 | connect(listview, &QTreeView::clicked, this, &OutputWidget::activate); | ||
492 | 492 | | |||
493 | return listview; | 493 | return QSharedPointer<QTreeView>(listview); | ||
494 | }; | 494 | }; | ||
495 | 495 | | |||
496 | QTreeView* listview = nullptr; | 496 | QSharedPointer<QTreeView> listview; | ||
497 | if( !m_views.contains(id) ) | 497 | if( !m_views.contains(id) ) | ||
498 | { | 498 | { | ||
499 | bool newView = true; | 499 | bool newView = true; | ||
500 | 500 | | |||
501 | if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView ) | 501 | if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView ) | ||
502 | { | 502 | { | ||
503 | qCDebug(PLUGIN_STANDARDOUTPUTVIEW) << "creating listview"; | 503 | qCDebug(PLUGIN_STANDARDOUTPUTVIEW) << "creating listview"; | ||
504 | listview = createHelper(); | 504 | listview = createHelper(); | ||
505 | 505 | | |||
506 | if( data->type & KDevelop::IOutputView::MultipleView ) | 506 | if( data->type & KDevelop::IOutputView::MultipleView ) | ||
507 | { | 507 | { | ||
508 | m_tabwidget->addTab( listview, data->outputdata.value(id)->title ); | 508 | m_tabwidget->addTab(listview.data(), data->outputdata.value(id)->title); | ||
509 | } else | 509 | } else | ||
510 | { | 510 | { | ||
511 | m_stackwidget->addWidget( listview ); | 511 | m_stackwidget->addWidget(listview.data()); | ||
512 | m_stackwidget->setCurrentWidget( listview ); | 512 | m_stackwidget->setCurrentWidget(listview.data()); | ||
513 | } | 513 | } | ||
514 | } else | 514 | } else | ||
515 | { | 515 | { | ||
516 | if( m_views.isEmpty() ) | 516 | if( m_views.isEmpty() ) | ||
517 | { | 517 | { | ||
518 | listview = createHelper(); | 518 | listview = createHelper(); | ||
519 | 519 | layout()->addWidget(listview.data()); | |||
520 | layout()->addWidget( listview ); | | |||
521 | } else | 520 | } else | ||
522 | { | 521 | { | ||
523 | listview = m_views.begin().value().view.data(); | 522 | listview = m_views.begin().value().view; | ||
524 | newView = false; | 523 | newView = false; | ||
525 | } | 524 | } | ||
526 | } | 525 | } | ||
527 | m_views[id].view = QSharedPointer<QTreeView>(listview); | 526 | m_views[id].view = listview; | ||
528 | 527 | | |||
529 | changeModel( id ); | 528 | changeModel( id ); | ||
530 | changeDelegate( id ); | 529 | changeDelegate( id ); | ||
531 | 530 | | |||
532 | if (newView) | 531 | if (newView) | ||
533 | listview->scrollToBottom(); | 532 | listview->scrollToBottom(); | ||
534 | } else | 533 | } else | ||
535 | { | 534 | { | ||
536 | listview = m_views.value(id).view.data(); | 535 | listview = m_views.value(id).view; | ||
537 | } | 536 | } | ||
538 | enableActions(); | 537 | enableActions(); | ||
539 | return listview; | 538 | return listview.data(); | ||
540 | } | 539 | } | ||
541 | 540 | | |||
542 | void OutputWidget::raiseOutput(int id) | 541 | void OutputWidget::raiseOutput(int id) | ||
543 | { | 542 | { | ||
544 | if( m_views.contains(id) ) | 543 | if( m_views.contains(id) ) | ||
545 | { | 544 | { | ||
546 | auto view = m_views.value(id).view.data(); | 545 | auto view = m_views.value(id).view.data(); | ||
547 | if( data->type & KDevelop::IOutputView::MultipleView ) | 546 | if( data->type & KDevelop::IOutputView::MultipleView ) | ||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |