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));
|
errorBox(tr("Layout file error"), tr("Expected ':', found '%1'.").arg(ch));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (buttons[num-1] == 0) {
|
for (int i = buttons.size(); i < num; ++ i) {
|
||||||
buttons.insert(num-1,new Button(num-1,this));
|
buttons.append(new Button(i, this));
|
||||||
}
|
}
|
||||||
if (!buttons[num-1]->read( stream )) {
|
if (!buttons[num-1]->read( stream )) {
|
||||||
errorBox(tr("Layout file error"), tr("Error reading Button %1").arg(num));
|
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));
|
errorBox(tr("Layout file error"), tr("Expected ':', found '%1'.").arg(ch));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (axes[num-1] == 0) {
|
for (int i = axes.size(); i < num; ++ i) {
|
||||||
axes.insert(num-1,new Axis(num-1,this));
|
axes.append(new Axis(i, this));
|
||||||
}
|
}
|
||||||
if (!axes[num-1]->read(stream)) {
|
if (!axes[num-1]->read(stream)) {
|
||||||
errorBox(tr("Layout file error"), tr("Error reading Axis %1").arg(num));
|
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;
|
unsigned int type = msg.type & ~JS_EVENT_INIT;
|
||||||
if (type == JS_EVENT_BUTTON) {
|
if (type == JS_EVENT_BUTTON) {
|
||||||
//capture that button.
|
//capture that button.
|
||||||
Button* button = joypad->buttons[msg.number];
|
if (msg.number < joypad->buttons.size()) {
|
||||||
|
Button* button = joypad->buttons[msg.number];
|
||||||
if (button) {
|
|
||||||
//go into setting mode and request a key/mousebutton
|
//go into setting mode and request a key/mousebutton
|
||||||
setting = true;
|
setting = true;
|
||||||
bool isMouse = false;
|
bool isMouse = false;
|
||||||
@ -44,17 +43,19 @@ void QuickSet::jsevent(const js_event &msg ) {
|
|||||||
if (abs(msg.value) < 5000) return;
|
if (abs(msg.value) < 5000) return;
|
||||||
|
|
||||||
//capture the axis that moved
|
//capture the axis that moved
|
||||||
Axis* axis = joypad->axes[msg.number];
|
if (msg.number < joypad->axes.size()) {
|
||||||
|
Axis* axis = joypad->axes[msg.number];
|
||||||
|
|
||||||
//grab a keycode for that axis and that direction
|
//grab a keycode for that axis and that direction
|
||||||
setting = true;
|
setting = true;
|
||||||
bool isMouse = false;
|
bool isMouse = false;
|
||||||
int code = KeyDialog::getKey((msg.value >= 0 ? tr("%1, positive") : tr("%1, negative")).arg(axis->getName()), true, &isMouse, this);
|
int code = KeyDialog::getKey((msg.value >= 0 ? tr("%1, positive") : tr("%1, negative")).arg(axis->getName()), true, &isMouse, this);
|
||||||
setting = false;
|
setting = false;
|
||||||
|
|
||||||
//assign the key to the axis.
|
//assign the key to the axis.
|
||||||
if (code >= 0) {
|
if (code >= 0) {
|
||||||
axis->setKey(isMouse, (msg.value > 0), code);
|
axis->setKey(isMouse, (msg.value > 0), code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user