mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-15 02:35:45 -04:00
Qt: Move resources out of exe into rcc file
This commit is contained in:
@ -3,11 +3,9 @@ find_package(Qt6 6.7.2 COMPONENTS Core Gui Widgets LinguistTools REQUIRED)
|
||||
include(CopyBaseTranslations)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
set(SRCS
|
||||
resources/resources.qrc
|
||||
aboutdialog.cpp
|
||||
aboutdialog.h
|
||||
aboutdialog.ui
|
||||
@ -253,6 +251,20 @@ elseif(APPLE)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif()
|
||||
|
||||
# Compile qrc to a binary file.
|
||||
if(NOT APPLE)
|
||||
set(RCC_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/duckstation-qt.rcc")
|
||||
qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress)
|
||||
add_dependencies(duckstation-qt duckstation-qt-rcc)
|
||||
else()
|
||||
set(RCC_FILE "${CMAKE_CURRENT_BINARY_DIR}/duckstation-qt.rcc")
|
||||
qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress)
|
||||
add_dependencies(duckstation-qt duckstation-qt-rcc)
|
||||
target_sources(duckstation-qt PRIVATE ${RCC_FILE})
|
||||
set_source_files_properties(${RCC_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
endif()
|
||||
|
||||
|
||||
# Translation setup.
|
||||
qt_add_lrelease(duckstation-qt TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES)
|
||||
if(NOT APPLE)
|
||||
|
@ -211,7 +211,7 @@
|
||||
</QtUi>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtResource Include="resources\resources.qrc">
|
||||
<QtResource Include="resources\duckstation-qt.qrc">
|
||||
<FileType>Document</FileType>
|
||||
</QtResource>
|
||||
</ItemGroup>
|
||||
@ -259,7 +259,6 @@
|
||||
<ClCompile Include="$(IntDir)moc_qtprogresscallback.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_settingswindow.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_setupwizarddialog.cpp" />
|
||||
<ClCompile Include="$(IntDir)qrc_resources.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="qt5.natvis" />
|
||||
|
@ -17,7 +17,6 @@
|
||||
<ClCompile Include="advancedsettingswidget.cpp" />
|
||||
<ClCompile Include="aboutdialog.cpp" />
|
||||
<ClCompile Include="memorycardsettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)qrc_resources.cpp" />
|
||||
<ClCompile Include="inputbindingdialog.cpp" />
|
||||
<ClCompile Include="gamelistmodel.cpp" />
|
||||
<ClCompile Include="autoupdaterdialog.cpp" />
|
||||
@ -300,7 +299,7 @@
|
||||
<Image Include="duckstation-qt.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtResource Include="resources\resources.qrc">
|
||||
<QtResource Include="resources\duckstation-qt.qrc">
|
||||
<Filter>resources</Filter>
|
||||
</QtResource>
|
||||
</ItemGroup>
|
||||
|
@ -479,10 +479,12 @@ bool QtHost::SetCriticalFolders()
|
||||
CrashHandler::SetWriteDirectory(EmuFolders::DataRoot);
|
||||
|
||||
// the resources directory should exist, bail out if not
|
||||
if (!FileSystem::DirectoryExists(EmuFolders::Resources.c_str()))
|
||||
const std::string rcc_path = Path::Combine(EmuFolders::Resources, "duckstation-qt.rcc");
|
||||
if (!FileSystem::DirectoryExists(EmuFolders::Resources.c_str()) || !FileSystem::FileExists(rcc_path.c_str()) ||
|
||||
!QResource::registerResource(QString::fromStdString(rcc_path)))
|
||||
{
|
||||
QMessageBox::critical(nullptr, QStringLiteral("Error"),
|
||||
QStringLiteral("Resources directory is missing, your installation is incomplete."));
|
||||
QStringLiteral("Resources are missing, your installation is incomplete."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2415,7 +2417,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
|
||||
}
|
||||
|
||||
// To do anything useful, we need the config initialized.
|
||||
if (!QtHost::InitializeConfig(std::move(settings_filename)))
|
||||
if (!InitializeConfig(std::move(settings_filename)))
|
||||
{
|
||||
// NOTE: No point translating this, because no config means the language won't be loaded anyway.
|
||||
QMessageBox::critical(nullptr, QStringLiteral("Error"), QStringLiteral("Failed to initialize config."));
|
||||
|
Reference in New Issue
Block a user