Qt: Use new debugger icons

This commit is contained in:
spycrab 2018-04-11 23:43:47 +02:00
parent f31221b3d0
commit a12d4996ed
7 changed files with 61 additions and 8 deletions

View File

@ -16,8 +16,10 @@
#include "Core/PowerPC/BreakPoints.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt2/Debugger/NewBreakpointDialog.h"
#include "DolphinQt2/QtUtils/ActionHelper.h"
#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
@ -47,6 +49,9 @@ BreakpointWidget::BreakpointWidget(QWidget* parent) : QDockWidget(parent)
setHidden(!enabled || !Settings::Instance().IsBreakpointsVisible());
});
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &BreakpointWidget::UpdateIcons);
UpdateIcons();
setHidden(!Settings::Instance().IsBreakpointsVisible() ||
!Settings::Instance().IsDebugModeEnabled());
@ -64,6 +69,8 @@ BreakpointWidget::~BreakpointWidget()
void BreakpointWidget::CreateWidgets()
{
m_toolbar = new QToolBar;
m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_table = new QTableWidget;
m_table->setColumnCount(5);
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
@ -75,9 +82,9 @@ void BreakpointWidget::CreateWidgets()
layout->addWidget(m_toolbar);
layout->addWidget(m_table);
AddAction(m_toolbar, tr("New"), this, &BreakpointWidget::OnNewBreakpoint);
AddAction(m_toolbar, tr("Delete"), this, &BreakpointWidget::OnDelete);
AddAction(m_toolbar, tr("Clear"), this, &BreakpointWidget::OnClear);
m_new = AddAction(m_toolbar, tr("New"), this, &BreakpointWidget::OnNewBreakpoint);
m_delete = AddAction(m_toolbar, tr("Delete"), this, &BreakpointWidget::OnDelete);
m_clear = AddAction(m_toolbar, tr("Clear"), this, &BreakpointWidget::OnClear);
m_load = AddAction(m_toolbar, tr("Load"), this, &BreakpointWidget::OnLoad);
m_save = AddAction(m_toolbar, tr("Save"), this, &BreakpointWidget::OnSave);
@ -91,6 +98,15 @@ void BreakpointWidget::CreateWidgets()
setWidget(widget);
}
void BreakpointWidget::UpdateIcons()
{
m_new->setIcon(Resources::GetScaledThemeIcon("debugger_add_breakpoint"));
m_delete->setIcon(Resources::GetScaledThemeIcon("debugger_delete"));
m_clear->setIcon(Resources::GetScaledThemeIcon("debugger_clear"));
m_load->setIcon(Resources::GetScaledThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
}
void BreakpointWidget::closeEvent(QCloseEvent*)
{
Settings::Instance().SetBreakpointsVisible(false);

View File

@ -42,8 +42,13 @@ private:
void OnLoad();
void OnSave();
void UpdateIcons();
QToolBar* m_toolbar;
QTableWidget* m_table;
QAction* m_new;
QAction* m_delete;
QAction* m_clear;
QAction* m_load;
QAction* m_save;
};

View File

@ -28,6 +28,7 @@
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt2/Debugger/CodeWidget.h"
#include "DolphinQt2/QtUtils/ActionHelper.h"
#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
constexpr size_t VALID_BRANCH_LENGTH = 10;
@ -49,7 +50,6 @@ CodeViewWidget::CodeViewWidget()
verticalHeader()->hide();
horizontalHeader()->hide();
horizontalHeader()->setStretchLastSection(true);
horizontalHeader()->resizeSection(0, 32);
setFont(Settings::Instance().GetDebugFont());
@ -61,6 +61,8 @@ CodeViewWidget::CodeViewWidget()
m_address = PC;
Update();
});
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &CodeViewWidget::Update);
}
static u32 GetBranchFromAddress(u32 addr)
@ -151,7 +153,8 @@ void CodeViewWidget::Update()
if (PowerPC::debug_interface.IsBreakpoint(addr))
{
bp_item->setBackground(Qt::red);
bp_item->setData(Qt::DecorationRole,
Resources::GetScaledThemeIcon("debugger_breakpoint").pixmap(QSize(24, 24)));
}
setItem(i, 0, bp_item);
@ -166,6 +169,8 @@ void CodeViewWidget::Update()
}
}
setColumnWidth(0, 24 + 5);
g_symbolDB.FillInCallers();
repaint();

