Skip to content

Commit cbe2fe3

Browse files
authored
application: add Qt version to Revision (#290)
* application: add Qt version to Revision * update translations * application: code cleanup * videoview: code cleanup
1 parent f4fbfea commit cbe2fe3

File tree

6 files changed

+35
-9
lines changed

6 files changed

+35
-9
lines changed

src/application/revisionsingleton.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ class RevisionSingleton : public QObject
1212
{
1313
Q_OBJECT
1414
Q_DISABLE_COPY(RevisionSingleton)
15-
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
15+
Q_PROPERTY(QString name READ name CONSTANT)
16+
Q_PROPERTY(QString runtimeQtVersion READ runtimeQtVersion CONSTANT)
17+
Q_PROPERTY(QString compiledQtVersion READ compiledQtVersion CONSTANT)
1618

1719
RevisionSingleton() {
1820
}
1921

2022
public:
2123
static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine)
2224
{
23-
Q_UNUSED(engine);
24-
Q_UNUSED(scriptEngine);
25+
Q_UNUSED(engine)
26+
Q_UNUSED(scriptEngine)
2527

2628
return new RevisionSingleton;
2729
}
@@ -31,8 +33,16 @@ class RevisionSingleton : public QObject
3133
return QStringLiteral(REVISION);
3234
}
3335

34-
signals:
35-
void nameChanged(const QString &name);
36+
QString runtimeQtVersion() const
37+
{
38+
return qVersion();
39+
}
40+
41+
QString compiledQtVersion() const
42+
{
43+
return QT_VERSION_STR;
44+
}
45+
3646
}; // class RevisionSingleton
3747
} // namespace qtquickvcp
3848

src/applicationcontrols/translations/machinekitapplicationcontrols_de.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@
208208
<source>TLO</source>
209209
<translation>TLO</translation>
210210
</message>
211+
<message>
212+
<source>S:</source>
213+
<translation type="unfinished"></translation>
214+
</message>
211215
</context>
212216
<context>
213217
<name>EditToolTableAction</name>

src/applicationcontrols/translations/machinekitapplicationcontrols_en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@
195195
<source>TLO</source>
196196
<translation type="unfinished"></translation>
197197
</message>
198+
<message>
199+
<source>S:</source>
200+
<translation type="unfinished"></translation>
201+
</message>
198202
</context>
199203
<context>
200204
<name>EditToolTableAction</name>

src/applicationcontrols/translations/machinekitapplicationcontrols_es.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@
195195
<source>TLO</source>
196196
<translation type="unfinished"></translation>
197197
</message>
198+
<message>
199+
<source>S:</source>
200+
<translation type="unfinished"></translation>
201+
</message>
198202
</context>
199203
<context>
200204
<name>EditToolTableAction</name>

src/applicationcontrols/translations/machinekitapplicationcontrols_ru.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@
195195
<source>TLO</source>
196196
<translation type="unfinished"></translation>
197197
</message>
198+
<message>
199+
<source>S:</source>
200+
<translation type="unfinished"></translation>
201+
</message>
198202
</context>
199203
<context>
200204
<name>EditToolTableAction</name>

src/videoview/mjpegstreamerclient.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ void MjpegStreamerClient::updateMessageReceived(const QList<QByteArray> &message
260260
#endif
261261

262262
streamBufferItem.image = QImage::fromData(data, "JPG");
263-
streamBufferItem.timestamp = (double)frame.timestamp_s()*1000 + (double)frame.timestamp_us() / 1000.0;
263+
streamBufferItem.timestamp = static_cast<double>(frame.timestamp_s())*1000.0 + static_cast<double>(frame.timestamp_us()) / 1000.0;
264264

265-
dateTime.setMSecsSinceEpoch((quint64)frame.timestamp_unix()*(quint64)1000);
265+
dateTime.setMSecsSinceEpoch(static_cast<qint64>(frame.timestamp_unix()) * 1000);
266266
dateTime = dateTime.toLocalTime();
267267
time = dateTime.time();
268-
streamBufferItem.time = time.addMSecs(frame.timestamp_us()/1000.0);
268+
streamBufferItem.time = time.addMSecs(static_cast<int>(frame.timestamp_us() / 1000));
269269

270270
#ifdef QT_DEBUG
271271
qDebug() << "time: " << streamBufferItem.time;
@@ -301,7 +301,7 @@ void MjpegStreamerClient::updateStreamBuffer()
301301
m_currentStreamBufferItem = m_streamBuffer.dequeue();
302302
interval = m_currentStreamBufferItem.timestamp - timestamp;
303303

304-
m_streamBufferTimer->start(qMax((int)interval, 0));
304+
m_streamBufferTimer->start(qMax(static_cast<int>(interval), 0));
305305
}
306306

307307
}

0 commit comments

Comments
 (0)