2024-03-29 06:51:38 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2024-02-29 23:00:35 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QFutureWatcher>
|
|
|
|
#include <QGraphicsBlurEffect>
|
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QLabel>
|
2024-03-29 06:43:46 +01:00
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QScrollBar>
|
|
|
|
#include <QStyleOptionViewItem>
|
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QTableWidgetItem>
|
2024-02-29 23:00:35 +01:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
2024-03-29 06:43:46 +01:00
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
#include "game_info.h"
|
2024-02-29 23:00:35 +01:00
|
|
|
#include "game_list_utils.h"
|
2024-03-29 06:43:46 +01:00
|
|
|
#include "gui_context_menus.h"
|
2024-02-29 23:00:35 +01:00
|
|
|
|
2024-03-29 06:43:46 +01:00
|
|
|
class GameListFrame : public QTableWidget {
|
2024-02-29 23:00:35 +01:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2024-06-11 04:42:21 +02:00
|
|
|
explicit GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent = nullptr);
|
2024-03-29 06:43:46 +01:00
|
|
|
Q_SIGNALS:
|
|
|
|
void GameListFrameClosed();
|
2024-02-29 23:00:35 +01:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void SetListBackgroundImage(QTableWidgetItem* item);
|
|
|
|
void RefreshListBackgroundImage();
|
2024-03-29 06:43:46 +01:00
|
|
|
void SortNameAscending(int columnIndex);
|
|
|
|
void SortNameDescending(int columnIndex);
|
2024-02-29 23:00:35 +01:00
|
|
|
|
|
|
|
private:
|
2024-06-11 04:42:21 +02:00
|
|
|
void SetTableItem(int row, int column, QString itemStr);
|
|
|
|
void SetRegionFlag(int row, int column, QString itemStr);
|
2024-02-29 23:00:35 +01:00
|
|
|
QList<QAction*> m_columnActs;
|
2024-03-29 06:43:46 +01:00
|
|
|
GameInfoClass* game_inf_get = nullptr;
|
|
|
|
bool ListSortedAsc = true;
|
2024-02-29 23:00:35 +01:00
|
|
|
|
2024-03-29 06:43:46 +01:00
|
|
|
public:
|
|
|
|
void PopulateGameList();
|
|
|
|
void ResizeIcons(int iconSize);
|
2024-02-29 23:00:35 +01:00
|
|
|
|
|
|
|
QImage backgroundImage;
|
2024-03-29 06:43:46 +01:00
|
|
|
GameListUtils m_game_list_utils;
|
|
|
|
GuiContextMenus m_gui_context_menus;
|
|
|
|
std::shared_ptr<GameInfoClass> m_game_info;
|
2024-02-29 23:00:35 +01:00
|
|
|
|
2024-03-29 06:43:46 +01:00
|
|
|
int icon_size;
|
|
|
|
|
|
|
|
static bool CompareStringsAscending(GameInfo a, GameInfo b, int columnIndex) {
|
|
|
|
if (columnIndex == 1) {
|
|
|
|
return a.name < b.name;
|
|
|
|
} else if (columnIndex == 2) {
|
|
|
|
return a.serial < b.serial;
|
|
|
|
} else if (columnIndex == 3) {
|
|
|
|
return a.fw < b.fw;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool CompareStringsDescending(GameInfo a, GameInfo b, int columnIndex) {
|
|
|
|
if (columnIndex == 1) {
|
|
|
|
return a.name > b.name;
|
|
|
|
} else if (columnIndex == 2) {
|
|
|
|
return a.serial > b.serial;
|
|
|
|
} else if (columnIndex == 3) {
|
|
|
|
return a.fw > b.fw;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|