2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
|
#include <QMainWindow>
|
2022-01-22 16:14:03 +00:00
|
|
|
#include <QEvent>
|
2021-04-04 21:04:12 +01:00
|
|
|
#include <memory>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
2022-01-22 16:14:03 +00:00
|
|
|
#include "src/ProjectSettings.hpp"
|
2021-12-31 17:05:31 +00:00
|
|
|
#include "src/ProjectConfig.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/Targets/TargetState.hpp"
|
2021-09-02 21:19:46 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/Targets/TargetDescriptor.hpp"
|
2023-05-30 00:40:36 +01:00
|
|
|
#include "src/Targets/TargetMemory.hpp"
|
2024-12-24 18:27:59 +00:00
|
|
|
#include "src/Targets/TargetVariantDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetPinoutDescriptor.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-05-03 20:00:52 +01:00
|
|
|
#include "Widgets/Label.hpp"
|
2021-12-08 00:18:59 +00:00
|
|
|
#include "Widgets/SvgToolButton.hpp"
|
2025-02-18 00:35:39 +00:00
|
|
|
#include "Widgets/PinoutWidgets/PinoutContainer.hpp"
|
|
|
|
|
#include "Widgets/PinoutWidgets/PinoutScene.hpp"
|
2023-03-12 23:32:44 +00:00
|
|
|
#include "Widgets/PanelWidget.hpp"
|
2021-09-04 18:11:52 +01:00
|
|
|
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
2021-10-17 20:44:40 +01:00
|
|
|
#include "Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPane.hpp"
|
2024-12-24 18:27:59 +00:00
|
|
|
#include "Widgets/TargetMemoryInspectionPane/ToolButton.hpp"
|
2021-12-25 01:46:47 +00:00
|
|
|
#include "Widgets/TargetMemoryInspectionPane/TargetMemoryInspectionPaneSettings.hpp"
|
2023-03-12 23:32:44 +00:00
|
|
|
#include "Widgets/TaskIndicator/TaskIndicator.hpp"
|
2021-09-02 21:19:46 +01:00
|
|
|
#include "AboutWindow.hpp"
|
|
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
class InsightWindow: public QMainWindow
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
2023-08-13 15:47:51 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
InsightWindow(
|
2025-02-18 00:35:39 +00:00
|
|
|
InsightProjectSettings& settings,
|
2023-08-19 21:53:00 +01:00
|
|
|
const InsightConfig& insightConfig,
|
|
|
|
|
const EnvironmentConfig& environmentConfig,
|
2024-12-24 18:27:59 +00:00
|
|
|
const Targets::TargetDescriptor& targetDescriptor,
|
|
|
|
|
const Targets::TargetState& targetState
|
2023-08-13 15:47:51 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
|
void showEvent(QShowEvent* event) override;
|
|
|
|
|
void closeEvent(QCloseEvent* event) override;
|
|
|
|
|
|
|
|
|
|
private:
|
2025-02-18 00:35:39 +00:00
|
|
|
InsightProjectSettings& settings;
|
2023-08-13 15:47:51 +01:00
|
|
|
|
|
|
|
|
InsightConfig insightConfig;
|
|
|
|
|
EnvironmentConfig environmentConfig;
|
|
|
|
|
TargetConfig targetConfig;
|
|
|
|
|
|
|
|
|
|
const Targets::TargetDescriptor& targetDescriptor;
|
2024-12-24 18:27:59 +00:00
|
|
|
const Targets::TargetState& targetState;
|
2023-08-13 15:47:51 +01:00
|
|
|
|
|
|
|
|
QWidget* windowContainer = nullptr;
|
|
|
|
|
QMenuBar* mainMenuBar = nullptr;
|
|
|
|
|
QWidget* layoutContainer = nullptr;
|
|
|
|
|
QWidget* container = nullptr;
|
|
|
|
|
QMenu* variantMenu = nullptr;
|
|
|
|
|
Widgets::Label* targetNameLabel = nullptr;
|
|
|
|
|
Widgets::Label* targetIdLabel = nullptr;
|
|
|
|
|
AboutWindow* aboutWindowWidget = nullptr;
|
|
|
|
|
|
|
|
|
|
QWidget* header = nullptr;
|
2025-02-18 00:35:39 +00:00
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
2025-02-18 00:35:39 +00:00
|
|
|
QAction* refreshRegistersOnTargetStopAction = nullptr;
|
|
|
|
|
QAction* refreshGpioOnTargetStopAction = nullptr;
|
2023-08-13 15:47:51 +01:00
|
|
|
|
|
|
|
|
QWidget* leftMenuBar = nullptr;
|
|
|
|
|
Widgets::PanelWidget* leftPanel = nullptr;
|
|
|
|
|
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
|
|
|
|
QToolButton* targetRegistersButton = nullptr;
|
|
|
|
|
|
2025-02-18 00:35:39 +00:00
|
|
|
Widgets::PinoutWidgets::PinoutContainer* pinoutContainerWidget = nullptr;
|
|
|
|
|
Widgets::PinoutWidgets::PinoutScene* pinoutScene = nullptr;
|
2023-08-13 15:47:51 +01:00
|
|
|
|
|
|
|
|
QWidget* bottomMenuBar = nullptr;
|
2024-12-24 18:27:59 +00:00
|
|
|
QHBoxLayout* bottomMenuBarLayout = nullptr;
|
2023-08-13 15:47:51 +01:00
|
|
|
Widgets::PanelWidget* bottomPanel = nullptr;
|
2024-12-24 18:27:59 +00:00
|
|
|
std::vector<Widgets::TargetMemoryInspectionPane*> memoryInspectionPaneWidgets = {};
|
2023-08-13 15:47:51 +01:00
|
|
|
|
|
|
|
|
QWidget* footer = nullptr;
|
|
|
|
|
Widgets::Label* targetStatusLabel = nullptr;
|
|
|
|
|
Widgets::Label* programCounterValueLabel = nullptr;
|
|
|
|
|
Widgets::TaskIndicator* taskIndicator = nullptr;
|
|
|
|
|
|
2024-12-24 18:27:59 +00:00
|
|
|
const Targets::TargetVariantDescriptor* selectedVariantDescriptor = nullptr;
|
2023-08-13 15:47:51 +01:00
|
|
|
bool uiDisabled = false;
|
|
|
|
|
|
|
|
|
|
void setUiDisabled(bool disable);
|
|
|
|
|
|
|
|
|
|
void populateVariantMenu();
|
|
|
|
|
void selectDefaultVariant();
|
2024-12-24 18:27:59 +00:00
|
|
|
void selectVariant(const Targets::TargetVariantDescriptor* variantDescriptor);
|
2023-08-13 15:47:51 +01:00
|
|
|
void createPanes();
|
|
|
|
|
|
|
|
|
|
void adjustPanels();
|
|
|
|
|
void adjustMinimumSize();
|
|
|
|
|
|
2024-12-24 18:27:59 +00:00
|
|
|
void onTargetStateUpdate(Targets::TargetState newState, Targets::TargetState previousState);
|
2025-02-18 00:35:39 +00:00
|
|
|
void setRefreshRegistersOnTargetStopped(bool enabled);
|
|
|
|
|
void setRefreshGpioOnTargetStopped(bool enabled);
|
|
|
|
|
void refresh(bool refreshRegisters, bool refreshGpio);
|
2024-12-24 18:27:59 +00:00
|
|
|
void refreshPadStates();
|
2023-08-13 15:47:51 +01:00
|
|
|
void openReportIssuesUrl();
|
|
|
|
|
void openGettingStartedUrl();
|
|
|
|
|
void openAboutWindow();
|
|
|
|
|
void toggleTargetRegistersPane();
|
2024-12-24 18:27:59 +00:00
|
|
|
void toggleMemoryInspectionPane(Widgets::TargetMemoryInspectionPane* pane);
|
2023-08-13 15:47:51 +01:00
|
|
|
void toggleEepromInspectionPane();
|
|
|
|
|
void toggleFlashInspectionPane();
|
|
|
|
|
void onRegistersPaneStateChanged();
|
2024-12-24 18:27:59 +00:00
|
|
|
void onMemoryInspectionPaneStateChanged(Widgets::TargetMemoryInspectionPane* pane, Widgets::ToolButton* toolBtn);
|
2023-08-13 15:47:51 +01:00
|
|
|
void onProgrammingModeEnabled();
|
|
|
|
|
void onProgrammingModeDisabled();
|
|
|
|
|
};
|