2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QtUiTools/QtUiTools>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
2021-04-08 20:42:23 +01:00
|
|
|
#include "src/ApplicationConfig.hpp"
|
2021-09-02 21:19:46 +01:00
|
|
|
#include "src/Insight/InsightWorker/InsightWorker.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"
|
|
|
|
|
#include "src/Targets/TargetVariant.hpp"
|
|
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
#include "Widgets/PanelWidget.hpp"
|
|
|
|
|
|
2021-09-26 18:18:12 +01:00
|
|
|
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
2021-09-02 21:19:46 +01:00
|
|
|
#include "Widgets/TargetWidgets/TargetPackageWidget.hpp"
|
2021-09-04 18:11:52 +01:00
|
|
|
#include "Widgets/TargetRegistersPane/TargetRegistersPaneWidget.hpp"
|
2021-09-02 21:19:46 +01:00
|
|
|
#include "AboutWindow.hpp"
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
namespace Bloom
|
|
|
|
|
{
|
2021-10-06 00:39:40 +01:00
|
|
|
class InsightWindow: public QMainWindow
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
private:
|
2021-05-30 16:53:24 +01:00
|
|
|
InsightConfig insightConfig;
|
|
|
|
|
EnvironmentConfig environmentConfig;
|
|
|
|
|
TargetConfig targetConfig;
|
|
|
|
|
|
2021-09-02 21:19:46 +01:00
|
|
|
InsightWorker& insightWorker;
|
|
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
bool activated = false;
|
|
|
|
|
|
2021-05-24 20:58:49 +01:00
|
|
|
Targets::TargetDescriptor targetDescriptor;
|
|
|
|
|
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
QWidget* windowContainer = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
QMenuBar* mainMenuBar = nullptr;
|
2021-10-06 00:39:40 +01:00
|
|
|
QWidget* layoutContainer = nullptr;
|
|
|
|
|
QWidget* container = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
QMenu* variantMenu = nullptr;
|
2021-10-06 00:39:40 +01:00
|
|
|
AboutWindow* aboutWindowWidget = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
QWidget* header = nullptr;
|
|
|
|
|
QToolButton* refreshIoInspectionButton = nullptr;
|
|
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
QWidget* leftMenuBar = nullptr;
|
|
|
|
|
Widgets::PanelWidget* leftPanel = nullptr;
|
2021-09-04 18:11:52 +01:00
|
|
|
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
|
|
|
|
QToolButton* targetRegistersButton = nullptr;
|
2021-09-26 18:18:12 +01:00
|
|
|
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
2021-10-06 00:39:40 +01:00
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
QLabel* ioUnavailableWidget = nullptr;
|
2021-07-07 20:54:45 +01:00
|
|
|
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
QWidget* bottomMenuBar = nullptr;
|
|
|
|
|
Widgets::PanelWidget* bottomPanel = nullptr;
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
QWidget* footer = nullptr;
|
|
|
|
|
QLabel* targetStatusLabel = nullptr;
|
|
|
|
|
QLabel* programCounterValueLabel = nullptr;
|
|
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
2021-05-24 20:58:49 +01:00
|
|
|
const Targets::TargetVariant* selectedVariant = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
bool uiDisabled = false;
|
|
|
|
|
|
2021-06-21 00:14:31 +01:00
|
|
|
static bool isVariantSupported(const Targets::TargetVariant& variant);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-05-24 20:58:49 +01:00
|
|
|
void selectVariant(const Targets::TargetVariant* variant);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
void toggleUi(bool disable);
|
|
|
|
|
void activate();
|
|
|
|
|
void deactivate();
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-10-06 00:39:40 +01:00
|
|
|
void adjustPanels();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
|
void showEvent(QShowEvent* event) override;
|
|
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
public:
|
2021-10-06 00:39:40 +01:00
|
|
|
InsightWindow(InsightWorker& insightWorker);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
|
|
|
|
this->environmentConfig = environmentConfig;
|
|
|
|
|
this->targetConfig = environmentConfig.targetConfig;
|
2021-04-04 21:04:12 +01:00
|
|
|
}
|
|
|
|
|
|
2021-05-30 16:53:24 +01:00
|
|
|
void setInsightConfig(const InsightConfig& insightConfig) {
|
|
|
|
|
this->insightConfig = insightConfig;
|
|
|
|
|
}
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-09-02 21:19:46 +01:00
|
|
|
void init(Targets::TargetDescriptor targetDescriptor);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
public slots:
|
2021-05-30 16:53:24 +01:00
|
|
|
void onTargetControllerSuspended();
|
|
|
|
|
void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
2021-05-24 20:58:49 +01:00
|
|
|
void onTargetStateUpdate(Targets::TargetState newState);
|
2021-04-04 21:04:12 +01:00
|
|
|
void onTargetProgramCounterUpdate(quint32 programCounter);
|
|
|
|
|
void openReportIssuesUrl();
|
2021-09-04 18:12:32 +01:00
|
|
|
void openGettingStartedUrl();
|
2021-04-04 21:04:12 +01:00
|
|
|
void openAboutWindow();
|
2021-09-04 18:11:52 +01:00
|
|
|
void toggleTargetRegistersPane();
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void refreshTargetPinStates(int variantId);
|
|
|
|
|
};
|
|
|
|
|
}
|