mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-24 11:26:18 +00:00
Adding Top and Bottom trophy option for pop window + Trophy improvements (#2566)
* Adding top button option for trophy pop up * Ui fix * Clang format * improvements to trophy pr * improvements * Note: The sound will only work in QT versions * -. * Update path_util.cpp * Update path_util.cpp * centered text when using top and bottom option * Clang * trophy viewer now opens in window not fullscreen --------- Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
This commit is contained in:
parent
f4110c43a7
commit
d59536a71c
9 changed files with 158 additions and 36 deletions
|
@ -418,8 +418,14 @@ void SettingsDialog::LoadValuesFromConfig() {
|
|||
ui->disableTrophycheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "isTrophyPopupDisabled", false));
|
||||
ui->popUpDurationSpinBox->setValue(Config::getTrophyNotificationDuration());
|
||||
ui->radioButton_Left->setChecked(Config::leftSideTrophy());
|
||||
ui->radioButton_Right->setChecked(!ui->radioButton_Left->isChecked());
|
||||
|
||||
QString side = QString::fromStdString(Config::sideTrophy());
|
||||
|
||||
ui->radioButton_Left->setChecked(side == "left");
|
||||
ui->radioButton_Right->setChecked(side == "right");
|
||||
ui->radioButton_Top->setChecked(side == "top");
|
||||
ui->radioButton_Bottom->setChecked(side == "bottom");
|
||||
|
||||
ui->BGMVolumeSlider->setValue(toml::find_or<int>(data, "General", "BGMvolume", 50));
|
||||
ui->discordRPCCheckbox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "enableDiscordRPC", true));
|
||||
|
@ -612,7 +618,7 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
|
|||
|
||||
//User
|
||||
if (elementName == "OpenCustomTrophyLocationButton") {
|
||||
text = tr("Open the custom trophy images/sounds folder:\\nYou can add custom images to the trophies and an audio.\\nAdd the files to custom_trophy with the following names:\\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png");
|
||||
text = tr("Open the custom trophy images/sounds folder:\\nYou can add custom images to the trophies and an audio.\\nAdd the files to custom_trophy with the following names:\\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png\\nNote: The sound will only work in QT versions.");
|
||||
}
|
||||
|
||||
// Input
|
||||
|
@ -706,7 +712,17 @@ void SettingsDialog::UpdateSettings() {
|
|||
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked());
|
||||
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked());
|
||||
Config::setTrophyNotificationDuration(ui->popUpDurationSpinBox->value());
|
||||
Config::setLeftSideTrophy(ui->radioButton_Left->isChecked());
|
||||
|
||||
if (ui->radioButton_Top->isChecked()) {
|
||||
Config::setSideTrophy("top");
|
||||
} else if (ui->radioButton_Left->isChecked()) {
|
||||
Config::setSideTrophy("left");
|
||||
} else if (ui->radioButton_Right->isChecked()) {
|
||||
Config::setSideTrophy("right");
|
||||
} else if (ui->radioButton_Bottom->isChecked()) {
|
||||
Config::setSideTrophy("bottom");
|
||||
}
|
||||
|
||||
Config::setPlayBGM(ui->playBGMCheckBox->isChecked());
|
||||
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked());
|
||||
Config::setLogType(logTypeMap.value(ui->logTypeComboBox->currentText()).toStdString());
|
||||
|
|
|
@ -1295,17 +1295,25 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Right">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Top">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Bottom">
|
||||
<property name="text">
|
||||
<string>Bottom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -1632,8 +1632,8 @@
|
|||
<translation>Update Compatibility Database:\nImmediately update the compatibility database.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png</source>
|
||||
<translation>Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png</translation>
|
||||
<source>Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions.</source>
|
||||
<translation>Open the custom trophy images/sounds folder:\nYou can add custom images to the trophies and an audio.\nAdd the files to custom_trophy with the following names:\nthophy.mp3, bronze.png, gold.png, platinum.png, silver.png\nNote: The sound will only work in QT versions.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Never</source>
|
||||
|
@ -1839,6 +1839,14 @@
|
|||
<source>Right</source>
|
||||
<translation>Right</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation>Top</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation>Bottom</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Notification Duration</source>
|
||||
<translation>Notification Duration</translation>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QCheckBox>
|
||||
#include <QDockWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <cmrc/cmrc.hpp>
|
||||
#include <common/config.h>
|
||||
#include "common/path_util.h"
|
||||
|
@ -157,6 +158,15 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo
|
|||
// Adds the dock to the left area
|
||||
this->addDockWidget(Qt::LeftDockWidgetArea, trophyInfoDock);
|
||||
|
||||
expandButton = new QPushButton(">>", this);
|
||||
expandButton->setGeometry(80, 0, 27, 27);
|
||||
expandButton->hide();
|
||||
|
||||
connect(expandButton, &QPushButton::clicked, this, [this, trophyInfoDock] {
|
||||
trophyInfoDock->setVisible(true);
|
||||
expandButton->hide();
|
||||
});
|
||||
|
||||
// Connects checkbox signals to update trophy display
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(showEarnedCheck, &QCheckBox::stateChanged, this, &TrophyViewer::updateTableFilters);
|
||||
|
@ -173,6 +183,31 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo
|
|||
|
||||
updateTrophyInfo();
|
||||
updateTableFilters();
|
||||
|
||||
connect(trophyInfoDock, &QDockWidget::topLevelChanged, this, [this, trophyInfoDock] {
|
||||
if (!trophyInfoDock->isVisible()) {
|
||||
expandButton->show();
|
||||
}
|
||||
});
|
||||
|
||||
connect(trophyInfoDock, &QDockWidget::visibilityChanged, this, [this, trophyInfoDock] {
|
||||
if (!trophyInfoDock->isVisible()) {
|
||||
expandButton->show();
|
||||
} else {
|
||||
expandButton->hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TrophyViewer::onDockClosed() {
|
||||
if (!trophyInfoDock->isVisible()) {
|
||||
reopenButton->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TrophyViewer::reopenLeftDock() {
|
||||
trophyInfoDock->show();
|
||||
reopenButton->setVisible(false);
|
||||
}
|
||||
|
||||
void TrophyViewer::PopulateTrophyWidget(QString title) {
|
||||
|
@ -354,7 +389,10 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
tabWidget->addTab(tableWidget,
|
||||
tabName.insert(6, " ").replace(0, 1, tabName.at(0).toUpper()));
|
||||
|
||||
this->showMaximized();
|
||||
this->resize(width + 400, 720);
|
||||
QSize mainWindowSize = QApplication::activeWindow()->size();
|
||||
this->resize(mainWindowSize.width() * 0.8, mainWindowSize.height() * 0.8);
|
||||
this->show();
|
||||
|
||||
tableWidget->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed);
|
||||
tableWidget->setColumnWidth(3, 650);
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
#include <QDockWidget>
|
||||
#include <QFileInfoList>
|
||||
#include <QGraphicsBlurEffect>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -26,6 +29,8 @@ public:
|
|||
void updateTrophyInfo();
|
||||
|
||||
void updateTableFilters();
|
||||
void onDockClosed();
|
||||
void reopenLeftDock();
|
||||
|
||||
private:
|
||||
void PopulateTrophyWidget(QString title);
|
||||
|
@ -39,6 +44,9 @@ private:
|
|||
QCheckBox* showEarnedCheck;
|
||||
QCheckBox* showNotEarnedCheck;
|
||||
QCheckBox* showHiddenCheck;
|
||||
QPushButton* expandButton;
|
||||
QDockWidget* trophyInfoDock;
|
||||
QPushButton* reopenButton;
|
||||
|
||||
std::string GetTrpType(const QChar trp_) {
|
||||
switch (trp_.toLatin1()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue