mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
Qt: repaint all related icons for custom configs
This commit is contained in:
parent
7af2ebb6f4
commit
02ca8f0002
2 changed files with 26 additions and 31 deletions
|
@ -730,7 +730,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
|
||||||
games_per_row = width() / (m_Icon_Size.width() + m_Icon_Size.width() * m_xgrid->getMarginFactor() * 2);
|
games_per_row = width() / (m_Icon_Size.width() + m_Icon_Size.width() * m_xgrid->getMarginFactor() * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int scroll_position = m_xgrid->verticalScrollBar()->value();
|
const int scroll_position = m_xgrid->verticalScrollBar()->value();
|
||||||
PopulateGameGrid(games_per_row, m_Icon_Size, m_Icon_Color);
|
PopulateGameGrid(games_per_row, m_Icon_Size, m_Icon_Color);
|
||||||
connect(m_xgrid, &QTableWidget::itemDoubleClicked, this, &game_list_frame::doubleClickedSlot);
|
connect(m_xgrid, &QTableWidget::itemDoubleClicked, this, &game_list_frame::doubleClickedSlot);
|
||||||
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
|
||||||
|
@ -888,7 +888,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (RemoveCustomConfiguration(currGame.serial, gameinfo, true))
|
if (RemoveCustomConfiguration(currGame.serial, gameinfo, true))
|
||||||
{
|
{
|
||||||
ShowCustomConfigIcon(item);
|
ShowCustomConfigIcon(gameinfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -899,7 +899,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (RemoveCustomPadConfiguration(currGame.serial, gameinfo, true))
|
if (RemoveCustomPadConfiguration(currGame.serial, gameinfo, true))
|
||||||
{
|
{
|
||||||
ShowCustomConfigIcon(item);
|
ShowCustomConfigIcon(gameinfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -981,7 +981,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
if (!gameinfo->hasCustomConfig)
|
if (!gameinfo->hasCustomConfig)
|
||||||
{
|
{
|
||||||
gameinfo->hasCustomConfig = true;
|
gameinfo->hasCustomConfig = true;
|
||||||
ShowCustomConfigIcon(item);
|
ShowCustomConfigIcon(gameinfo);
|
||||||
}
|
}
|
||||||
Q_EMIT NotifyEmuSettingsChange();
|
Q_EMIT NotifyEmuSettingsChange();
|
||||||
}
|
}
|
||||||
|
@ -1004,7 +1004,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
if (dlg.exec() == QDialog::Accepted && !gameinfo->hasCustomPadConfig)
|
if (dlg.exec() == QDialog::Accepted && !gameinfo->hasCustomPadConfig)
|
||||||
{
|
{
|
||||||
gameinfo->hasCustomPadConfig = true;
|
gameinfo->hasCustomPadConfig = true;
|
||||||
ShowCustomConfigIcon(item);
|
ShowCustomConfigIcon(gameinfo);
|
||||||
}
|
}
|
||||||
if (!Emu.IsStopped())
|
if (!Emu.IsStopped())
|
||||||
{
|
{
|
||||||
|
@ -1671,32 +1671,27 @@ QPixmap game_list_frame::PaintedPixmap(const QPixmap& icon, bool paint_config_ic
|
||||||
return canvas.scaled(m_Icon_Size * device_pixel_ratio, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
return canvas.scaled(m_Icon_Size * device_pixel_ratio, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_list_frame::ShowCustomConfigIcon(QTableWidgetItem* item)
|
void game_list_frame::ShowCustomConfigIcon(game_info game)
|
||||||
{
|
{
|
||||||
auto game = GetGameInfoFromItem(item);
|
if (!game)
|
||||||
if (game == nullptr)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_isListLayout)
|
const std::string serial = game->info.serial;
|
||||||
{
|
const bool hasCustomConfig = game->hasCustomConfig;
|
||||||
const QString title = m_titles.value(qstr(game->info.serial), qstr(game->info.name));
|
const bool hasCustomPadConfig = game->hasCustomPadConfig;
|
||||||
const QColor color = getGridCompatibilityColor(game->compat.color);
|
|
||||||
|
|
||||||
game->pxmap = PaintedPixmap(game->icon, game->hasCustomConfig, game->hasCustomPadConfig, color);
|
for (auto other_game : m_game_data)
|
||||||
int r = m_xgrid->currentItem()->row(), c = m_xgrid->currentItem()->column();
|
{
|
||||||
m_xgrid->addItem(game->pxmap, title.simplified(), r, c);
|
if (other_game->info.serial == serial)
|
||||||
m_xgrid->item(r, c)->setData(gui::game_role, QVariant::fromValue(game));
|
{
|
||||||
|
other_game->hasCustomConfig = hasCustomConfig;
|
||||||
|
other_game->hasCustomPadConfig = hasCustomPadConfig;
|
||||||
}
|
}
|
||||||
else if (game->hasCustomConfig && game->hasCustomPadConfig)
|
}
|
||||||
m_gameList->item(item->row(), gui::column_name)->setIcon(QIcon(":/Icons/combo_config_bordered.png"));
|
|
||||||
else if (game->hasCustomConfig)
|
RepaintIcons();
|
||||||
m_gameList->item(item->row(), gui::column_name)->setIcon(QIcon(":/Icons/custom_config.png"));
|
|
||||||
else if (game->hasCustomPadConfig)
|
|
||||||
m_gameList->item(item->row(), gui::column_name)->setIcon(QIcon(":/Icons/controllers.png"));
|
|
||||||
else
|
|
||||||
m_gameList->item(item->row(), gui::column_name)->setIcon(QIcon());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_list_frame::ResizeIcons(const int& sliderPos)
|
void game_list_frame::ResizeIcons(const int& sliderPos)
|
||||||
|
@ -1728,7 +1723,7 @@ void game_list_frame::RepaintIcons(const bool& fromSettings)
|
||||||
QtConcurrent::blockingMap(indices, [this](int& i)
|
QtConcurrent::blockingMap(indices, [this](int& i)
|
||||||
{
|
{
|
||||||
auto game = m_game_data[i];
|
auto game = m_game_data[i];
|
||||||
QColor color = getGridCompatibilityColor(game->compat.color);
|
const QColor color = getGridCompatibilityColor(game->compat.color);
|
||||||
game->pxmap = PaintedPixmap(game->icon, game->hasCustomConfig, game->hasCustomPadConfig, color);
|
game->pxmap = PaintedPixmap(game->icon, game->hasCustomConfig, game->hasCustomPadConfig, color);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1976,11 +1971,11 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
int r = 0;
|
int r = 0;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
std::string selected_item = CurrentSelectionIconPath();
|
const std::string selected_item = CurrentSelectionIconPath();
|
||||||
|
|
||||||
m_xgrid->deleteLater();
|
m_xgrid->deleteLater();
|
||||||
|
|
||||||
bool showText = m_icon_size_index > gui::gl_max_slider_pos * 2 / 5;
|
const bool showText = m_icon_size_index > gui::gl_max_slider_pos * 2 / 5;
|
||||||
|
|
||||||
if (m_icon_size_index < gui::gl_max_slider_pos * 2 / 3)
|
if (m_icon_size_index < gui::gl_max_slider_pos * 2 / 3)
|
||||||
{
|
{
|
||||||
|
@ -2002,7 +1997,7 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int entries = matching_apps.count();
|
const int entries = matching_apps.count();
|
||||||
|
|
||||||
// Edge cases!
|
// Edge cases!
|
||||||
if (entries == 0)
|
if (entries == 0)
|
||||||
|
@ -2012,8 +2007,8 @@ void game_list_frame::PopulateGameGrid(int maxCols, const QSize& image_size, con
|
||||||
|
|
||||||
maxCols = std::clamp(maxCols, 1, entries);
|
maxCols = std::clamp(maxCols, 1, entries);
|
||||||
|
|
||||||
int needsExtraRow = (entries % maxCols) != 0;
|
const int needsExtraRow = (entries % maxCols) != 0;
|
||||||
int maxRows = needsExtraRow + entries / maxCols;
|
const int maxRows = needsExtraRow + entries / maxCols;
|
||||||
m_xgrid->setRowCount(maxRows);
|
m_xgrid->setRowCount(maxRows);
|
||||||
m_xgrid->setColumnCount(maxCols);
|
m_xgrid->setColumnCount(maxCols);
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
QPixmap PaintedPixmap(const QPixmap& icon, bool paint_config_icon = false, bool paint_pad_config_icon = false, const QColor& color = QColor());
|
QPixmap PaintedPixmap(const QPixmap& icon, bool paint_config_icon = false, bool paint_pad_config_icon = false, const QColor& color = QColor());
|
||||||
QColor getGridCompatibilityColor(const QString& string);
|
QColor getGridCompatibilityColor(const QString& string);
|
||||||
void ShowCustomConfigIcon(QTableWidgetItem* item);
|
void ShowCustomConfigIcon(game_info game);
|
||||||
void PopulateGameGrid(int maxCols, const QSize& image_size, const QColor& image_color);
|
void PopulateGameGrid(int maxCols, const QSize& image_size, const QColor& image_color);
|
||||||
bool IsEntryVisible(const game_info& game);
|
bool IsEntryVisible(const game_info& game);
|
||||||
void SortGameList();
|
void SortGameList();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue