diff options
| author | 2015-08-19 17:00:56 -0300 | |
|---|---|---|
| committer | 2015-08-24 22:16:28 -0300 | |
| commit | c7745408f77a17771c1a26efb981d79aa66c9f66 (patch) | |
| tree | 21c29e6927d35d51a1a9becc43f004746a38e777 | |
| parent | Merge pull request #1063 from Subv/hw_renderer_debug_fb (diff) | |
| download | yuzu-c7745408f77a17771c1a26efb981d79aa66c9f66.tar.gz yuzu-c7745408f77a17771c1a26efb981d79aa66c9f66.tar.xz yuzu-c7745408f77a17771c1a26efb981d79aa66c9f66.zip | |
citra-qt: Add helper function to get a monospace QFont
Diffstat (limited to '')
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics.cpp | 4 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 6 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics_vertex_shader.cpp | 4 | ||||
| -rw-r--r-- | src/citra_qt/util/util.cpp | 13 | ||||
| -rw-r--r-- | src/citra_qt/util/util.h | 8 |
6 files changed, 32 insertions, 5 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 0c0515054..a82e8a85b 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -18,6 +18,7 @@ set(SRCS | |||
| 18 | debugger/ramview.cpp | 18 | debugger/ramview.cpp |
| 19 | debugger/registers.cpp | 19 | debugger/registers.cpp |
| 20 | util/spinbox.cpp | 20 | util/spinbox.cpp |
| 21 | util/util.cpp | ||
| 21 | bootmanager.cpp | 22 | bootmanager.cpp |
| 22 | hotkeys.cpp | 23 | hotkeys.cpp |
| 23 | main.cpp | 24 | main.cpp |
| @@ -42,6 +43,7 @@ set(HEADERS | |||
| 42 | debugger/ramview.h | 43 | debugger/ramview.h |
| 43 | debugger/registers.h | 44 | debugger/registers.h |
| 44 | util/spinbox.h | 45 | util/spinbox.h |
| 46 | util/util.h | ||
| 45 | bootmanager.h | 47 | bootmanager.h |
| 46 | hotkeys.h | 48 | hotkeys.h |
| 47 | main.h | 49 | main.h |
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp index 7424671f1..7d15028f0 100644 --- a/src/citra_qt/debugger/graphics.cpp +++ b/src/citra_qt/debugger/graphics.cpp | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #include <QVBoxLayout> | 7 | #include <QVBoxLayout> |
| 8 | #include <QDebug> | 8 | #include <QDebug> |
| 9 | 9 | ||
| 10 | #include "citra_qt/util/util.h" | ||
| 11 | |||
| 10 | extern GraphicsDebugger g_debugger; | 12 | extern GraphicsDebugger g_debugger; |
| 11 | 13 | ||
| 12 | GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0) | 14 | GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0) |
| @@ -79,7 +81,7 @@ GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent) : QDockWidget(tr | |||
| 79 | 81 | ||
| 80 | QListView* command_list = new QListView; | 82 | QListView* command_list = new QListView; |
| 81 | command_list->setModel(command_model); | 83 | command_list->setModel(command_model); |
| 82 | command_list->setFont(QFont("monospace")); | 84 | command_list->setFont(GetMonospaceFont()); |
| 83 | 85 | ||
| 84 | setWidget(command_list); | 86 | setWidget(command_list); |
| 85 | } | 87 | } |
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 35a3140b2..025434687 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <QSpinBox> | 14 | #include <QSpinBox> |
| 15 | #include <QComboBox> | 15 | #include <QComboBox> |
| 16 | 16 | ||
| 17 | #include "citra_qt/util/util.h" | ||
| 18 | |||
| 17 | #include "common/vector_math.h" | 19 | #include "common/vector_math.h" |
| 18 | 20 | ||
| 19 | #include "video_core/debug_utils/debug_utils.h" | 21 | #include "video_core/debug_utils/debug_utils.h" |
| @@ -303,9 +305,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 303 | 305 | ||
| 304 | list_widget = new QTreeView; | 306 | list_widget = new QTreeView; |
| 305 | list_widget->setModel(model); | 307 | list_widget->setModel(model); |
| 306 | QFont font("monospace"); | 308 | list_widget->setFont(GetMonospaceFont()); |
| 307 | font.setStyleHint(QFont::Monospace); // Automatic fallback to a monospace font on on platforms without a font called "monospace" | ||
| 308 | list_widget->setFont(font); | ||
| 309 | list_widget->setRootIsDecorated(false); | 309 | list_widget->setRootIsDecorated(false); |
| 310 | list_widget->setUniformRowHeights(true); | 310 | list_widget->setUniformRowHeights(true); |
| 311 | 311 | ||
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 0c17edee0..1d9a00e89 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #include <QSpinBox> | 15 | #include <QSpinBox> |
| 16 | #include <QTreeView> | 16 | #include <QTreeView> |
| 17 | 17 | ||
| 18 | #include "citra_qt/util/util.h" | ||
| 19 | |||
| 18 | #include "video_core/shader/shader.h" | 20 | #include "video_core/shader/shader.h" |
| 19 | 21 | ||
| 20 | #include "graphics_vertex_shader.h" | 22 | #include "graphics_vertex_shader.h" |
| @@ -245,7 +247,7 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con | |||
| 245 | } | 247 | } |
| 246 | 248 | ||
| 247 | case Qt::FontRole: | 249 | case Qt::FontRole: |
| 248 | return QFont("monospace"); | 250 | return GetMonospaceFont(); |
| 249 | 251 | ||
| 250 | case Qt::BackgroundRole: | 252 | case Qt::BackgroundRole: |
| 251 | // Highlight instructions which have no debug data associated to them | 253 | // Highlight instructions which have no debug data associated to them |
diff --git a/src/citra_qt/util/util.cpp b/src/citra_qt/util/util.cpp new file mode 100644 index 000000000..2cb939af1 --- /dev/null +++ b/src/citra_qt/util/util.cpp | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "util.h" | ||
| 6 | |||
| 7 | QFont GetMonospaceFont() { | ||
| 8 | QFont font("monospace"); | ||
| 9 | // Automatic fallback to a monospace font on on platforms without a font called "monospace" | ||
| 10 | font.setStyleHint(QFont::Monospace); | ||
| 11 | font.setFixedPitch(true); | ||
| 12 | return font; | ||
| 13 | } | ||
diff --git a/src/citra_qt/util/util.h b/src/citra_qt/util/util.h new file mode 100644 index 000000000..0787f9eb7 --- /dev/null +++ b/src/citra_qt/util/util.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <QFont> | ||
| 6 | |||
| 7 | /// Returns a QFont object appropriate to use as a monospace font for debugging widgets, etc. | ||
| 8 | QFont GetMonospaceFont(); | ||