Remove unused and bitrotted "controller config" files
This commit is contained in:
parent
63557e3fc1
commit
3a4a424b70
|
@ -2,8 +2,6 @@ set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
config/controller_config.cpp
|
|
||||||
config/controller_config_util.cpp
|
|
||||||
config.cpp
|
config.cpp
|
||||||
debugger/callstack.cpp
|
debugger/callstack.cpp
|
||||||
debugger/disassembler.cpp
|
debugger/disassembler.cpp
|
||||||
|
@ -33,8 +31,6 @@ set(SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
config/controller_config.h
|
|
||||||
config/controller_config_util.h
|
|
||||||
config.h
|
config.h
|
||||||
debugger/callstack.h
|
debugger/callstack.h
|
||||||
debugger/disassembler.h
|
debugger/disassembler.h
|
||||||
|
@ -65,7 +61,6 @@ set(HEADERS
|
||||||
)
|
)
|
||||||
|
|
||||||
set(UIS
|
set(UIS
|
||||||
config/controller_config.ui
|
|
||||||
debugger/callstack.ui
|
debugger/callstack.ui
|
||||||
debugger/disassembler.ui
|
debugger/disassembler.ui
|
||||||
debugger/profiler.ui
|
debugger/profiler.ui
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
// Copyright 2014 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
|
|
||||||
#include "controller_config.h"
|
|
||||||
#include "controller_config_util.h"
|
|
||||||
|
|
||||||
/* TODO(bunnei): ImplementMe
|
|
||||||
|
|
||||||
using common::Config;
|
|
||||||
|
|
||||||
GControllerConfig::GControllerConfig(common::Config::ControllerPort* initial_config, QWidget* parent) : QWidget(parent)
|
|
||||||
{
|
|
||||||
ui.setupUi(this);
|
|
||||||
((QGridLayout*)ui.mainStickTab->layout())->addWidget(new GStickConfig(Config::ANALOG_LEFT, Config::ANALOG_RIGHT, Config::ANALOG_UP, Config::ANALOG_DOWN, this, this), 1, 1);
|
|
||||||
((QGridLayout*)ui.cStickTab->layout())->addWidget(new GStickConfig(Config::C_LEFT, Config::C_RIGHT, Config::C_UP, Config::C_DOWN, this, this), 1, 1);
|
|
||||||
((QGridLayout*)ui.dPadTab->layout())->addWidget(new GStickConfig(Config::DPAD_LEFT, Config::DPAD_RIGHT, Config::DPAD_UP, Config::DPAD_DOWN, this, this), 1, 1);
|
|
||||||
|
|
||||||
// TODO: Arrange these more compactly?
|
|
||||||
QVBoxLayout* layout = (QVBoxLayout*)ui.buttonsTab->layout();
|
|
||||||
layout->addWidget(new GButtonConfigGroup("A Button", Config::BUTTON_A, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("B Button", Config::BUTTON_B, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("X Button", Config::BUTTON_X, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("Y Button", Config::BUTTON_Y, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("Z Button", Config::BUTTON_Z, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("L Trigger", Config::TRIGGER_L, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("R Trigger", Config::TRIGGER_R, this, ui.buttonsTab));
|
|
||||||
layout->addWidget(new GButtonConfigGroup("Start Button", Config::BUTTON_START, this, ui.buttonsTab));
|
|
||||||
|
|
||||||
memcpy(config, initial_config, sizeof(config));
|
|
||||||
|
|
||||||
emit ActivePortChanged(config[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GControllerConfig::OnKeyConfigChanged(common::Config::Control id, int key, const QString& name)
|
|
||||||
{
|
|
||||||
if (InputSourceJoypad())
|
|
||||||
{
|
|
||||||
config[GetActiveController()].pads.key_code[id] = key;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
config[GetActiveController()].keys.key_code[id] = key;
|
|
||||||
}
|
|
||||||
emit ActivePortChanged(config[GetActiveController()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GControllerConfig::GetActiveController()
|
|
||||||
{
|
|
||||||
return ui.activeControllerCB->currentIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GControllerConfig::InputSourceJoypad()
|
|
||||||
{
|
|
||||||
return ui.inputSourceCB->currentIndex() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
GControllerConfigDialog::GControllerConfigDialog(common::Config::ControllerPort* controller_ports, QWidget* parent) : QDialog(parent), config_ptr(controller_ports)
|
|
||||||
{
|
|
||||||
setWindowTitle(tr("Input configuration"));
|
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
||||||
config_widget = new GControllerConfig(controller_ports, this);
|
|
||||||
layout->addWidget(config_widget);
|
|
||||||
|
|
||||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
||||||
layout->addWidget(buttons);
|
|
||||||
|
|
||||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
|
||||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
|
||||||
|
|
||||||
connect(this, SIGNAL(accepted()), this, SLOT(EnableChanges()));
|
|
||||||
|
|
||||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
|
||||||
setLayout(layout);
|
|
||||||
setModal(true);
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GControllerConfigDialog::EnableChanges()
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < 4; ++i)
|
|
||||||
{
|
|
||||||
memcpy(&config_ptr[i], &config_widget->GetControllerConfig(i), sizeof(common::Config::ControllerPort));
|
|
||||||
|
|
||||||
if (common::g_config) {
|
|
||||||
// Apply changes if running a game
|
|
||||||
memcpy(&common::g_config->controller_ports(i), &config_widget->GetControllerConfig(i), sizeof(common::Config::ControllerPort));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
|
@ -1,56 +0,0 @@
|
||||||
// Copyright 2014 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#ifndef _CONTROLLER_CONFIG_HXX_
|
|
||||||
#define _CONTROLLER_CONFIG_HXX_
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
//#include "ui_controller_config.h"
|
|
||||||
|
|
||||||
/* TODO(bunnei): ImplementMe
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
class GControllerConfig : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
GControllerConfig(common::Config::ControllerPort* initial_config, QWidget* parent = NULL);
|
|
||||||
|
|
||||||
const common::Config::ControllerPort& GetControllerConfig(int index) const { return config[index]; }
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void ActivePortChanged(const common::Config::ControllerPort&);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void OnKeyConfigChanged(common::Config::Control id, int key, const QString& name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int GetActiveController();
|
|
||||||
bool InputSourceJoypad();
|
|
||||||
|
|
||||||
Ui::ControllerConfig ui;
|
|
||||||
common::Config::ControllerPort config[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
class GControllerConfigDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
GControllerConfigDialog(common::Config::ControllerPort* controller_ports, QWidget* parent = NULL);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void EnableChanges();
|
|
||||||
|
|
||||||
private:
|
|
||||||
GControllerConfig* config_widget;
|
|
||||||
common::Config::ControllerPort* config_ptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif // _CONTROLLER_CONFIG_HXX_
|
|
|
@ -1,308 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ControllerConfig</class>
|
|
||||||
<widget class="QWidget" name="ControllerConfig">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>503</width>
|
|
||||||
<height>293</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Controller Configuration</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetFixedSize</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="activeControllerCB">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QCheckBox" name="checkBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enabled</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="inputSourceCB">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Keyboard</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Joypad</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Active Controller:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Input Source:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="mainStickTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Main Stick</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="2" column="2">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="cStickTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>C-Stick</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="verticalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="dPadTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>D-Pad</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<item row="1" column="2">
|
|
||||||
<spacer name="horizontalSpacer_7">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="verticalSpacer_7">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_8">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="buttonsTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Buttons</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
<slots>
|
|
||||||
<signal>ControlsChanged()</signal>
|
|
||||||
<signal>MainStickCleared()</signal>
|
|
||||||
<signal>CStickCleared()</signal>
|
|
||||||
<signal>DPadCleared()</signal>
|
|
||||||
<signal>ButtonsCleared()</signal>
|
|
||||||
<slot>OnControlsChanged()</slot>
|
|
||||||
<slot>OnMainStickCleared()</slot>
|
|
||||||
<slot>OnCStickCleared()</slot>
|
|
||||||
<slot>OnDPadCleared()</slot>
|
|
||||||
<slot>OnButtonsCleared()</slot>
|
|
||||||
</slots>
|
|
||||||
</ui>
|
|
|
@ -1,125 +0,0 @@
|
||||||
// Copyright 2014 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QStyle>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
#include "controller_config_util.h"
|
|
||||||
|
|
||||||
/* TODO(bunnei): ImplementMe
|
|
||||||
GStickConfig::GStickConfig(common::Config::Control leftid, common::Config::Control rightid, common::Config::Control upid, common::Config::Control downid, QObject* change_receiver, QWidget* parent) : QWidget(parent)
|
|
||||||
{
|
|
||||||
left = new GKeyConfigButton(leftid, style()->standardIcon(QStyle::SP_ArrowLeft), QString(), change_receiver, this);
|
|
||||||
right = new GKeyConfigButton(rightid, style()->standardIcon(QStyle::SP_ArrowRight), QString(), change_receiver, this);
|
|
||||||
up = new GKeyConfigButton(upid, style()->standardIcon(QStyle::SP_ArrowUp), QString(), change_receiver, this);
|
|
||||||
down = new GKeyConfigButton(downid, style()->standardIcon(QStyle::SP_ArrowDown), QString(), change_receiver, this);
|
|
||||||
clear = new QPushButton(tr("Clear"), this);
|
|
||||||
|
|
||||||
QGridLayout* layout = new QGridLayout(this);
|
|
||||||
layout->addWidget(left, 1, 0);
|
|
||||||
layout->addWidget(right, 1, 2);
|
|
||||||
layout->addWidget(up, 0, 1);
|
|
||||||
layout->addWidget(down, 2, 1);
|
|
||||||
layout->addWidget(clear, 1, 1);
|
|
||||||
|
|
||||||
setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
GKeyConfigButton::GKeyConfigButton(common::Config::Control id, const QIcon& icon, const QString& text, QObject* change_receiver, QWidget* parent) : QPushButton(icon, text, parent), id(id), inputGrabbed(false)
|
|
||||||
{
|
|
||||||
connect(this, SIGNAL(clicked()), this, SLOT(OnClicked()));
|
|
||||||
connect(this, SIGNAL(KeyAssigned(common::Config::Control, int, const QString&)), change_receiver, SLOT(OnKeyConfigChanged(common::Config::Control, int, const QString&)));
|
|
||||||
connect(change_receiver, SIGNAL(ActivePortChanged(const common::Config::ControllerPort&)), this, SLOT(OnActivePortChanged(const common::Config::ControllerPort&)));
|
|
||||||
}
|
|
||||||
|
|
||||||
GKeyConfigButton::GKeyConfigButton(common::Config::Control id, const QString& text, QObject* change_receiver, QWidget* parent) : QPushButton(text, parent), id(id), inputGrabbed(false)
|
|
||||||
{
|
|
||||||
connect(this, SIGNAL(clicked()), this, SLOT(OnClicked()));
|
|
||||||
connect(this, SIGNAL(KeyAssigned(common::Config::Control, int, const QString&)), change_receiver, SLOT(OnKeyConfigChanged(common::Config::Control, int, const QString&)));
|
|
||||||
connect(change_receiver, SIGNAL(ActivePortChanged(const common::Config::ControllerPort&)), this, SLOT(OnActivePortChanged(const common::Config::ControllerPort&)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GKeyConfigButton::OnActivePortChanged(const common::Config::ControllerPort& config)
|
|
||||||
{
|
|
||||||
// TODO: Doesn't use joypad struct if that's the input source...
|
|
||||||
QString text = QKeySequence(config.keys.key_code[id]).toString(); // has a nicer format
|
|
||||||
if (config.keys.key_code[id] == Qt::Key_Shift) text = tr("Shift");
|
|
||||||
else if (config.keys.key_code[id] == Qt::Key_Control) text = tr("Control");
|
|
||||||
else if (config.keys.key_code[id] == Qt::Key_Alt) text = tr("Alt");
|
|
||||||
else if (config.keys.key_code[id] == Qt::Key_Meta) text = tr("Meta");
|
|
||||||
setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GKeyConfigButton::OnClicked()
|
|
||||||
{
|
|
||||||
grabKeyboard();
|
|
||||||
grabMouse();
|
|
||||||
inputGrabbed = true;
|
|
||||||
|
|
||||||
old_text = text();
|
|
||||||
setText(tr("Input..."));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GKeyConfigButton::keyPressEvent(QKeyEvent* event)
|
|
||||||
{
|
|
||||||
if (inputGrabbed)
|
|
||||||
{
|
|
||||||
releaseKeyboard();
|
|
||||||
releaseMouse();
|
|
||||||
setText(QString());
|
|
||||||
|
|
||||||
// TODO: Doesn't capture "return" key
|
|
||||||
// TODO: This doesn't quite work well, yet... find a better way
|
|
||||||
QString text = QKeySequence(event->key()).toString(); // has a nicer format than event->text()
|
|
||||||
int key = event->key();
|
|
||||||
if (event->modifiers() == Qt::ShiftModifier) { text = tr("Shift"); key = Qt::Key_Shift; }
|
|
||||||
else if (event->modifiers() == Qt::ControlModifier) { text = tr("Ctrl"); key = Qt::Key_Control; }
|
|
||||||
else if (event->modifiers() == Qt::AltModifier) { text = tr("Alt"); key = Qt::Key_Alt; }
|
|
||||||
else if (event->modifiers() == Qt::MetaModifier) { text = tr("Meta"); key = Qt::Key_Meta; }
|
|
||||||
|
|
||||||
setText(old_text);
|
|
||||||
emit KeyAssigned(id, key, text);
|
|
||||||
|
|
||||||
inputGrabbed = false;
|
|
||||||
|
|
||||||
// TODO: Keys like "return" cause another keyPressEvent to be generated after this one...
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton::keyPressEvent(event); // TODO: Necessary?
|
|
||||||
}
|
|
||||||
|
|
||||||
void GKeyConfigButton::mousePressEvent(QMouseEvent* event)
|
|
||||||
{
|
|
||||||
// Abort key assignment
|
|
||||||
if (inputGrabbed)
|
|
||||||
{
|
|
||||||
releaseKeyboard();
|
|
||||||
releaseMouse();
|
|
||||||
setText(old_text);
|
|
||||||
inputGrabbed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QAbstractButton::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
GButtonConfigGroup::GButtonConfigGroup(const QString& name, common::Config::Control id, QObject* change_receiver, QWidget* parent) : QWidget(parent), id(id)
|
|
||||||
{
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
|
||||||
|
|
||||||
QPushButton* clear_button = new QPushButton(tr("Clear"));
|
|
||||||
|
|
||||||
layout->addWidget(new QLabel(name, this));
|
|
||||||
layout->addWidget(config_button = new GKeyConfigButton(id, QString(), change_receiver, this));
|
|
||||||
layout->addWidget(clear_button);
|
|
||||||
|
|
||||||
// TODO: connect config_button, clear_button
|
|
||||||
|
|
||||||
setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
|
@ -1,82 +0,0 @@
|
||||||
// Copyright 2014 Citra Emulator Project
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#ifndef _CONTROLLER_CONFIG_UTIL_HXX_
|
|
||||||
#define _CONTROLLER_CONFIG_UTIL_HXX_
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
/* TODO(bunnei): ImplementMe
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
class GStickConfig : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
// change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot!
|
|
||||||
GStickConfig(common::Config::Control leftid, common::Config::Control rightid, common::Config::Control upid, common::Config::Control downid, QObject* change_receiver, QWidget* parent = NULL);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void LeftChanged();
|
|
||||||
void RightChanged();
|
|
||||||
void UpChanged();
|
|
||||||
void DownChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPushButton* left;
|
|
||||||
QPushButton* right;
|
|
||||||
QPushButton* up;
|
|
||||||
QPushButton* down;
|
|
||||||
|
|
||||||
QPushButton* clear;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GKeyConfigButton : public QPushButton
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
// TODO: change_receiver also needs to have an ActivePortChanged(const common::Config::ControllerPort&) signal
|
|
||||||
// change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot!
|
|
||||||
GKeyConfigButton(common::Config::Control id, const QIcon& icon, const QString& text, QObject* change_receiver, QWidget* parent);
|
|
||||||
GKeyConfigButton(common::Config::Control id, const QString& text, QObject* change_receiver, QWidget* parent);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void KeyAssigned(common::Config::Control id, int key, const QString& text);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void OnActivePortChanged(const common::Config::ControllerPort& config);
|
|
||||||
|
|
||||||
void OnClicked();
|
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent* event); // TODO: bGrabbed?
|
|
||||||
void mousePressEvent(QMouseEvent* event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
common::Config::Control id;
|
|
||||||
bool inputGrabbed;
|
|
||||||
|
|
||||||
QString old_text;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GButtonConfigGroup : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
// change_receiver needs to have a OnKeyConfigChanged(common::Config::Control, int, const QString&) slot!
|
|
||||||
GButtonConfigGroup(const QString& name, common::Config::Control id, QObject* change_receiver, QWidget* parent = NULL);
|
|
||||||
|
|
||||||
private:
|
|
||||||
GKeyConfigButton* config_button;
|
|
||||||
|
|
||||||
common::Config::Control id;
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif // _CONTROLLER_CONFIG_HXX_
|
|
Reference in New Issue