From b3efa75206c6bc4230af3031e0d0453bfd98765c Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 19 Oct 2017 13:29:48 +0200 Subject: [PATCH] [Qt] UI improvements (#3558) * Qt: Show tooltips in description box * Qt: implement description subscription * Qt: add gamelist resize for ctrl-+/-/wheel (simple zoom) * Qt: handle strict mode in gui tab * Qt: more highdpi stuff * Qt: remove old tooltips from settings_dialog * Qt: conform cpublit tooltip to new subscription model --- bin/GuiConfigs/Kuroi (Dark) by Ani.qss | 82 +++--- rpcs3/Json/tooltips.json | 15 +- rpcs3/rpcs3qt/about_dialog.cpp | 1 + rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp | 2 + rpcs3/rpcs3qt/game_list_frame.cpp | 40 +++ rpcs3/rpcs3qt/game_list_frame.h | 1 + rpcs3/rpcs3qt/gamepads_settings_dialog.cpp | 15 ++ rpcs3/rpcs3qt/instruction_editor_dialog.cpp | 1 + rpcs3/rpcs3qt/kernel_explorer.cpp | 1 + rpcs3/rpcs3qt/main_window.cpp | 9 +- rpcs3/rpcs3qt/memory_string_searcher.cpp | 9 +- rpcs3/rpcs3qt/memory_viewer_panel.cpp | 1 + rpcs3/rpcs3qt/pad_settings_dialog.cpp | 4 +- rpcs3/rpcs3qt/register_editor_dialog.cpp | 1 + rpcs3/rpcs3qt/rsx_debugger.cpp | 1 + rpcs3/rpcs3qt/save_data_info_dialog.cpp | 1 + rpcs3/rpcs3qt/save_data_list_dialog.cpp | 1 + rpcs3/rpcs3qt/save_manager_dialog.cpp | 1 + rpcs3/rpcs3qt/settings_dialog.cpp | 255 +++++++++++-------- rpcs3/rpcs3qt/settings_dialog.h | 7 + rpcs3/rpcs3qt/settings_dialog.ui | 153 ++++++----- rpcs3/rpcs3qt/vfs_dialog.cpp | 1 + rpcs3/rpcs3qt/welcome_dialog.cpp | 2 +- 23 files changed, 374 insertions(+), 230 deletions(-) diff --git a/bin/GuiConfigs/Kuroi (Dark) by Ani.qss b/bin/GuiConfigs/Kuroi (Dark) by Ani.qss index cd63a0a6fe..84a57c4e19 100644 --- a/bin/GuiConfigs/Kuroi (Dark) by Ani.qss +++ b/bin/GuiConfigs/Kuroi (Dark) by Ani.qss @@ -40,7 +40,7 @@ QWidget { /* Mouse tooltips */ QToolTip { - border: 1px solid #323232; + border: 0.05em solid #323232; background-color: #323232; color: #ecf0f1; } @@ -49,29 +49,29 @@ QToolTip { QHeaderView::section { background-color: #323232; color: #ecf0f1; - padding-left: 4px; - border: 1px solid #323232; + padding-left: 0.2em; + border: 0.05em solid #323232; } /* Settings Dialog: Tabs */ QTabBar::tab { color: #ecf0f1; - border: 1px solid #444; + border: 0.05em solid #444; border-bottom-style: none; background-color: #333333; - padding-left: 16px; - padding-right: 16px; - padding-top: 4px; - padding-bottom: 4px; - margin-right: -2px; + padding-left: 0.9em; + padding-right: 0.9em; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin-right: -0.2em; } QTabBar::tab:last { - margin-right: 0px; + margin-right: 0em; } QTabBar::tab:!selected { color: #b1b1b1; border-bottom-style: solid; - margin-top: 3px; + margin-top: 0.15em; background-color: #292929; } QTabBar::tab:hover { @@ -81,11 +81,11 @@ QTabBar::tab:hover { /* Checkboxes */ QCheckBox::indicator { - border-radius: 2px; - border: 1px solid #ecf0f1; - width: 10px; - height: 10px; - margin-top: 1px; + border-radius: 0.1em; + border: 0.05em solid #ecf0f1; + margin-top: 0.05em; + width: 0.8em; + height: 0.8em; } QCheckBox::indicator:checked { background-color: #2ecc71; /* Green */ @@ -99,11 +99,11 @@ QCheckBox::indicator::disabled { /* Radio Buttons */ QRadioButton::indicator { - border-radius: 6px; - border: 1px solid #ecf0f1; - width: 10px; - height: 10px; - margin-top: 1px; + border-radius: 0.4em; + border: 0.05em solid; + border-color: white; + width: 0.8em; + height: 0.8em; } QRadioButton::indicator:checked { background-color: #2ecc71; /* Green */ @@ -119,10 +119,10 @@ QRadioButton::indicator::disabled { QComboBox { background-color: #404040; color: #fff; - border: 1px solid #1e1e1e; - border-radius: 3px; - padding-bottom: 2px; - padding-left: 4px; + border: 0.05em solid #1e1e1e; + border-radius: 0.15em; + padding-bottom: 0.2em; + padding-left: 0.4em; } QComboBox::disabled { background-color: #828790; @@ -131,15 +131,15 @@ QComboBox::disabled { /* Group Boxes (Settings Dialog) */ QGroupBox { - margin-top: 17px; - font-size: 13px; - border: 1px solid #bdc3c7; - border-radius: 4px; + margin-top: 1em; + font-size: 8pt; + border: 0.05em solid #bdc3c7; + border-radius: 0.3em; } QGroupBox::title { subcontrol-origin: margin; - subcontrol-position: top center; - padding: 5px 10px 5px 10px; + subcontrol-position: top; + padding: 0.3em 0.5em 0.3em 0.5em; color: #fff; } @@ -154,19 +154,19 @@ QPushButton::disabled { /* Log and Debugger borders */ QTextEdit { - border: 1px solid #828790; + border: 0.05em solid #828790; } /* For dock buttons to be visible */ QDockWidget::close-button, QDockWidget::float-button { background-color: #bdc3c7; - border: 1px solid #000; - border-radius: 4px; + border: 0.05em solid #000; + border-radius: 0.3em; } /* Disable ugly borders */ QTabWidget::pane { - border: 0px solid #828790; + border: 0em solid #828790; } /* Top menu bar */ @@ -174,14 +174,14 @@ QMenuBar::item:selected { background: #444444; } QMenu::item { - padding-left: 20px; - padding-right: 15px; - padding-top: 4px; - padding-bottom: 4px; + padding-left: 1em; + padding-right: 0.75em; + padding-top: 0.2em; + padding-bottom: 0.2em; } QMenu::item:selected { background: #444444; - border: 1px solid #bdc3c7; + border: 0.05em solid #bdc3c7; } QMenu::item:disabled { background-color: #444444; @@ -223,7 +223,7 @@ QLabel#color_button { /* Seachbar on main toolbar */ QLineEdit#mw_searchbar { - margin-left:14px; + margin-left: 0.7em; color: #ecf0f1; } diff --git a/rpcs3/Json/tooltips.json b/rpcs3/Json/tooltips.json index 0aee1ee8fe..b0076dd0d0 100644 --- a/rpcs3/Json/tooltips.json +++ b/rpcs3/Json/tooltips.json @@ -1,6 +1,7 @@ { "audio": { - "audioOutBox": "Windows: Always use XAudio, no exceptions.\n\nLinux: ALSA uses the native Linux sound system to output sound.\nThis option has good compatibility and sound quality.\nOpenAL uses a cross-platform approach but will have poor audio quality and stuttering sound in most games.\nIf unsure, use ALSA.", + "audioOutBox": "Always use XAudio, no exceptions.\nOpenAL uses a cross-platform approach but will have poor audio quality and stuttering sound in most games.", + "audioOutBox_Linux": "PulseAudio uses the recommended native Linux sound system and has good compatibility and sound quality. If it is unavailable on your system, ALSA is the next best alternative. \nOpenAL uses a cross-platform approach but will have poor audio quality and stuttering sound in most games.", "audioDump": "Saves all audio as a raw wave file. If unsure, leave this unchecked.", "convert": "Uses 16-bit audio samples instead of default 32-bit floating point.\nUse with buggy audio drivers if you have no sound or completely broken sound.", "downmix": "Uses stereo audio output instead of default 7.1 surround sound.\nUse with stereo audio devices. Disable it only if you are using a surround sound audio system." @@ -30,7 +31,7 @@ "spuLoopDetection": "Try to detect loop conditions in SPU kernels and use them as scheduling hints.\nImproves performance and reduces CPU usage.\nMay cause severe audio stuttering in rare cases." }, "comboboxes": { - "preferredSPUThreads": "Preferred number of threads allowed to enter some sensitive SPU stages.\nSome SPU stages are sensitive to race conditions and allowing a limited number at a time helps alleviate performance stalls.\nSetting this to a smaller value might improve performance and reduce stuttering in some games.\nLeave this on auto if performance is negatively affected when setting a small value." + "preferredSPUThreads": "Some SPU stages are sensitive to race conditions and allowing a limited number at a time helps alleviate performance stalls.\nSetting this to a smaller value might improve performance and reduce stuttering in some games.\nLeave this on auto if performance is negatively affected when setting a small value." } }, "debug": { @@ -51,7 +52,7 @@ "emulator": { "gui": { "configs": "Only useful to developers.\nIf unsure, don't use this option.", - "stylesheets": "Only useful to developers.\nIf unsure, don't use this option.", + "stylesheets": "Changes the overall look of RPCS3.\nChoose a stylesheet and click Apply to change between styles.", "show_welcome": "Shows the initial welcome screen upon starting RPCS3.", "custom_colors": "Prioritize custom user interface colors over properties set in stylesheet." }, @@ -67,9 +68,10 @@ "gpu": { "comboboxes": { "renderBox": "Vulkan is the fastest renderer. OpenGL is the most accurate renderer.\nIf unsure, use Vulkan. Should you have any compatibility issues, fall back to OpenGL.\nDirectX 12 is deprecated and should never be used.", - "resBox": "This setting will be ignored if the Resolution Scale is set to anything other than 100%!\nLeave this on 1280x720, every PS3 game is compatible with this resolution.\nSet it to 1920x1080 only if supported by the game. Lower resolutions may work but are not practical.\nHowever rarely due to emulation bugs some games will only render at low resolutions like 480p.", + "renderBox_Linux": "Vulkan is the fastest renderer. OpenGL is the most accurate renderer.\nIf unsure, use Vulkan. Should you have any compatibility issues, fall back to OpenGL.", + "resBox": "This setting will be ignored if the Resolution Scale is set to anything other than 100%!\nLeave this on 1280x720, every PS3 game is compatible with this resolution.\nOnly use 1920x1080 if the game supports it.\nRarely due to emulation bugs some games will only render at low resolutions like 480p.", "graphicsAdapterBox": "On multi GPU systems select which GPU to use in RPCS3 when using Vulkan or DirectX 12.\nThis is not needed when using OpenGL.", - "aspectBox": "Leave this on 16:9 unless you have a 4:3 monitor.\nAuto also works well especially if you use a resolution that is not 720p.", + "aspectBox": "Leave this on 16:9 unless you have a 4:3 monitor.\nAuto also works well, especially if you use a resolution that is not 720p.", "frameLimitBox": "Off is the best option as it performs faster.\nUsing the frame limiter will add extra overhead and slow down the game.\nHowever, some games will crash if the framerate is too high.\nIf that happens, set value to anything other than Off.", "anisotropicFilterOverride": "Higher values increase sharpness of textures on sloped surfaces at the cost of GPU resources.\nModern GPUs can handle this setting just fine even at 16x.\nKeep this on Automatic if you want to use the original setting used by a real PS3." }, @@ -86,7 +88,8 @@ } }, "input": { - "padHandlerBox": "If you want to use the keyboard to control, select the Keyboard option.\nYou can change the button mappings in Configuration --> Controls.\nIf you have a DualShock 4, select DualShock 4.\nWindows: If you have an Xbox controller, or another compatible device, use XInput.\nOlder controllers such as PS2 controllers with an adapter usually work fine with MMJoystick.\nCheck button mappings in the Windows control panel.\n\nLinux: evdev input is WIP.", + "padHandlerBox": "If you want to use the keyboard to control, select the Keyboard option.\nIf you have a DualShock 4, select DualShock 4.\nIf you have an Xbox controller, or another compatible device, use XInput.\nOlder controllers such as PS2 controllers with an adapter usually work fine with MMJoystick.\nCheck button mappings in the Windows control panel.", + "padHandlerBox_Linux": "If you want to use the keyboard to control, select the Keyboard option.\nIf you have a DualShock 4, select DualShock 4.\nevdev input is WIP.", "keyboardHandlerBox": "Some games support native keyboard input.\nBasic will work in these cases.", "mouseHandlerBox": "Some games support native mouse input.\nBasic will work in these cases.", "cameraBox": "Camera support is not implemented, leave this on null.", diff --git a/rpcs3/rpcs3qt/about_dialog.cpp b/rpcs3/rpcs3qt/about_dialog.cpp index 58a8c77cd0..3ddf0d091d 100644 --- a/rpcs3/rpcs3qt/about_dialog.cpp +++ b/rpcs3/rpcs3qt/about_dialog.cpp @@ -23,6 +23,7 @@ about_dialog::about_dialog(QWidget* parent) : QDialog(parent), ui(new Ui::about_ connect(ui->patreon, &QAbstractButton::clicked, [] { QDesktopServices::openUrl(QUrl("https://www.patreon.com/Nekotekina")); }); connect(ui->close, &QAbstractButton::clicked, this, &QWidget::close); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); layout()->setSizeConstraint(QLayout::SetFixedSize); } diff --git a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp index d2eb3b79cc..c7577e0db2 100644 --- a/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/auto_pause_settings_dialog.cpp @@ -5,6 +5,8 @@ constexpr auto qstr = QString::fromStdString; auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialog(parent) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + QLabel *description = new QLabel(tr("To use auto pause: enter the ID(s) of a function or a system call.\nRestart of the game is required to apply. You can enable/disable this in the settings."), this); pauseList = new QTableWidget(this); diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 3db80303ff..01a6465788 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -144,6 +144,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: m_gameList->setSelectionMode(QAbstractItemView::SingleSelection); m_gameList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_gameList->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + m_gameList->verticalScrollBar()->installEventFilter(this); m_gameList->verticalScrollBar()->setSingleStep(20); m_gameList->horizontalScrollBar()->setSingleStep(20); m_gameList->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); @@ -157,6 +158,7 @@ game_list_frame::game_list_frame(std::shared_ptr guiSettings, std: m_gameList->horizontalHeader()->setDefaultSectionSize(150); m_gameList->setContextMenuPolicy(Qt::CustomContextMenu); m_gameList->setAlternatingRowColors(true); + m_gameList->installEventFilter(this); m_gameList->setColumnCount(GUI::COLUMN_COUNT); m_gameList->setHorizontalHeaderItem( GUI::COLUMN_ICON, new QTableWidgetItem(tr("Icon"))); @@ -950,6 +952,42 @@ void game_list_frame::resizeEvent(QResizeEvent *event) QDockWidget::resizeEvent(event); } +bool game_list_frame::eventFilter(QObject *object, QEvent *event) +{ + // Zoom gamelist/gamegrid + if (event->type() == QEvent::Wheel && (object == m_gameList->verticalScrollBar() || object == m_xgrid->verticalScrollBar())) + { + QWheelEvent *wheelEvent = static_cast(event); + + if (wheelEvent->modifiers() & Qt::ControlModifier) + { + QPoint numSteps = wheelEvent->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta + const int value = numSteps.y(); + m_Slider_Size->setValue(m_Slider_Size->value() + value); + return true; + } + } + else if (event->type() == QEvent::KeyPress && (object == m_gameList || object == m_xgrid)) + { + QKeyEvent *keyEvent = static_cast(event); + + if (keyEvent->modifiers() & Qt::ControlModifier) + { + if (keyEvent->key() == Qt::Key_Plus) + { + m_Slider_Size->setValue(m_Slider_Size->value() + 1); + return true; + } + else if (keyEvent->key() == Qt::Key_Minus) + { + m_Slider_Size->setValue(m_Slider_Size->value() - 1); + return true; + } + } + } + return QDockWidget::eventFilter(object, event); +} + /** Cleans and readds entries to table widget in UI. */ @@ -1099,6 +1137,8 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co m_xgrid->resizeColumnsToContents(); m_xgrid->resizeRowsToContents(); + m_xgrid->installEventFilter(this); + m_xgrid->verticalScrollBar()->installEventFilter(this); } /** diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 069b018333..f28d8902de 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -236,6 +236,7 @@ protected: /** Override inherited method from Qt to allow signalling when close happened.*/ void closeEvent(QCloseEvent* event) override; void resizeEvent(QResizeEvent *event) override; + bool eventFilter(QObject *object, QEvent *event); private: QPixmap PaintedPixmap(const QImage& img, bool paintConfigIcon = false); bool Boot(const GameInfo& info); diff --git a/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp b/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp index 2a0481942e..6f0718af97 100644 --- a/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/gamepads_settings_dialog.cpp @@ -11,6 +11,9 @@ #include "../Emu/Io/Null/NullPadHandler.h" #include "../Emu/System.h" +#include +#include + input_config input_cfg; // taken from https://stackoverflow.com/a/30818424/8353754 @@ -38,6 +41,13 @@ gamepads_settings_dialog::gamepads_settings_dialog(QWidget* parent) { setWindowTitle(tr("Gamepads Settings")); + // read tooltips from json + QFile json_file(":/Json/tooltips.json"); + json_file.open(QIODevice::ReadOnly | QIODevice::Text); + QJsonObject json_input = QJsonDocument::fromJson(json_file.readAll()).object().value("input").toObject(); + json_file.close(); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + QVBoxLayout *dialog_layout = new QVBoxLayout(); QHBoxLayout *all_players = new QHBoxLayout(); @@ -90,6 +100,11 @@ gamepads_settings_dialog::gamepads_settings_dialog(QWidget* parent) co_inputtype[i] = new QComboBox(); co_inputtype[i]->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); co_inputtype[i]->view()->setTextElideMode(Qt::ElideNone); +#ifdef WIN32 + co_inputtype[i]->setToolTip(json_input["padHandlerBox"].toString()); +#else + co_inputtype[i]->setToolTip(json_input["padHandlerBox_Linux"].toString()); +#endif ppad_layout->addWidget(co_inputtype[i]); co_deviceID[i] = new QComboBox(); diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 34d0411fb1..a570fe33e0 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -14,6 +14,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, c { setWindowTitle(tr("Edit instruction")); setAttribute(Qt::WA_DeleteOnClose); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setMinimumSize(300, sizeHint().height()); const auto cpu = _cpu.get(); diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index 0c4a0d0408..b0e5b2fba4 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -30,6 +30,7 @@ kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent) setWindowTitle(tr("Kernel Explorer")); setObjectName("kernel_explorer"); setAttribute(Qt::WA_DeleteOnClose); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setMinimumSize(QSize(700, 450)); QVBoxLayout* vbox_panel = new QVBoxLayout(); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 2db356e327..2115972870 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -405,10 +405,9 @@ void main_window::InstallPkg(const QString& dropPath) } QProgressDialog pdlg(tr("Installing package ... please wait ..."), tr("Cancel"), 0, 1000, this); - pdlg.setWindowTitle(tr("RPCS3 Package Installer")); pdlg.setWindowModality(Qt::WindowModal); - pdlg.setFixedSize(500, pdlg.height()); + pdlg.setFixedWidth(QLabel("This is the very length of the progressdialog due to hidpi reasons.").sizeHint().width()); pdlg.show(); #ifdef _WIN32 @@ -538,16 +537,16 @@ void main_window::InstallPup(const QString& dropPath) const std::string cur_version = "4.81"; if (version_string < cur_version && - QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Old firmware detected.\nThe newest firmware version is %1 and you are trying to install version %2\nContinue installation?").arg(QString::fromStdString(cur_version), QString::fromStdString(version_string)), + QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Old firmware detected.\nThe newest firmware version is %1 and you are trying to install version %2\nContinue installation?").arg(qstr(cur_version), qstr(version_string)), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No) { return; } - QProgressDialog pdlg(tr("Installing firmware version %1\nPlease wait...").arg(QString::fromStdString(version_string)), tr("Cancel"), 0, static_cast(updatefilenames.size()), this); + QProgressDialog pdlg(tr("Installing firmware version %1\nPlease wait...").arg(qstr(version_string)), tr("Cancel"), 0, static_cast(updatefilenames.size()), this); pdlg.setWindowTitle(tr("RPCS3 Firmware Installer")); pdlg.setWindowModality(Qt::WindowModal); - pdlg.setFixedSize(500, pdlg.height()); + pdlg.setFixedWidth(QLabel("This is the very length of the progressdialog due to hidpi reasons.").sizeHint().width()); pdlg.show(); #ifdef _WIN32 diff --git a/rpcs3/rpcs3qt/memory_string_searcher.cpp b/rpcs3/rpcs3qt/memory_string_searcher.cpp index 34f12ab6ee..6c1dd43d18 100644 --- a/rpcs3/rpcs3qt/memory_string_searcher.cpp +++ b/rpcs3/rpcs3qt/memory_string_searcher.cpp @@ -1,19 +1,20 @@ #include "memory_string_searcher.h" +#include + memory_string_searcher::memory_string_searcher(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("String Searcher")); setAttribute(Qt::WA_DeleteOnClose); - setFixedSize(QSize(545, 64)); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_addr_line = new QLineEdit(this); - m_addr_line->setFixedWidth(460); + m_addr_line->setFixedWidth(QLabel("This is the very length of the lineedit due to hidpi reasons.").sizeHint().width()); m_addr_line->setPlaceholderText(tr("Search...")); QPushButton* button_search = new QPushButton(tr("&Search"), this); - button_search->setFixedWidth(60); QHBoxLayout* hbox_panel = new QHBoxLayout(); hbox_panel->addWidget(m_addr_line); @@ -22,6 +23,8 @@ memory_string_searcher::memory_string_searcher(QWidget* parent) setLayout(hbox_panel); connect(button_search, &QAbstractButton::clicked, this, &memory_string_searcher::OnSearch); + + layout()->setSizeConstraint(QLayout::SetFixedSize); }; void memory_string_searcher::OnSearch() diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index a8f59a3f37..5a2cd93425 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -11,6 +11,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent) setWindowTitle(tr("Memory Viewer")); setObjectName("memory_viewer"); setAttribute(Qt::WA_DeleteOnClose); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); exit = false; m_addr = 0; m_colcount = 16; diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 056d27ffe1..2143e3a424 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -14,14 +14,14 @@ // TODO: rewrite with std::chrono or QTimer #include -static const int PadButtonWidth = 60; - extern keyboard_pad_config g_kbpad_config; pad_settings_dialog::pad_settings_dialog(QWidget *parent) : QDialog(parent), ui(new Ui::pad_settings_dialog) { ui->setupUi(this); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + ui->b_cancel->setDefault(true); connect(ui->b_cancel, &QAbstractButton::clicked, this, &QWidget::close); diff --git a/rpcs3/rpcs3qt/register_editor_dialog.cpp b/rpcs3/rpcs3qt/register_editor_dialog.cpp index 526e8a4e9d..83d85e8f33 100644 --- a/rpcs3/rpcs3qt/register_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/register_editor_dialog.cpp @@ -13,6 +13,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s { setWindowTitle(tr("Edit registers")); setAttribute(Qt::WA_DeleteOnClose); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QVBoxLayout* vbox_panel = new QVBoxLayout(); QHBoxLayout* hbox_panel = new QHBoxLayout(); diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index d06f189774..07ea0c1358 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -18,6 +18,7 @@ rsx_debugger::rsx_debugger(QWidget* parent) { setWindowTitle(tr("RSX Debugger")); setAttribute(Qt::WA_DeleteOnClose); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); //Fonts and Colors QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont); diff --git a/rpcs3/rpcs3qt/save_data_info_dialog.cpp b/rpcs3/rpcs3qt/save_data_info_dialog.cpp index 010d4d95ec..5086bc795d 100644 --- a/rpcs3/rpcs3qt/save_data_info_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_info_dialog.cpp @@ -9,6 +9,7 @@ constexpr auto qstr = QString::fromStdString; save_data_info_dialog::save_data_info_dialog(const SaveDataEntry& save, QWidget* parent) : QDialog(parent), m_entry(save) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Save Data Information")); setWindowIcon(QIcon(":/rpcs3.ico")); diff --git a/rpcs3/rpcs3qt/save_data_list_dialog.cpp b/rpcs3/rpcs3qt/save_data_list_dialog.cpp index 3e1eb0abd5..d4188127dd 100644 --- a/rpcs3/rpcs3qt/save_data_list_dialog.cpp +++ b/rpcs3/rpcs3qt/save_data_list_dialog.cpp @@ -15,6 +15,7 @@ constexpr auto qstr = QString::fromStdString; save_data_list_dialog::save_data_list_dialog(const std::vector& entries, s32 focusedEntry, bool is_saving, QWidget* parent) : QDialog(parent), m_save_entries(entries), m_entry(-1), m_entry_label(nullptr) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Save Data Interface")); setWindowIcon(QIcon(":/rpcs3.ico")); setMinimumSize(QSize(400, 400)); diff --git a/rpcs3/rpcs3qt/save_manager_dialog.cpp b/rpcs3/rpcs3qt/save_manager_dialog.cpp index 17609eafc2..8c8f38c9c2 100644 --- a/rpcs3/rpcs3qt/save_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/save_manager_dialog.cpp @@ -79,6 +79,7 @@ namespace save_manager_dialog::save_manager_dialog(std::string dir, QWidget* parent) : QDialog(parent), m_save_entries(), m_dir(dir), m_sort_column(1), m_sort_ascending(true) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowTitle(tr("Save Manager")); setWindowIcon(QIcon(":/rpcs3.ico")); setMinimumSize(QSize(400, 400)); diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index d7b2042962..ae3af41d5c 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -29,8 +29,10 @@ inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } settings_dialog::settings_dialog(std::shared_ptr guiSettings, std::shared_ptr emuSettings, const int& tabIndex, QWidget *parent, const GameInfo* game) : QDialog(parent), xgui_settings(guiSettings), xemu_settings(emuSettings), ui(new Ui::settings_dialog), m_tab_Index(tabIndex) { + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + ui->setupUi(this); - ui->cancelButton->setDefault(true); + ui->cancelButton->setFocus(); ui->tabWidget->setUsesScrollButtons(false); bool showDebugTab = xgui_settings->GetValue(GUI::m_showDebugTab).toBool(); @@ -40,6 +42,16 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: ui->tabWidget->removeTab(7); } + // Add description labels + SubscribeDescription(ui->description_cpu); + SubscribeDescription(ui->description_gpu); + SubscribeDescription(ui->description_audio); + SubscribeDescription(ui->description_io); + SubscribeDescription(ui->description_system); + SubscribeDescription(ui->description_network); + SubscribeDescription(ui->description_emulator); + SubscribeDescription(ui->description_debug); + // read tooltips from json QFile json_file(":/Json/tooltips.json"); json_file.open(QIODevice::ReadOnly | QIODevice::Text); @@ -56,7 +68,6 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: QJsonObject json_gpu = json_obj.value("gpu").toObject(); QJsonObject json_gpu_cbo = json_gpu.value("comboboxes").toObject(); QJsonObject json_gpu_main = json_gpu.value("main").toObject(); - QJsonObject json_gpu_deb = json_gpu.value("debug").toObject(); QJsonObject json_gpu_slid = json_gpu.value("sliders").toObject(); QJsonObject json_audio = json_obj.value("audio").toObject(); @@ -116,27 +127,27 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Checkboxes xemu_settings->EnhanceCheckBox(ui->hookStFunc, emu_settings::HookStaticFuncs); - ui->hookStFunc->setToolTip(json_cpu_cbs["hookStFunc"].toString()); + SubscribeTooltip(ui->hookStFunc, json_cpu_cbs["hookStFunc"].toString()); xemu_settings->EnhanceCheckBox(ui->bindSPUThreads, emu_settings::BindSPUThreads); - ui->bindSPUThreads->setToolTip(json_cpu_cbs["bindSPUThreads"].toString()); + SubscribeTooltip(ui->bindSPUThreads, json_cpu_cbs["bindSPUThreads"].toString()); xemu_settings->EnhanceCheckBox(ui->lowerSPUThrPrio, emu_settings::LowerSPUThreadPrio); - ui->lowerSPUThrPrio->setToolTip(json_cpu_cbs["lowerSPUThrPrio"].toString()); + SubscribeTooltip(ui->lowerSPUThrPrio, json_cpu_cbs["lowerSPUThrPrio"].toString()); xemu_settings->EnhanceCheckBox(ui->spuLoopDetection, emu_settings::SPULoopDetection); - ui->spuLoopDetection->setToolTip(json_cpu_cbs["spuLoopDetection"].toString()); + SubscribeTooltip(ui->spuLoopDetection, json_cpu_cbs["spuLoopDetection"].toString()); // Comboboxes xemu_settings->EnhanceComboBox(ui->preferredSPUThreads, emu_settings::PreferredSPUThreads, true); - ui->preferredSPUThreads->setToolTip(json_cpu_cbo["preferredSPUThreads"].toString()); + SubscribeTooltip(ui->preferredSPUThreads, json_cpu_cbo["preferredSPUThreads"].toString()); ui->preferredSPUThreads->setItemText(ui->preferredSPUThreads->findData("0"), tr("Auto")); // PPU tool tips - ui->ppu_precise->setToolTip(json_cpu_ppu["precise"].toString()); - ui->ppu_fast->setToolTip(json_cpu_ppu["fast"].toString()); - ui->ppu_llvm->setToolTip(json_cpu_ppu["LLVM"].toString()); + SubscribeTooltip(ui->ppu_precise, json_cpu_ppu["precise"].toString()); + SubscribeTooltip(ui->ppu_fast, json_cpu_ppu["fast"].toString()); + SubscribeTooltip(ui->ppu_llvm, json_cpu_ppu["LLVM"].toString()); QButtonGroup *ppuBG = new QButtonGroup(this); ppuBG->addButton(ui->ppu_precise, (int)ppu_decoder_type::precise); @@ -171,10 +182,10 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: } // SPU tool tips - ui->spu_precise->setToolTip(json_cpu_spu["precise"].toString()); - ui->spu_fast->setToolTip(json_cpu_spu["fast"].toString()); - ui->spu_asmjit->setToolTip(json_cpu_spu["ASMJIT"].toString()); - ui->spu_llvm->setToolTip(json_cpu_spu["LLVM"].toString()); + SubscribeTooltip(ui->spu_precise, json_cpu_spu["precise"].toString()); + SubscribeTooltip(ui->spu_fast, json_cpu_spu["fast"].toString()); + SubscribeTooltip(ui->spu_asmjit, json_cpu_spu["ASMJIT"].toString()); + SubscribeTooltip(ui->spu_llvm, json_cpu_spu["LLVM"].toString()); QButtonGroup *spuBG = new QButtonGroup(this); spuBG->addButton(ui->spu_precise, (int)spu_decoder_type::precise); @@ -203,10 +214,10 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: } // lib options tool tips - ui->lib_auto->setToolTip(json_cpu_lib["auto"].toString()); - ui->lib_manu->setToolTip(json_cpu_lib["manual"].toString()); - ui->lib_both->setToolTip(json_cpu_lib["both"].toString()); - ui->lib_lv2->setToolTip(json_cpu_lib["liblv2"].toString()); + SubscribeTooltip(ui->lib_auto, json_cpu_lib["auto"].toString()); + SubscribeTooltip(ui->lib_manu, json_cpu_lib["manual"].toString()); + SubscribeTooltip(ui->lib_both, json_cpu_lib["both"].toString()); + SubscribeTooltip(ui->lib_lv2, json_cpu_lib["liblv2"].toString()); // creating this in ui file keeps scrambling the order... QButtonGroup *libModeBG = new QButtonGroup(this); @@ -350,32 +361,29 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: emu_settings::Render_Creator render_creator = xemu_settings.get()->m_render_creator; // Comboboxes - ui->graphicsAdapterBox->setToolTip(json_gpu_cbo["graphicsAdapterBox"].toString()); + SubscribeTooltip(ui->graphicsAdapterBox, json_gpu_cbo["graphicsAdapterBox"].toString()); xemu_settings->EnhanceComboBox(ui->renderBox, emu_settings::Renderer); - ui->renderBox->setToolTip(json_gpu_cbo["renderBox"].toString()); +#ifdef WIN32 + SubscribeTooltip(ui->renderBox, json_gpu_cbo["renderBox"].toString()); +#else + SubscribeTooltip(ui->renderBox, json_gpu_cbo["renderBox_Linux"].toString()); +#endif //Change D3D12 to D3D12[DO NOT USE] - for (int i = 0; i < ui->renderBox->count(); i++) - { - if (ui->renderBox->itemText(i) == "D3D12") - { - ui->renderBox->setItemText(i, render_creator.name_D3D12); - break; - } - } + ui->renderBox->setItemText(ui->renderBox->findData("D3D12"), render_creator.name_D3D12); xemu_settings->EnhanceComboBox(ui->resBox, emu_settings::Resolution); - ui->resBox->setToolTip(json_gpu_cbo["resBox"].toString()); - ui->resBox->setItemText(ui->resBox->findData("1280x720"), "1280x720 (Recommended)"); + ui->resBox->setItemText(ui->resBox->findData("1280x720"), tr("1280x720 (Recommended)")); + SubscribeTooltip(ui->resBox, json_gpu_cbo["resBox"].toString()); xemu_settings->EnhanceComboBox(ui->aspectBox, emu_settings::AspectRatio); - ui->aspectBox->setToolTip(json_gpu_cbo["aspectBox"].toString()); + SubscribeTooltip(ui->aspectBox, json_gpu_cbo["aspectBox"].toString()); xemu_settings->EnhanceComboBox(ui->frameLimitBox, emu_settings::FrameLimit); - ui->frameLimitBox->setToolTip(json_gpu_cbo["frameLimitBox"].toString()); + SubscribeTooltip(ui->frameLimitBox, json_gpu_cbo["frameLimitBox"].toString()); xemu_settings->EnhanceComboBox(ui->anisotropicFilterOverride, emu_settings::AnisotropicFilterOverride, true); - ui->anisotropicFilterOverride->setToolTip(json_gpu_cbo["anisotropicFilterOverride"].toString()); + SubscribeTooltip(ui->anisotropicFilterOverride, json_gpu_cbo["anisotropicFilterOverride"].toString()); // only allow values 0,2,4,8,16 for (int i = ui->anisotropicFilterOverride->count() - 1; i >= 0; i--) { @@ -401,19 +409,24 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Checkboxes: main options xemu_settings->EnhanceCheckBox(ui->dumpColor, emu_settings::WriteColorBuffers); - ui->dumpColor->setToolTip(json_gpu_main["dumpColor"].toString()); + SubscribeTooltip(ui->dumpColor, json_gpu_main["dumpColor"].toString()); xemu_settings->EnhanceCheckBox(ui->vsync, emu_settings::VSync); - ui->vsync->setToolTip(json_gpu_main["vsync"].toString()); + SubscribeTooltip(ui->vsync, json_gpu_main["vsync"].toString()); xemu_settings->EnhanceCheckBox(ui->gpuTextureScaling, emu_settings::GPUTextureScaling); - ui->gpuTextureScaling->setToolTip(json_gpu_main["gpuTextureScaling"].toString()); + SubscribeTooltip(ui->gpuTextureScaling, json_gpu_main["gpuTextureScaling"].toString()); xemu_settings->EnhanceCheckBox(ui->stretchToDisplayArea, emu_settings::StretchToDisplayArea); - ui->stretchToDisplayArea->setToolTip(json_gpu_main["stretchToDisplayArea"].toString()); + SubscribeTooltip(ui->stretchToDisplayArea, json_gpu_main["stretchToDisplayArea"].toString()); xemu_settings->EnhanceCheckBox(ui->scrictModeRendering, emu_settings::StrictRenderingMode); - ui->scrictModeRendering->setToolTip(json_gpu_main["scrictModeRendering"].toString()); + SubscribeTooltip(ui->scrictModeRendering, json_gpu_main["scrictModeRendering"].toString()); + connect(ui->scrictModeRendering, &QCheckBox::clicked, [=](bool checked) + { + ui->gb_resolutionScale->setEnabled(!checked); + ui->gb_minimumScalableDimension->setEnabled(!checked); + }); // Sliders static const auto& minmaxLabelWidth = [](const QString& sizer) @@ -422,12 +435,13 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: }; xemu_settings->EnhanceSlider(ui->resolutionScale, emu_settings::ResolutionScale, true); - ui->gb_resolutionScale->setToolTip(json_gpu_slid["resolutionScale"].toString()); + SubscribeTooltip(ui->gb_resolutionScale, json_gpu_slid["resolutionScale"].toString()); + ui->gb_resolutionScale->setEnabled(!ui->scrictModeRendering->isChecked()); // rename label texts to fit current state of Resolution Scale int resolutionScaleDef = stoi(xemu_settings->GetSettingDefault(emu_settings::ResolutionScale)); auto ScaledResolution = [resolutionScaleDef](int percentage) { - if (percentage == resolutionScaleDef) return QString("100% (Automatic)"); + if (percentage == resolutionScaleDef) return QString(tr("100% (Default)")); return QString("%1% (%2x%3)").arg(percentage).arg(1280 * percentage / 100).arg(720 * percentage / 100); }; ui->resolutionScale->setPageStep(50); @@ -446,12 +460,13 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: }); xemu_settings->EnhanceSlider(ui->minimumScalableDimension, emu_settings::MinimumScalableDimension, true); - ui->gb_minimumScalableDimension->setToolTip(json_gpu_slid["minimumScalableDimension"].toString()); + SubscribeTooltip(ui->gb_minimumScalableDimension, json_gpu_slid["minimumScalableDimension"].toString()); + ui->gb_minimumScalableDimension->setEnabled(!ui->scrictModeRendering->isChecked()); // rename label texts to fit current state of Minimum Scalable Dimension int minimumScalableDimensionDef = stoi(xemu_settings->GetSettingDefault(emu_settings::MinimumScalableDimension)); auto MinScalableDimension = [minimumScalableDimensionDef](int dim) { - if (dim == minimumScalableDimensionDef) return QString("%1x%1 (Default)").arg(dim); + if (dim == minimumScalableDimensionDef) return tr("%1x%1 (Default)").arg(dim); return QString("%1x%1").arg(dim); }; ui->minimumScalableDimension->setPageStep(64); @@ -596,18 +611,22 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes xemu_settings->EnhanceComboBox(ui->audioOutBox, emu_settings::AudioRenderer); - ui->audioOutBox->setToolTip(json_audio["audioOutBox"].toString()); +#ifdef WIN32 + SubscribeTooltip(ui->audioOutBox, json_audio["audioOutBox"].toString()); +#else + SubscribeTooltip(ui->audioOutBox, json_audio["audioOutBox_Linux"].toString()); +#endif // Checkboxes xemu_settings->EnhanceCheckBox(ui->audioDump, emu_settings::DumpToFile); - ui->audioDump->setToolTip(json_audio["audioDump"].toString()); + SubscribeTooltip(ui->audioDump, json_audio["audioDump"].toString()); xemu_settings->EnhanceCheckBox(ui->convert, emu_settings::ConvertTo16Bit); - ui->convert->setToolTip(json_audio["convert"].toString()); + SubscribeTooltip(ui->convert, json_audio["convert"].toString()); xemu_settings->EnhanceCheckBox(ui->downmix, emu_settings::DownmixStereo); - ui->downmix->setToolTip(json_audio["downmix"].toString()); + SubscribeTooltip(ui->downmix, json_audio["downmix"].toString()); // _____ __ ____ _______ _ // |_ _| / / / __ \ |__ __| | | @@ -619,16 +638,16 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes xemu_settings->EnhanceComboBox(ui->keyboardHandlerBox, emu_settings::KeyboardHandler); - ui->keyboardHandlerBox->setToolTip(json_input["keyboardHandlerBox"].toString()); + SubscribeTooltip(ui->keyboardHandlerBox, json_input["keyboardHandlerBox"].toString()); xemu_settings->EnhanceComboBox(ui->mouseHandlerBox, emu_settings::MouseHandler); - ui->mouseHandlerBox->setToolTip(json_input["mouseHandlerBox"].toString()); + SubscribeTooltip(ui->mouseHandlerBox, json_input["mouseHandlerBox"].toString()); xemu_settings->EnhanceComboBox(ui->cameraTypeBox, emu_settings::CameraType); - ui->cameraTypeBox->setToolTip(json_input["cameraTypeBox"].toString()); + SubscribeTooltip(ui->cameraTypeBox, json_input["cameraTypeBox"].toString()); xemu_settings->EnhanceComboBox(ui->cameraBox, emu_settings::Camera); - ui->cameraBox->setToolTip(json_input["cameraBox"].toString()); + SubscribeTooltip(ui->cameraBox, json_input["cameraBox"].toString()); // _____ _ _______ _ // / ____| | | |__ __| | | @@ -642,12 +661,12 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes xemu_settings->EnhanceComboBox(ui->sysLangBox, emu_settings::Language); - ui->sysLangBox->setToolTip(json_sys["sysLangBox"].toString()); + SubscribeTooltip(ui->sysLangBox, json_sys["sysLangBox"].toString()); // Checkboxes xemu_settings->EnhanceCheckBox(ui->enableHostRoot, emu_settings::EnableHostRoot); - ui->enableHostRoot->setToolTip(json_sys["enableHostRoot"].toString()); + SubscribeTooltip(ui->enableHostRoot, json_sys["enableHostRoot"].toString()); // _ _ _ _ _______ _ // | \ | | | | | | |__ __| | | @@ -659,7 +678,7 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes xemu_settings->EnhanceComboBox(ui->netStatusBox, emu_settings::ConnectionStatus); - ui->netStatusBox->setToolTip(json_net["netStatusBox"].toString()); + SubscribeTooltip(ui->netStatusBox, json_net["netStatusBox"].toString()); // ______ _ _ _______ _ // | ____| | | | | |__ __| | | @@ -670,30 +689,31 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes - ui->combo_configs->setToolTip(json_emu_gui["configs"].toString()); - ui->combo_stylesheets->setToolTip(json_emu_gui["stylesheets"].toString()); + SubscribeTooltip(ui->combo_configs, json_emu_gui["configs"].toString()); + + SubscribeTooltip(ui->combo_stylesheets, json_emu_gui["stylesheets"].toString()); // Checkboxes - - ui->gs_resizeOnBoot->setToolTip(json_emu_misc["gs_resizeOnBoot"].toString()); - - ui->gs_disableMouse->setToolTip(json_emu_misc["gs_disableMouse"].toString()); - ui->cb_show_welcome->setToolTip(json_emu_gui["show_welcome"].toString()); + SubscribeTooltip(ui->gs_resizeOnBoot, json_emu_misc["gs_resizeOnBoot"].toString()); - ui->cb_custom_colors->setToolTip(json_emu_gui["custom_colors"].toString()); + SubscribeTooltip(ui->gs_disableMouse, json_emu_misc["gs_disableMouse"].toString()); + + SubscribeTooltip(ui->cb_show_welcome, json_emu_gui["show_welcome"].toString()); + + SubscribeTooltip(ui->cb_custom_colors, json_emu_gui["custom_colors"].toString()); xemu_settings->EnhanceCheckBox(ui->exitOnStop, emu_settings::ExitRPCS3OnFinish); - ui->exitOnStop->setToolTip(json_emu_misc["exitOnStop"].toString()); + SubscribeTooltip(ui->exitOnStop, json_emu_misc["exitOnStop"].toString()); xemu_settings->EnhanceCheckBox(ui->alwaysStart, emu_settings::StartOnBoot); - ui->alwaysStart->setToolTip(json_emu_misc["alwaysStart"].toString()); + SubscribeTooltip(ui->alwaysStart, json_emu_misc["alwaysStart"].toString()); xemu_settings->EnhanceCheckBox(ui->startGameFullscreen, emu_settings::StartGameFullscreen); - ui->startGameFullscreen->setToolTip(json_emu_misc["startGameFullscreen"].toString()); + SubscribeTooltip(ui->startGameFullscreen, json_emu_misc["startGameFullscreen"].toString()); xemu_settings->EnhanceCheckBox(ui->showFPSInTitle, emu_settings::ShowFPSInTitle); - ui->showFPSInTitle->setToolTip(json_emu_misc["showFPSInTitle"].toString()); + SubscribeTooltip(ui->showFPSInTitle, json_emu_misc["showFPSInTitle"].toString()); if (game) { @@ -754,8 +774,8 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: { m_currentConfig = GUI::Default; m_currentStylesheet = GUI::Default; - ui->combo_configs->setCurrentText(GUI::Default); - ui->combo_stylesheets->setCurrentText(GUI::Default); + ui->combo_configs->setCurrentIndex(0); + ui->combo_stylesheets->setCurrentIndex(0); } // Only attempt to load a config if changes occurred. if (m_currentConfig != xgui_settings->GetValue(GUI::m_currentConfig).toString()) @@ -861,13 +881,11 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: ui->gs_width->setEnabled(enableButtons); ui->gs_height->setEnabled(enableButtons); - QRect rec = QApplication::desktop()->screenGeometry(); + QRect screen = QApplication::desktop()->screenGeometry(); int width = xgui_settings->GetValue(GUI::gs_width).toInt(); int height = xgui_settings->GetValue(GUI::gs_height).toInt(); - const int max_width = rec.width(); - const int max_height = rec.height(); - ui->gs_width->setValue(width < max_width ? width : max_width); - ui->gs_height->setValue(height < max_height ? height : max_height); + ui->gs_width->setValue(std::min(width, screen.width())); + ui->gs_height->setValue(std::min(height, screen.height())); connect(ui->gs_resizeOnBoot, &QCheckBox::clicked, [=](bool val) { @@ -875,19 +893,15 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: ui->gs_width->setEnabled(val); ui->gs_height->setEnabled(val); }); - connect(ui->gs_width, static_cast(&QSpinBox::valueChanged), [=](int w) + connect(ui->gs_width, &QSpinBox::editingFinished, [=]() { - int width = QApplication::desktop()->screenGeometry().width(); - w = w > width ? width : w; - ui->gs_width->setValue(w); - xgui_settings->SetValue(GUI::gs_width, w); + ui->gs_width->setValue(std::min(ui->gs_width->value(), QApplication::desktop()->screenGeometry().width())); + xgui_settings->SetValue(GUI::gs_width, ui->gs_width->value()); }); - connect(ui->gs_height, static_cast(&QSpinBox::valueChanged), [=](int h) + connect(ui->gs_height, &QSpinBox::editingFinished, [=]() { - int height = QApplication::desktop()->screenGeometry().height(); - h = h > height ? height : h; - ui->gs_height->setValue(h); - xgui_settings->SetValue(GUI::gs_height, h); + ui->gs_height->setValue(std::min(ui->gs_height->value(), QApplication::desktop()->screenGeometry().height())); + xgui_settings->SetValue(GUI::gs_height, ui->gs_height->value()); }); AddConfigs(); @@ -905,46 +919,44 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Checkboxes: gpu debug options xemu_settings->EnhanceCheckBox(ui->glLegacyBuffers, emu_settings::LegacyBuffers); - ui->glLegacyBuffers->setToolTip(json_debug["glLegacyBuffers"].toString()); + SubscribeTooltip(ui->glLegacyBuffers, json_debug["glLegacyBuffers"].toString()); xemu_settings->EnhanceCheckBox(ui->forceHighpZ, emu_settings::ForceHighpZ); - ui->forceHighpZ->setToolTip(json_debug["forceHighpZ"].toString()); + SubscribeTooltip(ui->forceHighpZ, json_debug["forceHighpZ"].toString()); xemu_settings->EnhanceCheckBox(ui->debugOutput, emu_settings::DebugOutput); - ui->debugOutput->setToolTip(json_debug["debugOutput"].toString()); + SubscribeTooltip(ui->debugOutput, json_debug["debugOutput"].toString()); xemu_settings->EnhanceCheckBox(ui->debugOverlay, emu_settings::DebugOverlay); - ui->debugOverlay->setToolTip(json_debug["debugOverlay"].toString()); + SubscribeTooltip(ui->debugOverlay, json_debug["debugOverlay"].toString()); xemu_settings->EnhanceCheckBox(ui->logProg, emu_settings::LogShaderPrograms); - ui->logProg->setToolTip(json_debug["logProg"].toString()); + SubscribeTooltip(ui->logProg, json_debug["logProg"].toString()); xemu_settings->EnhanceCheckBox(ui->readColor, emu_settings::ReadColorBuffers); - ui->readColor->setToolTip(json_debug["readColor"].toString()); + SubscribeTooltip(ui->readColor, json_debug["readColor"].toString()); xemu_settings->EnhanceCheckBox(ui->dumpDepth, emu_settings::WriteDepthBuffer); - ui->dumpDepth->setToolTip(json_debug["dumpDepth"].toString()); + SubscribeTooltip(ui->dumpDepth, json_debug["dumpDepth"].toString()); xemu_settings->EnhanceCheckBox(ui->readDepth, emu_settings::ReadDepthBuffer); - ui->readDepth->setToolTip(json_debug["readDepth"].toString()); + SubscribeTooltip(ui->readDepth, json_debug["readDepth"].toString()); xemu_settings->EnhanceCheckBox(ui->disableVertexCache, emu_settings::DisableVertexCache); - ui->disableVertexCache->setToolTip(json_debug["disableVertexCache"].toString()); + SubscribeTooltip(ui->disableVertexCache, json_debug["disableVertexCache"].toString()); xemu_settings->EnhanceCheckBox(ui->disableHwOcclusionQueries, emu_settings::DisableOcclusionQueries); - ui->disableHwOcclusionQueries->setToolTip(json_debug["disableOcclusionQueries"].toString()); + SubscribeTooltip(ui->disableHwOcclusionQueries, json_debug["disableOcclusionQueries"].toString()); xemu_settings->EnhanceCheckBox(ui->forceCpuBlitEmulation, emu_settings::ForceCPUBlitEmulation); - ui->forceCpuBlitEmulation->setToolTip(json_debug["forceCpuBlitEmulation"].toString()); + SubscribeTooltip(ui->forceCpuBlitEmulation, json_debug["forceCpuBlitEmulation"].toString()); // Checkboxes: core debug options xemu_settings->EnhanceCheckBox(ui->ppuDebug, emu_settings::PPUDebug); - ui->ppuDebug->setToolTip(json_debug["ppuDebug"].toString()); - //TODO: Subscribe + SubscribeTooltip(ui->ppuDebug, json_debug["ppuDebug"].toString()); xemu_settings->EnhanceCheckBox(ui->spuDebug, emu_settings::SPUDebug); - ui->spuDebug->setToolTip(json_debug["spuDebug"].toString()); - //TODO: Subscribe + SubscribeTooltip(ui->spuDebug, json_debug["spuDebug"].toString()); // // Layout fix for High Dpi @@ -988,19 +1000,19 @@ void settings_dialog::AddStylesheets() { ui->combo_stylesheets->clear(); - ui->combo_stylesheets->addItem(GUI::Default); + ui->combo_stylesheets->addItem("Default (Bright)", GUI::Default); - for (QString entry : xgui_settings->GetStylesheetEntries()) + for (const QString& entry : xgui_settings->GetStylesheetEntries()) { if (entry != GUI::Default) { - ui->combo_stylesheets->addItem(entry); + ui->combo_stylesheets->addItem(entry, entry); } } m_currentStylesheet = xgui_settings->GetValue(GUI::m_currentStylesheet).toString(); - int index = ui->combo_stylesheets->findText(m_currentStylesheet); + int index = ui->combo_stylesheets->findData(m_currentStylesheet); if (index != -1) { ui->combo_stylesheets->setCurrentIndex(index); @@ -1055,7 +1067,7 @@ void settings_dialog::OnApplyConfig() void settings_dialog::OnApplyStylesheet() { - m_currentStylesheet = ui->combo_stylesheets->currentText(); + m_currentStylesheet = ui->combo_stylesheets->currentData().toString(); xgui_settings->SetValue(GUI::m_currentStylesheet, m_currentStylesheet); Q_EMIT GuiStylesheetRequest(xgui_settings->GetCurrentStylesheetPath()); } @@ -1069,3 +1081,42 @@ int settings_dialog::exec() QTimer::singleShot(0, [=]{ ui->tabWidget->setCurrentIndex(m_tab_Index); }); return QDialog::exec(); } + +void settings_dialog::SubscribeDescription(QLabel* description) +{ + description->setFixedHeight(description->sizeHint().height()); + m_description_labels.append(QPair(description, description->text())); +} + +void settings_dialog::SubscribeTooltip(QObject* object, const QString& tooltip) +{ + m_descriptions[object] = tooltip; + object->installEventFilter(this); +} + +// Thanks Dolphin +bool settings_dialog::eventFilter(QObject* object, QEvent* event) +{ + if (!m_descriptions.contains(object)) + { + return QDialog::eventFilter(object, event); + } + + int i = ui->tabWidget->currentIndex(); + QLabel* label = m_description_labels[i].first; + + if (event->type() == QEvent::Enter) + { + label->setText(m_descriptions[object]); + return QDialog::eventFilter(object, event); + } + + QString description = m_description_labels[i].second; + + if (event->type() == QEvent::Leave) + { + label->setText(description); + } + + return QDialog::eventFilter(object, event); +} diff --git a/rpcs3/rpcs3qt/settings_dialog.h b/rpcs3/rpcs3qt/settings_dialog.h index bb10fccf25..a6930c8c87 100644 --- a/rpcs3/rpcs3qt/settings_dialog.h +++ b/rpcs3/rpcs3qt/settings_dialog.h @@ -45,4 +45,11 @@ private: Ui::settings_dialog *ui; std::shared_ptr xgui_settings; std::shared_ptr xemu_settings; + + // descriptions + QList> m_description_labels; + QHash m_descriptions; + void SubscribeDescription(QLabel* description); + void SubscribeTooltip(QObject* object, const QString& tooltip); + bool eventFilter(QObject* object, QEvent* event); }; diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 5b833369dd..add69c4473 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -6,8 +6,8 @@ 0 0 - 729 - 821 + 550 + 604 @@ -36,7 +36,7 @@ - 1 + 0 @@ -314,9 +314,12 @@ - + - CPU settings allow you to change both the PPU (Power Processing Element) and SPU (Synergistic Processing Unit) decoder modes. You can also adjust firmware settings for the emulated console. These settings allow you to load firmware libraries automatically, manually or both at the same time as well as on-the-fly. + Point your mouse at an option to display a description in here. + + + Qt::PlainText @@ -468,7 +471,7 @@ - Resolution + Default Resolution @@ -545,30 +548,9 @@ - Resolution Scale + Resolution Scale (Disable Strict Mode) - - - - - - 0 - - - Qt::AlignCenter - - - - - - - Reset - - - - - @@ -614,6 +596,27 @@ + + + + + + 0 + + + Qt::AlignCenter + + + + + + + Reset + + + + + @@ -623,27 +626,6 @@ Resolution Scale Threshold - - - - - - 1x1 - - - Qt::AlignCenter - - - - - - - Reset - - - - - @@ -675,6 +657,27 @@ + + + + + + 1x1 + + + Qt::AlignCenter + + + + + + + Reset + + + + + @@ -705,9 +708,12 @@ - + - GPU settings allow you to change the rendering backend of the emulated console. You can also choose your preferred graphics device for GPU specific rendering APIs as well as adjust the output resolution, aspect ratio and framelimit of the emulated console. Additional enhancement settings will be added in the future. + Point your mouse at an option to display a description in here. + + + Qt::PlainText @@ -809,9 +815,10 @@ - + - Audio settings allow you to change the way audio is encoded and handled by the emulator. More detailed settings will be added in the future. + Point your mouse at an option to display a description in here. + @@ -892,13 +899,6 @@ - - - - - - - @@ -922,9 +922,10 @@ - + - I/O settings allow you to change controller, keyboard and mouse handlers as well as PlayStation camera inputs. More detailed settings will be added in the future. + Point your mouse at an option to display a description in here. + @@ -1026,9 +1027,11 @@ - + - System settings allow you to change basic system settings found within a real PlayStation 3 system. Depending on the application in use, the console language setting will change the language of the application accordingly. More detailed settings will be added in the future. + Point your mouse at an option to display a description in here. + + @@ -1094,9 +1097,10 @@ - + - Network settings allow you to change basic network settings found within a real PlayStation 3 system. More detailed settings may or may not be added in the future. + Point your mouse at an option to display a description in here. + @@ -1435,9 +1439,12 @@ - + - Emulator settings allow you to set personal preferences within the emulator such as automatic exit when a process is finished, starting games after boot and allowing games to automatically boot into fullscreen mode. You can also create your own stylesheets which can be used as themes for a more personal experience. + Point your mouse at an option to display a description in here. + + + Qt::PlainText @@ -1615,9 +1622,9 @@ - + - These options are only needed for development. + Point your mouse at an option to display a description in here. @@ -1647,6 +1654,9 @@ Save + + false + @@ -1654,6 +1664,9 @@ Close + + false + diff --git a/rpcs3/rpcs3qt/vfs_dialog.cpp b/rpcs3/rpcs3qt/vfs_dialog.cpp index 75c60ee194..9816543faa 100644 --- a/rpcs3/rpcs3qt/vfs_dialog.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog.cpp @@ -87,4 +87,5 @@ vfs_dialog::vfs_dialog(std::shared_ptr guiSettings, std::shared_pt setLayout(vbox); setWindowTitle("Virtual File System"); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 6015ff9fa3..09740a964b 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -15,7 +15,7 @@ welcome_dialog::welcome_dialog(QWidget* parent) : QDialog(parent), ui(new Ui::we { ui->setupUi(this); - setWindowFlags(Qt::WindowTitleHint); + setWindowFlags(windowFlags() & Qt::WindowTitleHint & ~Qt::WindowContextHelpButtonHint); gui_settings* settings = new gui_settings(this);