diff --git a/src/qt_gui/compatibility_info.cpp b/src/qt_gui/compatibility_info.cpp index e432ec9b2..a9afef5b3 100644 --- a/src/qt_gui/compatibility_info.cpp +++ b/src/qt_gui/compatibility_info.cpp @@ -122,7 +122,7 @@ CompatibilityEntry CompatibilityInfoClass::GetCompatibilityInfo(const std::strin QString title_id = QString::fromStdString(serial); if (m_compatibility_database.contains(title_id)) { { - for (int os_int = 0; os_int != OSType::Last; os_int++) { + for (int os_int = 0; os_int != static_cast(OSType::Last); os_int++) { QString os_string = OSTypeToString.at(static_cast(os_int)); QJsonObject compatibility_obj = m_compatibility_database[title_id].toObject(); if (compatibility_obj.contains(os_string)) { diff --git a/src/qt_gui/compatibility_info.h b/src/qt_gui/compatibility_info.h index c1ba387e7..5a99a10c8 100644 --- a/src/qt_gui/compatibility_info.h +++ b/src/qt_gui/compatibility_info.h @@ -11,7 +11,7 @@ #include "common/config.h" #include "core/file_format/psf.h" -enum CompatibilityStatus { +enum class CompatibilityStatus { Unknown, Nothing, Boots, @@ -21,22 +21,22 @@ enum CompatibilityStatus { }; // Prioritize different compatibility reports based on user's platform -enum OSType { +enum class OSType { #ifdef Q_OS_WIN - Win32OS = 0, - UnknownOS, - LinuxOS, + Win32 = 0, + Unknown, + Linux, macOS, #elif defined(Q_OS_LINUX) - LinuxOS = 0, - UnknownOS, - Win32OS, + Linux = 0, + Unknown, + Win32, macOS, #elif defined(Q_OS_MAC) macOS = 0, - UnknownOS, - LinuxOS, - Win32OS, + Unknown, + Linux, + Win32, #endif // Fake enum to allow for iteration Last @@ -59,9 +59,9 @@ public: {QStringLiteral("status-ingame"), CompatibilityStatus::Ingame}, {QStringLiteral("status-playable"), CompatibilityStatus::Playable}}; inline static const std::unordered_map LabelToOSType = { - {QStringLiteral("os-linux"), OSType::LinuxOS}, + {QStringLiteral("os-linux"), OSType::Linux}, {QStringLiteral("os-macOS"), OSType::macOS}, - {QStringLiteral("os-windows"), OSType::Win32OS}, + {QStringLiteral("os-windows"), OSType::Win32}, }; inline static const std::unordered_map CompatStatusToString = { @@ -72,10 +72,10 @@ public: {CompatibilityStatus::Ingame, QStringLiteral("Ingame")}, {CompatibilityStatus::Playable, QStringLiteral("Playable")}}; inline static const std::unordered_map OSTypeToString = { - {OSType::LinuxOS, QStringLiteral("os-linux")}, + {OSType::Linux, QStringLiteral("os-linux")}, {OSType::macOS, QStringLiteral("os-macOS")}, - {OSType::Win32OS, QStringLiteral("os-windows")}, - {OSType::UnknownOS, QStringLiteral("os-unknown")}}; + {OSType::Win32, QStringLiteral("os-windows")}, + {OSType::Unknown, QStringLiteral("os-unknown")}}; CompatibilityInfoClass(); ~CompatibilityInfoClass(); diff --git a/src/qt_gui/game_list_frame.cpp b/src/qt_gui/game_list_frame.cpp index 968a6faa8..a7f2d362d 100644 --- a/src/qt_gui/game_list_frame.cpp +++ b/src/qt_gui/game_list_frame.cpp @@ -221,36 +221,48 @@ void GameListFrame::SetCompatibilityItem(int row, int column, CompatibilityEntry widget->setStyleSheet("QToolTip {background-color: black; color: white;}"); QColor color; - QString tooltip_string; + QString status_explanation; + switch (entry.status) { - case Unknown: + case CompatibilityStatus::Unknown: color = QStringLiteral("#000000"); - tooltip_string = tr("Compatibility is untested"); + status_explanation = tr("Compatibility is untested"); break; - case Nothing: + case CompatibilityStatus::Nothing: color = QStringLiteral("#212121"); - tooltip_string = tr("Games that do not initialize properly / crash the emulator"); + status_explanation = tr("Games does not initialize properly / crashes the emulator"); break; - case Boots: + case CompatibilityStatus::Boots: color = QStringLiteral("#828282"); - tooltip_string = tr("Games that are able to boot, but only display a blank screen"); + status_explanation = tr("Game boots, but only displays a blank screen"); break; - case Menus: + case CompatibilityStatus::Menus: color = QStringLiteral("#FF0000"); - tooltip_string = tr("Games that displays an image but do not go past the menus"); + status_explanation = tr("Game displays an image but does not go past the menu"); break; - case Ingame: + case CompatibilityStatus::Ingame: color = QStringLiteral("#F2D624"); - tooltip_string = tr("Games that have game-breaking glitches or unplayable performance"); + status_explanation = tr("Game has game-breaking glitches or unplayable performance"); break; - case Playable: + case CompatibilityStatus::Playable: color = QStringLiteral("#47D35C"); - tooltip_string = + status_explanation = tr("Game can be completed with playable performance and no major glitches"); break; } + QString tooltip_string; + + if (entry.status == CompatibilityStatus::Unknown) { + tooltip_string = status_explanation; + } else { + tooltip_string = + tr("Last updated") + + QString(": %1 (%2)\n").arg(entry.last_tested.toString("yyyy-MM-dd"), entry.version) + + status_explanation; + } + QPixmap circle_pixmap(16, 16); circle_pixmap.fill(Qt::transparent); QPainter painter(&circle_pixmap); @@ -264,7 +276,7 @@ void GameListFrame::SetCompatibilityItem(int row, int column, CompatibilityEntry QLabel* label = new QLabel(m_compat_info->CompatStatusToString.at(entry.status), widget); - label->setStyleSheet("color: white; font-size: 12px; font-weight: bold;"); + label->setStyleSheet("color: white; font-size: 16px; font-weight: bold;"); // Create shadow effect QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); @@ -274,13 +286,8 @@ void GameListFrame::SetCompatibilityItem(int row, int column, CompatibilityEntry label->setGraphicsEffect(shadowEffect); // Apply shadow effect to the QLabel - QLabel* version_label = new QLabel( - QString("%1, (%2)").arg(entry.last_tested.toString("yyyy-MM-dd"), entry.version), widget); - version_label->setStyleSheet("color: white; font-size: 10px;"); - layout->addWidget(dotLabel, 0, 0, -1, 1); layout->addWidget(label, 0, 1, 1, 1); - layout->addWidget(version_label, 1, 1, 1, 1); layout->setAlignment(Qt::AlignLeft); widget->setLayout(layout); widget->setToolTip(tooltip_string);