fix segfault b/c QList is now used instead of QHash
This commit is contained in:
@ -152,8 +152,8 @@ bool JoyPad::readConfig( QTextStream &stream ) {
|
||||
errorBox(tr("Layout file error"), tr("Expected ':', found '%1'.").arg(ch));
|
||||
return false;
|
||||
}
|
||||
if (buttons[num-1] == 0) {
|
||||
buttons.insert(num-1,new Button(num-1,this));
|
||||
for (int i = buttons.size(); i < num; ++ i) {
|
||||
buttons.append(new Button(i, this));
|
||||
}
|
||||
if (!buttons[num-1]->read( stream )) {
|
||||
errorBox(tr("Layout file error"), tr("Error reading Button %1").arg(num));
|
||||
@ -172,8 +172,8 @@ bool JoyPad::readConfig( QTextStream &stream ) {
|
||||
errorBox(tr("Layout file error"), tr("Expected ':', found '%1'.").arg(ch));
|
||||
return false;
|
||||
}
|
||||
if (axes[num-1] == 0) {
|
||||
axes.insert(num-1,new Axis(num-1,this));
|
||||
for (int i = axes.size(); i < num; ++ i) {
|
||||
axes.append(new Axis(i, this));
|
||||
}
|
||||
if (!axes[num-1]->read(stream)) {
|
||||
errorBox(tr("Layout file error"), tr("Error reading Axis %1").arg(num));
|
||||
|
@ -25,9 +25,8 @@ void QuickSet::jsevent(const js_event &msg ) {
|
||||
unsigned int type = msg.type & ~JS_EVENT_INIT;
|
||||
if (type == JS_EVENT_BUTTON) {
|
||||
//capture that button.
|
||||
if (msg.number < joypad->buttons.size()) {
|
||||
Button* button = joypad->buttons[msg.number];
|
||||
|
||||
if (button) {
|
||||
//go into setting mode and request a key/mousebutton
|
||||
setting = true;
|
||||
bool isMouse = false;
|
||||
@ -44,6 +43,7 @@ void QuickSet::jsevent(const js_event &msg ) {
|
||||
if (abs(msg.value) < 5000) return;
|
||||
|
||||
//capture the axis that moved
|
||||
if (msg.number < joypad->axes.size()) {
|
||||
Axis* axis = joypad->axes[msg.number];
|
||||
|
||||
//grab a keycode for that axis and that direction
|
||||
@ -57,4 +57,5 @@ void QuickSet::jsevent(const js_event &msg ) {
|
||||
axis->setKey(isMouse, (msg.value > 0), code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user