refactor(Mods): make provider() return a std::optional
This makes it easier to check if a mod has a provider or not, without having to do a string comparison. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
aa3633d2d7
commit
257970c27d
3 changed files with 18 additions and 10 deletions
|
@ -83,8 +83,15 @@ QVariant ModFolderModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
case DateColumn:
|
||||
return m_resources[row]->dateTimeChanged();
|
||||
case ProviderColumn:
|
||||
return at(row)->provider();
|
||||
case ProviderColumn: {
|
||||
auto provider = at(row)->provider();
|
||||
if (!provider.has_value()) {
|
||||
//: Unknown mod provider (i.e. not Modrinth, CurseForge, etc...)
|
||||
return tr("Unknown");
|
||||
}
|
||||
|
||||
return provider.value();
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue