Qt: Simplify compat line in GameSummaryWidget

This commit is contained in:
TheTechnician27 2024-07-23 12:01:26 -05:00 committed by Ty
parent 225f057a5c
commit dcfd663c19
2 changed files with 11 additions and 51 deletions

View File

@ -35,10 +35,6 @@ GameSummaryWidget::GameSummaryWidget(const GameList::Entry* entry, SettingsWindo
m_ui.region->setItemIcon(i,
QIcon(QStringLiteral("%1/icons/flags/%2.png").arg(base_path).arg(GameList::RegionToString(static_cast<GameList::Region>(i)))));
}
for (int i = 1; i < m_ui.compatibility->count(); i++)
{
m_ui.compatibility->setItemIcon(i, QIcon(QStringLiteral("%1/icons/star-%2.png").arg(base_path).arg(i)));
}
m_entry_path = entry->path;
populateInputProfiles();
@ -76,7 +72,15 @@ void GameSummaryWidget::populateDetails(const GameList::Entry* entry)
m_ui.crc->setText(QString::fromStdString(fmt::format("{:08X}", entry->crc)));
m_ui.type->setCurrentIndex(static_cast<int>(entry->type));
m_ui.region->setCurrentIndex(static_cast<int>(entry->region));
m_ui.compatibility->setCurrentIndex(static_cast<int>(entry->compatibility_rating));
m_ui.compatibility->setText(QString("%0%1")
.arg(GameList::EntryCompatibilityRatingToString(entry->compatibility_rating))
.arg([entry]() {
if (entry->compatibility_rating == GameList::CompatibilityRating::Unknown)
return QString();
const qsizetype compatibility_value = static_cast<qsizetype>(entry->compatibility_rating);
return QString(" ") + QString("").repeated(compatibility_value - 1) + QString("").repeated(6 - compatibility_value);
}()));
int row = 0;
m_ui.detailsFormLayout->getWidgetPosition(m_ui.titleSort, &row, nullptr);

View File

@ -377,54 +377,10 @@
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="compatibility">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<widget class="QLineEdit" name="compatibility">
<property name="readOnly">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Unknown</string>
</property>
</item>
<item>
<property name="text">
<string>Not Bootable</string>
</property>
</item>
<item>
<property name="text">
<string>Reaches Intro</string>
</property>
</item>
<item>
<property name="text">
<string>Reaches Menu</string>
</property>
</item>
<item>
<property name="text">
<string>In-Game</string>
</property>
</item>
<item>
<property name="text">
<string>Playable</string>
</property>
</item>
<item>
<property name="text">
<string>Perfect</string>
</property>
</item>
</widget>
</item>
<item row="9" column="0">