mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:38:16 +00:00
UI: Programs: Group's name reflects its enabled flag
This commit is contained in:
parent
d492592ac4
commit
0fc0537de8
@ -138,7 +138,7 @@ QVariant AppListModel::dataDisplay(const QModelIndex &index) const
|
||||
case 1:
|
||||
return dataDisplayState(appRow);
|
||||
case 2:
|
||||
return conf()->appGroupAt(appRow.groupIndex)->name();
|
||||
return appGroupName(appRow);
|
||||
case 3:
|
||||
return appRow.appPath;
|
||||
case 4:
|
||||
@ -210,6 +210,25 @@ QVariant AppListModel::dataTextAlignment(const QModelIndex &index) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant AppListModel::appGroupName(const AppRow &appRow) const
|
||||
{
|
||||
const AppGroup *appGroup = conf()->appGroupAt(appRow.groupIndex);
|
||||
|
||||
return appGroup->name();
|
||||
}
|
||||
|
||||
QVariant AppListModel::appGroupColor(const AppRow &appRow) const
|
||||
{
|
||||
if (!appRow.useGroupPerm)
|
||||
return inactiveColor;
|
||||
|
||||
const AppGroup *appGroup = conf()->appGroupAt(appRow.groupIndex);
|
||||
if (!appGroup->enabled())
|
||||
return blockColor;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QString AppListModel::appStateText(const AppRow &appRow)
|
||||
{
|
||||
if (appRow.blocked)
|
||||
@ -218,14 +237,6 @@ QString AppListModel::appStateText(const AppRow &appRow)
|
||||
return tr("Allow");
|
||||
}
|
||||
|
||||
QVariant AppListModel::appGroupColor(const AppRow &appRow)
|
||||
{
|
||||
if (!appRow.useGroupPerm)
|
||||
return inactiveColor;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QColor AppListModel::appStateColor(const AppRow &appRow)
|
||||
{
|
||||
if (appRow.blocked)
|
||||
|
@ -57,11 +57,11 @@ private:
|
||||
QVariant dataForeground(const QModelIndex &index) const;
|
||||
QVariant dataTextAlignment(const QModelIndex &index) const;
|
||||
|
||||
QVariant appGroupName(const AppRow &appRow) const;
|
||||
QVariant appGroupColor(const AppRow &appRow) const;
|
||||
|
||||
static QString appStateText(const AppRow &appRow);
|
||||
|
||||
static QVariant appGroupColor(const AppRow &appRow);
|
||||
static QColor appStateColor(const AppRow &appRow);
|
||||
|
||||
static QIcon appStateIcon(const AppRow &appRow);
|
||||
|
||||
bool updateAppRow(const QString &sql, const QVariantList &vars, AppRow &appRow) const;
|
||||
|
Loading…
Reference in New Issue
Block a user