mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
(BlackBerry) Quick fix for device selection dropdown.
This commit is contained in:
parent
271db20cf8
commit
c99eb33c99
@ -53,14 +53,31 @@ Page
|
||||
preferredWidth: 650
|
||||
horizontalAlignment: HorizontalAlignment.Center
|
||||
|
||||
DropDown
|
||||
Container
|
||||
{
|
||||
objectName: "dropdown_devices"
|
||||
title: "Device"
|
||||
|
||||
onSelectedValueChanged:
|
||||
horizontalAlignment: HorizontalAlignment.Center
|
||||
layout: StackLayout
|
||||
{
|
||||
ButtonMap.mapDevice(selectedValue, players.selectedValue);
|
||||
orientation: LayoutOrientation.LeftToRight
|
||||
}
|
||||
|
||||
DropDown
|
||||
{
|
||||
horizontalAlignment: HorizontalAlignment.Left
|
||||
id: dropdown_device
|
||||
objectName: "dropdown_devices"
|
||||
title: "Device"
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
horizontalAlignment: HorizontalAlignment.Right
|
||||
text: "Set"
|
||||
|
||||
onClicked:
|
||||
{
|
||||
ButtonMap.mapDevice(dropdown_device.selectedValue, players.selectedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,6 +184,15 @@ void ButtonMap::refreshButtonMap(int player)
|
||||
map.insert("type", QVariant("item"));
|
||||
map.insert("index", QVariant(RARCH_MENU_TOGGLE));
|
||||
buttonDataModel->append(map);
|
||||
|
||||
//Update device dropdown
|
||||
if (deviceSelection)
|
||||
{
|
||||
if(port_device[player])
|
||||
deviceSelection->setSelectedIndex(port_device[player]->index);
|
||||
else
|
||||
deviceSelection->resetSelectedIndex();
|
||||
}
|
||||
}
|
||||
|
||||
//Button map
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <bb/cascades/Application>
|
||||
#include <bb/cascades/ArrayDataModel>
|
||||
#include <bb/cascades/DropDown>
|
||||
|
||||
#include <screen/screen.h>
|
||||
#include <sys/neutrino.h>
|
||||
@ -42,6 +43,7 @@ public:
|
||||
Q_INVOKABLE void mapDevice(int index, int player);
|
||||
|
||||
ArrayDataModel *buttonDataModel;
|
||||
DropDown *deviceSelection;
|
||||
|
||||
private:
|
||||
screen_context_t screen_cxt;
|
||||
|
@ -98,7 +98,7 @@ RetroArch::RetroArch()
|
||||
qml->setContextProperty("ButtonMap", buttonMap);
|
||||
|
||||
deviceSelection = mAppPane->findChild<DropDown*>("dropdown_devices");
|
||||
//connect(deviceSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onDeviceSelected(QVariant)));
|
||||
buttonMap->deviceSelection = deviceSelection;
|
||||
findDevices();
|
||||
|
||||
//Setup the datamodel for button mapping.
|
||||
|
@ -19,6 +19,7 @@ typedef struct {
|
||||
char device_name[64];
|
||||
int device;
|
||||
int port;
|
||||
int index;
|
||||
|
||||
// Current state.
|
||||
int buttons;
|
||||
|
@ -153,9 +153,9 @@ void discoverControllers()
|
||||
if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK || type == SCREEN_EVENT_KEYBOARD)
|
||||
{
|
||||
devices[pads_connected].handle = devices_found[i];
|
||||
devices[pads_connected].index = pads_connected;
|
||||
loadController(&devices[pads_connected]);
|
||||
|
||||
pads_connected++;
|
||||
if (pads_connected == MAX_PADS)
|
||||
break;
|
||||
}
|
||||
@ -186,6 +186,7 @@ static void initController(input_device_t* controller)
|
||||
controller->analog1[0] = controller->analog1[1] = controller->analog1[2] = 0;
|
||||
controller->port = -1;
|
||||
controller->device = -1;
|
||||
controller->index = -1;
|
||||
memset(controller->id, 0, sizeof(controller->id));
|
||||
}
|
||||
|
||||
@ -227,9 +228,12 @@ static void qnx_input_autodetect_gamepad(input_device_t* controller)
|
||||
strlcpy(controller->device_name, "None", sizeof(controller->device_name));
|
||||
}
|
||||
|
||||
if (input_qnx.set_keybinds)
|
||||
if (input_qnx.set_keybinds && (controller->device != DEVICE_NONE))
|
||||
{
|
||||
input_qnx.set_keybinds((void*)controller, controller->device, pads_connected, 0,
|
||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
||||
pads_connected++;
|
||||
}
|
||||
}
|
||||
|
||||
static void process_keyboard_event(screen_event_t event, int type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user