2017-05-23 16:08:53 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QKeyEvent>
|
2018-01-10 16:24:21 +00:00
|
|
|
#include <chrono>
|
|
|
|
#include <thread>
|
2017-05-23 16:08:53 +01:00
|
|
|
#include "ui_unix/PH_HidUnix.h"
|
|
|
|
|
2017-06-13 04:51:38 +01:00
|
|
|
#include "GamePad/GamePadInputEventListener.h"
|
|
|
|
#include "GamePad/GamePadDeviceListener.h"
|
|
|
|
|
2017-05-23 16:08:53 +01:00
|
|
|
namespace Ui {
|
2018-01-10 16:24:21 +00:00
|
|
|
class InputEventSelectionDialog;
|
2017-05-23 16:08:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
class InputEventSelectionDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-06-13 04:51:38 +01:00
|
|
|
explicit InputEventSelectionDialog(QWidget *parent = 0);
|
2017-05-23 16:08:53 +01:00
|
|
|
~InputEventSelectionDialog();
|
|
|
|
|
2017-06-13 04:51:38 +01:00
|
|
|
void Setup(const char *text, CInputBindingManager *inputManager, PS2::CControllerInfo::BUTTON button, const std::unique_ptr<CGamePadDeviceListener> &GPDL);
|
2017-05-23 16:08:53 +01:00
|
|
|
|
|
|
|
protected:
|
2017-06-13 04:51:38 +01:00
|
|
|
void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
|
2018-01-10 16:24:21 +00:00
|
|
|
void keyReleaseEvent(QKeyEvent*) Q_DECL_OVERRIDE;
|
2017-05-23 16:08:53 +01:00
|
|
|
|
|
|
|
private:
|
2018-01-10 16:24:21 +00:00
|
|
|
struct BINDINGINFOEXTENDED : CInputBindingManager::BINDINGINFO
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
CInputBindingManager::BINDINGTYPE bindtype;
|
|
|
|
};
|
|
|
|
void CountDownThreadLoop();
|
|
|
|
bool setCounter(int);
|
2017-06-13 04:51:38 +01:00
|
|
|
int click_count = 0;
|
2018-01-10 16:24:21 +00:00
|
|
|
QString m_bindingtext = QString("Select new binding for\n%1");
|
|
|
|
QString m_countingtext = QString("Press & Hold Button for %1 Seconds to assign key");
|
2017-06-13 04:51:38 +01:00
|
|
|
PS2::CControllerInfo::BUTTON m_button;
|
2018-01-10 16:24:21 +00:00
|
|
|
BINDINGINFOEXTENDED m_key1;
|
|
|
|
CInputBindingManager::BINDINGINFO m_key2;
|
2017-06-13 04:51:38 +01:00
|
|
|
CInputBindingManager *m_inputManager;
|
|
|
|
Ui::InputEventSelectionDialog *ui;
|
2018-01-10 16:24:21 +00:00
|
|
|
std::chrono::time_point<std::chrono::system_clock> m_countStart = std::chrono::system_clock::now();
|
|
|
|
std::thread m_thread;
|
|
|
|
std::atomic<bool> m_running;
|
|
|
|
std::atomic<bool> m_isCounting;
|
|
|
|
|
2018-01-10 15:45:33 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void setSelectedButtonLabelText(QString);
|
|
|
|
void setCountDownLabelText(QString);
|
2017-05-23 16:08:53 +01:00
|
|
|
};
|