Fixed getDCVersion() as part of turning worker-object into its own

thread.
This commit is contained in:
Gerhard Hoffmann 2023-11-07 09:12:17 +01:00
parent 685568d4f6
commit 7e4c138d1b

View File

@ -963,22 +963,25 @@ QString Worker::getPluginVersion(QString const &pluginFileName) const {
QStringList Worker::getDCVersion() const {
QStringList lst = (QStringList() << "N/A" << "N/A");
hwinf *hwi = m_mainWindow->getPlugin();
if (hwi) {
hwi->dc_autoRequest(true); // turn auto-request setting on
Update const *up = update();
if (up) {
hwinf const *caPlugin = up->hw();
if (caPlugin) {
caPlugin->dc_autoRequest(true); // turn auto-request setting on
QByteArray const cmp(8, char(0));
QByteArray hw(""), sw("");
for (int i=0; i<5; ++i) {
hw = hwi->dc_getHWversion().toUtf8();
sw = hwi->dc_getSWversion().toUtf8();
if (!hw.startsWith(cmp)) {
lst.clear();
qInfo() << hw << sw;
lst << hw << sw;
break;
QByteArray const cmp(8, char(0));
QByteArray hw(""), sw("");
for (int i=0; i<5; ++i) {
hw = caPlugin->dc_getHWversion().toUtf8();
sw = caPlugin->dc_getSWversion().toUtf8();
if (!hw.startsWith(cmp)) {
lst.clear();
qInfo() << hw << sw;
lst << hw << sw;
break;
}
QThread::sleep(1);
}
QThread::sleep(1);
}
}
return lst;