summaryrefslogtreecommitdiff
path: root/plugins/warp/ui/shared/fetchdialog.h
blob: c642d31e40030d5489d1555c8023d72aba434781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once

#include <QDialog>
#include <QComboBox>
#include <QListWidget>
#include <QSpinBox>
#include <QCheckBox>

#include "uicontext.h"
#include "viewframe.h"
#include "warp.h"
#include "fetcher.h"

class WarpFetchDialog : public QDialog
{
	Q_OBJECT

	QComboBox* m_containerCombo;

	QListWidget* m_tagsList;
	QPushButton* m_addTagBtn;
	QPushButton* m_removeTagBtn;
	QPushButton* m_resetTagBtn;

	QSpinBox* m_batchSize;
	QCheckBox* m_rerunMatcher;
	QCheckBox* m_clearProcessed;

	std::vector<Warp::Ref<Warp::Container>> m_containers;

	std::shared_ptr<WarpFetcher> m_fetchProcessor;
	BinaryViewRef m_bv;

public:
	explicit WarpFetchDialog(BinaryViewRef bv, std::shared_ptr<WarpFetcher> fetchProcessor, QWidget* parent = nullptr);

private slots:
	void onAddTag();

	void onRemoveTag();

	void onResetTags();

	void onAccept();

	void onReject();

private:
	void populateContainers();

	std::vector<Warp::SourceTag> collectTags() const;

	void runBatchedFetch(const std::optional<size_t>& containerIndex, const std::vector<Warp::SourceTag>& allowedTags,
		size_t batchSize, bool rerunMatcher);
};

void RegisterWarpFetchFunctionsCommand();