Clean up todos

This commit is contained in:
Ben Olden-Cooligan 2022-12-29 21:50:10 -08:00
parent 334295c538
commit 671a3a4b28
19 changed files with 2 additions and 86 deletions

View File

@ -1,44 +0,0 @@
// using System.Drawing;
// using System.Drawing.Imaging;
//
// namespace NAPS2.Images.Gdi;
//
// public class GdiConverters
// {
// [StorageConverter]
// public FileStorage ConvertToFile(GdiImage input, StorageConvertParams convertParams)
// {
// if (convertParams.Temporary)
// {
// var path = Path.Combine(Paths.Temp, Path.GetRandomFileName());
// input.Bitmap.Save(path);
// return new FileStorage(path);
// }
// else
// {
// var tempPath = ScannedImageHelper.SaveSmallestBitmap(input.Bitmap, convertParams.BitDepth, convertParams.Lossless, convertParams.LossyQuality, out ImageFormat fileFormat);
// string ext = Equals(fileFormat, ImageFormat.Png) ? ".png" : ".jpg";
// var path = _imageContext.FileStorageManager.NextFilePath() + ext;
// File.Move(tempPath, path);
// return new FileStorage(path);
// }
// }
//
// [StorageConverter]
// public GdiImage ConvertToGdi(FileStorage input, StorageConvertParams convertParams)
// {
// // TODO: Allow multiple converters (with priority?) and fall back to the next if it returns null
// // Then we can have a PDF->Image converter that returns null if it's not a pdf file.
// if (IsPdfFile(input))
// {
// return (GdiImage)_imageContext.PdfRenderer.Render(input.FullPath, 300).Single();
// }
// else
// {
// return new GdiImage(new Bitmap(input.FullPath));
// }
// }
//
// private static bool IsPdfFile(FileStorage fileStorage) => Path.GetExtension(fileStorage.FullPath)?.Equals(".pdf", StringComparison.InvariantCultureIgnoreCase) ?? false;
//
// }

View File

@ -89,7 +89,4 @@ internal static class LibTiff
[DllImport("libtiff.so.5")]
public static extern int TIFFReadRGBAImageOriented(
IntPtr tiff, int w, int h, IntPtr raster, int orientation, int stopOnError);
// TODO: For streams
// https://linux.die.net/man/3/tiffclientopen
}

View File

