This commit is contained in:
Steven Cherry 2016-06-23 07:00:07 -05:00 committed by Anon
parent ce63acecf8
commit 4ddb494072
2 changed files with 6 additions and 4 deletions

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <utility> #include <utility>
#include <QTimer>
#include "citra_qt/configure_input.h" #include "citra_qt/configure_input.h"
@ -45,6 +46,7 @@ ConfigureInput::ConfigureInput(QWidget* parent) :
} }
connect(ui->btnRestoreDefaults, SIGNAL(released()), this, SLOT(restoreDefaults())); connect(ui->btnRestoreDefaults, SIGNAL(released()), this, SLOT(restoreDefaults()));
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
timer = new QTimer(this);
timer->setSingleShot(true); timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, [&]() { key_pressed = Qt::Key_Escape; setKey(); }); connect(timer, &QTimer::timeout, this, [&]() { key_pressed = Qt::Key_Escape; setKey(); });
this->setConfiguration(); this->setConfiguration();

View File

@ -7,7 +7,6 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QTimer>
#include "citra_qt/config.h" #include "citra_qt/config.h"
#include "core/settings.h" #include "core/settings.h"
@ -15,6 +14,7 @@
class QPushButton; class QPushButton;
class QString; class QString;
class QTimer;
namespace Ui { namespace Ui {
class ConfigureInput; class ConfigureInput;
@ -35,15 +35,15 @@ private:
int key_pressed; int key_pressed;
QPushButton* changing_button = nullptr; /// button currently waiting for key press. QPushButton* changing_button = nullptr; /// button currently waiting for key press.
QString previous_mapping; QString previous_mapping;
QTimer* timer = new QTimer(this); QTimer* timer;
void setConfiguration(); void setConfiguration();
void removeDuplicates(const QString& newValue); void removeDuplicates(const QString& newValue);
void keyPressEvent(QKeyEvent* event) override; void keyPressEvent(QKeyEvent* event) override;
QString getKeyName(int key_code) const; QString getKeyName(int key_code) const;
Qt::Key getKeyValue(const QString& text) const; Qt::Key getKeyValue(const QString& text) const;
void setKey(); void setKey();
private Q_SLOTS: private Q_SLOTS:
void handleClick(); void handleClick();
void restoreDefaults(); void restoreDefaults();
}; };