From 3e24f6ab0b373d8718e26a19ac296044cc0d19c6 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 7 Oct 2025 14:30:37 -0400 Subject: [WARP] Improved fetch dialog UX - Respects views fetch batch size and allowed tags - Saves and loads from the view settings instead of qt settings --- plugins/warp/ui/shared/misc.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'plugins/warp/ui/shared/misc.h') diff --git a/plugins/warp/ui/shared/misc.h b/plugins/warp/ui/shared/misc.h index 35f640f5..57d71070 100644 --- a/plugins/warp/ui/shared/misc.h +++ b/plugins/warp/ui/shared/misc.h @@ -112,3 +112,30 @@ struct ParsedQuery return it.value(); } }; + +constexpr const char* ALLOWED_TAGS_SETTING = "warp.fetcher.allowedSourceTags"; +constexpr const char* BATCH_SIZE_SETTING = "warp.fetcher.fetchBatchSize"; + +inline std::vector GetAllowedTagsFromView(const BinaryViewRef& view) +{ + auto settings = BinaryNinja::Settings::Instance(); + if (!settings->Contains(ALLOWED_TAGS_SETTING)) + return {}; + return settings->Get>(ALLOWED_TAGS_SETTING, view); +} + +inline void SetTagsToView(const BinaryViewRef& view, const std::vector& tags) +{ + auto settings = BinaryNinja::Settings::Instance(); + if (!settings->Contains(ALLOWED_TAGS_SETTING)) + return; + settings->Set(ALLOWED_TAGS_SETTING, tags, view); +} + +inline int GetBatchSizeFromView(const BinaryViewRef& view) +{ + auto settings = BinaryNinja::Settings::Instance(); + if (!settings->Contains(BATCH_SIZE_SETTING)) + return 100; + return settings->Get(BATCH_SIZE_SETTING, view); +} \ No newline at end of file -- cgit v1.3.1