From 290275e8ea1a6736370ce0e26b8915b2b95f6303 Mon Sep 17 00:00:00 2001 From: chargeflux <20979457+chargeflux@users.noreply.github.com> Date: Thu, 28 Feb 2019 15:19:04 -0500 Subject: [PATCH] Debugger: Move hiding logic via setHidden() to before setFloating() --- Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp | 8 +++++--- Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 6 ++++-- Source/Core/DolphinQt/Debugger/JITWidget.cpp | 6 ++++-- Source/Core/DolphinQt/Debugger/MemoryWidget.cpp | 6 ++++-- Source/Core/DolphinQt/Debugger/RegisterWidget.cpp | 9 ++++++--- Source/Core/DolphinQt/Debugger/WatchWidget.cpp | 6 ++++-- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 27af010d23..d855b1af3a 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -26,11 +26,16 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent) setWindowTitle(tr("Breakpoints")); setObjectName(QStringLiteral("breakpoints")); + setHidden(!Settings::Instance().IsBreakpointsVisible() || + !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("breakpointwidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("breakpointwidget/floating")).toBool()); CreateWidgets(); @@ -61,9 +66,6 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons); UpdateIcons(); - setHidden(!Settings::Instance().IsBreakpointsVisible() || - !Settings::Instance().IsDebugModeEnabled()); - Update(); } diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index af13edfb3c..bdd8b5fa43 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -30,11 +30,15 @@ CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent) setWindowTitle(tr("Code")); setObjectName(QStringLiteral("code")); + setHidden(!Settings::Instance().IsCodeVisible() || !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("codewidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("codewidget/floating")).toBool()); connect(&Settings::Instance(), &Settings::CodeVisibilityChanged, @@ -53,8 +57,6 @@ CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &CodeWidget::Update); - setHidden(!Settings::Instance().IsCodeVisible() || !Settings::Instance().IsDebugModeEnabled()); - CreateWidgets(); ConnectWidgets(); diff --git a/Source/Core/DolphinQt/Debugger/JITWidget.cpp b/Source/Core/DolphinQt/Debugger/JITWidget.cpp index 4c52af61de..1ba4bc3bbd 100644 --- a/Source/Core/DolphinQt/Debugger/JITWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/JITWidget.cpp @@ -22,6 +22,8 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent) setWindowTitle(tr("JIT Blocks")); setObjectName(QStringLiteral("jitwidget")); + setHidden(!Settings::Instance().IsJITVisible() || !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); @@ -29,6 +31,8 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent) CreateWidgets(); restoreGeometry(settings.value(QStringLiteral("jitwidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("jitwidget/floating")).toBool()); m_table_splitter->restoreState( @@ -44,8 +48,6 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &JITWidget::Update); - setHidden(!Settings::Instance().IsJITVisible() || !Settings::Instance().IsDebugModeEnabled()); - ConnectWidgets(); #if defined(_M_X86) diff --git a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp index 4996560ae3..ec3f3ebf57 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp @@ -34,6 +34,8 @@ MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent) setWindowTitle(tr("Memory")); setObjectName(QStringLiteral("memory")); + setHidden(!Settings::Instance().IsMemoryVisible() || !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); CreateWidgets(); @@ -41,6 +43,8 @@ MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent) QSettings& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("memorywidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("memorywidget/floating")).toBool()); m_splitter->restoreState(settings.value(QStringLiteral("codewidget/splitter")).toByteArray()); @@ -52,8 +56,6 @@ MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &MemoryWidget::Update); - setHidden(!Settings::Instance().IsCodeVisible() || !Settings::Instance().IsDebugModeEnabled()); - LoadSettings(); ConnectWidgets(); diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp index ffe776e19f..5b62625ef1 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp @@ -21,11 +21,17 @@ RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent) { setWindowTitle(tr("Registers")); setObjectName(QStringLiteral("registers")); + + setHidden(!Settings::Instance().IsRegistersVisible() || + !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("registerwidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("registerwidget/floating")).toBool()); CreateWidgets(); @@ -47,9 +53,6 @@ RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::DebugModeToggled, [this](bool enabled) { setHidden(!enabled || !Settings::Instance().IsRegistersVisible()); }); - - setHidden(!Settings::Instance().IsRegistersVisible() || - !Settings::Instance().IsDebugModeEnabled()); } RegisterWidget::~RegisterWidget() diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp index a4c215fea9..810c431b12 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp @@ -28,11 +28,15 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent) setWindowTitle(tr("Watch")); setObjectName(QStringLiteral("watch")); + setHidden(!Settings::Instance().IsWatchVisible() || !Settings::Instance().IsDebugModeEnabled()); + setAllowedAreas(Qt::AllDockWidgetAreas); auto& settings = Settings::GetQSettings(); restoreGeometry(settings.value(QStringLiteral("watchwidget/geometry")).toByteArray()); + // macOS: setHidden() needs to be evaluated before setFloating() for proper window presentation + // according to Settings setFloating(settings.value(QStringLiteral("watchwidget/floating")).toBool()); CreateWidgets(); @@ -58,8 +62,6 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent) connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons); UpdateIcons(); - setHidden(!Settings::Instance().IsWatchVisible() || !Settings::Instance().IsDebugModeEnabled()); - Update(); }