Remember Project Tree View "Show Hidden Files" state between sessions.

This commit is contained in:
Martín Lucas Golini
2026-08-11 20:01:36 -03:00
parent 6ba7de31d5
commit 953b0ecb03
4 changed files with 16 additions and 8 deletions
+7 -2
View File
@@ -590,7 +590,8 @@ json AppConfig::saveNode( Node* node ) {
void AppConfig::saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
const std::string& configPath, const ProjectConfig& docConfig,
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
bool sessionSnapshot, PluginManager* pluginManager ) {
bool sessionSnapshot, bool showHiddenFiles,
PluginManager* pluginManager ) {
FileSystem::dirAddSlashAtEnd( projectFolder );
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
if ( !FileSystem::fileExists( projectsPath ) )
@@ -599,6 +600,7 @@ void AppConfig::saveProject( std::string projectFolder, UICodeEditorSplitter* ed
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
IniFile cfg( projectCfgPath, false );
cfg.setValue( "path", "folder_path", projectFolder );
cfg.setValueB( "project_tree", "show_hidden_files", showHiddenFiles );
cfg.setValueB( "document", "use_global_settings", docConfig.useGlobalSettings );
cfg.setValue( "document", "h_ext_language_type",
HExtLanguageTypeHelper::toString( docConfig.hExtLanguageType ) );
@@ -873,14 +875,17 @@ void AppConfig::loadDocuments( UICodeEditorSplitter* editorSplitter, json j,
void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
const std::string& configPath, ProjectConfig& docConfig,
ecode::App* app, bool sessionSnapshot, PluginManager* pluginManager ) {
ecode::App* app, bool sessionSnapshot, bool& showHiddenFiles,
PluginManager* pluginManager ) {
FileSystem::dirAddSlashAtEnd( projectFolder );
std::string projectsPath( configPath + "projects" + FileSystem::getOSSlash() );
MD5::Result hash = MD5::fromString( projectFolder );
std::string projectCfgPath( projectsPath + hash.toHexString() + ".cfg" );
showHiddenFiles = false;
if ( !FileSystem::fileExists( projectCfgPath ) )
return;
IniFile cfg( projectCfgPath );
showHiddenFiles = cfg.getValueB( "project_tree", "show_hidden_files", false );
docConfig.useGlobalSettings = cfg.getValueB( "document", "use_global_settings", true );
+2 -2
View File
@@ -333,11 +333,11 @@ class AppConfig {
void saveProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
const std::string& configPath, const ProjectConfig& docConfig,
const ProjectBuildConfiguration& buildConfig, bool onlyIfNeeded,
bool sessionSnapshot, PluginManager* );
bool sessionSnapshot, bool showHiddenFiles, PluginManager* );
void loadProject( std::string projectFolder, UICodeEditorSplitter* editorSplitter,
const std::string& configPath, ProjectConfig& docConfig, ecode::App* app,
bool sessionSnapshot, PluginManager* pluginManager );
bool sessionSnapshot, bool& showHiddenFiles, PluginManager* pluginManager );
void addTabWidgetType( const std::string& type, TabWidgetCbs tabWidget ) {
Lock l( tabWidgetTypesMutex );
+6 -4
View File
@@ -2260,7 +2260,7 @@ void App::saveProject( bool onlyIfNeeded, bool sessionSnapshotEnabled ) {
mCurrentProject, mSplitter, mConfigPath, mProjectDocConfig,
mProjectBuildManager ? mProjectBuildManager->getConfig() : ProjectBuildConfiguration(),
onlyIfNeeded, sessionSnapshotEnabled && mConfig.workspace.sessionSnapshot,
mPluginManager.get() );
mShowHiddenFiles, mPluginManager.get() );
}
}
@@ -3685,11 +3685,12 @@ void App::openAllFilesInFolder( const FileInfo& folder ) {
}
void App::toggleHiddenFiles() {
mShowHiddenFiles = !mShowHiddenFiles;
mFileSystemModel = FileSystemModel::New( mFileSystemModel->getRootPath(),
FileSystemModel::Mode::FilesAndDirectories,
{ true,
true,
!mFileSystemModel->getDisplayConfig().ignoreHidden,
!mShowHiddenFiles,
{},
[this]( const std::string& filePath ) -> bool {
return isFileVisibleInTreeView( filePath );
@@ -4223,7 +4224,8 @@ void App::loadFolder( std::string path, bool forceNewWindow ) {
mProjectBuildManager =
std::make_unique<ProjectBuildManager>( rpath, mThreadPool, mSidePanel, this );
mConfig.loadProject( rpath, mSplitter, mConfigPath, mProjectDocConfig, this,
mConfig.workspace.sessionSnapshot, mPluginManager.get() );
mConfig.workspace.sessionSnapshot, mShowHiddenFiles,
mPluginManager.get() );
Log::info( "Load project took: %.2f ms", projClock.getElapsedTime().asMilliseconds() );
loadFileSystemMatcher( rpath );
@@ -4231,7 +4233,7 @@ void App::loadFolder( std::string path, bool forceNewWindow ) {
mFileSystemModel = FileSystemModel::New( rpath, FileSystemModel::Mode::FilesAndDirectories,
{ true,
true,
true,
!mShowHiddenFiles,
{},
[this]( const std::string& filePath ) -> bool {
return isFileVisibleInTreeView( filePath );
+1
View File
@@ -728,6 +728,7 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
std::shared_ptr<GitIgnoreMatcher> mFileSystemMatcher;
size_t mMenuIconSize{ 16 };
bool mDirTreeReady{ false };
bool mShowHiddenFiles{ false };
bool mUseFrameBuffer{ false };
bool mBenchmarkMode{ false };
bool mDisablePlugins{ false };