-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Open
christianclavet
wants to merge
2
commits into
cyanfish:master
Choose a base branch
from
christianclavet:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| 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.LoadFromNaps2 }; | ||
| _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.loadFromNaps2; | ||
| 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.loadFromNaps2 | ||
| : 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 | ||
| }; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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)
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.
Changed.