Qt: prevent playing movies directly after a refresh

This commit is contained in:
Megamouse 2026-06-16 01:27:35 +02:00
parent 79616a376f
commit 5e745ac661
6 changed files with 34 additions and 4 deletions

View File

@ -35,6 +35,15 @@ game_list::game_list() : QTableWidget(), game_list_base()
});
}
void game_list::stop_movie()
{
if (m_last_hover_item)
{
m_last_hover_item->set_active(false);
m_last_hover_item = nullptr;
}
}
void game_list::sync_header_actions(std::map<int, QAction*>& actions, std::function<bool(int)> get_visibility)
{
ensure(get_visibility);

View File

@ -23,6 +23,8 @@ class game_list : public QTableWidget, public game_list_base
public:
game_list();
void stop_movie();
void sync_header_actions(std::map<int, QAction*>& actions, std::function<bool(int)> get_visibility);
void create_header_actions(std::map<int, QAction*>& actions, std::function<bool(int)> get_visibility, std::function<void(int, bool)> set_visibility);

View File

@ -35,6 +35,17 @@ game_list_grid::game_list_grid()
});
}
void game_list_grid::stop_movie()
{
for (flow_widget_item* flow_item : items())
{
if (game_list_grid_item* item = static_cast<game_list_grid_item*>(flow_item))
{
item->set_active(false);
}
}
}
void game_list_grid::clear_list()
{
clear();
@ -145,6 +156,9 @@ void game_list_grid::populate(
QApplication::processEvents();
select_items(selected_items);
// Prevent playing unwanted movie
stop_movie();
}
void game_list_grid::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)

View File

@ -12,6 +12,8 @@ class game_list_grid : public flow_widget, public game_list_base
public:
explicit game_list_grid();
void stop_movie();
void clear_list() override;
void populate(

View File

@ -424,6 +424,9 @@ void game_list_table::populate(
}
}
Q_EMIT itemSelectionChanged();
// Prevent playing unwanted movie
stop_movie();
}
void game_list_table::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)

View File

@ -3543,10 +3543,10 @@ void main_window::CreateConnects()
connect(ui->downloadIntegrityDbAct, &QAction::triggered, this, [this]()
{
ensure(m_game_list_frame->GetIsoIntegrity())->download();
ensure(m_game_list_frame->GetPsnContentIntegrity())->download();
ensure(m_game_list_frame->GetPsnDlcIntegrity())->download();
ensure(m_game_list_frame->GetPsnUpdateIntegrity())->download();
m_game_list_frame->GetIsoIntegrity()->download();
m_game_list_frame->GetPsnContentIntegrity()->download();
m_game_list_frame->GetPsnDlcIntegrity()->download();
m_game_list_frame->GetPsnUpdateIntegrity()->download();
});
connect(ui->downloadCompatDbAct, &QAction::triggered, this, [this]()