mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
WIP Lightbar GUI, needs saving and loading
This commit is contained in:
parent
32763b7af6
commit
055c456b10
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QPushButton>
|
||||||
#include "common/path_util.h"
|
#include "common/path_util.h"
|
||||||
#include "control_settings.h"
|
#include "control_settings.h"
|
||||||
#include "kbm_config_dialog.h"
|
|
||||||
#include "ui_control_settings.h"
|
#include "ui_control_settings.h"
|
||||||
|
|
||||||
ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget* parent)
|
||||||
@ -16,7 +16,7 @@ ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, Q
|
|||||||
|
|
||||||
AddBoxItems();
|
AddBoxItems();
|
||||||
SetUIValuestoMappings();
|
SetUIValuestoMappings();
|
||||||
ui->KBMButton->setFocus();
|
UpdateLightbarColor();
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, [this](QAbstractButton* button) {
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, [this](QAbstractButton* button) {
|
||||||
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
if (button == ui->buttonBox->button(QDialogButtonBox::Save)) {
|
||||||
@ -29,11 +29,7 @@ ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, Q
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
|
||||||
connect(ui->KBMButton, &QPushButton::clicked, this, [this] {
|
|
||||||
auto KBMWindow = new EditorDialog(this);
|
|
||||||
KBMWindow->exec();
|
|
||||||
SetUIValuestoMappings();
|
|
||||||
});
|
|
||||||
connect(ui->ProfileComboBox, &QComboBox::currentTextChanged, this, [this] {
|
connect(ui->ProfileComboBox, &QComboBox::currentTextChanged, this, [this] {
|
||||||
GetGameTitle();
|
GetGameTitle();
|
||||||
SetUIValuestoMappings();
|
SetUIValuestoMappings();
|
||||||
@ -61,6 +57,27 @@ ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, Q
|
|||||||
[this](int value) { ui->RStickLeftBox->setCurrentIndex(value); });
|
[this](int value) { ui->RStickLeftBox->setCurrentIndex(value); });
|
||||||
connect(ui->RStickLeftBox, &QComboBox::currentIndexChanged, this,
|
connect(ui->RStickLeftBox, &QComboBox::currentIndexChanged, this,
|
||||||
[this](int value) { ui->RStickRightBox->setCurrentIndex(value); });
|
[this](int value) { ui->RStickRightBox->setCurrentIndex(value); });
|
||||||
|
|
||||||
|
connect(ui->RSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||||
|
QString RedValue = QString("%1").arg(value, 3, 10, QChar('0'));
|
||||||
|
QString RValue = "R: " + RedValue;
|
||||||
|
ui->RLabel->setText(RValue);
|
||||||
|
UpdateLightbarColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->GSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||||
|
QString GreenValue = QString("%1").arg(value, 3, 10, QChar('0'));
|
||||||
|
QString GValue = "G: " + GreenValue;
|
||||||
|
ui->GLabel->setText(GValue);
|
||||||
|
UpdateLightbarColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->BSlider, &QSlider::valueChanged, this, [this](int value) {
|
||||||
|
QString BlueValue = QString("%1").arg(value, 3, 10, QChar('0'));
|
||||||
|
QString BValue = "B: " + BlueValue;
|
||||||
|
ui->BLabel->setText(BValue);
|
||||||
|
UpdateLightbarColor();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
||||||
@ -507,4 +524,13 @@ void ControlSettings::GetGameTitle() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControlSettings::UpdateLightbarColor() {
|
||||||
|
ui->LightbarColorFrame->setStyleSheet("");
|
||||||
|
QString RValue = QString::number(ui->RSlider->value());
|
||||||
|
QString GValue = QString::number(ui->GSlider->value());
|
||||||
|
QString BValue = QString::number(ui->BSlider->value());
|
||||||
|
QString colorstring = "background-color: rgb(" + RValue + "," + GValue + "," + BValue + ")";
|
||||||
|
ui->LightbarColorFrame->setStyleSheet(colorstring);
|
||||||
|
}
|
||||||
|
|
||||||
ControlSettings::~ControlSettings() {}
|
ControlSettings::~ControlSettings() {}
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void SaveControllerConfig(bool CloseOnSave);
|
void SaveControllerConfig(bool CloseOnSave);
|
||||||
void SetDefault();
|
void SetDefault();
|
||||||
|
void UpdateLightbarColor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ControlSettings> ui;
|
std::unique_ptr<Ui::ControlSettings> ui;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user