Remove the "show all tool" config

We show all tools at the moment anyway.
This commit is contained in:
Julian Ospald 2023-11-18 18:55:06 +08:00
parent d277e56121
commit 2caf491e9d
No known key found for this signature in database
GPG Key ID: 4275CDA6A29BED43
4 changed files with 14 additions and 37 deletions

View File

@ -89,9 +89,6 @@ notInstalledSign = "X "
notInstalledSign = "" notInstalledSign = ""
#endif #endif
hiddenTools :: [Tool]
hiddenTools = []
data BrickData = BrickData data BrickData = BrickData
{ lr :: [ListResult] { lr :: [ListResult]
@ -100,7 +97,6 @@ data BrickData = BrickData
data BrickSettings = BrickSettings data BrickSettings = BrickSettings
{ showAllVersions :: Bool { showAllVersions :: Bool
, showAllTools :: Bool
} }
deriving Show deriving Show
@ -134,19 +130,14 @@ keyHandlers KeyBindings {..} =
, ( bShowAllVersions , ( bShowAllVersions
, \BrickSettings {..} -> , \BrickSettings {..} ->
if showAllVersions then "Don't show all versions" else "Show all versions" if showAllVersions then "Don't show all versions" else "Show all versions"
, hideShowHandler (not . showAllVersions) showAllTools , hideShowHandler (not . showAllVersions)
)
, ( bShowAllTools
, \BrickSettings {..} ->
if showAllTools then "Don't show all tools" else "Show all tools"
, hideShowHandler showAllVersions (not . showAllTools)
) )
, (bUp, const "Up", \BrickState {..} -> put BrickState{ appState = moveCursor 1 appState Up, .. }) , (bUp, const "Up", \BrickState {..} -> put BrickState{ appState = moveCursor 1 appState Up, .. })
, (bDown, const "Down", \BrickState {..} -> put BrickState{ appState = moveCursor 1 appState Down, .. }) , (bDown, const "Down", \BrickState {..} -> put BrickState{ appState = moveCursor 1 appState Down, .. })
] ]
where where
hideShowHandler f p BrickState{..} = hideShowHandler f BrickState{..} =
let newAppSettings = appSettings { showAllVersions = f appSettings , showAllTools = p appSettings } let newAppSettings = appSettings { showAllVersions = f appSettings }
newInternalState = constructList appData newAppSettings (Just appState) newInternalState = constructList appData newAppSettings (Just appState)
in put (BrickState appData newAppSettings newInternalState appKeys) in put (BrickState appData newAppSettings newInternalState appKeys)
@ -411,8 +402,7 @@ constructList :: BrickData
-> Maybe BrickInternalState -> Maybe BrickInternalState
-> BrickInternalState -> BrickInternalState
constructList appD appSettings = constructList appD appSettings =
replaceLR (filterVisible (showAllVersions appSettings) replaceLR (filterVisible (showAllVersions appSettings))
(showAllTools appSettings))
(lr appD) (lr appD)
listSelectedElement' :: BrickInternalState -> Maybe (Int, ListResult) listSelectedElement' :: BrickInternalState -> Maybe (Int, ListResult)
@ -443,22 +433,15 @@ replaceLR filterF lr s =
lTool e1 == lTool e2 && lVer e1 == lVer e2 && lCross e1 == lCross e2 lTool e1 == lTool e2 && lVer e1 == lVer e2 && lCross e1 == lCross e2
filterVisible :: Bool -> Bool -> ListResult -> Bool filterVisible :: Bool -> ListResult -> Bool
filterVisible v t e | lInstalled e = True filterVisible v e | lInstalled e = True
| v | v
, not t , Nightly `notElem` lTag e = True
, Nightly `notElem` lTag e | not v
, lTool e `notElem` hiddenTools = True , Old `notElem` lTag e
| not v , Nightly `notElem` lTag e = True
, t | otherwise = (Old `notElem` lTag e) &&
, Old `notElem` lTag e (Nightly `notElem` lTag e)
, Nightly `notElem` lTag e = True
| v
, Nightly `notElem` lTag e
, t = True
| otherwise = (Old `notElem` lTag e) &&
(Nightly `notElem` lTag e) &&
(lTool e `notElem` hiddenTools)
install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m) install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m)
@ -712,7 +695,7 @@ brickMain s = do
defaultAppSettings :: BrickSettings defaultAppSettings :: BrickSettings
defaultAppSettings = BrickSettings { showAllVersions = False, showAllTools = False } defaultAppSettings = BrickSettings { showAllVersions = False }
getGHCupInfo :: IO (Either String GHCupInfo) getGHCupInfo :: IO (Either String GHCupInfo)

View File

@ -107,7 +107,6 @@ toSettings options = do
, bSet = fromMaybe bSet kSet , bSet = fromMaybe bSet kSet
, bChangelog = fromMaybe bChangelog kChangelog , bChangelog = fromMaybe bChangelog kChangelog
, bShowAllVersions = fromMaybe bShowAllVersions kShowAll , bShowAllVersions = fromMaybe bShowAllVersions kShowAll
, bShowAllTools = fromMaybe bShowAllTools kShowAllTools
} }

View File

@ -149,7 +149,6 @@ updateSettings usl usr =
, kSet = kSet kbl <|> kSet kbr , kSet = kSet kbl <|> kSet kbr
, kChangelog = kChangelog kbl <|> kChangelog kbr , kChangelog = kChangelog kbl <|> kChangelog kbr
, kShowAll = kShowAll kbl <|> kShowAll kbr , kShowAll = kShowAll kbl <|> kShowAll kbr
, kShowAllTools = kShowAllTools kbl <|> kShowAllTools kbr
} }

View File

@ -422,7 +422,6 @@ fromSettings Settings{..} (Just KeyBindings{..}) =
, kSet = Just bSet , kSet = Just bSet
, kChangelog = Just bChangelog , kChangelog = Just bChangelog
, kShowAll = Just bShowAllVersions , kShowAll = Just bShowAllVersions
, kShowAllTools = Just bShowAllTools
} }
in UserSettings { in UserSettings {
uCache = Just cache uCache = Just cache
@ -449,7 +448,6 @@ data UserKeyBindings = UserKeyBindings
, kSet :: Maybe KeyCombination , kSet :: Maybe KeyCombination
, kChangelog :: Maybe KeyCombination , kChangelog :: Maybe KeyCombination
, kShowAll :: Maybe KeyCombination , kShowAll :: Maybe KeyCombination
, kShowAllTools :: Maybe KeyCombination
} }
deriving (Show, GHC.Generic, Eq) deriving (Show, GHC.Generic, Eq)
@ -462,7 +460,6 @@ data KeyBindings = KeyBindings
, bSet :: KeyCombination , bSet :: KeyCombination
, bChangelog :: KeyCombination , bChangelog :: KeyCombination
, bShowAllVersions :: KeyCombination , bShowAllVersions :: KeyCombination
, bShowAllTools :: KeyCombination
} }
deriving (Show, GHC.Generic) deriving (Show, GHC.Generic)
@ -485,7 +482,6 @@ defaultKeyBindings = KeyBindings
, bSet = KeyCombination { key = KChar 's', mods = [] } , bSet = KeyCombination { key = KChar 's', mods = [] }
, bChangelog = KeyCombination { key = KChar 'c', mods = [] } , bChangelog = KeyCombination { key = KChar 'c', mods = [] }
, bShowAllVersions = KeyCombination { key = KChar 'a', mods = [] } , bShowAllVersions = KeyCombination { key = KChar 'a', mods = [] }
, bShowAllTools = KeyCombination { key = KChar 't', mods = [] }
} }
data AppState = AppState data AppState = AppState