Skip to content

Commit 1b3085a

Browse files
committed
Readme note and popup warning for encore -> ch
1 parent 8b6817e commit 1b3085a

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

Diff for: haskell/packages/onyx-exe-toolkit/src/Onyx/GUI.hs

+20-2
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,7 @@ data QuickFoFTask
24202420
= QFoFInPlace
24212421
| QFoFKeepOriginal
24222422
| QFoFDeleteOriginal
2423+
deriving (Eq)
24232424

24242425
pageQuickConvertCH
24252426
:: (?preferences :: Preferences)
@@ -2536,7 +2537,15 @@ pageQuickConvertCH sink rect tab startTasks = mdo
25362537
FL.setCallback btnGo $ \_ -> do
25372538
qfofs <- readMVar loadedFiles
25382539
transform <- getTransform
2539-
let warningText = "This will modify the selected songs, and the old versions will be deleted."
2540+
let warningText = T.unlines $ concat
2541+
[ ["This will modify the selected songs, and the old versions will be deleted."]
2542+
, do
2543+
guard $ any (\qfof -> qfof.format == FoFEncore) qfofs
2544+
[ ""
2545+
, "WARNING: This will convert Encore-format songs into CH-compatible ones, removing the original files."
2546+
, "Select a different mode if you want to keep them."
2547+
]
2548+
]
25402549
FL.flChoice warningText "Cancel" (Just "Start") Nothing >>= \case
25412550
1 -> sink $ EventOnyx $ do
25422551
-- TODO this is a hack to avoid stale .sng references after editing them.
@@ -2549,7 +2558,7 @@ pageQuickConvertCH sink rect tab startTasks = mdo
25492558
stackIO $ case qfof.format of
25502559
FoFFormat FoFFolder -> saveQuickFoFFolder loc qfof
25512560
FoFFormat FoFSNG -> fillRequiredMetadata qfof >>= saveQuickFoFSNG loc
2552-
FoFEncore -> saveQuickFoFFolder loc qfof -- TODO forbid this!
2561+
FoFEncore -> saveQuickFoFFolder loc qfof
25532562
return [loc]
25542563
in (loc, task)
25552564
_ -> return ()
@@ -2561,17 +2570,26 @@ pageQuickConvertCH sink rect tab startTasks = mdo
25612570
then QFoFInPlace
25622571
else if deleteOriginals then QFoFDeleteOriginal else QFoFKeepOriginal
25632572
return (qfof, fin, task, fout)
2573+
promptTasks :: [(QuickFoF, FilePath, QuickFoFTask, FilePath)] -> IO () -> IO ()
25642574
promptTasks tasks f = let
25652575
numInPlace = length [ () | (_, _, QFoFInPlace , _) <- tasks ]
25662576
numKeepOriginal = length [ () | (_, _, QFoFKeepOriginal , _) <- tasks ]
25672577
numDeleteOriginal = length [ () | (_, _, QFoFDeleteOriginal, _) <- tasks ]
2578+
numDeleteEncore = length $ do
2579+
(qfof, _, task, _) <- tasks
2580+
guard $ qfof.format == FoFEncore
2581+
guard $ elem task [QFoFInPlace, QFoFDeleteOriginal]
2582+
return ()
25682583
numSongs 1 = "1 song"
25692584
numSongs n = T.pack (show n) <> " songs"
25702585
warningText = T.unlines $ concat
25712586
[ ["Based on the filename template, these operations will be performed:"]
25722587
, guard (numInPlace /= 0) >> ["- " <> numSongs numInPlace <> " will be overwritten with new versions"]
25732588
, guard (numKeepOriginal /= 0) >> ["- " <> numSongs numKeepOriginal <> " will be converted to new versions"]
25742589
, guard (numDeleteOriginal /= 0) >> ["- " <> numSongs numDeleteOriginal <> " will be converted to new versions, and the old versions will be deleted"]
2590+
, do
2591+
guard $ numDeleteEncore /= 0
2592+
["", "WARNING: Some Encore-format songs will be removed/replaced by CH-compatible ones"]
25752593
]
25762594
in FL.flChoice warningText "Cancel" (Just "Start") Nothing >>= \case
25772595
1 -> f

Diff for: haskell/readme/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ <h2 id="quick-convert">Quick Convert</h2>
588588
<li>Convert between folder and <code>.sng</code> formats</li>
589589
<li>Reencode audio from other formats to .ogg or .opus</li>
590590
<li>Convert .chart files to MIDI</li>
591+
<li>Convert from Encore format to CH-compatible folder or <code>.sng</code></li>
591592
</ul>
592593
<p>Songs can be modified in place, or new folders or <code>.sng</code> files can be created via a filename template.</p>
593594
</li>

0 commit comments

Comments
 (0)