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 | |
| 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')
| -rw-r--r-- | plugins/warp/ui/matches.cpp | 25 | ||||
| -rw-r--r-- | plugins/warp/ui/matches.h | 4 | ||||
| -rw-r--r-- | plugins/warp/ui/plugin.cpp | 2 |
3 files changed, 26 insertions, 5 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); }); } } diff --git a/plugins/warp/ui/matches.h b/plugins/warp/ui/matches.h index 6a2061ef..1599dd54 100644 --- a/plugins/warp/ui/matches.h +++ b/plugins/warp/ui/matches.h @@ -1,6 +1,7 @@ #pragma once #include <QSplitter> +#include <QProgressBar> #include "filter.h" #include "render.h" @@ -13,6 +14,7 @@ class WarpCurrentFunctionWidget : public QWidget FunctionRef m_current; QSplitter* m_splitter; + QProgressBar* m_spinner; WarpFunctionTableWidget* m_tableWidget; WarpFunctionInfoWidget* m_infoWidget; @@ -22,7 +24,7 @@ class WarpCurrentFunctionWidget : public QWidget std::shared_ptr<WarpFetcher> m_fetcher; public: - explicit WarpCurrentFunctionWidget(); + explicit WarpCurrentFunctionWidget(QWidget* parent = nullptr); ~WarpCurrentFunctionWidget() override = default; diff --git a/plugins/warp/ui/plugin.cpp b/plugins/warp/ui/plugin.cpp index 9421cc02..e99059b9 100644 --- a/plugins/warp/ui/plugin.cpp +++ b/plugins/warp/ui/plugin.cpp @@ -136,7 +136,7 @@ WarpSidebarWidget::WarpSidebarWidget(BinaryViewRef data) : SidebarWidget("WARP") m_headerWidget->setLayout(headerLayout); QFrame* currentFunctionFrame = new QFrame(this); - m_currentFunctionWidget = new WarpCurrentFunctionWidget(); + m_currentFunctionWidget = new WarpCurrentFunctionWidget(this); QVBoxLayout* currentFunctionLayout = new QVBoxLayout(); currentFunctionLayout->setContentsMargins(0, 0, 0, 0); currentFunctionLayout->setSpacing(0); |
