mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-30 23:33:17 +00:00
Fix and add back Trophy type icons for both the trophy pop-up and viewer (#2522)
* Add back fixed trophy type icons to trophy viewer * Remove unused declaration until it is needed again * Fix trophy pop-up icons * Adjust size and alignment based on trophy name length --------- Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
This commit is contained in:
parent
bc0b42ee53
commit
47ac8b6c03
3 changed files with 72 additions and 18 deletions
|
@ -118,18 +118,19 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
item->setData(Qt::DecorationRole, icon);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
tableWidget->setItem(row, 1, item);
|
||||
|
||||
const std::string filename = GetTrpType(trpType[row].at(0));
|
||||
QTableWidgetItem* typeitem = new QTableWidgetItem();
|
||||
|
||||
QString type;
|
||||
if (trpType[row] == "P") {
|
||||
type = "Platinum";
|
||||
} else if (trpType[row] == "G") {
|
||||
type = "Gold";
|
||||
} else if (trpType[row] == "S") {
|
||||
type = "Silver";
|
||||
} else if (trpType[row] == "B") {
|
||||
type = "Bronze";
|
||||
}
|
||||
auto resource = cmrc::res::get_filesystem();
|
||||
std::string resourceString = "Resources/" + filename;
|
||||
auto file = resource.open(resourceString);
|
||||
std::vector<char> imgdata(file.begin(), file.end());
|
||||
QImage type_icon = QImage::fromData(imgdata).scaled(QSize(64, 64), Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation);
|
||||
typeitem->setData(Qt::DecorationRole, type_icon);
|
||||
typeitem->setFlags(typeitem->flags() & ~Qt::ItemIsEditable);
|
||||
tableWidget->setItem(row, 6, typeitem);
|
||||
|
||||
std::string detailString = trophyDetails[row].toStdString();
|
||||
std::size_t newline_pos = 0;
|
||||
|
@ -144,7 +145,6 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
SetTableItem(tableWidget, row, 3, QString::fromStdString(detailString));
|
||||
SetTableItem(tableWidget, row, 4, trpId[row]);
|
||||
SetTableItem(tableWidget, row, 5, trpHidden[row]);
|
||||
SetTableItem(tableWidget, row, 6, type);
|
||||
SetTableItem(tableWidget, row, 7, trpPid[row]);
|
||||
}
|
||||
tableWidget->verticalHeader()->resizeSection(row, icon.height());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue