Qt/Debugger: Implement "Watch" window
This commit is contained in:
parent
ec37ce093f
commit
08716be43b
|
@ -72,6 +72,7 @@ set(SRCS
|
||||||
Config/SettingsWindow.cpp
|
Config/SettingsWindow.cpp
|
||||||
Debugger/RegisterColumn.cpp
|
Debugger/RegisterColumn.cpp
|
||||||
Debugger/RegisterWidget.cpp
|
Debugger/RegisterWidget.cpp
|
||||||
|
Debugger/WatchWidget.cpp
|
||||||
GameList/GameFileCache.cpp
|
GameList/GameFileCache.cpp
|
||||||
GameList/GameFile.cpp
|
GameList/GameFile.cpp
|
||||||
GameList/GameList.cpp
|
GameList/GameList.cpp
|
||||||
|
|
|
@ -0,0 +1,308 @@
|
||||||
|
// Copyright 2017 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "DolphinQt2/Debugger/WatchWidget.h"
|
||||||
|
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/IniFile.h"
|
||||||
|
#include "Core/ConfigManager.h"
|
||||||
|
#include "Core/Core.h"
|
||||||
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||||
|
#include "DolphinQt2/Settings.h"
|
||||||
|
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QToolBar>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
|
||||||
|
{
|
||||||
|
setWindowTitle(tr("Watch"));
|
||||||
|
setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
restoreGeometry(settings.value(QStringLiteral("watchwidget/geometry")).toByteArray());
|
||||||
|
setFloating(settings.value(QStringLiteral("watchwidget/floating")).toBool());
|
||||||
|
|
||||||
|
CreateWidgets();
|
||||||
|
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());
|
||||||
|
|
||||||
|
if (state != Core::State::Starting)
|
||||||
|
Update();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(&Settings::Instance(), &Settings::WatchVisibilityChanged,
|
||||||
|
[this](bool visible) { setHidden(!visible); });
|
||||||
|
|
||||||
|
connect(&Settings::Instance(), &Settings::DebugModeToggled,
|
||||||
|
[this](bool enabled) { setHidden(!enabled || !Settings::Instance().IsWatchVisible()); });
|
||||||
|
|
||||||
|
setHidden(!Settings::Instance().IsWatchVisible() || !Settings::Instance().IsDebugModeEnabled());
|
||||||
|
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
WatchWidget::~WatchWidget()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
settings.setValue(QStringLiteral("watchwidget/geometry"), saveGeometry());
|
||||||
|
settings.setValue(QStringLiteral("watchwidget/floating"), isFloating());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::CreateWidgets()
|
||||||
|
{
|
||||||
|
m_toolbar = new QToolBar;
|
||||||
|
m_table = new QTableWidget;
|
||||||
|
|
||||||
|
m_table->setColumnCount(5);
|
||||||
|
m_table->verticalHeader()->setHidden(true);
|
||||||
|
m_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
|
||||||
|
m_load = AddAction(m_toolbar, tr("Load"), this, &WatchWidget::OnLoad);
|
||||||
|
m_save = AddAction(m_toolbar, tr("Save"), this, &WatchWidget::OnSave);
|
||||||
|
|
||||||
|
m_load->setEnabled(false);
|
||||||
|
m_save->setEnabled(false);
|
||||||
|
|
||||||
|
auto* layout = new QVBoxLayout;
|
||||||
|
layout->addWidget(m_toolbar);
|
||||||
|
layout->addWidget(m_table);
|
||||||
|
|
||||||
|
QWidget* widget = new QWidget;
|
||||||
|
widget->setLayout(layout);
|
||||||
|
|
||||||
|
setWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::ConnectWidgets()
|
||||||
|
{
|
||||||
|
connect(m_table, &QTableWidget::customContextMenuRequested, this, &WatchWidget::ShowContextMenu);
|
||||||
|
connect(m_table, &QTableWidget::itemChanged, this, &WatchWidget::OnItemChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::Update()
|
||||||
|
{
|
||||||
|
m_updating = true;
|
||||||
|
|
||||||
|
m_table->clear();
|
||||||
|
|
||||||
|
int size = static_cast<int>(PowerPC::watches.GetWatches().size());
|
||||||
|
|
||||||
|
m_table->setRowCount(size + 1);
|
||||||
|
|
||||||
|
m_table->setHorizontalHeaderLabels(
|
||||||
|
{tr("Label"), tr("Address"), tr("Hexadecimal"), tr("Decimal"), tr("String")});
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
auto entry = PowerPC::watches.GetWatches().at(i);
|
||||||
|
|
||||||
|
auto* label = new QTableWidgetItem(QString::fromStdString(entry.name));
|
||||||
|
auto* address =
|
||||||
|
new QTableWidgetItem(QStringLiteral("%1").arg(entry.address, 8, 16, QLatin1Char('0')));
|
||||||
|
auto* hex = new QTableWidgetItem;
|
||||||
|
auto* decimal = new QTableWidgetItem;
|
||||||
|
auto* string = new QTableWidgetItem;
|
||||||
|
|
||||||
|
QBrush brush = QPalette().brush(QPalette::Text);
|
||||||
|
|
||||||
|
if (!Core::IsRunning() || !PowerPC::HostIsRAMAddress(entry.address))
|
||||||
|
brush.setColor(Qt::red);
|
||||||
|
|
||||||
|
if (Core::IsRunning())
|
||||||
|
{
|
||||||
|
if (PowerPC::HostIsRAMAddress(entry.address))
|
||||||
|
{
|
||||||
|
hex->setText(QStringLiteral("%1").arg(PowerPC::HostRead_U32(entry.address), 8, 16,
|
||||||
|
QLatin1Char('0')));
|
||||||
|
decimal->setText(QString::number(PowerPC::HostRead_U32(entry.address)));
|
||||||
|
string->setText(QString::fromStdString(PowerPC::HostGetString(entry.address, 32)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
address->setForeground(brush);
|
||||||
|
|
||||||
|
int column = 0;
|
||||||
|
|
||||||
|
for (auto* item : {label, address, hex, decimal, string})
|
||||||
|
{
|
||||||
|
item->setData(Qt::UserRole, i);
|
||||||
|
item->setData(Qt::UserRole + 1, column++);
|
||||||
|
}
|
||||||
|
|
||||||
|
string->setFlags(Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
m_table->setItem(i, 0, label);
|
||||||
|
m_table->setItem(i, 1, address);
|
||||||
|
m_table->setItem(i, 2, hex);
|
||||||
|
m_table->setItem(i, 3, decimal);
|
||||||
|
m_table->setItem(i, 4, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* label = new QTableWidgetItem;
|
||||||
|
label->setData(Qt::UserRole, -1);
|
||||||
|
|
||||||
|
m_table->setItem(size, 0, label);
|
||||||
|
|
||||||
|
for (int i = 1; i < 5; i++)
|
||||||
|
{
|
||||||
|
auto* no_edit = new QTableWidgetItem;
|
||||||
|
no_edit->setFlags(Qt::ItemIsEnabled);
|
||||||
|
m_table->setItem(size, i, no_edit);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_updating = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::closeEvent(QCloseEvent*)
|
||||||
|
{
|
||||||
|
Settings::Instance().SetWatchVisible(false);
|
||||||
|
}
|
||||||
|
void WatchWidget::OnLoad()
|
||||||
|
{
|
||||||
|
IniFile ini;
|
||||||
|
|
||||||
|
Watches::TWatchesStr watches;
|
||||||
|
|
||||||
|
if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
||||||
|
false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ini.GetLines("Watches", &watches, false))
|
||||||
|
{
|
||||||
|
PowerPC::watches.Clear();
|
||||||
|
PowerPC::watches.AddFromStrings(watches);
|
||||||
|
}
|
||||||
|
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::OnSave()
|
||||||
|
{
|
||||||
|
IniFile ini;
|
||||||
|
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini",
|
||||||
|
false);
|
||||||
|
ini.SetLines("Watches", PowerPC::watches.GetStrings());
|
||||||
|
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini");
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::ShowContextMenu()
|
||||||
|
{
|
||||||
|
QMenu* menu = new QMenu(this);
|
||||||
|
|
||||||
|
if (m_table->selectedItems().size())
|
||||||
|
{
|
||||||
|
auto row_variant = m_table->selectedItems()[0]->data(Qt::UserRole);
|
||||||
|
|
||||||
|
if (!row_variant.isNull())
|
||||||
|
{
|
||||||
|
int row = row_variant.toInt();
|
||||||
|
|
||||||
|
if (row >= 0)
|
||||||
|
{
|
||||||
|
AddAction(menu, tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); });
|
||||||
|
AddAction(menu, tr("&Add Memory Breakpoint"), this,
|
||||||
|
[this, row] { AddWatchBreakpoint(row); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->addSeparator();
|
||||||
|
|
||||||
|
AddAction(menu, tr("Update"), this, &WatchWidget::Update);
|
||||||
|
|
||||||
|
menu->exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::OnItemChanged(QTableWidgetItem* item)
|
||||||
|
{
|
||||||
|
if (m_updating || item->data(Qt::UserRole).isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
int row = item->data(Qt::UserRole).toInt();
|
||||||
|
int column = item->data(Qt::UserRole + 1).toInt();
|
||||||
|
|
||||||
|
if (row == -1)
|
||||||
|
{
|
||||||
|
if (!item->text().isEmpty())
|
||||||
|
{
|
||||||
|
AddWatch(item->text(), 0);
|
||||||
|
|
||||||
|
Update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (column)
|
||||||
|
{
|
||||||
|
// Label
|
||||||
|
case 0:
|
||||||
|
if (item->text().isEmpty())
|
||||||
|
DeleteWatch(row);
|
||||||
|
else
|
||||||
|
PowerPC::watches.UpdateName(row, item->text().toStdString());
|
||||||
|
break;
|
||||||
|
// Address
|
||||||
|
// Hexadecimal
|
||||||
|
// Decimal
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
bool good;
|
||||||
|
quint32 value = item->text().toUInt(&good, column < 3 ? 16 : 10);
|
||||||
|
|
||||||
|
if (good)
|
||||||
|
{
|
||||||
|
if (column == 1)
|
||||||
|
PowerPC::watches.Update(row, value);
|
||||||
|
else
|
||||||
|
PowerPC::HostWrite_U32(value, PowerPC::watches.GetWatches().at(row).address);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Error"), tr("Bad input provided"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::DeleteWatch(int row)
|
||||||
|
{
|
||||||
|
PowerPC::watches.Remove(PowerPC::watches.GetWatches().at(row).address);
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::AddWatchBreakpoint(int row)
|
||||||
|
{
|
||||||
|
emit RequestMemoryBreakpoint(PowerPC::watches.GetWatches().at(row).address);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWidget::AddWatch(QString name, u32 addr)
|
||||||
|
{
|
||||||
|
PowerPC::watches.Add(addr);
|
||||||
|
PowerPC::watches.UpdateName(static_cast<int>(PowerPC::watches.GetWatches().size()) - 1,
|
||||||
|
name.toStdString());
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright 2017 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
class QTableWidget;
|
||||||
|
class QTableWidgetItem;
|
||||||
|
class QToolBar;
|
||||||
|
class QCloseEvent;
|
||||||
|
|
||||||
|
class WatchWidget : public QDockWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit WatchWidget(QWidget* parent = nullptr);
|
||||||
|
~WatchWidget();
|
||||||
|
|
||||||
|
void AddWatch(QString name, u32 addr);
|
||||||
|
signals:
|
||||||
|
void RequestMemoryBreakpoint(u32 addr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent*) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CreateWidgets();
|
||||||
|
void ConnectWidgets();
|
||||||
|
|
||||||
|
void OnLoad();
|
||||||
|
void OnSave();
|
||||||
|
|
||||||
|
void Update();
|
||||||
|
|
||||||
|
void ShowContextMenu();
|
||||||
|
void OnItemChanged(QTableWidgetItem* item);
|
||||||
|
void DeleteWatch(int row);
|
||||||
|
void AddWatchBreakpoint(int row);
|
||||||
|
|
||||||
|
QAction* m_load;
|
||||||
|
QAction* m_save;
|
||||||
|
QToolBar* m_toolbar;
|
||||||
|
QTableWidget* m_table;
|
||||||
|
|
||||||
|
bool m_updating = false;
|
||||||
|
};
|
|
@ -85,6 +85,7 @@
|
||||||
<QtMoc Include="Config\SettingsWindow.h" />
|
<QtMoc Include="Config\SettingsWindow.h" />
|
||||||
<QtMoc Include="FIFOPlayerWindow.h" />
|
<QtMoc Include="FIFOPlayerWindow.h" />
|
||||||
<QtMoc Include="Debugger\RegisterWidget.h" />
|
<QtMoc Include="Debugger\RegisterWidget.h" />
|
||||||
|
<QtMoc Include="Debugger\WatchWidget.h" />
|
||||||
<QtMoc Include="GameList\GameFile.h" />
|
<QtMoc Include="GameList\GameFile.h" />
|
||||||
<QtMoc Include="GameList\GameList.h" />
|
<QtMoc Include="GameList\GameList.h" />
|
||||||
<QtMoc Include="GameList\GameListModel.h" />
|
<QtMoc Include="GameList\GameListModel.h" />
|
||||||
|
@ -163,6 +164,7 @@
|
||||||
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)SoftwareRendererWidget.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)SoftwareRendererWidget.cpp" />
|
||||||
<ClCompile Include="$(QtMocOutPrefix)ToolBar.cpp" />
|
<ClCompile Include="$(QtMocOutPrefix)ToolBar.cpp" />
|
||||||
|
<ClCompile Include="$(QtMocOutPrefix)WatchWidget.cpp" />
|
||||||
<ClCompile Include="AboutDialog.cpp" />
|
<ClCompile Include="AboutDialog.cpp" />
|
||||||
<ClCompile Include="Config\CheatWarningWidget.cpp" />
|
<ClCompile Include="Config\CheatWarningWidget.cpp" />
|
||||||
<ClCompile Include="Config\ControllersWindow.cpp" />
|
<ClCompile Include="Config\ControllersWindow.cpp" />
|
||||||
|
@ -205,6 +207,7 @@
|
||||||
<ClCompile Include="FIFOPlayerWindow.cpp" />
|
<ClCompile Include="FIFOPlayerWindow.cpp" />
|
||||||
<ClCompile Include="Debugger\RegisterColumn.cpp" />
|
<ClCompile Include="Debugger\RegisterColumn.cpp" />
|
||||||
<ClCompile Include="Debugger\RegisterWidget.cpp" />
|
<ClCompile Include="Debugger\RegisterWidget.cpp" />
|
||||||
|
<ClCompile Include="Debugger\WatchWidget.cpp" />
|
||||||
<ClCompile Include="GameList\GameFile.cpp" />
|
<ClCompile Include="GameList\GameFile.cpp" />
|
||||||
<ClCompile Include="GameList\GameFileCache.cpp" />
|
<ClCompile Include="GameList\GameFileCache.cpp" />
|
||||||
<ClCompile Include="GameList\GameList.cpp" />
|
<ClCompile Include="GameList\GameList.cpp" />
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
||||||
#include "DolphinQt2/Config/SettingsWindow.h"
|
#include "DolphinQt2/Config/SettingsWindow.h"
|
||||||
#include "DolphinQt2/Debugger/RegisterWidget.h"
|
#include "DolphinQt2/Debugger/RegisterWidget.h"
|
||||||
#include "DolphinQt2/FIFOPlayerWindow.h"
|
#include "DolphinQt2/Debugger/WatchWidget.h"
|
||||||
#include "DolphinQt2/Host.h"
|
#include "DolphinQt2/Host.h"
|
||||||
#include "DolphinQt2/HotkeyScheduler.h"
|
#include "DolphinQt2/HotkeyScheduler.h"
|
||||||
#include "DolphinQt2/MainWindow.h"
|
#include "DolphinQt2/MainWindow.h"
|
||||||
|
@ -170,6 +170,7 @@ void MainWindow::CreateComponents()
|
||||||
connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
|
connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
|
||||||
[this](const QString& path) { StartGame(path); });
|
[this](const QString& path) { StartGame(path); });
|
||||||
m_register_widget = new RegisterWidget(this);
|
m_register_widget = new RegisterWidget(this);
|
||||||
|
m_watch_widget = new WatchWidget(this);
|
||||||
|
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
m_graphics_window = new GraphicsWindow(
|
m_graphics_window = new GraphicsWindow(
|
||||||
|
@ -319,9 +320,11 @@ void MainWindow::ConnectStack()
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_log_widget);
|
addDockWidget(Qt::RightDockWidgetArea, m_log_widget);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_log_config_widget);
|
addDockWidget(Qt::RightDockWidgetArea, m_log_config_widget);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_register_widget);
|
addDockWidget(Qt::RightDockWidgetArea, m_register_widget);
|
||||||
|
addDockWidget(Qt::RightDockWidgetArea, m_watch_widget);
|
||||||
|
|
||||||
tabifyDockWidget(m_log_widget, m_log_config_widget);
|
tabifyDockWidget(m_log_widget, m_log_config_widget);
|
||||||
tabifyDockWidget(m_log_widget, m_register_widget);
|
tabifyDockWidget(m_log_widget, m_register_widget);
|
||||||
|
tabifyDockWidget(m_log_widget, m_watch_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Open()
|
void MainWindow::Open()
|
||||||
|
|
|
@ -32,6 +32,7 @@ class ControllersWindow;
|
||||||
class DragEnterEvent;
|
class DragEnterEvent;
|
||||||
class GraphicsWindow;
|
class GraphicsWindow;
|
||||||
class RegisterWidget;
|
class RegisterWidget;
|
||||||
|
class WatchWidget;
|
||||||
|
|
||||||
class MainWindow final : public QMainWindow
|
class MainWindow final : public QMainWindow
|
||||||
{
|
{
|
||||||
|
@ -144,4 +145,5 @@ private:
|
||||||
LogConfigWidget* m_log_config_widget;
|
LogConfigWidget* m_log_config_widget;
|
||||||
FIFOPlayerWindow* m_fifo_window;
|
FIFOPlayerWindow* m_fifo_window;
|
||||||
RegisterWidget* m_register_widget;
|
RegisterWidget* m_register_widget;
|
||||||
|
WatchWidget* m_watch_widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,6 +91,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
|
||||||
void MenuBar::OnDebugModeToggled(bool enabled)
|
void MenuBar::OnDebugModeToggled(bool enabled)
|
||||||
{
|
{
|
||||||
m_show_registers->setVisible(enabled);
|
m_show_registers->setVisible(enabled);
|
||||||
|
m_show_watch->setVisible(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuBar::AddFileMenu()
|
void MenuBar::AddFileMenu()
|
||||||
|
@ -272,6 +273,14 @@ void MenuBar::AddViewMenu()
|
||||||
connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged, m_show_registers,
|
connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged, m_show_registers,
|
||||||
&QAction::setChecked);
|
&QAction::setChecked);
|
||||||
|
|
||||||
|
m_show_watch = view_menu->addAction(tr("&Watch"));
|
||||||
|
m_show_watch->setCheckable(true);
|
||||||
|
m_show_watch->setChecked(Settings::Instance().IsWatchVisible());
|
||||||
|
|
||||||
|
connect(m_show_watch, &QAction::toggled, &Settings::Instance(), &Settings::SetWatchVisible);
|
||||||
|
connect(&Settings::Instance(), &Settings::WatchVisibilityChanged, m_show_watch,
|
||||||
|
&QAction::setChecked);
|
||||||
|
|
||||||
view_menu->addSeparator();
|
view_menu->addSeparator();
|
||||||
|
|
||||||
AddGameListTypeSection(view_menu);
|
AddGameListTypeSection(view_menu);
|
||||||
|
|
|
@ -161,4 +161,5 @@ private:
|
||||||
|
|
||||||
// View
|
// View
|
||||||
QAction* m_show_registers;
|
QAction* m_show_registers;
|
||||||
|
QAction* m_show_watch;
|
||||||
};
|
};
|
||||||
|
|
|
@ -225,3 +225,18 @@ bool Settings::IsRegistersVisible() const
|
||||||
{
|
{
|
||||||
return QSettings().value(QStringLiteral("debugger/showregisters")).toBool();
|
return QSettings().value(QStringLiteral("debugger/showregisters")).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::SetWatchVisible(bool enabled)
|
||||||
|
{
|
||||||
|
if (IsWatchVisible() != enabled)
|
||||||
|
{
|
||||||
|
QSettings().setValue(QStringLiteral("debugger/showwatch"), enabled);
|
||||||
|
|
||||||
|
emit WatchVisibilityChanged(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::IsWatchVisible() const
|
||||||
|
{
|
||||||
|
return QSettings().value(QStringLiteral("debugger/showwatch")).toBool();
|
||||||
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ public:
|
||||||
bool IsDebugModeEnabled() const;
|
bool IsDebugModeEnabled() const;
|
||||||
void SetRegistersVisible(bool enabled);
|
void SetRegistersVisible(bool enabled);
|
||||||
bool IsRegistersVisible() const;
|
bool IsRegistersVisible() const;
|
||||||
|
void SetWatchVisible(bool enabled);
|
||||||
|
bool IsWatchVisible() const;
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
GameListModel* GetGameListModel() const;
|
GameListModel* GetGameListModel() const;
|
||||||
|
@ -99,6 +101,7 @@ signals:
|
||||||
void LogVisibilityChanged(bool visible);
|
void LogVisibilityChanged(bool visible);
|
||||||
void LogConfigVisibilityChanged(bool visible);
|
void LogConfigVisibilityChanged(bool visible);
|
||||||
void EnableCheatsChanged(bool enabled);
|
void EnableCheatsChanged(bool enabled);
|
||||||
|
void WatchVisibilityChanged(bool visible);
|
||||||
void DebugModeToggled(bool enabled);
|
void DebugModeToggled(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue