diff options
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 |