diff --git a/bin/GuiConfigs/YoRHa by Ani.qss b/bin/GuiConfigs/YoRHa by Ani.qss index bfe32c9510..085cec4f63 100644 --- a/bin/GuiConfigs/YoRHa by Ani.qss +++ b/bin/GuiConfigs/YoRHa by Ani.qss @@ -226,7 +226,7 @@ QDockWidget { font-weight: 500; } [floating="true"] { - background: #b3ac98; + border-image: url("GuiConfigs/YoRHa-background.jpg"); } QDockWidget::title { background: #4d4940; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index fce2913970..32a2f9527c 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -1308,6 +1308,7 @@ .\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DLLVM_AVAILABLE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\.." "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-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" + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 4000519b3f..147c1b3106 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -688,6 +688,9 @@ Gui\utils + + Gui + @@ -817,4 +820,4 @@ - + \ No newline at end of file diff --git a/rpcs3/rpcs3qt/custom_dock_widget.h b/rpcs3/rpcs3qt/custom_dock_widget.h new file mode 100644 index 0000000000..9c1a035e82 --- /dev/null +++ b/rpcs3/rpcs3qt/custom_dock_widget.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include + +class custom_dock_widget : public QDockWidget +{ +public: + explicit custom_dock_widget(const QString &title, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()) + : QDockWidget(title, parent, flags) + { + connect(this, &QDockWidget::topLevelChanged, [this](bool/* topLevel*/) + { + style()->unpolish(this); + style()->polish(this); + }); + }; + +protected: + void paintEvent(QPaintEvent* event) override + { + // We need to repaint the dock widgets as plain widgets in floating mode. + // Source: https://stackoverflow.com/questions/10272091/cannot-add-a-background-image-to-a-qdockwidget + if (isFloating()) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + return; + } + + // Use inherited method for docked mode because otherwise the dock would lose the title etc. + QDockWidget::paintEvent(event); + } +}; diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 37fec58ac8..fce59ebeda 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -10,7 +10,7 @@ constexpr auto qstr = QString::fromStdString; extern bool user_asked_for_frame_capture; debugger_frame::debugger_frame(std::shared_ptr settings, QWidget *parent) - : QDockWidget(tr("Debugger"), parent), xgui_settings(settings) + : custom_dock_widget(tr("Debugger"), parent), xgui_settings(settings) { m_update = new QTimer(this); connect(m_update, &QTimer::timeout, this, &debugger_frame::UpdateUI); diff --git a/rpcs3/rpcs3qt/debugger_frame.h b/rpcs3/rpcs3qt/debugger_frame.h index 14e6295b5b..26e08432b7 100644 --- a/rpcs3/rpcs3qt/debugger_frame.h +++ b/rpcs3/rpcs3qt/debugger_frame.h @@ -13,11 +13,11 @@ #include "Emu/Cell/SPUDisAsm.h" #include "Emu/Cell/PPUInterpreter.h" +#include "custom_dock_widget.h" #include "instruction_editor_dialog.h" #include "register_editor_dialog.h" #include "gui_settings.h" -#include #include #include #include @@ -29,7 +29,7 @@ class debugger_list; -class debugger_frame : public QDockWidget +class debugger_frame : public custom_dock_widget { Q_OBJECT diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index f71dffd173..59320c8aee 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -24,7 +24,7 @@ inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline QSize sizeFromSlider(const int& pos) { return gui::gl_icon_size_min + (gui::gl_icon_size_max - gui::gl_icon_size_min) * (pos / (float)gui::gl_max_slider_pos); } game_list_frame::game_list_frame(std::shared_ptr guiSettings, std::shared_ptr emuSettings, QWidget *parent) - : QDockWidget(tr("Game List"), parent), xgui_settings(guiSettings), xemu_settings(emuSettings) + : custom_dock_widget(tr("Game List"), parent), xgui_settings(guiSettings), xemu_settings(emuSettings) { m_isListLayout = xgui_settings->GetValue(gui::gl_listMode).toBool(); m_icon_size_index = xgui_settings->GetValue(gui::gl_iconSize).toInt(); diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 1e9240cf4f..3ff465aee6 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -3,12 +3,12 @@ #include "stdafx.h" #include "Emu/GameInfo.h" +#include "custom_dock_widget.h" #include "game_list.h" #include "game_list_grid.h" #include "emu_settings.h" #include "game_compatibility.h" -#include #include #include #include @@ -170,7 +170,7 @@ struct GUI_GameInfo bool hasCustomConfig; }; -class game_list_frame : public QDockWidget +class game_list_frame : public custom_dock_widget { Q_OBJECT diff --git a/rpcs3/rpcs3qt/log_frame.cpp b/rpcs3/rpcs3qt/log_frame.cpp index 37c0aad546..140ace7b53 100644 --- a/rpcs3/rpcs3qt/log_frame.cpp +++ b/rpcs3/rpcs3qt/log_frame.cpp @@ -103,7 +103,8 @@ struct gui_listener : logs::listener // GUI Listener instance static gui_listener s_gui_listener; -log_frame::log_frame(std::shared_ptr guiSettings, QWidget *parent) : QDockWidget(tr("Log"), parent), xgui_settings(guiSettings) +log_frame::log_frame(std::shared_ptr guiSettings, QWidget *parent) + : custom_dock_widget(tr("Log"), parent), xgui_settings(guiSettings) { m_tabWidget = new QTabWidget; m_tabWidget->setObjectName("tab_widget_log"); diff --git a/rpcs3/rpcs3qt/log_frame.h b/rpcs3/rpcs3qt/log_frame.h index bbf8375711..6394f6a4f1 100644 --- a/rpcs3/rpcs3qt/log_frame.h +++ b/rpcs3/rpcs3qt/log_frame.h @@ -3,19 +3,19 @@ #include "Utilities/File.h" #include "Utilities/Log.h" +#include "custom_dock_widget.h" #include "gui_settings.h" #include "find_dialog.h" #include -#include #include #include #include #include #include -class log_frame : public QDockWidget +class log_frame : public custom_dock_widget { Q_OBJECT diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index ddc72281c4..615c8ea9bf 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -1328,11 +1328,6 @@ void main_window::CreateDockWindows() guiSettings->SetValue(gui::mw_logger, false); } }); - connect(m_logFrame, &log_frame::topLevelChanged, [=](bool/* topLevel*/) - { - m_logFrame->style()->unpolish(m_logFrame); - m_logFrame->style()->polish(m_logFrame); - }); connect(m_debuggerFrame, &debugger_frame::DebugFrameClosed, [=]() { @@ -1342,11 +1337,6 @@ void main_window::CreateDockWindows() guiSettings->SetValue(gui::mw_debugger, false); } }); - connect(m_debuggerFrame, &log_frame::topLevelChanged, [=](bool/* topLevel*/) - { - m_debuggerFrame->style()->unpolish(m_debuggerFrame); - m_debuggerFrame->style()->polish(m_debuggerFrame); - }); connect(m_gameListFrame, &game_list_frame::GameListFrameClosed, [=]() { @@ -1356,11 +1346,6 @@ void main_window::CreateDockWindows() guiSettings->SetValue(gui::mw_gamelist, false); } }); - connect(m_gameListFrame, &log_frame::topLevelChanged, [=](bool/* topLevel*/) - { - m_gameListFrame->style()->unpolish(m_gameListFrame); - m_gameListFrame->style()->polish(m_gameListFrame); - }); connect(m_gameListFrame, &game_list_frame::RequestBoot, [this](const std::string& path){ Boot(path); }); }