diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-25 14:51:38 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-25 14:51:38 -0700 |
commit | 3ced073c900ae0389771b438da3d0584a6dfec63 (patch) | |
tree | ce62f7d1d67e041c61c1cc4e4a87fea224846bb4 /Types | |
parent | 1a48af859360e388c829f78ace708d32131d0a9b (diff) | |
download | sscan-3ced073c900ae0389771b438da3d0584a6dfec63.tar.gz |
types for presets
Diffstat (limited to 'Types')
-rw-r--r-- | Types/Preset.hs | 11 | ||||
-rw-r--r-- | Types/State.hs | 42 |
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 |