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

Load stylesheets properly when in AppImage or make install #4364

Merged
merged 2 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion rpcs3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if(USE_NATIVE_INSTRUCTIONS)
endif()

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -Wno-unused-command-line-argument -fexceptions")
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
Expand Down
14 changes: 14 additions & 0 deletions rpcs3/rpcs3_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,20 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
setStyleSheet(file.readAll());
file.close();
}
#if !defined(_WIN32) && !defined(__APPLE__)
else
{
// If we can't open the file, try the /share folder
QString shareDir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/";
QDir::setCurrent(shareDir);
QFile newFile(shareDir + "GuiConfigs/" + QFileInfo(file.fileName()).fileName());
if (newFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
setStyleSheet(newFile.readAll());
newFile.close();
}
}
#endif
gui::stylesheet = styleSheet();
RPCS3MainWin->RepaintGui();
}
Expand Down
19 changes: 10 additions & 9 deletions rpcs3/rpcs3qt/gui_settings.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "gui_settings.h"

#include "game_list_frame.h"
#include "qt_utils.h"

#include <QCoreApplication>
#include <QMessageBox>
Expand Down Expand Up @@ -235,15 +236,15 @@ void gui_settings::BackupSettingsToTarget(const QString& friendlyName)

QStringList gui_settings::GetStylesheetEntries()
{
QStringList nameFilter;
nameFilter << "*.qss";
QFileInfoList entries = m_settingsDir.entryInfoList(nameFilter, QDir::Files);
QStringList res;
for (const QFileInfo &entry : entries)
{
res.append(entry.baseName());
}

QStringList nameFilter = QStringList("*.qss");
QStringList res = gui::utils::get_dir_entries(m_settingsDir, nameFilter);
#if !defined(_WIN32) && !defined(__APPLE__)
// Makes stylesheets load if using AppImage or installed to /usr/bin
QDir linuxStylesheetDir = QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/";
res.append(gui::utils::get_dir_entries(linuxStylesheetDir, nameFilter));
res.removeDuplicates();
#endif
res.sort(Qt::CaseInsensitive);
return res;
}

Expand Down