Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into junior #1124

Merged
merged 3 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class TWO_D_MODEL_EXPORT TwoDRobotModel : public kitBase::robotModel::CommonRobo
QList<kitBase::robotModel::PortInfo> configurablePorts() const override;
QList<kitBase::robotModel::DeviceInfo> convertibleBases() const override;
int priority() const override;
void rereadSettings() override;

/// Configures 2D model window`s engine for using it in 2D model devices emulators.
void setEngine(engine::TwoDModelEngineInterface &engine);
Expand Down Expand Up @@ -128,6 +129,8 @@ class TWO_D_MODEL_EXPORT TwoDRobotModel : public kitBase::robotModel::CommonRobo
/// Returns scanning angle and max distance by given device type.
virtual QPair<qreal,int> rangeSensorAngleAndDistance (const kitBase::robotModel::DeviceInfo &deviceType) const;

signals:
void settingsChanged();
protected:
kitBase::robotModel::robotParts::Device *createDevice(
const kitBase::robotModel::PortInfo &port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ RobotItem::RobotItem(const QString &robotImageFileName, model::RobotModel &robot
connect(&mRobotModel.configuration(), &model::SensorsConfiguration::rotationChanged
, this, &RobotItem::updateSensorRotation);

connect(&mRobotModel.info(), &twoDModel::robotModel::TwoDRobotModel::settingsChanged
, this, &RobotItem::updateImage);

setAcceptHoverEvents(true);
setAcceptDrops(true);
setZValue(ZValue::Robot);
Expand Down Expand Up @@ -383,3 +386,8 @@ void RobotItem::BeepItem::drawBeepArcs(QPainter *painter, const QPointF &center,
painter->drawArc(rect, 225 * 16, 90 * 16);
painter->restore();
}

void RobotItem::updateImage()
{
mImage.loadFrom(mRobotModel.info().robotImage());
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class RobotItem : public graphicsUtils::RotateItem, public items::SolidItem
void ride(const QPointF &newPos, qreal rotation);

void onLanded();
void updateImage();

/** @brief Image of a robot drawn on scene */
model::Image mImage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,8 @@ DeviceInfo TwoDRobotModel::markerInfo() const
{
return DeviceInfo::create<parts::Marker>();
}

void TwoDRobotModel::rereadSettings()
{
emit settingsChanged();
}