pineapple/src/yuzu/configuration/configure_vibration.h

52 lines
1.2 KiB
C
Raw Normal View History

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