Made Insight settings object mutable via Insight
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Bloom
|
|||||||
const ProjectConfig& projectConfig,
|
const ProjectConfig& projectConfig,
|
||||||
const EnvironmentConfig& environmentConfig,
|
const EnvironmentConfig& environmentConfig,
|
||||||
const InsightConfig& insightConfig,
|
const InsightConfig& insightConfig,
|
||||||
const InsightProjectSettings& insightProjectSettings
|
InsightProjectSettings& insightProjectSettings
|
||||||
):
|
):
|
||||||
eventManager(eventManager),
|
eventManager(eventManager),
|
||||||
projectConfig(projectConfig),
|
projectConfig(projectConfig),
|
||||||
@@ -74,7 +74,7 @@ namespace Bloom
|
|||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
InsightConfig insightConfig;
|
InsightConfig insightConfig;
|
||||||
|
|
||||||
InsightProjectSettings insightProjectSettings;
|
InsightProjectSettings& insightProjectSettings;
|
||||||
|
|
||||||
EventManager& eventManager;
|
EventManager& eventManager;
|
||||||
EventListenerPointer eventListener = std::make_shared<EventListener>("InsightEventListener");
|
EventListenerPointer eventListener = std::make_shared<EventListener>("InsightEventListener");
|
||||||
@@ -84,7 +84,8 @@ namespace Bloom
|
|||||||
InsightWindow* mainWindow = new InsightWindow(
|
InsightWindow* mainWindow = new InsightWindow(
|
||||||
*(this->insightWorker),
|
*(this->insightWorker),
|
||||||
this->environmentConfig,
|
this->environmentConfig,
|
||||||
this->insightConfig
|
this->insightConfig,
|
||||||
|
this->insightProjectSettings
|
||||||
);
|
);
|
||||||
|
|
||||||
TargetControllerConsole targetControllerConsole = TargetControllerConsole(
|
TargetControllerConsole targetControllerConsole = TargetControllerConsole(
|
||||||
|
|||||||
@@ -30,17 +30,30 @@ using Bloom::Targets::TargetMemoryType;
|
|||||||
InsightWindow::InsightWindow(
|
InsightWindow::InsightWindow(
|
||||||
InsightWorker& insightWorker,
|
InsightWorker& insightWorker,
|
||||||
const EnvironmentConfig& environmentConfig,
|
const EnvironmentConfig& environmentConfig,
|
||||||
const InsightConfig& insightConfig
|
const InsightConfig& insightConfig,
|
||||||
|
InsightProjectSettings& insightProjectSettings
|
||||||
):
|
):
|
||||||
QMainWindow(nullptr),
|
QMainWindow(nullptr),
|
||||||
insightWorker(insightWorker),
|
insightWorker(insightWorker),
|
||||||
environmentConfig(environmentConfig),
|
environmentConfig(environmentConfig),
|
||||||
targetConfig(environmentConfig.targetConfig),
|
targetConfig(environmentConfig.targetConfig),
|
||||||
insightConfig(insightConfig)
|
insightConfig(insightConfig),
|
||||||
|
insightProjectSettings(insightProjectSettings)
|
||||||
{
|
{
|
||||||
this->setObjectName("main-window");
|
this->setObjectName("main-window");
|
||||||
this->setWindowTitle("Bloom Insight");
|
this->setWindowTitle("Bloom Insight");
|
||||||
this->setMinimumSize(1000, 500);
|
|
||||||
|
const auto defaultMinimumSize = QSize(1000, 500);
|
||||||
|
|
||||||
|
if (this->insightProjectSettings.mainWindowSize.has_value()) {
|
||||||
|
this->setMinimumSize(
|
||||||
|
std::max(this->insightProjectSettings.mainWindowSize->width(), defaultMinimumSize.width()),
|
||||||
|
std::max(this->insightProjectSettings.mainWindowSize->height(), defaultMinimumSize.height())
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this->setMinimumSize(defaultMinimumSize);
|
||||||
|
}
|
||||||
|
|
||||||
auto mainWindowUiFile = QFile(
|
auto mainWindowUiFile = QFile(
|
||||||
QString::fromStdString(Paths::compiledResourcesPath()
|
QString::fromStdString(Paths::compiledResourcesPath()
|
||||||
@@ -220,6 +233,12 @@ void InsightWindow::showEvent(QShowEvent* event) {
|
|||||||
this->adjustMinimumSize();
|
this->adjustMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsightWindow::closeEvent(QCloseEvent* event) {
|
||||||
|
this->insightProjectSettings.mainWindowSize = this->size();
|
||||||
|
|
||||||
|
return QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
|
bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
|
||||||
const auto pinCount = variant.pinDescriptorsByNumber.size();
|
const auto pinCount = variant.pinDescriptorsByNumber.size();
|
||||||
|
|
||||||
@@ -466,18 +485,25 @@ void InsightWindow::createPanes() {
|
|||||||
this->targetRegistersButton->setChecked(false);
|
this->targetRegistersButton->setChecked(false);
|
||||||
this->targetRegistersButton->setDisabled(false);
|
this->targetRegistersButton->setDisabled(false);
|
||||||
|
|
||||||
|
auto& memoryInspectionPaneSettingsByMemoryType =
|
||||||
|
this->insightProjectSettings.memoryInspectionPaneSettingsByMemoryType;
|
||||||
|
|
||||||
// Target memory inspection panes
|
// Target memory inspection panes
|
||||||
auto* bottomPanelLayout = this->bottomPanel->layout();
|
auto* bottomPanelLayout = this->bottomPanel->layout();
|
||||||
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::RAM)) {
|
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::RAM)) {
|
||||||
auto& ramDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::RAM);
|
auto& ramDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::RAM);
|
||||||
|
|
||||||
|
if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::RAM)) {
|
||||||
|
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::RAM] = TargetMemoryInspectionPaneSettings();
|
||||||
|
}
|
||||||
|
|
||||||
this->ramInspectionPane = new TargetMemoryInspectionPane(
|
this->ramInspectionPane = new TargetMemoryInspectionPane(
|
||||||
ramDescriptor,
|
ramDescriptor,
|
||||||
this->memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::RAM) ?
|
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::RAM],
|
||||||
this->memoryInspectionPaneSettingsByMemoryType.at(TargetMemoryType::RAM)
|
|
||||||
: TargetMemoryInspectionPaneSettings(),
|
|
||||||
this->insightWorker,
|
this->insightWorker,
|
||||||
this->bottomPanel
|
this->bottomPanel
|
||||||
);
|
);
|
||||||
|
|
||||||
bottomPanelLayout->addWidget(this->ramInspectionPane);
|
bottomPanelLayout->addWidget(this->ramInspectionPane);
|
||||||
this->ramInspectionPane->deactivate();
|
this->ramInspectionPane->deactivate();
|
||||||
this->ramInspectionButton->setChecked(false);
|
this->ramInspectionButton->setChecked(false);
|
||||||
@@ -486,14 +512,18 @@ void InsightWindow::createPanes() {
|
|||||||
|
|
||||||
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::EEPROM)) {
|
if (this->targetDescriptor.memoryDescriptorsByType.contains(TargetMemoryType::EEPROM)) {
|
||||||
auto& eepromDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::EEPROM);
|
auto& eepromDescriptor = this->targetDescriptor.memoryDescriptorsByType.at(TargetMemoryType::EEPROM);
|
||||||
|
|
||||||
|
if (!memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::EEPROM)) {
|
||||||
|
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::EEPROM] = TargetMemoryInspectionPaneSettings();
|
||||||
|
}
|
||||||
|
|
||||||
this->eepromInspectionPane = new TargetMemoryInspectionPane(
|
this->eepromInspectionPane = new TargetMemoryInspectionPane(
|
||||||
eepromDescriptor,
|
eepromDescriptor,
|
||||||
this->memoryInspectionPaneSettingsByMemoryType.contains(TargetMemoryType::EEPROM) ?
|
memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::EEPROM],
|
||||||
this->memoryInspectionPaneSettingsByMemoryType.at(TargetMemoryType::EEPROM)
|
|
||||||
: TargetMemoryInspectionPaneSettings(),
|
|
||||||
this->insightWorker,
|
this->insightWorker,
|
||||||
this->bottomPanel
|
this->bottomPanel
|
||||||
);
|
);
|
||||||
|
|
||||||
bottomPanelLayout->addWidget(this->eepromInspectionPane);
|
bottomPanelLayout->addWidget(this->eepromInspectionPane);
|
||||||
this->eepromInspectionPane->deactivate();
|
this->eepromInspectionPane->deactivate();
|
||||||
this->eepromInspectionButton->setChecked(false);
|
this->eepromInspectionButton->setChecked(false);
|
||||||
@@ -515,8 +545,6 @@ void InsightWindow::destroyPanes() {
|
|||||||
* hex viewer settings, etc), in order to persist them through debug sessions.
|
* hex viewer settings, etc), in order to persist them through debug sessions.
|
||||||
*/
|
*/
|
||||||
if (this->ramInspectionPane != nullptr) {
|
if (this->ramInspectionPane != nullptr) {
|
||||||
this->memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::RAM] = this->ramInspectionPane->settings;
|
|
||||||
|
|
||||||
this->ramInspectionPane->deactivate();
|
this->ramInspectionPane->deactivate();
|
||||||
this->ramInspectionPane->deleteLater();
|
this->ramInspectionPane->deleteLater();
|
||||||
this->ramInspectionPane = nullptr;
|
this->ramInspectionPane = nullptr;
|
||||||
@@ -527,8 +555,6 @@ void InsightWindow::destroyPanes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->eepromInspectionPane != nullptr) {
|
if (this->eepromInspectionPane != nullptr) {
|
||||||
this->memoryInspectionPaneSettingsByMemoryType[TargetMemoryType::EEPROM] = this->eepromInspectionPane->settings;
|
|
||||||
|
|
||||||
this->eepromInspectionPane->deactivate();
|
this->eepromInspectionPane->deactivate();
|
||||||
this->eepromInspectionPane->deleteLater();
|
this->eepromInspectionPane->deleteLater();
|
||||||
this->eepromInspectionPane = nullptr;
|
this->eepromInspectionPane = nullptr;
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QEvent>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#include "src/ProjectSettings.hpp"
|
||||||
#include "src/ProjectConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Targets/TargetState.hpp"
|
#include "src/Targets/TargetState.hpp"
|
||||||
@@ -33,7 +35,8 @@ namespace Bloom
|
|||||||
InsightWindow(
|
InsightWindow(
|
||||||
InsightWorker& insightWorker,
|
InsightWorker& insightWorker,
|
||||||
const EnvironmentConfig& environmentConfig,
|
const EnvironmentConfig& environmentConfig,
|
||||||
const InsightConfig& insightConfig
|
const InsightConfig& insightConfig,
|
||||||
|
InsightProjectSettings& insightProjectSettings
|
||||||
);
|
);
|
||||||
|
|
||||||
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
||||||
@@ -50,8 +53,11 @@ namespace Bloom
|
|||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
InsightProjectSettings& insightProjectSettings;
|
||||||
|
|
||||||
InsightConfig insightConfig;
|
InsightConfig insightConfig;
|
||||||
EnvironmentConfig environmentConfig;
|
EnvironmentConfig environmentConfig;
|
||||||
TargetConfig targetConfig;
|
TargetConfig targetConfig;
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ namespace Bloom::Widgets
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TargetMemoryInspectionPaneSettings settings;
|
TargetMemoryInspectionPaneSettings& settings;
|
||||||
bool activated = false;
|
bool activated = false;
|
||||||
|
|
||||||
TargetMemoryInspectionPane(
|
TargetMemoryInspectionPane(
|
||||||
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||||
const TargetMemoryInspectionPaneSettings& settings,
|
TargetMemoryInspectionPaneSettings& settings,
|
||||||
InsightWorker& insightWorker,
|
InsightWorker& insightWorker,
|
||||||
PanelWidget* parent
|
PanelWidget* parent
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user