mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Qt: enable custom fonts for stylesheets and add random object names
This commit is contained in:
parent
31cee7e4c8
commit
f786c078c2
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "rpcs3qt/trophy_notification_helper.h"
|
#include "rpcs3qt/trophy_notification_helper.h"
|
||||||
#include "rpcs3qt/save_data_dialog.h"
|
#include "rpcs3qt/save_data_dialog.h"
|
||||||
#include "rpcs3qt/msg_dialog_frame.h"
|
|
||||||
|
|
||||||
#include "Emu/Io/Null/NullKeyboardHandler.h"
|
#include "Emu/Io/Null/NullKeyboardHandler.h"
|
||||||
#include "basic_keyboard_handler.h"
|
#include "basic_keyboard_handler.h"
|
||||||
@ -356,6 +355,23 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
|||||||
}
|
}
|
||||||
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
|
QString config_dir = qstr(fs::get_config_dir());
|
||||||
|
|
||||||
|
// HACK: dev_flash must be mounted for vfs to work for loading fonts.
|
||||||
|
vfs::mount("dev_flash", fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", Emu.GetEmuDir()));
|
||||||
|
|
||||||
|
// Add PS3 fonts
|
||||||
|
QDirIterator ps3_font_it(qstr(vfs::get("/dev_flash/data/font/")), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
while (ps3_font_it.hasNext())
|
||||||
|
QFontDatabase::addApplicationFont(ps3_font_it.next());
|
||||||
|
|
||||||
|
// Add custom fonts
|
||||||
|
QDirIterator custom_font_it(config_dir + "fonts/", QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
while (custom_font_it.hasNext())
|
||||||
|
QFontDatabase::addApplicationFont(custom_font_it.next());
|
||||||
|
|
||||||
|
// Set root for stylesheets
|
||||||
|
QDir::setCurrent(config_dir);
|
||||||
setStyleSheet(file.readAll());
|
setStyleSheet(file.readAll());
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "basic_mouse_handler.h"
|
#include "basic_mouse_handler.h"
|
||||||
|
|
||||||
#include "Utilities/Config.h"
|
#include "Utilities/Config.h"
|
||||||
|
#include "Emu/VFS.h"
|
||||||
#include "Emu/RSX/GSRender.h"
|
#include "Emu/RSX/GSRender.h"
|
||||||
#include "Emu/Io/KeyboardHandler.h"
|
#include "Emu/Io/KeyboardHandler.h"
|
||||||
#include "Emu/Io/PadHandler.h"
|
#include "Emu/Io/PadHandler.h"
|
||||||
@ -19,6 +20,7 @@
|
|||||||
#include "rpcs3qt/emu_settings.h"
|
#include "rpcs3qt/emu_settings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
/** RPCS3 Application Class
|
/** RPCS3 Application Class
|
||||||
* The point of this class is to do application initialization and to hold onto the main window. The main thing I intend this class to do, for now, is to initialize callbacks and the main_window.
|
* The point of this class is to do application initialization and to hold onto the main window. The main thing I intend this class to do, for now, is to initialize callbacks and the main_window.
|
||||||
|
@ -37,6 +37,7 @@ auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialo
|
|||||||
|
|
||||||
setMinimumSize(QSize(400, 360));
|
setMinimumSize(QSize(400, 360));
|
||||||
setWindowTitle(tr("Auto Pause Manager"));
|
setWindowTitle(tr("Auto Pause Manager"));
|
||||||
|
setObjectName("auto_pause_manager");
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
connect(pauseList, &QTableWidget::customContextMenuRequested, this, &auto_pause_settings_dialog::ShowContextMenu);
|
connect(pauseList, &QTableWidget::customContextMenuRequested, this, &auto_pause_settings_dialog::ShowContextMenu);
|
||||||
|
@ -23,6 +23,7 @@ inline std::string sstr(const QString& _in) { return _in.toStdString(); }
|
|||||||
cg_disasm_window::cg_disasm_window(std::shared_ptr<gui_settings> xSettings): xgui_settings(xSettings)
|
cg_disasm_window::cg_disasm_window(std::shared_ptr<gui_settings> xSettings): xgui_settings(xSettings)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Cg Disasm"));
|
setWindowTitle(tr("Cg Disasm"));
|
||||||
|
setObjectName("cg_disasm");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setMinimumSize(QSize(200, 150)); // seems fine on win 10
|
setMinimumSize(QSize(200, 150)); // seems fine on win 10
|
||||||
|
@ -54,7 +54,6 @@ kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent)
|
|||||||
// Events
|
// Events
|
||||||
connect(button_refresh, &QAbstractButton::clicked, this, &kernel_explorer::Update);
|
connect(button_refresh, &QAbstractButton::clicked, this, &kernel_explorer::Update);
|
||||||
|
|
||||||
// Fill the wxTreeCtrl
|
|
||||||
Update();
|
Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QTabBar>
|
||||||
|
|
||||||
constexpr auto qstr = QString::fromStdString;
|
constexpr auto qstr = QString::fromStdString;
|
||||||
|
|
||||||
@ -103,6 +104,8 @@ static gui_listener s_gui_listener;
|
|||||||
log_frame::log_frame(std::shared_ptr<gui_settings> guiSettings, QWidget *parent) : QDockWidget(tr("Log"), parent), xgui_settings(guiSettings)
|
log_frame::log_frame(std::shared_ptr<gui_settings> guiSettings, QWidget *parent) : QDockWidget(tr("Log"), parent), xgui_settings(guiSettings)
|
||||||
{
|
{
|
||||||
m_tabWidget = new QTabWidget;
|
m_tabWidget = new QTabWidget;
|
||||||
|
m_tabWidget->setObjectName("tab_widget_log");
|
||||||
|
m_tabWidget->tabBar()->setObjectName("tab_bar_log");
|
||||||
|
|
||||||
m_log = new QTextEdit(m_tabWidget);
|
m_log = new QTextEdit(m_tabWidget);
|
||||||
m_log->setObjectName("log_frame");
|
m_log->setObjectName("log_frame");
|
||||||
|
@ -7,6 +7,7 @@ memory_string_searcher::memory_string_searcher(QWidget* parent)
|
|||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("String Searcher"));
|
setWindowTitle(tr("String Searcher"));
|
||||||
|
setObjectName("memory_string_searcher");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
m_addr_line = new QLineEdit(this);
|
m_addr_line = new QLineEdit(this);
|
||||||
|
@ -17,6 +17,7 @@ rsx_debugger::rsx_debugger(QWidget* parent)
|
|||||||
, exit(false)
|
, exit(false)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("RSX Debugger"));
|
setWindowTitle(tr("RSX Debugger"));
|
||||||
|
setObjectName("rsx_debugger");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
//Fonts and Colors
|
//Fonts and Colors
|
||||||
|
@ -32,13 +32,14 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->cancelButton->setFocus();
|
ui->cancelButton->setFocus();
|
||||||
ui->tabWidget->setUsesScrollButtons(false);
|
ui->tab_widget_settings->setUsesScrollButtons(false);
|
||||||
|
ui->tab_widget_settings->tabBar()->setObjectName("tab_bar_settings");
|
||||||
|
|
||||||
bool showDebugTab = xgui_settings->GetValue(gui::m_showDebugTab).toBool();
|
bool showDebugTab = xgui_settings->GetValue(gui::m_showDebugTab).toBool();
|
||||||
xgui_settings->SetValue(gui::m_showDebugTab, showDebugTab);
|
xgui_settings->SetValue(gui::m_showDebugTab, showDebugTab);
|
||||||
if (!showDebugTab)
|
if (!showDebugTab)
|
||||||
{
|
{
|
||||||
ui->tabWidget->removeTab(7);
|
ui->tab_widget_settings->removeTab(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add description labels
|
// Add description labels
|
||||||
@ -111,7 +112,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||||||
|
|
||||||
connect(ui->cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
|
connect(ui->cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||||
|
|
||||||
connect(ui->tabWidget, &QTabWidget::currentChanged, [=]()
|
connect(ui->tab_widget_settings, &QTabWidget::currentChanged, [=]()
|
||||||
{
|
{
|
||||||
ui->cancelButton->setFocus();
|
ui->cancelButton->setFocus();
|
||||||
});
|
});
|
||||||
@ -1081,7 +1082,7 @@ int settings_dialog::exec()
|
|||||||
// If we use setCurrentIndex now we will miraculously see a resize of the dialog as soon as we
|
// If we use setCurrentIndex now we will miraculously see a resize of the dialog as soon as we
|
||||||
// switch to the cpu tab after conjuring the settings_dialog with another tab opened first.
|
// switch to the cpu tab after conjuring the settings_dialog with another tab opened first.
|
||||||
// Weirdly enough this won't happen if we change the tab order so that anything else is at index 0.
|
// Weirdly enough this won't happen if we change the tab order so that anything else is at index 0.
|
||||||
QTimer::singleShot(0, [=]{ ui->tabWidget->setCurrentIndex(m_tab_Index); });
|
QTimer::singleShot(0, [=]{ ui->tab_widget_settings->setCurrentIndex(m_tab_Index); });
|
||||||
return QDialog::exec();
|
return QDialog::exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,7 +1106,7 @@ bool settings_dialog::eventFilter(QObject* object, QEvent* event)
|
|||||||
return QDialog::eventFilter(object, event);
|
return QDialog::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = ui->tabWidget->currentIndex();
|
int i = ui->tab_widget_settings->currentIndex();
|
||||||
QLabel* label = m_description_labels[i].first;
|
QLabel* label = m_description_labels[i].first;
|
||||||
|
|
||||||
if (event->type() == QEvent::Enter)
|
if (event->type() == QEvent::Enter)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tab_widget_settings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -36,7 +36,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>6</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="coreTab">
|
<widget class="QWidget" name="coreTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -41,6 +41,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
|
|||||||
{
|
{
|
||||||
// Nonspecific widget settings
|
// Nonspecific widget settings
|
||||||
setWindowTitle(tr("Trophy Manager"));
|
setWindowTitle(tr("Trophy Manager"));
|
||||||
|
setObjectName("trophy_manager");
|
||||||
|
|
||||||
m_icon_height = m_gui_settings->GetValue(gui::tr_icon_height).toInt();
|
m_icon_height = m_gui_settings->GetValue(gui::tr_icon_height).toInt();
|
||||||
m_show_locked_trophies = m_gui_settings->GetValue(gui::tr_show_locked).toBool();
|
m_show_locked_trophies = m_gui_settings->GetValue(gui::tr_show_locked).toBool();
|
||||||
|
@ -10,6 +10,7 @@ constexpr auto qstr = QString::fromStdString;
|
|||||||
|
|
||||||
trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& imgBuffer, const SceNpTrophyDetails& trophy, int height) : QWidget()
|
trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& imgBuffer, const SceNpTrophyDetails& trophy, int height) : QWidget()
|
||||||
{
|
{
|
||||||
|
setObjectName("trophy_notification_frame");
|
||||||
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||||
|
|
||||||
@ -42,14 +43,14 @@ trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& i
|
|||||||
QString trophyType = "";
|
QString trophyType = "";
|
||||||
switch (trophy.trophyGrade)
|
switch (trophy.trophyGrade)
|
||||||
{
|
{
|
||||||
case SCE_NP_TROPHY_GRADE_BRONZE: trophyType = "bronze"; break;
|
case SCE_NP_TROPHY_GRADE_BRONZE: trophyType = "bronze"; break;
|
||||||
case SCE_NP_TROPHY_GRADE_SILVER: trophyType = "silver"; break;
|
case SCE_NP_TROPHY_GRADE_SILVER: trophyType = "silver"; break;
|
||||||
case SCE_NP_TROPHY_GRADE_GOLD: trophyType = "gold"; break;
|
case SCE_NP_TROPHY_GRADE_GOLD: trophyType = "gold"; break;
|
||||||
case SCE_NP_TROPHY_GRADE_PLATINUM: trophyType = "platinum"; break;
|
case SCE_NP_TROPHY_GRADE_PLATINUM: trophyType = "platinum"; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
trophyName->setText("You have earned the " + trophyType + " trophy\n" + qstr(trophy.name));
|
trophyName->setText(tr("You have earned the %1 trophy\n").arg(trophyType) + qstr(trophy.name));
|
||||||
trophyName->setAutoFillBackground(true);
|
trophyName->setAutoFillBackground(true);
|
||||||
trophyName->setPalette(black_background);
|
trophyName->setPalette(black_background);
|
||||||
|
|
||||||
@ -60,7 +61,8 @@ trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& i
|
|||||||
setPalette(black_background);
|
setPalette(black_background);
|
||||||
|
|
||||||
// I may consider moving this code later to be done at a better location.
|
// I may consider moving this code later to be done at a better location.
|
||||||
QTimer::singleShot(TROPHY_TIMEOUT_MS, [this]() {
|
QTimer::singleShot(TROPHY_TIMEOUT_MS, [this]()
|
||||||
|
{
|
||||||
deleteLater();
|
deleteLater();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -83,4 +83,5 @@ vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_pt
|
|||||||
|
|
||||||
setLayout(vbox);
|
setLayout(vbox);
|
||||||
setWindowTitle(tr("Virtual File System"));
|
setWindowTitle(tr("Virtual File System"));
|
||||||
|
setObjectName("vfs_dialog");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user