summaryrefslogtreecommitdiff
path: root/src/scanner.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-14 11:36:54 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-14 11:36:54 +0100
commitcebf725978b32756700671a646aaed9677f6f219 (patch)
tree8aad7e2e09ba66c6ab36da556f7b8265b31898a6 /src/scanner.vala
parent13eec502b99e47e9910b5610869236698e1a8a13 (diff)
parenta632195d632be90e0da0ed0eef4b0987ed4bea6c (diff)
Merge branch 'release/3.26.2-1'3.26.2-1
Diffstat (limited to 'src/scanner.vala')
-rw-r--r--src/scanner.vala18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/scanner.vala b/src/scanner.vala
index 16f33cf..f98b4b6 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -69,7 +69,8 @@ public enum ScanType
SINGLE,
ADF_FRONT,
ADF_BACK,
- ADF_BOTH
+ ADF_BOTH,
+ BATCH
}
public class ScanOptions
@@ -82,6 +83,7 @@ public class ScanOptions
public int paper_height;
public int brightness;
public int contrast;
+ public int page_delay;
}
private class ScanJob
@@ -96,6 +98,7 @@ private class ScanJob
public int page_height;
public int brightness;
public int contrast;
+ public int page_delay;
}
private class Request {}
@@ -945,6 +948,7 @@ public class Scanner
switch (job.type)
{
case ScanType.SINGLE:
+ case ScanType.BATCH:
if (!set_default_option (handle, option, index))
if (!set_constrained_string_option (handle, option, index, flatbed_sources, null))
warning ("Unable to set single page source, please file a bug");
@@ -1040,7 +1044,7 @@ public class Scanner
if (option != null)
{
if (option.type == Sane.ValueType.BOOL)
- set_bool_option (handle, option, index, job.type != ScanType.SINGLE, null);
+ set_bool_option (handle, option, index, (job.type != ScanType.SINGLE) && (job.type != ScanType.BATCH), null);
}
/* Disable compression, we will compress after scanning */
@@ -1291,6 +1295,9 @@ public class Scanner
/* Go back for another page */
if (job.type != ScanType.SINGLE)
{
+ if (job.type == ScanType.BATCH)
+ Thread.usleep (job.page_delay * 1000);
+
page_number++;
pass_number = 0;
notify (new NotifyPageDone (job.id));
@@ -1550,6 +1557,8 @@ public class Scanner
return "ScanType.ADF_BACK";
case ScanType.ADF_BOTH:
return "ScanType.ADF_BOTH";
+ case ScanType.BATCH:
+ return "ScanType.BATCH";
default:
return "%d".printf (type);
}
@@ -1557,10 +1566,10 @@ public class Scanner
public void scan (string? device, ScanOptions options)
{
- debug ("Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%d, type=%s, paper_width=%d, paper_height=%d, brightness=%d, contrast=%d)",
+ debug ("Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%d, type=%s, paper_width=%d, paper_height=%d, brightness=%d, contrast=%d, delay=%dms)",
device != null ? device : "(null)", options.dpi, get_scan_mode_string (options.scan_mode), options.depth,
get_scan_type_string (options.type), options.paper_width, options.paper_height,
- options.brightness, options.contrast);
+ options.brightness, options.contrast, options.page_delay);
var request = new RequestStartScan ();
request.job = new ScanJob ();
request.job.id = job_id++;
@@ -1573,6 +1582,7 @@ public class Scanner
request.job.page_height = options.paper_height;
request.job.brightness = options.brightness;
request.job.contrast = options.contrast;
+ request.job.page_delay = options.page_delay;
request_queue.push (request);
}