mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
fix update linux
This commit is contained in:
@@ -34,7 +34,13 @@ void LinuxTrayIconBackend::applyVisual(const TrayIconVisual &visual)
|
||||
{
|
||||
const qreal opacity = TrayIconCommon::opacityForState(visual.connectionState);
|
||||
const QColor indicatorColor = TrayIconCommon::indicatorColorForState(visual.connectionState);
|
||||
m_trayIcon.setIcon(buildTrayIcon(opacity, visual.darkTheme, indicatorColor));
|
||||
const QIcon icon = buildTrayIcon(opacity, visual.darkTheme, indicatorColor);
|
||||
|
||||
// Some tray implementations cache the first icon; clear before applying an update.
|
||||
if (m_trayIcon.isVisible()) {
|
||||
m_trayIcon.setIcon(QIcon());
|
||||
}
|
||||
m_trayIcon.setIcon(icon);
|
||||
}
|
||||
|
||||
void LinuxTrayIconBackend::showMessage(const QString &title, const QString &message, const TrayIconVisual &visual,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "linuxtraytheme.h"
|
||||
|
||||
#include "platforms/linux/linuxutils.h"
|
||||
#include "ui/utils/trayThemeChangeFilter.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QObject>
|
||||
#include <QStyleHints>
|
||||
@@ -16,5 +18,7 @@ void LinuxTrayTheme::installThemeObserver(const std::function<void()> &onThemeCh
|
||||
QObject::connect(styleHints, &QStyleHints::colorSchemeChanged, parent, [onThemeChanged]() { onThemeChanged(); });
|
||||
}
|
||||
|
||||
qApp->installEventFilter(new TrayThemeChangeFilter(onThemeChanged, parent));
|
||||
|
||||
LinuxUtils::installThemeChangeObserver(onThemeChanged);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ public:
|
||||
SLOT(onPortalSettingChanged(QString, QString, QDBusVariant)));
|
||||
}
|
||||
|
||||
void setCallback(std::function<void()> callback)
|
||||
{
|
||||
m_callback = std::move(callback);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void onPortalSettingChanged(const QString &namespaceName, const QString &key, const QDBusVariant &value)
|
||||
{
|
||||
@@ -114,7 +119,10 @@ void LinuxUtils::installThemeChangeObserver(std::function<void()> callback)
|
||||
|
||||
if (!g_themeObserver) {
|
||||
g_themeObserver = new LinuxThemeObserver(std::move(callback), qApp);
|
||||
return;
|
||||
}
|
||||
|
||||
g_themeObserver->setCallback(std::move(callback));
|
||||
}
|
||||
|
||||
#include "linuxutils.moc"
|
||||
|
||||
Reference in New Issue
Block a user