1111#include " warp.h"
1212#include " shared/misc.h"
1313
14- WarpCurrentFunctionWidget::WarpCurrentFunctionWidget ()
14+ WarpCurrentFunctionWidget::WarpCurrentFunctionWidget (QWidget* parent) : QWidget(parent )
1515{
1616 // We must explicitly support no current function.
1717 m_current = nullptr ;
@@ -31,10 +31,27 @@ WarpCurrentFunctionWidget::WarpCurrentFunctionWidget()
3131 m_splitter = new QSplitter (Qt::Vertical);
3232 m_splitter->setContentsMargins (0 , 0 , 0 , 0 );
3333
34+ // Wrap the table and the spinner so that we can overlay the spinner on the table.
35+ QWidget* tableWrapper = new QWidget (m_splitter);
36+ QGridLayout* wrapperLayout = new QGridLayout (tableWrapper);
37+ wrapperLayout->setContentsMargins (0 , 0 , 0 , 0 );
38+
3439 // Add a widget to display the matches.
35- m_tableWidget = new WarpFunctionTableWidget (this );
40+ m_tableWidget = new WarpFunctionTableWidget (tableWrapper );
3641 m_tableWidget->setContentsMargins (0 , 0 , 0 , 0 );
37- m_splitter->addWidget (m_tableWidget);
42+
43+ // Spinner for when we are fetching functions over the network.
44+ m_spinner = new QProgressBar (tableWrapper);
45+ m_spinner->setRange (0 , 0 );
46+ m_spinner->setTextVisible (false );
47+ m_spinner->setFixedHeight (6 );
48+ m_spinner->hide ();
49+
50+ // The table has no alignment, so it expands to fill the entire cell.
51+ wrapperLayout->addWidget (m_tableWidget, 0 , 0 );
52+ wrapperLayout->addWidget (m_spinner, 0 , 0 , Qt::AlignBottom);
53+
54+ m_splitter->addWidget (tableWrapper);
3855
3956 // Add a widget to display the info about the selected function match.
4057 m_infoWidget = new WarpFunctionInfoWidget (this );
@@ -145,10 +162,12 @@ void WarpCurrentFunctionWidget::SetCurrentFunction(FunctionRef current)
145162 if (!m_fetcher->m_requestInProgress .exchange (true ))
146163 {
147164 BinaryNinja::WorkerPriorityEnqueue ([this ]() {
165+ QMetaObject::invokeMethod (this , [this ] { m_spinner->show (); }, Qt::QueuedConnection);
148166 BinaryNinja::Ref bgTask = new BinaryNinja::BackgroundTask (" Fetching WARP Functions..." , true );
149167 const auto allowedTags = GetAllowedTagsFromView (m_current->GetView ());
150168 m_fetcher->FetchPendingFunctions (allowedTags);
151169 bgTask->Finish ();
170+ QMetaObject::invokeMethod (this , [this ] { m_spinner->hide (); }, Qt::QueuedConnection);
152171 });
153172 }
154173 }
0 commit comments