1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Add separate on/off icons for submods with disabled parent mod

This commit is contained in:
Ivan Savenko 2024-10-16 19:39:35 +00:00
parent 9742f3a110
commit 1120f16d33
4 changed files with 30 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -16,8 +16,10 @@ namespace ModStatus
{
static const QString iconDelete = ":/icons/mod-delete.png";
static const QString iconDisabled = ":/icons/mod-disabled.png";
static const QString iconDisabledSubmod = ":/icons/submod-disabled.png";
static const QString iconDownload = ":/icons/mod-download.png";
static const QString iconEnabled = ":/icons/mod-enabled.png";
static const QString iconEnabledSubmod = ":/icons/submod-enabled.png";
static const QString iconUpdate = ":/icons/mod-update.png";
}
@ -104,15 +106,33 @@ QVariant CModListModel::getText(const CModEntry & mod, int field) const
QVariant CModListModel::getIcon(const CModEntry & mod, int field) const
{
if(field == ModFields::STATUS_ENABLED && mod.isEnabled())
return QIcon(ModStatus::iconEnabled);
if(field == ModFields::STATUS_ENABLED && mod.isDisabled())
return QIcon(ModStatus::iconDisabled);
if (field == ModFields::STATUS_ENABLED)
{
if(mod.isSubmod())
{
QString toplevelParent = mod.getName().section('.', 0, 0);
if (getMod(toplevelParent).isDisabled())
{
if (mod.isEnabled())
return QIcon(ModStatus::iconEnabledSubmod);
if(mod.isDisabled())
return QIcon(ModStatus::iconDisabledSubmod);
}
}
if(field == ModFields::STATUS_UPDATE && mod.isUpdateable())
return QIcon(ModStatus::iconUpdate);
if(field == ModFields::STATUS_UPDATE && !mod.isInstalled())
return QIcon(ModStatus::iconDownload);
if (mod.isEnabled())
return QIcon(ModStatus::iconEnabled);
if(mod.isDisabled())
return QIcon(ModStatus::iconDisabled);
}
if(field == ModFields::STATUS_UPDATE)
{
if (mod.isUpdateable())
return QIcon(ModStatus::iconUpdate);
if(!mod.isInstalled())
return QIcon(ModStatus::iconDownload);
}
return QVariant();
}

View File

@ -7,8 +7,10 @@
<file>icons/menu-settings.png</file>
<file>icons/mod-delete.png</file>
<file>icons/mod-disabled.png</file>
<file>icons/submod-disabled.png</file>
<file>icons/mod-download.png</file>
<file>icons/mod-enabled.png</file>
<file>icons/submod-enabled.png</file>
<file>icons/mod-update.png</file>
</qresource>
</RCC>