New and improved font technology!

This commit is contained in:
Gareth Poole 2014-10-28 22:20:22 -04:00
parent b9bc6f9721
commit 57fe9bc4c3
3 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,5 @@
#include <QSettings>
#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;
}

View File

@ -1,3 +1,5 @@
#include <QSettings>
#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()

View File

@ -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());