(BlackBerry) Quick fix for device selection dropdown.
This commit is contained in:
parent
271db20cf8
commit
c99eb33c99
|
@ -53,14 +53,31 @@ Page
|
||||||
preferredWidth: 650
|
preferredWidth: 650
|
||||||
horizontalAlignment: HorizontalAlignment.Center
|
horizontalAlignment: HorizontalAlignment.Center
|
||||||
|
|
||||||
DropDown
|
Container
|
||||||
{
|
{
|
||||||
objectName: "dropdown_devices"
|
horizontalAlignment: HorizontalAlignment.Center
|
||||||
title: "Device"
|
layout: StackLayout
|
||||||
|
|
||||||
onSelectedValueChanged:
|
|
||||||
{
|
{
|
||||||
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("type", QVariant("item"));
|
||||||
map.insert("index", QVariant(RARCH_MENU_TOGGLE));
|
map.insert("index", QVariant(RARCH_MENU_TOGGLE));
|
||||||
buttonDataModel->append(map);
|
buttonDataModel->append(map);
|
||||||
|
|
||||||
|
//Update device dropdown
|
||||||
|
if (deviceSelection)
|
||||||
|
{
|
||||||
|
if(port_device[player])
|
||||||
|
deviceSelection->setSelectedIndex(port_device[player]->index);
|
||||||
|
else
|
||||||
|
deviceSelection->resetSelectedIndex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Button map
|
//Button map
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <bb/cascades/Application>
|
#include <bb/cascades/Application>
|
||||||
#include <bb/cascades/ArrayDataModel>
|
#include <bb/cascades/ArrayDataModel>
|
||||||
|
#include <bb/cascades/DropDown>
|
||||||
|
|
||||||
#include <screen/screen.h>
|
#include <screen/screen.h>
|
||||||
#include <sys/neutrino.h>
|
#include <sys/neutrino.h>
|
||||||
|
@ -42,6 +43,7 @@ public:
|
||||||
Q_INVOKABLE void mapDevice(int index, int player);
|
Q_INVOKABLE void mapDevice(int index, int player);
|
||||||
|
|
||||||
ArrayDataModel *buttonDataModel;
|
ArrayDataModel *buttonDataModel;
|
||||||
|
DropDown *deviceSelection;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
screen_context_t screen_cxt;
|
screen_context_t screen_cxt;
|
||||||
|
|
|
@ -98,7 +98,7 @@ RetroArch::RetroArch()
|
||||||
qml->setContextProperty("ButtonMap", buttonMap);
|
qml->setContextProperty("ButtonMap", buttonMap);
|
||||||
|
|
||||||
deviceSelection = mAppPane->findChild<DropDown*>("dropdown_devices");
|
deviceSelection = mAppPane->findChild<DropDown*>("dropdown_devices");
|
||||||
//connect(deviceSelection, SIGNAL(selectedValueChanged(QVariant)), this, SLOT(onDeviceSelected(QVariant)));
|
buttonMap->deviceSelection = deviceSelection;
|
||||||
findDevices();
|
findDevices();
|
||||||
|
|
||||||
//Setup the datamodel for button mapping.
|
//Setup the datamodel for button mapping.
|
||||||
|
|
|
@ -19,6 +19,7 @@ typedef struct {
|
||||||
char device_name[64];
|
char device_name[64];
|
||||||
int device;
|
int device;
|
||||||
int port;
|
int port;
|
||||||
|
int index;
|
||||||
|
|
||||||
// Current state.
|
// Current state.
|
||||||
int buttons;
|
int buttons;
|
||||||
|
|
|
@ -153,9 +153,9 @@ void discoverControllers()
|
||||||
if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK || type == SCREEN_EVENT_KEYBOARD)
|
if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK || type == SCREEN_EVENT_KEYBOARD)
|
||||||
{
|
{
|
||||||
devices[pads_connected].handle = devices_found[i];
|
devices[pads_connected].handle = devices_found[i];
|
||||||
|
devices[pads_connected].index = pads_connected;
|
||||||
loadController(&devices[pads_connected]);
|
loadController(&devices[pads_connected]);
|
||||||
|
|
||||||
pads_connected++;
|
|
||||||
if (pads_connected == MAX_PADS)
|
if (pads_connected == MAX_PADS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ static void initController(input_device_t* controller)
|
||||||
controller->analog1[0] = controller->analog1[1] = controller->analog1[2] = 0;
|
controller->analog1[0] = controller->analog1[1] = controller->analog1[2] = 0;
|
||||||
controller->port = -1;
|
controller->port = -1;
|
||||||
controller->device = -1;
|
controller->device = -1;
|
||||||
|
controller->index = -1;
|
||||||
memset(controller->id, 0, sizeof(controller->id));
|
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));
|
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,
|
input_qnx.set_keybinds((void*)controller, controller->device, pads_connected, 0,
|
||||||
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
(1ULL << KEYBINDS_ACTION_SET_DEFAULT_BINDS));
|
||||||
|
pads_connected++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_keyboard_event(screen_event_t event, int type)
|
static void process_keyboard_event(screen_event_t event, int type)
|
||||||
|
|
Loading…
Reference in New Issue