Skip to content

Commit

Permalink
Use Qt resources from a file on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Oct 27, 2021
1 parent efdb990 commit f51ff6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
15 changes: 11 additions & 4 deletions ui/style/style_core_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 {
Expand Down

0 comments on commit f51ff6b

Please sign in to comment.