1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Qt: improve gamelist refresh, fix some more scroll issues

despite earlier efforts with modelindex and so on the annoying scroll jump still surfaced sometimes, so we only scrollTo index on selected occasions from now on.
Furthermore we don't need to refresh the gamelist if no custom config has been applied, so this will only be needed on accept from now on
This commit is contained in:
Megamouse 2017-09-10 23:31:51 +02:00 committed by Ivan
parent fac8a520f0
commit 553f67d7e3

View File

@ -24,6 +24,7 @@
#include <QUrl>
#include <QLabel>
#include <QMimeData>
#include <QScrollBar>
static const std::string m_class_name = "GameViewer";
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
@ -473,6 +474,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
if (m_isListLayout)
{
int scroll_position = m_gameList->verticalScrollBar()->value();
FilterData();
int row = PopulateGameList();
m_gameList->selectRow(row);
@ -482,6 +484,10 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
{
m_gameList->scrollTo(m_gameList->currentIndex(), QAbstractItemView::PositionAtCenter);
}
else
{
m_gameList->verticalScrollBar()->setValue(std::min(m_gameList->verticalScrollBar()->maximum(), scroll_position));
}
}
else
{
@ -494,6 +500,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
m_games_per_row = 0;
}
int scroll_position = m_xgrid->verticalScrollBar()->value();
PopulateGameGrid(m_games_per_row, m_Icon_Size, m_Icon_Color);
connect(m_xgrid, &QTableWidget::doubleClicked, this, &game_list_frame::doubleClickedSlot);
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
@ -504,6 +511,10 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
{
m_xgrid->scrollTo(m_xgrid->currentIndex());
}
else
{
m_xgrid->verticalScrollBar()->setValue(std::min(m_xgrid->verticalScrollBar()->maximum(), scroll_position));
}
}
}
@ -649,9 +660,13 @@ 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();
settings_dialog dlg(xgui_settings, m_Render_Creator, 0, this, &currGame);
connect(&dlg, &QDialog::accepted, [this]
{
Refresh(true, false);
});
dlg.exec();
});
connect(removeGame, &QAction::triggered, [=]
{
if (QMessageBox::question(this, tr("Confirm Delete"), tr("Permanently delete files?")) == QMessageBox::Yes)
@ -661,11 +676,23 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
Refresh();
}
});
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); Refresh(true, false); });
connect(deleteShadersCache, &QAction::triggered, [=]() { DeleteShadersCache(row); });
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); });
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); });
connect(removeConfig, &QAction::triggered, [=]()
{
RemoveCustomConfiguration(row);
Refresh(true, false);
});
connect(deleteShadersCache, &QAction::triggered, [=]()
{
DeleteShadersCache(row);
});
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, [=]
{
QString link = "https://rpcs3.net/compatibility?g=" + qstr(currGame.serial);