Skip to content

Commit

Permalink
Use only one ForkAwesome renderer and print warning if font cannot be…
Browse files Browse the repository at this point in the history
… loaded
  • Loading branch information
Martchus committed Jan 11, 2025
1 parent db32c94 commit c8fe62a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plasmoid/lib/syncthingapplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void SyncthingApplet::init()
// apply settings and connect according to settings
const auto palette = paletteFromTheme(m_theme);
setBrightColors(isPaletteDark(palette));
IconManager::instance().setPalette(palette);
m_iconManager.setPalette(palette);
handleSettingsChanged();
if (c.readEntry<>("preferIconsFromTheme", false)) {
Data::setForkAwesomeThemeOverrides();
Expand All @@ -215,7 +215,7 @@ void SyncthingApplet::initEngine(QObject *object)
return;
}
const auto color = m_theme.color(Plasma::Theme::TextColor, Plasma::Theme::NormalColorGroup);
m_imageProvider = new QtForkAwesome::QuickImageProvider(QtForkAwesome::Renderer::global(), color);
m_imageProvider = new QtForkAwesome::QuickImageProvider(m_iconManager.forkAwesomeRenderer(), color);
connect(engine, &QObject::destroyed, this, &SyncthingApplet::handleImageProviderDestroyed); // engine has ownership over image provider
engine->addImageProvider(QStringLiteral("fa"), m_imageProvider);
}
Expand Down
2 changes: 1 addition & 1 deletion syncthingmodel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)
use_syncthingconnector(VISIBILITY PUBLIC)

# find qtforkawesome
find_package(${PACKAGE_NAMESPACE_PREFIX}qtforkawesome${CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME} 0.1.0 REQUIRED)
find_package(${PACKAGE_NAMESPACE_PREFIX}qtforkawesome${CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME} 0.3.0 REQUIRED)
use_qt_fork_awesome(VISIBILITY PUBLIC)

# link also explicitly against the following Qt modules
Expand Down
1 change: 1 addition & 0 deletions syncthingmodel/syncthingicons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ IconManager::IconManager(const QPalette *palette)
m_forkAwesomeRenderer, (palette ? *palette : QGuiApplication::palette()).color(QPalette::Normal, QPalette::Text), QSize(64, 64))
, m_distinguishTrayIcons(false)
{
m_forkAwesomeRenderer.warnIfInvalid();
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Expand Down
2 changes: 1 addition & 1 deletion tray/gui/quick/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ App::App(bool insecure, QObject *parent)
Qt::QueuedConnection);
connect(&m_engine, &QQmlApplicationEngine::quit, m_app, &QGuiApplication::quit);
m_engine.setProperty("app", QVariant::fromValue(this));
m_engine.addImageProvider(QStringLiteral("fa"), new QtForkAwesome::QuickImageProvider(QtForkAwesome::Renderer::global()));
m_engine.addImageProvider(QStringLiteral("fa"), new QtForkAwesome::QuickImageProvider(iconManager.forkAwesomeRenderer()));

#ifdef Q_OS_ANDROID
// register native methods of Android activity
Expand Down

0 comments on commit c8fe62a

Please sign in to comment.