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

[Qt] fix small buttons/missing icons in the toolbar (Doppelgänger) (#3413)

* Qt: use lambda for colorizedIcon in main_window and game_list_frame

* Qt: enable AA_UseHighDpiPixmaps for better looking icons

* Qt: use iconSize instead of sizehint for linux, add some comments
This commit is contained in:
Megamouse 2017-09-10 19:46:39 +02:00 committed by Ivan
parent 4b9fa8ec6d
commit f0358f85fc
4 changed files with 53 additions and 25 deletions

View File

@ -23,7 +23,12 @@ int main(int argc, char** argv)
logs::set_init();
#ifdef _WIN32
// use this instead of SetProcessDPIAware if Qt ever fully supports this on windows
// at the moment it can't display QCombobox frames for example
// I think there was an issue with gsframe if I recall correctly, so look out for that
//QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
SetProcessDPIAware();
WSADATA wsa_data;
WSAStartup(MAKEWORD(2, 2), &wsa_data);
timeBeginPeriod(1);
@ -37,6 +42,8 @@ int main(int argc, char** argv)
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
#endif
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
rpcs3_app app(argc, argv);
// Command line args

View File

@ -886,23 +886,28 @@ void game_list_frame::RepaintToolBarIcons()
newColor = GUI::get_Label_Color("gamelist_toolbar_icon_color");
}
m_catActHDD.colored = gui_settings::colorizedIcon(QIcon(":/Icons/hdd_blue.png"), GUI::gl_tool_icon_color, newColor, true);
m_catActDisc.colored = gui_settings::colorizedIcon(QIcon(":/Icons/disc_blue.png"), GUI::gl_tool_icon_color, newColor, true);
m_catActHome.colored = gui_settings::colorizedIcon(QIcon(":/Icons/home_blue.png"), GUI::gl_tool_icon_color, newColor);
m_catActAudioVideo.colored = gui_settings::colorizedIcon(QIcon(":/Icons/media_blue.png"), GUI::gl_tool_icon_color, newColor, true);
m_catActGameData.colored = gui_settings::colorizedIcon(QIcon(":/Icons/data_blue.png"), GUI::gl_tool_icon_color, newColor, true);
m_catActUnknown.colored = gui_settings::colorizedIcon(QIcon(":/Icons/unknown_blue.png"), GUI::gl_tool_icon_color, newColor, true);
m_catActOther.colored = gui_settings::colorizedIcon(QIcon(":/Icons/other_blue.png"), GUI::gl_tool_icon_color, newColor);
auto icon = [&newColor](const QString& path, bool mask = false)
{
return gui_settings::colorizedIcon(QIcon(path), GUI::gl_tool_icon_color, newColor, mask);
};
m_catActHDD.colored = icon(":/Icons/hdd_blue.png", true);
m_catActDisc.colored = icon(":/Icons/disc_blue.png", true);
m_catActHome.colored = icon(":/Icons/home_blue.png");
m_catActAudioVideo.colored = icon(":/Icons/media_blue.png", true);
m_catActGameData.colored = icon(":/Icons/data_blue.png", true);
m_catActUnknown.colored = icon(":/Icons/unknown_blue.png", true);
m_catActOther.colored = icon(":/Icons/other_blue.png");
for (const auto& butt : m_categoryButtons)
{
butt->action->setIcon(butt->isActive ? butt->colored : butt->gray);
}
m_modeActList.colored = gui_settings::colorizedIcon(QIcon(":/Icons/list_blue.png"), GUI::gl_tool_icon_color, newColor);
m_modeActList.colored = icon(":/Icons/list_blue.png");
m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray);
m_modeActGrid.colored = gui_settings::colorizedIcon(QIcon(":/Icons/grid_blue.png"), GUI::gl_tool_icon_color, newColor);
m_modeActGrid.colored = icon(":/Icons/grid_blue.png");
m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored);
m_Slider_Size->setStyleSheet(m_Slider_Size->styleSheet().append("QSlider::handle:horizontal{ background: rgba(%1, %2, %3, %4); }")

View File

@ -86,8 +86,13 @@ void main_window::Init()
// for highdpi resize toolbar icons and height dynamically
// choose factors to mimic Gui-Design in main_window.ui
// TODO: in case Qt::AA_EnableHighDpiScaling is enabled in main.cpp we only need the else branch
#ifdef _WIN32
const int toolBarHeight = menuBar()->sizeHint().height() * 1.5;
ui->toolBar->setIconSize(QSize(toolBarHeight, toolBarHeight));
#else
const int toolBarHeight = ui->toolBar->iconSize().height();
#endif
ui->sizeSliderContainer->setFixedWidth(toolBarHeight * 5);
ui->sizeSlider->setFixedHeight(toolBarHeight * 0.65f);
@ -714,22 +719,27 @@ void main_window::RepaintToolBarIcons()
newColor = GUI::get_Label_Color("toolbar_icon_color");
}
m_icon_play = gui_settings::colorizedIcon(QIcon(":/Icons/play.png"), GUI::mw_tool_icon_color, newColor);
m_icon_pause = gui_settings::colorizedIcon(QIcon(":/Icons/pause.png"), GUI::mw_tool_icon_color, newColor);
m_icon_stop = gui_settings::colorizedIcon(QIcon(":/Icons/stop.png"), GUI::mw_tool_icon_color, newColor);
m_icon_restart = gui_settings::colorizedIcon(QIcon(":/Icons/restart.png"), GUI::mw_tool_icon_color, newColor);
m_icon_fullscreen_on = gui_settings::colorizedIcon(QIcon(":/Icons/fullscreen.png"), GUI::mw_tool_icon_color, newColor);
m_icon_fullscreen_off = gui_settings::colorizedIcon(QIcon(":/Icons/fullscreen_invert.png"), GUI::mw_tool_icon_color, newColor);
auto icon = [&newColor](const QString& path)
{
return gui_settings::colorizedIcon(QIcon(path), GUI::mw_tool_icon_color, newColor);
};
ui->toolbar_config->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/configure.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_controls->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/controllers.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_disc->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/disc.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_grid->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/grid.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_list->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/list.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_refresh->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/refresh.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_snap->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/screenshot.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_sort->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/sort.png"), GUI::mw_tool_icon_color, newColor));
ui->toolbar_stop->setIcon(gui_settings::colorizedIcon(QIcon(":/Icons/stop.png"), GUI::mw_tool_icon_color, newColor));
m_icon_play = icon(":/Icons/play.png");
m_icon_pause = icon(":/Icons/pause.png");
m_icon_stop = icon(":/Icons/stop.png");
m_icon_restart = icon(":/Icons/restart.png");
m_icon_fullscreen_on = icon(":/Icons/fullscreen.png");
m_icon_fullscreen_off = icon(":/Icons/fullscreen_invert.png");
ui->toolbar_config ->setIcon(icon(":/Icons/configure.png"));
ui->toolbar_controls->setIcon(icon(":/Icons/controllers.png"));
ui->toolbar_disc ->setIcon(icon(":/Icons/disc.png"));
ui->toolbar_grid ->setIcon(icon(":/Icons/grid.png"));
ui->toolbar_list ->setIcon(icon(":/Icons/list.png"));
ui->toolbar_refresh ->setIcon(icon(":/Icons/refresh.png"));
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())
{

View File

@ -141,7 +141,7 @@
<x>0</x>
<y>0</y>
<width>1058</width>
<height>21</height>
<height>36</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -285,6 +285,12 @@
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>