Qt: move default stylesheet to stylesheets.h

This commit is contained in:
Megamouse 2019-08-14 20:30:53 +02:00
parent 503d43889d
commit 9f854dba98
4 changed files with 111 additions and 94 deletions

View File

@ -1651,6 +1651,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -D%(PreprocessorDefinitions) "-I$(VULKAN_SDK)\Include" "-I.\.." "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras"</Command>
</CustomBuild>
<ClInclude Include="rpcs3qt\stylesheets.h" />
<ClInclude Include="rpcs3qt\_discord_utils.h" />
<ClInclude Include="rpcs3qt\find_dialog.h" />
<ClInclude Include="rpcs3qt\custom_table_widget_item.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Generated Files">
@ -829,6 +829,9 @@
<ClInclude Include="ds3_pad_handler.h">
<Filter>Io\DS3</Filter>
</ClInclude>
<ClInclude Include="rpcs3qt\stylesheets.h">
<Filter>Gui</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">

View File

@ -11,6 +11,7 @@
#include "save_data_dialog.h"
#include "msg_dialog_frame.h"
#include "osk_dialog_frame.h"
#include "stylesheets.h"
gui_application::gui_application(int& argc, char** argv) : QApplication(argc, argv)
{
@ -163,97 +164,6 @@ void gui_application::InitializeCallbacks()
*/
void gui_application::OnChangeStyleSheetRequest(const QString& path)
{
QString style_sheet
(
// main window toolbar search
"QLineEdit#mw_searchbar { padding: 0 1em; background: #fdfdfd; selection-background-color: #148aff; margin: .8em; color:#000000; }"
// main window toolbar slider
"QSlider#sizeSlider { color: #505050; background: #F0F0F0; }"
"QSlider#sizeSlider::handle:horizontal { border: 0em smooth rgba(227, 227, 227, 255); border-radius: .58em; background: #404040; width: 1.2em; margin: -.5em 0; }"
"QSlider#sizeSlider::groove:horizontal { border-radius: .15em; background: #5b5b5b; height: .3em; }"
// main window toolbar
"QToolBar#mw_toolbar { background-color: #F0F0F0; border: none; }"
"QToolBar#mw_toolbar::separator { background-color: rgba(207, 207, 207, 235); width: 0.125em; margin-top: 0.250em; margin-bottom: 0.250em; }"
// main window toolbar icon color
"QLabel#toolbar_icon_color { color: #5b5b5b; }"
// thumbnail icon color
"QLabel#thumbnail_icon_color { color: rgba(0, 100, 231, 255); }"
// game list icon color
"QLabel#gamelist_icon_background_color { color: rgba(240, 240, 240, 255); }"
// save manager icon color
"QLabel#save_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"
// trophy manager icon color
"QLabel#trophy_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"
// tables
"QTableWidget { alternate-background-color: #f2f2f2; background-color: #fff; border: none; }"
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: #fff; font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); border: 0em solid white; }"
"QTableView::item { border-left: 0.063em solid white; border-right: 0.063em solid white; padding-left:0.313em; }"
"QTableView::item:selected { background-color: #148aff; color: #fff; }"
"QTableView#game_grid::item:hover:!selected { background-color: #94c9ff; color: #fff; }"
"QTableView#game_grid::item:hover:selected { background-color: #007fff; color: #fff; }"
// table headers
#if (QT_VERSION < QT_VERSION_CHECK(5,11,0))
"QHeaderView::section { padding: .5em; border: 0.063em solid #ffffff; }"
"QHeaderView::section:hover { background: #e3e3e3; padding: .5em; border: 0.063em solid #ffffff; }"
#else
"QHeaderView::section { padding-left: .5em; padding-right: .5em; padding-top: .4em; padding-bottom: -.1em; border: 0.063em solid #ffffff; }"
"QHeaderView::section:hover { background: #e3e3e3; padding-left: .5em; padding-right: .5em; padding-top: .4em; padding-bottom: -.1em; border: 0.063em solid #ffffff; }"
#endif
// dock widget
"QDockWidget{ background: transparent; color: black; }"
"[floating=\"true\"]{ background: white; }"
"QDockWidget::title{ background: #e3e3e3; border: none; padding-top: 0.2em; padding-left: 0.2em; }"
"QDockWidget::close-button, QDockWidget::float-button{ background-color: #e3e3e3; }"
// log frame tty
"QTextEdit#tty_frame { background-color: #ffffff; }"
"QLabel#tty_text { color: #000000; }"
// log frame log
"QTextEdit#log_frame { background-color: #ffffff; }"
"QLabel#log_level_always { color: #107896; }"
"QLabel#log_level_fatal { color: #ff00ff; }"
"QLabel#log_level_error { color: #C02F1D; }"
"QLabel#log_level_todo { color: #ff6000; }"
"QLabel#log_level_success { color: #008000; }"
"QLabel#log_level_warning { color: #BA8745; }"
"QLabel#log_level_notice { color: #000000; }"
"QLabel#log_level_trace { color: #808080; }"
"QLabel#log_stack { color: #000000; }"
// about dialog
"QWidget#header_section { background-color: #ffffff; }"
// kernel explorer
"QDialog#kernel_explorer { background-color: rgba(240, 240, 240, 255); }"
// memory viewer
"QDialog#memory_viewer { background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_address_panel { color: rgba(75, 135, 150, 255); background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_hex_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_ascii_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
// debugger frame
"QLabel#debugger_frame_breakpoint { color: #000000; background-color: #ffff00; }"
"QLabel#debugger_frame_pc { color: #000000; background-color: #00ff00; }"
// rsx debugger
"QLabel#rsx_debugger_display_buffer { background-color: rgba(240, 240, 240, 255); }"
// pad settings
"QLabel#l_controller { color: #434343; }"
);
QFile file(path);
// If we can't open the file, try the /share or /Resources folder
@ -268,12 +178,15 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)
if (path == "")
{
setStyleSheet(style_sheet);
setStyleSheet(gui::stylesheets::default_style_sheet);
}
else if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QString config_dir = qstr(fs::get_config_dir());
// Remove old fonts
QFontDatabase::removeAllApplicationFonts();
// Add PS3 fonts
QDirIterator ps3_font_it(qstr(g_cfg.vfs.get_dev_flash() + "data/font/"), QStringList() << "*.ttf", QDir::Files, QDirIterator::Subdirectories);
while (ps3_font_it.hasNext())
@ -299,7 +212,7 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)
#endif
else
{
setStyleSheet(style_sheet);
setStyleSheet(gui::stylesheets::default_style_sheet);
}
gui::stylesheet = styleSheet();

