27
27
28
28
#include " diffviewwidget.h"
29
29
30
+ #include < QAction>
31
+ #include < QDoubleSpinBox>
30
32
#include < QLabel>
33
+ #include < QMenu>
31
34
#include < QProgressBar>
32
35
36
+ #include < kddockwidgets/DockWidget.h>
37
+ #include < kddockwidgets/MainWindow.h>
38
+
39
+ #include " diffviewproxy.h"
33
40
#include " dockwidgetsetup.h"
34
41
#include " filterandzoomstack.h"
35
42
#include " models/treemodel.h"
@@ -45,14 +52,50 @@ DiffViewWidget::DiffViewWidget(QWidget* parent)
45
52
, ui(new Ui::ResultsDiffPage)
46
53
, m_parserA(new PerfParser(this ))
47
54
, m_parserB(new PerfParser(this ))
55
+ , m_filterAndZoomStackA(new FilterAndZoomStack(this ))
56
+ , m_filterAndZoomStackB(new FilterAndZoomStack(this ))
57
+ , m_filterMenu(new QMenu(this ))
48
58
, 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 ))
49
62
{
50
63
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);
53
69
ui->diffTreeView ->sortByColumn (DiffViewModel::InitialSortColumn, Qt::DescendingOrder);
54
70
ResultsUtil::setupCostDelegate<DiffViewModel>(m_model, ui->diffTreeView );
55
71
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
+
56
99
auto repositionFilterBusyIndicator = [this ] {
57
100
auto geometry = m_filterBusyIndicator->geometry ();
58
101
geometry.setWidth (width () / 2 );
@@ -104,6 +147,15 @@ DiffViewWidget::DiffViewWidget(QWidget* parent)
104
147
}
105
148
});
106
149
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
+
107
159
{
108
160
m_filterBusyIndicator = new QWidget (this );
109
161
m_filterBusyIndicator->setMinimumHeight (100 );
0 commit comments