Refactor File Model + Sidebar Folder Functionality
This PR encompasses a multitude of changes that stemmed from the refactoring of the file model. The following is an overview of the changes that were made:
- Created a
FileNode
that is essentially a wrapper for aFile
with our own functions. - Most of the logic from
FileModel
was moved intoFileNode
. For example,FileNode
is responsible for creating child files/folders, loading, saving, exporting and more. - Got rid of idea of keeping our
FileNodes
in an array and using an index to keep track of which file is selected. Instead, we now work directly with theFileNode
- Rationale: This idea gets messy when we dynamically add notes to our file structure. Also, it does not translate well to a folder-like structure
- Used
TreeView
as a framework to build the UI of the sidebar. - Integrated the refactored models with all features (unless I missed some when going through the app). Some include: exporting to pdf, saving files, loading files, menu bar actions, etc.
Some features that were added for the sidebar are:
- Got adding new files to specific folders working (the buttons on the top of the sidebar will default to adding new notes for the selected folder - it does nothing if the current selected file is not a folder)
- Added functionality for creating new folders (again only works if the selected file is a folder - doesn't makes sense to add a folder to a file
- Added right-click context menus for adding new files/folders to whatever the user specifies
I will be properly adding styling to the sidebar in the next ticket.
Edited by Joseph Hu