Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: fix stylesheets on various platforms #9735

Merged
merged 1 commit into from Feb 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion rpcs3/rpcs3qt/gui_settings.cpp
Expand Up @@ -4,6 +4,8 @@
#include "localized.h"

#include "Emu/System.h"
#include "Utilities/File.h"
#include "Utilities/StrUtil.h"

#include <QCheckBox>
#include <QCoreApplication>
Expand Down Expand Up @@ -376,7 +378,17 @@ QString gui_settings::GetCurrentStylesheetPath()
QString path = dir.absoluteFilePath(stylesheet + ".qss");
QFile test(path);
if (test.exists())
return path;
{
test.open(QIODevice::ReadOnly);
std::string result = fs::get_cache_dir() + "temp.qss";
std::string sheet = test.readAll().toStdString();

// Fixup paths (replace resources in GuiConfigs with absolute paths) and store in temp file.
path.truncate(path.size() - stylesheet.size() - 4);
fs::write_file(result, fs::rewrite, fmt::replace_all(sheet, "url(\"GuiConfigs/", "url(\"" + path.toStdString()));

return QString::fromUtf8(result.data(), result.size());
}
}

return "";
Expand Down