Skip to content
Permalink
Browse files

Merge pull request #8231 from JosJuice/debugger-hidden

DolphinQt: Don't update debug widgets when hidden
  • Loading branch information...
JMC47 committed Jul 7, 2019
2 parents ba20d30 + 92a655c commit 398aa2a9f976169c4ac8228f0969971f3e2ba2f3
@@ -41,14 +41,8 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
CreateWidgets();

connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
if (!Settings::Instance().IsDebugModeEnabled())
return;

bool is_initialised = state != Core::State::Uninitialized;
m_new->setEnabled(is_initialised);
m_load->setEnabled(is_initialised);
m_save->setEnabled(is_initialised);
if (!is_initialised)
UpdateButtonsEnabled();
if (state == Core::State::Uninitialized)
{
PowerPC::breakpoints.Clear();
PowerPC::memchecks.Clear();
@@ -65,8 +59,6 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)

connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons);
UpdateIcons();

Update();
}

BreakpointWidget::~BreakpointWidget()
@@ -138,8 +130,28 @@ void BreakpointWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetBreakpointsVisible(false);
}

void BreakpointWidget::showEvent(QShowEvent* event)
{
UpdateButtonsEnabled();
Update();
}

void BreakpointWidget::UpdateButtonsEnabled()
{
if (!isVisible())
return;

const bool is_initialised = Core::GetState() != Core::State::Uninitialized;
m_new->setEnabled(is_initialised);
m_load->setEnabled(is_initialised);
m_save->setEnabled(is_initialised);
}

void BreakpointWidget::Update()
{
if (!isVisible())
return;

m_table->clear();

m_table->setHorizontalHeaderLabels(
@@ -9,9 +9,10 @@
#include "Common/CommonTypes.h"

class QAction;
class QCloseEvent;
class QShowEvent;
class QTableWidget;
class QToolBar;
class QCloseEvent;

class BreakpointWidget : public QDockWidget
{
@@ -25,6 +26,7 @@ class BreakpointWidget : public QDockWidget
bool do_break = true);
void AddRangedMBP(u32 from, u32 to, bool do_read = true, bool do_write = true, bool do_log = true,
bool do_break = true);
void UpdateButtonsEnabled();
void Update();

signals:
@@ -33,6 +35,7 @@ class BreakpointWidget : public QDockWidget

protected:
void closeEvent(QCloseEvent*) override;
void showEvent(QShowEvent* event) override;

private:
void CreateWidgets();
@@ -92,6 +92,9 @@ void CodeViewWidget::FontBasedSizing()

void CodeViewWidget::Update()
{
if (!isVisible())
return;

if (m_updating)
return;

@@ -568,6 +571,11 @@ void CodeViewWidget::mousePressEvent(QMouseEvent* event)
}
}

void CodeViewWidget::showEvent(QShowEvent* event)
{
Update();
}

void CodeViewWidget::ToggleBreakpoint()
{
if (PowerPC::debug_interface.IsBreakpoint(GetContextAddress()))
@@ -13,6 +13,7 @@
class QKeyEvent;
class QMouseEvent;
class QResizeEvent;
class QShowEvent;

class CodeViewWidget : public QTableWidget
{
@@ -56,6 +57,7 @@ class CodeViewWidget : public QTableWidget
void keyPressEvent(QKeyEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
void showEvent(QShowEvent* event) override;

void OnContextMenu();

@@ -64,8 +64,6 @@ CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent)
settings.value(QStringLiteral("codewidget/codesplitter")).toByteArray());
m_box_splitter->restoreState(
settings.value(QStringLiteral("codewidget/boxsplitter")).toByteArray());

Update();
}

CodeWidget::~CodeWidget()
@@ -83,6 +81,11 @@ void CodeWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetCodeVisible(false);
}

void CodeWidget::showEvent(QShowEvent* event)
{
Update();
}

