mirror of
https://github.com/PCSX2/pcsx2.git
synced 2024-11-27 11:30:45 +00:00
Qt: Add runtime downloading of CJK OSD fonts
This commit is contained in:
parent
7a045d837b
commit
46e1e3d904
7
.gitignore
vendored
7
.gitignore
vendored
@ -85,6 +85,13 @@ oprofile_data/
|
||||
/bin/textures
|
||||
/bin/translations
|
||||
/bin/inputprofiles
|
||||
|
||||
# Resources that are runtime downloaded.
|
||||
/bin/resources/NotoSansJP-Regular.ttf
|
||||
/bin/resources/NotoSansKR-Regular.ttf
|
||||
/bin/resources/NotoSansSC-Regular.ttf
|
||||
/bin/resources/NotoSansTC-Regular.ttf
|
||||
|
||||
/deps
|
||||
/ipch
|
||||
|
||||
|
@ -1644,7 +1644,10 @@ void MainWindow::reloadThemeSpecificImages()
|
||||
|
||||
void MainWindow::updateLanguage()
|
||||
{
|
||||
QtHost::InstallTranslator();
|
||||
// Remove the settings window, so it doesn't mess with any popups that happen (e.g. font download).
|
||||
destroySubWindows();
|
||||
|
||||
QtHost::InstallTranslator(this);
|
||||
recreate();
|
||||
}
|
||||
|
||||
@ -2885,6 +2888,12 @@ MainWindow::VMLock MainWindow::pauseAndLockVM()
|
||||
// Now we'll either have a borderless window, or a regular window (if we were exclusive fullscreen).
|
||||
QWidget* dialog_parent = getDisplayContainer();
|
||||
|
||||
// Ensure main window is visible.
|
||||
if (!g_main_window->isVisible())
|
||||
g_main_window->show();
|
||||
g_main_window->raise();
|
||||
g_main_window->activateWindow();
|
||||
|
||||
return VMLock(dialog_parent, was_paused, was_fullscreen);
|
||||
}
|
||||
|
||||
@ -2922,6 +2931,19 @@ MainWindow::VMLock::~VMLock()
|
||||
g_emu_thread->setVMPaused(false);
|
||||
}
|
||||
|
||||
MainWindow::VMLock& MainWindow::VMLock::operator=(VMLock&& lock)
|
||||
{
|
||||
m_dialog_parent = lock.m_dialog_parent;
|
||||
m_was_paused = lock.m_was_paused;
|
||||
m_was_fullscreen = lock.m_was_fullscreen;
|
||||
|
||||
lock.m_dialog_parent = nullptr;
|
||||
lock.m_was_paused = true;
|
||||
lock.m_was_fullscreen = false;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void MainWindow::VMLock::cancelResume()
|
||||
{
|
||||
m_was_paused = true;
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
VMLock(const VMLock&) = delete;
|
||||
~VMLock();
|
||||
|
||||
VMLock& operator=(VMLock&& lock);
|
||||
VMLock& operator=(const VMLock&) = delete;
|
||||
|
||||
/// Returns the parent widget, which can be used for any popup dialogs.
|
||||
__fi QWidget* getDialogParent() const { return m_dialog_parent; }
|
||||
|
||||
|
@ -1242,7 +1242,7 @@ bool QtHost::InitializeConfig()
|
||||
|
||||
LogSink::SetBlockSystemConsole(QtHost::InNoGUIMode());
|
||||
VMManager::Internal::LoadStartupSettings();
|
||||
InstallTranslator();
|
||||
InstallTranslator(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ namespace QtHost
|
||||
std::vector<std::pair<QString, QString>> GetAvailableLanguageList();
|
||||
|
||||
/// Call when the language changes.
|
||||
void InstallTranslator();
|
||||
void InstallTranslator(QWidget* dialog_parent);
|
||||
|
||||
/// Returns the application name and version, optionally including debug/devel config indicator.
|
||||
QString GetAppNameAndVersion();
|
||||
|
@ -203,7 +203,7 @@ void SetupWizardDialog::themeChanged()
|
||||
void SetupWizardDialog::languageChanged()
|
||||
{
|
||||
// Skip the recreation, since we don't have many dynamic UI elements.
|
||||
QtHost::InstallTranslator();
|
||||
QtHost::InstallTranslator(this);
|
||||
m_ui.retranslateUi(this);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -393,10 +393,8 @@ bool ImGuiManager::LoadFontData()
|
||||
{
|
||||
if (s_standard_font_data.empty())
|
||||
{
|
||||
std::optional<std::vector<u8>> font_data =
|
||||
s_font_path.empty() ? FileSystem::ReadBinaryFile(
|
||||
EmuFolders::GetOverridableResourcePath("fonts" FS_OSPATH_SEPARATOR_STR "Roboto-Regular.ttf").c_str()) :
|
||||
FileSystem::ReadBinaryFile(s_font_path.c_str());
|
||||
pxAssertRel(!s_font_path.empty(), "Font path has not been set.");
|
||||
std::optional<std::vector<u8>> font_data = FileSystem::ReadBinaryFile(s_font_path.c_str());
|
||||
if (!font_data.has_value())
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user