UI: Tray: Update icons

This commit is contained in:
Nodir Temirkhodjaev 2024-06-08 14:38:15 +03:00
parent adf095e831
commit e72498be56
6 changed files with 18 additions and 9 deletions

View File

@ -662,15 +662,7 @@ void TrayIcon::removeAlertTimer()
void TrayIcon::updateTrayIconShape() void TrayIcon::updateTrayIconShape()
{ {
QString mainIconPath; const QString mainIconPath = trayIconPath();
if (!conf()->filterEnabled() || !driverManager()->isDeviceOpened()) {
mainIconPath = ":/icons/fort_gray.png";
} else if (conf()->blockTraffic() || conf()->blockInetTraffic()) {
mainIconPath = ":/icons/fort_red.png";
} else {
mainIconPath = ":/icons/fort.png";
}
const auto icon = m_alerted const auto icon = m_alerted
? (m_animatedAlert ? IconCache::icon(":/icons/error.png") ? (m_animatedAlert ? IconCache::icon(":/icons/error.png")
@ -680,6 +672,20 @@ void TrayIcon::updateTrayIconShape()
this->setIcon(icon); this->setIcon(icon);
} }
QString TrayIcon::trayIconPath() const
{
if (!conf()->filterEnabled() || !driverManager()->isDeviceOpened()) {
return ":/icons/fort_gray.png";
}
if (conf()->blockTraffic()) {
return ":/icons/fort_red.png";
}
if (conf()->blockInetTraffic()) {
return ":/icons/fort_orange.png";
}
return ":/icons/fort.png";
}
void TrayIcon::saveTrayFlags() void TrayIcon::saveTrayFlags()
{ {
conf()->setFilterEnabled(m_filterEnabledAction->isChecked()); conf()->setFilterEnabled(m_filterEnabledAction->isChecked());

View File

@ -118,6 +118,8 @@ private:
void updateTrayIconShape(); void updateTrayIconShape();
QString trayIconPath() const;
void updateActionHotKeys(); void updateActionHotKeys();
void addHotKey(QAction *action, const char *iniKey); void addHotKey(QAction *action, const char *iniKey);

View File

@ -32,6 +32,7 @@
<file>icons/fort-96.png</file> <file>icons/fort-96.png</file>
<file>icons/fort.png</file> <file>icons/fort.png</file>
<file>icons/fort_gray.png</file> <file>icons/fort_gray.png</file>
<file>icons/fort_orange.png</file>
<file>icons/fort_red.png</file> <file>icons/fort_red.png</file>
<file>icons/github.png</file> <file>icons/github.png</file>
<file>icons/global_telecom.png</file> <file>icons/global_telecom.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB