Skip to content

Commit

Permalink
top menu and polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sigrdrifa committed Dec 1, 2023
1 parent 8b34bfe commit 34c0452
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
*_enc.wav

test/corpus/lol.wav
test/output/*.wav
Expand Down
8 changes: 4 additions & 4 deletions csrc/resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ static const SECTION union { const guint8 data[16201]; const double alignment; v
"\040\151\144\075\042\157\165\164\160\165\164\137\163\143\162\157"
"\154\154\145\144\137\167\151\156\144\157\167\042\076\074\160\162"
"\157\160\145\162\164\171\040\156\141\155\145\075\042\150\145\151"
"\147\150\164\055\162\145\161\165\145\163\164\042\076\061\063\065"
"\147\150\164\055\162\145\161\165\145\163\164\042\076\061\065\060"
"\074\057\160\162\157\160\145\162\164\171\076\074\143\150\151\154"
"\144\076\074\157\142\152\145\143\164\040\143\154\141\163\163\075"
"\042\107\164\153\124\145\170\164\126\151\145\167\042\040\151\144"
Expand Down Expand Up @@ -708,7 +708,7 @@ static const SECTION union { const guint8 data[16201]; const double alignment; v
"\143\154\141\163\163\075\042\107\164\153\114\141\142\145\154\042"
"\076\074\160\162\157\160\145\162\164\171\040\156\141\155\145\075"
"\042\154\141\142\145\154\042\040\164\162\141\156\163\154\141\164"
"\141\142\154\145\075\042\164\162\165\145\042\076\105\156\143\157"
"\141\142\154\145\075\042\164\162\165\145\042\076\104\145\143\157"
"\144\145\162\040\163\145\164\164\151\156\147\163\074\057\160\162"
"\157\160\145\162\164\171\076\074\163\164\171\154\145\076\074\143"
"\154\141\163\163\040\156\141\155\145\075\042\164\151\164\154\145"
Expand All @@ -719,7 +719,7 @@ static const SECTION union { const guint8 data[16201]; const double alignment; v
"\162\157\160\145\162\164\171\040\156\141\155\145\075\042\154\141"
"\142\145\154\042\040\164\162\141\156\163\154\141\164\141\142\154"
"\145\075\042\164\162\165\145\042\076\103\157\156\146\151\147\165"
"\162\145\040\164\150\145\040\145\156\143\157\144\145\162\040\163"
"\162\145\040\164\150\145\040\144\145\143\157\144\145\162\040\163"
"\145\164\164\151\156\147\163\040\164\157\040\165\163\145\074\057"
"\160\162\157\160\145\162\164\171\076\074\057\157\142\152\145\143"
"\164\076\074\057\143\150\151\154\144\076\074\143\150\151\154\144"
Expand Down Expand Up @@ -989,7 +989,7 @@ static const SECTION union { const guint8 data[16201]; const double alignment; v
"\151\144\075\042\157\165\164\160\165\164\137\163\143\162\157\154"
"\154\145\144\137\167\151\156\144\157\167\042\076\074\160\162\157"
"\160\145\162\164\171\040\156\141\155\145\075\042\150\145\151\147"
"\150\164\055\162\145\161\165\145\163\164\042\076\061\063\065\074"
"\150\164\055\162\145\161\165\145\163\164\042\076\061\065\060\074"
"\057\160\162\157\160\145\162\164\171\076\074\143\150\151\154\144"
"\076\074\157\142\152\145\143\164\040\143\154\141\163\163\075\042"
"\107\164\153\124\145\170\164\126\151\145\167\042\040\151\144\075"
Expand Down
18 changes: 15 additions & 3 deletions gui/MainWindow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import View.EncodeView
, updateEncodeViewAudioFileLoaded
)
import View.LoadView (LoadView(..), initLoadView)
import GI.Gio (MenuItem(..), menuItemSetLabel)
import qualified GI.Gio as Gtk

data MainWindow =
MainWindow
Expand Down Expand Up @@ -87,17 +89,27 @@ initMainWindow app state = do
encViewBox
(Just "encode-page")
"Encode"
"mail-send-symbolic"
"sound-wave-symbolic"
Adw.viewStackAddTitledWithIcon
stack
decViewBox
(Just "decode-page")
"Decode"
"mail-send-symbolic"
"sound-wave-alt-symbolic"
viewSwitcherBar <- new Adw.ViewSwitcherBar [#stack := stack]
viewSwitcherTitle <- new Adw.ViewSwitcherTitle [#stack := stack]
headerBar <- new Adw.HeaderBar [#titleWidget := viewSwitcherTitle]
menuBtn <- new Gtk.Button [#iconName := "open-menu-symbolic"]

-- configure top left menu
menuModelItem <- new MenuItem []
menuItemSetLabel menuModelItem (Just $ T.pack "Toggle Light/Dark")
menuModelItemAbout <- new MenuItem []
menuItemSetLabel menuModelItemAbout (Just $ T.pack "About")

menuModel <- new Gtk.Menu []
Gtk.menuAppendItem menuModel menuModelItem
Gtk.menuAppendItem menuModel menuModelItemAbout
menuBtn <- new Gtk.MenuButton [ #menuModel := menuModel, #iconName := "open-menu-symbolic"]
Adw.headerBarPackStart headerBar menuBtn
content.append headerBar
content.append stack
Expand Down
6 changes: 3 additions & 3 deletions gui/View/DecodeView.ui
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
<property name="orientation">1</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="true">Encoder settings</property>
<property name="label" translatable="true">Decoder settings</property>
<style>
<class name="title-4"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="true">Configure the encoder settings to use</property>
<property name="label" translatable="true">Configure the decoder settings to use</property>
</object>
</child>
<child>
Expand Down Expand Up @@ -213,7 +213,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="output_scrolled_window">
<property name="height-request">135</property>
<property name="height-request">150</property>
<child>
<object class="GtkTextView" id="output_textview">
<property name="bottom-margin">12</property>
Expand Down
5 changes: 2 additions & 3 deletions gui/View/EncodeView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ updateEncodeViewAudioFileLoaded appState encodeView = do
let framesBox = framesContainer encodeView
let frames = audioFrames wa

let children = Gtk.widgetGetChildren framesBox

-- Generate the visible frame indicators and append them to the framesBox
mapM_
(\(x, y) -> do
Expand Down Expand Up @@ -157,7 +155,7 @@ onEncodeBtnClicked appState encodeView = do
]
Adw.toastOverlayAddToast (toastOverlay encodeView) toast
pure ()
else if secondsValid == "" || secondsValidInt < 0
else if secondsValid == "" || secondsValidInt < 1
then do
putStrLn "invalid seconds valid"
toast <-
Expand All @@ -170,6 +168,7 @@ onEncodeBtnClicked appState encodeView = do
Adw.toastOverlayAddToast (toastOverlay encodeView) toast
pure ()
else do
putStrLn "valid encoding params"
let textView = outputTextView encodeView
textBuffer <- Gtk.textViewGetBuffer textView
start <- Gtk.textBufferGetEndIter textBuffer
Expand Down
2 changes: 1 addition & 1 deletion gui/View/EncodeView.ui
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="output_scrolled_window">
<property name="height-request">135</property>
<property name="height-request">150</property>
<child>
<object class="GtkTextView" id="output_textview">
<property name="bottom-margin">12</property>
Expand Down

0 comments on commit 34c0452

Please sign in to comment.