@@ -28,20 +28,25 @@ import RON.Storage.FS qualified as Storage
2828import FF (fromRgaM , viewNote )
2929import FF.Types (
3030 Entity (.. ),
31- Note (Note , note_text ),
31+ Note (.. ),
3232 NoteId ,
3333 View (NoteView , note ),
3434 loadNote ,
3535 )
3636
3737-- package
38+ import FF.Qt.DateComponent (DateComponent )
3839import FF.Qt.DateComponent qualified as DateComponent
3940
4041data TaskWidget = TaskWidget
4142 { super :: QScrollArea
4243 , frame :: QFrame
43- , label :: QLabel
44+ -- ^ widget inside the scroll area
45+ , textLabel :: QLabel
46+ -- ^ label for the text
4447 , storage :: Storage. Handle
48+ , start :: DateComponent
49+ , end :: DateComponent
4550 }
4651
4752new :: Storage. Handle -> IO TaskWidget
@@ -51,29 +56,31 @@ new storage = do
5156 frame <- QFrame. new
5257 QScrollArea. setWidget super frame
5358
54- label <- QLabel. new
55- QWidget. setSizePolicy label
59+ textLabel <- QLabel. new
60+ QWidget. setSizePolicy textLabel
5661 =<< makeSimpleSizePolicy QSizePolicy. MinimumExpanding
57- QLabel. setAlignment label AlignTop
58- QLabel. setWordWrap label True
62+ QLabel. setAlignment textLabel AlignTop
63+ QLabel. setWordWrap textLabel True
5964
6065 start <- DateComponent. new " Start:"
6166 end <- DateComponent. new " Deadline:"
6267
6368 box <- QVBoxLayout. newWithParent frame
64- QBoxLayout. addWidget box label
69+ QBoxLayout. addWidget box textLabel
6570 QBoxLayout. addLayout box start. super
6671 QBoxLayout. addLayout box end. super
6772
68- pure TaskWidget {super, frame, label , storage}
73+ pure TaskWidget {super, frame, textLabel , storage, start, end }
6974
7075update :: TaskWidget -> NoteId -> IO ()
71- update TaskWidget {frame, label, storage} noteId = do
72- Entity {entityVal} <- runStorage storage $ loadNote noteId >>= viewNote
76+ update this noteId = do
77+ Entity {entityVal} <- runStorage this . storage $ loadNote noteId >>= viewNote
7378 let NoteView {note} = entityVal
74- let Note {note_text} = note
75- QLabel. setText label $ fromRgaM note_text
76- QWidget. adjustSize frame
79+ let Note {note_text, note_start, note_end} = note
80+ QLabel. setText this. textLabel $ fromRgaM note_text
81+ DateComponent. setDate this. start note_start
82+ DateComponent. setDate this. end note_end
83+ QWidget. adjustSize this. frame
7784
7885makeSimpleSizePolicy :: QSizePolicyPolicy -> IO QSizePolicy
7986makeSimpleSizePolicy policy =
0 commit comments