1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

game_list_frame: add method colorizedIcons

This commit is contained in:
Megamouse 2017-07-12 18:52:52 +02:00 committed by Ivan
parent ced539579e
commit 743a19027a
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <QTimer>
#include <QUrl>
#include <QLabel>
#include <QBitmap>
static const std::string m_class_name = "GameViewer";
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
@ -754,6 +755,15 @@ void game_list_frame::ResizeIcons(const QString& sizeStr, const QSize& size, con
Refresh();
}
QIcon game_list_frame::colorizedIcon(const QIcon& icon, const QColor& oldColor, const QColor& newColor)
{
QPixmap pixmap = icon.pixmap(icon.availableSizes().at(0));
QBitmap mask = pixmap.createMaskFromColor(oldColor, Qt::MaskOutColor);
pixmap.fill(newColor);
pixmap.setMask(mask);
return QIcon(pixmap);
}
void game_list_frame::SetListMode(const bool& isList)
{
m_oldLayoutIsList = m_isListLayout;

View File

@ -189,6 +189,8 @@ public:
/** Resize Gamelist Icons to size */
void ResizeIcons(const QString& sizeStr, const QSize& size, const int& index);
static QIcon colorizedIcon(const QIcon& icon, const QColor& oldColor, const QColor& newColor);
public Q_SLOTS:
void SetListMode(const bool& isList);
void SetToolBarVisible(const bool& showToolBar);