Qt: fix compat list sort (#4003)

This commit is contained in:
Megamouse 2017-12-31 02:43:56 +01:00 committed by Ani
parent 78f7020ce6
commit 90f825aa49
6 changed files with 28 additions and 9 deletions

View file

@ -1286,6 +1286,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DLLVM_AVAILABLE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\.." "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)\." "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
</CustomBuild>
<ClInclude Include="rpcs3qt\custom_table_widget_item.h" />
<ClInclude Include="rpcs3qt\gamepads_settings_dialog.h" />
<CustomBuild Include="rpcs3qt\game_compatibility.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>

View file

@ -661,6 +661,9 @@
<ClInclude Include="evdev_joystick_handler.h">
<Filter>Io\evdev</Filter>
</ClInclude>
<ClInclude Include="rpcs3qt\custom_table_widget_item.h">
<Filter>Gui\game list</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">

View file

@ -0,0 +1,12 @@
#pragma once
#include <QTableWidgetItem>
class custom_table_widget_item : public QTableWidgetItem
{
public:
bool operator <(const QTableWidgetItem &other) const
{
return data(Qt::UserRole) < other.data(Qt::UserRole);
}
};

View file

@ -21,14 +21,14 @@ class game_compatibility : public QObject
const std::map<QString, Compat_Status> Status_Data =
{
{ "Playable", { "", "#2ecc71", QObject::tr("Playable"), QObject::tr("Games that can be properly played from start to finish") } },
{ "Ingame", { "", "#f1c40f", QObject::tr("Ingame"), QObject::tr("Games that go somewhere but not far enough to be considered playable") } },
{ "Intro", { "", "#f39c12", QObject::tr("Intro"), QObject::tr("Games that only display some screens") } },
{ "Loadable", { "", "#e74c3c", QObject::tr("Loadable"), QObject::tr("Games that display a black screen with an active framerate") } },
{ "Nothing", { "", "#2c3e50", QObject::tr("Nothing"), QObject::tr("Games that show nothing") } },
{ "NoResult", { "", "", QObject::tr("No results found"), QObject::tr("There is no entry for this game or application in the compatibility database yet.") } },
{ "NoData", { "", "", QObject::tr("Database missing"), QObject::tr("Right click here and download the current database.\nMake sure you are connected to the internet.") } },
{ "Download", { "", "", QObject::tr("Retrieving..."), QObject::tr("Downloading the compatibility database. Please wait...") } }
{ "Playable", { 0, "", "#2ecc71", QObject::tr("Playable"), QObject::tr("Games that can be properly played from start to finish") } },
{ "Ingame", { 1, "", "#f1c40f", QObject::tr("Ingame"), QObject::tr("Games that either can't be finished, have serious glitches or have insufficient performance") } },
{ "Intro", { 2, "", "#f39c12", QObject::tr("Intro"), QObject::tr("Games that display image but don't make it past the menus") } },
{ "Loadable", { 3, "", "#e74c3c", QObject::tr("Loadable"), QObject::tr("Games that display a black screen with a framerate on the window's title") } },
{ "Nothing", { 4, "", "#2c3e50", QObject::tr("Nothing"), QObject::tr("Games that don't initialize properly, not loading at all and/or crashing the emulator") } },
{ "NoResult", { 5, "", "", QObject::tr("No results found"), QObject::tr("There is no entry for this game or application in the compatibility database yet.") } },
{ "NoData", { 6, "", "", QObject::tr("Database missing"), QObject::tr("Right click here and download the current database.\nMake sure you are connected to the internet.") } },
{ "Download", { 7, "", "", QObject::tr("Retrieving..."), QObject::tr("Downloading the compatibility database. Please wait...") } }
};
int m_timer_count = 0;
QString m_filepath;

View file

@ -2,6 +2,7 @@
#include "settings_dialog.h"
#include "table_item_delegate.h"
#include "custom_table_widget_item.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
@ -1093,9 +1094,10 @@ int game_list_frame::PopulateGameList()
}
// Compatibility
QTableWidgetItem* compat_item = new QTableWidgetItem;
custom_table_widget_item* compat_item = new custom_table_widget_item;
compat_item->setFlags(compat_item->flags() & ~Qt::ItemIsEditable);
compat_item->setText(game.compat.text + (game.compat.date.isEmpty() ? "" : " (" + game.compat.date + ")"));
compat_item->setData(Qt::UserRole, game.compat.index);
compat_item->setToolTip(game.compat.tooltip);
if (!game.compat.color.isEmpty())
{

View file

@ -12,6 +12,7 @@
struct Compat_Status
{
int index;
QString date;
QString color;
QString text;