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