2018-11-02 03:07:46 +01:00
|
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2018-11-03 17:55:39 +01:00
|
|
|
|
#include <optional>
|
2018-11-02 03:07:46 +01:00
|
|
|
|
#include <QDialog>
|
2018-11-27 11:00:56 +01:00
|
|
|
|
|
2018-11-02 03:07:46 +01:00
|
|
|
|
#include "core/settings.h"
|
|
|
|
|
|
|
|
|
|
class QCheckBox;
|
|
|
|
|
class QPushButton;
|
|
|
|
|
class QTimer;
|
|
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
class ConfigureMouseAdvanced;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ConfigureMouseAdvanced : public QDialog {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit ConfigureMouseAdvanced(QWidget* parent);
|
2018-11-04 16:18:59 +01:00
|
|
|
|
~ConfigureMouseAdvanced() override;
|
2018-11-02 03:07:46 +01:00
|
|
|
|
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void ApplyConfiguration();
|
2018-11-02 03:07:46 +01:00
|
|
|
|
|
|
|
|
|
private:
|
2019-06-06 00:39:46 +02:00
|
|
|
|
void changeEvent(QEvent* event) override;
|
|
|
|
|
void RetranslateUI();
|
|
|
|
|
|
2018-11-02 03:07:46 +01:00
|
|
|
|
/// Load configuration settings.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void LoadConfiguration();
|
2018-11-02 03:07:46 +01:00
|
|
|
|
/// Restore all buttons to their default values.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void RestoreDefaults();
|
2018-11-02 03:07:46 +01:00
|
|
|
|
/// Clear all input configuration
|
|
|
|
|
void ClearAll();
|
|
|
|
|
|
|
|
|
|
/// Update UI to reflect current configuration.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void UpdateButtonLabels();
|
2018-11-02 03:07:46 +01:00
|
|
|
|
|
|
|
|
|
/// Called when the button was pressed.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void HandleClick(QPushButton* button,
|
2018-11-02 03:07:46 +01:00
|
|
|
|
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
|
|
|
|
InputCommon::Polling::DeviceType type);
|
|
|
|
|
|
|
|
|
|
/// Finish polling and configure input using the input_setter
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void SetPollingResult(const Common::ParamPackage& params, bool abort);
|
2018-11-02 03:07:46 +01:00
|
|
|
|
|
|
|
|
|
/// Handle key press events.
|
|
|
|
|
void keyPressEvent(QKeyEvent* event) override;
|
2018-11-27 11:02:12 +01:00
|
|
|
|
|
|
|
|
|
std::unique_ptr<Ui::ConfigureMouseAdvanced> ui;
|
|
|
|
|
|
|
|
|
|
/// This will be the the setting function when an input is awaiting configuration.
|
|
|
|
|
std::optional<std::function<void(const Common::ParamPackage&)>> input_setter;
|
|
|
|
|
|
|
|
|
|
std::array<QPushButton*, Settings::NativeMouseButton::NumMouseButtons> button_map;
|
|
|
|
|
std::array<Common::ParamPackage, Settings::NativeMouseButton::NumMouseButtons> buttons_param;
|
|
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> device_pollers;
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<QTimer> timeout_timer;
|
|
|
|
|
std::unique_ptr<QTimer> poll_timer;
|
|
|
|
|
|
|
|
|
|
/// A flag to indicate if keyboard keys are okay when configuring an input. If this is false,
|
|
|
|
|
/// keyboard events are ignored.
|
|
|
|
|
bool want_keyboard_keys = false;
|
2018-11-02 03:07:46 +01:00
|
|
|
|
};
|