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