mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 09:20:18 +00:00
Cleanup
This commit is contained in:
parent
82c1cf5f69
commit
87041056be
@ -1,8 +1,9 @@
|
|||||||
// Copyright 2014 Citra Emulator Project
|
// Copyright 2014 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
@ -10,12 +10,6 @@
|
|||||||
<height>501</height>
|
<height>501</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>441</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Citra Configuration</string>
|
<string>Citra Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2016 Citra Emulator Project
|
// Copyright 2016 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
ConfigureInput::ConfigureInput(QWidget* parent) :
|
ConfigureInput::ConfigureInput(QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::ConfigureInput)
|
ui(new Ui::ConfigureInput){
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
// Initialize mapping of input enum to UI button.
|
// Initialize mapping of input enum to UI button.
|
||||||
@ -52,13 +51,11 @@ ConfigureInput::ConfigureInput(QWidget* parent) :
|
|||||||
this->setConfiguration();
|
this->setConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureInput::~ConfigureInput()
|
ConfigureInput::~ConfigureInput(){
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Event handler for all button released() event.
|
/// Event handler for all button released() event.
|
||||||
void ConfigureInput::handleClick()
|
void ConfigureInput::handleClick(){
|
||||||
{
|
|
||||||
QPushButton* sender = qobject_cast<QPushButton*>(QObject::sender());
|
QPushButton* sender = qobject_cast<QPushButton*>(QObject::sender());
|
||||||
previous_mapping = sender->text();
|
previous_mapping = sender->text();
|
||||||
sender->setText(tr("[waiting]"));
|
sender->setText(tr("[waiting]"));
|
||||||
@ -70,8 +67,7 @@ void ConfigureInput::handleClick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Save all button configurations to settings file
|
/// Save all button configurations to settings file
|
||||||
void ConfigureInput::applyConfiguration()
|
void ConfigureInput::applyConfiguration(){
|
||||||
{
|
|
||||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
||||||
int value = getKeyValue(input_mapping[Settings::NativeInput::Values(i)]->text());
|
int value = getKeyValue(input_mapping[Settings::NativeInput::Values(i)]->text());
|
||||||
Settings::values.input_mappings[Settings::NativeInput::All[i]] = value;
|
Settings::values.input_mappings[Settings::NativeInput::All[i]] = value;
|
||||||
@ -80,8 +76,7 @@ void ConfigureInput::applyConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Load configuration settings into button text
|
/// Load configuration settings into button text
|
||||||
void ConfigureInput::setConfiguration()
|
void ConfigureInput::setConfiguration(){
|
||||||
{
|
|
||||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
||||||
QString keyValue = getKeyName(Settings::values.input_mappings[i]);
|
QString keyValue = getKeyName(Settings::values.input_mappings[i]);
|
||||||
input_mapping[Settings::NativeInput::Values(i)]->setText(keyValue);
|
input_mapping[Settings::NativeInput::Values(i)]->setText(keyValue);
|
||||||
@ -89,8 +84,7 @@ void ConfigureInput::setConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handle key press event for input tab when a button is 'waiting'.
|
/// Handle key press event for input tab when a button is 'waiting'.
|
||||||
void ConfigureInput::keyPressEvent(QKeyEvent* event)
|
void ConfigureInput::keyPressEvent(QKeyEvent* event){
|
||||||
{
|
|
||||||
if (changing_button != nullptr && event->key() != Qt::Key_unknown)
|
if (changing_button != nullptr && event->key() != Qt::Key_unknown)
|
||||||
{
|
{
|
||||||
key_pressed = event->key();
|
key_pressed = event->key();
|
||||||
@ -100,8 +94,7 @@ void ConfigureInput::keyPressEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set button text to name of key pressed.
|
/// Set button text to name of key pressed.
|
||||||
void ConfigureInput::setKey()
|
void ConfigureInput::setKey(){
|
||||||
{
|
|
||||||
QString key_value = getKeyName(key_pressed);
|
QString key_value = getKeyName(key_pressed);
|
||||||
if (key_pressed == Qt::Key_Escape)
|
if (key_pressed == Qt::Key_Escape)
|
||||||
changing_button->setText(previous_mapping);
|
changing_button->setText(previous_mapping);
|
||||||
@ -116,8 +109,7 @@ void ConfigureInput::setKey()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert key ASCII value to its' letter/name
|
/// Convert key ASCII value to its' letter/name
|
||||||
QString ConfigureInput::getKeyName(int key_code) const
|
QString ConfigureInput::getKeyName(int key_code) const{
|
||||||
{
|
|
||||||
if (key_code == Qt::Key_Shift)
|
if (key_code == Qt::Key_Shift)
|
||||||
return tr("Shift");
|
return tr("Shift");
|
||||||
|
|
||||||
@ -137,8 +129,7 @@ QString ConfigureInput::getKeyName(int key_code) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert letter/name of key to its ASCII value.
|
/// Convert letter/name of key to its ASCII value.
|
||||||
Qt::Key ConfigureInput::getKeyValue(const QString& text) const
|
Qt::Key ConfigureInput::getKeyValue(const QString& text) const{
|
||||||
{
|
|
||||||
if (text == "Shift")
|
if (text == "Shift")
|
||||||
return Qt::Key_Shift;
|
return Qt::Key_Shift;
|
||||||
if (text == "Ctrl")
|
if (text == "Ctrl")
|
||||||
@ -153,8 +144,7 @@ Qt::Key ConfigureInput::getKeyValue(const QString& text) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check all inputs for duplicate keys. Clears out any other button with same key as new button.
|
/// Check all inputs for duplicate keys. Clears out any other button with same key as new button.
|
||||||
void ConfigureInput::removeDuplicates(const QString& newValue)
|
void ConfigureInput::removeDuplicates(const QString& newValue){
|
||||||
{
|
|
||||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS - 1; ++i) {
|
||||||
if (changing_button != input_mapping[Settings::NativeInput::Values(i)]) {
|
if (changing_button != input_mapping[Settings::NativeInput::Values(i)]) {
|
||||||
QString oldValue = input_mapping[Settings::NativeInput::Values(i)]->text();
|
QString oldValue = input_mapping[Settings::NativeInput::Values(i)]->text();
|
||||||
|
Loading…
Reference in New Issue
Block a user