2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-10-17 15:38:12 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <memory>
|
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
class QGroupBox;
|
|
|
|
class QSpinBox;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ConfigureVibration;
|
|
|
|
}
|
|
|
|
|
2022-02-02 21:53:15 +01:00
|
|
|
namespace Core::HID {
|
|
|
|
enum class ControllerTriggerType;
|
|
|
|
class HIDCore;
|
|
|
|
} // namespace Core::HID
|
|
|
|
|
2020-10-17 15:38:12 +02:00
|
|
|
class ConfigureVibration : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-02-02 21:53:15 +01:00
|
|
|
explicit ConfigureVibration(QWidget* parent, Core::HID::HIDCore& hid_core_);
|
2020-10-17 15:38:12 +02:00
|
|
|
~ConfigureVibration() override;
|
|
|
|
|
|
|
|
void ApplyConfiguration();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void changeEvent(QEvent* event) override;
|
|
|
|
void RetranslateUI();
|
2022-02-02 21:53:15 +01:00
|
|
|
void VibrateController(Core::HID::ControllerTriggerType type, std::size_t player_index);
|
|
|
|
void StopVibrations();
|
2020-10-17 15:38:12 +02:00
|
|
|
|
|
|
|
std::unique_ptr<Ui::ConfigureVibration> ui;
|
|
|
|
|
|
|
|
static constexpr std::size_t NUM_PLAYERS = 8;
|
|
|
|
|
2022-02-02 21:53:15 +01:00
|
|
|
/// Groupboxes encapsulating the vibration strength spinbox.
|
2020-10-17 15:38:12 +02:00
|
|
|
std::array<QGroupBox*, NUM_PLAYERS> vibration_groupboxes;
|
|
|
|
|
2022-02-02 21:53:15 +01:00
|
|
|
/// Spinboxes representing the vibration strength percentage.
|
2020-10-17 15:38:12 +02:00
|
|
|
std::array<QSpinBox*, NUM_PLAYERS> vibration_spinboxes;
|
2022-02-02 21:53:15 +01:00
|
|
|
|
|
|
|
/// Callback index to stop the controllers events
|
|
|
|
std::array<int, NUM_PLAYERS> controller_callback_key;
|
|
|
|
|
|
|
|
Core::HID::HIDCore& hid_core;
|
2020-10-17 15:38:12 +02:00
|
|
|
};
|