aboutsummaryrefslogtreecommitdiffhomepage
path: root/Types
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-25 14:51:38 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-25 14:51:38 -0700
commit3ced073c900ae0389771b438da3d0584a6dfec63 (patch)
treece62f7d1d67e041c61c1cc4e4a87fea224846bb4 /Types
parent1a48af859360e388c829f78ace708d32131d0a9b (diff)
downloadsscan-3ced073c900ae0389771b438da3d0584a6dfec63.tar.gz
types for presets
Diffstat (limited to 'Types')
-rw-r--r--Types/Preset.hs11
-rw-r--r--Types/State.hs42
2 files changed, 53 insertions, 0 deletions
diff --git a/Types/Preset.hs b/Types/Preset.hs
new file mode 100644
index 0000000..78f0231
--- /dev/null
+++ b/Types/Preset.hs
@@ -0,0 +1,11 @@
+module Types.Preset where
+
+import qualified Data.Text as T
+
+import Types.State
+
+type PresetToggleKey = Char
+type PresetDesc = T.Text
+type PresetPreset = St -> St
+
+data Preset = Preset PresetToggleKey PresetDesc PresetPreset
diff --git a/Types/State.hs b/Types/State.hs
new file mode 100644
index 0000000..139310d
--- /dev/null
+++ b/Types/State.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Types.State where
+
+import Lens.Micro.TH (makeLenses)
+
+-- | Whether to do colour, grey or b&w scans
+data Colour = Lineart | Greyscale | Colour
+ deriving (Eq, Show)
+
+cycleColour :: Colour -> Colour
+cycleColour Lineart = Greyscale
+cycleColour Greyscale = Colour
+cycleColour Colour = Lineart
+
+-- | Paper size to scan (determines both scanning area and PDF page
+-- size)
+data Paper = A4 | Letter | Photo | Auto
+ deriving (Eq, Show)
+
+cyclePaper :: Paper -> Paper
+cyclePaper A4 = Letter
+cyclePaper Letter = Photo
+cyclePaper Photo = Auto
+cyclePaper Auto = A4
+
+-- | DPI to scan
+type DPI = Int
+
+-- | Application state
+data St =
+ St { _stScanningSession :: Maybe FilePath -- ^ if a session is in
+ -- progress, accmulate
+ -- scans in this dir
+ , _stOCR :: Bool -- ^ whether to use OCRmyPDF
+ , _stColour :: Colour
+ , _stPaper :: Paper
+ , _stDPI :: DPI
+ , _stOutdir :: FilePath -- ^ where to save final PDFs
+ }
+
+makeLenses ''St