2021-09-04 18:11:52 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QLineEdit>
|
2021-10-06 00:39:40 +01:00
|
|
|
#include <QScrollArea>
|
2021-09-04 18:11:52 +01:00
|
|
|
#include <set>
|
|
|
|
|
#include <QSize>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QEvent>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
#include "ItemWidget.hpp"
|
2021-10-06 00:39:40 +01:00
|
|
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PanelWidget.hpp"
|
|
|
|
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
|
2021-09-04 18:11:52 +01:00
|
|
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
|
|
|
|
#include "src/Targets/TargetState.hpp"
|
|
|
|
|
#include "src/Targets/TargetDescriptor.hpp"
|
|
|
|
|
|
|
|
|
|
namespace Bloom::Widgets
|
|
|
|
|
{
|
|
|
|
|
class RegisterGroupWidget;
|
|
|
|
|
class TargetRegistersPaneWidget: public QWidget
|
|
|
|
|
{
|
2021-10-06 21:12:31 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
bool activated = false;
|
|
|
|
|
|
|
|
|
|
TargetRegistersPaneWidget(
|
|
|
|
|
const Targets::TargetDescriptor& targetDescriptor,
|
|
|
|
|
InsightWorker& insightWorker,
|
|
|
|
|
PanelWidget *parent
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
void filterRegisters(const QString& keyword);
|
|
|
|
|
void collapseAllRegisterGroups();
|
|
|
|
|
void expandAllRegisterGroups();
|
|
|
|
|
|
|
|
|
|
void refreshRegisterValues(std::optional<std::function<void(void)>> callback = std::nullopt);
|
|
|
|
|
|
|
|
|
|
void activate();
|
|
|
|
|
void deactivate();
|
|
|
|
|
|
|
|
|
|
public slots:
|
2021-10-21 19:24:48 +01:00
|
|
|
void onItemSelectionChange(Bloom::Widgets::ItemWidget* newlySelectedWidget);
|
2021-10-06 21:12:31 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
|
|
|
|
|
|
virtual void postActivate();
|
|
|
|
|
virtual void postDeactivate();
|
|
|
|
|
|
2021-09-04 18:11:52 +01:00
|
|
|
private:
|
|
|
|
|
const Targets::TargetDescriptor& targetDescriptor;
|
|
|
|
|
InsightWorker& insightWorker;
|
|
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
PanelWidget* parent = nullptr;
|
2021-09-04 18:11:52 +01:00
|
|
|
QWidget* container = nullptr;
|
|
|
|
|
|
|
|
|
|
QWidget* toolBar = nullptr;
|
|
|
|
|
SvgToolButton* collapseAllButton = nullptr;
|
|
|
|
|
SvgToolButton* expandAllButton = nullptr;
|
|
|
|
|
|
|
|
|
|
QLineEdit* searchInput = nullptr;
|
2021-10-06 00:39:40 +01:00
|
|
|
QScrollArea* itemScrollArea = nullptr;
|
2021-09-04 18:11:52 +01:00
|
|
|
QWidget* itemContainer = nullptr;
|
|
|
|
|
|
|
|
|
|
ItemWidget* selectedItemWidget = nullptr;
|
|
|
|
|
|
|
|
|
|
std::set<RegisterGroupWidget*> registerGroupWidgets;
|
|
|
|
|
Targets::TargetRegisterDescriptors renderedDescriptors;
|
|
|
|
|
|
|
|
|
|
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onTargetStateChanged(Targets::TargetState newState);
|
2021-09-11 20:45:26 +01:00
|
|
|
void onRegistersRead(const Targets::TargetRegisters& registers);
|
2021-09-04 18:11:52 +01:00
|
|
|
};
|
|
|
|
|
}
|