-
-
Notifications
You must be signed in to change notification settings - Fork 445
Batch Scanning, added an option to output the images content of NAPS2 from this panel. #696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ public class BatchScanForm : EtoDialogBase | |
| private readonly Button _start = new() { Text = UiStrings.Start }; | ||
| private readonly Button _cancel = new() { Text = UiStrings.Cancel }; | ||
| private readonly DropDownWidget<ScanProfile> _profile = new(); | ||
| private readonly RadioButton _UseExistingImages; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should start with a lowercase letter to match, but also let's rename this to _loadFromNaps2 (and, optionally, you can also rename _load to _loadIntoNaps2)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed. |
||
| private readonly RadioButton _singleScan; | ||
| private readonly RadioButton _multipleScansPrompt; | ||
| private readonly RadioButton _multipleScansDelay; | ||
|
|
@@ -63,6 +64,7 @@ public BatchScanForm(Naps2Config config, DialogHelper dialogHelper, IProfileMana | |
| _batchScanPerformer = batchScanPerformer; | ||
| _errorOutput = errorOutput; | ||
| _singleScan = new RadioButton { Text = UiStrings.SingleScan }; | ||
| _UseExistingImages = new RadioButton(_singleScan) { Text = UiStrings.UseExistingImages }; | ||
| _multipleScansPrompt = new RadioButton(_singleScan) { Text = UiStrings.MultipleScansPrompt }; | ||
| _multipleScansDelay = new RadioButton(_singleScan) { Text = UiStrings.MultipleScansDelay }; | ||
| _load = new RadioButton { Text = UiStrings.LoadIn }; | ||
|
|
@@ -76,9 +78,12 @@ public BatchScanForm(Naps2Config config, DialogHelper dialogHelper, IProfileMana | |
|
|
||
| _start.Click += Start; | ||
| _cancel.Click += Cancel; | ||
| _UseExistingImages.CheckedChanged += UpdateExisting; | ||
| _multipleScansDelay.CheckedChanged += UpdateVisibility; | ||
| _saveToSingleFile.CheckedChanged += UpdateVisibility; | ||
| _saveToSingleFile.CheckedChanged += UpdateExisting; | ||
| _saveToMultipleFiles.CheckedChanged += UpdateVisibility; | ||
| _saveToMultipleFiles.CheckedChanged += UpdateExisting; | ||
|
|
||
| _userTransact = Config.User.BeginTransaction(); | ||
| _transactionConfig = Config.WithTransaction(_userTransact); | ||
|
|
@@ -100,9 +105,23 @@ private void UpdateVisibility(object? sender, EventArgs e) | |
| _delayVis.IsVisible = _multipleScansDelay.Checked; | ||
| _multiVis.IsVisible = _saveToMultipleFiles.Checked; | ||
| _fileVis.IsVisible = _saveToSingleFile.Checked || _saveToMultipleFiles.Checked; | ||
|
|
||
| LayoutController.Invalidate(); | ||
| } | ||
|
|
||
| private void UpdateExisting(object? sender, EventArgs e) | ||
| { | ||
| if (_UseExistingImages.Checked) | ||
| { | ||
| _load.Enabled = false; | ||
| _load.Checked = false; | ||
| } | ||
| else | ||
| { | ||
| _load.Enabled = true; | ||
| } | ||
| } | ||
|
|
||
| public Action<ProcessedImage> ImageCallback { get; set; } = null!; | ||
|
|
||
| private ActionCommand NewProfileCommand { get; } | ||
|
|
@@ -129,12 +148,14 @@ protected override void BuildLayout() | |
| L.GroupBox( | ||
| UiStrings.ScanConfig, | ||
| L.Column( | ||
| _UseExistingImages, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move this to the bottom of the column (below the |
||
| C.Label(UiStrings.ProfileLabel), | ||
| L.Row( | ||
| _profile.AsControl().Scale().NaturalWidth(100), | ||
| C.Button(EditProfileCommand, ButtonImagePosition.Overlay).Width(30), | ||
| C.Button(NewProfileCommand, ButtonImagePosition.Overlay).Width(30) | ||
| ), | ||
|
|
||
| _singleScan, | ||
| _multipleScansPrompt, | ||
| _multipleScansDelay, | ||
|
|
@@ -172,6 +193,16 @@ private void UpdateUIFromSettings() | |
| { | ||
| UpdateProfiles(); | ||
|
|
||
| _UseExistingImages.Checked = _transactionConfig.Get(c => c.BatchSettings.ScanType) == BatchScanType.UseExistingImages; | ||
| if (_UseExistingImages.Checked) | ||
| { | ||
| _load.Enabled = false; | ||
| _load.Checked = false; | ||
| } | ||
| else | ||
| { | ||
| _load.Enabled = true; | ||
| } | ||
| _singleScan.Checked = _transactionConfig.Get(c => c.BatchSettings.ScanType) == BatchScanType.Single; | ||
| _multipleScansPrompt.Checked = | ||
| _transactionConfig.Get(c => c.BatchSettings.ScanType) == BatchScanType.MultipleWithPrompt; | ||
|
|
@@ -195,6 +226,7 @@ private void UpdateUIFromSettings() | |
| _separateByPatchT.Checked = _transactionConfig.Get(c => c.BatchSettings.SaveSeparator) == SaveSeparator.PatchT; | ||
|
|
||
| _filePath.Text = _transactionConfig.Get(c => c.BatchSettings.SavePath); | ||
|
|
||
| } | ||
|
|
||
| private bool ValidateSettings() | ||
|
|
@@ -212,8 +244,11 @@ private bool ValidateSettings() | |
| ? BatchScanType.MultipleWithPrompt | ||
| : _multipleScansDelay.Checked | ||
| ? BatchScanType.MultipleWithDelay | ||
| : _UseExistingImages.Checked ? BatchScanType.UseExistingImages | ||
| : BatchScanType.Single); | ||
|
|
||
|
|
||
|
|
||
| if (_multipleScansDelay.Checked) | ||
| { | ||
| if (!int.TryParse(_numberOfScans.Text, out int scanCount) || scanCount <= 0) | ||
|
|
@@ -330,7 +365,7 @@ private void EnableDisableSettings(bool enabled) | |
| { | ||
| var controls = new Control[] | ||
| { | ||
| _profile.AsControl(), _singleScan, _multipleScansPrompt, _multipleScansDelay, _numberOfScans, | ||
| _profile.AsControl(), _UseExistingImages, _singleScan, _multipleScansPrompt, _multipleScansDelay, _numberOfScans, | ||
| _timeBetweenScans, _load, _saveToSingleFile, _saveToMultipleFiles, _filePerScan, _filePerPage, | ||
| _separateByPatchT, _moreInfo | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary any more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removed. There doesnt seem to have any reference to it.