mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
Qt: simplify icon_ready_callback in game list
This commit is contained in:
parent
91427646f5
commit
bd1102d3b7
8 changed files with 13 additions and 15 deletions
|
@ -8,9 +8,9 @@
|
|||
|
||||
game_list::game_list() : QTableWidget(), game_list_base()
|
||||
{
|
||||
m_icon_ready_callback = [this](const game_info& game)
|
||||
m_icon_ready_callback = [this](const movie_item_base* item)
|
||||
{
|
||||
Q_EMIT IconReady(game);
|
||||
Q_EMIT IconReady(item);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public Q_SLOTS:
|
|||
|
||||
Q_SIGNALS:
|
||||
void FocusToSearchBar();
|
||||
void IconReady(const game_info& game);
|
||||
void IconReady(const movie_item_base* item);
|
||||
|
||||
protected:
|
||||
movie_item* m_last_hover_item = nullptr;
|
||||
|
|
|
@ -79,7 +79,7 @@ void game_list_base::IconLoadFunction(game_info game, qreal device_pixel_ratio,
|
|||
if (!cancel || !cancel->load())
|
||||
{
|
||||
if (m_icon_ready_callback)
|
||||
m_icon_ready_callback(game);
|
||||
m_icon_ready_callback(game->item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
|||
QPixmap PaintedPixmap(const QPixmap& icon, qreal device_pixel_ratio, bool paint_config_icon = false, bool paint_pad_config_icon = false, const QColor& compatibility_color = {}) const;
|
||||
QColor GetGridCompatibilityColor(const QString& string) const;
|
||||
|
||||
std::function<void(const game_info&)> m_icon_ready_callback{};
|
||||
std::function<void(const movie_item_base*)> m_icon_ready_callback{};
|
||||
bool m_draw_compat_status_to_grid{};
|
||||
bool m_is_list_layout{};
|
||||
QSize m_icon_size{};
|
||||
|
|
|
@ -14,15 +14,14 @@ game_list_grid::game_list_grid()
|
|||
setObjectName("game_list_grid");
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
m_icon_ready_callback = [this](const game_info& game)
|
||||
m_icon_ready_callback = [this](const movie_item_base* item)
|
||||
{
|
||||
Q_EMIT IconReady(game);
|
||||
Q_EMIT IconReady(item);
|
||||
};
|
||||
|
||||
connect(this, &game_list_grid::IconReady, this, [this](const game_info& game)
|
||||
connect(this, &game_list_grid::IconReady, this, [this](const movie_item_base* item)
|
||||
{
|
||||
if (!game || !game->item) return;
|
||||
game->item->call_icon_func();
|
||||
if (item) item->call_icon_func();
|
||||
}, Qt::QueuedConnection); // The default 'AutoConnection' doesn't seem to work in this specific case...
|
||||
|
||||
connect(this, &flow_widget::ItemSelectionChanged, this, [this](int index)
|
||||
|
|
|
@ -33,5 +33,5 @@ Q_SIGNALS:
|
|||
void FocusToSearchBar();
|
||||
void ItemDoubleClicked(const game_info& game);
|
||||
void ItemSelectionChanged(const game_info& game);
|
||||
void IconReady(const game_info& game);
|
||||
void IconReady(const movie_item_base* item);
|
||||
};
|
||||
|
|
|
@ -52,10 +52,9 @@ game_list_table::game_list_table(game_list_frame* frame, std::shared_ptr<persist
|
|||
}
|
||||
});
|
||||
|
||||
connect(this, &game_list::IconReady, this, [this](const game_info& game)
|
||||
connect(this, &game_list::IconReady, this, [this](const movie_item_base* item)
|
||||
{
|
||||
if (!game || !game->item) return;
|
||||
game->item->call_icon_func();
|
||||
if (item) item->call_icon_func();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "game_list_base.h"
|
||||
#include "gui_game_info.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QComboBox>
|
||||
|
|
Loading…
Add table
Reference in a new issue