View File

@ -15,7 +15,9 @@
#include "Core/Core.h"
#include "Core/PowerPC/BreakPoints.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt2/QtUtils/ActionHelper.h"
#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
MemoryViewWidget::MemoryViewWidget(QWidget* parent) : QTableWidget(parent)
@ -31,6 +33,7 @@ MemoryViewWidget::MemoryViewWidget(QWidget* parent) : QTableWidget(parent)
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] { Update(); });
connect(this, &MemoryViewWidget::customContextMenuRequested, this,
&MemoryViewWidget::OnContextMenu);
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &MemoryViewWidget::Update);
setContextMenuPolicy(Qt::CustomContextMenu);
@ -65,8 +68,6 @@ void MemoryViewWidget::Update()
setColumnCount(CalculateColumnCount(m_type));
setColumnWidth(0, 24);
if (rowCount() == 0)
setRowCount(1);
@ -88,7 +89,10 @@ void MemoryViewWidget::Update()
bp_item->setData(Qt::UserRole, addr);
if (PowerPC::memchecks.OverlapsMemcheck(addr, 16))
bp_item->setBackground(Qt::red);
{
bp_item->setData(Qt::DecorationRole,
Resources::GetScaledThemeIcon("debugger_breakpoint").pixmap(QSize(24, 24)));
}
setItem(i, 0, bp_item);
@ -240,6 +244,7 @@ void MemoryViewWidget::Update()
}
}
setColumnWidth(0, 24 + 5);
for (int i = 1; i < columnCount(); i++)
{
resizeColumnToContents(i);

View File

@ -9,7 +9,9 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt2/QtUtils/ActionHelper.h"
#include "DolphinQt2/Resources.h"
#include "DolphinQt2/Settings.h"
#include <QHeaderView>
@ -51,6 +53,9 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
connect(&Settings::Instance(), &Settings::DebugModeToggled,
[this](bool enabled) { setHidden(!enabled || !Settings::Instance().IsWatchVisible()); });
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons);
UpdateIcons();
setHidden(!Settings::Instance().IsWatchVisible() || !Settings::Instance().IsDebugModeEnabled());
Update();
@ -67,6 +72,8 @@ WatchWidget::~WatchWidget()
void WatchWidget::CreateWidgets()
{
m_toolbar = new QToolBar;
m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_table = new QTableWidget;
m_table->setColumnCount(5);
@ -96,6 +103,12 @@ void WatchWidget::ConnectWidgets()
connect(m_table, &QTableWidget::itemChanged, this, &WatchWidget::OnItemChanged);
}
void WatchWidget::UpdateIcons()
{
m_load->setIcon(Resources::GetScaledThemeIcon("debugger_load"));
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
}
void WatchWidget::Update()
{
m_updating = true;

View File

@ -42,6 +42,8 @@ private:
void DeleteWatch(int row);
void AddWatchBreakpoint(int row);
void UpdateIcons();
QAction* m_load;
QAction* m_save;
QToolBar* m_toolbar;

View File

@ -104,6 +104,13 @@ void ToolBar::MakeActions()
void ToolBar::UpdateIcons()
{
m_step_action->setIcon(Resources::GetScaledThemeIcon("debugger_step_in"));
m_step_over_action->setIcon(Resources::GetScaledThemeIcon("debugger_step_over"));
m_step_out_action->setIcon(Resources::GetScaledThemeIcon("debugger_step_out"));
m_skip_action->setIcon(Resources::GetScaledThemeIcon("debugger_skip"));
m_show_pc_action->setIcon(Resources::GetScaledThemeIcon("debugger_set_pc"));
m_set_pc_action->setIcon(Resources::GetScaledThemeIcon("debugger_show_pc"));
m_open_action->setIcon(Resources::GetScaledThemeIcon("open"));
m_play_action->setIcon(Resources::GetScaledThemeIcon("play"));
m_pause_action->setIcon(Resources::GetScaledThemeIcon("pause"));