100
rpcs3/rpcs3qt/stylesheets.h Normal file
View File

@ -0,0 +1,100 @@
#pragma once
#include <QString>
namespace gui
{
namespace stylesheets
{
const QString default_style_sheet
(
// main window toolbar search
"QLineEdit#mw_searchbar { padding: 0 1em; background: #fdfdfd; selection-background-color: #148aff; margin: .8em; color:#000000; }"
// main window toolbar slider
"QSlider#sizeSlider { color: #505050; background: #F0F0F0; }"
"QSlider#sizeSlider::handle:horizontal { border: 0em smooth rgba(227, 227, 227, 255); border-radius: .58em; background: #404040; width: 1.2em; margin: -.5em 0; }"
"QSlider#sizeSlider::groove:horizontal { border-radius: .15em; background: #5b5b5b; height: .3em; }"
// main window toolbar
"QToolBar#mw_toolbar { background-color: #F0F0F0; border: none; }"
"QToolBar#mw_toolbar::separator { background-color: rgba(207, 207, 207, 235); width: 0.125em; margin-top: 0.250em; margin-bottom: 0.250em; }"
// main window toolbar icon color
"QLabel#toolbar_icon_color { color: #5b5b5b; }"
// thumbnail icon color
"QLabel#thumbnail_icon_color { color: rgba(0, 100, 231, 255); }"
// game list icon color
"QLabel#gamelist_icon_background_color { color: rgba(240, 240, 240, 255); }"
// save manager icon color
"QLabel#save_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"
// trophy manager icon color
"QLabel#trophy_manager_icon_background_color { color: rgba(240, 240, 240, 255); }"
// tables
"QTableWidget { alternate-background-color: #f2f2f2; background-color: #fff; border: none; }"
"QTableWidget#game_grid { alternate-background-color: #f2f2f2; background-color: #fff; font-weight: 600; font-size: 8pt; font-family: Lucida Grande; color: rgba(51, 51, 51, 255); border: 0em solid white; }"
"QTableView::item { border-left: 0.063em solid white; border-right: 0.063em solid white; padding-left:0.313em; }"
"QTableView::item:selected { background-color: #148aff; color: #fff; }"
"QTableView#game_grid::item:hover:!selected { background-color: #94c9ff; color: #fff; }"
"QTableView#game_grid::item:hover:selected { background-color: #007fff; color: #fff; }"
// table headers
#if (QT_VERSION < QT_VERSION_CHECK(5,11,0))
"QHeaderView::section { padding: .5em; border: 0.063em solid #ffffff; }"
"QHeaderView::section:hover { background: #e3e3e3; padding: .5em; border: 0.063em solid #ffffff; }"
#else
"QHeaderView::section { padding-left: .5em; padding-right: .5em; padding-top: .4em; padding-bottom: -.1em; border: 0.063em solid #ffffff; }"
"QHeaderView::section:hover { background: #e3e3e3; padding-left: .5em; padding-right: .5em; padding-top: .4em; padding-bottom: -.1em; border: 0.063em solid #ffffff; }"
#endif
// dock widget
"QDockWidget{ background: transparent; color: black; }"
"[floating=\"true\"]{ background: white; }"
"QDockWidget::title{ background: #e3e3e3; border: none; padding-top: 0.2em; padding-left: 0.2em; }"
"QDockWidget::close-button, QDockWidget::float-button{ background-color: #e3e3e3; }"
// log frame tty
"QTextEdit#tty_frame { background-color: #ffffff; }"
"QLabel#tty_text { color: #000000; }"
// log frame log
"QTextEdit#log_frame { background-color: #ffffff; }"
"QLabel#log_level_always { color: #107896; }"
"QLabel#log_level_fatal { color: #ff00ff; }"
"QLabel#log_level_error { color: #C02F1D; }"
"QLabel#log_level_todo { color: #ff6000; }"
"QLabel#log_level_success { color: #008000; }"
"QLabel#log_level_warning { color: #BA8745; }"
"QLabel#log_level_notice { color: #000000; }"
"QLabel#log_level_trace { color: #808080; }"
"QLabel#log_stack { color: #000000; }"
// about dialog
"QWidget#header_section { background-color: #ffffff; }"
// kernel explorer
"QDialog#kernel_explorer { background-color: rgba(240, 240, 240, 255); }"
// memory viewer
"QDialog#memory_viewer { background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_address_panel { color: rgba(75, 135, 150, 255); background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_hex_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
"QLabel#memory_viewer_ascii_panel { color: #000000; background-color: rgba(240, 240, 240, 255); }"
// debugger frame
"QLabel#debugger_frame_breakpoint { color: #000000; background-color: #ffff00; }"
"QLabel#debugger_frame_pc { color: #000000; background-color: #00ff00; }"
// rsx debugger
"QLabel#rsx_debugger_display_buffer { background-color: rgba(240, 240, 240, 255); }"
// pad settings
"QLabel#l_controller { color: #434343; }"
);
}
}