diff options
| author | Mason Reed <mason@vector35.com> | 2026-03-03 09:42:14 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-03-24 18:46:48 -0700 |
| commit | cc5f4dfc9d970ccd21bbd6f13b7235bc21990031 (patch) | |
| tree | 5ba8514adfbcdadd9f8922a56cfe38d79b013033 /plugins/warp/ui/matches.cpp | |
| parent | f852785e4ae0eb9bd560566221e9f6d70c895b32 (diff) | |
[WARP] Add a spinner to the possible matches widget while fetching from network
A little extra pizzaz
Diffstat (limited to 'plugins/warp/ui/matches.cpp')
| -rw-r--r-- | plugins/warp/ui/matches.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/plugins/warp/ui/matches.cpp b/plugins/warp/ui/matches.cpp index 289c1102..cede06ab 100644 --- a/plugins/warp/ui/matches.cpp +++ b/plugins/warp/ui/matches.cpp @@ -11,7 +11,7 @@ #include "warp.h" #include "shared/misc.h" -WarpCurrentFunctionWidget::WarpCurrentFunctionWidget() +WarpCurrentFunctionWidget::WarpCurrentFunctionWidget(QWidget* parent) : QWidget(parent) { // We must explicitly support no current function. m_current = nullptr; @@ -31,10 +31,27 @@ WarpCurrentFunctionWidget::WarpCurrentFunctionWidget() m_splitter = new QSplitter(Qt::Vertical); m_splitter->setContentsMargins(0, 0, 0, 0); + // Wrap the table and the spinner so that we can overlay the spinner on the table. + QWidget* tableWrapper = new QWidget(m_splitter); + QGridLayout* wrapperLayout = new QGridLayout(tableWrapper); + wrapperLayout->setContentsMargins(0, 0, 0, 0); + // Add a widget to display the matches. - m_tableWidget = new WarpFunctionTableWidget(this); + m_tableWidget = new WarpFunctionTableWidget(tableWrapper); m_tableWidget->setContentsMargins(0, 0, 0, 0); - m_splitter->addWidget(m_tableWidget); + + // Spinner for when we are fetching functions over the network. + m_spinner = new QProgressBar(tableWrapper); + m_spinner->setRange(0, 0); + m_spinner->setTextVisible(false); + m_spinner->setFixedHeight(6); + m_spinner->hide(); + + // The table has no alignment, so it expands to fill the entire cell. + wrapperLayout->addWidget(m_tableWidget, 0, 0); + wrapperLayout->addWidget(m_spinner, 0, 0, Qt::AlignBottom); + + m_splitter->addWidget(tableWrapper); // Add a widget to display the info about the selected function match. m_infoWidget = new WarpFunctionInfoWidget(this); @@ -145,10 +162,12 @@ void WarpCurrentFunctionWidget::SetCurrentFunction(FunctionRef current) if (!m_fetcher->m_requestInProgress.exchange(true)) { BinaryNinja::WorkerPriorityEnqueue([this]() { + QMetaObject::invokeMethod(this, [this] { m_spinner->show(); }, Qt::QueuedConnection); BinaryNinja::Ref bgTask = new BinaryNinja::BackgroundTask("Fetching WARP Functions...", true); const auto allowedTags = GetAllowedTagsFromView(m_current->GetView()); m_fetcher->FetchPendingFunctions(allowedTags); bgTask->Finish(); + QMetaObject::invokeMethod(this, [this] { m_spinner->hide(); }, Qt::QueuedConnection); }); } } |
