mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +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;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later -->
|
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ControlSettings</class>
|
<class>ControlSettings</class>
|
||||||
<widget class="QDialog" name="ControlSettings">
|
<widget class="QDialog" name="ControlSettings">
|
||||||
@ -11,8 +9,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1012</width>
|
<width>1043</width>
|
||||||
<height>721</height>
|
<height>822</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -24,44 +22,24 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QTabWidget" name="TabWidget">
|
||||||
<property name="frameShape">
|
<property name="currentIndex">
|
||||||
<enum>QFrame::Shape::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="widgetResizable">
|
<widget class="QWidget" name="RemapTab">
|
||||||
<bool>true</bool>
|
<attribute name="title">
|
||||||
</property>
|
<string>Controller Remapping</string>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
</attribute>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>10</x>
|
||||||
<y>0</y>
|
<y>10</y>
|
||||||
<width>994</width>
|
<width>1004</width>
|
||||||
<height>673</height>
|
<height>711</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<layout class="QHBoxLayout" name="RemapLayout">
|
||||||
<attribute name="title">
|
|
||||||
<string>Control Settings</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="mainLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="bottomLayout">
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_left">
|
<layout class="QVBoxLayout" name="verticalLayout_left">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -538,7 +516,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_middle" stretch="0,0,0,0">
|
<layout class="QVBoxLayout" name="verticalLayout_middle" stretch="0,0,0,0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -686,37 +664,27 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="layout_system_buttons">
|
<layout class="QVBoxLayout" name="layout_system_buttons">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>KBM Controls</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="KBMButton">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>KBM Editor</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -912,6 +880,167 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Color Adjustment</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="RLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>R: 000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="RSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>255</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="GLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>G: 000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="GSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>255</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="BLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>B: 255</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="BSlider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>255</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>255</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Override Lightbar Color</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="LightbarCheckBox">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Override Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="LightbarColorFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Shape::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Shadow::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -1354,8 +1483,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user