Launcher: fix appearance of disabled add-ons.
Spotted by Michael Danilov
This commit is contained in:
parent
38f44e0928
commit
e0df583c14
2 changed files with 12 additions and 4 deletions
|
@ -208,18 +208,24 @@ QHash<int, QByteArray> AddonsModel::roleNames() const
|
||||||
return m_roleToName;
|
return m_roleToName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddonsModel::enable(int index, bool enable)
|
void AddonsModel::enable(int row, bool enable)
|
||||||
{
|
{
|
||||||
if ((index < 0) || (index >= m_addonsList.size())) {
|
if ((row < 0) || (row >= m_addonsList.size())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto path = m_addonsList[index];
|
auto path = m_addonsList[row];
|
||||||
if (!m_addonsMap.contains(path))
|
if (!m_addonsMap.contains(path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_addonsMap[path].enable = enable && checkVersion(path);
|
const bool wasEnabled = m_addonsMap[path].enable;
|
||||||
|
const bool nowEnabled = enable && checkVersion(path);
|
||||||
|
if (wasEnabled == nowEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_addonsMap[path].enable = nowEnabled;
|
||||||
|
const auto mindex = index(row, 0);
|
||||||
|
emit dataChanged(mindex, mindex, {EnableRole});
|
||||||
emit modulesChanged();
|
emit modulesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ Item {
|
||||||
anchors.rightMargin: Style.margin
|
anchors.rightMargin: Style.margin
|
||||||
height: contentRect.height
|
height: contentRect.height
|
||||||
|
|
||||||
|
font.strikeout: !model.enable
|
||||||
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue