Merge pull request #9070 from Techjar/default-input-profiles
Add support for built-in input profiles
This commit is contained in:
commit
3348e63d1d
|
@ -0,0 +1,72 @@
|
|||
[Profile]
|
||||
Device = Bluetooth/0/Wii Remote
|
||||
Buttons/A = `A`
|
||||
Buttons/B = `B`
|
||||
Buttons/1 = `1`
|
||||
Buttons/2 = `2`
|
||||
Buttons/- = `-`
|
||||
Buttons/+ = `+`
|
||||
Buttons/Home = `HOME`
|
||||
IMUAccelerometer/Up = `Accel Up`
|
||||
IMUAccelerometer/Down = `Accel Down`
|
||||
IMUAccelerometer/Left = `Accel Left`
|
||||
IMUAccelerometer/Right = `Accel Right`
|
||||
IMUAccelerometer/Forward = `Accel Forward`
|
||||
IMUAccelerometer/Backward = `Accel Backward`
|
||||
IMUGyroscope/Dead Zone = 3
|
||||
IMUGyroscope/Pitch Up = `Gyro Pitch Up`
|
||||
IMUGyroscope/Pitch Down = `Gyro Pitch Down`
|
||||
IMUGyroscope/Roll Left = `Gyro Roll Left`
|
||||
IMUGyroscope/Roll Right = `Gyro Roll Right`
|
||||
IMUGyroscope/Yaw Left = `Gyro Yaw Left`
|
||||
IMUGyroscope/Yaw Right = `Gyro Yaw Right`
|
||||
IMUIR/Enabled = True
|
||||
IMUIR/Total Yaw = 20
|
||||
Extension/Attach MotionPlus = `Attached MotionPlus`
|
||||
Extension = `Attached Extension`
|
||||
Nunchuk/Buttons/C = `Nunchuk C`
|
||||
Nunchuk/Buttons/Z = `Nunchuk Z`
|
||||
Nunchuk/Stick/Up = `Nunchuk Y+`
|
||||
Nunchuk/Stick/Down = `Nunchuk Y-`
|
||||
Nunchuk/Stick/Left = `Nunchuk X-`
|
||||
Nunchuk/Stick/Right = `Nunchuk X+`
|
||||
Nunchuk/Stick/Calibration = 100 100 100 100 100 100 100 100
|
||||
Nunchuk/IMUAccelerometer/Up = `Nunchuk Accel Up`
|
||||
Nunchuk/IMUAccelerometer/Down = `Nunchuk Accel Down`
|
||||
Nunchuk/IMUAccelerometer/Left = `Nunchuk Accel Left`
|
||||
Nunchuk/IMUAccelerometer/Right = `Nunchuk Accel Right`
|
||||
Nunchuk/IMUAccelerometer/Forward = `Nunchuk Accel Forward`
|
||||
Nunchuk/IMUAccelerometer/Backward = `Nunchuk Accel Backward`
|
||||
Classic/Buttons/A = `Classic A`
|
||||
Classic/Buttons/B = `Classic B`
|
||||
Classic/Buttons/X = `Classic X`
|
||||
Classic/Buttons/Y = `Classic Y`
|
||||
Classic/Buttons/ZL = `Classic ZL`
|
||||
Classic/Buttons/ZR = `Classic ZR`
|
||||
Classic/Buttons/- = `Classic -`
|
||||
Classic/Buttons/+ = `Classic +`
|
||||
Classic/Buttons/Home = `Classic HOME`
|
||||
Classic/Left Stick/Up = `Classic Left Y+`
|
||||
Classic/Left Stick/Down = `Classic Left Y-`
|
||||
Classic/Left Stick/Left = `Classic Left X-`
|
||||
Classic/Left Stick/Right = `Classic Left X+`
|
||||
Classic/Left Stick/Calibration = 100 100 100 100 100 100 100 100
|
||||
Classic/Right Stick/Up = `Classic Right Y+`
|
||||
Classic/Right Stick/Down = `Classic Right Y-`
|
||||
Classic/Right Stick/Left = `Classic Right X-`
|
||||
Classic/Right Stick/Right = `Classic Right X+`
|
||||
Classic/Right Stick/Calibration = 100 100 100 100 100 100 100 100
|
||||
Classic/Triggers/L = `Classic L`
|
||||
Classic/Triggers/R = `Classic R`
|
||||
Classic/Triggers/L-Analog = `Classic L-Analog`
|
||||
Classic/Triggers/R-Analog = `Classic R-Analog`
|
||||
Classic/D-Pad/Up = `Classic Up`
|
||||
Classic/D-Pad/Down = `Classic Down`
|
||||
Classic/D-Pad/Left = `Classic Left`
|
||||
Classic/D-Pad/Right = `Classic Right`
|
||||
Rumble/Motor = `Motor`
|
||||
D-Pad/Up = `Up`
|
||||
D-Pad/Down = `Down`
|
||||
D-Pad/Left = `Left`
|
||||
D-Pad/Right = `Right`
|
||||
Options/Battery = `Battery`
|
|
@ -164,6 +164,11 @@ void MappingWindow::ConnectWidgets()
|
|||
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
|
||||
connect(m_profiles_delete, &QPushButton::clicked, this, &MappingWindow::OnDeleteProfilePressed);
|
||||
|
||||
connect(m_profiles_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&MappingWindow::OnSelectProfile);
|
||||
connect(m_profiles_combo, &QComboBox::editTextChanged, this,
|
||||
&MappingWindow::OnProfileTextChanged);
|
||||
|
||||
// We currently use the "Close" button as an "Accept" button so we must save on reject.
|
||||
connect(this, &QDialog::rejected, [this] { emit Save(); });
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
@ -181,6 +186,31 @@ void MappingWindow::UpdateProfileIndex()
|
|||
m_profiles_combo->setCurrentText(current_text);
|
||||
}
|
||||
|
||||
void MappingWindow::UpdateProfileButtonState()
|
||||
{
|
||||
// Make sure save/delete buttons are disabled for built-in profiles
|
||||
|
||||
bool builtin = false;
|
||||
if (m_profiles_combo->findText(m_profiles_combo->currentText()) != -1)
|
||||
{
|
||||
const QString profile_path = m_profiles_combo->currentData().toString();
|
||||
builtin = profile_path.startsWith(QString::fromStdString(File::GetSysDirectory()));
|
||||
}
|
||||
|
||||
m_profiles_save->setEnabled(!builtin);
|
||||
m_profiles_delete->setEnabled(!builtin);
|
||||
}
|
||||
|
||||
void MappingWindow::OnSelectProfile(int)
|
||||
{
|
||||
UpdateProfileButtonState();
|
||||
}
|
||||
|
||||
void MappingWindow::OnProfileTextChanged(const QString&)
|
||||
{
|
||||
UpdateProfileButtonState();
|
||||
}
|
||||
|
||||
void MappingWindow::OnDeleteProfilePressed()
|
||||
{
|
||||
UpdateProfileIndex();
|
||||
|
@ -268,7 +298,10 @@ void MappingWindow::OnSaveProfilePressed()
|
|||
ini.Save(profile_path);
|
||||
|
||||
if (m_profiles_combo->findText(profile_name) == -1)
|
||||
m_profiles_combo->addItem(profile_name, QString::fromStdString(profile_path));
|
||||
{
|
||||
PopulateProfileSelection();
|
||||
m_profiles_combo->setCurrentIndex(m_profiles_combo->findText(profile_name));
|
||||
}
|
||||
}
|
||||
|
||||
void MappingWindow::OnSelectDevice(int)
|
||||
|
@ -405,6 +438,13 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
|
|||
|
||||
m_controller = m_config->GetController(GetPort());
|
||||
|
||||
PopulateProfileSelection();
|
||||
}
|
||||
|
||||
void MappingWindow::PopulateProfileSelection()
|
||||
{
|
||||
m_profiles_combo->clear();
|
||||
|
||||
const std::string profiles_path =
|
||||
File::GetUserPath(D_CONFIG_IDX) + PROFILES_DIR + m_config->GetProfileName();
|
||||
for (const auto& filename : Common::DoFileSearch({profiles_path}, {".ini"}))
|
||||
|
@ -413,6 +453,20 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
|
|||
SplitPath(filename, nullptr, &basename, nullptr);
|
||||
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
|
||||
}
|
||||
|
||||
m_profiles_combo->insertSeparator(m_profiles_combo->count());
|
||||
|
||||
const std::string builtin_profiles_path =
|
||||
File::GetSysDirectory() + PROFILES_DIR + m_config->GetProfileName();
|
||||
for (const auto& filename : Common::DoFileSearch({builtin_profiles_path}, {".ini"}))
|
||||
{
|
||||
std::string basename;
|
||||
SplitPath(filename, nullptr, &basename, nullptr);
|
||||
// i18n: "Stock" refers to input profiles included with Dolphin
|
||||
m_profiles_combo->addItem(tr("%1 (Stock)").arg(QString::fromStdString(basename)),
|
||||
QString::fromStdString(filename));
|
||||
}
|
||||
|
||||
m_profiles_combo->setCurrentIndex(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,14 @@ private:
|
|||
|
||||
void RefreshDevices();
|
||||
|
||||
void OnSelectProfile(int index);
|
||||
void OnProfileTextChanged(const QString& text);
|
||||
void OnDeleteProfilePressed();
|
||||
void OnLoadProfilePressed();
|
||||
void OnSaveProfilePressed();
|
||||
void UpdateProfileIndex();
|
||||
void UpdateProfileButtonState();
|
||||
void PopulateProfileSelection();
|
||||
|
||||
void OnDefaultFieldsPressed();
|
||||
void OnClearFieldsPressed();
|
||||
|
|
Loading…
Reference in New Issue