From 57fe9bc4c3e85c45f10baf1fa6c4110114f690b3 Mon Sep 17 00:00:00 2001 From: Gareth Poole Date: Tue, 28 Oct 2014 22:20:22 -0400 Subject: [PATCH] New and improved font technology! --- src/citra_qt/debugger/disassembler.cpp | 10 ++++++++++ src/citra_qt/debugger/registers.cpp | 10 ++++++++++ src/citra_qt/main.cpp | 15 ++++++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index 2ee877743..f306c7bca 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp @@ -1,3 +1,5 @@ +#include + #include "disassembler.hxx" #include "../bootmanager.hxx" @@ -80,6 +82,14 @@ QVariant DisassemblerModel::data(const QModelIndex& index, int role) const { break; } + case Qt::FontRole: { + if (index.column() != 2) {// 2 is the symbols column + QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra", "config"); + return QFont(settings.value("UI/debugger_font").toString()); + } + break; + } + default: break; } diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index 96ceed480..ee119f139 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp @@ -1,3 +1,5 @@ +#include + #include "registers.hxx" #include "core/core.h" @@ -35,6 +37,14 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) CSPR->addChild(new QTreeWidgetItem(QStringList("C"))); CSPR->addChild(new QTreeWidgetItem(QStringList("Z"))); CSPR->addChild(new QTreeWidgetItem(QStringList("N"))); + + QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra", "config"); + QFont font = QFont(settings.value("UI/debugger_font").toString()); + + for (int i = 0; i < registers->childCount(); ++i) // Set Registers to display in Courier + registers->child(i)->setFont(1, font); + for (int i = 0; i < CSPR->childCount(); ++i) // Set CSPR to display in Courier + CSPR->child(i)->setFont(1, font); } void RegistersWidget::OnCPUStepped() diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index bac6a6bb8..8115e5195 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -39,6 +39,11 @@ GMainWindow::GMainWindow() ui.setupUi(this); statusBar()->hide(); + // Set default debugger font + QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra", "config"); + if(settings.value("UI/debugger_font").toString().length() <= 1) // Because it returns " " when the value is empty + settings.setValue("UI/debugger_font", QVariant("Courier")); + render_window = new GRenderWindow; render_window->hide(); @@ -82,10 +87,10 @@ GMainWindow::GMainWindow() // Restore UI state - QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); - restoreGeometry(settings.value("geometry").toByteArray()); - restoreState(settings.value("state").toByteArray()); - render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray()); + QSettings layout_settings(QSettings::IniFormat, QSettings::UserScope, "Citra", "layout"); + restoreGeometry(layout_settings.value("geometry").toByteArray()); + restoreState(layout_settings.value("state").toByteArray()); + render_window->restoreGeometry(layout_settings.value("geometryRenderWindow").toByteArray()); ui.action_Popout_Window_Mode->setChecked(settings.value("popoutWindowMode", true).toBool()); ToggleWindowMode(); @@ -224,7 +229,7 @@ void GMainWindow::OnConfigure() void GMainWindow::closeEvent(QCloseEvent* event) { // Save window layout - QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); + QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra", "layout"); settings.setValue("geometry", saveGeometry()); settings.setValue("state", saveState()); settings.setValue("geometryRenderWindow", render_window->saveGeometry());