game_list_frame: add scrollAfter option to Refresh for Talkashie

This commit is contained in:
Megamouse 2017-08-12 11:10:02 +02:00 committed by Ivan
parent 6136abd0f8
commit 4c42043940
2 changed files with 14 additions and 6 deletions

View File

@ -352,7 +352,7 @@ void game_list_frame::SortGameList()
gameList->resizeColumnToContents(0);
}
void game_list_frame::Refresh(bool fromDrive)
void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
{
if (fromDrive)
{
@ -471,7 +471,11 @@ void game_list_frame::Refresh(bool fromDrive)
int row = PopulateGameList();
gameList->selectRow(row);
SortGameList();
gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter);
if (scrollAfter)
{
gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter);
}
}
else
{
@ -489,7 +493,11 @@ void game_list_frame::Refresh(bool fromDrive)
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
m_Central_Widget->addWidget(m_xgrid);
m_Central_Widget->setCurrentWidget(m_xgrid);
m_xgrid->scrollTo(m_xgrid->currentIndex());
if (scrollAfter)
{
m_xgrid->scrollTo(m_xgrid->currentIndex());
}
}
}
@ -623,7 +631,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
});
connect(configure, &QAction::triggered, [=]() {
settings_dialog (xgui_settings, m_Render_Creator, 0, this, &currGame).exec();
Refresh(true);
Refresh(true, false);
});
connect(removeGame, &QAction::triggered, [=]()
{
@ -634,7 +642,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
Refresh();
}
});
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); Refresh(true); });
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); Refresh(true, false); });
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); });
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); });
connect(checkCompat, &QAction::triggered, [=]() {

View File

@ -185,7 +185,7 @@ public:
~game_list_frame();
/** Refresh the gamelist with/without loading game data from files. Public so that main frame can refresh after vfs or install */
void Refresh(const bool fromDrive = false);
void Refresh(const bool fromDrive = false, const bool scrollAfter = true);
/** Adds/removes categories that should be shown on gamelist. Public so that main frame menu actions can apply them */
void ToggleCategoryFilter(const QStringList& categories, bool show);