@ -87,7 +87,6 @@ internal class LibTiffIo : ITiffWriter
LibTiff.TIFFSetField(tiff, TiffTag.ImageWidth, image.Width);
LibTiff.TIFFSetField(tiff, TiffTag.ImageHeight, image.Height);
LibTiff.TIFFSetField(tiff, TiffTag.PlanarConfig, 1);
// TODO: Test setting g4 compression when it's not a BW image
LibTiff.TIFFSetField(tiff, TiffTag.Compression, (int) (compression switch
{
TiffCompressionType.Ccitt4 => TiffCompression.G4,

View File

@ -2,7 +2,6 @@
namespace NAPS2.Images.Mac;
// TODO: We might need to dispose things more aggressively
public class MacImage : IMemoryImage
{
public MacImage(ImageContext imageContext, NSImage image)

View File

@ -11,7 +11,6 @@ public class MacImageContext : ImageContext
public MacImageContext(IPdfRenderer? pdfRenderer = null) : base(typeof(MacImage), pdfRenderer)
{
// TODO: Not sure if this is truly thread safe.
NSApplication.CheckForIllegalCrossThreadCalls = false;
_imageTransformer = new MacImageTransformer(this);
}

View File

@ -43,8 +43,6 @@ public static class GtkEntryPoint
application.UnhandledException += UnhandledException;
var formFactory = container.Resolve<IFormFactory>();
var desktop = formFactory.Create<DesktopForm>();
// TODO: Clean up invoker setting
// Invoker.Current = new WinFormsInvoker(desktop.ToNative());
application.Run(desktop);
return 0;
}

View File

@ -53,11 +53,6 @@ public class GtkListView<T> : IListView<T> where T : notnull
public int ImageSize { get; set; }
// TODO: Properties here vs on behavior?
public bool AllowDrag { get; set; }
public bool AllowDrop { get; set; }
public ScrolledWindow NativeControl => _scrolledWindow;
public Control Control => _scrolledWindow.ToEto();

View File

@ -31,7 +31,6 @@ public class MacIconProvider : IIconProvider
{ "contrast_high", "circle.righthalf.filled" },
{ "sharpen", "rhombus" },
{ "cross", "trash" },
// TODO: Probably just use the save icon for these
{ "file_extension_pdf", "doc.richtext" },
{ "pictures", "photo" }
};

View File

@ -8,7 +8,6 @@ using NAPS2.WinForms;
namespace NAPS2.Scan.Twain.Legacy;
// TODO: Either make this usable without a form, or just get rid of it...
internal static class TwainApi
{
public static ScanDevice? SelectDeviceUI()

View File

@ -22,15 +22,8 @@ public class ConsoleOperationProgress : OperationProgress
public override void ShowModalProgress(IOperation op)
{
// TODO: We might want to use an eto-based progress form, or at least show some kind of indicator
// TODO: We might want to show some kind of indicator
// Where is this method called from anyway?
// if (!op.IsFinished)
// {
// var form = _formFactory.Create<FProgress>();
// form.Operation = op;
// form.ShowDialog();
// }
op.Wait();
}

View File

@ -9,8 +9,6 @@ using NAPS2.Scan.Batch;
namespace NAPS2.Config;
// TODO: Remove all unnecessary nullables
// TODO: Maybe have this serialize with the root node named as AppConfig/UserConfig somehow?
[Config]
public class CommonConfig
{

View File

@ -10,12 +10,6 @@ using NAPS2.Update;
namespace NAPS2.EtoForms.Desktop;
// TODO: We undoubtedly want to decompose this file even further.
// We almost certainly want a DesktopScanController for the scanning-related logic.
// We could have a DesktopPipesController that depends on DesktopScanController.
// Specifically each line in Initialize might make sense as a sub-controller.
// We also need to think about how to pass the Form instance around as needed. (e.g. to Activate it). Maybe this should be something injectable, and could also be used by UpdateOperation instead of searching through open forms.
// i.e. (I)DesktopFormProvider
public class DesktopController
{
private readonly ScanningContext _scanningContext;
@ -165,7 +159,6 @@ public class DesktopController
{
try
{
// TODO: Figure out and fix undisposed processed images
_scanningContext.Dispose();
_recoveryStorageManager.Dispose();
}
@ -263,7 +256,7 @@ public class DesktopController
{
// TODO: xplat
var formOnTop = Application.Instance.Windows.Last();
if (formOnTop.WindowState == WindowState.Minimized)
if (formOnTop.WindowState == WindowState.Minimized && PlatformCompat.System.CanUseWin32)
{
Win32.ShowWindow(formOnTop.NativeHandle, Win32.ShowWindowCommands.Restore);
}

View File

@ -103,7 +103,6 @@ public class DesktopKeyboardShortcuts
private string? GetProfileShortcut(int i)
{
// TODO: Granular
var ks = _config.Get(c => c.KeyboardShortcuts);
switch (i)
{

View File

@ -4,7 +4,6 @@ public interface IFormBase
{
FormStateController FormStateController { get; }
// TODO: Make these constructor injected, Eto requires things to be defined in the constructor so property injection is error-prone
IFormFactory FormFactory { get; set; }
Naps2Config Config { get; set; }

View File

@ -85,7 +85,6 @@ public class BatchScanForm : EtoDialogBase
private void UpdateVisibility(object? sender, EventArgs e)
{
// TODO: Bundle multiple updates together before invalidating somehow
_delayVis.IsVisible = _multipleScansDelay.Checked;
_multiVis.IsVisible = _saveToMultipleFiles.Checked;
_fileVis.IsVisible = _saveToSingleFile.Checked || _saveToMultipleFiles.Checked;

View File

@ -453,7 +453,6 @@ public abstract class DesktopForm : EtoFormBase
private void OnKeyDown(object? sender, KeyEventArgs e)
{
// TODO: The custom listview control isn't propagating events back to the parent window
e.Handled = _keyboardShortcuts.Perform(e.KeyData);
}

View File

@ -467,8 +467,6 @@ public class EditProfileForm : EtoDialogBase
_advanced.Enabled = !locked;
// TODO: Adjust form height?
_suppressChangeEvent = false;
}
}

View File

@ -1,6 +1,5 @@
namespace NAPS2.ImportExport.Images;
// TODO: Cross-platform TIFF
public class SaveImagesOperation : OperationBase
{
private readonly IOverwritePrompt _overwritePrompt;

View File

@ -273,10 +273,8 @@ public class BatchScanPerformer : IBatchScanPerformer
{
subPath = placeholders.Substitute(subPath, true, 0, 1);
}
// TODO: Make copies of images and dispose
try
{
// TODO: This is broken due to not accessing the child fields directly
var exportParams = new PdfExportParams(
_config.Get(c => c.PdfSettings.Metadata),
_config.Get(c => c.PdfSettings.Encryption),