void CodeWidget::CreateWidgets()
{
auto* layout = new QGridLayout;
@@ -265,6 +268,9 @@ void CodeWidget::SetAddress(u32 address, CodeViewWidget::SetAddressUpdate update

void CodeWidget::Update()
{
if (!isVisible())
return;

const Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(m_code_view->GetAddress());

UpdateCallstack();
@@ -12,6 +12,7 @@

class QCloseEvent;
class QLineEdit;
class QShowEvent;
class QSplitter;
class QListWidget;
class QTableWidget;
@@ -61,6 +62,7 @@ class CodeWidget : public QDockWidget
void OnSelectFunctionCalls();

void closeEvent(QCloseEvent*) override;
void showEvent(QShowEvent* event) override;

QLineEdit* m_search_address;
QLineEdit* m_search_symbols;
@@ -57,8 +57,6 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent)
#else
m_disassembler = GetNewDisassembler("UNK");
#endif

Update();
}

JITWidget::~JITWidget()
@@ -126,6 +124,9 @@ void JITWidget::Compare(u32 address)

void JITWidget::Update()
{
if (!isVisible())
return;

if (!m_address)
{
m_ppc_asm_widget->setHtml(QStringLiteral("<i>%1</i>").arg(tr("(ppc)")));
@@ -208,3 +209,8 @@ void JITWidget::closeEvent(QCloseEvent*)
{
Settings::Instance().SetJITVisible(false);
}

void JITWidget::showEvent(QShowEvent* event)
{
Update();
}
@@ -10,6 +10,7 @@
#include "Common/CommonTypes.h"

class QCloseEvent;
class QShowEvent;
class QSplitter;
class QTextBrowser;
class QTableWidget;
@@ -31,6 +32,7 @@ class JITWidget : public QDockWidget
void ConnectWidgets();

void closeEvent(QCloseEvent*) override;
void showEvent(QShowEvent* event) override;

QTableWidget* m_table_widget;
QTextBrowser* m_ppc_asm_widget;
@@ -57,7 +57,6 @@ MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent)
LoadSettings();

ConnectWidgets();
Update();
OnAddressSpaceChanged();
OnTypeChanged();
}
@@ -258,8 +257,16 @@ void MemoryWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetMemoryVisible(false);
}

void MemoryWidget::showEvent(QShowEvent* event)
{
Update();
}

void MemoryWidget::Update()
{
if (!isVisible())
return;

m_memory_view->Update();
update();
}
@@ -17,6 +17,7 @@ class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QShowEvent;
class QSplitter;

class MemoryWidget : public QDockWidget
@@ -61,6 +62,7 @@ class MemoryWidget : public QDockWidget
void FindValue(bool next);

void closeEvent(QCloseEvent*) override;
void showEvent(QShowEvent* event) override;

MemoryViewWidget* m_memory_view;
QSplitter* m_splitter;
@@ -38,14 +38,7 @@ RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent)
PopulateTable();
ConnectWidgets();

connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, [this] {
if (Settings::Instance().IsDebugModeEnabled() && Core::GetState() == Core::State::Paused)
{
m_updating = true;
emit UpdateTable();
m_updating = false;
}
});
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, &RegisterWidget::Update);

connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged,
[this](bool visible) { setHidden(!visible); });
@@ -68,6 +61,11 @@ void RegisterWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetRegistersVisible(false);
}

void RegisterWidget::showEvent(QShowEvent* event)
{
Update();
}

void RegisterWidget::CreateWidgets()
{
m_table = new QTableWidget;
@@ -375,3 +373,13 @@ void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::st

connect(this, &RegisterWidget::UpdateTable, [value] { value->RefreshValue(); });
}

void RegisterWidget::Update()
{
if (isVisible() && Core::GetState() == Core::State::Paused)
{
m_updating = true;
emit UpdateTable();
m_updating = false;
}
}
@@ -13,6 +13,7 @@

class QTableWidget;
class QCloseEvent;
class QShowEvent;

class RegisterWidget : public QDockWidget
{
@@ -30,6 +31,7 @@ class RegisterWidget : public QDockWidget

protected:
void closeEvent(QCloseEvent*) override;
void showEvent(QShowEvent* event) override;

private:
void CreateWidgets();
@@ -42,6 +44,8 @@ class RegisterWidget : public QDockWidget
void AddRegister(int row, int column, RegisterType type, std::string register_name,
std::function<u64()> get_reg, std::function<void(u64)> set_reg);

void Update();

QTableWidget* m_table;
bool m_updating = false;
};
@@ -43,12 +43,7 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
ConnectWidgets();

connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
if (!Settings::Instance().IsDebugModeEnabled())
return;

m_load->setEnabled(Core::IsRunning());
m_save->setEnabled(Core::IsRunning());

UpdateButtonsEnabled();
if (state != Core::State::Starting)
Update();
});
@@ -61,8 +56,6 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)

connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons);
UpdateIcons();

Update();
}

WatchWidget::~WatchWidget()
@@ -117,8 +110,20 @@ void WatchWidget::UpdateIcons()
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
}

void WatchWidget::UpdateButtonsEnabled()
{
if (!isVisible())
return;

m_load->setEnabled(Core::IsRunning());
m_save->setEnabled(Core::IsRunning());
}

void WatchWidget::Update()
{
if (!isVisible())
return;

m_updating = true;

m_table->clear();
@@ -200,6 +205,12 @@ void WatchWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetWatchVisible(false);
}

void WatchWidget::showEvent(QShowEvent* event)
{
UpdateButtonsEnabled();
Update();
}

void WatchWidget::OnLoad()
{
IniFile ini;

0 comments on commit 398aa2a

Please sign in to comment.
You can’t perform that action at this time.