mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-01 03:32:07 +00:00
Qt: support thumbnail icons in stylesheets
This commit is contained in:
parent
77a75305c7
commit
a358384900
@ -33,7 +33,6 @@
|
||||
|
||||
#include "pad_thread.h"
|
||||
|
||||
|
||||
#include "Emu/RSX/Null/NullGSRender.h"
|
||||
#include "Emu/RSX/GL/GLGSRender.h"
|
||||
#include "Emu/Audio/Null/NullAudioThread.h"
|
||||
@ -292,6 +291,12 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
||||
"QLabel#toolbar_icon_color { color: rgba(%1, %2, %3, %4); }")
|
||||
.arg(tic.red()).arg(tic.green()).arg(tic.blue()).arg(tic.alpha());
|
||||
|
||||
// thumbnail icon color stylesheet
|
||||
QColor thic = GUI::mw_thumb_icon_color;
|
||||
QString style_thumbnail_icons = QString(
|
||||
"QLabel#thumbnail_icon_color { color: rgba(%1, %2, %3, %4); }")
|
||||
.arg(thic.red()).arg(thic.green()).arg(thic.blue()).arg(thic.alpha());
|
||||
|
||||
// gamelist toolbar stylesheet
|
||||
QColor gltic = GUI::gl_tool_icon_color;
|
||||
QString style_gamelist_toolbar = QString(
|
||||
@ -311,7 +316,7 @@ void rpcs3_app::OnChangeStyleSheetRequest(const QString& sheetFilePath)
|
||||
"QLabel#l_controller { color: #434343; }"
|
||||
"QLabel#gamegrid_font { font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); }");
|
||||
|
||||
setStyleSheet(style_toolbar + style_toolbar_icons + style_gamelist_toolbar + style_gamelist_icons + style_rest);
|
||||
setStyleSheet(style_toolbar + style_toolbar_icons + style_thumbnail_icons + style_gamelist_toolbar + style_gamelist_icons + style_rest);
|
||||
}
|
||||
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
|
@ -84,10 +84,11 @@ namespace GUI
|
||||
const QString fs = "FileSystem";
|
||||
const QString gs_frame = "GSFrame";
|
||||
|
||||
const QColor mw_tool_bar_color = QColor(227, 227, 227, 255);
|
||||
const QColor mw_tool_icon_color = QColor(64, 64, 64, 255);
|
||||
const QColor gl_icon_color = QColor(209, 209, 209, 255);
|
||||
const QColor gl_tool_icon_color = QColor(0, 100, 231, 255);
|
||||
const QColor mw_tool_bar_color = QColor(227, 227, 227, 255);
|
||||
const QColor mw_tool_icon_color = QColor(64, 64, 64, 255);
|
||||
const QColor mw_thumb_icon_color = QColor(0, 100, 231, 255);
|
||||
const QColor gl_icon_color = QColor(209, 209, 209, 255);
|
||||
const QColor gl_tool_icon_color = QColor(0, 100, 231, 255);
|
||||
|
||||
const GUI_SAVE rg_freeze = GUI_SAVE(main_window, "recentGamesFrozen", false);
|
||||
const GUI_SAVE rg_entries = GUI_SAVE(main_window, "recentGamesNames", QVariant::fromValue(q_pair_list()));
|
||||
|
@ -150,11 +150,6 @@ void main_window::Init()
|
||||
void main_window::CreateThumbnailToolbar()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_icon_thumb_play = QIcon(":/Icons/play_blue.png");
|
||||
m_icon_thumb_pause = QIcon(":/Icons/pause_blue.png");
|
||||
m_icon_thumb_stop = QIcon(":/Icons/stop_blue.png");
|
||||
m_icon_thumb_restart = QIcon(":/Icons/restart_blue.png");
|
||||
|
||||
m_thumb_bar = new QWinThumbnailToolBar(this);
|
||||
m_thumb_bar->setWindow(windowHandle());
|
||||
|
||||
@ -177,6 +172,8 @@ void main_window::CreateThumbnailToolbar()
|
||||
m_thumb_bar->addButton(m_thumb_stop);
|
||||
m_thumb_bar->addButton(m_thumb_restart);
|
||||
|
||||
RepaintThumbnailIcons();
|
||||
|
||||
connect(m_thumb_stop, &QWinThumbnailToolButton::clicked, [=]() { Emu.Stop(); });
|
||||
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, [=]() { Emu.Stop(); Emu.Load(); });
|
||||
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, Pause);
|
||||
@ -706,6 +703,29 @@ void main_window::SaveWindowState()
|
||||
m_debuggerFrame->SaveSettings();
|
||||
}
|
||||
|
||||
void main_window::RepaintThumbnailIcons()
|
||||
{
|
||||
QColor newColor = GUI::get_Label_Color("thumbnail_icon_color");
|
||||
|
||||
auto icon = [&newColor](const QString& path)
|
||||
{
|
||||
return gui_settings::colorizedIcon(QPixmap::fromImage(gui_settings::GetOpaqueImageArea(path)), GUI::mw_tool_icon_color, newColor);
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!m_thumb_bar) return;
|
||||
|
||||
m_icon_thumb_play = icon(":/Icons/play.png");
|
||||
m_icon_thumb_pause = icon(":/Icons/pause.png");
|
||||
m_icon_thumb_stop = icon(":/Icons/stop.png");
|
||||
m_icon_thumb_restart = icon(":/Icons/restart.png");
|
||||
|
||||
m_thumb_playPause->setIcon(Emu.IsRunning() ? m_icon_thumb_pause : m_icon_thumb_play);
|
||||
m_thumb_stop->setIcon(m_icon_thumb_stop);
|
||||
m_thumb_restart->setIcon(m_icon_thumb_restart);
|
||||
#endif
|
||||
}
|
||||
|
||||
void main_window::RepaintToolBarIcons()
|
||||
{
|
||||
QColor newColor;
|
||||
@ -740,7 +760,7 @@ void main_window::RepaintToolBarIcons()
|
||||
ui->toolbar_snap ->setIcon(icon(":/Icons/screenshot.png"));
|
||||
ui->toolbar_sort ->setIcon(icon(":/Icons/sort.png"));
|
||||
ui->toolbar_stop ->setIcon(icon(":/Icons/stop.png"));
|
||||
|
||||
|
||||
if (Emu.IsRunning())
|
||||
{
|
||||
ui->toolbar_start->setIcon(m_icon_pause);
|
||||
@ -753,7 +773,7 @@ void main_window::RepaintToolBarIcons()
|
||||
{
|
||||
ui->toolbar_start->setIcon(m_icon_play);
|
||||
}
|
||||
|
||||
|
||||
if (isFullScreen())
|
||||
{
|
||||
ui->toolbar_fullscreen->setIcon(m_icon_fullscreen_on);
|
||||
@ -1058,6 +1078,7 @@ void main_window::RepaintGui()
|
||||
m_gameListFrame->RepaintToolBarIcons();
|
||||
RepaintToolbar();
|
||||
RepaintToolBarIcons();
|
||||
RepaintThumbnailIcons();
|
||||
}
|
||||
|
||||
void main_window::RepaintToolbar()
|
||||
|
@ -47,10 +47,10 @@ class main_window : public QMainWindow
|
||||
QIcon m_icon_thumb_pause;
|
||||
QIcon m_icon_thumb_stop;
|
||||
QIcon m_icon_thumb_restart;
|
||||
QWinThumbnailToolBar *m_thumb_bar;
|
||||
QWinThumbnailToolButton *m_thumb_playPause;
|
||||
QWinThumbnailToolButton *m_thumb_stop;
|
||||
QWinThumbnailToolButton *m_thumb_restart;
|
||||
QWinThumbnailToolBar *m_thumb_bar = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_playPause = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_stop = nullptr;
|
||||
QWinThumbnailToolButton *m_thumb_restart = nullptr;
|
||||
QStringList m_vulkan_adapters;
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
@ -82,7 +82,6 @@ private Q_SLOTS:
|
||||
void DecryptSPRXLibraries();
|
||||
|
||||
void SaveWindowState();
|
||||
void RepaintToolBarIcons();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
@ -91,6 +90,8 @@ protected:
|
||||
void SetAppIconFromPath(const std::string path);
|
||||
private:
|
||||
void RepaintToolbar();
|
||||
void RepaintToolBarIcons();
|
||||
void RepaintThumbnailIcons();
|
||||
void CreateActions();
|
||||
void CreateConnects();
|
||||
void CreateDockWindows();
|
||||
|
Loading…
Reference in New Issue
Block a user