Skip to content

Commit cc1e9a4

Browse files
committed
Add playTone visualisation to code interpretation
1 parent 52071ae commit cc1e9a4

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

plugins/robots/interpreters/trikKitInterpreterCommon/include/trikKitInterpreterCommon/trikbrick.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class TrikBrick final : public trikControl::BrickInterface
7070
public slots:
7171
void configure(const QString &, const QString &) override {}
7272
void playSound(const QString &) override {}
73+
void playTone(int, int msDuration) override;
7374
void say(const QString &msg) override;
7475
void stop() override;
7576
trikControl::MotorInterface *motor(const QString &port) override;
@@ -95,7 +96,6 @@ public slots:
9596
trikControl::FifoInterface *fifo(const QString &) override {return nullptr;}
9697
trikControl::I2cDeviceInterface *i2c(int, int) override {return nullptr;}
9798

98-
void playTone(int, int) override {}
9999
QVector<uint8_t> getStillImage() override;
100100
trikControl::EventDeviceInterface *eventDevice(const QString &) override {return nullptr;}
101101
void stopEventDevice(const QString &) override {}

plugins/robots/interpreters/trikKitInterpreterCommon/src/trikbrick.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ void TrikBrick::say(const QString &msg) {
161161
QMetaObject::invokeMethod(sh, [sh, msg](){sh->say(msg);});
162162
}
163163

164+
void TrikBrick::playTone(int, int msDuration) {
165+
auto* robot = mTwoDRobotModel.data();
166+
QMetaObject::invokeMethod(robot, [robot, msDuration](){robot->engine()->playSound(msDuration);});
167+
}
168+
164169
void TrikBrick::stop() {
165170
/// @todo: properly implement this?
166171
mTwoDRobotModel->stopRobot();

qrtranslations/fr/plugins/robots/trikKitInterpreterCommon_fr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
</message>
114114
<message>
115115
<location line="-30"/>
116-
<location line="+262"/>
116+
<location line="+267"/>
117117
<source>Trying to read from file %1 failed</source>
118118
<translation type="unfinished"></translation>
119119
</message>

qrtranslations/ru/plugins/robots/trikKitInterpreterCommon_ru.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
</message>
174174
<message>
175175
<location line="-30"/>
176-
<location line="+262"/>
176+
<location line="+267"/>
177177
<source>Trying to read from file %1 failed</source>
178178
<translation>Не удалось открыть файл %1</translation>
179179
</message>

0 commit comments

Comments
 (0)