2727
2828#include " diffviewwidget.h"
2929
30+ #include < QAction>
31+ #include < QDoubleSpinBox>
3032#include < QLabel>
33+ #include < QMenu>
3134#include < QProgressBar>
3235
36+ #include < kddockwidgets/DockWidget.h>
37+ #include < kddockwidgets/MainWindow.h>
38+
39+ #include " diffviewproxy.h"
3340#include " dockwidgetsetup.h"
3441#include " filterandzoomstack.h"
3542#include " models/treemodel.h"
@@ -45,14 +52,50 @@ DiffViewWidget::DiffViewWidget(QWidget* parent)
4552 , ui(new Ui::ResultsDiffPage)
4653 , m_parserA(new PerfParser(this ))
4754 , m_parserB(new PerfParser(this ))
55+ , m_filterAndZoomStackA(new FilterAndZoomStack(this ))
56+ , m_filterAndZoomStackB(new FilterAndZoomStack(this ))
57+ , m_filterMenu(new QMenu(this ))
4858 , m_model(new DiffViewModel(this ))
59+ , m_contents(createDockingArea(QStringLiteral(" diffview" ), this))
60+ , m_timelineA(new TimeLineWidget(m_parserA, m_filterMenu, m_filterAndZoomStackA, this ))
61+ , m_timelineB(new TimeLineWidget(m_parserB, m_filterMenu, m_filterAndZoomStackB, this ))
4962{
5063 ui->setupUi (this );
51- ;
52- ui->diffTreeView ->setModel (m_model);
64+ auto diffProxy = new DiffViewProxy (this );
65+ diffProxy->setSourceModel (m_model);
66+
67+ ResultsUtil::setupTreeView (ui->diffTreeView , ui->diffSearch , diffProxy, DiffViewModel::InitialSortColumn,
68+ DiffViewModel::SortRole);
5369 ui->diffTreeView ->sortByColumn (DiffViewModel::InitialSortColumn, Qt::DescendingOrder);
5470 ResultsUtil::setupCostDelegate<DiffViewModel>(m_model, ui->diffTreeView );
5571
72+ auto dockify = [](QWidget* widget, const QString& id, const QString& title, const QString& shortcut) {
73+ auto * dock = new KDDockWidgets::DockWidget (id);
74+ dock->setWidget (widget);
75+ dock->setTitle (title);
76+ dock->toggleAction ()->setShortcut (shortcut);
77+ return dock;
78+ };
79+
80+ m_timelineDockA = dockify (m_timelineA, QStringLiteral (" timelinea" ), tr (" Timeline A" ), tr (" Ctrl+A" ));
81+ m_contents->addDockWidget (m_timelineDockA, KDDockWidgets::Location_OnBottom);
82+ m_timelineDockB = dockify (m_timelineB, QStringLiteral (" timelineb" ), tr (" Timeline B" ), tr (" Ctrl+B" ));
83+ m_timelineDockA->addDockWidgetAsTab (m_timelineDockB);
84+
85+ auto costThreshold = new QDoubleSpinBox (this );
86+ costThreshold->setDecimals (2 );
87+ costThreshold->setMinimum (0 );
88+ costThreshold->setMaximum (99.90 );
89+ costThreshold->setPrefix (tr (" Cost Threshold: " ));
90+ costThreshold->setSuffix (QStringLiteral (" %" ));
91+ costThreshold->setValue (0.01 );
92+ costThreshold->setSingleStep (0.01 );
93+ connect (costThreshold, static_cast <void (QDoubleSpinBox::*)(double )>(&QDoubleSpinBox::valueChanged), this ,
94+ [diffProxy](double threshold) { diffProxy->setThreshold (threshold); });
95+
96+ ui->bottomUpVerticalLayout ->addWidget (costThreshold);
97+ ui->bottomUpVerticalLayout ->addWidget (m_contents);
98+
5699 auto repositionFilterBusyIndicator = [this ] {
57100 auto geometry = m_filterBusyIndicator->geometry ();
58101 geometry.setWidth (width () / 2 );
@@ -104,6 +147,15 @@ DiffViewWidget::DiffViewWidget(QWidget* parent)
104147 }
105148 });
106149
150+ connect (m_filterAndZoomStackA, &FilterAndZoomStack::filterChanged, this , [this ](const Data::FilterAction& action) {
151+ m_bFinished = true ;
152+ m_parserA->filterResults (action);
153+ });
154+ connect (m_filterAndZoomStackB, &FilterAndZoomStack::filterChanged, this , [this ](const Data::FilterAction& action) {
155+ m_aFinished = true ;
156+ m_parserB->filterResults (action);
157+ });
158+
107159 {
108160 m_filterBusyIndicator = new QWidget (this );
109161 m_filterBusyIndicator->setMinimumHeight (100 );
0 commit comments