add joysick support and state feedback
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include "ui_relayscrollbox.h"
|
||||
#include "../items/train.h"
|
||||
#include "../items/turnout.h"
|
||||
#include "../trainjs.h"
|
||||
|
||||
ItemScrollBox::ItemScrollBox(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -37,6 +38,16 @@ void ItemScrollBox::addItem(std::weak_ptr<Item> item)
|
||||
widgets_.back()->setShortcuts(QKeySequence(Qt::Key_R), QKeySequence(Qt::Key_F), QKeySequence(Qt::Key_V));
|
||||
else if(train->getTrainId() == 4)
|
||||
widgets_.back()->setShortcuts(QKeySequence(Qt::Key_T), QKeySequence(Qt::Key_G), QKeySequence(Qt::Key_B));
|
||||
|
||||
std::vector<std::shared_ptr<TrainJs>> joysticks = TrainJs::getJsDevices();
|
||||
for(auto joystick: joysticks)
|
||||
{
|
||||
if(!joystick->itemIsSet())
|
||||
{
|
||||
joystick->setItem(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(turnout)
|
||||
{
|
||||
|
Reference in New Issue
Block a user