mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-19 09:54:54 +00:00
menu description | rename: Release/Nightly (#1116)
* menu description * improve texts * TR * Release_Nightly
This commit is contained in:
parent
65bd62e98b
commit
4e4f3d7504
31 changed files with 3214 additions and 305 deletions
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include <QCompleter>
|
||||
#include <QDirIterator>
|
||||
#include <QHoverEvent>
|
||||
|
||||
#include <common/version.h>
|
||||
#include "check_update.h"
|
||||
#include "common/logging/backend.h"
|
||||
#include "common/logging/filter.h"
|
||||
|
@ -68,6 +70,9 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
|
|||
InitializeEmulatorLanguages();
|
||||
LoadValuesFromConfig();
|
||||
|
||||
defaultTextEdit = tr("Point your mouse at an options to display a description in here");
|
||||
ui->descriptionText->setText(defaultTextEdit);
|
||||
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
||||
|
||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
||||
|
@ -179,6 +184,36 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
|
|||
connect(ui->rdocCheckBox, &QCheckBox::stateChanged, this,
|
||||
[](int val) { Config::setRdocEnabled(val); });
|
||||
}
|
||||
|
||||
// Descriptions
|
||||
{
|
||||
// General
|
||||
ui->consoleLanguageGroupBox->installEventFilter(this);
|
||||
ui->emulatorLanguageGroupBox->installEventFilter(this);
|
||||
ui->fullscreenCheckBox->installEventFilter(this);
|
||||
ui->showSplashCheckBox->installEventFilter(this);
|
||||
ui->ps4proCheckBox->installEventFilter(this);
|
||||
ui->userName->installEventFilter(this);
|
||||
ui->logTypeGroupBox->installEventFilter(this);
|
||||
ui->logFilter->installEventFilter(this);
|
||||
ui->updaterGroupBox->installEventFilter(this);
|
||||
ui->GUIgroupBox->installEventFilter(this);
|
||||
|
||||
// Graphics
|
||||
ui->graphicsAdapterGroupBox->installEventFilter(this);
|
||||
ui->widthGroupBox->installEventFilter(this);
|
||||
ui->heightGroupBox->installEventFilter(this);
|
||||
ui->heightDivider->installEventFilter(this);
|
||||
ui->dumpShadersCheckBox->installEventFilter(this);
|
||||
ui->nullGpuCheckBox->installEventFilter(this);
|
||||
ui->dumpPM4CheckBox->installEventFilter(this);
|
||||
|
||||
// Debug
|
||||
ui->debugDump->installEventFilter(this);
|
||||
ui->vkValidationCheckBox->installEventFilter(this);
|
||||
ui->vkSyncValidationCheckBox->installEventFilter(this);
|
||||
ui->rdocCheckBox->installEventFilter(this);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::LoadValuesFromConfig() {
|
||||
|
@ -209,7 +244,15 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||
ui->rdocCheckBox->setChecked(Config::isRdocEnabled());
|
||||
|
||||
ui->updateCheckBox->setChecked(Config::autoUpdate());
|
||||
ui->updateComboBox->setCurrentText(QString::fromStdString(Config::getUpdateChannel()));
|
||||
std::string updateChannel = Config::getUpdateChannel();
|
||||
if (updateChannel != "Release" && updateChannel != "Nightly") {
|
||||
if (Common::isRelease) {
|
||||
updateChannel = "Release";
|
||||
} else {
|
||||
updateChannel = "Nightly";
|
||||
}
|
||||
}
|
||||
ui->updateComboBox->setCurrentText(QString::fromStdString(updateChannel));
|
||||
}
|
||||
|
||||
void SettingsDialog::InitializeEmulatorLanguages() {
|
||||
|
@ -246,3 +289,86 @@ int SettingsDialog::exec() {
|
|||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog() {}
|
||||
|
||||
void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
|
||||
QString text; // texts are only in .ts translation files for better formatting
|
||||
|
||||
// General
|
||||
if (elementName == "consoleLanguageGroupBox") {
|
||||
text = tr("consoleLanguageGroupBox");
|
||||
} else if (elementName == "emulatorLanguageGroupBox") {
|
||||
text = tr("emulatorLanguageGroupBox");
|
||||
} else if (elementName == "fullscreenCheckBox") {
|
||||
text = tr("fullscreenCheckBox");
|
||||
} else if (elementName == "showSplashCheckBox") {
|
||||
text = tr("showSplashCheckBox");
|
||||
} else if (elementName == "ps4proCheckBox") {
|
||||
text = tr("ps4proCheckBox");
|
||||
} else if (elementName == "userName") {
|
||||
text = tr("userName");
|
||||
} else if (elementName == "logTypeGroupBox") {
|
||||
text = tr("logTypeGroupBox");
|
||||
} else if (elementName == "logFilter") {
|
||||
text = tr("logFilter");
|
||||
} else if (elementName == "updaterGroupBox") {
|
||||
text = tr("updaterGroupBox");
|
||||
} else if (elementName == "GUIgroupBox") {
|
||||
text = tr("GUIgroupBox");
|
||||
}
|
||||
|
||||
// Graphics
|
||||
if (elementName == "graphicsAdapterGroupBox") {
|
||||
text = tr("graphicsAdapterGroupBox");
|
||||
} else if (elementName == "widthGroupBox") {
|
||||
text = tr("resolutionLayout");
|
||||
} else if (elementName == "heightGroupBox") {
|
||||
text = tr("resolutionLayout");
|
||||
} else if (elementName == "heightDivider") {
|
||||
text = tr("heightDivider");
|
||||
} else if (elementName == "dumpShadersCheckBox") {
|
||||
text = tr("dumpShadersCheckBox");
|
||||
} else if (elementName == "nullGpuCheckBox") {
|
||||
text = tr("nullGpuCheckBox");
|
||||
} else if (elementName == "dumpPM4CheckBox") {
|
||||
text = tr("dumpPM4CheckBox");
|
||||
}
|
||||
|
||||
// Debug
|
||||
if (elementName == "debugDump") {
|
||||
text = tr("debugDump");
|
||||
} else if (elementName == "vkValidationCheckBox") {
|
||||
text = tr("vkValidationCheckBox");
|
||||
} else if (elementName == "vkSyncValidationCheckBox") {
|
||||
text = tr("vkSyncValidationCheckBox");
|
||||
} else if (elementName == "rdocCheckBox") {
|
||||
text = tr("rdocCheckBox");
|
||||
}
|
||||
|
||||
ui->descriptionText->setText(text.replace("\\n", "\n"));
|
||||
}
|
||||
|
||||
bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) {
|
||||
if (event->type() == QEvent::Enter || event->type() == QEvent::Leave) {
|
||||
if (qobject_cast<QWidget*>(obj)) {
|
||||
bool hovered = (event->type() == QEvent::Enter);
|
||||
QString elementName = obj->objectName();
|
||||
|
||||
if (hovered) {
|
||||
updateNoteTextEdit(elementName);
|
||||
} else {
|
||||
ui->descriptionText->setText(defaultTextEdit);
|
||||
}
|
||||
|
||||
// if the text exceeds the size of the box, it will increase the size
|
||||
int documentHeight = ui->descriptionText->document()->size().height();
|
||||
int visibleHeight = ui->descriptionText->viewport()->height();
|
||||
if (documentHeight > visibleHeight) {
|
||||
ui->descriptionText->setMinimumHeight(90);
|
||||
} else {
|
||||
ui->descriptionText->setMinimumHeight(70);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue