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, m_ui.region->setItemIcon(i,
QIcon(QStringLiteral("%1/icons/flags/%2.png").arg(base_path).arg(GameList::RegionToString(static_cast<GameList::Region>(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; m_entry_path = entry->path;
populateInputProfiles(); 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.crc->setText(QString::fromStdString(fmt::format("{:08X}", entry->crc)));
m_ui.type->setCurrentIndex(static_cast<int>(entry->type)); m_ui.type->setCurrentIndex(static_cast<int>(entry->type));
m_ui.region->setCurrentIndex(static_cast<int>(entry->region)); 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; int row = 0;
m_ui.detailsFormLayout->getWidgetPosition(m_ui.titleSort, &row, nullptr); m_ui.detailsFormLayout->getWidgetPosition(m_ui.titleSort, &row, nullptr);

View File

@ -377,54 +377,10 @@
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QComboBox" name="compatibility"> <widget class="QLineEdit" name="compatibility">
<property name="enabled"> <property name="readOnly">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool> <bool>true</bool>
</property> </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> </widget>
</item> </item>
<item row="9" column="0"> <item row="9" column="0">