From 9b0403473d58a9d71268b17946effa8812696a3d Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Thu, 12 Jan 2023 16:26:50 +0300 Subject: [PATCH] UI: Programs: Rework State column for alerts --- src/ui/model/applistmodel.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ui/model/applistmodel.cpp b/src/ui/model/applistmodel.cpp index 66be7167..8d371e09 100644 --- a/src/ui/model/applistmodel.cpp +++ b/src/ui/model/applistmodel.cpp @@ -209,8 +209,6 @@ QVariant AppListModel::dataTextAlignment(const QModelIndex &index) const QString AppListModel::appStateText(const AppRow &appRow) { - if (appRow.alerted) - return tr("Alert"); if (appRow.blocked) return tr("Block"); return tr("Allow"); @@ -225,8 +223,6 @@ QVariant AppListModel::appGroupColor(const AppRow &appRow) QColor AppListModel::appStateColor(const AppRow &appRow) { - if (appRow.alerted) - return alertColor; if (appRow.blocked) return blockColor; return allowColor; @@ -234,9 +230,12 @@ QColor AppListModel::appStateColor(const AppRow &appRow) QIcon AppListModel::appStateIcon(const AppRow &appRow) { - return IconCache::icon(appRow.blocked - ? ":/icons/deny.png" - : (appRow.endTime.isNull() ? ":/icons/accept.png" : ":/icons/time.png")); + const QString iconPath = appRow.blocked + ? ":/icons/deny.png" + : (appRow.endTime.isNull() ? ":/icons/accept.png" : ":/icons/time.png"); + + return appRow.alerted ? GuiUtil::overlayIcon(iconPath, ":/icons/error.png") + : IconCache::icon(iconPath); } bool AppListModel::updateAppRow(const QString &sql, const QVariantList &vars, AppRow &appRow) const