Commit 46ea84cc authored by Alexander Stippich's avatar Alexander Stippich
Browse files

announce zero progress directly after the very first byte has been read

CCBUG: 446547


(cherry picked from commit ea4fa091)
parent 22555d3d
Pipeline #108619 passed with stage
in 1 minute and 5 seconds
......@@ -79,6 +79,7 @@ void KSaneScanThread::run()
{
m_dataSize = 0;
m_readStatus = ReadOngoing;
m_announceFirstRead = true;
// Start the scanning with sane_start
m_saneStatus = sane_start(m_saneHandle);
......@@ -118,8 +119,6 @@ void KSaneScanThread::run()
m_frameRead = 0;
m_frame_t_count = 0;
Q_EMIT scanProgressUpdated(0);
while (m_readStatus == ReadOngoing) {
readData();
}
......@@ -150,6 +149,11 @@ void KSaneScanThread::readData()
SANE_Int readBytes = 0;
m_saneStatus = sane_read(m_saneHandle, m_readData, SCAN_READ_CHUNK_SIZE, &readBytes);
if (readBytes > 0 && m_announceFirstRead) {
Q_EMIT scanProgressUpdated(0);
m_announceFirstRead = false;
}
switch (m_saneStatus) {
case SANE_STATUS_GOOD:
// continue to parsing the data
......
......@@ -73,6 +73,7 @@ private:
SANE_Parameters m_params;
SANE_Status m_saneStatus = SANE_STATUS_GOOD;
ReadStatus m_readStatus = ReadReady;
bool m_announceFirstRead = true;
bool m_invertColors = false;
KSaneImageBuilder m_imageBuilder;
QImage m_image;
......
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