Merge pull request #12659 from mitaclaw/qt-debug-font
DolphinQt Settings: Signal Debug Font By Const Reference
This commit is contained in:
commit
aea1f64873
|
@ -172,9 +172,8 @@ CodeViewWidget::CodeViewWidget()
|
||||||
|
|
||||||
connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu);
|
connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu);
|
||||||
connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged);
|
connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged);
|
||||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &QWidget::setFont);
|
|
||||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this,
|
connect(&Settings::Instance(), &Settings::DebugFontChanged, this,
|
||||||
&CodeViewWidget::FontBasedSizing);
|
&CodeViewWidget::OnDebugFontChanged);
|
||||||
|
|
||||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] {
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] {
|
||||||
m_address = m_system.GetPPCState().pc;
|
m_address = m_system.GetPPCState().pc;
|
||||||
|
@ -208,7 +207,7 @@ void CodeViewWidget::FontBasedSizing()
|
||||||
// just text width is too small with some fonts, so increase by a bit
|
// just text width is too small with some fonts, so increase by a bit
|
||||||
constexpr int extra_text_width = 8;
|
constexpr int extra_text_width = 8;
|
||||||
|
|
||||||
const QFontMetrics fm(Settings::Instance().GetDebugFont());
|
const QFontMetrics fm(font());
|
||||||
|
|
||||||
const int rowh = fm.height() + 1;
|
const int rowh = fm.height() + 1;
|
||||||
verticalHeader()->setMaximumSectionSize(rowh);
|
verticalHeader()->setMaximumSectionSize(rowh);
|
||||||
|
@ -745,6 +744,12 @@ void CodeViewWidget::AutoStep(CodeTrace::AutoStop option)
|
||||||
} while (msgbox.clickedButton() == (QAbstractButton*)run_button);
|
} while (msgbox.clickedButton() == (QAbstractButton*)run_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeViewWidget::OnDebugFontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
setFont(font);
|
||||||
|
FontBasedSizing();
|
||||||
|
}
|
||||||
|
|
||||||
void CodeViewWidget::OnCopyAddress()
|
void CodeViewWidget::OnCopyAddress()
|
||||||
{
|
{
|
||||||
const u32 addr = GetContextAddress();
|
const u32 addr = GetContextAddress();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/Debugger/CodeTrace.h"
|
#include "Core/Debugger/CodeTrace.h"
|
||||||
|
|
||||||
|
class QFont;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
|
@ -78,6 +79,7 @@ private:
|
||||||
void OnContextMenu();
|
void OnContextMenu();
|
||||||
|
|
||||||
void AutoStep(CodeTrace::AutoStop option = CodeTrace::AutoStop::Always);
|
void AutoStep(CodeTrace::AutoStop option = CodeTrace::AutoStop::Always);
|
||||||
|
void OnDebugFontChanged(const QFont& font);
|
||||||
void OnFollowBranch();
|
void OnFollowBranch();
|
||||||
void OnCopyAddress();
|
void OnCopyAddress();
|
||||||
void OnCopyTargetAddress();
|
void OnCopyTargetAddress();
|
||||||
|
|
|
@ -202,18 +202,18 @@ MemoryViewWidget::MemoryViewWidget(Core::System& system, QWidget* parent)
|
||||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &MemoryViewWidget::Update);
|
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &MemoryViewWidget::Update);
|
||||||
|
|
||||||
// Also calls create table.
|
// Also calls create table.
|
||||||
UpdateFont();
|
UpdateFont(Settings::Instance().GetDebugFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryViewWidget::UpdateFont()
|
void MemoryViewWidget::UpdateFont(const QFont& font)
|
||||||
{
|
{
|
||||||
const QFontMetrics fm(Settings::Instance().GetDebugFont());
|
const QFontMetrics fm(font);
|
||||||
m_font_vspace = fm.lineSpacing() + 4;
|
m_font_vspace = fm.lineSpacing() + 4;
|
||||||
// BoundingRect is too unpredictable, a custom one would be needed for each view type. Different
|
// BoundingRect is too unpredictable, a custom one would be needed for each view type. Different
|
||||||
// fonts have wildly different spacing between two characters and horizontalAdvance includes
|
// fonts have wildly different spacing between two characters and horizontalAdvance includes
|
||||||
// spacing.
|
// spacing.
|
||||||
m_font_width = fm.horizontalAdvance(QLatin1Char('0'));
|
m_font_width = fm.horizontalAdvance(QLatin1Char('0'));
|
||||||
m_table->setFont(Settings::Instance().GetDebugFont());
|
m_table->setFont(font);
|
||||||
|
|
||||||
CreateTable();
|
CreateTable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
class QFont;
|
||||||
class QPoint;
|
class QPoint;
|
||||||
class QScrollBar;
|
class QScrollBar;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ public:
|
||||||
|
|
||||||
void CreateTable();
|
void CreateTable();
|
||||||
void Update();
|
void Update();
|
||||||
void UpdateFont();
|
void UpdateFont(const QFont& font);
|
||||||
void ToggleBreakpoint(u32 addr, bool row);
|
void ToggleBreakpoint(u32 addr, bool row);
|
||||||
|
|
||||||
std::vector<u8> ConvertTextToBytes(Type type, QStringView input_text) const;
|
std::vector<u8> ConvertTextToBytes(Type type, QStringView input_text) const;
|
||||||
|
|
|
@ -106,7 +106,7 @@ void RegisterWidget::ConnectWidgets()
|
||||||
connect(m_table, &QTableWidget::customContextMenuRequested, this,
|
connect(m_table, &QTableWidget::customContextMenuRequested, this,
|
||||||
&RegisterWidget::ShowContextMenu);
|
&RegisterWidget::ShowContextMenu);
|
||||||
connect(m_table, &QTableWidget::itemChanged, this, &RegisterWidget::OnItemChanged);
|
connect(m_table, &QTableWidget::itemChanged, this, &RegisterWidget::OnItemChanged);
|
||||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, m_table, &QWidget::setFont);
|
connect(&Settings::Instance(), &Settings::DebugFontChanged, m_table, &RegisterWidget::setFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterWidget::OnItemChanged(QTableWidgetItem* item)
|
void RegisterWidget::OnItemChanged(QTableWidgetItem* item)
|
||||||
|
|
|
@ -51,13 +51,9 @@ FIFOAnalyzer::FIFOAnalyzer(FifoPlayer& fifo_player) : m_fifo_player(fifo_player)
|
||||||
m_search_splitter->restoreState(
|
m_search_splitter->restoreState(
|
||||||
settings.value(QStringLiteral("fifoanalyzer/searchsplitter")).toByteArray());
|
settings.value(QStringLiteral("fifoanalyzer/searchsplitter")).toByteArray());
|
||||||
|
|
||||||
m_detail_list->setFont(Settings::Instance().GetDebugFont());
|
OnDebugFontChanged(Settings::Instance().GetDebugFont());
|
||||||
m_entry_detail_browser->setFont(Settings::Instance().GetDebugFont());
|
connect(&Settings::Instance(), &Settings::DebugFontChanged, this,
|
||||||
|
&FIFOAnalyzer::OnDebugFontChanged);
|
||||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, [this] {
|
|
||||||
m_detail_list->setFont(Settings::Instance().GetDebugFont());
|
|
||||||
m_entry_detail_browser->setFont(Settings::Instance().GetDebugFont());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FIFOAnalyzer::~FIFOAnalyzer()
|
FIFOAnalyzer::~FIFOAnalyzer()
|
||||||
|
@ -779,3 +775,9 @@ void FIFOAnalyzer::UpdateDescription()
|
||||||
object_size - entry_start, callback);
|
object_size - entry_start, callback);
|
||||||
m_entry_detail_browser->setText(callback.text);
|
m_entry_detail_browser->setText(callback.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIFOAnalyzer::OnDebugFontChanged(const QFont& font)
|
||||||
|
{
|
||||||
|
m_detail_list->setFont(font);
|
||||||
|
m_entry_detail_browser->setFont(font);
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
class FifoPlayer;
|
class FifoPlayer;
|
||||||
|
class QFont;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
@ -43,6 +44,8 @@ private:
|
||||||
void UpdateDetails();
|
void UpdateDetails();
|
||||||
void UpdateDescription();
|
void UpdateDescription();
|
||||||
|
|
||||||
|
void OnDebugFontChanged(const QFont& font);
|
||||||
|
|
||||||
FifoPlayer& m_fifo_player;
|
FifoPlayer& m_fifo_player;
|
||||||
|
|
||||||
QTreeWidget* m_tree_widget;
|
QTreeWidget* m_tree_widget;
|
||||||
|
|
|
@ -217,7 +217,7 @@ signals:
|
||||||
void JITVisibilityChanged(bool visible);
|
void JITVisibilityChanged(bool visible);
|
||||||
void AssemblerVisibilityChanged(bool visible);
|
void AssemblerVisibilityChanged(bool visible);
|
||||||
void DebugModeToggled(bool enabled);
|
void DebugModeToggled(bool enabled);
|
||||||
void DebugFontChanged(QFont font);
|
void DebugFontChanged(const QFont& font);
|
||||||
void AutoUpdateTrackChanged(const QString& mode);
|
void AutoUpdateTrackChanged(const QString& mode);
|
||||||
void FallbackRegionChanged(const DiscIO::Region& region);
|
void FallbackRegionChanged(const DiscIO::Region& region);
|
||||||
void AnalyticsToggled(bool enabled);
|
void AnalyticsToggled(bool enabled);
|
||||||
|
|
Loading…
Reference in New Issue