Use Qt resources from a file on macOS.

This commit is contained in:
John Preston 2021-10-27 20:39:21 +04:00
parent efdb990d96
commit f51ff6b513
2 changed files with 13 additions and 5 deletions

View file

@ -24,7 +24,8 @@ generate_palette(lib_ui ui/colors.palette)
generate_styles(lib_ui ${src_loc} "${style_files}" ui/colors.palette)
generate_emoji(lib_ui emoji.txt emoji_suggestions/emoji_autocomplete.json)
set_target_properties(lib_ui PROPERTIES AUTOMOC ON AUTORCC ON)
set_target_properties(lib_ui PROPERTIES AUTOMOC ON)
target_prepare_qrc(lib_ui)
target_precompile_headers(lib_ui PRIVATE ${src_loc}/ui/ui_pch.h)
nice_target_sources(lib_ui ${src_loc}

View file

@ -8,6 +8,7 @@
#include "base/algorithm.h"
#include "base/debug_log.h"
#include "base/base_file_utilities.h"
#include "ui/style/style_core_custom_font.h"
#include "ui/integration.h"
@ -18,16 +19,22 @@
#include <QtWidgets/QApplication>
void style_InitFontsResource() {
#ifdef Q_OS_MAC // Use resources from the .app bundle on macOS.
base::RegisterBundledResources(u"lib_ui.rcc"_q);
#else // Q_OS_MAC
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
Q_INIT_RESOURCE(fonts);
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
#ifdef Q_OS_WIN
Q_INIT_RESOURCE(win);
#elif defined Q_OS_MAC // Q_OS_WIN
Q_INIT_RESOURCE(mac);
#elif defined Q_OS_UNIX && !defined DESKTOP_APP_USE_PACKAGED // Q_OS_WIN || Q_OS_MAC
#elif defined Q_OS_UNIX && !defined DESKTOP_APP_USE_PACKAGED // Q_OS_WIN
Q_INIT_RESOURCE(linux);
#endif // Q_OS_WIN || Q_OS_MAC || (Q_OS_UNIX && !DESKTOP_APP_USE_PACKAGED)
#endif // Q_OS_WIN || (Q_OS_UNIX && !DESKTOP_APP_USE_PACKAGED)
#endif // Q_OS_MAC
}
namespace style {