mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
Qt: Fix style sheet edge case
This commit is contained in:
parent
23b10fc16d
commit
19514128e3
1 changed files with 77 additions and 71 deletions
|
@ -319,10 +319,7 @@ void rpcs3_app::InitializeConnects()
|
||||||
* Handle a request to change the stylesheet. May consider adding reporting of errors in future.
|
* Handle a request to change the stylesheet. May consider adding reporting of errors in future.
|
||||||
* Empty string means default.
|
* Empty string means default.
|
||||||
*/
|
*/
|
||||||
void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
void rpcs3_app::OnChangeStyleSheetRequest(const QString& path)
|
||||||
{
|
|
||||||
QFile file(sheetFilePath);
|
|
||||||
if (sheetFilePath == "")
|
|
||||||
{
|
{
|
||||||
auto rgba = [](const QColor& c, int v = 0)
|
auto rgba = [](const QColor& c, int v = 0)
|
||||||
{
|
{
|
||||||
|
@ -330,7 +327,7 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
QString rgba_tool_bar = rgba(gui::mw_tool_bar_color);
|
QString rgba_tool_bar = rgba(gui::mw_tool_bar_color);
|
||||||
QString style_sheet = QString
|
QString style_sheet
|
||||||
(
|
(
|
||||||
// main window toolbar search
|
// main window toolbar search
|
||||||
//"QLineEdit#mw_searchbar { margin-left:14px; background-color: " + rgba_tool_bar + " }"
|
//"QLineEdit#mw_searchbar { margin-left:14px; background-color: " + rgba_tool_bar + " }"
|
||||||
|
@ -399,6 +396,16 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
||||||
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
|
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QFile file(path);
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||||
|
// If we can't open the file, try the /share folder
|
||||||
|
QString share_dir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/";
|
||||||
|
QFile share_file(share_dir + "GuiConfigs/" + QFileInfo(file.fileName()).fileName());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (path == "")
|
||||||
|
{
|
||||||
setStyleSheet(style_sheet);
|
setStyleSheet(style_sheet);
|
||||||
}
|
}
|
||||||
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
@ -421,19 +428,18 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||||
else
|
else if (share_file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
// If we can't open the file, try the /share folder
|
QDir::setCurrent(share_dir);
|
||||||
QString shareDir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/";
|
setStyleSheet(share_file.readAll());
|
||||||
QDir::setCurrent(shareDir);
|
share_file.close();
|
||||||
QFile newFile(shareDir + "GuiConfigs/" + QFileInfo(file.fileName()).fileName());
|
|
||||||
if (newFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
||||||
{
|
|
||||||
setStyleSheet(newFile.readAll());
|
|
||||||
newFile.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setStyleSheet(style_sheet);
|
||||||
|
}
|
||||||
|
|
||||||
gui::stylesheet = styleSheet();
|
gui::stylesheet = styleSheet();
|
||||||
RPCS3MainWin->RepaintGui();
|
RPCS3MainWin->RepaintGui();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue