nuttyartist / notes

Fast and beautiful note-taking app written in C++. Write down your thoughts.
https://notes-foss.com
Mozilla Public License 2.0
3.77k stars 333 forks source link

Fixes panel widths resetting when resizing (fixes #482) #503

Closed zjeffer closed 1 year ago

zjeffer commented 1 year ago

This PR removes the m_noteListWidth and m_nodeTreeWidth variables, as I bypass them entirely. It also adds 2 new boolean settings: isNoteListCollapsed and isTreeCollapsed.

I fixed the resizing issue by using the splitter's setStretchFactor method to 0 for the first two panes, and 1 for the editor pane. Collapsing the 2 panes happens by simply hiding the widgets, using the setHidden() method.

Tested on bspwm with a clean settings file.

guihkx commented 1 year ago

Hiding and restoring panels using the options in the menu is a bit buggy at the moment (tested with the Qt 5 AppImage):

https://user-images.githubusercontent.com/626206/221446655-f53fdcf4-7b43-4e67-8a20-e195c2128a77.mp4


It works just fine using keyboard shortcuts, though.

bjorn commented 1 year ago

If we're just toggling the visibility of those widgets (which I think is a great idea, btw), couldn't we also get rid of the two extra booleans, m_isNoteListCollapsed and m_isTreeCollapsed and just check their isVisible() directly instead?

Also, I think instead of m_splitter->widget(0) we can use the more readable pointers ui->treeView and ui->listView (which could be renamed to foldersTreeView and noteListView for additional clarity.

nuttyartist commented 1 year ago

Hiding and restoring panels using the options in the menu is a bit buggy at the moment (tested with the Qt 5 AppImage):

It works just fine using keyboard shortcuts, though.

Hmm, I think we should fix this before merging...

zjeffer commented 1 year ago

I fixed the bug described by @guihkx.

As for @bjorn's comments, I removed the booleans entirely, but I'm not sure which name I should give the m_splitter.widget(0) and (1) variables. ui->treeView and ui->listView both point to widgets inside of the left and middle pane, not the left and middle pane themselves. For example, hiding the ui->listView would only hide the note list itself, but keep the "All notes" rectangle with search bar visible.

What should I call these left and middle panes?

bjorn commented 1 year ago

ui->treeView and ui->listView both point to widgets inside of the left and middle pane, not the left and middle pane themselves.

Ah, sorry I missed that part.

What should I call these left and middle panes?

Maybe something like foldersWidget and noteListWidget then.

zjeffer commented 1 year ago

Rebased to master and we're now setting m_foldersWidget and m_noteListWidget to ui->frameLeft and ui->frameMiddle, respectively. Thanks taking the time to review.

nuttyartist commented 1 year ago

Awesome, thanks! 👍