From 3c88b11e5df33116580ac008e36092775df66135 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 13 Mar 2026 12:24:18 -0700 Subject: [WARP] Improved UX and API - Exposes WARP type objects directly - Adds processor API (for generating warp files directly) - Adds file and chunk API - Misc cleanup - Simplified the amount of commands - Replaced the "Create" commands with a purpose built processor dialog - Added a native QT viewer for WARP files - Simplified committing to a remote with a purpose built commit dialog --- plugins/warp/ui/shared/processordialog.h | 127 +++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 plugins/warp/ui/shared/processordialog.h (limited to 'plugins/warp/ui/shared/processordialog.h') diff --git a/plugins/warp/ui/shared/processordialog.h b/plugins/warp/ui/shared/processordialog.h new file mode 100644 index 00000000..3f69601d --- /dev/null +++ b/plugins/warp/ui/shared/processordialog.h @@ -0,0 +1,127 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "binaryninjaapi.h" +#include "warp.h" +#include "file.h" + +// TODO: Both of these are bothersome but I don't really want to do a ID lookup. +Q_DECLARE_METATYPE(BinaryNinja::Ref) +Q_DECLARE_METATYPE(BinaryNinja::Ref) + +// Worker to run the processor +class WarpProcessorWorker : public QThread +{ + Q_OBJECT + + std::shared_ptr m_processor; + +public: + WarpProcessorWorker(std::shared_ptr processor, QObject* parent = nullptr) : + QThread(parent), m_processor(std::move(processor)) + {} + + void run() override + { + Warp::Ref file = m_processor->Start(); + emit finishedProcessing(file); + } + +signals: + void finishedProcessing(Warp::Ref file); +}; + +class ProcessorDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ProcessorDialog(QWidget* parent = nullptr); + ~ProcessorDialog() override; + + void onAddBinaryView(BinaryNinja::Ref view); + void onAddProjectFiles(); + +private slots: + void onStartProcessing(); + void onProcessingFinished(Warp::Ref file); + void onCancelProcessing(); + void onUpdateState(); + void onSaveToFile(); + void onCommit(); + void onAddPath(); + void onAddDirectory(); + void onRemoveItem(); + void onSearchItems(); + void onAddEntryMenu(); + void showContextMenu(const QPoint& pos); + +private: + void addAddActionsToMenu(QMenu* menu); + void addPathRecursive(const QString& path); + void addSinglePath(const QString& path); + struct ToProcessEntry + { + enum Type + { + ViewMode, + PathMode, + ProjectMode, + ProjectFileMode + } type; + BinaryNinja::Ref view; + std::string path; + BinaryNinja::Ref project; + BinaryNinja::Ref projectFile; + QString displayName; + }; + + Warp::Ref m_file; + std::shared_ptr m_processor; + std::vector m_toProcess; + + enum Page + { + ConfigurationPage = 0, + ProcessingPage = 1, + ResultsPage = 2 + }; + + QStackedWidget* m_stack; + + // Page 1: Configuration + QLineEdit* m_entrySearch; + QPushButton* m_addButton; + QListWidget* m_entryList; + + // Global Config + QComboBox* m_includedDataCombo; + QComboBox* m_includedFunctionsCombo; + QSpinBox* m_workerCountSpinBox; + QPushButton* m_processButton; + + // Page 2: Processing + QLabel* m_processingLabel; + QProgressBar* m_progressBar; + QListWidget* m_stateList; + QPushButton* m_cancelButton; + QTimer* m_updateTimer; + + // Page 3: Results + FileWidget* m_fileWidget; + QPushButton* m_saveButton; + QLabel* m_elapsedLabel; + QPushButton* m_commitButton; + + QElapsedTimer m_processTimer; +}; -- cgit v1.3.1