Skip to content

Commit

Permalink
add selection for log encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterMute committed Feb 16, 2024
1 parent a6da53e commit c94ea6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Source/Core/DolphinQt/Config/LogWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <QPlainTextEdit>
#include <QPushButton>
#include <QTimer>
#include <sys/qos.h>

#include "Core/ConfigManager.h"

Expand Down Expand Up @@ -132,15 +133,19 @@ void LogWidget::CreateWidgets()
// Log
m_log_text = new QPlainTextEdit;
m_log_wrap = new QCheckBox(tr("Word Wrap"));
m_log_encoding = new QComboBox;
m_log_font = new QComboBox;
m_log_clear = new QPushButton(tr("Clear"));

m_log_encoding->addItems({tr("Shift JIS"), tr("UTF-8")});

m_log_font->addItems({tr("Default Font"), tr("Monospaced Font"), tr("Selected Font")});

auto* log_layout = new QGridLayout;
log_layout->addWidget(m_log_wrap, 0, 0);
log_layout->addWidget(m_log_font, 0, 1);
log_layout->addWidget(m_log_clear, 0, 2);
log_layout->addWidget(m_log_encoding, 0, 1);
log_layout->addWidget(m_log_font, 0, 2);
log_layout->addWidget(m_log_clear, 0, 3);
log_layout->addWidget(m_log_text, 1, 0, 1, -1);

QWidget* widget = new QWidget;
Expand Down Expand Up @@ -182,6 +187,7 @@ void LogWidget::LoadSettings()
m_log_text->setHorizontalScrollBarPolicy(m_log_wrap->isChecked() ? Qt::ScrollBarAsNeeded :
Qt::ScrollBarAlwaysOn);

m_log_encoding->setCurrentIndex(std::min(settings.value(QStringLiteral("logging/encoding")).toInt(), 1));
// Log - Font Selection
// Currently "Debugger Font" is not supported as there is no Qt Debugger, defaulting to Monospace
m_log_font->setCurrentIndex(std::min(settings.value(QStringLiteral("logging/font")).toInt(), 1));
Expand All @@ -202,6 +208,9 @@ void LogWidget::SaveSettings()
m_log_text->setHorizontalScrollBarPolicy(m_log_wrap->isChecked() ? Qt::ScrollBarAsNeeded :
Qt::ScrollBarAlwaysOn);

// Log - Encoding Selection
settings.setValue(QStringLiteral("logging/encoding"), m_log_encoding->currentIndex());

// Log - Font Selection
settings.setValue(QStringLiteral("logging/font"), m_log_font->currentIndex());
UpdateFont();
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Config/LogWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LogWidget final : public QDockWidget, Common::Log::LogListener

// Log
QCheckBox* m_log_wrap;
QComboBox* m_log_encoding;
QComboBox* m_log_font;
QPushButton* m_log_clear;
QPlainTextEdit* m_log_text;
Expand Down

0 comments on commit c94ea6f

Please sign in to comment.