mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 03:24:49 +00:00
QT: Various interface fixes (#2496)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* QT: Various interface fixes * fix close without saving * + * + using the save and close buttons, everything works fine, but when using the X button it doesn't work very well... * fix close (X) without saving
This commit is contained in:
parent
22ca57b1f2
commit
e1ae052185
5 changed files with 70 additions and 5 deletions
|
@ -26,8 +26,10 @@
|
|||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QXmlStreamReader>
|
||||
#include <common/logging/log.h>
|
||||
|
||||
#include "cheats_patches.h"
|
||||
#include "common/config.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/memory_patcher.h"
|
||||
#include "common/path_util.h"
|
||||
#include "core/module.h"
|
||||
|
@ -92,7 +94,7 @@ void CheatsPatches::setupUI() {
|
|||
gameVersionLabel->setAlignment(Qt::AlignLeft);
|
||||
gameInfoLayout->addWidget(gameVersionLabel);
|
||||
|
||||
if (m_gameSize.left(4) != "0.00") {
|
||||
if (Config::GetLoadGameSizeEnabled()) {
|
||||
QLabel* gameSizeLabel = new QLabel(tr("Size: ") + m_gameSize);
|
||||
gameSizeLabel->setAlignment(Qt::AlignLeft);
|
||||
gameInfoLayout->addWidget(gameSizeLabel);
|
||||
|
|
|
@ -84,7 +84,9 @@ public:
|
|||
copyMenu->addAction(copyName);
|
||||
copyMenu->addAction(copySerial);
|
||||
copyMenu->addAction(copyVersion);
|
||||
copyMenu->addAction(copySize);
|
||||
if (Config::GetLoadGameSizeEnabled()) {
|
||||
copyMenu->addAction(copySize);
|
||||
}
|
||||
copyMenu->addAction(copyNameAll);
|
||||
|
||||
menu.addMenu(copyMenu);
|
||||
|
@ -362,12 +364,18 @@ public:
|
|||
}
|
||||
|
||||
if (selected == copyNameAll) {
|
||||
QString GameSizeEnabled;
|
||||
if (Config::GetLoadGameSizeEnabled()) {
|
||||
GameSizeEnabled = " | Size:" + QString::fromStdString(m_games[itemID].size);
|
||||
}
|
||||
|
||||
QClipboard* clipboard = QGuiApplication::clipboard();
|
||||
QString combinedText = QString("Name:%1 | Serial:%2 | Version:%3 | Size:%4")
|
||||
QString combinedText = QString("Name:%1 | Serial:%2 | Version:%3%4")
|
||||
.arg(QString::fromStdString(m_games[itemID].name))
|
||||
.arg(QString::fromStdString(m_games[itemID].serial))
|
||||
.arg(QString::fromStdString(m_games[itemID].version))
|
||||
.arg(QString::fromStdString(m_games[itemID].size));
|
||||
.arg(GameSizeEnabled);
|
||||
|
||||
clipboard->setText(combinedText);
|
||||
}
|
||||
|
||||
|
|
|
@ -290,6 +290,27 @@ void MainWindow::CreateConnects() {
|
|||
connect(settingsDialog, &SettingsDialog::CompatibilityChanged, this,
|
||||
&MainWindow::RefreshGameTable);
|
||||
|
||||
connect(settingsDialog, &SettingsDialog::accepted, this, &MainWindow::RefreshGameTable);
|
||||
connect(settingsDialog, &SettingsDialog::rejected, this, &MainWindow::RefreshGameTable);
|
||||
connect(settingsDialog, &SettingsDialog::close, this, &MainWindow::RefreshGameTable);
|
||||
|
||||
connect(settingsDialog, &SettingsDialog::BackgroundOpacityChanged, this,
|
||||
[this](int opacity) {
|
||||
Config::setBackgroundImageOpacity(opacity);
|
||||
if (m_game_list_frame) {
|
||||
QTableWidgetItem* current = m_game_list_frame->GetCurrentItem();
|
||||
if (current) {
|
||||
m_game_list_frame->SetListBackgroundImage(current);
|
||||
}
|
||||
}
|
||||
if (m_game_grid_frame) {
|
||||
if (m_game_grid_frame->IsValidCellSelected()) {
|
||||
m_game_grid_frame->SetGridBackgroundImage(m_game_grid_frame->crtRow,
|
||||
m_game_grid_frame->crtColumn);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
settingsDialog->exec();
|
||||
});
|
||||
|
||||
|
@ -302,6 +323,10 @@ void MainWindow::CreateConnects() {
|
|||
connect(settingsDialog, &SettingsDialog::CompatibilityChanged, this,
|
||||
&MainWindow::RefreshGameTable);
|
||||
|
||||
connect(settingsDialog, &SettingsDialog::accepted, this, &MainWindow::RefreshGameTable);
|
||||
connect(settingsDialog, &SettingsDialog::rejected, this, &MainWindow::RefreshGameTable);
|
||||
connect(settingsDialog, &SettingsDialog::close, this, &MainWindow::RefreshGameTable);
|
||||
|
||||
connect(settingsDialog, &SettingsDialog::BackgroundOpacityChanged, this,
|
||||
[this](int opacity) {
|
||||
Config::setBackgroundImageOpacity(opacity);
|
||||
|
|
|
@ -63,6 +63,9 @@ QMap<QString, QString> logTypeMap;
|
|||
QMap<QString, QString> fullscreenModeMap;
|
||||
QMap<QString, QString> chooseHomeTabMap;
|
||||
|
||||
int backgroundImageOpacitySlider_backup;
|
||||
int bgm_volume_backup;
|
||||
|
||||
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
QWidget* parent)
|
||||
|
@ -115,6 +118,7 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this,
|
||||
[this, config_dir](QAbstractButton* button) {
|
||||
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
||||
is_saving = true;
|
||||
UpdateSettings();
|
||||
Config::save(config_dir / "config.toml");
|
||||
QWidget::close();
|
||||
|
@ -126,6 +130,10 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||
Config::save(config_dir / "config.toml");
|
||||
LoadValuesFromConfig();
|
||||
} else if (button == ui->buttonBox->button(QDialogButtonBox::Close)) {
|
||||
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
||||
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
|
||||
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
|
||||
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
|
||||
ResetInstallFolders();
|
||||
}
|
||||
if (Common::Log::IsActive()) {
|
||||
|
@ -197,6 +205,12 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||
|
||||
// Gui TAB
|
||||
{
|
||||
connect(ui->backgroundImageOpacitySlider, &QSlider::valueChanged, this,
|
||||
[this](int value) { emit BackgroundOpacityChanged(value); });
|
||||
|
||||
connect(ui->BGMVolumeSlider, &QSlider::valueChanged, this,
|
||||
[](int value) { BackgroundMusicPlayer::getInstance().setVolume(value); });
|
||||
|
||||
connect(ui->chooseHomeTabComboBox, &QComboBox::currentTextChanged, this,
|
||||
[](const QString& hometab) { Config::setChooseHomeTab(hometab.toStdString()); });
|
||||
|
||||
|
@ -330,6 +344,16 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::closeEvent(QCloseEvent* event) {
|
||||
if (!is_saving) {
|
||||
ui->backgroundImageOpacitySlider->setValue(backgroundImageOpacitySlider_backup);
|
||||
emit BackgroundOpacityChanged(backgroundImageOpacitySlider_backup);
|
||||
ui->BGMVolumeSlider->setValue(bgm_volume_backup);
|
||||
BackgroundMusicPlayer::getInstance().setVolume(bgm_volume_backup);
|
||||
}
|
||||
QDialog::closeEvent(event);
|
||||
}
|
||||
|
||||
void SettingsDialog::LoadValuesFromConfig() {
|
||||
|
||||
std::filesystem::path userdir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||
|
@ -460,6 +484,9 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||
ResetInstallFolders();
|
||||
ui->backgroundImageOpacitySlider->setValue(Config::getBackgroundImageOpacity());
|
||||
ui->showBackgroundImageCheckBox->setChecked(Config::getShowBackgroundImage());
|
||||
|
||||
backgroundImageOpacitySlider_backup = Config::getBackgroundImageOpacity();
|
||||
bgm_volume_backup = Config::getBGMvolume();
|
||||
}
|
||||
|
||||
void SettingsDialog::InitializeEmulatorLanguages() {
|
||||
|
|
|
@ -42,6 +42,7 @@ private:
|
|||
void InitializeEmulatorLanguages();
|
||||
void OnLanguageChanged(int index);
|
||||
void OnCursorStateChanged(s16 index);
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
std::unique_ptr<Ui::SettingsDialog> ui;
|
||||
|
||||
|
@ -50,4 +51,6 @@ private:
|
|||
QString defaultTextEdit;
|
||||
|
||||
int initialHeight;
|
||||
|
||||
bool is_saving = false;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue