Commit 505e285a authored by Alexander Stippich's avatar Alexander Stippich
Browse files

do not start FindDevicesThread unconditionally

and document SANE API limitations

CCBUG: 445139


(cherry picked from commit 7b56da61)
parent 46ea84cc
Pipeline #112580 passed with stage
in 46 seconds
......@@ -52,9 +52,6 @@ KSaneCore::KSaneCore(QObject *parent)
}
s_objectMutex->unlock();
// read the device list to get a list of vendor and model info
d->m_findDevThread->start();
d->m_readValuesTimer.setSingleShot(true);
connect(&d->m_readValuesTimer, &QTimer::timeout, d.get(), &KSaneCorePrivate::reloadValues);
}
......
......@@ -114,7 +114,10 @@ public:
/**
* Get the list of available scanning devices. Connect to availableDevices()
* which is fired once these devices are known.
* which is fired once these devices are known. While the querying is done in a
* separate thread and thus not blocking the application, the application must
* ensure that no other action accessing the scanner device (settings options etc.)
* is performed during this period.
* @return whether the devices list are being reloaded or not.
*/
bool reloadDevicesList();
......@@ -145,16 +148,22 @@ public:
/**
* This method returns the internal device name of the currently opened scanner.
* @note Due to limitations of the SANE API, this will function will return an empty string
* if reloadDevicesList() has not been called before.
*/
QString deviceName() const;
/**
* This method returns the vendor name of the currently opened scanner.
* This method returns the vendor name of the currently opened scanner.
* @note Due to limitations of the SANE API, this will function will return an empty string
* if reloadDevicesList() has not been called before.
*/
QString deviceVendor() const;
/**
* This method returns the model of the currently opened scanner.
* @note Due to limitations of the SANE API, this will function will return an empty string
* if reloadDevicesList() has not been called before.
*/
QString deviceModel() const;
......@@ -288,11 +297,7 @@ Q_SIGNALS:
void buttonPressed(const QString &optionName, const QString &optionLabel, bool pressed);
/**
* This signal is emitted when the device info of the already opened scanner device
* is updated and vendor() and model() return the corresponding names.
* @param deviceName is the technical device name of the currently opened scanner.
* @param deviceVendor is the vendor of the currently opened scanner.
* @param deviceModel is the model name of the currently opened scanner.
* This signal is not emitted anymore.
*/
void openedDeviceInfoUpdated(const QString &deviceName, const QString &deviceVendor, const QString &deviceModel);
......
......@@ -267,7 +267,6 @@ void KSaneCorePrivate::clearDeviceOptions()
m_devName.clear();
m_model.clear();
m_vendor.clear();
Q_EMIT q->openedDeviceInfoUpdated(m_devName, m_vendor, m_model);
}
void KSaneCorePrivate::devicesListUpdated()
......@@ -278,7 +277,6 @@ void KSaneCorePrivate::devicesListUpdated()
if (device.name == m_devName) {
m_vendor = device.vendor;
m_model = device.model;
Q_EMIT q->openedDeviceInfoUpdated(m_devName, m_vendor, m_model);
break;
}
}
......
......@@ -49,7 +49,6 @@ KSaneWidget::KSaneWidget(QWidget *parent)
connect(d->m_ksaneCoreInterface, &KSaneCore::batchModeCountDown, d, &KSaneWidgetPrivate::updateCountDown);
connect(d->m_ksaneCoreInterface, &KSaneCore::availableDevices, d, &KSaneWidgetPrivate::signalDevListUpdate);
connect(d->m_ksaneCoreInterface, &KSaneCore::buttonPressed, this, &KSaneWidget::buttonPressed);
connect(d->m_ksaneCoreInterface, &KSaneCore::openedDeviceInfoUpdated, this, &KSaneWidget::openedDeviceInfoUpdated);
// Create the static UI
// create the preview
......
......@@ -323,8 +323,7 @@ Q_SIGNALS:
void buttonPressed(const QString &optionName, const QString &optionLabel, bool pressed);
/**
* This Signal is emitted when the device info of the already opened scanner device
* is updated and vendor() and model() return the corresponding names.
* This signal is not emitted anymore.
*/
void openedDeviceInfoUpdated(const QString &deviceName, const QString &deivceVendor, const QString &deviceModel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment