void DevicesConfigurationWidget::prependCustomWidget(RobotModelInterface &robotModel, QWidget * const widget) { if (!widget) { return; } Q_ASSERT(mRobotModelConfigurers.contains(robotModel.name())); QVBoxLayout *layout = dynamic_cast<QVBoxLayout *>(mRobotModelConfigurers[robotModel.name()]->layout()); Q_ASSERT(layout); layout->insertWidget(0, widget); }
TwoDRobotModel::TwoDRobotModel(const RobotModelInterface &realModel) : CommonRobotModel(realModel.kitId(), realModel.robotId()) , mRealModel(&realModel) , mEngine(nullptr) { for (const PortInfo &port : realModel.availablePorts()) { if (!port.name().toLower().contains("gamepad")) { addAllowedConnection(port, realModel.allowedDevices(port)); } } addAllowedConnection(PortInfo("MarkerPort", output), { markerInfo() }); }
void DevicesConfigurationWidget::selectRobotModel(RobotModelInterface &robotModel) { if (mCurrentModelType == robotModel.name() && mCurrentModelId == robotModel.robotId()) { return; } mCurrentModelType = robotModel.name(); mCurrentModelId = robotModel.robotId(); takeWidget(); if (mRobotModels.contains(mCurrentModelType)) { setWidget(mRobotModelConfigurers[mCurrentModelType]); refresh(); } }
SpeakerBlock::SpeakerBlock(RobotModelInterface &robotModel) : kitBase::blocksBase::common::DeviceBlock<robotModel::parts::NxtSpeaker>(robotModel) , mTimer(robotModel.timeline().produceTimer()) { mTimer->setParent(this); connect(mTimer, &utils::AbstractTimer::timeout, this, &SpeakerBlock::timeout); }
SpeakerBlock::SpeakerBlock(RobotModelInterface &robotModel) : mRobotModel(robotModel) , mTimer(robotModel.timeline().produceTimer()) { mTimer->setParent(this); connect(mTimer, &utils::AbstractTimer::timeout, this, &SpeakerBlock::timeout); }
QSet<qReal::Id> BlocksFactoryManager::visibleBlocks(const RobotModelInterface &robotModel) const { QSet<qReal::Id> result; const QString kitId = robotModel.kitId(); for (const RobotModelInterface *robotModel : mFactories.keys()) { if (robotModel && robotModel->kitId() == kitId) { for (const BlocksFactoryInterface * factory : factoriesFor(*robotModel)) { result += factory->providedBlocks().toSet(); } } } return result; }
WaitBlock::WaitBlock(RobotModelInterface &robotModel) : mRobotModel(robotModel) { mActiveWaitingTimer.reset(robotModel.timeline().produceTimer()); connect(mActiveWaitingTimer.data(), &utils::AbstractTimer::timeout, this, &WaitBlock::timerTimeout); mActiveWaitingTimer->setInterval(20); mActiveWaitingTimer->setRepeatable(true); }
void DevicesConfigurationWidget::selectRobotModel(RobotModelInterface &robotModel) { QString const robotModelId = robotModel.name(); mCurrentModel = robotModelId; takeWidget(); if (mRobotModels.contains(robotModelId)) { setWidget(mRobotModelConfigurers[robotModelId]); refresh(); } }