Qt: Check if movie item changed and is valid before calling the callbacks
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, arch -X86_64 .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run

This commit is contained in:
Megamouse 2025-09-07 11:49:14 +02:00
parent 25925f2680
commit 1a7d702e4e
8 changed files with 17 additions and 17 deletions

View File

@ -8,9 +8,9 @@
game_list::game_list() : QTableWidget(), game_list_base()
{
m_icon_ready_callback = [this](const movie_item_base* item)
m_icon_ready_callback = [this](const game_info& game, const movie_item_base* item)
{
Q_EMIT IconReady(item);
Q_EMIT IconReady(game, item);
};
}

View File

@ -36,7 +36,7 @@ public Q_SLOTS:
Q_SIGNALS:
void FocusToSearchBar();
void IconReady(const movie_item_base* item);
void IconReady(const game_info& game, const movie_item_base* item);
protected:
movie_item* m_last_hover_item = nullptr;

View File

@ -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->item);
m_icon_ready_callback(game, game->item);
}
}

View File

@ -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 movie_item_base*)> m_icon_ready_callback{};
std::function<void(const game_info&, const movie_item_base*)> m_icon_ready_callback{};
bool m_draw_compat_status_to_grid{};
bool m_is_list_layout{};
QSize m_icon_size{};

View File

@ -14,14 +14,14 @@ game_list_grid::game_list_grid()
setObjectName("game_list_grid");
setContextMenuPolicy(Qt::CustomContextMenu);
m_icon_ready_callback = [this](const movie_item_base* item)
m_icon_ready_callback = [this](const game_info& game, const movie_item_base* item)
{
Q_EMIT IconReady(item);
Q_EMIT IconReady(game, item);
};
connect(this, &game_list_grid::IconReady, this, [this](const movie_item_base* item)
connect(this, &game_list_grid::IconReady, this, [this](const game_info& game, const movie_item_base* item)
{
if (item) item->image_change_callback();
if (game && item && game->item == item) item->image_change_callback();
}, Qt::QueuedConnection); // The default 'AutoConnection' doesn't seem to work in this specific case...
connect(this, &flow_widget::ItemSelectionChanged, this, [this](int index)

View File

@ -33,5 +33,5 @@ Q_SIGNALS:
void FocusToSearchBar();
void ItemDoubleClicked(const game_info& game);
void ItemSelectionChanged(const game_info& game);
void IconReady(const movie_item_base* item);
void IconReady(const game_info& game, const movie_item_base* item);
};

View File

@ -41,10 +41,10 @@ game_list_table::game_list_table(game_list_frame* frame, std::shared_ptr<persist
setColumnCount(static_cast<int>(gui::game_list_columns::count));
setMouseTracking(true);
connect(this, &game_list_table::size_on_disk_ready, this, [this](const game_info& game)
connect(this, &game_list_table::size_on_disk_ready, this, [this](const game_info& game, movie_item_base* item)
{
if (!game || !game->item) return;
if (QTableWidgetItem* size_item = item(static_cast<movie_item*>(game->item)->row(), static_cast<int>(gui::game_list_columns::dir_size)))
if (!game || !game->item || game->item != item) return;
if (QTableWidgetItem* size_item = this->item(static_cast<movie_item*>(game->item)->row(), static_cast<int>(gui::game_list_columns::dir_size)))
{
const u64& game_size = game->info.size_on_disk;
size_item->setText(game_size != umax ? gui::utils::format_byte_size(game_size) : tr("Unknown"));
@ -52,9 +52,9 @@ game_list_table::game_list_table(game_list_frame* frame, std::shared_ptr<persist
}
});
connect(this, &game_list::IconReady, this, [this](const movie_item_base* item)
connect(this, &game_list::IconReady, this, [this](const game_info& game, const movie_item_base* item)
{
if (item) item->image_change_callback();
if (game && item && game->item == item) item->image_change_callback();
});
}
@ -284,7 +284,7 @@ void game_list_table::populate(
if (!cancel || !cancel->load())
{
Q_EMIT size_on_disk_ready(game);
Q_EMIT size_on_disk_ready(game, game->item);
return;
}
}

View File

@ -34,7 +34,7 @@ public:
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
Q_SIGNALS:
void size_on_disk_ready(const game_info& game);
void size_on_disk_ready(const game_info& game, movie_item_base* item);
private:
game_list_frame* m_game_list_frame{};