Tracks the directory the user last browsed to and the most-recently opened/saved files, so the next dialog can seed a sensible starting directory and (on platforms without an OS recents list) an in-editor recent-files menu.
More...
#include "donner/editor/FileDialogState.h"
|
| | FileDialogState (std::size_t maxRecents=10) |
| std::optional< std::string > | defaultDirectory (const std::optional< std::string > ¤tFilePath) const |
| | Directory to seed the next dialog with.
|
| void | noteChosenPath (std::string_view path) |
| | Record that the user opened or saved path. Updates the remembered directory and pushes the file to the front of the recents list (de-duplicated, most-recent first, bounded by maxRecents).
|
|
const std::vector< std::string > & | recentFiles () const |
| | Most-recently opened/saved files, newest first.
|
|
const std::optional< std::string > & | lastDirectory () const |
| | Directory remembered from the last chosen file, if any.
|
Tracks the directory the user last browsed to and the most-recently opened/saved files, so the next dialog can seed a sensible starting directory and (on platforms without an OS recents list) an in-editor recent-files menu.
◆ FileDialogState()
| donner::editor::FileDialogState::FileDialogState |
( |
std::size_t | maxRecents = 10 | ) |
|
|
explicit |
- Parameters
-
| maxRecents | Maximum number of remembered recent files. |
◆ defaultDirectory()
| std::optional< std::string > donner::editor::FileDialogState::defaultDirectory |
( |
const std::optional< std::string > & | currentFilePath | ) |
const |
|
nodiscard |
Directory to seed the next dialog with.
Preference order: the directory of the last chosen file, then the parent directory of currentFilePath if one is open, then empty (let the OS pick its own default).
- Parameters
-
| currentFilePath | Path of the document currently open, if any. |
◆ noteChosenPath()
| void donner::editor::FileDialogState::noteChosenPath |
( |
std::string_view | path | ) |
|
Record that the user opened or saved path. Updates the remembered directory and pushes the file to the front of the recents list (de-duplicated, most-recent first, bounded by maxRecents).
Empty paths are ignored.
The documentation for this class was generated from the following file: