polished off feed coloring a bit

This commit is contained in:
Martin Rotter 2025-02-28 12:09:52 +01:00
parent c8c286507e
commit d75aed4af1
2 changed files with 13 additions and 17 deletions

View file

@ -554,7 +554,7 @@ QVariant FeedsModel::data(const QModelIndex& index, int role) const {
case Qt::ItemDataRole::FontRole: {
RootItem* it = itemForIndex(index);
bool is_bold = it->countOfUnreadMessages() > 0;
bool is_striked = it->kind() == RootItem::Kind::Feed ? qobject_cast<Feed*>(it)->isSwitchedOff() : false;
bool is_striked = it->kind() == RootItem::Kind::Feed ? it->toFeed()->isSwitchedOff() : false;
if (is_bold) {
return is_striked ? m_boldStrikedFont : m_boldFont;
@ -564,21 +564,6 @@ QVariant FeedsModel::data(const QModelIndex& index, int role) const {
}
}
case Qt::ItemDataRole::ForegroundRole: {
RootItem* it = itemForIndex(index);
if (it->kind() == RootItem::Kind::Feed && qobject_cast<Feed*>(it)->isSwitchedOff()) {
return qApp->settings()->value(GROUP(CustomSkinColors), SETTING(CustomSkinColors::Enabled)).toBool()
? qApp->skins()->colorForModel(SkinEnums::PaletteColors::FgDisabledFeed)
: QColor("#d1d1d1");
}
}
case Qt::ItemDataRole::ToolTipRole:
if (!qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableTooltipsFeedsMessages)).toBool()) {
return QVariant();
}
case Qt::ItemDataRole::DecorationRole: {
if (index.column() == FDS_MODEL_TITLE_INDEX && m_updateDuringFetching) {
RootItem* it = itemForIndex(index);
@ -589,6 +574,12 @@ QVariant FeedsModel::data(const QModelIndex& index, int role) const {
}
}
case Qt::ItemDataRole::ToolTipRole:
// NOTE: Fall-down to "default" if condition not met.
if (!qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableTooltipsFeedsMessages)).toBool()) {
return QVariant();
}
default:
return itemForIndex(index)->data(index.column(), role);
}

View file

@ -85,7 +85,11 @@ QVariant Feed::data(int column, int role) const {
}
}
case Qt::ItemDataRole::ForegroundRole:
case Qt::ItemDataRole::ForegroundRole: {
if (isSwitchedOff()) {
return qApp->skins()->colorForModel(SkinEnums::PaletteColors::FgDisabledFeed);
}
switch (status()) {
case Status::NewMessages:
return qApp->skins()->colorForModel(SkinEnums::PaletteColors::FgNewMessages);
@ -107,6 +111,7 @@ QVariant Feed::data(int column, int role) const {
default:
return QVariant();
}
}
default:
return RootItem::data(column, role);